Re: code from spec with clojure.spec?

2016-11-06 Thread Joe Corneli
This is a late reply to my own question but maybe it will be helpful to a future searcher. http://blog.cognitect.com/blog/2016/10/5/interactive-development-with-clojurespec has an example that showed me more clearly how to use :fn. Specifically here's how I rewrote the spec: (s/fdef mapper

code from spec with clojure.spec?

2016-10-17 Thread Joe Corneli
As a running example related to the ideas in http://clojure.org/guides/spec#_spec_ing_functions, please consider the following function: (defn mapper [x y] {:tacos (vec (range x)) :burritos (vec (range y))}) Example input and output: (mapper 2 4) ;=> {:tacos [0 1], :burritos [0 1 2 3]} O

Re: breaking homoiconicity?

2015-06-20 Thread Joe Corneli
On Saturday, June 20, 2015 at 4:15:30 AM UTC+1, Sean Corfield wrote: > > (.getTypeName (Class/forName "[Ljava.lang.String;")) > ;;=> "java.lang.String[]" — that is more readable! > Thanks, that's helpful for me. By chance do you know if the class is natively recoverable from

breaking homoiconicity?

2015-06-19 Thread Joe Corneli
This is an interaction with Clojure via CIDER. repl [1]> (type (into-array String ["Awesome"])) [Ljava.lang.String; repl [2]> [Ljava.lang.String; RuntimeException EOF while reading, starting at line 1 clojure.lang.Util.runtimeException (Util.java:221) repl [3]> (quote [Ljava.lang.String;) CIDER