From aa0485fe33204169724d020f9c5e3b91e558ab1e Mon Sep 17 00:00:00 2001 From: ubq323 Date: Tue, 23 Jul 2024 17:00:56 +0100 Subject: add pend builtin function --- ideas | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ideas (limited to 'ideas') diff --git a/ideas b/ideas new file mode 100644 index 0000000..9717cb6 --- /dev/null +++ b/ideas @@ -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) + + + + -- cgit v1.2.3