Loading...
# access tuple values
(def t [:a :b :c]) # test tuple
(first t)
# => :a
(last t)
# => :c
(slice t 0 2)
# => (:a :b)
# Index as function
(0 t)
# => :a
# Tuple as function
(t 0)
# => :a
# With destructuring
(let [[_ b _] t]
b)
# => :b
# With pattern matching
(match t
[:a _ :d] (print "does not match")
[:a b :c] (print b)
_ (print "anything"))
# => :b
leobmPlayground[1 2 3] # => (1 2 3)
(tuple 1 2 3) # => (1 2 3)
(tuple (splice [1 2 3]) # => (1 2 3)
(tuple ;[1 2 3]) # => (1 2 3)
cellularmitosisPlayground(tuple 1 2.3 :a "foo" true nil [] {} (fn []))
# => (1 2.3 :a "foo" true nil () {} <function 0x7FB2A3D030B0>)
cellularmitosisPlayground