axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Boot/SPAD package syntax


From: Ralf Hemmecke
Subject: Re: [Axiom-developer] Boot/SPAD package syntax
Date: Tue, 05 Jun 2007 09:46:39 +0200
User-agent: Thunderbird 2.0.0.0 (X11/20070326)

I use the syntax FOO::BAR, but not FOO'BAR, for "package-call".
New Boot treats FOO'BAR as a "single" identifier.

Ok, a "package-call" is a Lisp concept.  As far as I know neither Boot
nor SPAD admit the concept of a package.

I don't know much about Lisp and Boot, but Aldor defines what a package is (maybe it is different from what you mean here) and I always thought, that this is a concept that also exists in SPAD.

See src/algebra/mappkg.spad.pamphlet:

MappingPackageInternalHacks1(A: SetCategory): MPcat == MPdef where
    NNI ==> NonNegativeInteger

    MPcat == with
        iter:  ((A -> A), NNI, A) -> A
          ++\spad{iter(f,n,x)} applies \spad{f n} times to \spad{x}.
        recur: ((NNI, A)->A, NNI, A) -> A
          ++\spad{recur(n,g,x)} is \spad{g(n,g(n-1,..g(1,x)..))}.

    MPdef == add
        iter(g,n,x)  ==
            for i in 1..n repeat x := g x     -- g(g(..(x)..))
            x
        recur(g,n,x) ==
            for i in 1..n repeat x := g(i,x)  -- g(n,g(n-1,..g(1,x)..))
            x

I would call that a package.

I am not really sure about SPAD, but in Aldor I would call that as

  A ==> Integer;
  g(i: Integer): Integer == i;
  n: NNI := 10;
  a: A := 3;
  iter(g, n, a)$MappingPackageInternalHacks1(A);

or

  (iter$MappingPackageInternalHacks1(A))(g,n,a)

You probably mean something else...

Ralf




reply via email to

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