On Fri, 16 Nov 2007, jeff p wrote:
A function is an expression whose type is an arrow; e.g. Int - Int.
The type of taxRate is (Fractional t) = t.
I had this misunderstanding too, when starting with Haskell. In other
languages there are functions with zero, one or more arguments. In
contrast
On Nov 16, 2007 12:26 AM, Lennart Augustsson [EMAIL PROTECTED] wrote:
On Nov 14, 2007 1:05 AM, Robin Green [EMAIL PROTECTED] wrote:
On Tue, 13 Nov 2007 13:51:13 -0800
Dan Piponi [EMAIL PROTECTED] wrote:
Up until yesterday I had presumed that guards only applied to
functions. But I
On Tue, 13 Nov 2007, Dan Piponi wrote:
On Nov 13, 2007 1:24 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
I tend to prefer where, but I think that guards function declarations are
more readable than giant if-thens and case constructs.
Up until yesterday I had presumed that guards only applied
Hello Henning,
Thursday, November 15, 2007, 2:31:07 PM, you wrote:
Btw. I would write here
min 1 (max (-1) x)
or even better define a function for such clipping, since it is needed
quite often.
min 1 . max (-1) is pretty standard, although i renamed them:
atMax 1 . atLeast (-1)
--
On Thu, 15 Nov 2007, Bulat Ziganshin wrote:
Hello Henning,
Thursday, November 15, 2007, 2:31:07 PM, you wrote:
Btw. I would write here
min 1 (max (-1) x)
or even better define a function for such clipping, since it is needed
quite often.
min 1 . max (-1) is pretty standard,
On Thu, 15 Nov 2007 12:31:07 +0100, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Tue, 13 Nov 2007, Dan Piponi wrote:
On Nov 13, 2007 1:24 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
I tend to prefer where, but I think that guards function
declarations are
more readable than giant if-thens
On Nov 16, 2007 12:35 AM, Arnar Birgisson [EMAIL PROTECTED] wrote:
[1]
I'm terribly sorry, that was meant to be:
[1]
http://www.onlamp.com/pub/a/onlamp/2007/07/12/introduction-to-haskell-pure-functions.html
sorry,
Arnar
___
Haskell-Cafe mailing list
No, Haskell functions take exactly one argument.
On Nov 14, 2007 1:05 AM, Robin Green [EMAIL PROTECTED] wrote:
On Tue, 13 Nov 2007 13:51:13 -0800
Dan Piponi [EMAIL PROTECTED] wrote:
Up until yesterday I had presumed that guards only applied to
functions. But I was poking about in the
Hi Chris,
this could be captured nicely in a where clause:
exp = (fst blah, snd blah) where blah = gg 1000
But a let would have to be placed in both elements of the tuple
exp = (let blah = g 1000 in fst blah, let blah = g 1000 in snd blah)
Why not:
exp = let blah = g 1000
in
Hi David,
A let clause would work fine here:
someFunction ls a b c = let listLen = length ls
someAuxFunction x y = ... listLen ...
someOtherFunction x y = ... listLen ...
in
... listLen
Hi Neil,
Why not:
exp = let blah = g 1000
in (fst blah, snd blah)
Yes, fair enough.
Where's always get desugared to let's, so where's are never more efficient.
Interesting. I'm thinking a where-to-let refactoring and its converse may
make useful routine refactorings for HaRe.
Hello,
I know there are several important differences between let-expressions
and where-clauses regarding scoping and the restriction of where to
a top-level definition. However, frequently I write code in which
either one would be allowed, and I was wondering if there were any
guidelines or
On Nov 13, 2007 6:56 PM, John Lato [EMAIL PROTECTED] wrote:
Hello,
I know there are several important differences between let-expressions
and where-clauses regarding scoping and the restriction of where to
a top-level definition. However, frequently I write code in which
either one would be
On Nov 13, 2007 10:56 AM, John Lato [EMAIL PROTECTED] wrote:
I know there are several important differences between let-expressions
and where-clauses regarding scoping and the restriction of where to
a top-level definition. However, frequently I write code in which
One place I find it useful
On Tue, 13 Nov 2007, John Lato wrote:
Hello,
I know there are several important differences between let-expressions
and where-clauses regarding scoping and the restriction of where to
a top-level definition. However, frequently I write code in which
either one would be allowed, and I was
Hi
This depends on whether you are an expression style or declaration
style programmer.
http://www.haskell.org/haskellwiki/Declaration_vs._expression_style
http://www.haskell.org/haskellwiki/Let_vs._Where
Reading the let vs where page I'm left with the strong impression that
I should use
I'd like to thank Henning for pointing out the wiki page, which
describes one consequence I hadn't considered. I knew I couldn't have
been the first person to have this question, but I somehow missed it
before. I agree with Neil, though, that it doesn't seem very neutral.
On Nov 13, 2007 1:58
On Tue, 13 Nov 2007, John Lato wrote:
I'd like to thank Henning for pointing out the wiki page, which
describes one consequence I hadn't considered. I knew I couldn't have
been the first person to have this question, but I somehow missed it
before. I agree with Neil, though, that it
Hi
Maybe it would be enough to represent the example where problem more
fairly on its own terms. The non-working example has us writing
f = State $ \ x - y
where y = ... x ...
I just don't think this example is representative of the typical
decisions in the trade-off. There are
On Tue, 2007-11-13 at 13:08 -0800, Donn Cave wrote:
On Tue, 13 Nov 2007, Neil Mitchell wrote:
This depends on whether you are an expression style or declaration
style programmer.
http://www.haskell.org/haskellwiki/Declaration_vs._expression_style
I tend to prefer where, but I think that guards function declarations are
more readable than giant if-thens and case constructs.
where can scope over multiple guards, and guards can access things
declared in a where clause, both of which are important features:
f xs | len 2 = y
| len ==
On Nov 13, 2007 1:24 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
I tend to prefer where, but I think that guards function declarations are
more readable than giant if-thens and case constructs.
Up until yesterday I had presumed that guards only applied to
functions. But I was poking about in the
On Tue, Nov 13, 2007 at 11:41:20AM -0800, Justin Bailey wrote:
On Nov 13, 2007 10:56 AM, John Lato [EMAIL PROTECTED] wrote:
I know there are several important differences between let-expressions
and where-clauses regarding scoping and the restriction of where to
a top-level definition.
On Tue, 13 Nov 2007 13:51:13 -0800
Dan Piponi [EMAIL PROTECTED] wrote:
Up until yesterday I had presumed that guards only applied to
functions. But I was poking about in the Random module and discovered
that you can write things like
a | x 1 = 1
| x -1 = -1
| otherwise = x
where
On Tue, 2007-11-13 at 13:51 -0800, Dan Piponi wrote:
On Nov 13, 2007 1:24 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
I tend to prefer where, but I think that guards function declarations are
more readable than giant if-thens and case constructs.
Up until yesterday I had presumed that guards
25 matches
Mail list logo