Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Abbreviations-automatic/J/abbreviations-automatic.j
Normal file
19
Task/Abbreviations-automatic/J/abbreviations-automatic.j
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
NB. y is words in boxes
|
||||
abbreviation_length =: monad define
|
||||
N =. # y
|
||||
for_i. i. >: >./ #&> y do.
|
||||
NB. if the length of the set of length i prefixes matches the length of the row
|
||||
if. N -: # ~. i ({. &>) y do.
|
||||
i return.
|
||||
end.
|
||||
end.
|
||||
)
|
||||
|
||||
NB. use: auto_abbreviate DAY_NAMES
|
||||
auto_abbreviate =: 3 :0
|
||||
y =. y -. CR
|
||||
lines =. [;._2 y
|
||||
a =. <@([: <;._2 ,&' ');._2 y
|
||||
L =. abbreviation_length&> a
|
||||
((' ',~":)&> L) ,"1 lines
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue