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 - borisT

#1
Makes sense. Thanks for that.
#2
newLISP in the real world / list of functions question
January 30, 2019, 07:45:32 AM
I'm a newbie, I'm trying to write some code that will select and run a function from a list of functions

Typically I'm doing something like this:


(define (myfunc) (println "this is myfunc"))

;; define a list of functions
(set 'funclist '(myfunc myfunc myfunc myfunc myfunc))

;; get and run the nth = 2 item of the list
(println "getting func")
(set 'afunc (funclist 2))
(println "calling func ")

(afunc)


Whatever I try I usully get the following error message:
Quotegetting func

calling func



ERR: invalid function : (afunc)


Could anyone explain what I'm, doing wrong?

Thanks.