sample defun with return

Discussion of Common Lisp
Post Reply
rodrigo_sjc_sp
Posts: 3
Joined: Mon Oct 01, 2012 6:26 am

sample defun with return

Post by rodrigo_sjc_sp » Tue Oct 02, 2012 12:59 pm

I need a sample code Lisp .

A function(defun) returning value

A simple example


Thanks
Rodrigo

Goheeca
Posts: 271
Joined: Thu May 10, 2012 12:54 pm
Contact:

Re: sample defun with return

Post by Goheeca » Tue Oct 02, 2012 1:26 pm

The internet is full of that.
Anyway:

Code: Select all

(defun value-returner () 'value)
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: sample defun with return

Post by nuntius » Tue Oct 02, 2012 7:32 pm

Please see one of the useful resources in the FAQ.

sylwester
Posts: 133
Joined: Mon Jul 11, 2011 2:53 pm

Re: sample defun with return

Post by sylwester » Wed Oct 03, 2012 4:38 am

Code: Select all

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

(return-a-value 'test) ==> test
(return-a-value (* 3 6)) ===> 18
I'm the author of two useless languages that uses BF as target machine.
Currently I'm planning a Scheme compiler :p

Post Reply