Store a function in a variable

Discussion of Common Lisp
Post Reply
Super_Stinger
Posts: 5
Joined: Wed May 02, 2012 3:49 am

Store a function in a variable

Post by Super_Stinger » Mon May 07, 2012 4:48 am

Is it possible to store a function in a variable?

I am creating a button with xlib (the button being a struct) and i want to store the function in that button, so when that button is clicked or activated, it will follow through with the function thats stored inside that button

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Store a function in a variable

Post by ramarren » Mon May 07, 2012 5:06 am

In Common Lisp you can access the function value of a binding with FUNCTION special operator or create an anonymous function with LAMBDA.

You can read a more explanatory explanation than the specification in Practical Common Lisp.

Post Reply