new functions, doc updates
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
|`(first list)`|Returns first element of a list|`>>> (first '(1 2 3)) => 1`|List manipulation|
|
||||
|`(last list)`|Returns last element of list|`>>> (last '(1 2 3)) => 2`|List manipulation|
|
||||
|`(range low high)`|Returns list with elements in range low .. high|`(range 1 5) => (1 2 3 4)`|List manipulation|
|
||||
|`(member lst item)`|Returns #t when item is inluded in lst otherwise nil||List manipulation|
|
||||
|`(member lst item)`|Returns #t when item is inluded in lst otherwise nil|`>>> (member '(1 2 3) 1) => #t`|List manipulation|
|
||||
|`(uniq list)`|Filter out any duplicates from list|`>>> (uniq '(1 2 2 3 4 5 2 2)) => (1 2 3 4 5)`|List manipulation|
|
||||
|`(flatten list)`|Flattens a list to single level|`>>> (flatten '(1 (2 2) 3)) => (1 2 2 3)`|List manipulation|
|
||||
|`(take list count)`|Returns sublist with count element of list|`>>> (take '(1 2 3 4) 3) => (1 2 3)`|List manipulation|
|
||||
@@ -83,6 +83,8 @@
|
||||
|`(input [prompt])`|Get user input with an optional prompt||IO|
|
||||
|`(random low high)`|Get a random number between two numbers inclusively||System|
|
||||
|`(include file)`|Read a file and execute its code||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||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|
|
||||
@@ -94,9 +96,9 @@
|
||||
|`(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|
|
||||
|`(is-dir? filename)`|Returns true if passed filename is a directory||IO|
|
||||
|`(parse-csv string)`|Parse CSV string||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||String manipulation|
|
||||
|`(save-csv ..)`|Save list as csv||IO|
|
||||
|`(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-localtime-offset)`|Offset in seconds between local time and gmt time||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|
|
||||
@@ -165,6 +167,7 @@
|
||||
|`(doc::look "string")`|Alias for appropos||Language|
|
||||
|`(doc::lookup "string")`|Alias for appropos||Language|
|
||||
|`(get-env var)`|Return environment variable var|`>>> (get-env "HOME") => "/Users/vaclavt"`|System|
|
||||
|`(set-env var value)`|Sets environment variable var to value|`>>> (set-env "XXYYZZ" "haha") => "haha"`|System|
|
||||
|`(second list)`|Returns second element of list|`>>> (second '(1 2 3 4 5 6 7)) => 2`|List manipulation|
|
||||
|`(third list)`|Returns third element of list|`>>> (third '(1 2 3 4 5 6 7)) => 3`|List manipulation|
|
||||
|`(fourth list)`|Returns fourth element of list|`>>> (fourth '(1 2 3 4 5 6 7)) => 4`|List manipulation|
|
||||
|
||||
Reference in New Issue
Block a user