From J Wiki
Jump to: navigation, search

15B. Miscellaneous

v0=. '.'&$: : (2&{.@(<;._1)@,) Split y on x (on period for monad)
m1=: (i.@# = i.~) # ] Nub ~.
n2=: a.{~65 97+/i.26 A-Z, a-z

For example:

   v0 'filename.ext'

   ';' v0 'filename;ext'

The following illustrates miscellaneous matters, including multiple assignments:

n=. 'psmith';(i.3 4);100 200 assign local to explicit definition
n=: 'psmith';(i.3 4);100 200 assign global
'one two three'=: n assign names
'a b c'=: i.3 4 assign rows of matrix
'a b c d'=: |:i.3 4 assign cols of matrix
'a b c'=: 1 2 3;'two';3 3$3 assign opened elements
[x=: i.5 assign and display result
v=: +:@*: assign name to verb
([ v) i.5 invoke verb, return argument
(;v) i.5 invoke verb, return argument linked to result