Talk:Function composition: Difference between revisions
Content added Content deleted
(functional composition in J) |
(→J) |
||
Line 38: | Line 38: | ||
|<tt>'''f'''(''x'' '''g''' ''y'')</tt> |
|<tt>'''f'''(''x'' '''g''' ''y'')</tt> |
||
|<tt>'''f'''</tt> applied to each output of <tt>'''g'''</tt> independently |
|<tt>'''f'''</tt> applied to each output of <tt>'''g'''</tt> independently |
||
|- |
|||
|<tt>@.</tt> |
|||
| |
|||
| |
|||
| To be discussed |
|||
|- |
|- |
||
|<tt>@:</tt> |
|<tt>@:</tt> |
||
Line 48: | Line 53: | ||
|<tt>('''g''' ''x'')'''f'''('''g''' ''y'')</tt> |
|<tt>('''g''' ''x'')'''f'''('''g''' ''y'')</tt> |
||
|<tt>'''f'''</tt> applied between each output of <tt>'''g'''</tt> on <tt>''x''</tt> and <tt>''y''</tt> pairwise |
|<tt>'''f'''</tt> applied between each output of <tt>'''g'''</tt> on <tt>''x''</tt> and <tt>''y''</tt> pairwise |
||
|- |
|||
|<tt>&.</tt> |
|||
| |
|||
| |
|||
| To be discussed |
|||
|- |
|||
|<tt>&.:</tt> |
|||
| |
|||
| |
|||
| To be discussed |
|||
|- |
|- |
||
|<tt>&:</tt> |
|<tt>&:</tt> |
||
Line 53: | Line 68: | ||
|<tt>('''g''' ''x'')'''f'''('''g''' ''y'')</tt> |
|<tt>('''g''' ''x'')'''f'''('''g''' ''y'')</tt> |
||
|<tt>'''f'''</tt> applied between all outputs of <tt>'''g'''</tt> on <tt>''x''</tt> and <tt>''y''</tt> ''in toto'' |
|<tt>'''f'''</tt> applied between all outputs of <tt>'''g'''</tt> on <tt>''x''</tt> and <tt>''y''</tt> ''in toto'' |
||
|- |
|||
|<tt>.</tt> |
|||
| |
|||
| |
|||
| To be discussed |
|||
|- |
|- |
||
|<tt>..</tt> |
|<tt>..</tt> |
||
Line 69: | Line 89: | ||
| Allows the unary and binary definitions of a function to be specified independently. |
| Allows the unary and binary definitions of a function to be specified independently. |
||
|- |
|- |
||
|<tt>: |
|<tt>:.</tt> |
||
| |
|||
|<tt>try { '''f''' ''y'' } catch { '''g''' ''y'' } </tt> |
|||
| |
|||
|<tt>try { ''x'' '''f''' ''y'' } catch { ''x'' '''g''' ''y'' } </tt> |
|||
| To be discussed |
|||
| Given <tt>'''h'''←'''f'''::'''g'''</tt>, if <tt>'''f'''</tt> returns a valid value without error, then the result of <tt>'''h'''</tt> is the result of <tt>'''f'''</tt>; else, the result of <tt>'''h'''</tt> is the result of <tt>'''g'''</tt>. These succinct, functional exception handlers can be chained. |
|||
|- |
|- |
||
|<tt>::</tt> |
|<tt>::</tt> |
||
Line 78: | Line 98: | ||
|<tt>try { ''x'' '''f''' ''y'' } catch { ''x'' '''g''' ''y'' } </tt> |
|<tt>try { ''x'' '''f''' ''y'' } catch { ''x'' '''g''' ''y'' } </tt> |
||
| Given <tt>'''h'''←'''f'''::'''g'''</tt>, if <tt>'''f'''</tt> returns a valid value without error, then the result of <tt>'''h'''</tt> is the result of <tt>'''f'''</tt>; else, the result of <tt>'''h'''</tt> is the result of <tt>'''g'''</tt>. These succinct, functional exception handlers can be chained. |
| Given <tt>'''h'''←'''f'''::'''g'''</tt>, if <tt>'''f'''</tt> returns a valid value without error, then the result of <tt>'''h'''</tt> is the result of <tt>'''f'''</tt>; else, the result of <tt>'''h'''</tt> is the result of <tt>'''g'''</tt>. These succinct, functional exception handlers can be chained. |
||
|- |
|||
|<tt>''hook''</tt> |
|||
| |
|||
| |
|||
| To be discussed |
|||
|- |
|||
|<tt>''fork''</tt> |
|||
| |
|||
| |
|||
| To be discussed |
|||
|- |
|- |
||
|} |
|} |
||
===Still to discuss=== |
|||
::<tt>@.</tt> = functional selection (<tt>'''f'''`'''g'''@.'''h'''</tt>) |
|||
Discuss |
|||
::<tt>&.</tt> = ''under'', this is a ''good'' one. |
|||
::<tt>&.:</tt> = <tt>&.:</tt> is to <tt>&.</tt> as <tt>&:</tt> is to <tt>&.</tt> |
|||
&. |
|||
⚫ | |||
&.: |
|||
::<tt>:.</tt> = related to <tt>&.</tt>, another good one. |
|||
⚫ | |||
::hook = an implicit composition of 2 functions |
|||
::) |
|||
::fork = an implicit composition of 3 functions |
|||
:. (obverse) |
|||
fork |
|||
hook |