Talk:Function composition: Difference between revisions

m
Line 156:
 
:: Agreed. Although it is less elegant than composing multiple functions with a single call, it does demonstrate that a language supports function composition without having to resort to additional functional programming language features. I would still prefer to see the task defined more precisely because I'm afraid we'll end up with several (sin (asin (sin x))) implementations. I haven't come up with a good example (yet), but I think that changing the task description to include the following output should separate most of the wheat from the chaff. --[[User:Lhignight|Larry Hignight]] 23:00, 20 June 2012 (UTC)
::: Not sure I agree with you about elegance -- the syntax you have in your illustration here favors composing lists of functions but that's an implementation detail, it's not universal. For example, in J, composing f g and h looks like f@g@h and composing them as a list looks like <nowiki>(4 :'(x`:6)@(y`:6)`'''''/f`g`h)`:6</nowiki> -- I could define a '''compose''' word that encapsulates that complexity, but it would never beat f@g@h for directness.
::: That said, I added an implementation of your examples to the J implementation on the main page. ----[[User:Rdm|Rdm]] 23:21, 20 June 2012 (UTC)
<pre>;;Example Usage:
6,962

edits