mlisp/debug.lsp

52 lines
2.4 KiB
Common Lisp

(print (string-regex-list "<td class=\"xyz\">1</td><td>2</td>" "<td.*?>(.*?)</td>" "match" "ignore"))
(print (string-regex-list "<td class=\"xyz\">1</td><td>2</td>" "<td.*?>(.*?)</td>" "token"))
;; (include "/usr/local/var/mlisp/ut.lsp")
;; (ut::define-test "result of (string-regex-list ... \"match\")" (ut::assert-equal '(("<td class=\"xyz\">1</td>" "<td>2</td>")) (string-regex-list "<td class=\"xyz\">1</td><td>2</td>" "<td.*?>(.*?)</td>" "match" "ignore")))
;; (ut::define-test "result of (string-regex-list ... \"token\")" '(ut::assert-equal '(("1") ("2")) (string-regex-list "<td class=\"xyz\">1</td><td>2</td>" "<td.*?>(.*?)</td>" "token")))
;; (ut::run-tests)
;; (define create_tbl_sql "create table prices (datetime integer, symbol varchar(8), prev_close float, open float, price float, change float, change_prct varchar(16))")
;; (define insert_sql "insert into prices (datetime, symbol, prev_close, open, price, change, change_prct) values (1626979443, 'MPC', 54.08, 53.82, 53.63, -0.832101, '-0.83 %')")
;; (define select_sql "select to_string(datetime, '%d.%m.%Y %H:%M:%S'), symbol, prev_close, open, price, change, change_prct from prices")
;; (print (usql create_tbl_sql))
;; (print (usql insert_sql))
;; (print (usql select_sql))
;; (print (usql "select to_string(datetime, '%d.%m.%Y %H:%M:%S'), symbol, prev_close, open, price, change, change_prct from prices"))
;; (print (+ "select min(adjClose), max(adjClose) from history_prices where symbol = '" var "'"))
;; (print (usql "create table data (ticker varchar(8), price float null)"))
;; (usql "load data from '/Users/vaclavt/Library/Mobile Documents/com~apple~CloudDocs/Development/usql/data.csv')")
;; (print (usql "select ticker, price from data"))
;; (read-url "https://api.nasdaq.com/api/calendar/dividends/")
;; (define fc 5)
;; (define sc 5)
;; (define first_tid (thread-create (while (> fc 0) (do (thread-under-lock "ilock" (do (set! fc (dec fc))(print 1))) (thread-sleep 500)))))
;; (define second_tid (thread-create (while (> sc 0) (do (thread-under-lock "ilock" (do (set! sc (dec sc))(print 2))) (thread-sleep 750)))))
;; (print "first thread id:" first_tid)
;; (print "second thread id:" second_tid)
;; (threads-join)
;; (print "ok")
;; (try
;; (ls-dir "nonexisting/dir")
;; (print "dir not exists"))
;; (try
;; (throw "my-exception")
;; (print "exception caught:" ml-exception))
;; (/ 1 0)