scheme1_worksheet

scheme1_worksheet - CSCC24 Principles of Programming...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCC24 – Principles of Programming Languages Functional Programming - Scheme Functions and Examples eq? Equality of atoms. 1 ]=> (eq? 'a 'a) ;Value: 1 ]=> (eq? 'a 'b) ;Value: 1 ]=> (eq? 2 (+ 1 1)) ;Value: 1 ]=> (eq? 2 (+ 1 1) (+ 0 2)) 1 ]=> (eq? '(a b) '(a b)) ;Value: null? Is this an empty list? 1 ]=> (null? '(a b)) ;Value: 1 ]=> (null? 'a) ;Value: 1 ]=> (null? '()) ;Value: + - * / numeric operators = < > <= >= number comparison operators Run-time type checking functions – All return Boolean values: #t and #f 1 ]=> (number? 5) ;Value: 1 ]=> (number? (+ 3 4)) ;Value: 1 ]=> (number? 'a) ;Value: 1 ]=> (number? '(3)) ;Value: 1 ]=> (zero? 0) ;Value: 1 ]=> (zero? (- 4 4)) ;Value: 1 ]=> (zero? (+ 4 -4)) ;Value: 1 ]=> (zero? 'a) 1 ]=> (zero? '(0)) 1 ]=> (symbol? 'ab) ;Value: 1 ]=> (symbol? 2) ;Value: CSCC24 – January 28, 2010 Week 4, Scheme Programming Page 1 of 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 ]=> (symbol? #t) ;Value: 1 ]=> (symbol? '(1 2)) ;Value: 1 ]=> (list? 'a) ;Value: 1 ]=> (list? '(a b)) ;Value: READ-EVAL-PRINT Loop
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/05/2011 for the course CS 24 taught by Professor Cathy during the Summer '10 term at University of Toronto.

Page1 / 4

scheme1_worksheet - CSCC24 Principles of Programming...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online