Public Vars

Back

fn? (clj)

(source)

function

(fn? x)
Returns true if x implements Fn, i.e. is an object created via fn.

Examples

clojure/core.typed
(ns ^:skip-wiki clojure.core.typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  (:require [#?(:clj clojure.core.typed
                :cljs cljs.core.typed)
             :refer [defalias] :as t]))

(defalias
  ^{:doc "A type that returns true for clojure.core/fn?"
    :forms '[Fn]}
  t/Fn
  clojure.lang.Fn)
hraberg/deuce
(ns deuce.emacs.eval
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.alloc :as alloc]
            [deuce.emacs.data :as data]
            [deuce.emacs-lisp.cons :as cons]
            [deuce.emacs-lisp :as el])
  (:import [clojure.lang Var])
  (:refer-clojure :exclude [apply eval macroexpand]))

(defun functionp (object)
  "Non-nil if OBJECT is a function."
  (when (or (fn? object)
            (and (symbol? object) (el/fun object))
            (and (seq? object) (= 'lambda (first object))))
    true))

  Do not use `make-local-variable' to make a hook variable buffer-local.
  Instead, use `add-hook' and specify t for the LOCAL argument."
  (when-let [hook (el/global hook)]
    (let [hook @hook]
      (doall (map #(c/apply funcall % args) (if (fn? hook) [hook] hook))))))
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))))

(t/defalias
  ^{:doc "A type that returns true for clojure.core/fn?"
    :forms '[Fn]}
  t/Fn
  #?(:clj clojure.lang.Fn
     :cljs (t/U cljs.core/Fn
                ;;TODO 
                #_js/Function)))

cc/ifn? (t/Pred #?(:clj clojure.lang.IFn
                   :cljs cljs.core/IFn))
cc/fn? (t/Pred t/Fn)
walmartlabs/lacinia-pedestal
(ns com.walmartlabs.lacinia.pedestal.spec
  "Common specifications."
  {:added "0.10.0"}
  (:require
    com.walmartlabs.lacinia.schema                          ; for CompiledSchema
    [clojure.core.async.impl.protocols :refer [Buffer]]
    io.pedestal.interceptor                                 ; for Interceptor
    [clojure.spec.alpha :as s])
  (:import
    (com.walmartlabs.lacinia.schema CompiledSchema)
    (io.pedestal.interceptor Interceptor)))

(s/def ::compiled-schema (s/or :direct #(instance? CompiledSchema %)
                               :indirect fn?))

(s/def ::interceptor (s/or :handler fn?
                           :interceptor (s/and (s/nonconforming (s/or :interceptor #(instance? Interceptor %)
                                                                      :map map?))
                                               #(-> % :name keyword?))))
bsless/more.async
(ns more.async.dataflow.node
  (:require
   [clojure.spec.alpha :as s]
   [clojure.core.async :as a]
   [more.async :as ma]
   [clojure.data]))

(s/def ::to ::name)
(s/def ::to* (s/* ::to))
(s/def ::to-map (s/map-of any? ::to))
(s/def ::from ::name)
(s/def ::size nat-int?)
(s/def ::xf fn?)
(s/def ::rf fn?)
(s/def ::fn fn?)
(s/def ::init-fn fn?)
(s/def ::async? boolean?)
(s/def ::timeout pos-int?)

(s/def ::finally-fn fn?)

(s/def ::pubsub (s/keys :req [::pub ::topic-fn] :opt [::sub]))
(s/def ::pub ::name)
(s/def ::sub (s/* (s/keys :req [::topic ::name])))
(s/def ::topic any?)
(s/def ::topic-fn ifn?)