# notes # lambda pattern matching ~~~ (apply (lambda (a b c) #t) (list 1 2 3)) ~~~ -> a:1 b:2 c:3 ~~~ (apply (lambda (a b . c) #t) (list 1 2 3 4 5)) ~~~ -> a:1 b:2 c:(3 4 5) ~~~ (apply (lambda* (a #:optional b) #t) (list 1 2)) ~~~ -> a:1 b:2. if a shorter list (list 1) where given instead, then a:1 b:#f ~~~ (apply (lambda* (a #:key (b 8) c) #t) (list 1 #:b 2 #:c 3)) ~~~ the special #: keyword syntax of lambda* is used to differentiate from normal symbols. unfortunately, the following does not work ~~~ (apply (lambda (a . b) #t) (pair 1 2)) ~~~ # other * eq, eqv, equal * eval returns objects * exact->inexact: floats are inexact, integers are exact * file tree walk * map with multiple arguments * multiple hash-table interfaces, multiple exception interfaces * named let defines and calls a procedure * pattern matching with (ice-9 match) * sandbox evaluation * the guile c interface * the use of begin on the toplevel * uniform vectors and c * the identity function * guile [procedure index](https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html#Procedure-Index) * continuation passing style * lists are chains of pairs # iteration, loops and recursion * folding and mapping. unfold, pair-fold, parallel map * the stop condition * recursion needs a condition for which it stops or it continues indefinitely * when working with loops, decide and look for the stop condition * map, fold and unfold only create one result - how to change multiple values which each iteration * custom loops * fold and an updated nested data structure * mutating variables is possible in scheme (set!), but in a purely functional language the values of bindings are declared at specific points (lambda arguments) as dependencies for scopes in which they are bound understand this loop: ~~~ (let loop ((rest (list 1 2 3))) (if (null? rest) rest (cons (+ 1 (car rest)) (loop (cdr rest))))) ~~~ it maps a list and, compared to the map procedure, can be customized and extended