(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))
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