Checking Equivalence Demo (equal?e1 e2)checks if el and e2 evaluate to equivalent values ●Like=in Python ●(null?expr)is like(equal?expr ni1) (eq?e1 e2)checks if el and e2 evaluate to identical values ●Like is in Python Only matters for lists (e1 e2)only works for numbers
Checking Equivalence (equal? e1 e2) checks if e1 and e2 evaluate to equivalent values ● Like == in Python ● (null? expr) is like (equal? expr nil) (eq? e1 e2) checks if e1 and e2 evaluate to identical values ● Like is in Python ● Only matters for lists (= e1 e2) only works for numbers Demo
List Constructor Demo If we know each element we want to put in a list,we can use the list constructor The list constructor takes in any number of elements and puts each element as a single element in a list scm> (1ist123) scm>(list 0 (list 1 2 3)) (123) (0(123) 123 123N
List Constructor If we know each element we want to put in a list, we can use the list constructor The list constructor takes in any number of elements and puts each element as a single element in a list scm> (list 1 2 3) (1 2 3) scm> (list 0 (list 1 2 3)) (0 (1 2 3)) 1 2 3 1 2 3 0 Demo
Quoting Demo The quote special form takes in a single argument and returns an unevaluated version of the argument Quoting a symbol gives a symbol back,that symbol can mean something to scheme! Quoting the representation of a list gives a list scm>‘(abc) scm>‘(0(123)) (a b c) (8(123)) 123N
Quoting The quote special form takes in a single argument and returns an unevaluated version of the argument Quoting a symbol gives a symbol back, that symbol can mean something to scheme! Quoting the representation of a list gives a list scm> ‘(a b c) (a b c) scm> ‘(0 (1 2 3)) (0 (1 2 3)) a b c 1 2 3 0 Demo