Re: A few newbie questions

"Pascal J. Bourguignon" <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Organization Informatimago
Message-ID <[email protected]>
"Yves S. Garret" <[email protected]> writes:

> Hi, just curious.  I ran the little hello world function that you've described with and without the
> (values)) at the end.  Without, I got a NIL returned.  With the (values)), I did not have that NIL
> returned.  I would like to know why this is happening?
>
> I'm guessing that all functions in Lisp return something, even if it's a null (you have "void" in C/
> C++ and Java).  So, without the (values)), the function by default returns the null.  However, with
> the (values)), we are returning that variable, which is not bound to anything, which is just a blank
> if it's not bound to nothing.  Am I correct?  If not, please feel free to explain.

There's no variable named values.
There's a function named values, which returns a variable number of
values: one of each argument.

Therefore (values) returns no value, since it has no argument.


A function doesn't return nil by default, it returns whatever its
returning form returns.  In this case if you remove the call to VALUES,
it's FORMAT which returns only one value, nil, which are taken by the
implicit PROGN which returns them, which are taken by the BLOCK
<function-name> which returns them, which are taken by the LAMBDA
implicit PROGN which returns them.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.