[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] [Axiom-mail] manipulating series not as streams bu
From: |
Ralf Hemmecke |
Subject: |
Re: [Axiom-developer] [Axiom-mail] manipulating series not as streams but as sumations |
Date: |
Thu, 23 Oct 2014 08:50:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 10/21/2014 11:05 PM, William Sit wrote:
> I don't think Axiom is that different, and the problem that Stream
> cannot "look inside" the parameter f is not because Axiom is
> compiled. Rather it is the nature that f is passed as a function,
> which by definition, has a source domain and a target domain, and
> computes values and nothing more.
The point I wanted to make is that, in fact, Axiom has exactly that view
while other systems don't have it, because there everything is an
expression tree that can always be extracted from the parameter.
=======================================
Mathematica 9.0 for Linux x86 (64-bit)
Copyright 1988-2013 Wolfram Research, Inc.
In[1]:= f = Function[x, Sin[x]*x]
Out[1]= Function[x, Sin[x] x]
In[2]:= f[2]
Out[2]= 2 Sin[2]
In[3]:= g[fun_] := {fun[0], fun[1], fun[2], FullForm[fun]}
In[4]:= g[f]
Out[4]= {0, Sin[1], 2 Sin[2], Function[x, Times[Sin[x], x]]}
======================================
|\^/| Maple 12 (X86 64 LINUX)
._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc.
2008
\ MAPLE / All rights reserved. Maple is a trademark of
<____ ____> Waterloo Maple Inc.
| Type ? for help.
> f := x -> x*sin(x);
f := x -> x sin(x)
> g := proc (fun) print(fun); {fun(0), fun(1)} end proc;
g := proc(fun) print(fun); {fun(0), fun(1)} end proc
> g(f);
x -> x sin(x)
{0, sin(1)}
> print(g);
proc(fun) print(fun); {fun(0), fun(1)} end proc
======================================
As William said, Axiom would only allow to print f if f itself (or
rather its type) exports a function that lets you look inside or prints
the (original) expression of f. Like in OOP, if there is no such method,
there is no way to get the information.
Well, Tim might argue that everything is still in Lisp, but Lisp is not
the inherent feature of SPAD, but rather an implementation detail of
SPAD, i.e. talking about SPAD should not have any need to talk on a Lisp
level.
Ralf