clj-commons / useful Goto Github PK
View Code? Open in Web Editor NEWSome Clojure functions we use all the time, and so can you.
License: Eclipse Public License 1.0
Some Clojure functions we use all the time, and so can you.
License: Eclipse Public License 1.0
On Java 11 and 12-ea:
java.lang.ClassNotFoundException: sun.misc.BASE64Decoder, compiling:(flatland/useful/compress.clj:1:1)
java.util.Base64
would be good, but it's only available on Java 8 onwards. Probably still the best choice, but would mean dropping support for Java 7 and down, at least for the flatland.compress
namespace.
clojure.core now comes with an update
function itself: https://github.com/clojure/clojure/blob/master/changes.md#25-update---like-update-in-for-first-level
This gets replaced by useful.map/update
now. Probably the function in useful.map
can be removed.
@amalloy Should useful.config also work for non-resources? If so, we could use it for lazybot and get rid of clj-config entirely.
Right now the map-keys function only maps the top keys, i.e:
(map-keys str {:a {:b "c"}})
=> {"a" {:b "c"}}
Can we consider adding something like map-all-keys, map-all-values, etc that will traverse a nested structure? The use case here could be transforming a clojurefied map into a formatted JSON object or vise versa for example.
(defn transform-keys
"Recursively transforms all map keys in coll with t."
[t coll]
(let [f (fn [[k v]] [(t k) v])]
(clojure.walk/postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) coll)))
(transform-keys ->kebab-case-keyword {"oneTwo" 12 "threeFour" {"fiveSix" 56}})
=> {:three-four {:five-six 56}, :one-two 12}
OR
(defn transform-keys
"Recursively transforms all map keys in m with f."
[f m]
(letfn [(mapper [[k v]] [(f k) (if (map? v) (map-keys f v) v)])]
(into {} (map mapper m))))
(transform-keys ->kebab-case-keyword {"oneTwo" 12 "threeFour" {"fiveSix" 56}})
=> {:three-four {:five-six 56}, :one-two 12}
Travis CI is only setup on amalloy/useful, not flatland/useful. Could you set it up on flatland/useful as well?
https://groups.google.com/forum/#!topic/clojure/l8vGw458nFQ contains the details of if-let-all
macro.
Is useful an appropriate project to host if-let-all
macro?
((ignoring-nils +) nil nil)
returns 0, but ((ignoring-nils +) nil nil nil)
returns nil. Is this difference intentional? I figure they should both return 0.
Just a heads up: 0.8.9 and 0.9.0 have not been pushed to clojars (not sure if this is intentional).
It would be great if you could deploy a signature for the latest
release of this library and make it a habit of deploying signed jars
in the future.
Here's a quick description of how to sign already-deployed jars on Clojars:
https://github.com/technomancy/leiningen/wiki/SigningDeployedJars
I am a Debian developer packaging Clojure and Leiningen. Leiningen2 depends on this project and I'd like to package it. Could you please display copyright holders (developers) for this work? project.clj is likely a good place to note that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.