Assignment 13: Pie 1
intriguing-word (claim intriguing-word Atom)
lucky-num (claim lucky-num Nat)
to-go-order
(claim to-go-order (Pair Nat Atom))
MyFirstType
(claim MyFirstType U)
my-thing-and-atom
(claim my-thing-and-Atom (Pair MyFirstType U))
with-Nats
with-Nats
(claim with-Nats
(-> (-> Nat Nat
Nat)
(Pair Nat Nat)
Nat))
U
Nats
Nats Nats
(check-same Nat (with-Nats ( (n m) n) (cons 1 2)) 1) (check-same Nat (with-Nats ( (n m) (add1 m)) (cons 1 2)) 3)
at-least-two?
Nat
at-least-two?
(claim at-least-two?
(-> Nat
‘t
‘nil
Atom))
which-Nat
(Pair MyFirstType U)
Show pagesource Log In
U
. si esu dluohs eht :ETON . motA eht nruter dluohs ti esiwrehto ,)2 => si
rotanimile taN ylno eht fi .e.i( pot eht ta s1dda owt tsael tset dna enfieD ,7
ta sah tnemugra sti fi motA eht nruter dna taN a ekat dluohs ti ,
ni
– dna ,
owt eht ot )1 tnemugra( noitcnuf eht gniylppa fo tluser eht eb dluohs revo noitcnuf yranib a – :stnemugra owt sekat taht noitcnuf a ,
fo tluser ehT
.
a si mota-dna-gniht-ym taht os
enfieD ,5
.)epyt a si epyTtsriFyM taht mialc a sa nettirw evah ew os ,¡±sepyt fo esrevinu eht¡° rof trohs si dna )flesti
a si .e.i(
tpecxe( sepyt lla sebircsed taht epyt eht si :ETON .epyt a si epyTtsriFyM taht os
enfieD ,4
.)motA taN riaP( a si redro-pukcip taht os
enfieD ,3
.taN a si mun-ykcul taht os
enfieD ,2
.motA na si drow-gniugirtni taht os
enfieD ,1 sepyt ot noitcudortnI
.yllanoisacco]lmth.xedni/eip/gro.gnal-tekcar.scod//:sptth[eiPfonoitatnemucodehtkcehcotdeenthgimuoY
¦Ë ¦Ë
htiw noitinfied ruoy tseT
.)2 tnemugra( staN fo riap eht
. fo riap a tset dna enfieD ,6
staN
(check-same Atom (at-least-two? 0) ‘nil)
(check-same Atom (at-least-two? 1) ‘nil)
(check-same Atom (at-least-two? 41) ‘t)
(claim + (-> Nat Nat
Nat))
(define + ( (n m) (rec-Nat n
m
( (k k+m) (add1 k+m)))))
(claim * (-> Nat Nat
Nat))
(define * ( (n m) (rec-Nat n
0
( (k k*m) (+ m k*m)))))
expt
map
nth
vec-second
max
(claim expt (-> Nat Nat Nat))
(claim map ( ((A U)
(B U))
( ( A B) (List A)
(List B))))
(claim nth
( ((A U))
( (List A) A Nat A)))
ti srebmun owt eht fo regral eht snruter taht srebmun larutan no rotarepo yranib a ,
.nevig si tset dna enfieD ,21
ruoy ecudortnI .tnemele dnoces sti snruter dna rotcev `reporp` a sekat hcihw
.eno siht rof mialc nwo enfieD ,11
pot eht ta 1dda evah m dna n fi )))m 1bus( n kca( )n 1bus( kca( 0 = m dna pot eht ta 1dda sah n fi )1 )n 1bus( kca( 0 = n fi )m 1dda(
tluafed eht snruter ,gib oot si n fi ro ,tsil a fo tnemele htn eht snruter hcihw
enfieD ,01
.srebmun larutan fo noitaitnenopxe eb ot ¦Ë
enfieD
:si )m n kca( .noitcnuf s’nnamrekcA enfieD ,31
.noitacilpitlum dna noitidda fo snoitinfied eht era ereH ,8
¦Ë
sresaetniarB
.
enfieD ,9 stsiL
¦Ë
¦Ë
¡ú¡ú
¦°
htiw noitinfied ruoy tseT
sceV
¡ú
¦°
cvm yb 81:31 61/40/0202 :defiidom tsaL ¡¤ txt.1eip