clojure-cheatsheets icon indicating copy to clipboard operation
clojure-cheatsheets copied to clipboard

unchecket-int and friends

Open cloojure opened this issue 8 years ago • 2 comments

Hi. I just noticed that the function unchecked-int and friends are not in the Cheatsheet. Should they be added? Alan

cloojure avatar Jul 26 '17 20:07 cloojure

They certainly could be, but not clear if they are worth the 'shelf space' they would take up. There are 6 such functions in the Cheatsheet, concentrated on the ones involving operations on longs. There are 15 more not included in the Cheatsheet, listed below:

unchecked-add-int
unchecked-byte
unchecked-char
unchecked-dec-int
unchecked-divide-int
unchecked-double
unchecked-float
unchecked-inc-int
unchecked-int
unchecked-long
unchecked-multiply-int
unchecked-negate-int
unchecked-remainder-int
unchecked-short
unchecked-subtract-int

As a point of comparison, there are a total of 173 vars in Clojure 1.8.0 that are not included in the Cheatsheet today. The full list is below, in case you are curious:

*allow-unresolved-vars*
*assert*
*compiler-options*
*flush-on-newline*
*fn-loader*
*math-context*
*read-eval*
*source-path*
*suppress-read*
*use-context-classloader*
*verbose-defrecords*
->ArrayChunk
->Eduction
->Vec
->VecNode
->VecSeq
-cache-protocol-fn
-reset-methods
EMPTY-NODE
Throwable->map
accessor
add-classpath
agent-errors
await1
chunk
chunk-append
chunk-buffer
chunk-cons
chunk-first
chunk-next
chunk-rest
chunked-seq?
clear-agent-errors
clojure.core.reducers/->Cat
clojure.core.reducers/CollFold
clojure.core.reducers/append!
clojure.core.reducers/cat
clojure.core.reducers/coll-fold
clojure.core.reducers/drop
clojure.core.reducers/filter
clojure.core.reducers/fjtask
clojure.core.reducers/flatten
clojure.core.reducers/fold
clojure.core.reducers/foldcat
clojure.core.reducers/folder
clojure.core.reducers/map
clojure.core.reducers/mapcat
clojure.core.reducers/monoid
clojure.core.reducers/pool
clojure.core.reducers/reduce
clojure.core.reducers/reducer
clojure.core.reducers/remove
clojure.core.reducers/take
clojure.core.reducers/take-while
clojure.data/Diff
clojure.data/EqualityPartition
clojure.data/diff-similar
clojure.data/equality-partition
clojure.java.browse/*open-url-script*
clojure.java.io/Coercions
clojure.java.io/IOFactory
clojure.java.io/default-streams-impl
clojure.java.io/make-input-stream
clojure.java.io/make-output-stream
clojure.java.io/make-parents
clojure.java.io/make-reader
clojure.java.io/make-writer
clojure.java.javadoc/*core-java-api*
clojure.java.javadoc/*feeling-lucky*
clojure.java.javadoc/*feeling-lucky-url*
clojure.java.javadoc/*local-javadocs*
clojure.java.javadoc/*remote-javadocs*
clojure.java.javadoc/add-local-javadoc
clojure.java.javadoc/add-remote-javadoc
clojure.java.shell/*sh-dir*
clojure.java.shell/*sh-env*
clojure.pprint/*print-base*
clojure.pprint/*print-miser-width*
clojure.pprint/*print-pprint-dispatch*
clojure.pprint/*print-pretty*
clojure.pprint/*print-radix*
clojure.pprint/*print-right-margin*
clojure.pprint/*print-suppress-namespaces*
clojure.pprint/code-dispatch
clojure.pprint/formatter
clojure.pprint/formatter-out
clojure.pprint/fresh-line
clojure.pprint/get-pretty-writer
clojure.pprint/pp
clojure.pprint/pprint-indent
clojure.pprint/pprint-logical-block
clojure.pprint/pprint-newline
clojure.pprint/pprint-tab
clojure.pprint/print-length-loop
clojure.pprint/set-pprint-dispatch
clojure.pprint/simple-dispatch
clojure.pprint/with-pprint-dispatch
clojure.pprint/write
clojure.pprint/write-out
clojure.repl/demunge
clojure.repl/dir-fn
clojure.repl/root-cause
clojure.repl/set-break-handler!
clojure.repl/source-fn
clojure.repl/stack-element-str
clojure.repl/thread-stopper
clojure.walk/keywordize-keys
clojure.walk/stringify-keys
clojure.xml/*current*
clojure.xml/*sb*
clojure.xml/*stack*
clojure.xml/*state*
clojure.xml/attrs
clojure.xml/content
clojure.xml/content-handler
clojure.xml/element
clojure.xml/emit
clojure.xml/emit-element
clojure.xml/startparse-sax
clojure.xml/tag
create-struct
defstruct
delay?
denominator
destructure
find-protocol-impl
find-protocol-method
hash-combine
hash-ordered-coll
hash-unordered-coll
method-sig
mix-collection-hash
munge
namespace-munge
numerator
primitives-classnames
print-ctor
print-dup
print-method
print-simple
proxy-call-with-super
proxy-name
read
read-string
reader-conditional
reader-conditional?
refer-clojure
replicate
special-symbol?
struct
struct-map
tagged-literal
tagged-literal?
unchecked-add-int
unchecked-byte
unchecked-char
unchecked-dec-int
unchecked-divide-int
unchecked-double
unchecked-float
unchecked-inc-int
unchecked-int
unchecked-long
unchecked-multiply-int
unchecked-negate-int
unchecked-remainder-int
unchecked-short
unchecked-subtract-int
unquote
unquote-splicing
with-bindings
with-bindings*
with-loading-context

jafingerhut avatar Jul 26 '17 20:07 jafingerhut

Just ran into this question again on StackOverflow: https://stackoverflow.com/questions/49862614/how-to-cast-an-int-larger-than-127-to-to-a-byte-in-clojure

It's only been 9 months and I'd already forgotten about unchecked-byte completely. I wonder if an "appendix" or "Less Common Functions" page as an addendum to the base CheatSheet. Perusing the CheatSheet is how I refresh my memory about what functions exist (I find Clojure.org too painful to use unless I'm desperate).

Alan

On Wed, Jul 26, 2017 at 1:38 PM, Andy Fingerhut [email protected] wrote:

They certainly could be, but not clear if they are worth the 'shelf space' they would take up. There are 6 such functions in the Cheatsheet, concentrated on the ones involving operations on longs. There are 15 more not included in the Cheatsheet, listed below:

unchecked-add-int unchecked-byte unchecked-char unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc-int unchecked-int unchecked-long unchecked-multiply-int unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract-int

As a point of comparison, there are a total of 173 vars in Clojure 1.8.0 that are not included in the Cheatsheet today. The full list is below, in case you are curious:

allow-unresolved-vars assert compiler-options flush-on-newline fn-loader math-context read-eval source-path suppress-read use-context-classloader verbose-defrecords ->ArrayChunk ->Eduction ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods EMPTY-NODE Throwable->map accessor add-classpath agent-errors await1 chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? clear-agent-errors clojure.core.reducers/->Cat clojure.core.reducers/CollFold clojure.core.reducers/append! clojure.core.reducers/cat clojure.core.reducers/coll-fold clojure.core.reducers/drop clojure.core.reducers/filter clojure.core.reducers/fjtask clojure.core.reducers/flatten clojure.core.reducers/fold clojure.core.reducers/foldcat clojure.core.reducers/folder clojure.core.reducers/map clojure.core.reducers/mapcat clojure.core.reducers/monoid clojure.core.reducers/pool clojure.core.reducers/reduce clojure.core.reducers/reducer clojure.core.reducers/remove clojure.core.reducers/take clojure.core.reducers/take-while clojure.data/Diff clojure.data/EqualityPartition clojure.data/diff-similar clojure.data/equality-partition clojure.java.browse/open-url-scriptclojure.java.io/Coercionsclojure.java.io/IOFactoryclojure.java.io/default-streams-implclojure.java.io/make-input-streamclojure.java.io/make-output-streamclojure.java.io/make-parentsclojure.java.io/make-readerclojure.java.io/make-writer clojure.java.javadoc/core-java-api clojure.java.javadoc/feeling-lucky clojure.java.javadoc/feeling-lucky-url clojure.java.javadoc/local-javadocs clojure.java.javadoc/remote-javadocs clojure.java.javadoc/add-local-javadoc clojure.java.javadoc/add-remote-javadoc clojure.java.shell/sh-dir clojure.java.shell/sh-env clojure.pprint/print-base clojure.pprint/print-miser-width clojure.pprint/print-pprint-dispatch clojure.pprint/print-pretty clojure.pprint/print-radix clojure.pprint/print-right-margin clojure.pprint/print-suppress-namespaces clojure.pprint/code-dispatch clojure.pprint/formatter clojure.pprint/formatter-out clojure.pprint/fresh-line clojure.pprint/get-pretty-writer clojure.pprint/pp clojure.pprint/pprint-indent clojure.pprint/pprint-logical-block clojure.pprint/pprint-newline clojure.pprint/pprint-tab clojure.pprint/print-length-loop clojure.pprint/set-pprint-dispatch clojure.pprint/simple-dispatch clojure.pprint/with-pprint-dispatch clojure.pprint/write clojure.pprint/write-out clojure.repl/demunge clojure.repl/dir-fn clojure.repl/root-cause clojure.repl/set-break-handler! clojure.repl/source-fn clojure.repl/stack-element-str clojure.repl/thread-stopper clojure.walk/keywordize-keys clojure.walk/stringify-keys clojure.xml/current clojure.xml/sb clojure.xml/stack clojure.xml/state clojure.xml/attrs clojure.xml/content clojure.xml/content-handler clojure.xml/element clojure.xml/emit clojure.xml/emit-element clojure.xml/startparse-sax clojure.xml/tag create-struct defstruct delay? denominator destructure find-protocol-impl find-protocol-method hash-combine hash-ordered-coll hash-unordered-coll method-sig mix-collection-hash munge namespace-munge numerator primitives-classnames print-ctor print-dup print-method print-simple proxy-call-with-super proxy-name read read-string reader-conditional reader-conditional? refer-clojure replicate special-symbol? struct struct-map tagged-literal tagged-literal? unchecked-add-int unchecked-byte unchecked-char unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc-int unchecked-int unchecked-long unchecked-multiply-int unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract-int unquote unquote-splicing with-bindings with-bindings* with-loading-context

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jafingerhut/clojure-cheatsheets/issues/43#issuecomment-318175406, or mute the thread https://github.com/notifications/unsubscribe-auth/AGwXB9PQvfWPV4ROcepZJFoyRNLFImmzks5sR6PYgaJpZM4OkbN- .

cloojure avatar Apr 16 '18 19:04 cloojure