transform functions to macro

You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Forum rules
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
Post Reply
omarasl
Posts: 12
Joined: Sun Nov 25, 2012 6:19 am

transform functions to macro

Post by omarasl » Mon Dec 31, 2012 5:19 pm

Hello everybody,
actually I post many posts but really I can not solve this problem , I want somebody to help me please
I have these functions to sort a list an I want to transform them to macros or have some macros to do the same thing .

(defun isMember (L E)

"Test if element E is a member of a sorted list L."

(if (null L)

nil

(if (> E (first L))

(isMember (rest L) E)

(= E (first L)))))

(defun insertm (L E)

"Insert element E into a sorted list L to produce a new sorted list."

(if (null L)

(list E)

(if (> E (first L))

(cons (first L) (insertm (rest L) E))

(if (= E (first L))

L

(cons E L)))))

(defun removeelm (L E)

"Remove element E from sorted list L to produce a new sorted list."

(if (null L)

nil

(if (> E (first L))

(cons (first L) (removeelm (rest L) E))

(if (= E (first L))

(rest L)

L))))

pleeeeeeeeeeeeeeeeeeease help me

sylwester
Posts: 133
Joined: Mon Jul 11, 2011 2:53 pm

Re: transform functions to macro

Post by sylwester » Thu Jan 03, 2013 2:35 pm

First off, you should edit your post. Mark the code and press Code. It will look better.
What have you tried so far?
I'm the author of two useless languages that uses BF as target machine.
Currently I'm planning a Scheme compiler :p

Post Reply