sort tests added

This commit is contained in:
VaclavT 2021-02-26 09:49:54 +01:00
parent f7992b1eab
commit c104e3ce85
3 changed files with 23 additions and 11 deletions

View File

@ -3,11 +3,10 @@
- see malformed_program - wrong parsing of comments - probably comment with "
### TODO
- use file suffix .lsp instead of .lisp
- test whether AIG,,,10 csv row is parsed
- support for (), nil, t
- print-table
- download 1 year of data from api.nasdaq.com into test dir
- support for including lisp libs at startup from dir
- download 10 years of data from api.nasdaq.com into test dir
- documentation
- rename data.csv and add more tickers
- logical operators
@ -19,19 +18,22 @@
- add instrumentation (time, nr of evals, debug info, debug environment etc)
- in casting functions (as_string..) better exception description
- add better print (syntax high-lighting)
- add comman line options -h -v
- add command line options -h -v
- readline
- execute system command should capture stderr
- add sleep
- add builtin sleep
- add built in for and, or
- file functions
- name it here
- string functions
- name it here
- compare - needed for sorting
- uppper/lower case
- regexp functions
- date support
- decode-universal-time
- anv function
- env functions
- get env
- set env
- add hash datatype
- conversion functions like parse-integer
- list function nth

View File

@ -34,9 +34,15 @@
(print (len csv_list))
(define my_tickers '("WFC" "AIG"))
(define my_tickers '("FDX" "C" "AIG" "BAC" "BK" "PBF" "PBFX" "SYF" "WFC" "TEVA" "XOM"))
; (print (filter (lambda (x) (= (first x) "CLX")) csv_list))
(print (filter (lambda (x) (member my_tickers (first x))) csv_list))
; (print (filter (lambda (x) (member my_tickers (first x))) csv_list))
(define csv_list (filter (lambda (x) (member my_tickers (first x))) csv_list))
(define sorted_list (quick-sort-by csv_list (lambda (a b) (> (str-to-date (second a) "%m/%d/%Y") (str-to-date (second b) "%m/%d/%Y")))))
(for x csv_list (print x))
(print "Debug ends")

View File

@ -30,8 +30,8 @@
(+ n (scitej (- n 1)))
))
(print (scitej 4000))
; (print (scitej 5))
;; (print (scitej 4000))
(print (scitej 1000))
@ -42,6 +42,10 @@
(print "sorted: " (quick-sort '(10 9 8 7 6 5 4 3 2 1)))
(print "sorted: " (quick-sort '(1 2 3 4 5 6 7 8 9 10)))
(print "sorted by: " (quick-sort-by '(10 9 8 7 6 5 4 3 2 1) (lambda (a b) (> a b)) ))
(print "sorted by: " (quick-sort-by '(1 2 3 4 5 6 7 8 9 10) (lambda (a b) (> a b)) ))
(print "sorted by: " (quick-sort-by '(1 2 3 4 5 6 7 8 9 10) (lambda (a b) (< a b)) ))