Quoting Ralf Hemmecke [EMAIL PROTECTED]:
All the exports that appear are basically the
exports of the Union (OK, Union still has a few more.)
---BEGIN aaa.as
#include aldor
#include aldorio
define ET: Category == with; -- ExpressionType
Expr: ET with {
MkInt: Integer - %;
It
Bill Page [EMAIL PROTECTED] writes:
| Quoting Ralf Hemmecke [EMAIL PROTECTED]:
|
|
| All the exports that appear are basically the
| exports of the Union (OK, Union still has a few more.)
|
| ---BEGIN aaa.as
| #include aldor
| #include aldorio
|
| define ET: Category == with; --
Bill Page [EMAIL PROTECTED] writes:
[...]
| in Haskell, by a kind of convenient abuse of notation
| (or polymorphism if you wish) 'MkInt' also denotes a
| function
|
|MkInt: Int - MkInt Int
Bill --
you're highly confused.
On 05/09/2007 10:02 AM, Bill Page wrote:
No, I think there is a serious misunderstanding here. What
Gaby is talking about are algebraic data types. See for
example:
http://en.wikipedia.org/wiki/Algebraic_data_type
In Gaby's example Haskell code:
data Expr = MkInt Int
| MkAdd
Quoting Ralf Hemmecke [EMAIL PROTECTED]:
On 05/09/2007 10:02 AM, Bill Page wrote:
...
MkInt is *not* a function which when given an Integer
returns something of type Expr. It is type *constructor*,
that is, when given 'Int' MkInt returns a subtype of Expr.
Before you criticize... I
Dear Bill,
I only have a comment on the following.
I agree that it's a source of confusion. But I must admit that
I would have written
MkInt: Int - Expr
instead. Otherwise there would be a type mismatch in
eval (MkInt i) = i
since MkInt(Int) is not equal to Expr. Don't you agree?
On Wed, 9 May 2007, Ralf Hemmecke wrote:
| And I cannot say whether MkInt is a type constructor in Haskell, since I don't
| know the language very well.
MkInt is NOT a type constructor in Haskell; Bill was very confused.
MkInt is a *data* constructor, and your understanding is correct.
-- Gaby
On Wed, 9 May 2007, Bill Page wrote:
[...]
| ... in Haskell, by a kind of convenient abuse of notation
| (or polymorphism if you wish) 'MkInt' also denotes a
| function
|
| MkInt: Int - MkInt Int
|
| that creates an object of type 'MkInt Int' from an object
| in 'Int'. I think
Quoting Ralf Hemmecke [EMAIL PROTECTED]:
Dear Bill,
I only have a comment on the following.
I agree that it's a source of confusion. But I must admit that
I would have written
MkInt: Int - Expr
instead. Otherwise there would be a type mismatch in
eval (MkInt i) = i
since
Quoting Gabriel Dos Reis [EMAIL PROTECTED]:
On Wed, 9 May 2007, Bill Page wrote:
[...]
| ... in Haskell, by a kind of convenient abuse of notation
| (or polymorphism if you wish) 'MkInt' also denotes a
| function
|
| MkInt: Int - MkInt Int
|
| that creates an object of type
Well, I did not interepret it as a slur against Haskell. However, it did
appear to me to be fundamentally incorrect to miss the core ideas of
algebraic data typea and how they lead to GADT:
data Expr where
MkInt:: Integer - Expr
MkAdd:: Expr - Expr - Expr
MkMul:: Expr -
Bill Page [EMAIL PROTECTED] writes:
| Quoting Gabriel Dos Reis [EMAIL PROTECTED]:
|
| On Wed, 9 May 2007, Bill Page wrote:
|
| [...]
|
| | ... in Haskell, by a kind of convenient abuse of notation
| | (or polymorphism if you wish) 'MkInt' also denotes a
| | function
| |
| |
On Wed, 9 May 2007, Ralf Hemmecke wrote:
| Well, I did not interepret it as a slur against Haskell. However, it did
| appear to me to be fundamentally incorrect to miss the core ideas of
| algebraic data typea and how they lead to GADT:
| data Expr where
|MkInt:: Integer - Expr
On Tue, 8 May 2007, Bill Page wrote:
| I have more to say later.
|
| We're listening. :-)
One of the issues I have with many of the various alternatives is
that they make definition of new functions operating on Expr
also impossible (by a third person) without intimate knowledge
of the
On 05/08/2007 05:21 PM, Gabriel Dos Reis wrote:
One of the issues I have with many of the various alternatives is
that they make definition of new functions operating on Expr
also impossible (by a third person) without intimate knowledge
of the representation of Expr, or modifying the Expr
Quoting Ralf Hemmecke:
...
I know the definitions in aaa.as look quite lengthy, but it probably
shows how one could generically generate appropriate Aldor code
from a more concise Syntax.
Since Aldor is already intended to be pretty concise, I don't think
it is a good idea in general to try
... I know the definitions in aaa.as look quite lengthy, but it probably
shows how one could generically generate appropriate Aldor code
from a more concise Syntax.
Since Aldor is already intended to be pretty concise, I don't think
it is a good idea in general to try to invent a new language
Ooops, I overlooked something.
---BEGIN bbb.as
#include aldor
#include aldorio
#library EXPR aaa.ao
import from EXPR;
extend Expr: OutputType == add {
import from 'MkInt', 'MkAdd', 'MkMul';
import from Integer;
(tw: TextWriter) (x: %): TextWriter == {
x case MkInt = tw
On Tue, 8 May 2007, Ralf Hemmecke wrote:
| But I thought that the Haskell
|
| data Expr = MkInt Int
| | MkAdd Expr Expr
| | MkMul Expr Expr
|
| is more like
|
| Union(Cross(Tag, Int),
| Cross(Tag, Expr, Expr),
| Cross(Tag, Exrp, Expr)).
yes, conceptually, that
Quoting Ralf Hemmecke [EMAIL PROTECTED]:
...
Bill Page wrote:
Ralf, these are just general comments about your approach and
aren't intended to be particularly critical.
Although I felt that it was the most critical reaction on one of my
mails that I have ever experienced from you, I know
By the way. Today I have learned how to include an integer
into the left or right part of Union(left: Integer, right:
Integer). There appears only an example in the AUG, but not a formal
description.
Please tell. I missing the example. I think this is quite important.
That should have been
Dear Gaby,
Gabriel Dos Reis [EMAIL PROTECTED] writes:
For concretness, here is a very classic example of inductive type
along with a function working on expression of such type, written in
both Haskell and New Boot. How would you best write that in Spad?
I'm very sorry, but I do not
On May 7, 2007 2:28 AM Martin Rubey writes:
Gabriel Dos Reis writes:
For concretness, here is a very classic example of inductive
type along with a function working on expression of such type,
written in both Haskell and New Boot. How would you best write
that in Spad?
I'm very
Here you go. But I doubt somehow that Gaby had this in mind, since this is
quite usual stuff in Axiom (grep Rep.*Union)
Martin
)abbrev domain EX Expr
Expr(): with
eval: % - Integer
coerce: Integer - %
coerce: % - OutputForm
_+: (%,%) - %
_*: (%,%) - %
== add
MkInt ==
Martin,
On May 7, 2007 4:14 AM you wrote:
Here you go. But I doubt somehow that Gaby had this in mind,
since this is quite usual stuff in Axiom (grep Rep.*Union)
...
Fantastic! Thankyou. See it again here:
http://wiki.axiom-developer.org/SandBoxInductiveType
I believe that is exactly
Martin Rubey [EMAIL PROTECTED] writes:
| Dear Gaby,
|
| Gabriel Dos Reis [EMAIL PROTECTED] writes:
|
|For concretness, here is a very classic example of inductive type
| along with a function working on expression of such type, written in
| both Haskell and New Boot. How would you best
http://wiki.axiom-developer.org/SandBoxInductiveType
I've added an Aldor version.
Ralf
___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail
On May 7, 2007 10:41 AM Gaby wrote:
Martin Rubey writes:
| Here you go. But I doubt somehow that Gaby had this in
| mind, since this is quite usual stuff in Axiom
(grep Rep.*Union)
Thanks, Martin.
I did not say I did not know how to write it. I said I don't
have a good way :-).
28 matches
Mail list logo