Talk:Haskell/Higher-order functions

Higher-Order Functions and Types
This section starts with "The concept of currying (the generating of intermediate functions on the way toward a final result) was first introduced in the earlier chapter "Lists II". This is a good place to revisit how currying works." but doesn't really explains anything about currying, it explains partial application. In fact "generating of intermediate functions on the way toward a final result" is partial application while currying is transforming a function of multiple arguments into a series of lambdas. These concepts are related but not the same. 78.29.93.171 (discuss) 09:30, 24 February 2019 (UTC)

2014-04-29 refactoring
The exercises with the for-loop seems baffling and out of place to me. I didn't remove it myself, but my vote is to omit it. I'm not sure what is going on there, but maybe that's because I don't have imperative programming experience. Backfromquadrangle (discuss • contribs) 18:16, 29 April 2014 (UTC)


 * It is a borderline case, but I think they have some worth as a hard exercise at the end of the story arc. I enjoyed them back in 2010, when I went through the book having just a little imperative (and no functional) experience, though I'm not sure if I could handle with the /  items. Maybe different wording would help? Also, I don't like the first bonus item much (the one that asks you to guess one particular wrong implementation).--Duplode (discuss • contribs) 09:09, 30 April 2014 (UTC)


 * P.S.: Good call on increasing the pace of the chapter. Given the many historical accidents this book was subject to, there are parts written for (and by!) different audiences. If we manage to make them somewhat more uniform the book will look much tidier.--Duplode (discuss • contribs) 09:09, 30 April 2014 (UTC)

Higher-order function composition
I'm trying to wrap my head around the myInits definition:

The article mentions to break it up bit by bit so I've found that

Now I understand that we need to map reverse over this list to place each sublist's elements in the correct order, but I guess what I don't understand is how ghc is able to evaluate this expression the way we want? And I think at the base of my problem is a misunderstanding of haskell's evaluation semantics. I've tried placing the explicit paranthesis to see how haskell behaves:

but why doesn't the following work?:

I would really appreciate if someone could walk me through the myInits definition or at least point out a good reference to haskell's expression evaluation semantics.

Thanks

Sgcb (discuss • contribs) 17:37, 2 June 2014 (UTC)


 * It is a precedence issue. What you actually want is:




 * Function application has precedence over all operators, and so the first argument to  is , which as you say reverses the sublists, and not   on its own, which would reverse the outer list.--Duplode (discuss • contribs) 00:45, 3 June 2014 (UTC)