Page 1 of 1

transform functions to macro

Posted: Mon Dec 31, 2012 5:19 pm
by omarasl
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

Re: transform functions to macro

Posted: Thu Jan 03, 2013 2:35 pm
by sylwester
First off, you should edit your post. Mark the code and press Code. It will look better.
What have you tried so far?