Please enable JavaScript.
Coggle requires JavaScript to display documents.
Scheme (Lecture (Errors in Scheme (Unspecified Behavior ((eq? '(a b)…
Scheme
Lecture
let
Takes list, returns last element example
Reverse list example
(define (reverse ls)
(let revapp ((ls2 ls)(a '()))
(if (null? ls2)
a
(revapp (cdr ls2)
(cons (car ls2) a)))))
-
-
Revapp takes ls2 and a
NOT ACTUALLY LS2, can be Ls
-
Continuation
Lecture
Controversial
Too powerful, causes trouble
-
-
-
-
Without Call cc
-
Every function accepts an extra argument k,
To return a value v, we pass v to k
-
-
-
-
Errors in Scheme
-
An error's signaled
open_input_file "foo"
If no file foo, implementation checks for file
-
Unspecified Behavior
-
(eq? '(a b) '(a b))
-
Compiler makes single copy, so they point to same place in memory
-
-
-
-
-
-