Arc Forumnew | comments | leaders | submit | Tyr's commentslogin
3 points by Tyr 4969 days ago | link | parent | on: Problems with Lisp

Reading about his argument against cons, I can't help but compare it to Haskell. In Haskell one can define `data List a = Cons a (List a) | Nil` and use it just like Lisp's cons (ignoring polymorphism for the moment) but one can also define `data TriTree a = Node a (TriTree a) (TriTree a) (TriTree a) | Leaf` and have no difference in speed between getting the first inorder element or the last, which is not possible in Lisps while maintaining the common abstractions, such as being able to map over them like with `fmap (+1) myTriTree` or `fmap (+1) myList`. This might be saying something about the powerfulness of typeclasses more than any weakness of cons, but I still think it is a valid point. The ability to define abstract over the structure of the data while maintaining efficiency is very nice.

-----