- destructure—useful to debug destructuring. "It's like macroexpand, but for destructuring."
- reductions—like reduce, but also returns intermediate results
- test—docstring says it best: "test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception". You might use this to document/demonstrate assertions about a var in the immediate context of the var's definition.
- clojure.pprint/cl-format—crazy-powerful formatting function from Common Lisp. Pluralization of English words! Roman numerals! Spelled out English representations of numbers! The docstring links to this documentation on format control strings.
- clojure.java.browse/browse-url—programmatically open a URL in the system browser
- clojure.java.javadoc/javadoc—quick peek into java docs
- clojure.reflect/reflect—deep reflection on types. Get variables, fields, methods supported, signatures of each method, etc.
- clojure.inspector/inspect-tree—visual inspector of data structures, handy for complex structures. Swing UI.
- clojure.lang.PersistentQueue—immutable FIFO queue, with buffers, schedulers, etc.
- fnil—nil-patch a fn. Useful to handle nil when it wouldn't be handled otherwise, or else to override nil-handling.
The following get honorable mentions:
- counted?—does coll implement 'count in constant time?
- reversible?—does coll implement Reversible?
- vector-of—uniform-type vectors of unboxed primitives
- clojure.set/rename-keys—rename keys in a map
- clojure.data/diff—Clojure data structure diffing
- munge—munge special characters in symbols or strings to _ENGLISH_ representations. (munge "!") -> "_BANG_"
- gensym—Returns a new symbol with a unique name, optionally prefixed.
- seque—Creates a queued seq on another (presumably lazy) seq s.
- zippers—functional tree editing
These were highlights for me: destructure, test, cl-format, reflect, inspect-tree, munge
No comments:
Post a Comment