[Haskell-cafe] Mystery operator?

michael rice nowgate at yahoo.com
Mon Nov 30 13:26:13 EST 2009


So, ALL patterns are strict, unless one precedes them with "~"?

Michael

--- On Mon, 11/30/09, Brandon S. Allbery KF8NH <allbery at ece.cmu.edu> wrote:

From: Brandon S. Allbery KF8NH <allbery at ece.cmu.edu>
Subject: Re: [Haskell-cafe] Mystery operator?
To: "michael rice" <nowgate at yahoo.com>
Cc: "Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu>, haskell-cafe at haskell.org
Date: Monday, November 30, 2009, 1:10 PM

On Nov 30, 2009, at 12:47 , michael rice wrote:
From: http://www.haskell.org/haskellwiki/Blow_your_mind#Polynomials

  -- splitting in two (alternating)
  -- "1234567" -> ("1357", "246")
  -- the lazy match with ~ is necessary for efficiency, especially enabling processing of infinite lists
  foldr (\a ~(x,y) -> (a:y,x)) ([],[])

This works but can't find (~) operator anywhere. Please explain or site a reference.

http://haskell.org/onlinereport/exps.html#pattern-matching --- see the last alternative for "apat", and rule #2 of section 3.17.2.  Basically it changes a (normally strict) pattern into a lazy pattern.
 -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.comsystem administrator [openafs,heimdal,too many hats] allbery at ece.cmu.eduelectrical and computer engineering, carnegie mellon university    KF8NH
 



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091130/d5df5071/attachment.html


More information about the Haskell-Cafe mailing list