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

Re: sections



Original-Via: uk.ac.ukc; Thu, 25 Oct 90 10:17:54 BST
From: Thomas Johnsson <johnsson>
Date: Thu, 25 Oct 90 10:07:14-0100
To: kent
Cc: haskell@cs.glasgow.ac.uk
In-Reply-To: Kent Karlsson's message of Wed, 24 Oct 90 17:25:32 +0100 <9010241625.AA01500@birk.cs.chalmers.se>
Subject: Re: sections
Original-Sender: johnsson%se.chalmers.cs@sunic.sunet.se
Sender: haskell-request@cs.glasgow.ac.uk



Kent Karlsson proposes:
   I think the "placeholder" in a s.c. section should be explicitly
   marked, either by a '?', or, if you don't want to reserve a new
   symbol, by an '_'.  E.g.:

   (_ - 1)    (1 - _)    (_ + 1)   (_ = 0)

   1. This would also allow writing 'subtract n' as a section.

   2. This would generalize to the 'f _ 1 2' case (even if it's not
      included in "the standard").

   3. And just in case prefix/postfix operators were to be introduced
      (whether as a standard, or just in some implementations...),
      this notation for sections would not be a hindrance.

At first glance, I like your idea! It generalises nicely to e.g. 
  (if _ then e1 else e2), 
etc.  But, hm, presumably you would have to restrict the number
of placeholders to one in an expression?  Or would you want to allow
(_ + _), (if _ then e1 else _), etc?
In writing increasingly complicated "sections", there comes a point where
a lambda expression becomes more readable.

-- Thomas