July 1st 2026 - Things I Worked On
Added multi expression and nested functions to Hith
(defun outer-func (x) (defun inner-func (x) (+ x 1)) (+ x (inner-func 10))) (outer-func 5)
Added reading a hith script
You can now write whole scripts in hith and pass them to the interpreter:
Example script:
(defvar x 10) (defun add20 (x) (+ x 20)) (message (add20 x))
python hith.py script
Output:
30
Added getting length of strings and quoted lists
I'm still not happy with the implementation of quotes nor lists so I'll have to work on this some more but here's an early attempt at getting the length of things.
Tests:
def test_string_length(self): self.assertEqual(self.evaluate("(length \"\")"), 0) self.assertEqual(self.evaluate("(length \"a\")"), 1) self.assertEqual(self.evaluate("(length \"ab\")"), 2) self.assertEqual(self.evaluate("(length \"ab cd\")"), 5) self.evaluate("(defvar x \"hello\")") self.assertEqual(self.evaluate("(length x)"), 5) def test_list_length(self): self.assertEqual(self.evaluate("(length '(test 123))"), 2)
Implementation:
def length(self, *args, env): if args[0] == "'": # return length of quoted list return len(args[1]) else: value = self.evaluate_node(args[0], env) # 2 is the length of the two enclosing quote marks return len(value) - 2
Added quote special form to hith
(quote test) (quote (this is a list))
Added getting commandline args and getting items from list to hith
A list is now created every time a hith script is run which contains the commandline args and is called command-line-args.
Items can be accessed from this and other lists using the new nth function:
(nth 2 command-line-args)
Where 2 is the index of the value you want to access.
Added progn to hith
progn returns the result of the last expression.
(progn (+ 2 3) (* 3 4))
Added an exit function to hith
(exit)
Added reading lines from a file to hith
This is a very high level function and needs to be broken down into more primitive functionality. Ideally, the final form of this function will be written 100% in hith. But for now its considered a built-in function.
(file-read-lines file)