axiom-developer
[Top][All Lists]

## [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

```Changes http://page.axiom-developer.org/zope/mathaction/102SolveSinhZCoshZZ/diff
--
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)
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?
--