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


Computer Aided Design - CAD > Cadence > Re: Passing A F...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3915 of 4195
Post > Topic >>

Re: Passing A Function to a Function

by "S. Badel" <stephane.badel@[EMAIL PROTECTED] > Mar 8, 2008 at 05:54 PM

> (defun ekdToggle (f @[EMAIL PROTECTED]
 (valuesPair (list t nil)))
>   "When you want the OTHER value a function returns."
>   (car (remove (f) valuesPair)))
> 
>> (ekdToggle 'leIsInstSelectable)
> 
> *Error* eval: undefined function - f
> 
> Hey!  What gives?
> 

The value of f is a symbol. The symbol's function slots contains the
actual address of the function 
to be called.

When you do (f) you are accessing the function slot of the symbol f, which
is not what you intend to do.

What you should do is use funcall(f) or apply(f args).

Note that, when valuePair is '(t nil), it's equivalent to a not(), just a
little overkill.

Cheers,
Stéphane
 




 3 Posts in Topic:
Passing A Function to a Function
Edward <edward.dodge@[  2008-03-07 19:14:28 
Re: Passing A Function to a Function
"S. Badel" <  2008-03-08 17:54:15 
Re: Passing A Function to a Function
cadence <jimka@[EMAIL   2008-03-09 14:43:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Thu Aug 28 14:18:32 CDT 2008.