3 ms·
I read you. I think Guile's native syntax for keywords, though more explicit, probably makes it worse. I imagine this would be clearer for a non-Lisper? Valid C
by gglitch 3y ago
I read you. I think Guile's native syntax for keywords, though more explicit, probably makes it worse. I imagine this would be clearer for a non-Lisper? Valid CL, but not Guile without a configuration change.
'(:firstName "John"
:lastName "Smith"
:isAlive t
:age 27
:address (:streetAdddress "21 2nd Street"
:city "New York"
:state "NY"
:postalCode "10021-3100")
:phoneNumbers ((:type "home"
:number "212 555-1234")
(:type "office"
:number "646 555 4597"))
:children ("Catherine"
"Thomas"
"Trevor")
:spouse nil)
...or, indented more like Wiki's JSON example:
'(
:firstName "John"
:lastName "Smith"
:isAlive t
:age 27
:address (
:streetAdddress "21 2nd Street"
:city "New York"
:state "NY"
:postalCode "10021-3100"
)
:phoneNumbers (
(
:type "home"
:number "212 555-1234"
)
(
:type "office"
:number "646 555 4597"
)
)
:children (
"Catherine"
"Thomas"
"Trevor"
)
:spouse nil
)
- grumbel 3y agoThe core issue that you can't escape is that Scheme creates a lot of ambiguity between data and code, since both use the same syntax. There is nothing wrong with using plain s-expressions for data, quite the opposite, I find them quite nice to look at, no need for keywords here: (person (firstName "John") (lastName "Smith") (isAlive t) (age 27) (address (streetAdddress "21 2nd Street") (city "New York") (state "NY") (postalCode "10021-3100") ) ) But that's not something you can put in a Scheme file directly, you have to quote it and then you have to use quasiquotes, macros or other hacks to get parts of that data structure executable. It's also not even the proper way to do a name/value pairs in Scheme, which would be the alist of the form ((name . value) ...). In Nix you do not have any of those ambiguities {} is a set, [] is a list, 5+5 is an expression, a = 5; is an assignment. And you can freely mix them without all that quoting, so it's { a = 5 + 5; }, not `((a . ,(+ 5 5))) or (list (cons 'a (+ 5 5)))