all repos — hex @ 6b112b3be5d9d0270daa6037f8db2d0cdd242b3c

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

Added times symbol.
h3rald h3rald@h3rald.com
Fri, 23 May 2025 08:23:42 +0200
commit

6b112b3be5d9d0270daa6037f8db2d0cdd242b3c

parent

78163ab82462934a443b32008d7c3ce263a3170e

2 files changed, 18 insertions(+), 2 deletions(-)

jump to
M lib/utils.hexlib/utils.hex

@@ -390,6 +390,22 @@ "_filter_list" #

"_filter_result" # ) "filter" :: +;;; times +;; q i -> * +;; Execute quotation %:q%% %:i%% times. +( + "_times_i" : + "_times_q" : + (_times_i 0x0 >) + ( + _times_q . + _times_i 0x1 - "_times_i" : + ) + while + "_times_q" # + "_times_i" # +) "times" :: + ;;; slice ;; s1 i1 i2 -> s2 ;; Extracts the portion of the string between indices %:i1%% and %:i2%%.

@@ -413,4 +429,3 @@ "_slice_start" #

"_slice_str" # "_slice_result" # ) "slice" :: -
M scripts/test.hexscripts/test.hex

@@ -131,7 +131,7 @@

((args len 0x2 ==) ("two") ("no") if "two" ==) ((dup *) "square" :: 0x2 square 0x4 == "square" #) (0x1 "tmp-a" : (tmp-a 0x3 <) (tmp-a 0x1 + "tmp-a" :) while tmp-a 0x3 ==) - (symbols len 0x64 ==) + (symbols len 0x65 ==) ;60 ((0x2 0x0 /) (error "[symbol /] Division by zero" ==) try)

@@ -369,6 +369,7 @@ ;198

(("a" 0x0 0x1 slice) (error) try "[symbol slice] Index out of bounds" ==) ("a" 0x0 0x0 slice "a" ==) + ("" ("-" cat) 0x5 times "-----" ==) ) "TESTS" :