Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - skibud2

#1
newLISP newS / Macors that write functions/macros?
August 04, 2006, 06:32:18 AM
In clisp, you can do something like this:


(defun create-symbol (str)
  (intern (string-upcase str)) )


(defmacro create-functions (group-name)
  (let ((f1 (create-symbol
             (format nil "~a~a" group-name 1)))
        (f2 (create-symbol
             (format nil "~a~a" group-name 2))) )
    `(progn
       (defun ,f1 (arg) (+ arg 1))
       (defun ,f2 (arg) (+ arg 2)) ) ) )


if you call:

(create-functions foo)





it generates



(defun foo1 (arg) (+ arg 1)) and

(defun foo2 (arg) (+ arg 2))



Can you do something similar in newLisp??