transform functions to macro
Posted: 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
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