2c: Bit Arithmetic
+bex
+bexBinary exponent.
Computes the result of 2^a, where .a is a block size (see $bloq), producing an $atom.
Accepts
.a is a +bloq.
Produces
An $atom.
Source
++ bex
~/ %bex
|= a=bloq
^- @
?: =(0 a) 1
(mul 2 $(a (dec a)))Examples
> (bex 4)
16+can
+canAssemble.
Produces an $atom from a +list .b of length-value pairs .p and .q, where .p is the length in blocks of size .a, and .q is an $atomic value.
Accepts
.a is a block size (see +bloq).
.b is a +list of length-value pairs, .p and .q:
.pis a+step..qis a@.
Produces
An $atom.
Source
Examples
+cat
+catConcatenate.
Concatenates two $atoms, .b and .c, according to block size .a, producing an $atom.
Accepts
.a is a block size (see +bloq).
.b is an $atom.
.c is an $atom.
Produces
An $atom.
Source
Examples
+cut
+cutSlice.
Slices .c blocks of size .a that are positioned .b blocks from the end of .d. That slice is produced as an $atom.
Accepts
.a is a block size (see +bloq).
[b c] where:
.d is an $atom.
Produces
An $atom.
Source
Examples
+end
+endTail.
Produces an $atom by taking the last +step blocks of size +bloq from .b.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is an $atom.
Produces
An $atom.
Source
Examples
+fil
+filFill bloqstream.
Produces an $atom by repeating .c for .b blocks of size .a.
Accepts
.a is a block size (see +bloq).
.b is a +step.
.c is an $atom.
Produces
An $atom.
Source
Examples
+lsh
+lshLeft-shift.
Produces an $atom by left-shifting .b by +step blocks of size +bloq.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is an $atom.
Produces
An $atom.
Source
Examples
+met
+metMeasure.
Computes the number of blocks of size .a in .b, producing an $atom.
Accepts
.a is a block size (see +bloq).
.b is an $atom.
Source
Examples
+rap
+rapAssemble non-zero.
Concatenates a +list of $atoms .b using block size .a, producing an $atom.
Accepts
.a is a block size (see +bloq).
.b is a +list of $atoms.
Produces
An $atom.
Source
Examples
Discussion
Any element of the value 0 is not included in concatenation.
+rep
+repAssemble single.
Produces an $atom by assembling a +list of $atoms .b using block size .a.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is a +list of $atoms.
Produces
An $atom.
Source
Examples
+rev
+revReverses block order, accounting for leading zeroes.
Produces an $atom from the bits of .dat in reverse order according to a block size .boz and a size .len.
If the total size is less than the length of .dat, then only the first bits of .dat up to the total size will be taken and reversed. If the total size is longer, trailing zeroes will be added.
Accepts
.boz is a block size with optional block count (see +bloq).
.len is a @ud of the number of blocks of size .boz to be reversed.
.dat is an $atom.
Produces
An $atom.
Source
Examples
+rip
+ripDisassemble.
Produces a +list of $atoms from the bits of .b using block size .a.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is an $atom.
Produces
A +list of $atoms.
Source
Examples
+rsh
+rshRight-shift.
Right-shifts .b by +step blocks of size +bloq, producing an $atom.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is an $atom.
Produces
An $atom.
Source
Examples
+run
+run+turn into $atom.
Disassembles $atom .b into slices specified by .a, applies .c to each slice, and reassembles the results back into an $atom.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is an $atom.
.c is a gate that accepts an $atom and produces an $atom.
Produces
An $atom.
Source
Examples
+rut
+rut+turn into +list.
Disassembles $atom .b into slices specified by .a, applies .c to each slice, and assembles the results back into a.
Accepts
.a is an $atom slice specifier (see $bite), which is a block size (see +bloq) with optional block count.
.b is an $atom.
.c is a gate that accepts an $atom.
Produces
A +list.
Source
Examples
+sew
+sewStitch one $atom into another.
Replace .c blocks of size .a at offset .b of $atom .e with .c blocks of size .a from $atom .d.
That is, take (end [a c] d) from .d and overwrite the (cut a [b c] e) part of .e.
Or in simpler terms, take from the start of .d and replace some part of .e with it.
Accepts
.a is a $bloq (block size).
[b c d] where:
.bis a step specifying the number of+bloqs to offset..bis a step specifying the number of+bloqs to replace..dis the donor$atom.
.e is the recipient $atom.
Produces
An $atom.
Source
Examples
+swp
+swpReverse block order.
Switches little-endian to big-endian and vice versa: produces an $atom by reversing the block order of .b using block size .a.
Accepts
.a is a block size (see +bloq).
.b is an $atom.
Produces
An $atom.
Source
Examples
+xeb
+xebBinary logarithm.
Computes the base-2 logarithm of .a, producing an $atom.
Accepts
.a is an $atom.
Produces
An $atom.
Source
Examples
+fe
+feModulo bloq.
Core that contains arms for +bloq and modular integer operations.
Accepts
.a is a +bloq.
Source
+dif:fe
+dif:feProduces the difference between two $atoms in the modular basis representation.
Accepts
.a is a +bloq (and is the sample of the parent core).
.b is an $atom.
.c is an $atom.
Produces
A @s.
Source
Examples
+inv:fe
+inv:feInverse.
Inverts the order of the modular field.
Accepts
.a is a +bloq (and is the sample of the parent core).
.b is a +bloq. (see +bloq)
Produces
An $atom.
Source
Examples
+net:fe
+net:feFlip endianness.
Reverses bytes within a block.
Accepts
.a is a +bloq (and the sample of the parent core).
.b is a +bloq (see +bloq).
Produces
An $atom.
Source
Examples
+out:fe
+out:feMax integer value.
Produces the maximum integer value that the current block can store; 2^a^a.
Accepts
.a is a +bloq (and is the sample of the parent core).
Produces
An $atom.
Source
Examples
+rol:fe
+rol:feRoll left.
Rolls .d to the left by .c .b-sized blocks.
Accepts
.a is a +bloq (and is the sample of the parent core).
.b is a +bloq.
.c is an $atom.
.d is an $atom.
Produces
An $atom.
Source
Examples
+ror:fe
+ror:feRoll right.
Rolls .d to the right by .c .b-sized blocks.
Accepts
.a is a +bloq (and is the sample of the parent core).
.b is a +bloq.
.c is an $atom.
.d is an $atom.
Produces
An $atom.
Source
Examples
+sum:fe
+sum:feSum.
Sums two numbers in this modular field.
Accepts
.a is a +bloq (and is the sample of the parent core).
.b is an $atom.
.c is an $atom.
Produces
An $atom.
Source
Examples
+sit:fe
+sit:feEnforce modulo.
Produces an $atom in the current modular block representation.
Accepts
.a is a +bloq (and is the sample of the parent core).
.b is an $atom.
Produces
An $atom.
Source
Examples
Last updated