New function - makelist alternative: table()ing Lisp ECL 9.4.1
Subject: New function - makelist alternative: table()ing Lisp ECL 9.4.1
From: Oliver Kullmann
Date: Sun, 10 May 2009 21:54:14 +0100
On Sun, May 10, 2009 at 03:47:51PM -0400, Stavros Macrakis wrote:
> On Sun, May 10, 2009 at 3:14 PM, Oliver Kullmann
> <O.Kullmann at swansea.ac.uk> wrote:
> > On Sun, May 10, 2009 at 03:07:44PM -0400, Stavros Macrakis wrote:
> >> As I have documented before, create_list has a fatal design flaw:
> >> ambiguous syntax, unlike Ziga's 'table', which is unambiguous. ?I
> >> would recommend that create_list be removed from the system after
> >> table is fully integrated.
>
> > sorry, but that's nonsense: create_list is the single most useful
> > function in Maxima! In my system I use it in likely over 1000 places,
> > and I NEVER encountered any problem (different from the rest of Maxima).
>
> Just because one user never encountered a problem does not mean there isn't one.
>
But you haven't give yet any example of a problem (not to mention there is
apparently not a single use-case of somebody actually having a problem).
> > ...I know you have a problem with create_list, but you never
> > gave any reason except of your repeated statement.
>
> You may disagree with me, but accusing me of not giving any reason is offensive.
>
> I first stated my objections to create_list on this list on Apr 7,
> 2007 and forwarded them to the list again on Oct 12, 2008. See below.
>
I know your e-mail, but if some Maxima function
needs to be removed since it might create misunderstandings,
then likely most of Maxima functions need to be
removed. And with create_list we don't have the
problem that it computes something incorrectly;
see below.
What should count for evaluating usefulness is user experience,
and I now made a concrete count in my library, and counted
251 lines with create_list; I made a sample,
sometimes one has several create_list on
the same line (often nestings), so 300 occurrences might
be a proper count (so my stated 1000 was
exaggerated). (But in my daily work I use
create_list permanently; I would bet it is
the most used function.)
I also considered which cases are used, and
I use "i,first,last" as well as "i,list",
both pure and mixed.
I wish Maxima had more useful functions like create_list.
Considering your example (it seems better to me to let the arguments
explicitly show up in the result, so I replaced i*j by [i,j]; I don't
think that this changes your argument, it only makes it clearer what
happens):
(a:1,b:2,c:3,d:4)$
create_list([i,j], i, a, b, j, c, d);
[[1,3],[1,4],[2,3],[2,4]
(a:[1,2],j:[3,4],d:[5,6])$
create_list([i,j], i, a, b, j, c, d);
[[1,[3,4]],[1,[3,4]],[1,[3,4]],[1,[3,4]],[2,[3,4]],[2,[3,4]],[2,[3,4]],[2,[3,4]]]
Where is the problem? This is exactly as it should be.
Oliver
P.S. Isn't this Lisp? In the context of programming languages
like Java or C I could understand that this wouldn't fit into the flow
of the language, but create_list perfectly fits into what one (or at least I)
expects from Lisp.
Likely one should specify in the documentation of create_list how it interpretes
its arguments: Yet I always assumed that this happens from left to
right, and if one integer shows up then the next must also be one.
I believe this is nice (and integers and lists seems to be the two basic
types in Lisp, so the whole thing seems well-defined to me).
P.S.P.S. Sure, having additionally more powerful list creation at hand
can't hurt ;-) But actually yet it never occurred to me that something is
missing, but nesting create_list if needed seemed always appropriate and
intuitive.
A difference might be whether one comes more from a functional-language
perspective or not (I don't): Living in the functional world likely
people actually have to use a lot of complicated list-handling (since
the jobs can't be done otherwise), but fortunately Lisp supports also
the procedural view, and so there is much less need for all the usual
list-constructions.