[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Unions in Spad
From: |
Stephen Wilson |
Subject: |
Re: [Axiom-developer] Unions in Spad |
Date: |
13 Jul 2007 03:12:01 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Hi Ralf,
This is late in the night for me, so please forgive the terse
response.
Ralf Hemmecke <address@hidden> writes:
> =--- union-test.spad ----
> > )abbrev domain BAR Bar
> > Bar() : Exp == Impl where
> > Exp == with
> > inj : Integer -> %
> > inj : String -> %
> > prj : % -> Integer
> > Impl == add
> > Rep := Union(tag1: Integer, tag1: String)
> > inj (n : Integer) : % == [n]
> > inj (s : String) : % == [s]
> > prj p == (p::Rep).tag1
>
> Stephen, have you ever thought about the difference between Rep and %?
Yes.
> The type of [n] would be Rep, since there is no function
>
> bracket: Integer -> %
Perhaps you are thinking in terms of Aldor? In Spad, we have:
1) -> )sh Union(tag1: Integer, tag1: String)
Union(tag1: Integer,tag1: String) is a domain constructor.
------------------------------- Operations --------------------------------
?=? : (%,%) -> Boolean ?case? : (%,tag1) -> Boolean
?case? : (%,tag1) -> Boolean coerce : % -> OutputForm
construct : Integer -> % construct : String -> %
?.? : (%,tag1) -> Integer ?.? : (%,tag1) -> String
Here, `bracket' is known as `construct', and as you can see, there are
two such operations.
>
> so if you write
>
> inj (n : Integer) : % == [n]
>
> as above, that should be a type error.
On the contrary, it is a call to:
construct : Integer -> %
which is well typed.
Take care,
Steve
- Re: [Axiom-developer] Unions in Spad, (continued)
- Re: [Axiom-developer] Unions in Spad (Correction), William Sit, 2007/07/13
- Re: [Axiom-developer] Unions in Spad (Correction), Stephen Wilson, 2007/07/13
- [Axiom-developer] Re: keyword arguments, was: Unions in Spad (Correction), Martin Rubey, 2007/07/14
- Re: [Axiom-developer] Re: keyword arguments, was: Unions in Spad (Correction), Bill Page, 2007/07/21
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad,
Stephen Wilson <=
- Re: [Axiom-developer] Unions in Spad, Stephen Wilson, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Gabriel Dos Reis, 2007/07/13
- rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, Gabriel Dos Reis, 2007/07/13
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Ralf Hemmecke, 2007/07/13
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Gabriel Dos Reis, 2007/07/14
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Ralf Hemmecke, 2007/07/14
- Re: [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Gabriel Dos Reis, 2007/07/14
- [Axiom-developer] Re: [Aldor-l] rep, per, Rep in SPAD/Aldor, Christian Aistleitner, 2007/07/14
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13