Learn To Cut - Common Lisp For Ghosts
Lisp is a family of languages.
Common Lisp is standardized (ANSI Common Lisp, 1994).
It's not just a language.
It's a ritual. A framework.
A tool that's known by a minority - a cipher for the Ghosts.
The Soul Is The Body - The Body Is The Soul
In Lisp, code is data. Data is code.
With the '
, it's just data:
'(+ 1 2 3 4 5) ;; -> (+ 1 2 3 4 5)
Without the '
, Lisp sees an expression:
(+ 1 2 3 4 5) ;; -> 15
The first element, the +
is treated as a function
.
The rest are the arguments
.
No fluff. No sugarcoating.
[Operator's Note]
Ghost Rule: In Lisp, the blade is double-edged.
Quote it, and you carry the form untouched.
Unquote it, and you cut.
Ghost Style - Notation And Parentheses
You already tasted it.
Parentheses in Lisp are the soul.
Clarity. Readability.
No ornaments. No illusions.
Only raw data. The Ghost Core.
The expression:
( if (= 2 2)
T
NIL)
is the same as:
( if (= 2 2) T NIL)
[Field Signal]
Every parenthesis holds a list.
Every list can be cut.
car, cdr, cons - the Ghost's first weapons.
Prefix notation…
The Lisp-family languages use prefix notation.
The function is the first element of the list.
Common Lisp processes the expression inside out.
(/ (+ 3 5) 4) ;; -> 2
First Lisp solves (+ 3 5)
equals to 8
.
The +
is the function that adds two or more numbers.
The Ghost's view: prefix notation - no ambiguity, no illusions.
Then (/ 8 4)
will return 2
.
Another cut:
(* 2 3 4) ;; -> 24
Ghost Operator's Toolset - Lists With Minimal Core
"Lisp" came from "LISt Processing".
A Ghost sees lists everywhere.
Code is a list of data.
'(1 2 3) ; A list of numbers. '( "hello" "world") ; A list of strings. '((a b c) (1 2 3)) ; A list of lists.
Quoting preserves the form - untouched.
Without the quote, the list is a command, ready to cut.
(round (* 3 pi)) ;; -> 9
Cut Like A Ghost: Manipulate The Lists
Lists haunt every corner of Lisp.
Ghosts cut with precision. Surgically.
Extract the head with car
(or first
).
Leave the body with cdr
(or rest
).
Strike any position with nth
.
(car '( "lisp" "is" "the" "ghost" "tool")) ;; -> "lisp" (cdr '( "lisp" "is" "the" "ghost" "tool")) ;; -> ("is" "the" "ghost" "tool") (nth 2 '( "lisp" "is" "the" "ghost" "tool")) ;; -> "the"
[Operator's Cut]
car takes the head.
cdr leaves the body.
nth pierces straight to the target.
Ghosts Don't Just Use Lists - They Construct Them
(cons "ghost" '( "operator" "toolkit")) ;; -> ("ghost" "operator" "toolkit")
[Operator's Cut]
Forge a new link. Attach the head. Extend the chain.
Cut Deeper - Recursion
( defun ghost-cut (lst) ( when lst (cons (car lst) (ghost-cut (cdr lst)))))
[Field Signal]
The Ghost can loop silently.
Recursion is a shadowy cut - elegant, endless.
Conditions
( if (> 5 3) "Cut" "Hold") ;; -> "Cut"
[Operator's Cut]
The Ghost chooses the path.
The blade follows the condition.
A Common Lisp community is building on Discord: https://discord.gg/eNvmFrSCNb
[ The Signal fades here. DeadSwitch is out. ]