Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Lisp > Re: Capturing a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 15 Topic 13120 of 13806
Post > Topic >>

Re: Capturing a function in a closure

by Rainer Joswig <joswig@[EMAIL PROTECTED] > Jul 22, 2008 at 09:43 PM

In article <slrng8cdk5.h0c.gwillen@[EMAIL PROTECTED]
>,
 Glenn Willen <gwillen@[EMAIL PROTECTED]
> wrote:

> In article <6emqgpF7pnpkU1@[EMAIL PROTECTED]
>, Pascal Costanza wrote:
> > Yes, this is a terrible hack. It's ugliness will manifest itself when 
> > you attempt to file-compile code with such references:
> > 
> > (defun foo (x) x)
> > 
> > (defun bar (x) (apply #.#'foo (list x)))
> > 
> > If you file-compile such code, the compiler will complain because the 
> > function foo is not defined yet at readtime.
> 
> Right, this is why I emphasized read-time. What I really want to capture
is
> function-definition-evaluation-time. Unfortunately I've done very little
> working with or thinking about compilation versus interpretation, which
means
> there are more 'times' than I'm really comfortable with.
> > 
> > What you want is load-time-value:
> > 
> > (defun foo (x) x)
> > 
> > (defun bar (x) (apply (load-time-value #'foo) (list x)))
> 
> Interesting! That's a form I've never heard of before.

On the Lisp Machine one could display a random hint with a command.
I propose a random CLHS page of the day. The Hyperspec has
a file with links for each Common Lisp symbol.  One could for example
email a clhs html file for a random CL symbol each day. After
a few years you can then start over... ;-) Planet Lisp
could also display the CLHS symbol of the day. Etc...

> The CLHS suggests it is
> indeed precisely what I was looking for. Is "load time" always the same
as the
> time at which the function definition is evaluated? (I guess in the
compiled
> universe, there's no such time, just the time at which it's compiled and
the
> time at which the image is loaded, this being the latter. In the
interpreted
> universe I guess "load-time" is treated as precisely what I want,
though.)

Also make sure you read the entry for FUNCTION. (function foo) is
the expanded version of #'foo).

http://www.lispworks.com/do***entation/HyperSpec/Body/s_fn.htm

> 
> Thanks a lot!
> gwillen

-- 
http://lispm.dyndns.org/
 




 15 Posts in Topic:
Capturing a function in a closure
Glenn Willen <gwillen@  2008-07-22 21:10:44 
Re: Capturing a function in a closure
Pascal Costanza <pc@[E  2008-07-22 21:25:13 
Re: Capturing a function in a closure
Glenn Willen <gwillen@  2008-07-22 21:35:38 
Re: Capturing a function in a closure
Rainer Joswig <joswig@  2008-07-22 21:43:39 
Re: Capturing a function in a closure
Vassil Nikolov <vnikol  2008-07-23 00:41:34 
Re: Capturing a function in a closure
pjb@[EMAIL PROTECTED] (P  2008-07-23 08:45:17 
Re: Capturing a function in a closure
Kent M Pitman <pitman@  2008-07-22 17:00:06 
Re: Capturing a function in a closure
Vassil Nikolov <vnikol  2008-07-23 00:44:01 
Re: Capturing a function in a closure
Barry Margolin <barmar  2008-07-23 05:03:35 
Re: Capturing a function in a closure
pjb@[EMAIL PROTECTED] (P  2008-07-23 11:38:17 
Re: Capturing a function in a closure
Vassil Nikolov <vnikol  2008-07-23 23:38:42 
Re: Capturing a function in a closure
Kaz Kylheku <kkylheku@  2008-07-24 19:12:41 
Re: Capturing a function in a closure
Kent M Pitman <pitman@  2008-07-24 19:37:56 
Re: Capturing a function in a closure
Kent M Pitman <pitman@  2008-07-24 19:26:00 
Re: Capturing a function in a closure
Kaz Kylheku <kkylheku@  2008-07-24 19:08:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 7:54:45 CST 2008.