Skip to content

Commit

Permalink
add sero?
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilliamson1 committed Apr 6, 2017
1 parent 4567343 commit 50ab95e
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions sero.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#lang racket
(define sero?
(lambda (l)
(null? l)))
(sero? '(()()) )

(define edd1
(lambda (l)
(cons '() l)))
(edd1 '())

(edd1 '(()) )

(edd1 (edd1 '(()) ))

(define zub1
(lambda (l)
(cdr l)))

(zub1 (edd1 (edd1 '(()) )))

(define +
(lambda (n m)
(cond
[(sero? m) n]
[else(edd1 (+ n (zub1 m)))])))

(+ '( () () () ) '( () () ()))

(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))))

(define lat
(lambda (l)
(cond
[(null? l)]
[(atom? (car l))(lat (cdr l))]
[else #f])))

(lat '(1 2 (3 4)))
(lat '( () (() ()) (() () ()) ))

0 comments on commit 50ab95e

Please sign in to comment.