On Jul 15, 2009, at 2:30 PM, Hans Aberg wrote:
If ++ could be pattern matched, what should have been the result of
let (x++y)=[1,2,3] in (x,y)?
It will branch. In terms of unification, you get a list of
substitutions.
f :: [a] - ([a],[a])
f (x ++ y) = (x,y)
For an argument s, any pair
Hi,
I do not notice this before. fun ([0, 1] ++ xs) = .. in my code
could not be compiled, parse error.
--
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
2009/7/15 Magicloud Magiclouds magicloud.magiclo...@gmail.com:
Hi,
I do not notice this before. fun ([0, 1] ++ xs) = .. in my code
could not be compiled, parse error.
++ is a function; you can't pattern-match on that.
Cheers,
Thu
___
Haskell-Cafe
2009/7/15 minh thu not...@gmail.com:
2009/7/15 Magicloud Magiclouds magicloud.magiclo...@gmail.com:
Hi,
I do not notice this before. fun ([0, 1] ++ xs) = .. in my code
could not be compiled, parse error.
++ is a function; you can't pattern-match on that.
But here you can match against
Technically, the reason is not that (++) is a function, but that it is
not a constructor of the [] type.
And, not only is it not a constructor, but it also *can't* be one,
because the main characteristic of pattern matching in Haskell is that
it is (contrary to Prolog's unification) unambiguous
On 15 Jul 2009, at 12:25, Eugene Kirpichov wrote:
If ++ could be pattern matched, what should have been the result of
let (x++y)=[1,2,3] in (x,y)?
It will branch. In terms of unification, you get a list of
substitutions.
Hans
___
On Wed, Jul 15, 2009 at 3:08 AM, Hans Aberg hab...@math.su.se wrote:
On 15 Jul 2009, at 12:25, Eugene Kirpichov wrote:
If ++ could be pattern matched, what should have been the result of
let (x++y)=[1,2,3] in (x,y)?
It will branch. In terms of unification, you get a list of substitutions.
Err, technically, aren't functions and constructors mutually exclusive? So
if something is a function, it's, by definition, not a constructor?
On Wed, Jul 15, 2009 at 6:25 AM, Eugene Kirpichov ekirpic...@gmail.comwrote:
Technically, the reason is not that (++) is a function, but that it is
not
No. Most constructors are functions, e.g. Just :: a - Maybe a - a function.
On the other hand, Nothing :: Maybe a is a constructor, but not a function.
Andrew Wagner wrote:
Err, technically, aren't functions and constructors mutually exclusive?
So if something is a function, it's, by
On 15 Jul 2009, at 13:22, Luke Palmer wrote:
If ++ could be pattern matched, what should have been the result of
let (x++y)=[1,2,3] in (x,y)?
It will branch. In terms of unification, you get a list of
substitutions.
f :: [a] - ([a],[a])
f (x ++ y) = (x,y)
For an argument s, any pair (x,
On Wed, Jul 15, 2009 at 08:09:37AM -0400, Andrew Wagner wrote:
Err, technically, aren't functions and constructors mutually exclusive? So
if something is a function, it's, by definition, not a constructor?
I guess what Eugene Kirpichov meant was that not being a function
(and being a
On Jul 15, 2009, at 9:59 PM, minh thu wrote:
2009/7/15 Magicloud Magiclouds magicloud.magiclo...@gmail.com:
Hi,
I do not notice this before. fun ([0, 1] ++ xs) = .. in my code
could not be compiled, parse error.
++ is a function; you can't pattern-match on that.
Doesn't matter, it's not
On Jul 15, 2009, at 9:57 PM, Magicloud Magiclouds wrote:
Hi,
I do not notice this before. fun ([0, 1] ++ xs) = .. in my code
could not be compiled, parse error.
I apologise to everyone for my previous message in this
thread. There was a Haskell message in amongst some Erlang
messages, and
13 matches
Mail list logo