Javascript: f(g(x)) Lisp: (f (g x))
Same amount of parens.
Show me how to write `a + b * c` in Lisp without parentheses.
I'm loading an infix reader macro into LispWorks, the code is roughly 30 years old:
CL-USER 1 > (ql:quickload "INFIX")
To load "infix":
Load 1 ASDF system:
infix
; Loading "infix"
;;; *************************************************************************
;;; Infix notation for Common Lisp.
;;; Version 1.3 28-JUN-96.
;;; Written by Mark Kantrowitz, CMU School of Computer Science.
;;; Copyright (c) 1993-95. All rights reserved.
;;; May be freely redistributed, provided this notice is left intact.
;;; This software is made available AS IS, without any warranty.
;;; *************************************************************************
("INFIX")
Now we can write Infix expressions: CL-USER 2 > '#I( a + b * c )
(+ A (* B C))
Let's set the variables a, b, c CL-USER 3 > setf a 10 b 20 c 30
30
The Infix expression reader macro at work: CL-USER 4 > #I( a + b * c)
610
Inside the Infix macro Lisp parses a sublanguage of Infix expressions into Lisp s-expressions. Generally this would be possible with a normal macro, but the reader also changes the tokenizing of elements, so we can also write: CL-USER 5 > #I(a+b*c)
610
In "normal" Lisp syntax a+b*c would be a single symbol. The infix reader parses it into five symbols and a list according to operator priorities.