Earlier quoted context omitted.
Lua tables are a general-purpose associative structure that are used for both map and list functions in that language: there's syntactic sugar for both consecutive integer keys and simple string keys, and the former are used to make sequences (with internal, semantics-preserving optimizations in the Lua runtime for storing them). They strike me as one of the best options for a single core data structure if one were l…
I haven't use Lua, but that sounds exactly like JavaScript objects. JavaScript does get on very well with basically just these objects.
Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
41–50 of 74 posts
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#42I still think there's room for experimenting with a Lisp that has the hashmap (a.k.a. dictionary, associative array, property bag) as its organizing principle rather than the list. There's nothing better than hashmaps for exploratory programming. If there is something to be gained from building a Lisp in terms of them (from the ground up; I don't mean support for object literals), I'd like to know what it is. This ha…
This presents a very thorny language design problem. Lists have this very nice property that they are ordered , which lets you attach implied semantics to the position of an element, e.g.: (defun foo (a b c) ...) We know this is a function defining because the symbol DEFUN is in the FIRST position of the list. Associative arrays are unordered, so you have to explicitly label everything: { top-level-form : defun, argu…
(defun foo (a b c))
could accept a map of variable names (foo {a: 1, b: 2, c: 3})Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#43Earlier quoted context omitted.
(cranky You know, we have the upvote arrow for things that excite you, and the “Go read something else and comment on it” feature for things that don’t float your boat. Clearly this is not spam and it is not off-topic. So: You asked the OP and/or your fellow HNers why they upvoted this onto the front page. I ask you, why this comment, what value does it add to my life to read about how smart and educated you are? Wha…
Raganwald, you pretentious douche: > I wrote an implementation of Scheme in Java with macros, tail call optimization, lambda hoisting, a bunch of stuff. Greenspun’s Tenth Law is widely accepted, demonstrations of it in action add nothing of value to the programming community. Furthermore, writing a Scheme in Java is likely to be a project where you learned nothing of interest about Lisp or about Java. —signed, Nikola…
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#44Earlier quoted context omitted.
> Could you allow (a b c) as a synonym for { 0 a 1 b 2 c }? Yes, of course, but all you've done is re-invent vectors. > you lose cdr (except by copying the rest of the vector) Copying the rest of the vector is not semantically equivalent to CDR unless you are being purely functional. But you can actually implement CDR using displaced vectors. > You must have something in mind other than this? Could be :-) Try writing…
Yes, of course, but all you've done is re-invent vectors. True, but only as a device to keep the playing field open for any new benefits that might spring from universal hashmaps. What are they? I don't know, that's the question. Maybe there aren't any, but that itself would be interesting as a negative result (the L in Lisp is there for a reason). What I'd really like to know is what would complete this sequence: li…
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#45I really like Lisp (I was even paid to develop in it for 6 years) and these days I love JSON because of its Lisp-ish nature - but those expressions look damn ugly to me.
Maybe start with lisp and just add {key: value key2: value2} syntax for tables? It'd be useful to get ruby-style keyword args for free, at least.
I spend a lot of time thinking about keyword args because I've been working on a lisp interpreter that supports them. Here's a webserver that is nice to read because of a crucial keyword arg (it starts with a colon):
http://github.com/akkartik/wart/blob/460565a2e0/064http-serv...
Like in python the keyword arg is always optional. You could delete it from this definition and it would behave the same.
In conclusion: please try to include python-style keyword args in your next language. You never know when they'll come in handy.
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#46Earlier quoted context omitted.
Raganwald, you pretentious douche: > I wrote an implementation of Scheme in Java with macros, tail call optimization, lambda hoisting, a bunch of stuff. Greenspun’s Tenth Law is widely accepted, demonstrations of it in action add nothing of value to the programming community. Furthermore, writing a Scheme in Java is likely to be a project where you learned nothing of interest about Lisp or about Java. —signed, Nikola…
That's kind of an inappropriate response. Pointing out one has implemented Scheme with all the bells and whistles as a condition in which the implementor is still interested in Lisp implementations and similar stuff is not a pretension or a statement that it was some kind of tremendous feat. I have a motorcycle, but I'm still interested in not only other motorcycles, but also bicycles. I don't think this makes me a p…
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#47Earlier quoted context omitted.
Raganwald, you pretentious douche: > I wrote an implementation of Scheme in Java with macros, tail call optimization, lambda hoisting, a bunch of stuff. Greenspun’s Tenth Law is widely accepted, demonstrations of it in action add nothing of value to the programming community. Furthermore, writing a Scheme in Java is likely to be a project where you learned nothing of interest about Lisp or about Java. —signed, Nikola…
Wait.. why is raganwald replying to raganwald?
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#48I still think there's room for experimenting with a Lisp that has the hashmap (a.k.a. dictionary, associative array, property bag) as its organizing principle rather than the list. There's nothing better than hashmaps for exploratory programming. If there is something to be gained from building a Lisp in terms of them (from the ground up; I don't mean support for object literals), I'd like to know what it is. This ha…
This presents a very thorny language design problem. Lists have this very nice property that they are ordered , which lets you attach implied semantics to the position of an element, e.g.: (defun foo (a b c) ...) We know this is a function defining because the symbol DEFUN is in the FIRST position of the list. Associative arrays are unordered, so you have to explicitly label everything: { top-level-form : defun, argu…
That's not true in general, is it? It's just hash maps that are unordered. You can use a tree to represent an associative array (so the order of keys is found by a tree traversal), or a "worse" method like an association list (linked list). You can also just store a linked list of keys along with your hash map.
Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#49Re: Show HN: a Lisp that uses JSON instead of S-expressions (in .js)
#50Earlier quoted context omitted.
> cdr gets expensive Yes, that's one thing. But do you really need CDR? > You could represent a list as a naked array of lisp pointers, but then cons gets expensive. Actually, it's much worse than that. CONS actually becomes impossible. (Think about it.) But maybe there's something else that you can use instead of CONS? > And good luck garbage collecting the vectors Why would that be a problem? Extant Lisps collect v…
"Extant Lisps collect vectors just fine." But they don't permit pointers inside the vectors, do they? I think if you permit internal pointers so you can have copyless cdr, computing reachability would get really expensive.