COMP 3007
Outline
Lectures
Assignments
Contact
serusolC noisrucer liaT selbairav eerF noitcartsbA larudecorP mgidarap evitaralceD sv mgidarap evitarepmI
etairporppa sa edoc elpmas ro selpmaxe edivorp dna smret gniwollof eht enfieD
snoitseuq perp mretdiM 7003
snoitinfieD
7003 PMOC EMOH
(+ (* 3 4)(- 5 2 1)(/ 8 2))
(and (> (+ (* 3 4)(- 5 2 1)(/ 8 2)) 0)(or (= (- 4 5)(+
3 6 (* 10 -1)))(>= (* (/ 16 4)(+ 1 (* 3 2)(- 31 29)))
(+ (* 3 4)(- 5 2 1)(* 8 2)))))
(let ((l (+ 2 1))(e (/ 16(* 4 4)))(t (length (5 7))))
(if (< l e) t 0))((lambda (x y) (+ 3 x (* 2 y))) (+ 3 3)(* 2 2))(let ((a (lambda (b c)(* b c)))(b 10)(c 5))(+ (a 3 2)b c))(define (x y z)((lambda (y z)(- y z)) z y)) (x 3 5)(define (foo y) ((lambda (x) y) ((lambda (y)(* y y))y))) (foo 3)(((lambda(x)(lambda(y)(+ x y))) 12) ((lambda(z)(* 3z)) 3))((lambda (a b c)(list ‘(a b c) (list a b c) a ‘b c)) 12 3)(((lambda (a)(lambda (b) ‘(lambda (c) ‘(a b c)))) 1)2)(let ((a (lambda(x y)(list x y)))(b 2)(c 3))(list (a b’c) ‘(a b c))) let lambda .snoisserpxe tnelaviuqe otni snoisserpxe gniwollof eht trevnoCemehcS ni rewsna ruoy gniyfirev erofeb dnah yb eseht evlos ot erus eB .smargorp/snoisserpxe gniwollof eht fo tuptuo eht si tahWnoisneherpmoClet lambda(let ((varname 2)) (* varname 3))(let ((a (+ 3 5)) (b (* 4 2)) (c (- 12 8))) (+ (* 3 a)(* 2 b b)(/ c 2)))(let ((x (* 12 4)) (y (+ 8 16))) (let ((z 4)) (* z (+(* 3 x) y))))lambda let((lambda (x)(* x x)) 4)((lambda (i j k) (cons (+ (* 3 i) 2) (+ j (* 2 k))))(caddr ‘(5 6 2 1 3)) (cadar ‘((4 12 3) 2 1 0)) (car'(1 2 3)))((lambda (a b c) (/ (+ b c) a)) ((lambda(x)(* x x))(+3 2)) ((lambda (x y)(+ (* 3 y) x)) (* 2 4)(- 10 4))(+10 2))(define (f x)(+ x (* 2 x)))(define (g y)(* 10 (f y)))(g (+ 1 2 3))(define (abs x)(if (< x 0) (- x) x))(define (square x) (* x x))(define (inc x)(+ x 1))selpmaxe gniwollof eht rof redro evitacilppa dna lamron gnisu ledom noitutitsbus eht wohSredro evitacilppA dna lamroN snoituloS.snoisserpxe tnelaviuqe otni snoisserpxe gniwollof eht trevnoC.snoisserpxe tnelaviuqe otni snoisserpxe gniwollof eht trevnoC (+ (abs (- 75 100))(square (inc (abs (* -2 3)))))end-segmentmake-point x-point y-point midpoint-segment(define (print-point p)(display “(“)(display (x-point p))(display “,”)(display (y-point p))(display “)”)(newline))map filter (last L)(leading n L)(reverse L)reducemake-segmentstart-segmentevitareti na esu tub tsil a esrever ot erudecorp rehtona enfieD redro esrever ni stnemele emas eht fo tsil a snruterdna tnemugra sa tsil a sekat taht YLNO gniniatnoc tsil a snruter tahterudecorp a enfieD smeti n tsrfi eht erudecorp a enfieD .L erudecorp a enfieD , serudecorp eht enfieDtsil eht fo tnemele tsal eht snruter taht dna ,:stniop tnirp ot yaw a deen ll’uoy ,serudecorp ruoy yrt oT .)stniopdne eht fo setanidrooc eht fo egareva eht era setanidrooc esohw tniop eht( tniopdim sti snruter dna tnemugra sa tnemges enil a sekat taht erudecorp a enfied ,srotcurtsnoc dna srotceles ruoy gnisu ,yllaniF .noitatneserpersiht enfied taht dna srotceles dna rotcurtsnoc a yficeps ,ylgnidroccA .etanidrooc y eht dna etanidrooc x eht :srebmun fo riap a sa detneserper eb nac tniop a ,eromrehtruF .stniop fo smret ni stnemges fo noitatneserper eht enfied taht dna srotceles dna rotcurtsnoc a enfieD .tniop gnidne na dna tniop gnitrats a :stniop fo riap a sa detneserper si tnemges hcaE .enalp a ni stnemges enil gnitneserper fo melborp eht redisnoCnoitareti dna stsiL snoituloSnoitcartsbA ataD snoituloS(reverse ‘(a b c d e))remove-duplicatesmakeChange(inexact->exact (floor
floatNum))
stream-cdr
filter
stream-cons stream-car stream-ref stream-map stream-
stream-interlace
(stream-interlace integers primes) (1 1 2 2 3 3 4 5 5 7 6 11 7 13 8 17 )
fo seulav eht sevaelretni taht
,.g.E .smaerts )etinfini yllaitnetop( owt erudecorp a enfieD
dna ,
dna , ,
,
:serudecorp maerts eroc eht tnemelpmI
8 >= ))))7 6 5( 5 4()3 2( 2( ezis-eert( ,.g.E .eert eht ni seulav evitimirp fo rebmun latot eht snruter dna tnemugra na sa eert a stpecca taht )t ezis-eert( dellac noitcnuf a enfieD )))94 63 52( 52 61( )9 4( 4( >= ))))7 6 5( 5 4()3 2( 2( ))x x *()x(adbmal( pam-eert( ,.g.E .eert eht ni meti yreve ot deilppa noitcnuf nevig eht htiw erutcurts emas eht fo eert a snruter dna ,)tsil detsen( eert a dna noitcnuf a sretemarap owt stpecca taht noitcnuf pam-eert a enfieD sdnuf tneicffiusnI )01 51 egnahCekam( ,.g.E )2 0 1 3 81( )02 31.1 egnahCekam( ,.g.E )0 0 0 3 93( )05 52.01 egnahCekam( ,.g.E
.erutcel ni enod sa serudecorp eht tnemelpmI
.
:gnisu regetni na ot rebmun tniop gnitaofl
a tsac nac uoY :etoN .)seinnep slekcin semid sretrauq srallod( :tamrof gniwollof eht ni egnahc fo tsil a snruter dna stnemugra sa tnemyap a dna tsoc a sekat taht taht erudecorp a enfieD .seulav etacilpud on htiw tsil taht fo ypoc a snruter dna tnemugra sa srebmun fo tsil a sekat taht erudecorp a enfieD .evitareti/evisrucer era snoitseuq owt suoiverp eht ot srewsna ruoy taht wohs ot rof ledom noitutitsbus eht esU .)asrev eciv ro( eno evisrucer a desu noitulos suoiverp ruoy fi ssecorp evitareti na esu tub tsil a esrever ot erudecorp rehtona enfieD
smaertS snoituloS
(stream-interlace ones zeroes) (1 0 1 0 1 0 1 0 1 0 )
bn
(expt b n)
ot esu :piT( .i regetni evitagennon rof ,i3 dna i2 mrof
eht fo sregetni eht yb demrof ,. ,72 ,8 ,9 ,4 ,3 ,2 ,1,1 :ecneuqes rebmun adbmaL eht setareneg taht maerts etinfini na tcurtsnoC ,.g.E
snoituloS .) etaluclac
Reviews
There are no reviews yet.