Course:CPSC311/2010WT1/Lecture Notes/2010-09-10/NNek

From UBC Wiki

CPSC 311 September 10 2010

Redefining an existing function shadows the old one

Lambda: introduces a function without a name, becomes a function value

ie:
(define (only-pos lon)
   (filter (lambda (num) ( > num  0)) lon))

‘(num) does not work, as it will return the list (num)

If statement:
(cond
[boolean-expr result-expr]
[]
[]
[else ])

(cons 1 2) gives (1 . 2), why does our cons work? Because we are always appending a listof numbers as the second argument.