Back
inc (clj)
(source)function
(inc x)
Returns a number one greater than num. Does not auto-promote
longs, will throw on overflow. See also: inc'
Examples
clojure
(ns clojure.test-clojure.reducers
(:require [clojure.core.reducers :as r]
[clojure.test.generative :refer (defspec)]
[clojure.data.generators :as gen])
(:use clojure.test))
(defequivtest test-map
[map r/map #(into [] %)]
[inc dec #(Math/sqrt (Math/abs %))])
(defequivtest test-mapcat
[mapcat r/mapcat #(into [] %)]
[(fn [x] [x])
(fn [x] [x (inc x)])
(fn [x] [x (inc x) x])])
(deftest test-mapcat-obeys-reduced
(is (= [1 "0" 2 "1" 3]
(->> (concat (range 100) (lazy-seq (throw (Exception. "Too eager"))))
(r/mapcat (juxt inc str))
(r/take 5)
(into [])))))
nextjournal/clerk
(ns viewers.controls
"Demo of Clerk's two-way bindings."
{:nextjournal.clerk/visibility {:code :show :result :show}}
(:require [clojure.core :as core]
[nextjournal.clerk :as clerk]
[nextjournal.clerk.viewer :as viewer]))
;; But this should probably be fixed in a principled way.
hraberg/deuce
(ns deuce.emacs.chartab
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c]
[deuce.emacs.alloc :as alloc]
[deuce.emacs.data :as data]
[deuce.emacs.fns :as fns])
(:import [deuce.emacs.data CharTable]
[java.util Arrays])
(:refer-clojure :exclude []))
(defun set-char-table-default (char-table ch value)
"This function is obsolete since 23.1;
generic characters no longer exist.
hraberg/deuce
(ns deuce.emacs.print
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c]
[clojure.string :as s]
[deuce.emacs.buffer :as buffer]
[deuce.emacs.data :as data]
[deuce.emacs.editfns :as editfns]
[deuce.emacs.fns :as fns])
(:refer-clojure :exclude [print]))
(defun princ (object &optional printcharfun)
"Output the printed representation of OBJECT, any Lisp object.
No quoting characters are used; no delimiters are printed around
the contents of strings.
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/distinct (t/All [x] (t/IFn [:-> (t/Transducer x x)]
[(t/Seqable x) :-> (t/ASeq x)]))
#?@(:cljs [] :default [
clojure.java.shell/sh [t/Any :*
;would be nice (combine :* and kw args)
; t/Str :*
;& :optional {:in t/Any ;; any valid input to clojure.java.io/copy
; :inc-enc t/Str :out-env (t/U ':bytes t/Str)
; :env (t/U (Array t/Str) (t/Map t/Any t/Any))
; :dir (t/U t/Str java.io.File)}
:-> '{:exit t/Str
:out (t/U (Array byte) t/Str)
:err t/Str}]
clojure.java.browse/browse-url [t/Any :-> t/Any]
clojure.java.io/delete-file [clojure.java.io/Coercions (t/? t/Any) :-> t/Any]
clojure.java.io/make-parents [(t/+ clojure.java.io/Coercions) :-> t/Any]
clojure.java.io/file [(t/+ clojure.java.io/Coercions) :-> java.io.File]
clojure.java.io/as-relative-path [clojure.java.io/Coercions :-> t/Str]
;; TODO second arg is flattened IOFactoryOpts
clojure.java.io/reader [clojure.java.io/IOFactory :-> java.io.BufferedReader]
;; TODO second arg is flattened IOFactoryOpts
clojure.java.io/writer [clojure.java.io/IOFactory :-> java.io.BufferedWriter]
clojure.java.io/resource [t/Str (t/? ClassLoader) :-> (t/Nilable java.net.URL)]
clojure.stacktrace/e [:-> t/Any]
clojure.stacktrace/print-cause-trace [Throwable :-> t/Any]
clojure.stacktrace/print-stack-trace [Throwable :-> t/Any]
clojure.stacktrace/print-throwable [Throwable :-> t/Any]
clojure.stacktrace/root-cause [Throwable :-> Throwable]
;; FIXME keyword arguments
clojure.reflect/reflect [(t/+ t/Any) :-> (t/Map t/Any t/Any)]
clojure.inspector/atom? [t/Any :-> t/Bool]
clojure.inspector/collection-tag [t/Any :-> t/Keyword]
clojure.inspector/tree-model [t/Any :-> t/Any]
clojure.inspector/old-table-model [t/AnySeqable :-> t/Any]
clojure.inspector/inspect [t/Any :-> javax.swing.JFrame]
clojure.inspector/inspect-tree [t/Any :-> javax.swing.JFrame]
clojure.inspector/inspect-table [t/AnySeqable :-> javax.swing.JFrame]
])
#?(:cljs cc/*clojurescript-version* :default cc/*clojure-version*)
'{:major t/Any :minor t/Any :incremental t/Any :qualifier t/Any}
cc/= [(t/+ t/Any) :-> t/Bool]
cc/identical? [t/Any t/Any :-> t/Bool]
#?@(:cljs [
cc/keyword-identical? [t/Any t/Any :-> t/Bool]
])
cc/distinct? [(t/+ t/Any) :-> t/Bool]
cc/unchecked-inc (t/IFn [t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
cc/unchecked-inc-int [t/Num :-> t/AnyInteger]
cc/unchecked-dec (t/IFn [t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
cc/unchecked-dec-int [t/Num :-> t/AnyInteger]
cc/unchecked-subtract (t/IFn [t/AnyInteger t/AnyInteger :-> t/AnyInteger]
[t/Num t/Num :-> t/Num])
cc/unchecked-subtract-int [t/Num t/Num :-> t/AnyInteger]
cc/unchecked-negate (t/IFn [t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
cc/unchecked-negate-int [t/Num :-> t/AnyInteger]
cc/unchecked-add (t/IFn [t/AnyInteger t/AnyInteger :-> t/AnyInteger]
[t/Num t/Num :-> t/Num])
cc/unchecked-add-int [t/Num t/Num :-> t/AnyInteger]
cc/unchecked-multiply (t/IFn [t/AnyInteger t/AnyInteger :-> t/AnyInteger]
[t/Num t/Num :-> t/Num])
cc/unchecked-multiply-int [t/Num t/Num :-> t/AnyInteger]
cc/unchecked-divide-int [t/Num t/Num :-> t/AnyInteger]
cc/unchecked-remainder-int [t/Num t/Num :-> t/AnyInteger]
cc/rem (t/IFn [t/AnyInteger t/AnyInteger :-> t/AnyInteger]
[t/Num t/Num :-> t/Num])
cc/inc (t/IFn #?(:clj [Long :-> Long])
#?(:clj [Double :-> Double])
[t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
cc/dec (t/IFn #?(:clj [Long :-> Long])
#?(:clj [Double :-> Double])
[t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
#?@(:cljs [] :default [
cc/inc' (t/IFn [t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
cc/dec' (t/IFn [t/AnyInteger :-> t/AnyInteger]
[t/Num :-> t/Num])
cc/rationalize [t/Num :-> t/Num]
])
serioga/webapp-clojure-2020
(ns app.rum.component.hello-world
"Example react component, modification of
https://github.com/tonsky/rum/blob/gh-pages/examples/rum/examples/local_state.cljc"
(:require [app.rum.impl.component :as impl]
[lib.clojure.core :as c]
[rum.core :as rum]))
(rum/defcs hello-world
"Example react component."
< (rum/local 0)
[state greeting]
(let [count! (:rum/local state)]
[:div
{:style {"-webkit-user-select" "none"
"cursor" "pointer"}
:on-click (fn [_] (swap! count! inc))}
(str "Hello, " greeting ": " @count! " clicks.")]))