#t and #f added to language, datetime fixes

This commit is contained in:
2021-10-12 13:26:38 +02:00
parent adca8a452b
commit 4359012190
13 changed files with 90 additions and 55 deletions

View File

@@ -6,6 +6,7 @@
|-c code|Runs given code|
|-f source_file ..|Executes code in files|
|-i|Runs REPL|
|-d|Turns on better stacktrace|
|-p|Prints profile info at the end|
|-v|Prints version string|
@@ -22,6 +23,7 @@
|Special Form|Argument Evaluations|Purpose|
|:-|-|-|
|`(if cond a b)`|`if` only evaluates its `cond` argument. If `cond` is truthy (non-zero), then `a` is evaluated. Otherwise, `b` is evaluated.|This special form is the main method of control flow.|
|`(cond (test1 action1) (test2 action2) ... (testn actionn))`|The first clause whose test evaluates to non-nil is selected; all other clauses are ignored, and the consequents of the selected clause are evaluated in order. If none of the test conditions are evaluated to be true, then the cond statement returns nil.|This special form is method of control flow.|
|`(do a b c ...)`|`do` takes a list of s-expressions and evaluates them in the order they were given (in the current scope), and then returns the result of the last s-expression.|This special form allows lambda functions to have multi-step bodies.|
|`(scope a b c ...)`|`scope` takes a list of s-expressions and evaluates them in the order they were given _in a new scope_, and then returns the result of the last s-expression.|This special form allows the user to evaluate blocks of code in new scopes.|
|`(defun name params body)`|`defun` evaluates none of its arguments.|This special form allows the user to conveniently define functions.|
@@ -85,6 +87,7 @@
|`(parse-json json_string)`|Parse JSON string||
|`(save-csv ..)`|||
|`(get-universal-time)`|Get current time as secs from epoch||
|`(get-localtime-offset)`|Offset in seconds between local time and gmt 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"`|
|`(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`|