Deciding between operators ">>", "<<" and ","
Christopher Diggins — 2006-02-14 15:33:50
I am trying to decide how to arrange the operators in Unimperative.
Currently I have ">>" meaning right-concatenation. E.g. f >> g == g . f; And
the "<<" means left-concatenation. E.g. f << g == f . g; I also have the
option of overloading the comma operator as well as (or instead of) these
operators. I was wondering if anyone has an opinion, if they could share
their thoughts. Thanks!
--
Christopher Diggins
http://www.unimperative.com
[Non-text portions of this message have been removed]
John Cowan — 2006-02-14 16:38:48
Christopher Diggins scripsit:
> I am trying to decide how to arrange the operators in Unimperative.
> Currently I have ">>" meaning right-concatenation. E.g. f >> g == g . f; And
> the "<<" means left-concatenation. E.g. f << g == f . g; I also have the
> option of overloading the comma operator as well as (or instead of) these
> operators. I was wondering if anyone has an opinion, if they could share
> their thoughts. Thanks!
It's hard to judge unless you explain what "f . g" means. Originally it meant
\x.f(g(x)), but now it often means \x.g(f(x)) instead, and far too many
authors leave you to glork what is meant from context.
I prefer the original version, so I would want "f, g" to mean \x.f(x(g)).
--
Business before pleasure, if not too bloomering long before.
--Nicholas van Rijn
John Cowan <
cowan@...>
http://www.ccil.org/~cowan http://www.ap.org
Christopher Diggins — 2006-02-14 17:36:02
Sorry I wasn't clear. I meant f . g to mean the composition operator,
i.e. f(g);
Another option is that instead of g >> f and f << g I could use f(g) and g,
f .
Christopher Diggins
http://www.unimperative.com
On 2/14/06, John Cowan <cowan@...> wrote:
>
> Christopher Diggins scripsit:
>
> > I am trying to decide how to arrange the operators in Unimperative.
> > Currently I have ">>" meaning right-concatenation. E.g. f >> g == g . f;
> And
> > the "<<" means left-concatenation. E.g. f << g == f . g; I also have the
> > option of overloading the comma operator as well as (or instead of)
> these
> > operators. I was wondering if anyone has an opinion, if they could share
> > their thoughts. Thanks!
>
> It's hard to judge unless you explain what "f . g" means. Originally it
> meant
> \x.f(g(x)), but now it often means \x.g(f(x)) instead, and far too many
> authors leave you to glork what is meant from context.
>
> I prefer the original version, so I would want "f, g" to mean \x.f(x(g)).
[Non-text portions of this message have been removed]
sa@dfa.com — 2006-02-14 19:14:05
i can't see the point of supporting, much less mixing, both
left and right directionality.
as i pointed out in my messages on artima, we read code left-
to-right, so for applicative languages, it is natural to read
f g h x
as "f applied to the result of g applied to the result of h
applied to x", and for concatenative languges, it is natural
to read
x h g f
"as "push x, apply h, apply g, apply f."
i note that requiring << and >> more than doubles the size of
the code (and who on earth would want to mix directionalities
within a single line?)
the first of a quotation is the left-most element. but if we
reverse the direction of the code, 'first' must either pick off
the right-most element (e.g. [1 2 3] first -> 3) or quotations
must contain the reverse of the unquoted code.
what am i missing?
Christopher
Diggins
<cdiggins@gmail.c To
om>
concatenative@yahoogroups.com
Sent by: cc
concatenative@yah
oogroups.com Subject
Re: [stack] Deciding between
operators ">>", "<<" and ","
02/14/2006 12:36
PM
Please respond to
concatenative@yah
oogroups.com
Sorry I wasn't clear. I meant f . g to mean the composition operator,
i.e. f(g);
Another option is that instead of g >> f and f << g I could use f(g) and g,
f .
Christopher Diggins
http://www.unimperative.com
On 2/14/06, John Cowan <cowan@...> wrote:
>
> Christopher Diggins scripsit:
>
> > I am trying to decide how to arrange the operators in Unimperative.
> > Currently I have ">>" meaning right-concatenation. E.g. f >> g == g .
f;
> And
> > the "<<" means left-concatenation. E.g. f << g == f . g; I also have
the
> > option of overloading the comma operator as well as (or instead of)
> these
> > operators. I was wondering if anyone has an opinion, if they could
share
> > their thoughts. Thanks!
>
> It's hard to judge unless you explain what "f . g" means. Originally it
> meant
> \x.f(g(x)), but now it often means \x.g(f(x)) instead, and far too many
> authors leave you to glork what is meant from context.
>
> I prefer the original version, so I would want "f, g" to mean \x.f(x(g)).
[Non-text portions of this message have been removed]
Yahoo! Groups Links
Christopher Diggins — 2006-02-15 03:25:40
I agree with you. So only one way: "," which reads left to right, like Joy.
Thanks for debating it with me!
On 2/14/06, sa@... <sa@...> wrote:
>
> i can't see the point of supporting, much less mixing, both
> left and right directionality.
>
> as i pointed out in my messages on artima, we read code left-
> to-right, so for applicative languages, it is natural to read
>
> f g h x
>
> as "f applied to the result of g applied to the result of h
> applied to x", and for concatenative languges, it is natural
> to read
>
> x h g f
>
> "as "push x, apply h, apply g, apply f."
>
> i note that requiring << and >> more than doubles the size of
> the code (and who on earth would want to mix directionalities
> within a single line?)
>
> the first of a quotation is the left-most element. but if we
> reverse the direction of the code, 'first' must either pick off
> the right-most element (e.g. [1 2 3] first -> 3) or quotations
> must contain the reverse of the unquoted code.
>
> what am i missing?
[Non-text portions of this message have been removed]