help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing to buffer/file


From: Pascal J. Bourguignon
Subject: Re: Writing to buffer/file
Date: Wed, 08 Dec 2010 15:28:32 -0000
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux)

naugiedoggie <michael.a.powe@gmail.com> writes:

> On Sep 14, 10:14 am, p...@informatimago.com (Pascal J. Bourguignon)
> wrote:
>> Michael Powe <michael+g...@trollope.org> writes:
>
>> Even before that, you're misunderstanding the basic syntaxis for Lisp.
>
>> To call a function in lisp, we write a LIST, whose first element is the
>> name of the function, and whose other elements are the arguments to
>> that function.
>
> Every journey begins with a step.
>
>> To write a list, we write an open parenthesis, the elements of the list
>> separated by spaces, and a close parenthesis.
>>
>> sexp ::= atom | '(' {sexp} ')' .
>>
>> function-call ::= '(' function-name {argument} ')'
>>
>>     (hash-to-list (myhash mylist))
>>
>> Since myhash is not the name of a function the subexpression
>>
>>     (myhash mylist)
>
> Why doesn't it through an error? e.g. '(void-function myhash)'?

Indeed this is what I would expect.  Unless you've defined a function
named myhash.

> I took that hash-to-list function from Xah Lee's emacs pages.  I did
> change it to pass in the list variable.

You just cannot in lisp pass 'variables' as argument to a
function. You can only pass values.  

In lisp, arguments are always passed by value.

(It happens that some values are references, and some values may be
names (ie. symbols), but in both case, they're values, and it's the
value that's passed to the function).


So, since mylist is always bound to nil when you call hash-to-list,
you always pass nil as second argument, and this is pointless.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]