A few observations Re: Clean

Ana Maria Abrão ana@ufu.br
Mon, 13 Apr 1998 14:44:06 +0000


Adrian Hey wrote:
> 
> On Mon 06 Apr, rinus plasmeijer wrote:
> 
> > >Gripe 1 - List Expressions
> > >--------------------------
> 
> >For easy porting you can define your own infix Cons operator and simply
> >change every ':' to this operator.
> 
> Yes I did think of that, but didn't try it because it wouldn't sort out the
> same problem with list patterns (unless the Clean compiler is a lot smarter
> than I thought). In fact it would be even worse because syntax wouldn't
> even be consistent within same module.
> 
Dear Adrian.
I cannot understand your question. Of course, I am not a programmer, and
I have great difficulty in going down to fine details. However, why
something like the code below wouldn't work?

($) infixr  4 :: a [a] -> [a];
($) c  d = [c:d];

Start = 1$2$3$4$[];

Consider ML. It has a Cons operator (::), and a list syntax like the one
found in Clean. The Cons operator doesn't differ from the proposed ($)
operator. Then, what is the problem with my definition? What do you mean
by 'sort out the same problem'? The lists generated by ($) is equal in
every respect to a list generated by [_ : _]. Or did I missed something?