[Top][All Lists]

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

[Axiom-developer] [#102 solve(sinh(z)=cosh(z), z) ] "foo"/list is a BOOT

From: Bill Page
Subject: [Axiom-developer] [#102 solve(sinh(z)=cosh(z), z) ] "foo"/list is a BOOT construction
Date: Tue, 18 Oct 2005 17:50:02 -0500

This construct occurs frequently in the BOOT code in src/interp so
I guess that this is actually a carry-over from the BOOT language.

'reduce' is defined as either::

      reduce(fn, v, ident) ==
        val := ident
        for i in minIndex v .. maxIndex v repeat
          val := fn(qelt(v, i), val)

for array-like structures or recursively (for lists)::

      reduce(fn, l, ident) ==
        empty? l => ident
        reduce(fn, rest l, fn(first l, ident))

It seems doubtful to me that either of these would be optimized
by SPAD to a simple lisp primitive (but I could be wrong). Anyway
I agree that it makes more sense to use 'reduce' in the algebra
code especially since there is no "/" operation defined in the
domain 'List', although this might introduce more circularity
(mutual recursion) in the algebra code.

I wonder if it would work to define the operation::

  "/":((S, R) -> R, A, R) -> R

as a synonym for 'reduce' in 'List' and then recompile most of
the algebra code or would SPAD die of embarrassment?
forwarded from

reply via email to

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