Created
December 19, 2019 06:31
-
-
Save val314159/9a0a609418221af06df8856ab53993d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun f. (&rest r) | |
(if (cdr r) | |
(progn (apply 'format t r) (terpri) (cadr r)) | |
(progn (apply 'format t "~s" r) (terpri) (car r)))) | |
(defvar x0 '((0 (format t "[~s]~%" 101)))) | |
(defvar x1 '((0 (if t \:)) | |
(1 (format t "[~s]~%" 102)) | |
(1 (format t "[~s]~%" 103)) | |
)) | |
(defvar xx '((0 nil))) | |
(defvar x2 '((0 (if t \:)) | |
(1 (format t "[~s]~%" 104)) | |
(1 (format t "[~s]~%" 105)) | |
(1 (if t \:)) | |
(2 (format t "[~s]~%" 106)) | |
(2 (format t "[~s]~%" 107)) | |
(1 (format t "[~s]~%" 108)) | |
(0 (format t "[~s]~%" 109)) | |
)) | |
(defun next-stmt (x) | |
(labels ((ewc (x) (eq '\: (car (last x)))) | |
(blk (n) (if (eq (caar x) n) (append (stmt) (blk n)))) | |
(stmt () (if x (let* ((y (pop x)) | |
(z (pop y)) | |
(w (pop y))) | |
(if (null (ewc w)) (list w) | |
(list (append | |
(butlast w) | |
(list (cons 'progn (blk (caar x))))))))))) | |
(let* ((a (stmt))) | |
(if (member (caar x) (list nil 0)) (values a x) | |
(error "indent error"))))) | |
(f. "------------------------------1") | |
(f. (next-stmt x0)) | |
(f. "------------------------------2") | |
(f. (next-stmt x1)) | |
(f. "------------------------------3") | |
(f. (next-stmt x2)) | |
(f. "------------------------------4") | |
(f. (next-stmt xx)) | |
(f. "------------------------------5") | |
(f. (next-stmt nil)) | |
(f. "------------------------------6") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
combobulate: | |
sbcl --script $*.lisp | |
ecl -load $*.lisp -eval '(quit)' | |
ccl64 --load $*.lisp --eval '(quit)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment