Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Question on evaluating function compostion (John Wiegley)
2. Re: understanding curried function calls (Roman Czyborra)
3. Re: Question on evaluating function compostion (Roman Czyborra)
----------------------------------------------------------------------
Message: 1
Date: Wed, 20 Aug 2014 05:12:18 -0500
From: "John Wiegley" <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Question on evaluating function
compostion
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
>>>>> Chul-Woong Yang <[email protected]> writes:
> Does (f . g) x y z equal ((((f . g) x) y) z) ?in haskell?
Correct, since function application is left-associative and binds more tightly
than any other operator.
John
------------------------------
Message: 2
Date: Wed, 20 Aug 2014 12:12:57 +0200
From: Roman Czyborra <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: [Haskell-beginners] understanding curried function calls
Message-ID:
<cadu1f6cgzn7jkwxtahpwrpbpxdbdgkljtgrnhgjf1rgkwp7...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Dear Dimitri:
I am having a hard time with.
> doTwice f x = f (f x)
> what does this do? What is the systematic way to evaluate these
> expressions?
You might recognize the numeral two from pure
http://en.wikipedia.org/wiki/Lambda_calculus and the fact that some lambda
expressions are irreducible while others never arrive at such a normal form.
> Are there any resources with many practice exercises like this one?
>
None that I am aware of. You mostly find theoretical revelations.
Possibly because there is often nothing more practical than the right
theory. But it is easy to make up some practical examples to play with:
let pow2 f x = f (f x) in [ pow2 (pow2 (pow2 (1+)))) 0, pow2 pow2 pow2 (1+)
0] == [2^3, 2^2^2^2]
Current Haskell compilers will not tell you directly that pow2 pow2 pow2
pow2 = do65536times and pow 2 pow2 (pow2 pow2) = do256times but just do so
in concrete cases.
Try pow2 pow2 (+1) 0
Or pow2 pow2 (++"-") "."
Thanks,
> Dimiti
> [1] http://www.seas.upenn.edu/~cis552/lectures/Lec2.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140820/10ab96fc/attachment-0001.html>
------------------------------
Message: 3
Date: Wed, 20 Aug 2014 12:47:16 +0200
From: Roman Czyborra <[email protected]>
To: [email protected], [email protected]
Subject: Re: [Haskell-beginners] Question on evaluating function
compostion
Message-ID:
<CADu1F6c_6DysK=AoK91Hn5WwTDdPjB9QX604woEF32T=riv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
> Does (f . g) x y z equal ((((f . g) x) y) z) in haskell?
>
Yes: (f . g) x y z = (((f (g (x)) (y)) (z)) = f (g x) y z since in Haskell
as a higher-order functional language a bare function mentioned to the left
is supposed to bind its argument stronger first before any lower-order
arguments are allowed to start acting rightwards. (did-not (have
(this-readability-problem)) lisp)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140820/6905df53/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 74, Issue 18
*****************************************