Fork me on GitHub
#beginners
<
2017-03-09
>
yonatanel09:03:00

@adamkowalski Out of curiosity, why do you need to enumerate implemented/extended protocols of an object?

josh_tackett17:03:36

silly question but having trouble using the clj-fuzzy lib

josh_tackett17:03:38

Could not locate clj_fuzzy/metrics__init.class or clj_fuzzy/metrics.clj on classpath

josh_tackett17:03:44

I added to project file and namespace

josh_tackett17:03:56

project file: ;; Fuzzy String Matching [clj-fuzzy "0.3.3" :exclusions [org.clojure/clojure]]

josh_tackett17:03:08

namespace [clj-fuzzy.metrics :as fuzzy]

seancorfield17:03:20

@josh_tackett I cannot repro that problem locally — perhaps you can elaborate on exactly what you’re doing?

mruzekw17:03:58

I’m currently trying to long poll a url every 5 secs and print the output, but after the first response it ends up in an infitnite loop. What am I doing wrong?

(go (let [resp-chan (chan)
              callback #(http/jsonp 
                                “<url>" 
                                {:callback-name "callback" :timeout 3000 :channel resp-chan})
             interval  (js/setInterval callback 5000)]
          (loop []
            (let [status (<! resp-chan)]
              (println status)
              (recur)))

mruzekw17:03:26

Okay, I avoided the infinite loop with a when check, but the responses after the first one aren’t showing

mruzekw17:03:55

Looks like http/jsonp closes the channel after a success

adamkowalski22:03:11

@yonatanel I am making a tree data structure which I want to feel like any of the other native types. So I am hoping to learn about what kind of protocols or interfaces they implement so that I can see which ones make sense for me. The idea is to minimize the amount of new things somebody would need to learn to use it, and instead focus on the abstract idea.

josh.freckleton22:03:43

how can I format a string with a non-space padding?

josh.freckleton22:03:12

eg (f "a" "x" 6) = "xxxxxa"

josh.freckleton22:03:04

I'd like to use, if at all possible, the stock format, and I cant find much of a reference for it online

josh.freckleton22:03:43

@schmee thanks, i had actually browsed through that already but couldn't find how to pad a string with anything but spaces...

schmee22:03:07

user=> (cl-format nil "Pad with leading asterisks ~5,'*d" 3)
"Pad with leading asterisks ****3”

schmee22:03:47

the syntax for cl-format seems nuts to me, but hey, it works! 😄

josh.freckleton22:03:32

thanks, ya, i saw that too and didn't invest more than a few minutes in trying to get it to work. I'm... baffled this isn't a more common problem.

josh.freckleton22:03:49

i mean, i'd think java could handle it without additional custom logic

josh.freckleton23:03:27

@shmee thanks for your help there, I ended up settling for a custom fn