Recently Written · git

LispBrain

The best Brainfuck debugger available, if you know how the Common Lisp debugger works. Uses Common Lisp's ease of debugging to make debugging Brainfuck code easy. Almost entirely useless.

git clone https://github.com/equwal/LispBrain

Log | Files | Refs


code/utils.lisp (791 bytes)

1 (in-package :brain)
2 
3 (defun any-char (char sequence)
4   "Compare the 'char' to each element of 'sequence' using the 'some'
5 command"
6   (some #'(lambda (x) (char-equal x char))
7 	sequence))
8 
9 (defun char-list->string-aux (char-list string position)
10   (if (null (first char-list))
11       string
12       (char-list->string-aux (rest char-list)
13 			     (progn (setf (char string position)
14 					  (first char-list))
15 				    string)
16 			     (1+ position))))
17 
18 (defun char-list->string (char-list)
19   (char-list->string-aux char-list (make-string (length char-list)) 0))
20 
21 (defun first-elt (string)
22   (elt string 0))
23 
24 (defun ascii->integer (char)
25   (char-code char))
26 
27 (defun integer->ascii (num)
28   (code-char num))
29 
30 (defun remove-first (string)
31   (if (= 1 (length string))
32       ""
33       (subseq string 1)))