mlisp/debug.lsp

31 lines
1.3 KiB
Common Lisp

;https://github.com/anthay/Lisp90/blob/master/lisp90.cpp
;http://howtowriteaprogram.blogspot.com/2010/11/lisp-interpreter-in-90-lines-of-c.html
; https://stackoverflow.com/questions/526082/in-scheme-whats-the-point-of-set
;; (define x 3)
;; (defun foo() (do (define x 4) x))
;; (defun bar() (do (set! x 4) x))
;; (foo) ; returns 4
;; x ; still 3
;; (bar) ; returns 4
;; x ; is now 4
;; (defun mini-uuid (uuid_len) (do
;; (define a_list '("_" "-" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"))
;; (reduce (lambda (acc y) (+ acc y)) "" (map (lambda (e) (index a_list (random 0 (- (len a_list) 1)))) (range 0 uuid_len)))
;; ))
;; (benchmark "uuid 1000x :" (define i 0) (while (< i 1000) (do (mini-uuid 5) (define i (+ i 1)))))
;; (define first_tid (thread-create (while 1 (do (thread-under-lock "ilock" (print 1)) (thread-sleep 50)))))
;; (define second_tid (thread-create (while 1 (do (thread-under-lock "ilock" (print 2)) (thread-sleep 75)))))
;; (print "first thread id:" first_tid)
;; (print "second thread id:" second_tid)
;; (threads-join)
;; (print "ok")