4 ms·
You can use the same car, map on any of them as the functions operate on a sequence interface not on cons lists. Whereas in CL these functions are defined dire
by glymor 18y ago
You can use the same car, map on any of them as the functions operate on a sequence interface not on cons lists.
Whereas in CL these functions are defined directly on the implementation (cons lists) so map can't map over a vector you need to make a special vector only map and so on.
- anamax 18y ago> Whereas in CL these functions are defined directly on the implementation (cons lists) so map can't map over a vector you need to make a special vector only map and so on. Wrong. The Common Lisp list functions, such as mapcar, are restricted to lists but Commmon Lisp also has sequence functions which take any Common Lisp sequence type. Common Lisp's map happens to be a sequence function. I forget if hashes are a Common lisp sequence type, but vectors definitely are. IIRC, Common Lisp strings are sequences.
- glymor 18y agomapcar in clojure wouldn't be limited to lists even if no one had though about the it at the time - this is the difference. There's a ton of CL code out there that only works on cons lists, adding a sequence type doesn't solve this nor does it force people to use it or change existing code.
- anamax 18y agoI don't see the option of specialized functions as a bad thing. I also don't see why the existence of code that uses such functions is a bad thing.