Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mathematica list function in NewLisp, Qi

8 views
Skip to first unread message

Xah Lee

unread,
Feb 9, 2008, 5:38:36 PM2/9/08
to
Can anyone consider adding these functions to lisp?

In particular, i'm thinking Qi, NewLisp would be very good candidates.

The official list of Mathematica's list manipulation functions is
here:
http://reference.wolfram.com/mathematica/guide/ListManipulation.html

It may be overwhelming for anyone exposed to it for the first time.
But the following is few of the most powerful, essential ones, with
some comment on the side.

I want the following functions:
--------------------------------------------------

(in the following, tree will mean nested list of arbitrary shape. A
node will mean a leaf or a branch of a tree)

-------------
Tree generators:

• Table; generate arbitrary rectangular tree by eval vars in a nested
loop

-------------
List/Tree parts extraction:

• Part ; http://reference.wolfram.com/mathematica/ref/Part.html

returns a collection of nodes from a given tree, using a sequence of
indexes

• Take ; http://reference.wolfram.com/mathematica/ref/Take.html

• Extract ; http://reference.wolfram.com/mathematica/ref/Extract.html

• Select ; http://reference.wolfram.com/mathematica/ref/Select.html

gets sublist by appyling a predicate function (like grep/filter)

• Cases; http://reference.wolfram.com/mathematica/ref/Cases.html

return nodes of a tree that matches a pattern

-------------

• ReplacePart

• Flatten; flattens all, or up to level n, or only those with
particular head

• Position ; returns the index(es) of a particular node (or pattern)

• Partition; chop list to sublists; generalized to cover trees at
arbitrary levels and specify overlapping and cyclic results

• Transpose; transposition of arbitrary dimensional matrix
(rectangular tree)

this is not exhaustive list... there are few others.... and this
message is botched... but my attention span ran out now.

few years ago, i started a project to implement each of these in Perl,
Python, lisp, Java, but the project got botched. ( http://xahlee.org/tree/tree.html
) Part of the reason is that i'm ambivalent about carrying it out
thoroughly, in part there are legal ramifications, in part i'm not so
sure i want to spread the extremely quality design to the Open Source
community fuck.

Xah
x...@xahlee.org
http://xahlee.org/

Mark Tarver

unread,
Feb 11, 2008, 4:19:58 AM2/11/08
to
> Part of the reason is that i'm ambivalent about carrying it out
> thoroughly, in part there are legal ramifications, in part i'm not so
> sure i want to spread the extremely quality design to the Open Source
> community fuck.
>
>   Xah
>   x...@xahlee.org
> ∑http://xahlee.org/
>
> ☄

I can't speak for NewLisp, but Qi II will be MIT licensed so you're
free from that worry.

Mark

Xah Lee

unread,
Feb 11, 2008, 4:55:43 AM2/11/08
to
Hi Mark,

Sorry for bad language. What i actually meant is that, if one copies
Mathematica's list manipulations wholesale into other langs, it may
infringe Wolfram Research's intellectual properties.

Xah
x...@xahlee.org
http://xahlee.org/

Mark Tarver

unread,
Feb 11, 2008, 5:18:59 AM2/11/08
to
> > Mark- Hide quoted text -
>
> - Show quoted text -

A lot of those functions have been around in CL for years implemented
by CL programmers in applications or as part of the language standard.

I don't think you should be intimidated from producing your work
because it has been influenced by your experiences with Mathematica.
From what I can see their lawyers would have a very hard job making it
stick. Go and do what you want to do.

Mark

Xah Lee

unread,
Feb 11, 2008, 7:00:18 AM2/11/08
to
Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:
«A lot of those [mathematica's list manipulation] functions have been

around in CL for years implemented by CL programmers in applications
or as part of the language standard.»

You speak too quick Mark.

From what i know of emacs lisp, and scheme literature (reading the
sicp book and r4rs a decade ago), and from the discussions i see from
Common Lispers here, CL has nothing like the complete set of
Mathematica's list manipulating functions. (you might want to argue
this point, thinking that since i don't know technical details of CL
so i might be wrong, but i'm quite sure of this.)

As far as i know, the closest lang that might have something
_similar_, is APL/J family.

(so called “array programing langs”
See Wikipedia here:
http://en.wikipedia.org/wiki/Array_programming_language

Note that Wikipedia lists Matlab as one. I've touched Matlab a bit in
the past. Matlab's functions have nothing near the consistency and
generalization of Mathematica's.
)

> I don't think you should be intimidated from producing your work
> because it has been influenced by your experiences with Mathematica.
> From what I can see their lawyers would have a very hard job making it
> stick. Go and do what you want to do.

Assign the job to Kenny Tilton. He seems to have nothing to do all
day.

I might do it for emacs lisp down the road for practical reasons (so
that when i program in elisp, i can use these without bothering with
cons business). I think you should consider doing it for Qi... it
really empowers the lang.

Xah
x...@xahlee.org
http://xahlee.org/

Mark Tarver

unread,
Feb 11, 2008, 8:08:03 AM2/11/08
to

> From what i know of emacs lisp, and scheme literature (reading the
> sicp book and r4rs a decade ago), and from the discussions i see from
> Common Lispers here, CL has nothing like the complete set of
> Mathematica's list manipulating functions. (you might want to argue
> this point, thinking that since i don't know technical details of CL
> so i might be wrong, but i'm quite sure of this.)

OK, fair enough. Some of those functions listed in your ref are in CL
though.

Generally CL programmers take list handling stuff for granted and its
so simple to roll your own that we don't fret too much if the language
spec does not include a specific operation. It would be very hard to
persuade people to part with $ for this. But maybe Mathematica
includes some really mind-bending operations which it is good to have
in a library.

Mark

Ingo Menger

unread,
Feb 11, 2008, 9:34:53 AM2/11/08
to
On 11 Feb., 13:00, Xah Lee <x...@xahlee.org> wrote:
> Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:
>
> «A lot of those [mathematica's list manipulation] functions have been
> around in CL for years implemented by CL programmers in applications
> or as part of the language standard.»
>
> You speak too quick Mark.
>
> From what i know of emacs lisp, and scheme literature (reading the
> sicp book and r4rs a decade ago), and from the discussions i see from
> Common Lispers here, CL has nothing like the complete set of
> Mathematica's list manipulating functions.

Since when is it forbidden to implement some algorithms, assuming
nobody has a patent on them?
For this, we don't even have to discuss the utterly absurd notion of a
patent on algorithms. The only question is, whether the "complete set
of Mathematica's list manipulating functions in any language of the
world" is patented or not.

George Neuner

unread,
Feb 11, 2008, 7:01:05 PM2/11/08
to

The algorithms may be PD, but Wolfram may have a copyright on the API
which you _might_ be infringing by implementing it elsewhere. "Look
and feel" copyrights are a PITA because you can never predict how a
judge will perceive similarities.

George
--
for email reply remove "/" from address

viper-2

unread,
Feb 12, 2008, 12:02:21 PM2/12/08
to
On Feb 9, 5:38 pm, Xah Lee <x...@xahlee.org> wrote:
> Can anyone consider adding these functions to lisp?
>
> The official list of Mathematica's list manipulation functions is
> here:http://reference.wolfram.com/mathematica/guide/ListManipulation.html

Xah, are you aware that many of the ideas in Mathematica came from
Macsyma for which there is now a GPL licensed version Maxima? See:

http://directory.fsf.org/project/maxima/
http://en.wikipedia.org/wiki/Macsyma


This means that the functions you have listed have already been
implemented in Common Lisp; look at the source code.

The Common Lisp Wiki, CLiki, also lists several mathematics packages
implemented in Common Lisp: Matlisp, Axiom, and Octave to name a few.

http://www.cliki.net/Mathematics


If you have a look at those packages, it might help you to decide how
to distinguish your proposed implementation in terms of innovation and
creativity.

Also, this kind of implementation in Common Lisp would already be
quite a mammoth task in itself, so I wouldn't try to do the same thing
in Python, Java, etc simultaneously - or the project will get botched
again.

agt


Maciej Katafiasz

unread,
Feb 12, 2008, 12:25:45 PM2/12/08
to

Are you sure you can copyright APIs at all? IANAL and IANEAUC[1], but I
seem to recall that there were precendents at least in the US copyright
law that made .h files and their kin NOT copyrighteable.

Cheers,
Maciej

[1] I Am Not Even A US Citizen

Mark Tarver

unread,
Feb 12, 2008, 12:48:57 PM2/12/08
to
> Python, lisp, Java, but the project got botched. (http://xahlee.org/tree/tree.html

> ) Part of the reason is that i'm ambivalent about carrying it out
> thoroughly, in part there are legal ramifications, in part i'm not so
> sure i want to spread the extremely quality design to the Open Source
> community fuck.
>
>   Xah
>   x...@xahlee.org
> ∑http://xahlee.org/
>
> ☄

What would be a lot more useful than reimplementing a lot of stuff
thats probably in the CL maths library; is to go in and look at these
systems. What can they do and which do you think is best? Then
choose your favourite system S and think about the numerical type
theory of the library functions. Qi gives you the power to assign
types to imported CL functions. So you could produce a type secure
version of S which can be loaded into Qi as a maths package and you
can do type secure maths.

Mark

Its actually useful to be able to rev

George Neuner

unread,
Feb 12, 2008, 5:06:55 PM2/12/08
to

Yes, APIs can be both copyrighted and patented. My father and sister
are IP attorneys so I am quite certain of this. I myself am not an
attorney, but I speak legalese fluently and I generally keep up with
changes in IP law because it increasingly affects everything software.

****
Disclaimer: don't take my word for anything ... if you have questions
or concerns consult a qualified IP attorney.
****

>but I seem to recall that there were precendents at least in the US
>copyright law that made .h files and their kin NOT copyrighteable.

In fact all code is copyrightable - both sources and binaries.

Human readable .h files and the like are copyrighted by default under
the Berne convention. Binary files produced by a tool from human
readable source are derivative works covered by the copyright on the
source that produced them. Once assembled into a distribution, the
distribution itself is copyrightable.

So the .h file itself is copyrighted as an original work. In
addition, particular contents of the file may be covered under
separate copyright which the file's author has license to reproduce or
derive (either by being also the author of the included information or
by contract with the original author or his delegate). This would be
the case with the API representation contained in the file.

So the rights conferred with an .h file may be quite complicated. For
example, the user may have limited reproduction rights (e.g., he can
give copies to coworkers), may use the file in his own original work,
but may not alter the file or transfer it to anyone not directly
involved in his work, and may not use it to develop a derivative work
(aka. a competing implementation).

Joachim Durchholz

unread,
Feb 12, 2008, 5:41:49 PM2/12/08
to

Am Dienstag, den 12.02.2008, 17:06 -0500 schrieb George Neuner:
> Yes, APIs can be both copyrighted and patented. My father and sister
> are IP attorneys so I am quite certain of this.

I'm not sure what legal system you're referring to - at least here in
Germany, you cannot copyright APIs.
You can copyright API descriptions. You can copyright the .h files. In
fact both are automatically copyrighted by the mere act of creating
them.
However, writing a program that has
#include <somecopyrightedapi.h>
in it does *not* violate the copyright. You may have to distribute your
code without including somecopyrightedapi.h, so there are obvious
problems, but nothing in copyright law prevents you from using the
header file.

Distributing binaries that used somecopyrightedapi.h is a different
issue. I don't know what the rules here are.

And, yes, you can patent APIs here, though strictly speaking that should
be impossible (but the EPA is reinterpreting the laws to mean the exact
opposite of what they originally meant).

Regards,
Jo

Paul Wallich

unread,
Feb 13, 2008, 9:26:19 AM2/13/08
to
Joachim Durchholz wrote:
> Am Dienstag, den 12.02.2008, 17:06 -0500 schrieb George Neuner:
>> Yes, APIs can be both copyrighted and patented. My father and sister
>> are IP attorneys so I am quite certain of this.
>
> I'm not sure what legal system you're referring to - at least here in
> Germany, you cannot copyright APIs.
> You can copyright API descriptions. You can copyright the .h files. In
> fact both are automatically copyrighted by the mere act of creating
> them.

In the US, that may not be true, depending on how strongly the API
constrains the contents of the .h or equivalent files. Text whose value
is purely functional is not subject to copyright, period. (But of course
there's a lot of wiggle room in "purely functional") That keeps people
from doing things like copyrighting a routine to add two numbers or
checking for a passphrase in any code that calls a library and suing
people who reproduce the passphrase in their code without permission...

viper-2

unread,
Feb 15, 2008, 12:03:40 PM2/15/08
to
On Feb 12, 12:48 pm, Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:
> On 9 Feb, 22:38, Xah Lee <x...@xahlee.org> wrote:
>
>
>
> > Can anyone consider adding these functions to lisp?

> What would be a lot more useful than reimplementing a lot of stuff


> thats probably in the CL maths library; is to go in and look at these
> systems. What can they do and which do you think is best? Then
> choose your favourite system S and think about the numerical type
> theory of the library functions. Qi gives you the power to assign
> types to imported CL functions. So you could produce a type secure
> version of S which can be loaded into Qi as a maths package and you
> can do type secure maths.

Xah:

I recently discovered that there is new, ongoing work on implementing
more efficient mathematical algorithms in Lisp. Tamas Papp's cl-sparse-
matrix,

http://www.cliki.net/cl-sparsematrix

and Jeronimo Pellegrini's Spartns,

http://aleph0.info/spartns/
http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/f8a3e184bfa86039

are examples of new implementations, while the group "lisp-matrix-
devel"

http://groups.google.com/group/lisp-matrix-devel

aims to develop better optimized, faster Lisp code for numerical
linear algebra.

Mark's suggestion is a good idea, but my previous comment was really
the result of my own concerns about the efficiency of mathematical
algorithms coded in Lisp, of which I was again reminded recently while
running through the final chapters of Lisp 3rd edition; see my code
here:
:

http://groups.google.com/group/lisp-matrix-devel/msg/0aa2558c261459c0

agt

0 new messages