On Jun 16, 11:37 am, David Nolen <[email protected]> wrote: > Not possible in Clojure and a source of hassle in Scheme and Common Lisp. > If you have dotted pairs you can never know if you have a proper list.
I'm probably missing some context, but I've heard this argument before and had a hard time understanding it. Clojure is dynamically typed, and you should expect that calling something like 'map with an improper list would blow up just like you would expect this to blow up: user=> (map inc 5) IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:494) With dotted pairs I would expect something like: user=> (map inc '(5 6 . 7))) IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:494) And in Racket you get: > (map (lambda (x) (+ x 1)) 2) map: expects type <proper list> as 2nd argument, given: 2; other arguments were: #<procedure> > (map (lambda (x) (+ x 1)) '(1 . 2)) map: expects type <proper list> as 2nd argument, given: '(1 . 2); other arguments were: #<procedure> I'm not necessarily arguing that Clojure should have dotted pairs. I think something like [1 2] works well as a substitute. Plus Clojure already uses . for other things and the overloading might be confusing. I'm just not sure I understand the typing argument for a dynamically typed language. Paul -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
