Name: The informer 2009-04-20 0:22
So basically I'm taking a programming languages class and we are working on functional languages right now. But our class and book have been teaching us everything in scheme and yet our professor in his infinite wisdom decided to have us do an assignment in emacs CLISP. I am having a retardedly difficult time getting this to work I think primarily because of the syntax but I've also been getting errors when I call the function as well.
The tasks are as follows
Creating a function that returns the number of zeros in a given simple list of numbers
A function that deletes all the top level instances of an atom from a list
a function that returns the union of two simple list parameters that represent sets
and a function that has 2 parameters an atom and a list that returns the list with all occurrences of the atom deleted.
I solved the first two in scheme and sadly can not port it over to clisp properly and I gave up after about 2 hours of working on the first two.
Here is the scheme code for the first 2.
(define (x lis)
(cond
((null? lis) 0)
((eq? 0 (car lis)) (+ 1 (x (cdr lis)))
(else (+ 0 (x (cdr lis)))
)
)
(define (x atom lis)
(cond
((null? lis) '() )
((eq? atom lis) (x atom cdr(lis)))
((else (cons car(atom) (x atom cdr(lis)))))
)
)
Any and all help is appreciated.
The tasks are as follows
Creating a function that returns the number of zeros in a given simple list of numbers
A function that deletes all the top level instances of an atom from a list
a function that returns the union of two simple list parameters that represent sets
and a function that has 2 parameters an atom and a list that returns the list with all occurrences of the atom deleted.
I solved the first two in scheme and sadly can not port it over to clisp properly and I gave up after about 2 hours of working on the first two.
Here is the scheme code for the first 2.
(define (x lis)
(cond
((null? lis) 0)
((eq? 0 (car lis)) (+ 1 (x (cdr lis)))
(else (+ 0 (x (cdr lis)))
)
)
(define (x atom lis)
(cond
((null? lis) '() )
((eq? atom lis) (x atom cdr(lis)))
((else (cons car(atom) (x atom cdr(lis)))))
)
)
Any and all help is appreciated.