octave-maintainers
[Top][All Lists]
Advanced

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

Re: patch : [...] = leval(name, list)


From: Etienne Grossmann
Subject: Re: patch : [...] = leval(name, list)
Date: Wed, 24 Jan 2001 12:34:22 +0000
User-agent: WEMI/1.13.7 (Shimada) FLIM/1.13.2 (Kasanui) Emacs/20.7 (i386-debian-linux-gnu) (with unibyte mode)


>From address@hidden Wed Jan 24 12:30:38 2001

#  Etienne,
#
#  I would expect to see this function under the name "apply" in the file

  I used "leval" in analogy with "feval" : "l" for list. 

#  ov-list.cc, and indeed, I have looked for it there.  But maybe that's
#  just my lisp/scheme programming coming back to haunt me.
#
#  Note that you can do the same in Matlab using the syntax:
#
#          feval("name", list{:})
#
#  or just
#
#          name(list{:})
#
#  if you happen to know the name in your function.  This is even more
#  flexible, though the syntax seems strange at first.  Unfortunately,
#  it will be a hard thing to implement.

  The point of "leval" is exactly the case in which you don't know in
advance the name of the function. If don't know the name in advance,
but you know the arguments, you can use (in Octave) :

  feval (funcname, arg1, arg2, arg3);

  If you don't know the arguments in advance, you can use the slow
trick :
  
  cmd = sprintf ("%f (%s)", funcname, arg_str);
  eval (cmd);

  where arg_str is a string that you built, which contains the names
of the arguments; note that you these arguments must be named
variables. In plain Octave, I don't know of a better way of doing
this. 


  Cheers,


  Etienne


On Sun, Dec 17, 2000 at 11:40:14AM +0000, Etienne Grossmann wrote:
> 
>   Hello,
> 
>   I got convinced that a function [...] = leval(name, list) offers
> more flexibility than [...] = feval(name, arg1,...,argn). For example,
> such a function is useful for minimization of a function that takes
> many arguments.
> 
>   I first implemented it as a leval.m which works fine, but puts an
> overhead of ~4ms (PII,350MHz), which I think is too much (there may be
> hundreds of calls to it).
> 
>   It turns out that "leval" is very simple to implement as a built-in:
> see the patch (against 2.1.32) below. It works fine : I append a test
> script too. Run it after setting "verbose=1".
> 
>   Does that patch meet the coding standards?
> 
>   Etienne
> 
> 



reply via email to

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