Function composition: Difference between revisions

J: support tentative new example
(Updated D entry)
(J: support tentative new example)
Line 700:
 
Of course, given that <tt>@</tt> is only one character long and is a built-in primitive, there is no need for the cover function <tt>compose</tt>. And <tt>@</tt> is not the only composition primitive; composition is a very important concept in J. For more details, see the [[Talk:Functional Composition#J|talk page]].
 
Tentative new example:
 
<lang j>f=: >.@(1&o.)@%:
g=: 1&+@|@(2&o.)
h=: f@g</lang>
 
Example use:
<lang j> (f, g, h) 1p1
1 2 1</lang>
 
Note: 1&o. is sine (mnemonic: sine is an odd circular function), 2&o. is cosine (cosine is an even circular function), %: is square root, >. is ceiling, | is absolute value and 1&+ adds 1.
 
=={{header|Java}}==
6,951

edits