Back
reverse (clj)
(source)function
(reverse coll)
Returns a seq of the items in coll in reverse order. Not lazy.
Examples
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
"Type annotations for the base Clojure distribution."
#?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
(:require [clojure.core :as cc]
[typed.clojure :as t]
#?(:clj [typed.ann-macros.clojure :as macros])
#?(:clj typed.ann.clojure.jvm) ;; jvm annotations
#?(:clj clojure.core.typed))
#?(:clj
(:import (clojure.lang PersistentHashSet PersistentList
APersistentMap #_IPersistentCollection
#_ITransientSet
IRef)
(java.util Comparator Collection))))
clojure.string/blank? [(t/U nil t/Str) :-> t/Bool]
clojure.string/capitalize [t/Str :-> t/Str]
clojure.string/lower-case [t/Str :-> t/Str]
clojure.string/replace [(t/alt (t/cat t/Str t/Str t/Str)
(t/cat t/Str Character Character)
(t/cat t/Str t/Regex (t/U t/Str [t/Str :-> t/Str]))) :-> t/Str]
clojure.string/replace-first [(t/alt (t/cat t/Str t/Str t/Str)
(t/cat t/Str Character Character)
(t/cat t/Str t/Regex (t/U t/Str [t/Str :-> t/Str]))) :-> t/Str]
clojure.string/reverse [t/Str :-> t/Str]
clojure.string/trim [t/Str :-> t/Str]
clojure.string/trimr [t/Str :-> t/Str]
clojure.string/triml [t/Str :-> t/Str]
cc/instance? [#?(:clj Class :cljs js/Object) t/Any :-> t/Bool]
cc/cons (t/All [x] [x (t/Seqable x) :-> (t/ASeq x)])
cc/reverse (t/All [x] [(t/Seqable x) :-> (t/ASeq x)])
cc/rseq (t/All [x] [(t/Reversible x) :-> (t/NilableNonEmptyASeq x)])
cc/subseq (t/All [x e] [(t/I (t/Seqable e) (t/Sorted x)) [t/Int t/Int :-> t/Bool] t/Int (t/cat [t/Int t/Int :-> t/Bool] t/Int) :? :-> (t/Nilable (t/ASeq e))])
cc/rsubseq (t/All [x e] [(t/I (t/Seqable e) (t/Sorted x)) [t/Int t/Int :-> t/Bool] t/Int (t/cat [t/Int t/Int :-> t/Bool] t/Int) :? :-> (t/Nilable (t/ASeq e))])
fluree/db
(ns json-ld.query
(:require [clojure.core.async :as async]
[fluree.db.flake :as flake]
[fluree.db.json-ld.api :as fluree]
[fluree.db.util.async :refer [<?? go-try channel?]]
[fluree.db.query.range :as query-range]
[fluree.db.constants :as const]
[fluree.db.dbproto :as dbproto]
[fluree.db.did :as did]
[fluree.json-ld :as json-ld]
[fluree.db.indexer.default :as indexer]
[fluree.db.indexer.proto :as idx-proto]
[fluree.db.util.log :as log]
[fluree.db.index :as index]
[criterium.core :as criterium]
[fluree.db.query.analytical-parse :as q-parse]))
@(fluree/query db {:context {:friended {:reverse :ex/friend}}
:select [:schema/name :friended]
:from :ex/brian})
@(fluree/query db {:context {:friended {:reverse :ex/friend}}
:select [:schema/name {:friended [:*]}]
:from :ex/brian})
@(fluree/query db {:context {:friended {"@reverse" :ex/friend}}
:select ['?friend]
:where [['?s :schema/name "Cam"]
['?s :ex/friend '?friend]]})
fluree/db
(ns json-ld
(:require [fluree.db.method.ipfs.core :as ipfs]
[fluree.db.db.json-ld :as jld-db]
[fluree.db.json-ld.transact :as jld-tx]
[clojure.core.async :as async]
[fluree.db.flake :as flake]
[fluree.db.json-ld.api :as fluree]
[fluree.db.util.async :refer [<?? go-try channel?]]
[fluree.db.query.range :as query-range]
[fluree.db.constants :as const]
[fluree.db.dbproto :as dbproto]
[fluree.db.did :as did]
[fluree.db.conn.proto :as conn-proto]
[fluree.db.util.json :as json]
[fluree.json-ld :as json-ld]
[fluree.db.indexer.default :as indexer]
[fluree.db.indexer.proto :as idx-proto]
[fluree.db.util.log :as log]))
;; query for Book with reverse reference
@(fluree/query db2 {:context {:derivedFrom {"@reverse" "http://schema.org/isBasedOn"}}
:select [:* {:derivedFrom [:*]}]
:from :wiki/Q3107329})
fluree/db
(ns json-ld
(:require [fluree.db.method.ipfs.core :as ipfs]
[fluree.db.db.json-ld :as jld-db]
[fluree.db.json-ld.transact :as jld-tx]
[clojure.core.async :as async]
[fluree.db.flake :as flake]
[fluree.db.json-ld.api :as fluree]
[fluree.db.util.async :refer [<?? go-try channel?]]
[fluree.db.query.range :as query-range]
[fluree.db.constants :as const]
[fluree.db.dbproto :as dbproto]
[fluree.db.did :as did]
[fluree.db.conn.proto :as conn-proto]
[fluree.db.util.json :as json]
[fluree.json-ld :as json-ld]
[fluree.db.util.log :as log]))
;; query for Book with reverse reference
@(fluree/query db2 {:context {:derivedFrom {"@reverse" "http://schema.org/isBasedOn"}}
:select [:* {:derivedFrom [:*]}]
:from :wiki/Q3107329})
bsless/clj-fast
(ns clj-fast.clojure.core-test
(:require [clj-fast.clojure.core :as sut]
[clojure.test :as t]))
(t/deftest test-subseq
(let [s1 (range 100)
s2 (into (sorted-set) s1)]
(doseq [i (range 100)]
(t/is (= s1 (concat (sut/subseq s2 < i) (sut/subseq s2 >= i))))
(t/is (= (reverse s1) (concat (sut/rsubseq s2 >= i) (sut/rsubseq s2 < i)))))))