Public Vars

Back

*1 (clj)

(source)

variable

bound in a repl thread to the most recent value printed

Examples

cognitect-labs/aws-api
(ns s3-examples
  (:require [clojure.core.async :as a]
            [clojure.spec.alpha :as s]
            [clojure.spec.gen.alpha :as gen]
            [clojure.java.io :as io]
            [clojure.repl :as repl]
            [cognitect.aws.client.api :as aws]))

  ;; http-request and http-response are in metadata
  (meta *1)

  ;; check it!
  (slurp (:Body *1))

  (meta *1)
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))))

cc/*1 t/Any
cc/*2 t/Any
cc/*3 t/Any
cc/*e #?(:cljs t/Any :default (t/U nil Throwable))
#?@(:cljs [] :default [
cc/*agent* (t/U nil (t/Deref t/Any) #_(t/Agent t/Any))
cc/*allow-unresolved-vars* t/Any
cc/*data-readers* (t/Map t/Sym t/AnyVar)
cc/*default-data-reader-fn* (t/U nil [t/Any t/Any :-> t/Any])
cc/*fn-loader* t/Any
cc/*math-context* t/Any
cc/*source-path* t/Str
cc/*use-context-classloader* t/Any
])
cc/*assert* t/Any
hyperfiddle/rcf
(ns hyperfiddle.rcf.example-test
  (:require [clojure.core.async :refer [chan >! go go-loop <! timeout close!]]
            [hyperfiddle.rcf :as rcf :refer [tests tap % with]]
            [missionary.core :as m]))

(tests
 "REPL bindings work"
 (inc 1) := 2
 (dec *1) := 1
 
 (tests 1 2 3 *3 := 1, *2 := 2, *1 := 3))
Netflix/mantis-mql
;
; Copyright 2022 Netflix, Inc.
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
(ns io.mantisrx.mql.test-query
  "The objective of this namespace is to verify correct functionality with
   non-aggregate queries."
  (:require [clojure.test :refer :all]
            [io.mantisrx.mql.jvm.core :refer :all]
            [instaparse.core :as insta]
            [rx.lang.clojure.core :as rx]
            [rx.lang.clojure.blocking :as rxb]
            )
  (:import rx.Observable java.util.concurrent.TimeUnit))

      (testing "`select * from stream where a ==~ /.*123.*/` filters out non-matching data.
                Note that this query is expected to be transformed by the optimizer."
        (let
          [q "select * from stream where a ==~ /.*123.*/"
           context {"stream" (Observable/just {"a" "ab123ab"} {"b" 2} {"a" "abba"})}
           result (rxb/into [] (eval-mql q context))]
          (is (= [{"a" "ab123ab"}] result))))
      (testing "`select * from stream where a ==~ /.*(abc|def).*/` filters out non-matching data.
                Note that this query is expected to be transformed by the optimizer."
        (let
          [q "select * from stream where a ==~ /.*(abc|def).*/"
           context {"stream" (Observable/just {"a" "abc123ab"} {"b" 2} {"a" "abba"})}
           result (rxb/into [] (eval-mql q context))]
          (is (= [{"a" "abc123ab"}] result))))
      (testing "`select * from stream where a ==~ /abc|def|ghi/` filters out non-matching data.
                Note that this query is expected to be transformed by the optimizer."
        (let
          [q "select * from stream where a ==~ /abc|def|ghi/"
           context {"stream" (Observable/just {"a" "ghi"} {"b" 2} {"a" "abba"} {"a" "xyz"} {"a" "abc"})}
           result (rxb/into [] (eval-mql q context))]
          (is (= [{"a" "ghi"} {"a" "abc"}] result))))
      (testing "`select * from stream where a ==~ /.*prop\\\"\\:\\\"123.*/` matches nested json.
                Note that this query is expected to be transformed by the optimizer."
        (let
          [q "select * from stream where a ==~ /.*prop\\\"\\:\\\"123.*/"
           context {"stream" (Observable/just {"a" "{\"prop\":\"123\"}"} {"b" 2} {"a" "abba"})}
           result (rxb/into [] (eval-mql q context))]
          (is (= [{"a" "{\"prop\":\"123\"}"}] result))))
      (testing "`select * from stream where a ==~ /^\\(focus\\)/` matches nested json.
                Note that this query is expected to be transformed by the optimizer."
        (let
          [q "select * from stream where a ==~ /^\\(focus\\).*/"
           context {"stream" (Observable/just {"a" "(focus)test"} {"b" 2} {"a" "abba"})}
           result (rxb/into [] (eval-mql q context))]
          (is (= [{"a" "(focus)test"}] result))))
      ))