Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;gnu clisp 2.49
- (print "Hello, world!")
- (defun counter (S a)
- (IF (EQ S NIL)
- 0
- (IF (ATOM (CAR S))
- (IF (EQ (CAR S) a)
- (+ 1 (counter (CDR S) a))
- (counter (CDR S) a)
- )
- (+ (counter (CAR S) a) (counter (CDR S) a))
- )
- )
- )
- (print (counter `(1 2 3 4 (4 5 6 4)) 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement