- Subject: Re: make_ini and autoload
- From: "G. Milde" <g.milde@xxxxxx>
- Date: Fri, 12 May 2006 10:11:41 +0200
Dear John,
On 12.05.06, John E. Davis wrote:
> G. Milde <g.milde@xxxxxx> wrote:
array_map (Void_Type, &autoload, funs, file)
> >This looks promising but is not significantly faster:
>
> I didn't mean to imply that it would be faster. I just wanted to
> point out another mechanism to carry out this task.
Thanks. I use array_map a lot and I support advertisement for this powerfull
function. (And I did not yet think of the trick to use
array_map(Void_Type, ...
for functions without return value.)
...
> The advantage of it is that it avoids an explicit loop and in many
> cases produces simpler looking code.
This is why I would like to see the functional programming tools
extended for the new List_Type:
* conversion functions list2array(), array2list()
* either a function list_map() or a generic mapping function for all
sorts of sequences (arrys, lists (strings?)).
* a generic where() and wherefirst() accepting lists as well as arrays.
It could even support associative arrays where the return value would
be an array of key-strings (for where()) or a string (or NULL) for
wherefirst().
> [...]
> >So, here is my feature request for an improved autoload():
> > autoload(String funct, [String funct2 , ...], String file);
>
> I will look into extending autoload to support this,
Thanks a lot.
> but do not look for it anytime soon.
This could be catered for by a SLang function
%!%+
%\function{autoloads}
%\synopsis{Load functions from a file}
%\usage{autoloads(String funct, [String funct2 , ...], String file)}
%\description
% The `autoloads' function is used to declare a variable number of
% functions `funct' to the interpreter and indicate that they should be
% loaded from `file' when actually used.
% It does so by calling autoload(funct, file) for all \var{funct} arguments.
%\notes
% A future version of \sfun{autload} might provide for mulitple funct
% arguments and render \sfun{autoloads} obsolete.
%
% _autoload(funct, file, funct2, file, ..., functN, file, N) is faster,
% (albeit less convenient to write and needing an explicit number argument).
% Use this for time-critical cases.
%\seealso{_autoload, autoload, require, evalfile}
%!%-
define autoloads(file) % (funct, [funct2 , ...], file)
{
loop(_NARGS - 1)
autoload((), file);
}
Do you know of a fast way to sort the stack
funct
funct2
...
functN
file
so that it could be used by _autoload(N)?
Or is (in this special case) the explicit loop the better choice?
Thanks
Günter
--
Milde ife.et.tu-dresden.de
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]