← Back to context Comment by bogdanoff_2 7 years ago What is the second bullet point referring to? 1 comment bogdanoff_2 Reply shaftway 7 years ago Lisp syntax in a nutshell is: "(" {function} [" " {argument}...] ")" If you don't want to actually run a function, like you just want a list of values, you put a single quote before it: "'(" [{item} [" " {item}...]] ")" So if you want to do `(1 + 2) * 3` it'd be `(* (+ 1 2))`. Parentheses abound.On top of that everything is a function, including if statements, assignment, and even how you define a new function. So factorial in lisp is: (defun factorial (x) (if (<= x 0) 1 (* x (factorial (- x 1))) ) ) You'll notice that it ended with 5 close-parentheses. Different people have different strategies for managing that along with indents and newlines.
shaftway 7 years ago Lisp syntax in a nutshell is: "(" {function} [" " {argument}...] ")" If you don't want to actually run a function, like you just want a list of values, you put a single quote before it: "'(" [{item} [" " {item}...]] ")" So if you want to do `(1 + 2) * 3` it'd be `(* (+ 1 2))`. Parentheses abound.On top of that everything is a function, including if statements, assignment, and even how you define a new function. So factorial in lisp is: (defun factorial (x) (if (<= x 0) 1 (* x (factorial (- x 1))) ) ) You'll notice that it ended with 5 close-parentheses. Different people have different strategies for managing that along with indents and newlines.
Lisp syntax in a nutshell is:
If you don't want to actually run a function, like you just want a list of values, you put a single quote before it:
So if you want to do `(1 + 2) * 3` it'd be `(* (+ 1 2))`. Parentheses abound.
On top of that everything is a function, including if statements, assignment, and even how you define a new function. So factorial in lisp is:
You'll notice that it ended with 5 close-parentheses. Different people have different strategies for managing that along with indents and newlines.