4,494
edits
(add diagam) |
(→Trains) Tags: Mobile edit Mobile web edit |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[File:Function compositions.png|thumb|right|Diagrams of [[function | [[File:Function compositions.png|thumb|right|Diagrams of [[function composition]]s, an important part of tacit programming.]] | ||
'''Tacit programming''', also called '''[[wikipedia:Tacit_programming|point-free style]]''', refers to usage of tacit [[function]]s that are defined in terms of implicit [[argument]]s. This is in contrast to the explicit use of arguments in [[dfn]]s (<syntaxhighlight inline lang=apl>⍺ ⍵</syntaxhighlight>) and [[tradfn]]s (which have named arguments). Some APL dialects allow to combine functions into [[train]]s following a small set of rules. This allows creating complex [[derived function]]s without specifying any arguments explicitly. | '''Tacit programming''', also called '''[[wikipedia:Tacit_programming|point-free style]]''', refers to usage of tacit [[function]]s that are defined in terms of implicit [[argument]]s. This is in contrast to the explicit use of arguments in [[dfn]]s (<syntaxhighlight inline lang=apl>⍺ ⍵</syntaxhighlight>) and [[tradfn]]s (which have named arguments). Some APL dialects allow to combine functions into [[train]]s following a small set of rules. This allows creating complex [[derived function]]s without specifying any arguments explicitly. | ||
Line 37: | Line 37: | ||
A [[train]] is a series of functions in isolation. An isolated function is either surrounded by parentheses or named. | A [[train]] is a series of functions in isolation. An isolated function is either surrounded by parentheses or named. | ||
These rules are used for 3-trains: | These rules are used for 3-trains, called [[fork]]s: | ||
{| | {| | ||
|<syntaxhighlight lang=apl> (f g h) ⍵</syntaxhighlight>|| {{←→}} ||<syntaxhighlight lang=apl>( f ⍵) g ( h ⍵)</syntaxhighlight> | |<syntaxhighlight lang=apl> (f g h) ⍵</syntaxhighlight>|| {{←→}} ||<syntaxhighlight lang=apl>( f ⍵) g ( h ⍵)</syntaxhighlight> | ||
Line 50: | Line 50: | ||
|} | |} | ||
In APL (but not [[J]]), these rules are used for 2-trains: | In APL (but not [[J]]), these rules are used for 2-trains, called [[atop]]s: | ||
{| | {| | ||
|<syntaxhighlight lang=apl> (g h) ⍵</syntaxhighlight>|| {{←→}} ||<syntaxhighlight lang=apl>g ( h ⍵)</syntaxhighlight> | |<syntaxhighlight lang=apl> (g h) ⍵</syntaxhighlight>|| {{←→}} ||<syntaxhighlight lang=apl>g ( h ⍵)</syntaxhighlight> | ||
Line 66: | Line 66: | ||
|<syntaxhighlight lang=apl>(⊢ g f) ⍵</syntaxhighlight>|| {{←→}} ||<syntaxhighlight lang=apl>g∘f⍨ ⍵</syntaxhighlight> | |<syntaxhighlight lang=apl>(⊢ g f) ⍵</syntaxhighlight>|| {{←→}} ||<syntaxhighlight lang=apl>g∘f⍨ ⍵</syntaxhighlight> | ||
|} | |} | ||
== Debugging == | == Debugging == |