3,038
edits
(Operator vs. function test) |
m (→Operator or function?: Whitespace) |
||
Line 82: | Line 82: | ||
<source lang=apl> | <source lang=apl> | ||
1 3 /¨ 'ab' 'cd' | 1 3 /¨ 'ab' 'cd' | ||
abbb cddd | abbb cddd | ||
(1 3/)¨ 'ab' 'cd' | (1 3/)¨ 'ab' 'cd' | ||
abbb cddd | abbb cddd | ||
</source>{{Works in|[[SHARP APL]] (with <source lang=apl inline>¨></source> in place of <source lang=apl inline>¨</source>), [[APL2]], [[APLX]]}} | </source>{{Works in|[[SHARP APL]] (with <source lang=apl inline>¨></source> in place of <source lang=apl inline>¨</source>), [[APL2]], [[APLX]]}} | ||
If Replicate is a function, then Each will apply to Replicate only, and the resulting derived function will be invoked monadically. | If Replicate is a function, then Each will apply to Replicate only, and the resulting derived function will be invoked monadically. | ||
<source lang=apl> | <source lang=apl> | ||
1 3 /¨ 'ab' 'cd' | 1 3 /¨ 'ab' 'cd' | ||
ab cccddd | ab cccddd | ||
1 3 (/¨) 'ab' 'cd' | 1 3 (/¨) 'ab' 'cd' | ||
ab cccddd | ab cccddd | ||
</source>{{Works in|[[NARS2000]], [[Dyalog APL]], [[GNU APL]]}} | </source>{{Works in|[[NARS2000]], [[Dyalog APL]], [[GNU APL]]}} | ||
In early APLs such as [[APL\360]], applying an operator to Compress will always result in a [[SYNTAX ERROR]], because Compress is not an allowed operand of any operator. This is also the case in [[ngn/APL]]: although operators can apply to any function, Replicate cannot be used unless both arguments are immediately available. In both cases there is no way to determine whether Replicate "acts like a function" or "acts like an operator". | In early APLs such as [[APL\360]], applying an operator to Compress will always result in a [[SYNTAX ERROR]], because Compress is not an allowed operand of any operator. This is also the case in [[ngn/APL]]: although operators can apply to any function, Replicate cannot be used unless both arguments are immediately available. In both cases there is no way to determine whether Replicate "acts like a function" or "acts like an operator". |