Fortunately, it was all closing parentheses.
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
to/from Clojure.
Github: http://github.com/russellc/Marshal
Clojars: https://clojars.org/marshal
//C header file definition
struct packet {
unsigned long type;
unsigned long size;
long data[1];
};
(require '[marshal.core :as m])
(def packet (m/struct :type m/uint32 :size m/uint32 :data (m/array
(defn foo []
(letfn (bar [acc val]
acc)
(reduce bar {} (range 1 10
doesn't compile
java.lang.IllegalArgumentException: Don't know how to create ISeq
from: clojure.lang.Symbol
this compiles
(defn bar [acc val] acc)
(defn foo []
(reduce bar {} (range 1
Not sure it's better than Uncle Bobs version but it seems a little
more idiomatic?
(defn of [n]
(letfn [(f [res k]
(if (= 0 (rem (:n res) k))
(assoc (assoc res :n (quot (:n res) k)) :fs (conj (:fs
res) k))
res))]
(:fs (reduce f {:n n :fs []}
Should this compile?
(defprotocol P (p [this]))
(defrecord R [k] P (p [{:keys [k]}] k))
java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot
be cast to clojure.lang.Symbol
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to
FWIW (i.e. IMO the previous two functional solutions are better
examples) here is a more imperative style solution done sort of to
prove to myself that I could do such a thing in Clojure w/o too much
(arguable) fanfare. Maybe it will be interesting to others who are
learning Clojure too
(defn