Hacker News new | ask | show | jobs
by deckard1 1036 days ago
> Initially, Lisp-style languages had linked lists as the primary data type, but vectors were early added

The Achilles' heel of every Lisp is dealing with any data structure that isn't a linked list. I'm talking aref, setf+aref, vector-ref, vector-set!, char, etc. It's all just a huge pain when compared to any other language (Python, Ruby, JavaScript, Java) that has syntax for arrays, hash maps, strings. Solving the generalized "map" or "length" is really only solving one side of the problem. The other side can't be solved because the language is s-exps and "everything is a function." It would fundamentally cease to be Scheme at that point.

1 comments

I haven't used clojure since forever but I don't think this was particularly problematic. They even had nice literal syntax for different collection types and fairly powerful generalized collection abstractions, way better than the languages you mentioned IMO.
Also Clojure decomplects inheritance and interfaces.

It gives you protocols to define a set of related methods, without any restriction on the underlying data structure.

It gives you defrecord & deftype to define composite associative data structures, which the fields in an object are.

Then you can combine these in various ways, giving you all sorts of polymorphic code.

Clojure even has multimethods for cases, when a single operation should happen different ways, depending on some aspect of an arbitrary data structure. Someone defines a transformation function from arbitrary data to some other data to dispatch behavior over, then anyone can add define behavior for new dispatch values.

Why not copy these approaches?

This approach is already there in Common Lisp, and the biggest flavours that predated it.

I think is the whole point of Scheme community always having been a different set of folks.

In a way, it is like the C versus C++ communities of parenthesis based languages.