Vocabulary/aco
Jump to navigation
Jump to search
>> << Back to: Vocabulary Thru to: Dictionary
a: Ace (Boxed Empty) Noun
An atom consisting of the boxed empty list (<0$0).
# a: NB. Tally (#) shows a: consists of 1 (list) item 1 $ a: NB. But the Shape Of ($) a: is the empty list $$ a: 0
Common uses
1. For convenience inside a tacit definition
listnameswithprefix=: 0 1 2 3&$: :(] ((] -: ({.~ #))S:0 _ # [)~ a: , [ 4!:1~ [: {. ]) NB. a: appears here ____________________________________________^
2. Remove unwanted empty strings from a list of boxed strings
] z=: 'alpha' ; '' ; 'bravo' ; 'charlie' ; '' ; 'delta' +-----++-----+-------++-----+ |alpha||bravo|charlie||delta| +-----++-----+-------++-----+ z -. a: +-----+-----+-------+-----+ |alpha|bravo|charlie|delta| +-----+-----+-------+-----+
3. Denote an empty axis for x { y or x u;.3 y
i. 3 4 0 1 2 3 4 5 6 7 8 9 10 11 (<a:;2) { i. 3 4 NB. Fetch column 2 2 6 10
4. To select all of y, whatever its rank, using: {
a: { '' a: { 0 0 a: { i. 3 0 1 2
More Information
1. (a:) is the value used for framing fill for boxed results.
2. Strictly a: is an empty Boolean list, boxed (i. e. <0$0). But, by and large, J treats all empty lists as equivalent, as tested by (-:)
It matters if you unbox a: and overtake the contents,
or join it to another empty list, or explicitly check the type with 3!:0, or use it as y in x ": y
lace=: <'' assert lace -: a: NB. But... < 3{. > lace +---+ | | +---+ < 3{. > a: +-----+ |0 0 0| +-----+