Category:J: Difference between revisions

m
(update j playground reference)
Line 81:
The language represents capabilities of hardware.
For example, if language did not have an internal stack, a word's definition could not be used during the execution of that word. All current J implementations support recursion, but in some sense this is a convenience, and it's reasonable to imagine J implementations which do not (perhaps in a "compile to silicon" implementation).
 
=== Types ==
 
Perhaps also worth noting is that when thinking about J programs, it can be convenient to think of an instance of an array as a type. This is somewhat different from the usual treatment of type (where all potential values in a context are treated as a type).
 
J's type hierarchy supports arrays of arbitrary size and dimension, and array contents may be numeric, character or boxed. Thus, for example, we might work with an array of boxes, each box containing a one dimensional array of characters -- or, informally: strings.
 
In addition to arrays, J's type hierarchy includes procedural types: verbs, adverbs, and conjunctions. These correspond to functions and metafunctions of other languages.
 
As a simple example: 2 is an array (with zero dimensions), 3 is an array, and < is a verb. The expression (2<3) compares 2 and 3 and returns a truth value indicating that 2 is less than 3. But the expression (<3) returns a box which contains the array 3. While the details here are a bit different, the general concepts should be familiar to users of other programming languages. (For example, in C, 2&3 performs a bitwise and between the two numbers, and &y returns a pointer to the value referred to by y.)
 
== J on RosettaCode ==
6,962

edits