Phrases/Arguments

From J Wiki
Jump to navigation Jump to search

boxdef

NB.*boxdef v ensure and provide default arguments
boxdef=: [ (#~ a:&=)`(I.@(a:&=)@])`]} #@[ {. boxopen@] , a: #~ #@[

Examples

   ]y=. '';5 6 7
++-----+
||5 6 7|
++-----+
   'a b c'=. (1 2;4 5 6;'qq') boxdef y
   a;b;c
+---+-----+--+
|1 2|5 6 7|qq|
+---+-----+--+

   ]d=. 1 2;4 5 6;'qq'
+---+-----+--+
|1 2|4 5 6|qq|
+---+-----+--+
   d boxdef ''
+---+-----+--+
|1 2|4 5 6|qq|
+---+-----+--+
   d boxdef 0 1
+---+-----+--+
|0 1|4 5 6|qq|
+---+-----+--+
   d boxdef 0 1;''
+---+-----+--+
|0 1|4 5 6|qq|
+---+-----+--+
   d boxdef 0 1;6 7 8
+---+-----+--+
|0 1|6 7 8|qq|
+---+-----+--+
   d boxdef '';'';'zz'
+---+-----+--+
|1 2|4 5 6|zz|
+---+-----+--+

See Also