Updates readme to match the actual api for list-ref

master
sloum 2 years ago
parent 61667f2d68
commit 1a1030400b

@ -228,7 +228,7 @@ Implemented:
<li><code>(map [procedure] [list...])</code>: <code>list</code></li>
<li><code>(for-each [procedure] [list...])</code>: <code>list</code></li>
<li><code>(list->string [list] [join-on: string])</code>: <code>string</code></li>
<li><code>(list-ref [list] [number])</code>: <code>value</code></li>
<li><code>(list-ref [list] [index: number] [[set: value]])</code>: <code>value|list</code></li>
<li><code>(list-sort [list] [[sub-list-index: number]])</code>: <code>list</code></li>
<li><code>(reverse [list|string])</code>: <code>list</code></li>
<li><code>(assoc [assoc-list] [key: value] [[value: value]])</code>: <code>value</code></li>

@ -12,6 +12,8 @@ import (
"strings"
"syscall"
"unicode"
"git.rawtext.club/sloum/slope/termios"
)
func AnythingToBool(e expression) expression {
@ -259,6 +261,7 @@ func SafeExit(code int) {
if linerTerm != nil || initialTerm != nil {
line.Close()
}
termios.Restore()
os.Exit(code)
}

@ -75,7 +75,7 @@ var usageStrings = map[string]string{
"license": "(license) => ()",
"list": "(list [value...]) => list",
"list?": "(list? [value]) => bool",
"list-ref": "(list-ref [list] [index: number]) => value\n\nList indexing starts at 0",
"list-ref": "(list-ref [list] [index: number] [[set: value]]) => value|list\n\nList indexing starts at 0. When the optional `set` argument is provided the list will be returned with the value at the given index replaced by the `set` value that was given",
"list-seed": "(list-seed [length: number] [value]) => list\n\nUsing list seed to create lists filled with a certain element is more efficient than recursion for large lists and will not overflow the stack\n\n`length` should be a positive number larger than zero. If a floating point number is given, it will be floored",
"list-sort": "(list-sort [list] [[sub-list-index: number]]) => list\n\nIf `list` is a list of lists, sorting can be done by the index value of a sublist if desired. `list-sort` always sorts the list in ascending order, but can be reversed with `reverse`",
"list->string": "(list->string [list] [[join-on: string]]) => string",

Loading…
Cancel
Save