Difference between revisions of "Singleton list confusion"

From HaskellWiki
Jump to navigation Jump to search
(short introduction)
 
(further example, but same author)
Line 2: Line 2:
 
People sometimes write argument patterns like <hask>[x]</hask>, hoping that <hask>x</hask> will assume all values of a list successively.
 
People sometimes write argument patterns like <hask>[x]</hask>, hoping that <hask>x</hask> will assume all values of a list successively.
 
Maybe it is some kind of [[list comprehension]].
 
Maybe it is some kind of [[list comprehension]].
  +
<!-- the first time I saw this in students homework solutions -->
   
 
See for example
 
See for example
  +
Haskell-Cafe about
Haskell-Cafe about [http://www.haskell.org/pipermail/haskell-cafe/2008-April/041556.html Pattern match failure]
 
  +
[http://www.haskell.org/pipermail/haskell-cafe/2008-April/041496.html testing for same characters in lists of strings],
 
[http://www.haskell.org/pipermail/haskell-cafe/2008-April/041556.html Pattern match failure]
   
 
[[Category:Syntax]]
 
[[Category:Syntax]]

Revision as of 15:46, 10 April 2008

Why do Haskell newcomers frequently believe, that list variables must be enclosed in brackets? People sometimes write argument patterns like [x], hoping that x will assume all values of a list successively. Maybe it is some kind of list comprehension.

See for example Haskell-Cafe about

testing for same characters in lists of strings,
Pattern match failure