|
|
|
@@ -80,27 +80,25 @@
|
|
|
|
|`(exit code)`|Exit the program with an integer code||System|
|
|
|
|
|`(exit code)`|Exit the program with an integer code||System|
|
|
|
|
|`(quit code)`|Same as (exit ..)||System|
|
|
|
|
|`(quit code)`|Same as (exit ..)||System|
|
|
|
|
|`(print ..)`|Print several values and return the last one||IO|
|
|
|
|
|`(print ..)`|Print several values and return the last one||IO|
|
|
|
|
|`(input [prompt])`|Get user input with an optional prompt||IO|
|
|
|
|
|
|
|
|
|`(random low high)`|Get a random number between two numbers inclusively||System|
|
|
|
|
|`(random low high)`|Get a random number between two numbers inclusively||System|
|
|
|
|
|`(include file)`|Read a file and execute its code||IO|
|
|
|
|
|`(include file)`|Read a file and execute its code||IO|
|
|
|
|
|
|
|
|
|`(input [prompt])`|Get user input with an optional prompt||IO|
|
|
|
|
|`(read)`|Reads in the printed representation of a Lisp object from input-stream, builds a corresponding Lisp object, and returns the object||IO|
|
|
|
|
|`(read)`|Reads in the printed representation of a Lisp object from input-stream, builds a corresponding Lisp object, and returns the object||IO|
|
|
|
|
|`(read-line)`|Reads in a line of text terminated by a newline||IO|
|
|
|
|
|`(read-file filename)`|Get the contents of a file|`>>> (read-file "/tmp/a.txt") => "test"`|IO|
|
|
|
|
|`(read-file filename)`|Get the contents of a file||IO|
|
|
|
|
|
|
|
|
|`(read-file-lines filename lambda)`|Reads file and for each line call lambda with passing the line as a parameter|`(read-file-lines "/tmp/f.txt" (lambda (ln) (print ln))`|IO|
|
|
|
|
|`(read-file-lines filename lambda)`|Reads file and for each line call lambda with passing the line as a parameter|`(read-file-lines "/tmp/f.txt" (lambda (ln) (print ln))`|IO|
|
|
|
|
|`(write-file filename content-str)`|Write a string to a file||IO|
|
|
|
|
|`(write-file filename content-str)`|Write a string to a file|`>>> (write-file "/tmp/a.txt" "test") => #t`|IO|
|
|
|
|
|`(read-url url [headers] [body] [method])`|Reads URL|Returns list (status-code content)|IO|
|
|
|
|
|`(read-url url [headers] [body] [method])`|Reads URL. Returns list (status-code content)||IO|
|
|
|
|
|`(system-cmd command_str)`|Execute system command||System|
|
|
|
|
|`(system-cmd command_str)`|Execute system command|`>>> (system-cmd "date") => (0 "Fri Feb 25 12:35:28 CET 2022\n")`|System|
|
|
|
|
|`(ls-dir dir)`|List a dir|List of directory entries|
|
|
|
|
|`(ls-dir dir)`|List a dir|List of directory entries|`>>> (ls-dir "/tmp") => ("." ".." "vscode-ipc-cccbe1dd-8c71-4028-a863-df975ad5887b.sock" "vscode-ipc-1163bb52-d088-41dc-80a5-81b6a7c7fa36.sock" "vscode-ipc-630f21df-26b5-43d4-8b2e-5175d53ce317.sock")`|IO|
|
|
|
|
|`(is-file? filename)`|Returns true if passed filename is a file||IO|
|
|
|
|
|`(is-file? filename)`|Returns true if passed filename is a file|`>>> (is-file? "/tmp") => nil`|IO|
|
|
|
|
|`(is-dir? filename)`|Returns true if passed filename is a directory||IO|
|
|
|
|
|`(is-dir? filename)`|Returns true if passed filename is a directory|`>>> (is-dir? "/tmp") => #t`|IO|
|
|
|
|
|`(tcp-server port handler)`|Starts listening on port and when request comes calls passed lambda and writes its returned value back to client. Lambda must return either string or two element list where first element is boolean and second string.When first element is true it closes listening socker.|(`tcp-server 7777 (lambda (str) (list #t (string-upcase str))))`|IO|
|
|
|
|
|`(tcp-server port handler)`|Starts listening on port and when request comes calls passed lambda and writes its returned value back to client. Lambda must return either string or two element list where first element is boolean and second string.When first element is true it closes listening socker.|(`tcp-server 7777 (lambda (str) (list #t (string-upcase str))))`|IO|
|
|
|
|
|`(tcp-client address port data)`|Opens connection to server on port, writes there data and returns response.|`(print (tcp-client "127.0.0.1" 7777 "abcd"))`|IO|
|
|
|
|
|`(tcp-client address port data)`|Opens connection to server on port, writes there data and returns response.|`(print (tcp-client "127.0.0.1" 7777 "abcd"))`|IO|
|
|
|
|
|`(is-dir? filename)`|Returns true if passed filename is a directory||IO|
|
|
|
|
|`(parse-csv string)`|Parse CSV string|`>>> (parse-csv "A,B\n1,1\n2,2") => ((1 1) (2 2))`|String manipulation|
|
|
|
|
|`(parse-csv string)`|Parse CSV string|`>>> (make-csv '(("A" "B")(1 1)(2 2))) => "A,B\n1,1\n2,2"`|String manipulation|
|
|
|
|
|`(parse-json json_string)`|Parse JSON string|`>>> (parse-json "{\"k1\":\"v1\", \"k2\":42, \"k3\":[\"a\",123,true,false,null]}") => (("k1" "v1") ("k2" 42) ("k3" ("a" 123 #t nil nil)))`|String manipulation|
|
|
|
|
|`(parse-json json_string)`|Parse JSON string||String manipulation|
|
|
|
|
|`(make-csv ..)`|Returns list as csv string|`>>> (make-csv '(("A" "B")(1 1)(2 2))) => "A,B\n1,1\n2,2"`|String manipulation|
|
|
|
|
|`(make-csv ..)`|Returns list as csv string||IO|
|
|
|
|
|
|
|
|
|`(get-universal-time)`|Get current time as secs from epoch|`>>> (get-universal-time) => 1642152733`|Date and time|
|
|
|
|
|`(get-universal-time)`|Get current time as secs from epoch|`>>> (get-universal-time) => 1642152733`|Date and time|
|
|
|
|
|`(get-localtime-offset)`|Offset in seconds between local time and gmt time||Date and time|
|
|
|
|
|`(get-localtime-offset)`|Offset in seconds between local time and gmt time|`>>> (get-localtime-offset) => 3600`|Date and time|
|
|
|
|
|`(date-to-str date format)`|Converts date to formated string. Format is strftime format (https://www.tutorialspoint.com/c_standard_library/c_function_strftime.htm)|`>>> (date-to-str (get-universal-time) "%Y-%m-%d %H:%M:%S") => "2021-03-13 19:53:01"`|Date and time|
|
|
|
|
|`(date-to-str date format)`|Converts date to formated string. Format is strftime format (https://www.tutorialspoint.com/c_standard_library/c_function_strftime.htm)|`>>> (date-to-str (get-universal-time) "%Y-%m-%d %H:%M:%S") => "2021-03-13 19:53:01"`|Date and time|
|
|
|
|
|`(str-to-date string format)`|Converst string to time of secs since epoch. |`>>> (str-to-date "2021-03-13 19:53:01" "%Y-%m-%d %H:%M:%S") => 1615665181`|Date and time|
|
|
|
|
|`(str-to-date string format)`|Converst string to time of secs since epoch. |`>>> (str-to-date "2021-03-13 19:53:01" "%Y-%m-%d %H:%M:%S") => 1615665181`|Date and time|
|
|
|
|
|`(date-add date amount unit)`|Add number of units to date. A unit is one of 'year', 'month', 'day', 'hour', 'minute' or 'second'|`>>> (date-to-str (date-add (str-to-date "2021-03-13 19:53:01" "%Y-%m-%d %H:%M:%S") 10 "day") "%Y-%m-%d %H:%M:%S") => "2021-03-23 20:53:01"`|Date and time|
|
|
|
|
|`(date-add date amount unit)`|Add number of units to date. A unit is one of 'year', 'month', 'day', 'hour', 'minute' or 'second'|`>>> (date-to-str (date-add (str-to-date "2021-03-13 19:53:01" "%Y-%m-%d %H:%M:%S") 10 "day") "%Y-%m-%d %H:%M:%S") => "2021-03-23 20:53:01"`|Date and time|
|
|
|
|
@@ -126,10 +124,10 @@
|
|
|
|
|`(string-rpad str len char)`|Pad string from righ with char to length len|`>>> (string-rpad "0" 10 "x") => "0xxxxxxxxx"`|String manipulation|
|
|
|
|
|`(string-rpad str len char)`|Pad string from righ with char to length len|`>>> (string-rpad "0" 10 "x") => "0xxxxxxxxx"`|String manipulation|
|
|
|
|
|`(string-split str separator)`|Splits string into list by regexp|`>>> (string-split "split me by space" "\s+") => ("split" "me" "by" "space")`|String manipulation|
|
|
|
|
|`(string-split str separator)`|Splits string into list by regexp|`>>> (string-split "split me by space" "\s+") => ("split" "me" "by" "space")`|String manipulation|
|
|
|
|
|`(string-rltrim str len RKRRKR)`|Removes " \n\r\t" from the begininfg or end or both ends of str||Regex|
|
|
|
|
|`(string-rltrim str len RKRRKR)`|Removes " \n\r\t" from the begininfg or end or both ends of str||Regex|
|
|
|
|
|`(string-ltrim str)`|Removes " \n\r\t" from the begininfg of str||String manipulation|
|
|
|
|
|`(string-ltrim str)`|Removes " \n\r\t" from the begininfg of str|`>>> (string-ltrim " *** ") => "*** "`|String manipulation|
|
|
|
|
|`(string-rtrim str)`|Removes " \n\r\t" from the end of str||String manipulation|
|
|
|
|
|`(string-rtrim str)`|Removes " \n\r\t" from the end of str|`>>> (string-rtrim " *** ") => " ***"`|String manipulation|
|
|
|
|
|`(string-trim str)`|Removes " \n\r\t" from the both strart and end of str||String manipulation|
|
|
|
|
|`(string-trim str)`|Removes " \n\r\t" from the both strart and end of str|`>>> (string-trim " *** ") => "***"`|String manipulation|
|
|
|
|
|`(string-case str RKRRKR)`|Returns up or down cased string||String manipulation|
|
|
|
|
|`(string-case str UPLO)`|Returns up or down cased string based on second parameter (upper/lower)|`>>> (string-case "abc" "upper") => "ABC"`|String manipulation|
|
|
|
|
|`(string-upcase str)`|Returns up cased string|`>>> (string-upcase "abcdefghchijklmn") => "ABCDEFGHCHIJKLMN"`|String manipulation|
|
|
|
|
|`(string-upcase str)`|Returns up cased string|`>>> (string-upcase "abcdefghchijklmn") => "ABCDEFGHCHIJKLMN"`|String manipulation|
|
|
|
|
|`(string-downcase str)`|Returns down cased string |`>>> (string-downcase "ABCDefghchijklmn") => "abcdefghchijklmn"`|String manipulation|
|
|
|
|
|`(string-downcase str)`|Returns down cased string |`>>> (string-downcase "ABCDefghchijklmn") => "abcdefghchijklmn"`|String manipulation|
|
|
|
|
|`(string-join lst sep)`|Returns string created as elements of concatenation of lst elements separated by sep|`>>> (string-join ("A" "B" "C" "D") ",") => "A,B,C,D"`|String manipulation|
|
|
|
|
|`(string-join lst sep)`|Returns string created as elements of concatenation of lst elements separated by sep|`>>> (string-join ("A" "B" "C" "D") ",") => "A,B,C,D"`|String manipulation|
|
|
|
|
@@ -147,18 +145,18 @@
|
|
|
|
|`(int? e)`|Returns true if type of e is integer|`>>> (int? "str") => nil >>> (int? 9) => #t`|Type casting|
|
|
|
|
|`(int? e)`|Returns true if type of e is integer|`>>> (int? "str") => nil >>> (int? 9) => #t`|Type casting|
|
|
|
|
|`(float? e)`|Returns true if type of e is float|`>>> (float? 9) => nil >>> (float? 9.0) => #t`|Type casting|
|
|
|
|
|`(float? e)`|Returns true if type of e is float|`>>> (float? 9) => nil >>> (float? 9.0) => #t`|Type casting|
|
|
|
|
|`(nil? e)`|Returns true if type of e is nil|`>>> (nil? 9.0) => nil >>> (nil? nil) => #t >>> (nil? '()) => nil`|Type casting|
|
|
|
|
|`(nil? e)`|Returns true if type of e is nil|`>>> (nil? 9.0) => nil >>> (nil? nil) => #t >>> (nil? '()) => nil`|Type casting|
|
|
|
|
|`(true? e)`|Returns true if type of e is #t||Type casting|
|
|
|
|
|`(true? e)`|Returns true if type of e is #t|`>>> (true? 1) => nil >>> (true? #t) => #t`|Type casting|
|
|
|
|
|`(parse ..)`|Parses string to be evaluated|`>>> (eval (first (parse "(+ 1 2)"))) => 3`|Language|
|
|
|
|
|`(parse ..)`|Parses string to be evaluated|`>>> (eval (first (parse "(+ 1 2)"))) => 3`|Language|
|
|
|
|
|`(quick-sort-by list cmp)`|Returns list sorted by comparsion function||Language|
|
|
|
|
|`(quick-sort-by list cmp)`|Returns list sorted by comparsion function||Language|
|
|
|
|
|`(quick-sort list)`|Return sorted list|`>>> (quick-sort '(2 4 6 1 7 3 3 9 5)) => (1 2 3 3 4 5 6 7 9)`|Language|
|
|
|
|
|`(quick-sort list)`|Return sorted list|`>>> (quick-sort '(2 4 6 1 7 3 3 9 5)) => (1 2 3 3 4 5 6 7 9)`|Language|
|
|
|
|
|`(quick-sort-reverse list)`|Return reverse sorted list|`>>> (quick-sort-reverse '(2 4 6 1 7 3 3 9 5)) => (9 7 6 5 4 3 3 2 1)`|Language|
|
|
|
|
|`(quick-sort-reverse list)`|Return reverse sorted list|`>>> (quick-sort-reverse '(2 4 6 1 7 3 3 9 5)) => (9 7 6 5 4 3 3 2 1)`|Language|
|
|
|
|
|`(not c)`|Logical NOT of c|`>>> (not 1) => nil`|Language|
|
|
|
|
|`(not c)`|Logical NOT of c|`>>> (not 1) => nil`|Language|
|
|
|
|
|`(neg n)`|Negates number|`>>> (neg -5) => 5`|Language|
|
|
|
|
|`(neg n)`|Negates number|`>>> (neg -5) => 5`|Language|
|
|
|
|
|`(is-pos? n)`|Returns true if n is positive number||Language|
|
|
|
|
|`(is-pos? n)`|Returns true if n is positive number|`>>> (is-pos? -1) => nil`|Language|
|
|
|
|
|`(is-neg? n)`|Returns true if n is negative number||Language|
|
|
|
|
|`(is-neg? n)`|Returns true if n is negative number|`>>> (is-neg? -1) => #t`|Language|
|
|
|
|
|`(dec n)`|Return n decremented by 1|`>>> (dec 5) => 4`|Language|
|
|
|
|
|`(dec n)`|Return n decremented by 1|`>>> (dec 5) => 4`|Language|
|
|
|
|
|`(inc n)`|Return n incremented by 1|`>>> (inc 5) => 6`|Language|
|
|
|
|
|`(inc n)`|Return n incremented by 1|`>>> (inc 5) => 6`|Language|
|
|
|
|
|`(sleep time)`|Pauses execution for time interval of seconds||System|
|
|
|
|
|`(sleep time)`|Pauses execution for time interval of seconds. Calls system sleep command|`>>> (sleep 1) => (0 "")`|System|
|
|
|
|
|`(function? e)`|Returns true if type of e is lambda, macro or builtin|`>>> (function? index) => #t`|Language|
|
|
|
|
|`(function? e)`|Returns true if type of e is lambda, macro or builtin|`>>> (function? index) => #t`|Language|
|
|
|
|
|`(unless test v)`|If test is not truthy then v is evaluated. This is macro.|`>>> (unless (> 1 2) "1 < 2") => "1 < 2"`|Language|
|
|
|
|
|`(unless test v)`|If test is not truthy then v is evaluated. This is macro.|`>>> (unless (> 1 2) "1 < 2") => "1 < 2"`|Language|
|
|
|
|
|`(dotimes v n body)`|Evaluates body n-times. For each eveluation v is set to value between 0 and n minus one|`(dotimes i 10 (print "i :" i))`|Language|
|
|
|
|
|`(dotimes v n body)`|Evaluates body n-times. For each eveluation v is set to value between 0 and n minus one|`(dotimes i 10 (print "i :" i))`|Language|
|
|
|
|
@@ -177,7 +175,7 @@
|
|
|
|
|`(sprintf ..)`|Writes string pointed by format to the standard output|`>>> (sprintf "%s, %d, %.2f" (list "string" 1000 3.14)) => "string, 1000, 3.14"`|String manipulation|
|
|
|
|
|`(sprintf ..)`|Writes string pointed by format to the standard output|`>>> (sprintf "%s, %d, %.2f" (list "string" 1000 3.14)) => "string, 1000, 3.14"`|String manipulation|
|
|
|
|
|`(thread-create code..)`|Creates new thread, starts evalueating code and returns immediatelly thread id||Threading|
|
|
|
|
|`(thread-create code..)`|Creates new thread, starts evalueating code and returns immediatelly thread id||Threading|
|
|
|
|
|`(thread-under-lock lockname code)`|Acquire lock with lockname and eval code. "ilock" currently is only allowed lockname||Threading|
|
|
|
|
|`(thread-under-lock lockname code)`|Acquire lock with lockname and eval code. "ilock" currently is only allowed lockname||Threading|
|
|
|
|
|`(thread-sleep milisecons)`|Sleeps thread for given amount of miliseconds||Threading|
|
|
|
|
|`(thread-sleep milisecons)`|Sleeps thread for given amount of miliseconds|`>>> (thread-sleep 100) => 100`|Threading|
|
|
|
|
|`(threads-join)`|Wait for all running threads to finish||Threading|
|
|
|
|
|`(threads-join)`|Wait for all running threads to finish||Threading|
|
|
|
|
|`(try block catch_block [finally_block])`|Evaluates block and if an exception is thrown, evaluates catch_block.Eventually in both cases evals finally_block. Return evaluated last expression from block if no exception or last expression from catch_block, if exception is thrown from block. Variable ml-exception in catch block is available with astring describing exception||Exceptions|
|
|
|
|
|`(try block catch_block [finally_block])`|Evaluates block and if an exception is thrown, evaluates catch_block.Eventually in both cases evals finally_block. Return evaluated last expression from block if no exception or last expression from catch_block, if exception is thrown from block. Variable ml-exception in catch block is available with astring describing exception||Exceptions|
|
|
|
|
|`(throw exp_desc)`|Throws an exception with exp_desc describing what happened. exp_desc will be evaluated a returned as string|`>>> (throw (+ 1 2))\n3`|Exceptions|
|
|
|
|
|`(throw exp_desc)`|Throws an exception with exp_desc describing what happened. exp_desc will be evaluated a returned as string|`>>> (throw (+ 1 2))\n3`|Exceptions|
|