Public Vars

Back

ifn? (clj)

(source)

function

(ifn? x)
Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn

Examples

clojure/core.typed
(ns clojure.core.typed.test.cljs-core
    (:require [cljs.core.typed :as t]
              [cljs.core :as core]
              [clojure.core.typed.test.cljs-utils :refer [is-tc-e tc-e]]
              [clojure.test :refer :all]))

(add-test1 ifn?
    (fn [x] x) t/JSBoolean
    "foo"      t/JSBoolean)
uncomplicate/fluokitten
(ns uncomplicate.fluokitten.core-test
  (:use [uncomplicate.fluokitten algo jvm core test utils])
  (:use [midje.sweet :exclude [just]])
  (:require [clojure.string :as s]
            [clojure.core.reducers :as r]))

(fact "Fmap keeps type."
      (ifn? (fmap inc (curry dec))))

(fact "Fmap keeps type - varargs."
      (ifn? (fmap inc (curry dec) (curry +))))
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/ifn? (t/Pred #?(:clj clojure.lang.IFn
                   :cljs cljs.core/IFn))
cc/fn? (t/Pred t/Fn)
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 ::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?)
rbuchmann/samak
(ns samak.oasis-test
  (:require [samak.oasis                  :as sut]
            [samak.caravan                :as caravan]
            [samak.repl                   :as repl]
            [samak.nodes                  :as nodes]
            [samak.stdlib                 :as pipes]
            [samak.code-db                :as db]
            [samak.runtime.stores         :as stores]
            [samak.runtime                :as runtime]
            [samak.core                   :as c]
            [samak.utils                  :as utils]
            [samak.trace                  :as trace]
            #?@(:clj [[clojure.test       :as t :refer [is deftest]]
                      [clojure.spec.alpha :as s]
                      [clojure.core.async :as a :refer [<! chan go go-loop]]]
                :cljs [[cljs.test         :as t :refer [is deftest] :include-macros true]
                       [cljs.spec.alpha   :as s] :include-macros true
                       [clojure.core.async :as a :refer [<! chan go go-loop]]])))

#_(deftest should-define
  (let [code (repl/eval-multi-exp repl/base-symbols [sut/get-val])
        func (get code 'get-val)]
    (is (< (count repl/base-symbols) (count code)))
    (is (= true (ifn? func)))
    (is (= :bar (apply func [{:samak.nodes/rhs {:samak.nodes/value :bar}}])))))