Beside: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement  "http://help.dyalog.com" to "https://help.dyalog.com") 
m (Added examples) 

Line 2:  Line 2:  
In usage, <source lang=apl inline>X f∘g Y</source> is equivalent to <source lang=apl inline>X f g Y</source>, and <source lang=apl inline>f∘g Y</source> is equivalent to <source lang=apl inline>f g Y</source>. Thus, beside can be defined as the [[dop]] <source lang=apl inline>{⍺←⊢ ⋄ ⍺ ⍺⍺ ⍵⍵ ⍵}</source>.  In usage, <source lang=apl inline>X f∘g Y</source> is equivalent to <source lang=apl inline>X f g Y</source>, and <source lang=apl inline>f∘g Y</source> is equivalent to <source lang=apl inline>f g Y</source>. Thus, beside can be defined as the [[dop]] <source lang=apl inline>{⍺←⊢ ⋄ ⍺ ⍺⍺ ⍵⍵ ⍵}</source>.  
== Examples ==  
When use [[monadic]]ally, <source lang=apl inline>f∘g</source> behaves the same as [https://en.wikipedia.org/wiki/Function_composition function compositian].  
<source lang=apl>  
∘÷ 2  
¯0.5  
⍝ same as  
(÷2)  
¯0.5  
</source>  
When use [[dyadic]]ally, <source lang=apl inline>f∘g</source> forms a [[Hook]].  
<source lang=apl>  
'oy'≡∘⌽'yo'  
1  
⍝ same as  
'oy'≡⌽'yo'  
1  
</source>  
== External links ==  == External links == 
Revision as of 08:54, 6 September 2021
∘

Beside (∘
), Compose or After is a primitive operator. It shares the glyph ∘
with Bind. Called dyadically with function operands f
and g
, it uses g
monadically to preprocesses the right argument before applying f
to the given left argument and preprocessed right argument. Called monadically with operands f
and g
, it applies f
to the result of applying g
to the argument.
In usage, X f∘g Y
is equivalent to X f g Y
, and f∘g Y
is equivalent to f g Y
. Thus, beside can be defined as the dop {⍺←⊢ ⋄ ⍺ ⍺⍺ ⍵⍵ ⍵}
.
Examples
When use monadically, f∘g
behaves the same as function compositian.
∘÷ 2 ¯0.5 ⍝ same as (÷2) ¯0.5
When use dyadically, f∘g
forms a Hook.
'oy'≡∘⌽'yo' 1 ⍝ same as 'oy'≡⌽'yo' 1
External links
Lessons
Documentation