Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maps syntax support #75

Open
camshaft opened this issue Jun 17, 2014 · 12 comments
Open

maps syntax support #75

camshaft opened this issue Jun 17, 2014 · 12 comments

Comments

@camshaft
Copy link

it would be great to have maps support built in. maybe something like:

#{:key :value :other-key :other-value}

(let
  (
    map #{:name "joxa" :type :language}
    #{:name name} map)
  (io/format "~p~n" [name])) ;; joxa
@ericbmerritt
Copy link
Contributor

Agreed. Lets put it on the timeline.

@hhkbp2
Copy link
Member

hhkbp2 commented Jun 24, 2014

'(a b :name 12.5)           ;; list
['a 'b :name 12.5]          ;; vector
{:name "Chas" :age 31}      ;; map
#{1 2 3}                   ;; set

I think the collections syntax of clojure is a good reference, though tuple already took the '{}' sytax in Joxa. Using a clojure compatible syntax in Joxa makes it more like Lisp, rather than Erlang.

@camshaft
Copy link
Author

@hhkbp2 Personally, I think the language would be more successful by catering to erlang developers who want a lisp, rather than trying to lure clojure developers with a familiar syntax. At the end of the day we are on the erlang vm, which carries a lot of the same semantics as the erlang language.

@hhkbp2
Copy link
Member

hhkbp2 commented Jun 24, 2014

Yes, Joxa would run on top of Erlang VM, but that doesn't mean it should follow everything(including syntax) in Erlang. If an Erlang developer really want a lisp which looks quite familiar with Erlang, probably he would prefer LFE to Joxa.

In this article Differences Between Joxa and LFE(http://blog.ericbmerritt.com/2012/02/21/differences-between-joxa-and-lfe.html), @ericbmerritt describe Joxa as a Lisp happens to run on Erlang VM. Its syntax would mostly come from clojure/scheme, rather than erlang. That's why Joxa is created even though LFE is already there. And that's why some people like Joxa more than LFE(so do I). So I mentioned the clojure syntax above, though tuple syntax '{}' is from Erlang.

@hhkbp2
Copy link
Member

hhkbp2 commented Jun 24, 2014

Besides map, it would be great to have syntax support for the full set collections in Clojure, such as set, vector, seq. Anyone once knows Clojure would miss these highly consistent collections syntax and operators in Clojure a lot, no matter what other languages he uses from then on. Having them in Joxa would make the language powerful, consistent and handy(easy to use) as a Lisp, even though some collections are already there in Erlang library and open for usage.

@ericbmerritt
Copy link
Contributor

Joxa is Joxa; neither Erlang nor Closure. It has influences from both, of
course, but doesn't try to be either.

The main goal of Joxa is to provide a very simply language that will make a
good basis to build other languages on top of (including itself). One of
its design goals is to build most of itself that way as well. So I while I
have no problem at all with supporting syntax for all the different types.
Those are things I would rather see as libraries that folks can include
into their namespace rather than core parts of the language. That's
actually very doable. There are two things that are needed before that can
happen.

  1. Support for R17 maps
  2. Expose the reader macros in the language syntax

Once we have that, It would make sense to start designing some data
structure libraries an top of it.

Eric

On Mon, Jun 23, 2014 at 11:55 PM, Dylan Wen notifications@github.com
wrote:

Besides map, it would be great to have syntax support for the full set
collections in Clojure, such as set, vector, seq. Anyone once knows Clojure
would miss these highly consistent collections syntax and operators in
Clojure a lot, no matter what other languages he uses from then on. Having
them in Joxa would make the language powerful, consistent and handy(easy to
use) as a Lisp, even though some collections are already there in Erlang
library and open for usage.


Reply to this email directly or view it on GitHub
#75 (comment).

@camshaft
Copy link
Author

yeah that sounds like a great idea. makes it much more flexible.

@robkuz
Copy link

robkuz commented Jul 31, 2014

I guess the only thing we would need is to make the syntax extension a library approach is to hook into the reader. So we need that reader-macros. Here is a nice writeup on it https://gist.github.com/chaitanyagupta/9324402

Btw I completely agree that we should look lean towards Clojure instead of Erlang.

@ericbmerritt
Copy link
Contributor

Right now reader macros are based on peg grammers. Which make them
(arguably) much easier to use. The downside is that the entire parser is
based off peg grammers at the moment. The downside there is speed. The goal
going forward is to convert the current peg based main parser to something
more performant and allow a peg based 'reader macro' system on top of that.
I don't actually find common lisps reader macro system very compelling. It
made sense 40 years ago, but we can do better today.

On Thu, Jul 31, 2014 at 8:07 AM, robertj notifications@github.com wrote:

I guess the only thing we would need is to make the syntax extension a
library approach is to hook into the reader. So we need that reader-macros.
Here is a nice writeup on it
https://gist.github.com/chaitanyagupta/9324402

Btw I completely agree that we should look lean towards Clojure instead of
Erlang.


Reply to this email directly or view it on GitHub
#75 (comment).

@robkuz
Copy link

robkuz commented Jul 31, 2014

Actually my intention wasn't really to push towards a specific implementation but rather, that in generally it seems to be pretty easy to implement a reader macro.

@ericbmerritt
Copy link
Contributor

It is. and all the stuff is there. We just need to surface it to the
language implementation. That is so users of the language, not just the
compiler can use it.

On Thu, Jul 31, 2014 at 8:37 AM, robertj notifications@github.com wrote:

Actually my intention wasn't really to push towards a specific
implementation but rather, that in generally it seems to be pretty easy to
implement a reader macro.


Reply to this email directly or view it on GitHub
#75 (comment).

@ghost
Copy link

ghost commented Jan 26, 2015

I know that this thread is basically dormant but I think recent developments in the 'clojure inspired lisp' space are worth mentioning.
There now exist rhine on LLVM, lambdatron on Apple Swift and pixie on PyPy.
They are all independent languages that draw inspiration from Clojure but vary quite a bit in semantics. Nevertheless they all choose the same "original" clojure syntax as reader macros for their data-structures.

I think it would be worthwhile to fit into that ecosystem, not because of clojure but because of the sum of languages.

I think [] would be the better tuple syntax, especially because it is currently only used for lists like (,
freeing {} up for maps. A clojure vector is also semantically closer to a tuple than a list really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants