[Haskell-cafe] Re: New to Haskell
Ketil Malde
ketil+haskell at ii.uib.no
Tue Dec 18 05:50:46 EST 2007
"Cristian Baboi" <cristi at ot.onrc.ro> writes:
> I mean anything that you can put between "{" "}", and between ";"
Okay, there you have it then: the syntax for a block is a {, followed
by elements separated by ;s and terminated by a }.
Perhaps you are really asking about how the layout rule works? (Which
has already been answered, btw.)
> Is this ([1 ,2 ,3 ,4]) a tuple or what ?
> It has commas in it!
Good observation. Lists also have commas in them, and strings can,
too. ",,," is not a tuple, either. A tuple would have a (, and
subexpressions separated by commas, and terminated by ). The
subexpressions would need to be maximal, and have no superexpression
except the tuple.
I must admit I don't understand why you find this difficult, I've had
my share of problems grokking Haskell, but tuple syntax has always
seemed quite natural.
>>> - the fact that lambda expressions are not the same thing
>>> as "algebraic data" values
>> It might help to know why you think they might be the same;
>> the syntax is different and the name is different...
> Ah, just a thought, nothing more.
> Lambda expressions are values, which is just data, after all.
Yes.
> Even C can apply a function variable to an argument (function pointers).
Would you say that functions and structs in C are the same thing
because of this?
>> This is a fundamental property of the language. A lambda
>> expression is programme and at runtime the system doesn't
>> know one lambda expression from another (all it can do with
>> one is apply it to something).
> Even C can apply a function variable to an argument (function pointers).
> What make Haskell different beside the "lazy evaluation" and "mutable
> variables" things ?
Referential transparency? But if you are happy about how C can print
functions, perhaps you want to do:
instance Show (a -> b) where
show x = "A function"
Main> show (+)
"A function"
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list