4 ms·
> Pretty compelling, especially "Janet does not adhere to the ancient customs. CAR is called first. PROGN is called do. LAMBDA is fn, and SETQ is def." - a sign
by setopt 4mo ago
> Pretty compelling, especially "Janet does not adhere to the ancient customs. CAR is called first. PROGN is called do. LAMBDA is fn, and SETQ is def." - a sign of good sense for sure!
Just FYI, many of these are also done in Scheme and its derivative Racket. They kept lambda (but even Python did that), but progn -> begin, setq -> set!, car -> first, and so on.
> Also my main objection to Lisps is still the horrible bracket syntax. Yes it's unambiguous and easy to parse, but it's HORRIBLE to read and edit.
I have pretty mixed feelings at this point. I don’t mind it for normal programming, but when I do numerical programming (physics models, etc.) you often get extremely long and verbose expressions that are IMO difficult to parse compared to the math-like infix operator notation used in other languages.
- aeonik 4mo agoI'm starting to prefer the s expression syntax when dealing with tree structures like json. I wonder if we were raised on tree based algebra if math would be easier to do, or harder. Like, solve for x. (= (+ (* 2 x) 3) 11) (= (* 2 x) (- 11 3)) (= (* 2 x) 8) (= x (/ 8 2)) (= x 4) Though this isn't too bad. (= (+ (pow x 2) (pow y 2)) (pow r 2))
- setopt 4mo agoI definitely prefer s-exps over both xml and json myself too! Interesting question. Much of the difficulty does stem from mentally translating back and forth between conventional notation and s-exps too, since you can’t really avoid the standard notation when reading and writing math and physics papers. And current-day math and physics notation has been optimized to some extent for the infix notation; perhaps one would have invented more expressive higher-order functions or macros to denote s-exp math if that was what everyone used for centuries.
- veqq 4mo ago> perhaps one would have invented more expressive higher-order functions or macros to denote s-exp math if that was what everyone used for centuries. Have you ever looked into APL? It was made as a better notation for math over a decade before computers emerged.
- setopt 4mo agoI think also a lot of my objections could be worked around if one simply had a "math" macro that evaluates infix math notation as a DSL, similarly to how the CL "loop" macro does a DSL for iteration. Perhaps this exists already somewhere?
- veqq 4mo ago> exists already The helloworld of macros lets you do `(infix 1 + 2)`: (defmacro infix [a op b] ~(,op ,a ,b)) A useful one with precedence letting you to `(infix 2 + 4 * 5)`: (defmacro infix [& toks] (def prec {'+ 1 '- 1 '* 2 '/ 2 '% 2}) (var pos 0) (defn climb [min-p] (var left (toks pos)) (++ pos) (while (>= (get prec (get toks pos) -1) min-p) # nil/operand -> -1, stops the loop (def op (toks pos)) (++ pos) (set left ~(,op ,left ,(climb (inc (prec op)))))) # inc => left-associative left) (climb 0)) But ultimately, APL notation is best: https://git.sr.ht/~subsetpark/jnj https://git.sr.ht/~subsetpark/jnj
- xigoi 4mo ago> Perhaps this exists already somewhere? https://janet-lang.org/spork/api/infix.html https://janet-lang.org/spork/api/infix.html
- krupan 4mo agoIf you ever used an RPN calculator then this is very familiar
- deleted 4mo ago[deleted]