1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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)
|