The J Software release, Tacit Programming Extension patches and code and shared libraries are licensed under the GNU GPL v3.
This program is distributed in the hope that it will be useful,
but
WITHOUT ANY WARRANTY
; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
http://www.gnu.org/licenses/gpl.html
UNTESTED
- Use at your own risk.
Windows 64bit binary:
j.dll
Linux 64bit binary:
libj.so
Official J806 source patch generated from official commit 5cec3b69 .
Jx1 Cheatsheet
u (c a) v ↔ u c v a
*: (@ /) -
*:@-/
The product of (u c v) is not required to be a noun or verb and it is passed as an argument to the adverb a.
u (a c a) v ↔ (u a) c (v a)
+ (/@/) -
+/@(-/)
The products of (u a) and (v a) are not required to be a noun or verb and they are passed as arguments to the conjunction c.
a v ↔ v(a)
The verb is executed with the adverb as its argument, e.g.,
/ <
┌─┐
│/│
└─┘
a c ↔ a(c)
The adverb is executed with the conjunction as its argument, e.g.,
]: &
┌───┬──┐
│┌─┐│]:│
││&││ │
│└─┘│ │
└───┴──┘
x (a a) ↔ (x a) a
The product of (x a) is not required to be a noun or verb and ((x a) a) produces a train if (x a) produces an adverb or conjunction.
NB. x a0 producing a verb (the official case)
assert (+((]adv)/))<adv -: (+/ <adv)
NB. x a0 producing an adverb...
assert (((/<)( (>adv)\ ) )<) -: (/\ <)
=..
and
=::
– are similar to their corresponding copulas but are syntactically verbs and may be embedded in tacit expressions.
test=. verb define
=::~ 'XX'
echo XX
=..~ 'XXX'
echo XXX
)
test ''
assert 'XX' -: ". 'XX'
assert '' -: ". 'XXX'
~
Evoke –
X~
for literal
X
is the result of executing
X
as a sentence.
u~
first applies
u
to its argument(s) and then executes the resulting sentence.
[.
and
].
Trigger and Trap –
].
(Trap) is an adverb.
u ].
Is the same as
u
, except that if the verb
[.
(Trigger) is encountered,
u
returns immediately with the result being the monadic argument to the
[.
encountered.
]:
Strand notation –
]:
is an adverb that collects its verb and noun arguments until a closing
[:
is encountered, returning them as a boxed list. If a noun argument is a valid atomic representation or equivalent, it is first converted into the object it represents.
[: +/ - 0 1 2 ]:
┌──┬─┬─────┐
│+/│-│0 1 2│
└──┴─┴─────┘
"..
Train / Do
·
Apply –
".. Y
for boxed
Y
is similar to
Y`:6
and for literal
Y
is similar to
". Y
except that verbs, adverbs and conjunctions are valid results.
X ".. Y
is
X 128!:2 Y
(apply).
`.
Knot (Gerund) – is similar to the J primitive
`
(tie) except that a non-boxed noun argument is first replaced by its atomic representation.
?:
Cloak –
?:
is a verb.
X ?: y
returns the functional whose atomic representation is
Y
as a verb (3), adverb (1) or conjunction (2) depending on the return code
X
for positive
X
.
?: Y
is equivalent to
3 ?: Y
and it is also equivalent to
(<(<,'4'),<(<(<,'4'),<;:'0:`'),<(<,'4'),<;:',^:') (0:`)(,^:)
. For negative
X
?:
generates the following functionals:
_3 ?: 0
is a verb that converts its argument into a verb.
_2 ?: 0
is an adverb that converts its argument into a conjunction.
_1 ?: 0
is an adverb that converts its argument into an adverb.
(;:'ver conj adv')=. _3 _2 _1<@(?:"0) 0
O.
Optimize –
v O. 0
(no implicit scope) is similar to
v
except any
$:
or
$::
appearing in
v
applies to
v
and not the verb containing
v
if any.
v O. 1
is similar to
v
, if
v
is tail-recursive, except that recursive calls do not grow the function call stack. If
v
is not tail recursive then
v O. 1
will cause the interpreter to crash.
$::
Self reference without context apart from O.0
104!:5
Unnamed Execution –
X 104!:5 v
calls verb
v
on a temporary name for
X
.
assert ((i.2 3) ((104!:5) ((5!:1)@<))) -: ("..^:_1 i.2 3)
i..
Complex Iota –
i.. A j. B
is
|. |: (i. A) j." 0 1"0 i. B
"::
Improved Rank –
"::
is similar to
"
except it accepts a gerund left argument whose verbs are executed on the computed cells of the input cyclically.
+:`|:"::2 i. 2 2 3
0 2 4
6 8 10
0 0 0
6 9 0
7 10 0
8 11 0
Unicode characters are legal inside names.
'λ λ0 λ1' =. 1 2 3
λ , λ0 , λ1
1 2 3
Sparse arrays can be boxed and retrieved from a boxed array.
]A=. 'sparse';7;$.3=7&|i.30
┌──────┬─┬──────┐
│sparse│7│ 3 │ 1│
│ │ │10 │ 1│
│ │ │17 │ 1│
│ │ │24 │ 1│
└──────┴─┴──────┘
2{::A
3 │ 1
10 │ 1
17 │ 1
24 │ 1