all repos — hex @ 6f7302ecf0b68003261d88067771a92cd6fca81e

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Removed filter symbol.
h3rald h3rald@h3rald.com
Sun, 22 Dec 2024 17:36:33 +0100
commit

6f7302ecf0b68003261d88067771a92cd6fca81e

parent

bf5d004b45f7e64653707c2c08173dc627d2d7d9

5 files changed, 54 insertions(+), 63 deletions(-)

jump to
M scripts/test.hexscripts/test.hex

@@ -135,7 +135,7 @@ ("a" ' ' ' ((("a"))) ==)

((0x1 0x2 0x3) (dup dup * *) map (0x1 0x8 0x1b) ==) ;64 - ((0x1 0x2 0x3) (0x2 % 0x0 ==) filter (0x2) ==) + ;((0x1 0x2 0x3) (0x2 % 0x0 ==) filter (0x2) ==) (0x2 dup stack (0x2 0x2) ==) (clear stack () ==) (0x1 0x2 swap pop stack (0x2) ==)
M src/doc.csrc/doc.c

@@ -105,7 +105,6 @@

// Quotation hex_set_doc(docs, "each", "q1 q2", "*", "Executes 'q2' for each item of 'q1'."); hex_set_doc(docs, "map", "q1 q2", "q3", "Applies 'q2' to 'q1' items and returns results."); - hex_set_doc(docs, "filter", "q1 q2", "q3", "Filters 'q2' by applying 'q1'."); // I/O hex_set_doc(docs, "puts", "a", "", "Prints 'a' and a new line to standard output.");
M src/hex.hsrc/hex.h

@@ -25,7 +25,7 @@ #define HEX_STDIN_BUFFER_SIZE 16384

#define HEX_REGISTRY_SIZE 1024 #define HEX_STACK_SIZE 256 #define HEX_STACK_TRACE_SIZE 16 -#define HEX_NATIVE_SYMBOLS 65 +#define HEX_NATIVE_SYMBOLS 64 #define HEX_MAX_SYMBOL_LENGTH 256 #define HEX_MAX_USER_SYMBOLS (HEX_REGISTRY_SIZE - HEX_NATIVE_SYMBOLS)

@@ -160,70 +160,69 @@ HEX_OP_PUSHQT = 0x03,

// Native Symbols HEX_OP_STORE = 0x10, - HEX_OP_DEFINE = 0x50, - HEX_OP_FREE = 0x11, + HEX_OP_DEFINE = 0x11, + HEX_OP_FREE = 0x12, - HEX_OP_IF = 0x12, - HEX_OP_WHEN = 0x13, - HEX_OP_WHILE = 0x14, - HEX_OP_ERROR = 0x15, - HEX_OP_TRY = 0x16, + HEX_OP_IF = 0x13, + HEX_OP_WHEN = 0x14, + HEX_OP_WHILE = 0x15, + HEX_OP_ERROR = 0x16, + HEX_OP_TRY = 0x17, - HEX_OP_DUP = 0x17, - HEX_OP_STACK = 0x18, - HEX_OP_CLEAR = 0x19, - HEX_OP_POP = 0x1A, - HEX_OP_SWAP = 0x1B, + HEX_OP_DUP = 0x18, + HEX_OP_STACK = 0x19, + HEX_OP_CLEAR = 0x1a, + HEX_OP_POP = 0x1b, + HEX_OP_SWAP = 0x1c, - HEX_OP_I = 0x1C, - HEX_OP_EVAL = 0x1D, - HEX_OP_QUOTE = 0x1E, + HEX_OP_I = 0x1d, + HEX_OP_EVAL = 0x1e, + HEX_OP_QUOTE = 0x1f, - HEX_OP_ADD = 0x1F, - HEX_OP_SUB = 0x20, - HEX_OP_MUL = 0x21, - HEX_OP_DIV = 0x22, - HEX_OP_MOD = 0x23, + HEX_OP_ADD = 0x20, + HEX_OP_SUB = 0x21, + HEX_OP_MUL = 0x22, + HEX_OP_DIV = 0x23, + HEX_OP_MOD = 0x24, - HEX_OP_BITAND = 0x24, - HEX_OP_BITOR = 0x25, - HEX_OP_BITXOR = 0x26, - HEX_OP_BITNOT = 0x27, - HEX_OP_SHL = 0x28, - HEX_OP_SHR = 0x29, + HEX_OP_BITAND = 0x25, + HEX_OP_BITOR = 0x26, + HEX_OP_BITXOR = 0x27, + HEX_OP_BITNOT = 0x28, + HEX_OP_SHL = 0x29, + HEX_OP_SHR = 0x2a, - HEX_OP_EQUAL = 0x2A, - HEX_OP_NOTEQUAL = 0x2B, - HEX_OP_GREATER = 0x2C, - HEX_OP_LESS = 0x2D, - HEX_OP_GREATEREQUAL = 0x2E, - HEX_OP_LESSEQUAL = 0x2F, + HEX_OP_EQUAL = 0x2b, + HEX_OP_NOTEQUAL = 0x2c, + HEX_OP_GREATER = 0x2d, + HEX_OP_LESS = 0x2e, + HEX_OP_GREATEREQUAL = 0x2f, + HEX_OP_LESSEQUAL = 0x30, - HEX_OP_AND = 0x30, - HEX_OP_OR = 0x31, - HEX_OP_NOT = 0x32, - HEX_OP_XOR = 0x33, + HEX_OP_AND = 0x31, + HEX_OP_OR = 0x32, + HEX_OP_NOT = 0x33, + HEX_OP_XOR = 0x34, - HEX_OP_INT = 0x34, - HEX_OP_STR = 0x35, - HEX_OP_DEC = 0x36, - HEX_OP_HEX = 0x37, - HEX_OP_ORD = 0x38, - HEX_OP_CHR = 0x39, - HEX_OP_TYPE = 0x3A, + HEX_OP_INT = 0x35, + HEX_OP_STR = 0x36, + HEX_OP_DEC = 0x37, + HEX_OP_HEX = 0x38, + HEX_OP_ORD = 0x39, + HEX_OP_CHR = 0x3a, + HEX_OP_TYPE = 0x3b, - HEX_OP_CAT = 0x3B, - HEX_OP_LEN = 0x3C, - HEX_OP_GET = 0x3D, - HEX_OP_INDEX = 0x3E, - HEX_OP_JOIN = 0x3F, + HEX_OP_CAT = 0x3c, + HEX_OP_LEN = 0x3d, + HEX_OP_GET = 0x3e, + HEX_OP_INDEX = 0x3f, + HEX_OP_JOIN = 0x40, - HEX_OP_SPLIT = 0x40, - HEX_OP_REPLACE = 0x41, + HEX_OP_SPLIT = 0x41, + HEX_OP_REPLACE = 0x42, - HEX_OP_EACH = 0x42, - HEX_OP_MAP = 0x43, - HEX_OP_FILTER = 0x44, + HEX_OP_EACH = 0x43, + HEX_OP_MAP = 0x44, HEX_OP_PUTS = 0x45, HEX_OP_WARN = 0x46,
M src/opcodes.csrc/opcodes.c

@@ -217,10 +217,6 @@ else if (strcmp(symbol, "map") == 0)

{ return HEX_OP_MAP; } - else if (strcmp(symbol, "filter") == 0) - { - return HEX_OP_FILTER; - } else if (strcmp(symbol, "puts") == 0) { return HEX_OP_PUTS;

@@ -378,8 +374,6 @@ case HEX_OP_EACH:

return "each"; case HEX_OP_MAP: return "map"; - case HEX_OP_FILTER: - return "filter"; case HEX_OP_PUTS: return "puts"; case HEX_OP_WARN:
M src/symbols.csrc/symbols.c

@@ -2667,7 +2667,6 @@ hex_set_native_symbol(ctx, "try", hex_symbol_try);

hex_set_native_symbol(ctx, "'", hex_symbol_q); hex_set_native_symbol(ctx, "each", hex_symbol_each); hex_set_native_symbol(ctx, "map", hex_symbol_map); - hex_set_native_symbol(ctx, "filter", hex_symbol_filter); hex_set_native_symbol(ctx, "swap", hex_symbol_swap); hex_set_native_symbol(ctx, "dup", hex_symbol_dup); hex_set_native_symbol(ctx, "stack", hex_symbol_stack);