diff options
author | ubq323 <ubq323@ubq323.website> | 2024-07-23 17:00:56 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-07-23 17:00:56 +0100 |
commit | aa0485fe33204169724d020f9c5e3b91e558ab1e (patch) | |
tree | 909ea369aa38854fe98396c61ecab6c600533f7a /ideas | |
parent | 726f9e814b29b4496d07c92323dc55dcf93c2a87 (diff) |
add pend builtin function
Diffstat (limited to 'ideas')
-rw-r--r-- | ideas | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +(, a b) +pend. +concatenates arrays, but enlists anything that isnt already an array +thus + (, x xs) (, xs x) is like append or prepend + (, x y) is pair + (, x) is enlist + (, xs ys) is extend +if you really want an array to be inside another array + you can do (, xs (, ys)) or equivalently (, xs [ys]) + this is probably the rarer case so that's good +this always returns (allocates) a new object. that's probably fine +most of the time +if you want it to modify inplace have a (,! ...) form +but need to specify which one to modify ... + (,! x xs) (,! xs x) are unambiguous + but should (,! xs ys) copy ys to xs or vice versa? + maybe something like (,!< xs ys) (,!> xs ys) respectively + or maybe more generally (,! xs (! ys)) but that's uglier + (,! xs !ys) ??? +this also does string concatenation. +have a variant (,, ...) maybe that puts spaces in between +have a variant that uniions hashes + does (, {'x 10} {'y 20}) do {'x 10 'y 20} or [{'x 10} {'y 20}] ? + probably see which is commoner + + + +separate strings from symbols +symbols are atomic and interned +strings are just arrays of characters (codepoints) + + + + |