This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

transform functions to macro

2 posts · 4282 views

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

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