This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I have now this :
(defn ->long [s] (try (Long/parseLong s) (catch Exception _ ::s/invalid)))
(s/def ::page (s/and (s/conformer ->long) (s/int-in 1 471)))
(s/def ::optional-page (s/nilable ::page))
(defn page-check [page] (let [page page page-num (or (s/conform ::optional-page page) 1)] page-num))
(s/fdef page-check
:args (string? ::page :page)
:ret (number? ::page :page)
:fn (s/valid? true? :page )
)
I don't suppose there are any up-to-date DHT/P2P libs for Clojure available? It's looking like I'm probably going to need to just write a damned Pastry wrapper.
@seylerius +1 a lib called filo should exist.
I mean, what else would you call a thin clojure wrapper around a lib called pastry?
hi guys
how can i define my own type which is hash inside hash, then check if the provided hash is hash of hash or not ?
is there good way to do this?
i guess i need to define hash-of-hash type then use instance? method to check the provided hash is hash of hash type or not
(instance? Hash-of-Hash {1 {2 3}}) => should return True
can anybody help me to define this custom type?
#(->> {1 {2 3} 2 {3 4}} (mapv (fn [[k v]] (type v))) (every? (fn [t] (= t clojure.lang.PersistentArrayMap))))
is this elegant solution ?
(mapv (fn [[k v]] (map? v))) (every? true?))
i didn't know if there is map?
(prn (type match-pos))
=> clojure.lang.LazySeq
(prn match-pos)
=> ()
(prn (first '()))
=> nil
(prn (first match-pos))
=> java.lang.String cannot be cast to clojure.lang.IFn
Why, Lord, why? ðŸ˜
@aisamu what's the full stack trace?
it's probably likely that whatever is throwing that error is inside the actual lazy seq, the contents of the lazy seq
would probably throw the same error if you did (first match-pos)