5 ms·
Hm. 鳥> (read "(push [1] 'Z)") ;;=> [ "'push", [ "'list", 1 ], [ "'quote", "'Z" ] ] 鳥> (eval (read "(push [1] 'Z)")) ;;=> [ "'Z", 1 ] ...sh
by randallsquared 6y ago
Hm.
鳥> (read "(push [1] 'Z)")
;;=> [ "'push", [ "'list", 1 ], [ "'quote", "'Z" ] ]
鳥> (eval (read "(push [1] 'Z)"))
;;=> [ "'Z", 1 ]
...shouldn't the last line be either
;;=> [ 'Z, 1 ]
or
;;=> [ [ "quote", "'Z" ], 1 ]
?
- akkartik 6y agoThe results are always Javascript literals. Javascript doesn't have symbols. So symbols are represented as strings starting with a single quote. Mildly confusing but seems easy to pick up.
- fogus 6y agoAs mentioned, JS does have Symbols and I started the language using them but moved away. At the moment symbols are encoded as "'foo" but I may change the prefix to something less confusing at a glance.
- zeckalpha 6y agoJS does have Symbols but they are relatively modern: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...