gnu-arch-users
[Top][All Lists]
Advanced

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

Re: [Gnu-arch-users] Re: Tla spork


From: Andrew Suffield
Subject: Re: [Gnu-arch-users] Re: Tla spork
Date: Sat, 28 Aug 2004 02:53:26 +0100
User-agent: Mutt/1.5.6+20040803i

On Sat, Aug 28, 2004 at 11:12:18AM +1000, Zenaan Harkness wrote:
> > Now, let's introduce a rule that says parentheses aren't required:
> > function applications bind stronger than anything else and associate
> > to the left.
> > 
> > define (fib n)
> >   if (or (= n 0) (= n 1))
> >     1
> >     + (fib (- n 1))
> >       (fib (- n 2))
> > 
> > That's got rid of a few nasty parentheses.
> 
> So you only need parens to disambiguate right?

Yes.

> > Now introduce a rule that if a function name is wrapped in (), it is a
> > prefix function, and if it is wrapped in ``, it is an infix
> > function. Currently, all functions are prefix by default. We'll
> > introduce normal logical precedence at the same time.
> > 
> > Now we introduce a rule which says that a function with a name
> > comprised of punctuation !#$%&*+./<=>address@hidden|-~ is infix by default.

> > define (fib n)
> >   if (n = 0 `or` n = 1)
> >     1
> >     fib (n - 1) + fib (n - 2)
> 
> Would it make sense for the `` wrapping to be used when defining
> the function, to change it's _default_ ordering from prefix to infix,
> or what that get too confusing for users (not knowing what is the
> default for a function), which come to think about it might be pretty
> likely, and lead to always using explicit `` or () wrapping.

Doesn't sound sensible to me. Haskell introduces a keyword to set
this. It is, however, rarely useful; principle of least surprise.

> > And now we have:
> > 
> > fib n
> >  | n == 0  = 1
> >  | n == 1  = 1
> >  otherwise = fib (n - 1) + fib (n - 2)
> > 
> > Now *that* is a real syntax (it's Haskell). Almost all the nasty
> > parentheses have been eliminated, and those that remain merely enhance
> > clarity rather than reduce it.
> 
> Thanks Andrew. That too is great stuff! I think I like haskell syntax
> better. However I think it is in fact all starting to sink in.
> 
> So is there a page or old post someone can point me to to bring pika/
> furth, whatever into the picture? I'll try google though...

Syntax for those isn't firmly decided yet. I intend to ensure that
anything I have to deal with regularly is at least as good as
Haskell. There's several ways that could happen, including "ensure
that I never have to deal with furth".

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


reply via email to

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