The quote indicates the the tokens are not to be evaluated but stored as the tokens themselves.
(quote arg) is the same thing as 'arg .
Dr. Poe's first "real" experience with BASIC. Data General AOS Basic. Data General Eclipse C/150. Mostly, I used a Dasher D200 terminal.
10 LET A$ = "17*5"
20 PRINT A$
30 PRINT
17*5
85
Early languages allowed you to store expressions in a string and evaluate them later.
10 LET A$ = "A+3"
20 LET A = 17
30 PRINT VAL(A$)
20
Lisp does something a little different. LISP stores the tokens themselves as elements of a list, if you want it to, with the (QUOTE ) function. You can evaluate that later.
Pascal was not only case insensitive, it had "alternate punctuation" for symbols that might not be found on every keyboard.
{ (*
} *)
[ (.
] .)
^ @
ASCII 7-bit: 0-127, but only characters 32-126 actually store visible symbols. All those other bytes are "control characters".
ASCII 7 BEL, it rang a bell. ASCII 0 NUL ASCII 10 LF ASCII 13 CR ASCII 127 DEL ASCII 27 ESC.
When "fonting" became a thing, some of the characters between 0 and 31 were defined to be visible things. And the characters from 128-255 would be visible things.
Unicode: 0-65535, or more.
Kid in the 1970's: Uh, nice outfit, dude.
Kid in the 1990's: Uh, nice outfit, dude. Not.
Kid in the 2020's: Uh, nYs outft. ;-)
(read) reads in an object from standard input.
So, you can type in a number, a string, a list
(read-line) reads in a line of text from standard input, that you
can parse.
Microsoft Windows [Version 10.0.19044.3930]
(c) Microsoft Corporation. All rights reserved.
C:\Users\apoe>signon
C:\Users\apoe>addskip
C:\Users\apoe>control
C:\Users\apoe>zoom
C:\Users\apoe>attendance
Command: take
Date: 20240214
Enter new value:
Do you wish to clear this field?
Course ID:
Enter new value: cs 556 01 24w
Course: CS 556 01 24W
Name: Functional Programming
Is this the entry you wish? (Y,P,N,R,C) y
CLARK, Andrea L
Present: Y
Enter new value:
Do you wish to clear this field?
COMBS, Grant J
Present: Y
Enter new value:
Do you wish to clear this field?
LAWTON, Linda B
Present: Y
Enter new value:
Do you wish to clear this field?
MENZE, Matthew P
Present: Y
Enter new value:
Do you wish to clear this field?
RICHTER, Paul R
Present: Y
Enter new value:
Do you wish to clear this field?
SIMULA, Jordan S
Present: Y
Enter new value:
Do you wish to clear this field?
Command: exit
C:\Users\apoe>cd Desktop
C:\Users\apoe\Desktop>mkdir cs556-01-24w
C:\Users\apoe\Desktop>cd cs556-01-24w
C:\Users\apoe\Desktop\cs556-01-24w>dir
Volume in drive C is Windows
Volume Serial Number is ECD8-6666
Directory of C:\Users\apoe\Desktop\cs556-01-24w
02/14/2024 11:09 AM
.
02/14/2024 11:09 AM ..
0 File(s) 0 bytes
2 Dir(s) 362,824,294,400 bytes free
C:\Users\apoe\Desktop\cs556-01-24w>touch notes20240214.txt
C:\Users\apoe\Desktop\cs556-01-24w>textpad notes20240214.txt
C:\Users\apoe\Desktop\cs556-01-24w>clisp
C:\Users\apoe\Desktop\cs556-01-24w>"C:\Program Files\clisp-2.49\clisp.exe" -K full
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8
Welcome to GNU CLISP 2.49 (2010-07-07)
Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010
Type :h and hit Enter for context help.
[1]> (quote (+ 1 2 3))
(+ 1 2 3)
[2]> (setf a (+ 1 2 3))
6
[3]>
:
:||
[4]> (setf a (quote (+ 1 2 3)))
(+ 1 2 3)
[5]> a
(+ 1 2 3)
[6]> (length a)
4
[7]> (first a)
+
[8]> a
(+ 1 2 3)
[9]> (setf b '(+ arg1 arg2))
(+ ARG1 ARG2)
[10]> b
(+ ARG1 ARG2)
[11]> (first (rest b))
ARG1
[12]> (eval a)
6
[13]> (eval b)
*** - EVAL: variable ARG1 has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of ARG1.
STORE-VALUE :R2 Input a new value for ARG1.
ABORT :R3 Abort main loop
Break 1 [14]> abort
[15]> (setf arg1 19)
19
[16]> (setf arg2 -20)
-20
[17]> (eval b)
-1
[18]> (setf arg3 'arg3)
ARG3
[19]> (eval arg3)
ARG3
[20]> (setf arg3 '(arg3))
(ARG3)
[21]> arg3
(ARG3)
[22]> (eval arg3)
*** - EVAL: undefined function ARG3
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'ARG3).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'ARG3).
ABORT :R4 Abort main loop
Break 1 [23]> abort
[24]> (setf arg3 '(eval arg3))
(EVAL ARG3)
[25]> arg3
(EVAL ARG3)
[26]> (eval arg3)
*** - Program stack overflow. RESET
[27]> (setf a "I eat guys like you for breakfast.")
"I eat guys like you for breakfast."
[28]> a
"I eat guys like you for breakfast."
[29]> (char a 2)
#\e
[30]> (char a 1)
#\Space
[31]> (subseq a 6 9)
"guy"
(subseq a 0 1)
"I"
[34]> (subseq a 0 5)
"I eat"
[35]> (subseq a 0)
"I eat guys like you for breakfast."
[36]> (subseq a 15)
" you for breakfast."
(string= "a" "b")
NIL
[39]> (string= "a" "a")
T
[40]> (string= "a" "A")
NIL
[41]> (string-equals "a" "A")
*** - EVAL: undefined function STRING-EQUALS
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'STRING-EQUALS).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'STRING-EQUALS).
ABORT :R4 Abort main loop
Break 1 [42]> abort
[43]> (string-equal "a" "A")
T
[44]> ; string= and string-equal are not the same.
:
:||
[45]> ; string= is case-sensitive; string-equal is case-insensitive.:
:
:||
[46]> (string< "A" "a")
0
[47]> (string> "A" "a")
NIL
[48]> (string< "abcde" "abcdf")
4
[49]> (string< "abcdf" "abcde")
NIL
[50]> (string-lessp "A" "a")
NIL
[51]> ;string-lessp is case-insensitive.
:
:||
[52]> (string-greaterp "A" "a")
NIL
[53]> ;string-greaterp is case-insensitive.
:
:||
[54]> (write-line "Hello")
Hello
"Hello"
[55]> (write "Hello")
"Hello"
"Hello"
[56]> ;write-line writes a line of text. ;write evaluates the argument and prints that
in a standard format.
*** - SYSTEM::READ-EVAL-PRINT: variable IN has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of IN.
STORE-VALUE :R2 Input a new value for IN.
ABORT :R3 Abort main loop
Break 1 [57]> abort
[58]> (read a)
*** - READ: argument "I eat guys like you for breakfast." is not a stream
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead.
ABORT :R2 Abort main loop
Break 1 [59]> (read is)
*** - SYSTEM::READ-EVAL-PRINT: variable IS has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of IS.
STORE-VALUE :R2 Input a new value for IS.
ABORT :R3 Abort debug loop
ABORT :R4 Abort main loop
Break 2 [60]> abort
Break 1 [59]> abort
[61]> (setf a (read))
12
12
[62]> a
12
[63]> (setf a (read))
Hi There
HI
[64]>
*** - SYSTEM::READ-EVAL-PRINT: variable THERE has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of THERE.
STORE-VALUE :R2 Input a new value for THERE.
ABORT :R3 Abort main loop
Break 1 [65]> abort
[66]> (setf a (read))
"Hi There"
"Hi There"
[67]> (setf a (read))
(1 2 3)
(1 2 3)
[68]> a
(1 2 3)
[69]> (setf a (read))
(+ 1 2 3)
(+ 1 2 3)
[70]> a
(+ 1 2 3)
[71]> (eval a)
6
[72]> (setf a (read-line))
Hi There
"Hi There"
[73]> (setf a (read-line-ignore-whitespace))
*** - EVAL: undefined function READ-LINE-IGNORE-WHITESPACE
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'READ-LINE-IGNORE-WHITESPACE).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'READ-LINE-IGNORE-WHITESPACE).
ABORT :R4 Abort main loop
Break 1 [74]> abort
[75]> (setf a (read-line))
Hi There
" Hi There"
[76]> (setf a (read-line-preserving-whitespace))
*** - EVAL: undefined function READ-LINE-PRESERVING-WHITESPACE
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'READ-LINE-PRESERVING-WHITESPACE).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'READ-LINE-PRESERVING-WHITESPACE).
ABORT :R4 Abort main loop
Break 1 [77]> (setf a (read-line-preserve-whitespace))
*** - EVAL: undefined function READ-LINE-PRESERVE-WHITESPACE
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'READ-LINE-PRESERVE-WHITESPACE).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'READ-LINE-PRESERVE-WHITESPACE).
ABORT :R4 Abort debug loop
ABORT :R5 Abort main loop
Break 2 [78]> abort
Break 1 [77]> abort
[79]> (load "mergesort.lisp")
;; Loading file mergesort.lisp ...
*** - READ from #: an object cannot
start with #\)
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [80]> abort
[81]> (load "mergesort.lisp")
;; Loading file mergesort.lisp ...
;; Loaded file mergesort.lisp
T
[82]> (setf a (list 3 1 4 1 5 9))
(3 1 4 1 5 9)
[83]> (full-merge-sort (list a))
*** - EVAL: undefined function MERGE-DEM-LISTS
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'MERGE-DEM-LISTS).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'MERGE-DEM-LISTS).
ABORT :R4 Abort main loop
Break 1 [84]> abort
[85]> (load "mergesort.lisp")
;; Loading file mergesort.lisp ...
;; Loaded file mergesort.lisp
T
[86]> (full-merge-sort (list a))
NIL
[87]> A
(3 4 5)
[88]> (setf a (list 0 2 1 3 4))
(0 2 1 3 4)
[89]> (full-merge-sort (list a))
NIL
[90]> a
(0 1 2 3 4)
[91]> (setf a (list 1 1 1 1 1))
(1 1 1 1 1)
[92]> (full-merge-sort (list a))
NIL
[93]> a
(1 1 1 1 1)
[94]> (setf a (list 3 1 4 1 5 9))
(3 1 4 1 5 9)
[95]> (full-merge-sort (list a))
NIL
[96]> a
(3 4 5 9)
[97]> (full-merge-sort (list a))
NIL
[98]> a
(3 4 5 9)
[99]> (setf a (list 3 1 4 1 5 9))
(3 1 4 1 5 9)
[100]> (full-merge-sort (list a))
NIL
[101]> a
(3 4 5 9)
[102]> (load "split.lisp")
;; Loading file split.lisp ...
WARNING: DEFUN/DEFMACRO: redefining function SPLIT in C:\Users\apoe\Desktop\cs556-01-24w\split.lisp,
was defined in C:\Users\apoe\Desktop\cs556-01-24w\mergesort.lisp
WARNING: DEFUN/DEFMACRO: redefining function MERGE-DEM-LISTS in
C:\Users\apoe\Desktop\cs556-01-24w\split.lisp, was defined in
C:\Users\apoe\Desktop\cs556-01-24w\mergesort.lisp
WARNING: DEFUN/DEFMACRO: redefining function SEMI-SORT in
C:\Users\apoe\Desktop\cs556-01-24w\split.lisp, was defined in
C:\Users\apoe\Desktop\cs556-01-24w\mergesort.lisp
WARNING: DEFUN/DEFMACRO: redefining function FULL-MERGE-SORT in
C:\Users\apoe\Desktop\cs556-01-24w\split.lisp, was defined in
C:\Users\apoe\Desktop\cs556-01-24w\mergesort.lisp
;; Loaded file split.lisp
T
[103]> (setf a (list 3 1 4 1 5 9))
(3 1 4 1 5 9)
[104]> (full-merge-sort (list a))
NIL
[105]> a
(3 4 5 9)
[106]>