Page 1 of 1

sample defun with return

Posted: Tue Oct 02, 2012 12:59 pm
by rodrigo_sjc_sp
I need a sample code Lisp .

A function(defun) returning value

A simple example


Thanks
Rodrigo

Re: sample defun with return

Posted: Tue Oct 02, 2012 1:26 pm
by Goheeca
The internet is full of that.
Anyway:

Code: Select all

(defun value-returner () 'value)

Re: sample defun with return

Posted: Tue Oct 02, 2012 7:32 pm
by nuntius
Please see one of the useful resources in the FAQ.

Re: sample defun with return

Posted: Wed Oct 03, 2012 4:38 am
by sylwester

Code: Select all

(defun return-a-value (return-value)
           return-value)

(return-a-value 'test) ==> test
(return-a-value (* 3 6)) ===> 18