swadey / LispSyntax.jl

lisp-like syntax in julia
Other
229 stars 24 forks source link

Make , alias of tuple #10

Closed Ismael-VC closed 6 years ago

Ismael-VC commented 8 years ago

Hy lang uses this:

=> (, 1 2 3)
(1, 2, 3)

currently we do this:

lisp> (tuple 1 2 3)
(1,2,3)

I'm not sure if this conflicts with the backquote syntax:

I think clojure uses ~ am I right?

Ismael-VC commented 8 years ago

Or do you think a literal tuple syntax would be more useful instead?

Ismael-VC commented 8 years ago

What about #(1 2 3)?

Ismael-VC commented 8 years ago

Currently '[1 2 3] and '(1 2 3) are interchangeable, should a possible #(1 2 3) be the same as #[1 2 3]?

swadey commented 8 years ago

This is interesting. Many lisps use # as a reader-macro dispatch character. I think clojure uses this character for reader dispatch and I believe they use #() as an anonymous function dispatch as in #(+ %1 %2) which translates into (fn [a b] (+ a b))

Perhaps we use either the (, _ _) or use tuple dispatch #tuple{} or #tuple() and just properly implement constructor dispatch. The word tuple can be any constructor in that case.

What do you think?

swadey commented 8 years ago

just pushed a version that includes an experimental version of reader dispatch. two further steps would be necessary to support tuples:

  1. tuples have to become first-class iterables
  2. a reader function needs to be attached. I'll do something along this line tomorrow.