Talk:Partial function application: Difference between revisions

→‎Proposal for new task description: suggested task description
(→‎Proposal for new task description: suggested task description)
Line 302:
=== Current task description is a bit odd ===
Reading over the current task description, I think it is somewhat odd. It asks you to define a function ''f'' taking a single argument, and a higher-order function ''fs'' (essential ''map'') and to partially apply ''f'' to ''fs''. The most common use case of partial application, however, would be, given a function ''f'' of arity at least 2, partially apply arguments until it has remaining arity 1 and then pass this partially applied function to ''fs'' (i.e. ''map''). Even if we do not want to adopt my proposal above, I believe the current task description should still be modified. I would in this case advise ''f'' to be of arity 3, as this makes the task slightly more challenging and interesting for statically-typed languages. —''[[User:Ruud Koot|Ruud]]'' 10:29, 17 April 2011 (UTC)
 
: My suggested task description would read:
:* Define the linear function ''f''(''a'', ''b'', ''x'') ↦ ''ax'' + ''b''. This function should preferably by defined in an idiomatic form, but if this is not possible other solutions are acceptable.
:* Define the function ''[[map]]''(''f'', ''xs'') which applies its first argument, a function expecting a single argument, to each element of the sequence ''xs''. Preferably use the implementation form the standard library, if available.
:* Perform the following operations: partially apply ''a'' = 7 and ''b'' = 9 to ''f'', and apply this partially applied function to a sequence using ''map''.
: —''[[User:Ruud Koot|Ruud]]'' 12:46, 20 April 2011 (UTC)
Anonymous user