Skip to content

Commit

Permalink
more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
shriram committed Jun 2, 2014
1 parent c8c70e1 commit 6d01187
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions examples.rkt
Expand Up @@ -165,13 +165,21 @@ test:

test: first(list("a", "b")) =? "a"

deffun: len(l) =
deffun: lenrec(l) =
if: empty?(l)
0
else:
add1(len(rest(l)))
add1(lenrec(rest(l)))

test: length(list(1,2,3)) =? 3
test: lenrec(list(1,2,3)) =? 3

deffun: lentr(l, acc) =
if: empty?(l)
acc
else:
lentr(rest(l), add1(acc))

test: lentr(list(1,2,3), 0) =? 3

defstruct: pt has:
(x,
Expand Down

0 comments on commit 6d01187

Please sign in to comment.