Back
completing (clj)
(source)function
(completing f)
(completing f cf)
Takes a reducing function f of 2 args and returns a fn suitable for
transduce by adding an arity-1 signature that calls cf (default -
identity) on the result argument.
Examples
hraberg/deuce
(ns deuce.emacs.coding
(:use [deuce.emacs-lisp :only (defun defvar) :as el])
(:require [clojure.core :as c]
[deuce.emacs.alloc :as alloc]
[deuce.emacs.charset :as charset]
[deuce.emacs.fns :as fns]
[deuce.emacs-lisp.globals :as globals])
(:refer-clojure :exclude []))
(defvar coding-system-alist nil
"Alist of coding system names.
Each element is one element list of coding system name.
This variable is given to `completing-read' as COLLECTION argument.
(defun read-coding-system (prompt &optional default-coding-system)
"Read a coding system from the minibuffer, prompting with string PROMPT.
If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
Ignores case when completing coding systems (all Emacs coding systems
are lower-case)."
)
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/reduce (t/All [a c] (t/IFn
;Without accumulator
; default
; (reduce + my-coll)
[[a a :-> (t/U (t/Reduced a) a)] (t/NonEmptySeqable a) :-> a]
[(t/IFn [a a :-> (t/U (t/Reduced a) a)] [:-> a]) (t/Seqable a) :-> a]
; default
; (reduce + 3 my-coll)
; (reduce (fn [a b] a) (reduced 1) nil)
; ;=> (reduced 1)
[[a c :-> (t/U (t/Reduced a) a)] a (t/Seqable c) :-> a]))
cc/transduce (t/All [a b c] (t/IFn [(t/Transducer a a) (t/Reducer a a) (t/Seqable a) :-> a]
[(t/Transducer b c) (t/IFn [c :-> c] [c a :-> (t/U c (t/Reduced c))]) a (t/Seqable b) :-> a]))
cc/reduce-kv (t/All [a k v] [[a k v :-> (t/U (t/Reduced a) a)] a (t/Option (t/Associative k v)) :-> a])
cc/reductions (t/All [a b] (t/IFn [[a a :-> (t/U (t/Reduced a) a)] (t/NonEmptySeqable a) :-> (t/NonEmptyASeq a)]
[(t/IFn [:-> a] [a a :-> (t/U (t/Reduced a) a)]) (t/Seqable a) :-> (t/NonEmptyASeq a)]
[[a b :-> (t/U (t/Reduced a) a)] a (t/Seqable b) :-> (t/NonEmptyASeq a)]))
cc/reduced (t/All [x] [x :-> (t/Reduced x)])
cc/unreduced (t/All [x] (t/IFn [(t/Reduced x) :-> x]
[(t/U x (t/Reduced x)) :-> x]))
cc/ensure-reduced (t/All [x] [(t/U x (t/Reduced x)) :-> (t/Reduced x)])
cc/completing (t/All [a b] [(t/IFn [:-> b] [b a :-> (t/U b (t/Reduced b))])
[b :-> b]
:-> (t/Reducer a b)])
logicblocks/salutem
(ns salutem.core.maintenance-test
(:require
[clojure.test :refer :all]
[clojure.core.async :as async]
(deftest evaluator-logs-event-on-completing-check
(let [test-logger (cartus-test/logger)
dependencies {:logger test-logger}
context {:some "context"}
(is (logged? test-logger
{:context {:trigger-id trigger-id
:check-name :thing
:result result}
:level :info
:type ::maintenance/evaluator.completing}))
mauricioszabo/repl-tooling
(ns repl-tooling.features.autocomplete-test
(:require [reagent.core :as r]
[clojure.test :refer [async testing is]]
[clojure.core.async :as async]
[matcher-combinators.matchers :refer [embeds]]
[check.core :refer [check]]
[check.async-old :refer [await!]]
[devcards.core :as cards :include-macros true]
[repl-tooling.features.autocomplete.simple :as simple]
[repl-tooling.features.autocomplete.compliment :as compliment]
[repl-tooling.features.autocomplete.suitable :as suit]
[repl-tooling.eval-helpers :as h]))
(set! cards/test-timeout 20000)
(cards/deftest clojure-simple-autocomplete
(h/async-with-repl "Clojure simple autocomplete"
(testing "completing core functions"
(let [res (simple/for-clj repl 'user "prn")]
(check (await! res) => [{:candidate "prn" :type :function}
{:candidate "prn-str" :type :function}])))
(testing "completing macros and private fns in current NS"
(let [res (simple/for-clj repl 'repl-tooling.integration.ui-macros "type-and")]
(check (await! res) => [{:candidate "type-and-assert-result" :type :function}
{:candidate "type-and-just-for-test" :type :function}
{:candidate "type-and-result" :type :function}])))
(testing "completing imported vars"
(let [res (simple/for-clj repl 'repl-tooling.integration.ui-macros "str/repl")]
(check (await! res) => [{:candidate "str/replace" :type :function}
{:candidate "str/replace-first" :type :function}])))))
(cards/deftest clojurescript-simple-autocomplete
(h/async-with-cljs-repl "ClojureScript with simple complete"
(testing "completing core functions"
(let [res (simple/for-cljs repl 'repl-tooling.integration.fixture-app "prn")]
(check (await! res) => [{:candidate "prn" :type :function}
{:candidate "prn-str" :type :function}
{:candidate "prn-str-with-opts" :type :function}])))
(testing "completing functions in current NS"
(let [res (simple/for-cljs repl 'repl-tooling.integration.fixture-app "priva")]
(check (await! res) => [{:candidate "private-fn" :type :function}
{:candidate "private-var" :type :function}]))
(let [res (simple/for-cljs repl 'repl-tooling.integration.fixture-app "loc")]
(check (await! res) => [{:candidate "local-fn" :type :function}
{:candidate "local-var" :type :function}])))
(testing "completing imported vars"
(let [res (simple/for-cljs repl 'repl-tooling.integration.fixture-app "st/repl")]
(check (await! res) => [{:candidate "st/replace" :type :function}
{:candidate "st/replace-all" :type :function}
{:candidate "st/replace-first" :type :function}
{:candidate "st/replace-with" :type :function}])))))