Talk:Function composition: Difference between revisions
Content added Content deleted
(→Multiple Function Composition: Yah!) |
No edit summary |
||
Line 154: | Line 154: | ||
:: Brilliant. No need for another task. --[[User:Paddy3118|Paddy3118]] 19:18, 14 June 2012 (UTC) |
:: Brilliant. No need for another task. --[[User:Paddy3118|Paddy3118]] 19:18, 14 June 2012 (UTC) |
||
:: 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) |
|||
<pre>;;Example Usage: |
|||
;CL-USER> (compose f #'ceiling #'sin #'sqrt) |
|||
;F |
|||
CL-USER> (compose g #'1+ #'abs #'cos) |
|||
G |
|||
CL-USER> (compose h #'f #'g) |
|||
H |
|||
CL-USER> (values (f pi) (g pi) (h pi)) |
|||
1 |
|||
2.0L0 |
|||
1 |
|||
CL-USER> </pre> |