Fork me on GitHub
#clojure
<
2016-11-12
>
fabrao00:11:58

hello all, is the corret ->

fellshard00:11:57

You may want to use reify instead of proxy since HostKeyVerifier is an interface (sshj, correct?)

fellshard00:11:43

you're forgetting your 'this' argument to .addHostKeyVerifier

fellshard00:11:13

i.e. ssh in the Java code needs to be the first argument to .addHostKeyVerifier in the Clojure code, I believe

fellshard00:11:12

Similarly, your verify method also needs to accept a this parameter first.

fellshard00:11:32

(.addHostKeyVerifier
  ssh
  (reify HostKeyVerifier
    (verify [this s i p] true)))

fabrao01:11:06

@fellshard, the "this" was from doto 🙂, and yes, interface from sshj, and thank you, it worked

ghadi16:11:39

doesn't seem like a bug. when reading in cljs tools.reader has no idea that baz is aliased

moxaj16:11:49

@ghadi sure, but i'd expect the reader to think like "oh, i'm reading the clj branch of a reader conditional - let's consider those clj aliases I tossed away earlier"

ghadi17:11:15

the reader doesn't evaluate things

ghadi17:11:30

handling aliases requires ns to be evaluated

moxaj17:11:54

@ghadi how does it read any ::foo/bar like keywords then? surely it has to be aware that some namespace was aliased as foo

ghadi17:11:32

Oh -- right. You're reading with cljs but the alias hasn't been defined.

ghadi17:11:58

Agh. I see what you mean.

moxaj17:11:11

@ghadi probably not a bug, but a feature request

ghadi17:11:28

which tools.reader again?

moxaj17:11:14

@ghadi stacktrace says clojure.tools.reader

micha17:11:46

hello, i'm trying to get greglook/whidbey working in boot repl, anyone here familiar with that code?

vigilancetech18:11:28

I'm trying to build a core.async channel to cycle thru responses every time the channel is read. But every time I try and read it blocks. Why?

(def c (chan))
 (go (>! c (cycle [:a :b])))
 (<!! c)

eoy18:11:09

Newbee question: If I have this data, how do I go about "searching" for Example 2? In Ruby you could do something like .where(name: "Example2")

[{:name "Example 1"
 :description "This is a description"}
{:name "Example 2"
 :description "This is a description"}
{:name "Example 3"
 :description "This is a description"]

mtnygard19:11:49

@eoy You would use filter to find the match. (filter #(= “Example 2” (:name %)) [{:name ,,,}])

mtnygard19:11:12

That will return a seq of all the matches. If you only want the first one, you can call first on the result.

eoy19:11:24

Awesome, thanks!

eoy19:11:52

And if I wanted to grab all that matches a regex of #"Example" I'd just have to modify the condition?

mtnygard19:11:36

Yes. You’d still use filter, but with a different predicate function.

eoy19:11:16

I'm guessing there is no ~=

mtnygard19:11:40

No, but there are functions that work on regexes.

mtnygard19:11:46

Mostly starting with re-

eoy19:11:01

right, like re-matches and re-seq

eoy19:11:03

I'll figure this out 🙂

mtnygard19:11:20

One catch to watch out for.

mtnygard19:11:28

An empty string counts as a “truthy” value

mtnygard19:11:40

Only nil and false are falsey.

eoy19:11:55

God Clojure is complex to learn coming from a quite purely object oriented background

mtnygard19:11:15

For sure there’s a learning curve.

mtnygard19:11:26

@vigilancetech I think the line where you do (go (>! c (cycle [:a :b]))) is doing something different than you expect.

mtnygard19:11:35

That puts one value into the channel

vigilancetech19:11:35

someone on IRC answered my question.

mtnygard19:11:48

Which will be the entire contents of the infinite sequence returned from cycle.

vigilancetech19:11:58

I needed to set it up with async/to-chan

vigilancetech19:11:05

@mtnygard actually I was getting 0 values 🙂

mtnygard19:11:25

@vigilancetech Because it would never finish realizing the value of cycle to put it into the channel, right?

vigilancetech19:11:48

I read somewhere that like cond is lazy and conj is not or vice versa, so I'm thinking perhaps using one of those to get a lazy take infinity might work

vigilancetech19:11:26

Oh, I know what's happening I think. Its trying to give an infinite sequence to the channel because that's probably hungry

vigilancetech19:11:48

anyway, a lot of clojure is still a mystery to me

wei19:11:54

is there any documentation on the new namespaced maps features in 1.9?

wei19:11:16

I’d like to know how to remove namespaces from keys in a map

wei19:11:09

also I’ve been running into this problem in 1.9-alpha14 RuntimeException EOF while reading and then RuntimeException Unmatched delimiter: } :

(def a #:test{:a 1
              :b 1})

wei19:11:50

this works though

(def b #:test{:a 1 :b 1})

wei20:11:04

here’s my solution for removing ns from map:

(defn unqualify [m]
  (com.rpl.specter.macros/transform [(com.rpl.specter/walker keyword?)] (comp keyword name) m))

noisesmith20:11:32

@vigilancetech: neither cond or conj is lazy, lazy-seq is lazy

noisesmith20:11:00

and maybe you were thinking of cons, not cond

wei21:11:29

to answer my question above, http://clojure.org/reference/reader under "Map namespace syntax“ has some documentation on the new reader syntax