7 ms·
I've never really bothered to learn lisp, but this is incredible. I get it now. That being said, I wonder how data types would work as opposed to lists. What w
by nynx 6y ago
I've never really bothered to learn lisp, but this is incredible. I get it now.
That being said, I wonder how data types would work as opposed to lists. What would a language based around maps look like?
- garmaine 6y agoIt would look like smalltalk: [sendMessage with:arg1 to:arg2]
- User23 6y agoCommon Lisp has keyword args too.
- garmaine 6y agoTo be clear this is something I’ve thought a bit about. I think the interesting analog is not maps per se, but relational tuples. Instead of “everything is a list”, it would be “everything is a tuple”, and the environment is a table. Evaluate a tuple to execute, evaluate a table to execute in parallel.
- User23 6y agoObjectively speaking table oriented programming is a very interesting topic. Sadly the incredibly effective anti-evangelist calling himself topmind over at the c2 wiki convinced me to completely ignore it for over a decade. The relational calculus is an incredibly powerful formalism though, and it's definitely one that has an important place in serious software development.
- javajosh 6y agoFirst of all, a map can be defined as a list where the even elts are labels and the odd ones are values. So it would be a lot like lisp but every elt in every list would have an extra before it, a short string name.
- brabel 6y agoIt's the other way around, actually. If you define a map as a list, it will have none of the properties of a map: you can't lookup a key in constant time. But if you start with maps, then you can represent a list as a special case of a map in which the keys are integers that get incremented, starting at 0.
- Reelin 6y agoGP isn't talking about the runtime implementation but rather the serialization format. You can serialize a map as a list. Therefore, a hypothetical Lisp-like language based around maps could simply end up consisting of lists that contain key value pairs.
- andyferris 6y agoIndeed - I have also wondered what a “struct processor” rather than “list processor” would look like. I keep thinking code blocks and the struct/map definition could possibly both use `{ ... }`, which might appear a bit like some other languages? What about function calling and definitions? The S-Expr thing seems to indicate you’d still need a “head” then a list of key-value pairs?
- andreareina 6y agoClojure has first-class support for map literals.
- deleted 6y ago[deleted]
- thibran 6y agoHave a look at Clojure Spec. The other one, which I don't like much, is PHP. For me it's strange that nobody seems to talk about the power of PHP map-like data structure and it's upsides because it is the main data structure.
- brabel 6y agoIt would look like Lua: https://www.lua.org https://www.lua.org They call "maps" tables. Even arrays in Lua are tables, as are everything else. Pretty cool concept... And there's even a low level, statically typed, system language that uses Lua as a composer language, Terra: http://terralang.org http://terralang.org In Terra, you manipulate your program using Lua at compile time. Really cool concept.
- zeveb 6y agoA large difference is that Lua source is not in the form of Lua tables — and that makes all the difference! Having full access to your complete language at read, compile and run times is what makes Lisp Lisp, and that can only sanely be done with a homoiconic language.
- sparkie 6y agoTake a look at Connection Machine Lisp (http://diyhpl.us/~bryan/papers2/paperbot/25aa007a093cd69bbf070e6db9603c3a.pdf http://diyhpl.us/~bryan/papers2/paperbot/25aa007a093cd69bbf0...)