on master help sign in
add into and snap (#730)
6d6746bEric Fode
reference/library/2b.md+72−1
@@ -931,6 +931,77 @@ Produces a list of `b` appended to `a`.
931 ~[1 2 3 4]
931 ~[1 2 3 4]
932```
932```
933
933
934+---
935+### `++snap`
936+
937+Replace item at index
938+
939+Accepts a `list` `a`, an atom `b`, and a noun `c`, producing the list of `a` with the item at index `b` replaced with `c`.
940+
941+#### Accepts
942+
943+`a` is a list.
944+
945+`b` is a atom.
946+
947+`c` is a noun.
948+
949+
950+#### Produces
951+
952+the list of `a` with the item at index `b` replaced with `c`.
953+
954+#### Source
955+
956+```hoon
957+ ++ snap
958+ |* [a/(list) b/@ c/*]
959+ ^+ a
960+ (weld (scag b a) [c (slag +(b) a)])
961+```
962+
963+#### Examples
964+
965+```
966+ > (snap (limo ~[2 3 4]) 1 11)
967+ ~[2 11 4]
968+```
969+
970+---
971+### `++into`
972+
973+Insert item at index
974+
975+Accepts a `list` `a`, an atom `b`, and a noun `c`, producing the list of `a` with the item `c` inserted at index `b`.
976+
977+#### Accepts
978+
979+`a` is a list.
980+
981+`b` is a atom.
982+
983+`c` is a noun.
984+
985+
986+#### Produces
987+
988+the list of `a` with the item `c` inserted at index `b`.
989+
990+#### Source
991+
992+```hoon
993+ ++ into
994+ |* [a/(list) b/@ c/*]
995+ ^+ a
996+ (weld (scag b a) [c (slag b a)])
997+```
998+
999+#### Examples
1000+
1001+```
1002+ > (into (limo ~[2 3 4]) 1 11)
1003+ ~[2 11 3 4]
1004+```
934
1005
935---
1006---
936### `++sort`
1007### `++sort`
@@ -1290,4 +1361,4 @@ A list.
1290 ~[1 97 2 98 3 99 4 100]
1361 ~[1 97 2 98 3 99 4 100]
1291```
1362```
1292
1363
1293−---
1364+---