hibachrach/ruut

"lisp" format is misleading (doesnt support lisp syntax)

masukomi opened this issue · 8 comments

request:

Please either rename the "lisp" syntax to something else ("parentheses" ? "parens" maybe?) OR change it to support actual lisp syntax.

reasoning:

I'm not sure what the "lisp" format is but it's not "lisp", and when you try and use lisp it gets it wrong. I'm not suggesting there's anything wrong with the suggested "lisp" syntax, but I am suggesting that it shouldn't be called "lisp" because it misleads users and will cause frustration when literally anyone who knows lisp attempts to use it.

In my case, as a lisp user, I saw this, got excited, tried it, and then got frustrated enough to file this ticket.

Even if we ignore the fact that you can't start with a parentheses the following example produces a single element instead of four elements.

(Grandchild 1 Grandchild 2)

Sorry for the frustration! Yes, I completely understand. When I was originally developing that syntax format, I had trouble thinking of a good name for it, but parens sounds wonderful. I think I can add this.

Since you're a lisp user, might I ask what a lisp-like way would be to unify elements in the event they include spaces? Would something like (foo "bar baz") translating to

foo
└── bar baz

make sense?

Would something like (foo "bar baz") translating to... make sense?

Yup. That's exactly how you'd do it. Double quotes would be standard but i think being a command line tool people would be understanding if you allowed single quotes too, even though in scheme and lisp the single quote has a very different meaning and doesn't come in pairs. ;)

If you want to go even farther down the lisp rabbit hole the first thing in the parentheses is the function and the rest of the stuff is parameters to the function so in the AST the first item is the parent and everything else is a child. so really

(foo "bar baz" (beedle fum))

becomes

foo
└── "bar baz"
└── beedle
      └── fum 

Great! Working on it now 😄

One thing I am unsure of how to represent is expressions of the form:

((foo bar) (baz biz))

Any ideas? Or just error on those?

((foo bar) (baz biz))

eeesh I don't know that anything is "right" but what about this

()
└── foo
|     └ bar
└── baz
      └── biz 

() is "null" and "empty list" in lisp (testing an empty list with the null function returns true ) . Also, with the tree under it it seem to imply that it's an empty list containing things which is kind-of true. I think it fits.

((foo bar) (baz biz))

Or just error on those?

forgot to comment on that. it definitely shouldn't be an error because it's totally valid lisp. the (foo bar) would resolve to a function which would then be in the first place of a form, and thus called and passed whatever (baz biz) resolved to.

thanks for the tweak @HarrisonB :D

hehe no prob!