JanetDocsPlaygroundI'm feeling luckyGitHub sign in

index-of



    function
    boot.janet on line 1069, column 1

    (index-of x ind &opt dflt)

    Find the first key associated with a value x in a data structure, 
    acting like a reverse lookup. Will not look at table prototypes. 
    Returns `dflt` if not found.


1 exampleSign in to add an example
Loading...
# in struct 
(index-of 2 {:a 1 :b 2 :c 3 :d 2} )
# => :b

# in table 
(index-of 2 @{:a 1 :b 2 :c 3 :d 2})
# => :b

# in array 
(index-of 6 @[4 5 6 7 8 9] )
# => 2

# in tuple 
(index-of 2 [1 2 3 4])
# => 1
leobmPlayground