Lists package

This commit is contained in:
2025-09-18 19:57:24 +10:00
parent b625bc6244
commit 5f65c1b42b
2 changed files with 14 additions and 8 deletions

View File

@@ -3,9 +3,10 @@ fun -string !ltos -list &inlist
getlistsize *inlist &listlen
set &idx 0
set &ans ""
add $ans '[' &ans
add $ans "[" &ans
@stdoutloop
getlistat *inlist $idx &store
tostring $store &store
add $ans $store &ans
add $idx 1 &idx
equal $idx $listlen &store
@@ -16,9 +17,4 @@ fun -string !ltos -list &inlist
@trueend
add $ans "]" &ans
return $ans
endfun
setlist *store 4 2 "Hello"
pusharg *store
call !ltos &store
stdlnout $store
endfun

View File

@@ -1 +1,11 @@
### Due to the current limitations of ground, this package is not ready for use.
# Lists library
This library adds extra list manipulation functions to ground. It is entirely coded in ground.
Please note that you cannot copy a single function from the package, as some functions rely on other functions in the library (reliance on other functions is detailed below).
## Functions
### fun -string !ltos -list &inlist
Converts a list to a string, in the format [$item1, $item2, $item3, ...] (no prerequisites).