Frame agreement: Difference between revisions
Jump to navigation
Jump to search
m (Link fixes) |
m (Align comments) |
||
Line 22: | Line 22: | ||
af =/@(<.&# {.&> ;) bf NB. one frame prefixes the other | af =/@(<.&# {.&> ;) bf NB. one frame prefixes the other | ||
1 | 1 | ||
]cf=: af {.@(<.&#{.&>;~) bf | ]cf=: af {.@(<.&#{.&>;~) bf NB. the common frame (always the shorter of the two frames) | ||
2 | 2 | ||
]lf=: af >@(-.@>&# { ;) bf | ]lf=: af >@(-.@>&# { ;) bf NB. the longer of the two frames | ||
2 3 | 2 3 | ||
]sf=: lf }.~ #cf | ]sf=: lf }.~ #cf NB. the surplus frame results from removing the common frame from the left side of longer frame | ||
3 | 3 | ||
a +"0 1]b | a +"0 1]b | ||
Line 36: | Line 36: | ||
12 13 | 12 13 | ||
14 15 | 14 15 | ||
'A B'=: (<"lr]a),&<(<"rr]b) | 'A B'=: (<"lr]a),&<(<"rr]b) NB. frame each argument in terms of lr- or rr-cells | ||
A | A NB. a framed as lr-cells | ||
┌─┬─┐ | ┌─┬─┐ | ||
│3│4│ | │3│4│ | ||
Line 43: | Line 43: | ||
$A | $A | ||
2 | 2 | ||
B | B NB. b framed as rr-cells | ||
┌───┬───┬─────┐ | ┌───┬───┬─────┐ | ||
│0 1│2 3│4 5 │ | │0 1│2 3│4 5 │ | ||
Line 51: | Line 51: | ||
$B | $B | ||
2 3 | 2 3 | ||
]pairs=: A([;'+';])&>_1]B | ]pairs=: A([;'+';])&>_1]B NB. each cell of sa is paired with each cell among the corresponding group of (*/sf) cells of la | ||
┌─┬─┬─────┐ | ┌─┬─┬─────┐ | ||
│3│+│0 1 │ | │3│+│0 1 │ | ||
Line 67: | Line 67: | ||
│4│+│10 11│ | │4│+│10 11│ | ||
└─┴─┴─────┘ | └─┴─┴─────┘ | ||
A+&>"_1]B | A+&>"_1]B NB. the results of all applications of + are framed by lf | ||
3 4 | 3 4 | ||
5 6 | 5 6 |