Skip to content

PrependTo

Name - Description Default Type
<input> The value to prepend to the collection. Any
<output> The input to this shard is passed through as its output. Any
Collection The collection to add the input to. None &[ Any ]&String&Bytes

Prepends the input to the context variable passed to :Collection.

Details

PrependTo prepends (i.e., adds to the start) its input to the variable it receives in its :Collection parameter.

This shard works on string and sequence variables.

The input to this shard is also passed through as its output.

Examples

1
2
3
4
5
6
7
8
9
;; prepend element to sequence
[1 2 3] >= .seq
0 (PrependTo .seq)   ;; prepends element to sequence
.seq (Log)           ;; updated sequence => [0, 1, 2, 3]

;; prepend character to string
"pen" >= .str
"O" (PrependTo .str) ;; prepends character to string
.str (Log)           ;; updated string => Open
[info] [shards/General/PrependTo/PrependTo.edn] [0, 1, 2, 3]
[info] [shards/General/PrependTo/PrependTo.edn] Open