"ICAL" Some Intercal-like functions

Fingerprint ID:0x4943414c

New in version 0.5-rc2.

This fingerprint, from RC/Funge-98, implements INTERCAL-esque operations. It provides the following commands:

A : a — &a
Performs unary AND operation, defined as a AND ror(a, 1) where ror stands for bitwise rotate-right operation.
F : n
Works like INTERCAL’s FORGET command. It discards n vectors from the address stack. Reflects if n is negative; it is no-op when n is zero. This command doesn’t change delta.
I : a ba$b

Performs mingle operation.

Mingle interleaves bits from a and b, so if a = a3a2a1a0 and b = b3b2b1b0 then a$b = a3b3a2b2a1b1a0b0.

N : targetv
Works like INTERCAL’s NEXT command. It pushes the position of IP to the address stack, and jumps to target so for next time that cell is executed. Reflects if the address stack contains 79 entries already. (This is original INTERCAL-72 behavior, indeed.)
O : a — Va
Performs unary OR operation, defined as a OR ror(a, 1) where ror stands for bitwise rotate-right operation.
R : n
Works like INTERCAL’s RESUME command. It pops n vectors from the address stack, and jumps to last popped vector so for next time that cell is executed. Reflects if n is negative. If n is larger than the size of address stack, the address stack will be emptied and the position won’t change. This command doesn’t change delta.
S : a ba~b

Performs select operation.

Select collects bits from a, such that corresponding bit from b is set. Collected bits are left-padded and stored in the order: for example 1100 ~ 101 is 10, since b has bit 2 and 0 set.

X : a — ∀a
Performs unary XOR operation, defined as a XOR ror(a, 1) where ror stands for bitwise rotate-right operation.

INTERCAL uses the fixed integer size but PyFunge doesn’t, so it uses certain heuristics. If an operand of unary commands (A, O, X) is larger than 16 bits, it assumes the integer size of 32 bits; if it is larger than 32 bits, it assumes the integer size of 64 bits; and so on. This is consistent with RC/Funge-98’s behavior too.