#clojure log - Mar 20 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:08 SegFaultAX: Has anyone here ever tried to embed elasticsearch in their application?

0:11 technomancy: SegFaultAX: as I understand it, elasticsearch is a distributed dynamo-style cluster; not sure how that would work.

0:12 SegFaultAX: technomancy: Just like running it stand alone, but embedded in your application (eg the nodes life cycle is tied to your application's)

0:12 http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html

0:13 technomancy: not sure what the point of ES is if you don't have clustering though?

0:14 just use lucene

0:14 SegFaultAX: It still connects to the cluster.

0:14 It works exactly the same way, just embedded.

0:14 "When you start a Node, it joins an elasticsearch cluster." - that page I linked

0:14 technomancy: I guess you would gain faster access for whatever data happens to be on the local node?

0:15 might make sense for smaller corpuses

0:15 hiredman: technomancy: it isn't a data node

0:15 SegFaultAX: technomancy: Actually in this case I'm wondering if it would ease deployment if I want to use elastic beanstalk or something.

0:15 hiredman: technomancy: what we did before we switched to the rest api

0:16 SegFaultAX: I guess I could deploy ES directly to EB.

0:16 technomancy: hiredman: oh, you mean like so it has access to all the ring data so it can go directly to the node that contains a given shard?

0:16 skip a hop or whatever

0:17 hiredman: technomancy: if I recall, yeah

0:18 SegFaultAX: Anyway, it doesn't seem like it'd be that hard to do. Maybe not worth it though.

0:19 I was thinking it might be neat to have a local read-only index. Writes will fan out from the master to the local instance on each app server.

0:20 hiredman: SegFaultAX: that is not really how es works

0:20 SegFaultAX: hiredman: In what way do you mean?

0:21 I had a ~5 node cluster at my last company so I'm familiar running it as a silo'd service.

0:21 hiredman: SegFaultAX: es nodes don't have a copy of all the data, and I would definitely *not* recommend making your app a data node on elasticbeanstalk, you will have a bad time as the cluster rebalances when you scale up or down

0:23 SegFaultAX: Yea that was my main concern, too.

0:23 hiredman: But I got the idea from reading this: http://www.colinsteele.org/post/27929539434/60-000-growth-in-7-months-using-clojure-and-aws

0:23 Basically they had an embedded solr instance in each app node (also Clojure)

0:24 And I've heard of a similar architecture at Guardian (one of the tech leads gave a talk about it)

0:25 hiredman: SegFaultAX: sure, that is a common thing to do with lucene based things that are not elasticsearch, you have some offline process that generates indices, and each process gets a copy

0:26 SegFaultAX: (Relevant guardian talk: http://www.infoq.com/presentations/guardian-content-api)

0:26 hiredman: Why do you think that won't work for ES?

0:26 hiredman: SegFaultAX: es is clustered

0:27 SegFaultAX: they are talking about non-clustered completely indepedent solr instances

0:27 the clustering will not respond well to many and rapid changes in cluster membership

0:27 SegFaultAX: Well it's not like instances come up and down every couple minutes.

0:28 But I see your point anyway.

0:28 hiredman: if your data set is small enough for one machine, just build and ship lucene indices, no need for solr or es

0:30 SegFaultAX: hiredman: Yea, totally. I might still play around with it anyway just to see how bad it is. Just thought it was an interesting architectural choice.

0:37 dakrone: hiredman: it's still nice to have solr or ES instead of plain Lucene though, Lucene by itself is a much more complex API to deal with

0:37 (sometimes)

0:58 jph-: dakrone, btw, thanks for cheshire

0:59 dakrone: jph-: you're welcome!

1:12 jph-: is it ok to put bigger functions in your (extend-type or should call functions defined elsewhere?

1:12 i kinda feel like the latter is the better approach

1:12 they otherwise feel hidden away in (extend-type

1:22 vertup: f/clear

1:23 jph-: accidentally left a () in my code, the stack trace was less than helpful

1:32 turbofail: it always is

1:56 mr-foobar: lein cljsbuild auto is compiling my changes, but python -m SimpleHTTPServer in resources/public is not picking up the changes. Not sure why :/

2:11 michel_slm: hi everyone

2:11 what's the best practice for dealing with dependencies pulling multiple versions of some components like clojure?

2:27 storme: echo ,(println "&(+ 1 2)")

2:27 lazybot: ,(println "&(+ 1 2)")

2:27 clojurebot: &(+ 1 2)\n

2:27 storme: echo ,(println "(+ 1 2)")

2:27 lazybot: ,(println "(+ 1 2)")

2:27 clojurebot: (+ 1 2)\n

2:27 katratxo: michel_slm: perhaps using `:exclusions` ? https://github.com/search?l=Clojure&q=%3Aexclusions&ref=advsearch&type=Code

2:28 https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L48

2:31 michel_slm: katratxo: aha, thanks.

2:31 am trying out hoplon, and when I tried one of its dependencies using lein try, it pulls in clojure 1.3.0 -- will try and make sure that doesn't make its way into production code

3:05 akhudek: does anyone have any idea how I can access these weird static final classes? https://github.com/knowitall/openregex/blob/master/src/main/java/edu/washington/cs/knowitall/regex/RegularExpressionParsers.java

3:13 opqdonut: akhudek: you import edu.washington.cs.knowitall.regex.RegularExpressionParser, you refer to them with RegularExpressionParser/character and RegularExpressionParser/word

3:13 akhudek: as you can see they're not really classes, but fields

3:14 akhudek: opqdonut: that's what I thought too, but it's giving me illegal access errors

3:14 opqdonut: mm, sorry, I typoed

3:14 should be RegularExpressionParser_s_ and RegularExpressionParser_s_/character

3:14 akhudek: weird, could you paste the error somewhere?=

3:15 dbasch: is there a way to know if a compojure route would match a path without calling it?

3:15 akhudek: https://www.refheap.com/3b078fda1a1cb483a50207b32

3:19 there is serious magic going on in this library

3:19 https://github.com/knowitall/openregex/blob/master/src/main/java/edu/washington/cs/knowitall/regex/RegularExpression.java

3:19 at the bottom you can see it use RegularExpressionParsers

3:19 but it never imports it

3:19 O.o

3:20 opqdonut: akhudek: it's in the same package, no need to import

3:21 akhudek: I just checked and I can access "public static final" fields ok

3:22 akhudek: opqdonut: yeah, I've done it before too. Not sure why this one isn't working.

3:27 ArchPy: I was told to come here to learn more.

3:27 SegFaultAX: What do you want to know?

3:28 ArchPy: Why is clojure worth paying attention to?

3:29 SegFaultAX: Are you primarily a Python hacker?

3:31 jack_rabbit: Clojure is probably one of the easier functional languages to write significant applications in. And lisp is great.

3:34 tsdh: Aren't there functions like head-set/tail-set for sorted sets that return the set of elements smaller/larger than a given element?

3:35 I know I can use take-while/drop-while, but those are linear whereas special sorted-set aware functions could be logarithmic.

3:37 ArchPy: SegFaultAX I work primarily with python and powershell

3:37 My day-to-day is powershell because I am a Windows Server Administrator and my personal projects have always been python. I've dabbled in other languages but nothing significant.

3:38 akhudek: opqdonut: I think the reason is that RegularExpressionParsers itself is not marked public

3:40 SegFaultAX: ArchPy: Well other people have spent a lot of time and effort describing the wonderful and attractive aspects of clojure.

3:41 They do it more justice than I can off the cuff here. Try googling "why clojure" or something.

3:42 scottj: here's one http://clojure.org/rationale

3:42 opqdonut: akhudek: riiiight, yeah

3:42 akhudek: so it has only package visibility

3:43 SegFaultAX: Or here: http://www.quora.com/Clojure/Why-would-someone-learn-Clojure

3:44 Or here: http://michaelochurch.wordpress.com/2013/08/07/why-clojure-will-win/

3:52 jph-: how might i thread-first this... (merge (get {:a 1} :b) (get {:a 1 :b 2} :b)) ?

3:53 i know how to thread-first (-> {:a 1} (get :b) (merge))

3:53 woops, its the second get im not sure how to represent

3:58 scottj: jph-: I don't think there's a reason to thread that. (merge (map :b [{:a 1} {:a 1 :b 2}]

3:59 tsdh: How can I get the namespace prefix of a symbol? E.g., (gimme-ns `foo) would return user if I'm in the user namespace.

3:59 jph-: scottj, i havent seen it written that way, cheers

3:59 beamso: isn't a :: symbol the symbol for the current namespace

4:00 jph-: *ns*

4:00 ,*ns*

4:00 clojurebot: #<Namespace sandbox>

4:00 scottj: beamso: that's for keywords, which I think are called symbols in other languages

4:00 beamso: ,(symbol "foo")

4:00 jph-: learnt that when playing with macros

4:00 clojurebot: foo

4:03 tsdh: Just to make my point clear: how can I distinguish `foo and 'foo?

4:03 ,[(name 'foo) (name `foo) (= 'foo `foo)]

4:03 clojurebot: ["foo" "foo" false]

4:03 jph-: user=> (symbol (str *ns*) "help")

4:03 user/help

4:03 then you can (resolve ..)

4:03 and (deref (resolve ..))

4:04 tsdh: jph-: That requires that foo is an existing var which it is not in my case.

4:06 Basically, I'm trying to write a function that given a form picks out all local variables it uses. Those are the symbols that are not in funcall position and are not namespace qualified.

4:07 (Plus some extra logic for let, loop, and fn, etc.)

4:10 Argh, that was way too obvious: ,(namespace `foo)

4:10 ,(namespace `foo)

4:10 clojurebot: "sandbox"

4:10 tsdh: :-)

4:10 jph-: hah

4:10 nice

4:34 silly question, whats the purpose of including type in a functions parameter list

4:34 it's not casting is it?

4:35 (def x [^java.math.BigDecimal y] y)

4:35 TEttinger: that's a type hint

4:35 jph-: for when you are (doc x) ?

4:35 ie, is it more for self-documenting code

4:35 beamso: the type hint is to prevent using reflection when executing methods/functions

4:36 scottj: jph-: clojurebook.com or read all the docs on clojure.org

4:36 beamso: lein check tells you the methods in your project that are using reflection

4:36 jph-: beamso, ahh, got it

4:36 beamso: i think *warn-on-reflection* is the setting in the repl

4:36 TEttinger: type hints are important for making clojure run faster, and the doc thing is nice too

4:37 jph-: oh so it also allows optimization when JITing

4:37 ok

5:40 ivan-kanis: what's the equivalent of CL progn in clojure?

5:40 clgv: ivan-kanis: `do`

5:41 ivan-kanis: ok

5:41 clgv: ,(do (println 1) (println 2) 3)

5:41 &(do (println 1) (println 2) 3)

5:41 lazybot: ⇒ 1 2 3

5:41 clojurebot: 1\n2\n3

5:41 clgv: hm ok not that illustrative with the bots

5:42 &(+ 5 (do (println 1) (println 2) 3))

5:42 lazybot: ⇒ 1 2 8

5:42 ivan-kanis: no worry

5:42 How do I close the cider repl?

5:43 ArchPy: Clojure for sys admin projects? yea or nay?

5:44 pyr: ArchPy: what type specifically

5:44 ArchPy: pyr: Mostly task automation. But of every kind really.

5:44 ivan-kanis: nm it's C-c C-q

5:44 ArchPy: In a mixed enviroment windows and linux

5:45 mskoud: If startup time is not an issue, i dont see why not.

5:45 ArchPy: mskoud: How is Clojure with .NET?

5:45 pyr: ArchPy: there are really good libs for this in clojure. if you're working with traditional ops persons you're gonna get a bit of pushback

5:48 ArchPy: pyr: I'm curious as to what that would be?

5:48 clgv: ArchPy: probably "nay" when you need fast startup times

5:48 pyr: ArchPy: because clojure doesn't even remotely look like bash

5:49 ArchPy: mostly :-)

5:50 clgv: ArchPy: Clojure CLR is tracking Clojure JVM closely afair

5:50 ArchPy: pyr: Well, I dont really use bash. My day to day automation is powershell in windows. And when I need to do most of my basic stuff in linux its python / puppet.

5:51 I mean, I guess I do use bash. But not really in the toolmaking category.

5:52 clgv: ArchPy: powershell has a tight .NET integration right?

5:52 ArchPy: I guess I was wondering if there are any unique advantage to using Clojure for toolmaking

5:52 clgv: It's ridiculously good. Super-fast and easy.

5:53 clgv: Powershell has kind of revolutionized my job. It's not ugly and painful like vbscript. With just object-piping and a ForEach loop half of what I need is done.

5:53 clgv: ArchPy: well if Clojure's .NET interop is as good as the on for Java then you should try how far you come

5:54 ArchPy: clgv: Could you rephrase that? I dont think I totally understood you.

5:59 rocknrollMarc: powershell is windows only right?

5:59 have you tryed the fish shell? that one realy kicks as

5:59 s

6:00 xsyn: zsh ?

6:00 rocknrollMarc: http://fishshell.com/

6:01 I usualy use zsh but this new one is realy better but im switching slowly maybe I wont but Im using bolth as fish has realy nice completion

6:01 is you have a mac and use vim like me have a look at this please https://github.com/skwp/dotfiles

6:35 dsrx: who needs fish or zsh when you have eshell? ;)

6:39 xsyn: or cshell

6:39 (on the sea shore)

6:53 sm0ke: hello all

6:53 what clojure datastructure should i use which is composite and comparable aprt from lists vectors

6:54 ,(sort [{:a 1} {:a 3}])

6:54 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Comparable>

7:11 CookedGryphon: sm0ke: what are you trying to achieve there?

7:11 ,(sort-by key [{:a 1} {:a 3}])

7:11 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry>

7:11 CookedGryphon: oh, oops

7:11 sm0ke: ,(sort-by :a [{:a 1} {:a 3}])

7:11 clojurebot: ({:a 1} {:a 3})

7:11 CookedGryphon: ,(sort-by :a [{:a 1} {:a 3}])

7:11 clojurebot: ({:a 1} {:a 3})

7:12 sm0ke: yea i dont want to sort, i want data abstraction which can have multiple components and be comparable

7:13 so for instance ##(sort [[:a 1] [:a 2] [:a -1] [:z 0]])

7:13 lazybot: ⇒ ([:a -1] [:a 1] [:a 2] [:z 0])

7:13 sm0ke: makes sense right?

7:14 but only that i am not allowed to use list

7:15 athough weird requirement, i think one way would be to have a Record which implments Comparable

7:17 its weird though that maps have equality but are not comparable

7:17 ,(= {:a 1} {:a 1})

7:17 clojurebot: true

7:17 sm0ke: ,(compare {:a 1} {:a 1})

7:17 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Comparable>

7:22 pyrtsa: sm0ke: Unlike equality comparison, there is no cheap inequality comparison for maps.

7:23 So that's, AFAICT, the reason there is no such thing defined by default.

7:23 sm0ke: true

7:24 pyrtsa: (The keys of a map aren't sorted, so you need to iterate over all the keys of both maps before you know what to compare.)

7:26 sm0ke: unless its a sorted map

7:26 ,(compare (sorted-map :a 1) (sorted-map :a 1))

7:26 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be cast to java.lang.Comparable>

7:27 pyrtsa: Why don't you just create your own comparator for that?

7:27 sm0ke: yea doing that

7:35 clgv: ArchPy: my guess is that Clojure CLR interop with .NET is probably as good as Clojure JVM interop with the JVM/Java

7:35 ArchPy: I did not tray it yet though

7:38 CookedGryphon: does anybody know of any libraries which nicely wrap safe posixy atomic file operations?

7:39 I can't seem to find anything

7:40 sm0ke: CookedGryphon: wouldnt anything over jvm be already posixy?

7:41 CookedGryphon: different part of posix :P I mean the safe atomic read/write conventions

7:41 so for example if your process crashes half way through a save, you don't have a corrupt file left on disk and the previous version completely lost

7:42 BartAdv: clgv> ArchPy: my guess is that Clojure CLR interop with .NET is probably as good as Clojure JVM interop with the JVM/Java <- there are some inconveniences with generics, as there are differences in that regard etween jvm and .net

7:44 clgv: BartAdv: ah ok. yeah in .NET genrics are at vm-level right?

7:45 BartAdv: yes

7:46 sm0ke: anyone working with nippy had problem with de/se of Records?

8:32 abcdw: Are any GSoC mentors here?

8:48 clgv: abcdw: more likely in a few hours (2-3)

9:05 abcdw: why this channel is so silent?)

9:05 teslanick: People are busy working on great stuff?

9:06 clgv: because the vast number of US people is not here, yet

9:06 fu86: Is there a function to prepend a string to another which I can use in a (-> ...) form?

9:06 cemerick: +1 to irc channels that aren't busy just to be busy :-)

9:07 clgv: fu86: I guess you are not threading the prefix, right?

9:07 fu86: in that case you probably need a custom function to do that

9:07 fu86: clgv: ok, thanks

9:09 hyPiRion: fu86: ##(-> "foobar" ((partial str "p:")))

9:09 lazybot: ⇒ "p:foobar"

9:10 hyPiRion: eventually just use ##(-> "foobar" (->> (str "p:")) (str "-postfix))

9:10 cemerick: there's always ##(-> "foobar" (->> (str "p:")))

9:10 lazybot: ⇒ "p:foobar"

9:10 cemerick: my irc game has gone stale :-P

9:11 hyPiRion: cemerick: well, you didn't forget to end the string :)

9:12 fu86: is ->> inside a -> okay?

9:13 cemerick: it's probably overly-clever, but yes

9:13 hyPiRion: I tend to use as-> inside -> in small doses, so I guess it is okay

9:13 cemerick: as-> is perhaps a better option

9:14 fu86: thanks a lot!

9:14 hyPiRion: fu86: I think it just boils down to preference at that point. As long as it is readable and consistent in a project, you should be fine :)

9:15 clgv: hyPiRion: yeah but this form defeats the point of the threading somehow

9:15 fu86: okay. I still having some trouble finding "the clojure way"^TM

9:40 jjl`: /win 42

9:40 fu86: http://hastebin.com/jupapeyixe.lisp

9:40 is there a better way to write this?

9:40 devn: so weird and "magic" that midje has "typo tolerance" just 'cause

9:41 "Experience has shown that it's easy to type ..mc... when you meant to type ...mc.... As of Midje 1.3-alpha5, the two are resolved to the same metaconstant. The same is true of --mc--- and ---mc---. It is not the case, however, that ..mc.. is the same metaconstant as --mc--."

9:41 blech.

9:43 shep-werk: devn: metaconstant is close enough to magicconstant anyway ;-)

9:43 devn: i have no idea why anyone would litter their codebase with something to do that. it's tantamount to saying: "experience has shown that people regularly mis-spell and, so from this point on in clojure, "adn" will also resolve to and"

9:44 that's where you just go:

9:44 * devn slow claps

9:46 jjl`: they do this in npm

9:48 mikerod: ,(let [or #'clojure.core/or] (or 1 2))

9:48 clojurebot: nil

9:49 mikerod: ,(let [or #'clojure.core/or] (or 1 2))

9:49 clojurebot: nil

9:49 mikerod: Why?

9:49 clojurebot: http://clojure.org/rationale

9:50 clgv: mikerod: first of all `or` is a macro so that did not have any chance to work at all

9:55 shep-werk: clgv: the macroexpand for it looks reasonable though...

9:55 ,(let* [or #'clojure.core/or] (let* [or__3943__auto__ 1] (if or__3943__auto__ or__3943__auto__ 2)))

9:55 clojurebot: 1

9:56 berdario: I just noticed a weird thing, if I have nested `send`s (that is, I send a function to an agent, and inside that function another function is sent to the same agent) the agent loses part of its state

9:57 (the agent contains a vector, logging the value before the inner send it is a 2 element vector, logging the value inside the function that was "inner-sent" it's a 1 element-vector)

9:57 I guess that the execution order of functions sent in this way isn't well defined... is this expected behavior?

9:58 Bronsa: mikerod: you need to take into account &form and &env

9:59 ,(#'or nil nil 1 2)

9:59 clojurebot: (clojure.core/let [or__3947__auto__ 1] (if or__3947__auto__ or__3947__auto__ (clojure.core/or 2)))

10:00 clgv: shep-werk: I think macroexpand makes an error there and deviates from the compiler behavior

10:01 shep-werk: clgv: combined with Bronsa's point about form/env, that would make sense

10:01 Bronsa: clgv: an error?

10:01 clgv: shep-werk: ah so you think his point was to get the macroexpandion with that let form?

10:04 shep-werk: clgv: you mean mikerod's original goal? I don't dare wager a guess :-)

10:07 clgv: shep-werk: yeah I focussed on the original ;)

10:08 shep-werk: clgv: so, what do you think is up with macroexpand in this case?

10:10 mikerod: clgv: so I'm still confused by this behavior :)

10:10 I have a chunk of unevaluated code. I want to qualify all of the unqualified symbols in it, if they can be.

10:10 but I want to respect local shadowing.

10:10 So I had this good idea, of just shadowing all the symbols

10:10 In an outer-let

10:11 that wraps the original form

10:11 ...

10:11 clgv: shep-werk: nothing. as Bronsa pointed out there are the two "hidden" parameters to every macro

10:12 mikerod: maybe you want macro-symbol-let from tools.macros

10:12 mikerod_: I was knocked out of the channel

10:12 clgv: mikerod_: maybe you want macro-symbol-let from tools.macros

10:12 mikerod_: I will look at that

10:12 I think I've heard of it before.

10:13 I am curious about this behavior though. I guess I could dig into the evaluation to understand it.

10:13 ,(let [or #'clojure.core/or] (or 1 2 3))

10:13 clojurebot: 3

10:13 quizdr: cemerick hyperion what is the double hash symbol for? ##

10:13 mikerod_: (let [or #'clojure.core/or] (or 1))

10:13 Bronsa: mikerodor is a macro

10:13 mikerod_: ,(let [or #'clojure.core/or] (or 1))

10:13 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/or>

10:13 mikerod_: Very strange

10:13 Bronsa: if you get the var of a macro you can invoke that as a function

10:13 mikerod_: Bronsa: it seems to work on 3 arity?

10:13 ,(let [or #'clojure.core/or] (or 1 2 3))

10:13 clojurebot: 3

10:14 mikerod_: ,(let [or #'clojure.core/or] (or 1 2 3 4))

10:14 clojurebot: (clojure.core/let [or__3947__auto__ 3] (if or__3947__auto__ or__3947__auto__ (clojure.core/or 4)))

10:14 mikerod_: oh

10:14 Bronsa: mikerod_ every macro has 2 implicit args

10:14 &form and &env

10:14 lazybot: java.lang.RuntimeException: Unable to resolve symbol: form in this context

10:14 mikerod_: ah

10:14 Bronsa: I see what you mean now.

10:14 tricky

10:16 honza: http://honza.ca/2014/03/how-to-use-piggieback-in-vim-fireplace-to-hack-cljs

10:24 clgv: honza: a lot of text for 2 relevant lines ;)

10:25 honza: word :)

10:51 matthavener: does clojure's PersistentHashMap handle avoiding collision DoS attacks?

10:57 TimMc: matthavener: I don't believe so.

10:58 stuartsierra: How could it?

10:58 TimMc: Hmm, maybe in 1.6 it will.

10:59 In master, it uses Util/hasheq, which for String uses the Murmur3 hash.

11:01 ,*clojure-version*

11:01 clojurebot: {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}

11:01 clgv: matthavener: you'll need a cryptographic hash function to do that (i.e. a hash function for which it is computationally hard to find collisions)

11:07 matthavener: clgv: yeah, agreed, if you need the cryptographic collision prevention.. but i'm just referring to the problem that ruby had:

11:08 clgv: where the hashcode was the same for given data on every proecess, so it was trivial to generate collisions that worked against every ruby instance

11:08 according to this: http://vaskoz.wordpress.com/2013/04/06/java-7-hashing-drastically-better-than-java-6/ , hashCode and murmur use some kind of seed entropy

11:10 tbaldridge: I'd have to search the ML but there was a discussion about this about a year or so ago

11:10 some languages like Lua and Ruby IIRC had some serious issues with this, but it wasn't so bad in Clojure.

11:10 felher: Hey folks. I very often would like to use 'type' or 'key' as names for my arguments of some functions. Those names are taken, though, and IIRC it is considered to be bad style shadowing those names. Is there a convention that adresses this problem? Prefixing with '_' for example?

11:13 tbaldridge: part of the problem in Lua was that it only hashed the first 32 characters of the string

11:15 TimMc: hah, nice

11:15 ,(map #(clojure.lang.Util/hasheq %) ["Aa" "BB"])

11:15 clojurebot: (2112 2112)

11:16 cbp: o_O

11:17 TimMc: ,(map #(clojure.lang.Util/hasheq %) ["AaAaAaAa" "BBBBBBBB"])

11:17 clojurebot: (-540425984 -540425984)

11:18 TimMc: hiredman: How recent is clojurebot's clojure.core?

11:18 xeqi: ,*clojure-version*

11:18 clojurebot: {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}

11:19 xeqi: hmm, that doesn't help with the hash changes :/

11:22 TimMc: Oh, wait...

11:22 return Murmur3.hashInt(o.hashCode());

11:22 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L172

11:22 tbaldridge: Yeah, that was put in yesterday

11:22 to handle perf problems with re-hashing large strings.

11:23 TimMc: fail

11:23 tbaldridge: how so?

11:24 TimMc: Well, if the output of hashCode is alreayd a collision, how will running it through Murmur3 do any good?

11:26 ,clojure.lang.Murmur3

11:26 Bronsa: TimMc: I've wondered that too

11:26 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.lang.Murmur3, compiling:(NO_SOURCE_PATH:0:0)>

11:28 Bronsa: TimMc: that collision still happens in clojure HEAD btw

11:30 TimMc: of course

11:32 tbaldridge: did those strings hash differently before this latest patch?

11:33 TimMc: No, that's a known problem with java.lang.String/hashCode

11:34 &(map #(clojure.lang.Util/hasheq %) ["AaAaAaAa" "BBBBBBBB"])

11:34 lazybot: ⇒ (-540425984 -540425984)

11:34 tbaldridge: So the problem is this. Switching to pure Murmur3 causes perf problems when people use large strings as keys (see ML thread on 1.6)

11:34 TimMc: Yeah, I don't have an answer. :-(

11:34 tbaldridge: Switching to the way it is now restores perf at the loss of better hashing for strings.

11:35 Bronsa: tbaldridge: in RC1 they hashed differently, yes

11:35 user=> ,(map #(clojure.lang.Murmur3/hashUnencodedChars %) ["Aa" "BB"])

11:35 (208255379 -1956385023)

11:35 TimMc: tbaldridge: Oh, misunderstood your question, sorry.

11:36 tbaldridge: And I pinged rich off channel for comments about hashing the hashCode of string, reply: "those hashcodes incorporate arithmetic relationships between the values of characters that reemerge when you combine them, rehashing scrambles so that doesn't happen"

11:36 "hashcodes get combined in collection hashes"

11:37 TimMc: what

11:38 OK, brainstorm: Murmur3(o.hashCode() + Murmur3(head(o)))

11:39 That feels icky and I don't know jack about hashing algorithms, but it is probably strictly better than what we have now, in both perf and collision resistance.

11:39 (where head(o) is like Lua's approach(

11:39 tbaldridge: Sadly I don't know much more about any of this to comment, if there are concerns try a ML post. Alex reads those and responds quite quickly.

11:40 TimMc: ok

11:40 tbaldridge: And these days he's kindof the Clojure curator

11:43 clgv: TimMc: I think you are right, that "murmuring" the hashcode java provides defeats the purpuse of using murmur at all in the string case

11:45 humm is string hashing fixed in java 8? there was some talk that hashing was improved in that release

11:46 shep-werk: TimMc: Why murmur the sum of codes?

11:47 Why not just combine them; like o.hashCode *combine* murmur(head(o))

11:47 TimMc: shep-werk: (Not necessarily sum, just some combining function.) Because Murmur is better at hashing strings, but hashCode takes into account the whole string.

11:47 shep-werk: right, that's why you want to combine them; I think we are on the same page

11:47 TimMc: so s/+/⊕/

11:47 shep-werk: heh, is this #APL now

11:47 tbaldridge: The problem wasn't that Murmur wasn't hashing the entire string, the problem is that .hashCode caches the hash. Can't do that if you switch up the hashing method

11:48 TimMc: Alex Miller says that Murmur on String/hashCode is still valuable for the collection hashing characteristics: https://github.com/clojure/clojure/commit/50c9095b3e72b2d7a9a9f93838b147c3d99c6dd0#commitcomment-5744987

11:48 katox: dnolen_: I gave a almost 2.5h talk at Prague Lambda yesterday on om and react, http://www.slideshare.net/katoxidl/om-react-1

11:48 dnolen_: react attracted many newcomers (mostly js devs), Om received more quite a few nods and boomarks, I think you made a few converts yesterday, well done ;)

11:49 dnolen_: katox: that's awesome!

11:50 katox: dnolen_: the coolest part was watching js devs eyeballs rolling when showing them map identity comparison in om source ;)

11:53 dnolen_: katox: heh

11:58 katox: dnolen_: I don't even know when they updated React Dev tools, but when I opened the console the new display names were there, also quite nice

11:58 dnolen_: It might be handy to update om/component to include it by default

11:58 dnolen_: katox: yep, there's no way to include it by default - but there's a ticket for om/component to take an additional parameter for this

11:58 katox: dnolen_: that's what I meant

11:59 CookedGryphon: In core async, is there a neat way to wait on a mult closing?

12:00 Other than consuming and throwing away everything until I get a nil

12:01 tbaldridge: CookedGryphon: nope

12:01 besides a separate "close" channel that you close after the mult closes

12:02 CookedGryphon: tbaldridge: Fair enough, I'll just make a separate close channel for things to listen to rather than consuming it in multiple places

12:06 puredanger: hello gentle Clojure friends

12:06 matthavener: your original question about PHM and collision DoS attacks is a good one

12:07 and something that could be addressed in the Murmur3 class by creating a seed like Java 7 does (or using theirs) instead of seeding to 0

12:07 matthavener: puredanger: thanks :)

12:08 according to this, http://java-performance.info/changes-to-string-java-1-7-0_06/ , in java 7 String has a hash32() method which is cached and seeded via time

12:10 TimMc: Oh huh, I didn't know that Java 7 made String/substring linear.

12:10 puredanger: thx - that's interesting.

12:10 I knew about some but not all of those changes

12:10 I also was not aware that sun.misc.Hashing has a murmur3 impl which we might be able to use directly

12:11 when we require java 7+ that is :)

12:11 * TimMc gives up on navigating the ML interface

12:14 puredanger: you can just mail clojure@googlegroups.com if you're in the group

12:14 TimMc: I was trying to find a/the existing discussion to reply to.

12:15 puredanger: https://groups.google.com/forum/#!topic/clojure/K6W7DbxV0Cw

12:15 mercwithamouth: hmmm so i'm going through web development in clojure. I've just started the picture gallery app and I'm running into a little issue https://gist.github.com/anonymous/9667479

12:16 TimMc: Oh! Thanks.

12:16 mercwithamouth: here's an updated version with my project.clj and handler.clj files https://gist.github.com/anonymous/9667520

12:16 puredanger: TimMc: although, I think it would be perfectly reasonable to raise the cryptographic DoS issue specifically on clojure-dev instead

12:17 cbp: mercwithamouth: need the .repl namespace too

12:17 file i mean

12:17 trptcolin: mercwithamouth: first guess, probably need to (require 'picture-gallery.repl). in-ns doesn't require anything

12:18 mercwithamouth: ahh

12:20 TimMc: (I have a particularly slow internet connection this week, which is making things difficult.)

12:20 clgv: puredanger: you dont want cryptographic hashing in Clojure's datastructuers since you want fast hashing with a good scattering

12:20 but real cryptographic ones are much slower than e.g. murmur

12:21 puredanger: yeah, I'm not suggesting that

12:22 I'm suggesting that creating a per-VM unique seed would be useful as in http://vaskoz.wordpress.com/2013/04/06/java-7-hashing-drastically-better-than-java-6/

12:22 and then using Murmur3 as we do now

12:23 mercwithamouth: hmm still no bueno.

12:23 i'll take a few more minutes to see where my ignorance lies...

12:25 ok

12:29 sandwichmaker: mercwithamouth: from your last gist link I can't see where is the start-server defined. For development, I tipically defined as: (defonce server (run-jetty #'handler/app-handler {:port 8080 :join? false}))

12:31 mercwithamouth: and then (.start server)

12:35 mercwithamouth: ahh i did lein new compojure [blah]... compojure-app gives me the setup i'm familiar with

12:35 sandwichmaker: merchwithamouth: and if you want to know about the different parameters present in that run-jetty map you can go to http://ring-clojure.github.io/ring/ring.adapter.jetty.html

12:35 mercwithamouth: sandwichmaker: yeah, i noticed that when i went back to look at a previous web app i toyed with and realized no project.repl existed in the first place. wrong template =P

12:36 sandwichmaker: mercwithamouth: :)

12:38 mercwithamouth: can't squeeze blood from a turnip...

12:45 TimMc: Hmm, another approach for hashDoS would be to avoid eagerly parsing the querystring and postbody, and instead asking for all params with keys in a known set or matching a pattern.

12:46 You could even use a destructuring syntax, I htink.

12:46 puredanger: TimMc: I notice that they undid a lot of that hashing stuff in Java 8

12:47 looks like they moved it down into hotspot itself for Strings

12:48 http://docs.oracle.com/javase/8/docs/technotes/guides/collections/changes8.html

12:48 they changed hash map impl such that collisions are held as a tree, not a list and address that root problem

12:49 Bronsa: I just realized that in {:AaAa 1 :BBBB 2} the keys will collide because of the last commit

12:51 the collision propagates to keywords and symbols since they use the string hash

12:51 TimMc: Bronsa: But as someone noted on the ML, symbols and keywords have the opportunity to cache their own fancier hashes.

12:51 puredanger: we have a fix for that issue in the queue already (on keywords and symbols)

12:51 Bronsa: puredanger: oh ok

12:52 hyPiRion: huh

12:52 puredanger: we will murmur3 the name and ns parts

12:52 Bronsa: seems reasonable

12:53 puredanger: specifically Util.hashCombine(Murmur3.hashUnencodedChars(name), ns==null?0:Murmur3.hashUnencodedChars(ns))

12:53 TimMc: I'm not a huge fan of converting strings to keywords everywhere (I don't like that they're non-roundtrippable in the general case) but it works out nicely here.

12:53 hlship: Haveing an issue with namespaces and meta-data

12:53 I have a namespace with meta:

12:54 https://gist.github.com/anonymous/cd5db37da6bed1da9a15

12:54 But (-> 'io.aviso.rook-test5 find-ns meta) is nil

12:55 Bronsa: hlship: are you AOT compiling that namesapce?

12:55 hlship: Nope, this is all at the REPL

12:56 tomjack: hashDoS?

12:56 Bronsa: hlship: what version of clojure? this works on my repl

12:56 TimMc: tomjack: http://events.ccc.de/congress/2011/Fahrplan/attachments/2007_28C3_Effective_DoS_on_web_application_platforms.pdf (PDF)

12:56 hlship: 1.5.1

12:56 tomjack: TimMc: this is a problem we already had in 1.5.1?

12:57 hlship: It looks like its an artifact of re-loading a namespace.

12:57 cbp: hlship: maybe you havent required that namespace?

12:57 tomjack: I got scared that a 1.6 RC had a "hashDoS" problem :)

12:57 TimMc: Yeah..

12:57 tomjack: ok, cool

12:57 hlship: It looks like when you re-load a namespace, any meta for it is not changed

12:57 Bronsa: hlship: right

12:57 hlship: is that intentional or a bug?

12:58 Bronsa: honestly I don't know. metadata on namespaces is a bit weird

12:59 hlship: I do get correct results using ns-remove before reloading the namespace

13:00 I know reloading a namespace can be a bit odd

13:00 Bronsa: that's to be expected. right now the behaviour is that the ns gets the metadata of the symbol naming the namespace when the namespace is first created

13:00 hlship: yes, that's not ideal for me

13:01 Bronsa: AFAIK this is what causes problems with metadata on AOT compiled namespaces

13:01 I tried debugging it in the past but got bored before finding a solution.

13:01 hlship: Is this a known issue or should I go add one?

13:02 this is extra wierd in that I'm provding an attribute map for the namespace (as opposed to meta-data on the symbol)

13:02 that should either take precedence or be merged

13:02 I think I'd prefer precendence

13:02 Bronsa: hlship: I don't see a bug in JIRA for this, I'd say go open one

13:03 mmitchell: Question... I have a set of functions, that talk with an http service. In order to facilitate simpler testing, I’d like to pass these functions as an argument to my app code - not reference a namespace. I have this setup as a protocol now, but because I don’t envision ever having alternative implementations (except for tests), but I am considering a map of functions instead. So I guess the question is… is using a protoc

13:03 ol to achieve cleaner testing a valid approach? Or, would using the map of functions be a better way?

13:06 noonian: does anyone know if you can configure light table to recognize certain files that don't have extensions to use a particular language editor?

13:07 i.e. Gemfile or Vagrantfile to use ruby; :lt.objs.files/file-types works great but only seems to be configurable by extension

13:09 hlship: http://dev.clojure.org/jira/browse/CLJ-1389

13:12 mindbender1: ,(dissoc {:a {:b {:c 1}}} [:a :b] :c)

13:12 clojurebot: {:a {:b {:c 1}}}

13:12 TimMc: mindbender1: It's not dissoc-in

13:12 mindbender1: ,(dissoc-in {:a {:b {:c 1}}} [:a :b] :c)

13:12 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dissoc-in in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:12 TimMc: Yeha. :-(

13:13 mindbender1: ,(defn dissoc-in [m ks k]

13:13 (update-in m ks #(dissoc % k)))

13:13 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

13:13 TimMc: *yeah

13:13 mindbender1: And update-in doesn't do the right thing in the base case.

13:13 hyPiRion: It's not evident what dissoc-in would do iirc

13:14 TimMc: mindbender1: And update-in doesn't do the right thing in the base case.

13:14 ugh

13:14 &(update-in {} [] assoc 1 2)

13:14 lazybot: ⇒ {nil {1 2}}

13:14 mindbender1: I think it should be patched then?

13:14 TimMc:

13:17 TimMc: I agree. I don't remember if there's a Jira ticket open for it.

13:18 puredanger: there are at least 2 tickets for this already

13:19 coming at it from different angles

13:19 http://dev.clojure.org/jira/browse/CLJ-373

13:19 mindbender1: puredanger: If you're looking at the link now can you share?

13:19 ok

13:20 puredanger: (was finding - just knew from memory)

13:21 tutysara: I recently started doing frontend development using angular, having used clojure for some time, I am missing the jump-to-source and jump-to-definition functions offered by cider. Do we have anything similar to nrepl for coding interactive javascript with angular

13:21 puredanger: mindbender1: feel free to vote on that if you want to raise visibility, I would like to fix it as it trips people up

13:24 mindbender1: puredanger: sure!

13:31 bodie_: just curious whether anyone's got any input about opengl interfaces for clojure? is LWJGL suitable? I'm working on a game engine right now and weighing between scala, clojure and C++/SDL for my approach.

13:32 stuartsierra: mmitchell: I like the protocol approach, because that's what protocols are for. I assume that virtual method dispatch in Java is always going to be faster than a hash-map lookup.

13:32 mmitchell: stuartsierra: ahh good point

13:34 tbaldrid_: bodie_: the OpenGL interface is so simple just about any Java binding would work

13:34 bodie_: but you haven't explained what you're trying to do

13:37 bodie_: tbaldridge, make an extensible base so I can start some really minimal work on a game -- I have something pretty unique in mind for the mechanics so I'm trying to put my own thing together under the hood

13:37 not quite sure what you're looking for beyond that :)

13:38 jjl`: use unity3d?

13:38 bodie_: doesn't really fit the bill, I'm academically interested in engine programming anyway

13:38 tbaldridge: bodie_: yeah, then a simple OpenGL binding will work. If you were looking to visualize 500GB of medical data, I might suggest something else.

13:39 bodie_: ah, I see

13:39 cause data structures and heap behavior?

13:39 it's a voxel rts kind of thing with lots of units on screen, so... might be vaguely comparable

13:39 why?

13:39 clojurebot: why not?

13:40 bodie_: ^ clever :D

13:40 jballanc: clojurebot: botsnack

13:40 clojurebot: Thanks, but I prefer chocolate

13:41 jballanc: clojurebot: chocolate

13:41 clojurebot: actually I decided I prefer botsnacks after all.

13:41 jballanc: clojurebot: recursion

13:41 clojurebot: Gabh mo leithscéal?

13:41 arrdem: (inc clojurebot)

13:41 lazybot: ⇒ 35

13:41 hyPiRion: oh woah, when did clojurebot reply on chocolate? That's a neat easter egg

13:45 tbaldridge: bodie_: there's some technical stuff that may cause issues if you're attempting to stream tons of data to/from a GPU. I don't see it being a problem for most games as you'll probably stream the data once and leave it there

13:46 bodie_: namely, Clojure likes to work with doubles and not floats. So if you're doing tons of CPU processing of float data you might run into issues.

13:47 like I said, not a problem for a prototype, and easy enough to work around when it comes to optimizing. That's what I love about Clojure easy to prototype, not hard to optimize when the time comes.

13:53 borkdude: Does this, or something similar already exist in clojure? https://www.refheap.com/62421

13:55 ssa: does anyone know how to intern a defmethod?

13:57 amalloy: ssa: they're not interned, so no

13:57 ssa: ok

13:57 amalloy: borkdude: that looks like comp?

13:57 ssa: maybe i should describe my problem

13:58 i'm using liberator and trying to override one of its defmethods -- specifically its json encoding

13:58 amalloy: like, (filter= :a 2 coll) is (filter (comp #{2} :a) coll)

13:59 ssa: i added a defmethod in my project that i thought would "override" the original

13:59 it does seem to override it some, but not all the time

13:59 so i thought it could be a binding issue?

13:59 is this a good intuition or no?

14:01 amalloy: ssa: probably not. if you succeed in overwriting a defmethod, the original is gone and nobody's the wiser. perhaps liberator sometimes goes through that defmulti and sometimes does something else, or perhaps it sometimes has a different dispatch value and thus goes through a different method

14:02 ssa: interesting, ok, thanks amalloy. i'll do some more investigating, cheers

14:03 amalloy: or you might be reloading the liberator namespaces, which re-tramples back over your definition, ssa

14:05 bodie_: thanks for the input, tbaldridge

14:06 ssa: i see what you're saying; i have a feeling that isn't happening -- only one endpoint has this problem (defmethod isn't overwritten), whereas the other endpoints are ok (defmethod is overwritten)

14:06 SegFaultAX: Anyone played with EEP?

14:11 AeroNotix: is weavejester around?

14:11 or do they have a different handle in IRC?

14:13 hyPiRion: $seen weavejester

14:13 lazybot: weavejester was last seen joining on clojure 2 weeks ago.

14:13 AeroNotix: heh, nice!

14:32 borkdude: What is the common clojure way to deal with (compare 1 "foo") => Exception?

14:32 amalloy thanks for your reply earlier

14:32 amalloy: borkdude: you're welcome. and: use a different/custom comparator

14:33 borkdude: I kind of solved it like this: (compare 1 (if (string? v) nil v))

15:56 amalloy: borkdude: that's fine if you're calling compare by hand, but that seems pretty rare to me: most uses of compare will be from trying to put things in a sorted collection, no?

16:00 ToBeReplaced: can someone point me to an example using reduced? and reduced

16:01 justin_smith: http://kunstmusik.com/2014/03/20/clojure-and-bluecsound-example/ blog post on using clojure with blue (a java csound frontend)

16:03 JavaIsAwful: csound? why use csound when there's overtone

16:03 ToBeReplaced: nevermind reduced question, got there

16:04 AeroNotix: is it a pita to integrate midje and core.test?

16:04 or will it be fine enough?

16:07 justin_smith: JavaIsAwful: csound has better performance, more diversity in its audio processing functions, and better low level control. The main benefit of sc is the more flexible language, which you are going around anyway with a clojure frontend.

16:07 JavaIsAwful: I suppose that's a good point

16:07 the clojure frontend bit

16:08 didn't know csound performed better than sc

16:08 justin_smith: I switched from sc csound when I got a nokia n900

16:08 dacc: i thought sc was more interactive than csound?

16:08 justin_smith: on a small mobile device like that, csound was fully functional (and much fun) and sc was useless

16:08 dacc: latest csound allows definition of instruments at runtime

16:09 (and redefinition)

16:09 it also compiles to pnacl such that you can run it in a chrome browser(!)

16:09 bob2: AeroNotix, integrate how?

16:10 pretty sure midje runs core.test tests

16:10 justin_smith: http://vlazzarini.github.io/ (link to run csound in your browser)

16:12 I have thought of using clojurescript to control the pnacl csound port

16:17 ToBeReplaced: does reducers/fold allow you to set reduced on each subgroup? can't seem to get it to function

16:17 dacc: justin_smith: wow cool

16:18 garietyxxx: Hi, #clojure, I'd like to write a Node.js app in Clojure, but I'm confused as to ClojureScripts association with the Closure compiler. Google Closure and Node use different `require` formats, so how could they possibly work together?

16:19 justin_smith: dacc: be sure to check out stria

16:19 an excellent piece of computer music, all algrorithmic, generated in the browser

16:21 dbell: is there a clean idiomatic way to have to two different datatypes share implementation of the same protocol? Would you just write a common function and then reference the function when extending?

16:22 amalloy: ToBeReplaced: i wouldn't expect reduced to make sense in the context of a fold

16:26 dbell: you can use extend (rather than extend-type/extend-protocol) to pass in a map of all the functions. otoh, you may want to double-check whether you really want a protocol and not just a function, if you need multiple identical implementations

16:26 seangrove: dnolen_: I'd like my components to implement another protocol, zr/IPreview, and to have my Om instrumentation be able to select between using om/IRender and zr/IPreview - basically swapping out the rendering methods. Any ideas on how to approach that

16:26 ?

16:27 stuartsierra: garietyxxx: I think ClojureScript apps targeting Node.js do not use the G.Closure compiler. But it's not an area I know much about.

16:27 dbell: sorry, I realized i wasn't clear;

16:27 it's a third-party type/protocol pair

16:27 amalloy: yikes. i mean, it's not against the law, but you should be cautious when extending a protocol you don't control for a type you don't control

16:28 dbell: oh, sorry

16:28 still not clear

16:28 trying to extend the protocol

16:28 to *my* type

16:28 and wanting to use the implementation of the 3rd-party type

16:28 i mean i can just copy paste

16:28 but...

16:29 amalloy: so type T implements protocol P, and you want an identical implementation for your type S?

16:29 seangrove: dbell: You want a type that basically wraps a third-party type, so you can safely extend protocols to it?

16:29 dbell: yeah

16:30 justin_smith: dacc: woah, going directly to that piece, I see it is by the guy who invented FM synthesis http://vlazzarini.github.io/stria

16:30 amalloy: there's not much to share then

16:31 dbell: yeah something tells me i've got a logic problem rather than a not-knowing-clojure-feature problem

16:31 amalloy: you just have to copy/paste or something, if the code is not in a function you can use

16:31 dnolen_: seangrove: what's the difference between those two methods exactly?

16:33 seangrove: dnolen_: One renders a dummy/mockup version of the component (possibly with drop-target for sub-components to be built) with resizing/editing handles, the other renders exactly as the production version of the component

16:35 dnolen_: I think I can work around it by making IPreview return a separate Om component. It was messy last time I tried, but I might have better context for it now

16:35 dnolen_: seangrove: why can't you handle this with :instrument? You can intercept and back with a component that will call the preview method instead?

16:37 seangrove: dnolen_: I can, but ultimately Om is going to call (render ...) on it, so I can't provide a preview method alongside my Om methods easily - right now they're separate components

16:37 dnolen_: seangrove: "back with a React component that call preview method instead"

16:37 seangrove: Ahh, ok

16:37 Got it

16:38 dnolen_: seangrove: look at how Pure is constructed now in master

16:38 seangrove: you can just create your like Pure is constructed but you just assoc in your custom render method

16:38 om.core/build takes :ctor so you can use your own constructor instead of `pure`

16:39 seangrove: dnolen_: Looks good, thanks

16:41 dnolen_: seangrove: let me know how that goes, that's a pretty cool use of :instrument, replacing all the standard Om components with a custom thing

16:42 seangrove: dnolen_: Just wrapped my head around :instrument yesterday, cleaned up quite a bit of stuff

16:42 dnolen_: seangrove: nice

16:56 JavaIsAwful: when you guys GPL your clojure projects, what do you typically put under :license :name in your project.clj?

16:56 just GNU General Public License?

16:56 or do you include "version 3" after, or whatever version

16:59 bts-: JavaIsAwful: https://github.com/search?q=license+GNU+path%3Aproject.clj&type=Code&ref=searchresults

16:59 JavaIsAwful: bts-: good to see there's no consensus :D

17:12 eraserhd_: Is there a lein plugin that checks for dependency updates?

17:12 eraserhd: Oops.

17:12 technomancy: JavaIsAwful: the GPL is incompatible with Clojure's own license

17:13 devth_: eraserhd: https://github.com/xsc/lein-ancient

17:13 JavaIsAwful: technomancy: but that doesn't mean I can't use it, right?

17:13 technomancy: I'm not licensing clojure with it

17:13 technomancy: JavaIsAwful: you're licensing a derivative work

17:14 hiredman: technomancy: are you a lawyer? you have to tell me if you are

17:14 JavaIsAwful: or a cop

17:14 gotta tell us if you're a cop

17:14 gfredericks: or an angel

17:15 joegallo: he's not a cop, seriously, though, how about that meth?

17:16 technomancy: joegallo: https://twitter.com/NotAPoliceman/status/263447666376187904

17:16 arohner: hiredman: lol

17:16 hiredman: as long as technomancy has some too, then we are ok under attorney client privilege

17:16 joegallo: technomancy: "crime men" i'm dying

17:20 JavaIsAwful: lol, this is pretty great

17:20 thanks for giving me something to waste the next 5 minutes reading

17:24 well, that was a fun 5 minutes

17:27 gfredericks: yeah that was great now lets all go do our favorite drugs and tell each other what/where we're doing

17:34 technomancy: and when

17:39 JavaIsAwful: I'll be going to the corner of 5th and main with my kilo of heroin, everyone and their non-cop friends should join me #yolo #notacop

17:39 at exactly 6pm EST

17:51 arrdem: where's Bronsa when you need him :c forget the time delay between the US and Italy.

17:55 amalloy: arrdem: you can $mail him

17:56 not synchronous, of course, but if your development process relies on synchronous access to bronsa you're probably out of luck

17:57 arrdem: hey now.. synchronous access to Clojure contributors tends to be an amazingly viable assumption

17:57 see my last 20 months of bothering yall successfully :P

18:01 JavaIsAwful: does using () vs [] make a difference when I use :import?

18:01 in (ns), that is

18:01 gtrak: () is weird imo

18:02 JavaIsAwful: yeah

18:02 I don't like it

18:02 gtrak: but it works

18:02 JavaIsAwful: but [] will work the same?

18:02 gtrak: yea

18:02 JavaIsAwful: ok good

18:02 cbp: java is the best

18:02 JavaIsAwful: I'm looking at a clojure.contrib example that uses [] for everything but :import

18:02 gtrak: ns is a macro, so normally, (blah would call a function called blah, but it just takes it as a list

18:02 JavaIsAwful: gtrak: makes sense

18:02 gtrak: since that's what makes macros macros

18:03 JavaIsAwful: is there any way to force evaluation in a macro's arguments?

18:03 gtrak: the key question is 'when'

18:03 JavaIsAwful: when is there a way?

18:04 gtrak: when do you want it to be evaluated

18:04 JavaIsAwful: no particular example, just wondering

18:04 gtrak: this: http://www.infoq.com/presentations/Clojure-Macros

18:04 tbaldridge: JavaIsAwful: it's purely convention, there is no difference between using [] or () in a ns

18:07 JavaIsAwful: does paredit have a way to convert ()'s to []'s?

18:07 gtrak: JavaIsAwful: so that's the long answer, the short answer is you can run eval yourself on the arg in the body of the macro to eval at compile-time, and if the macro returns a data structure, it'll be evaluated just like normal code.

18:07 JavaIsAwful: gtrak: I see

18:08 gtrak: macros run at compile-time, outside-in.

18:08 JavaIsAwful: right

18:08 gtrak: if the return result contains the arg, that'll get evaluated at run-time.

18:09 cbp: JavaIsAwful: yes it does

18:09 gtrak: with normal function call order

18:09 cbp: JavaIsAwful: But I dont remember the keybinding ahahah

18:09 JavaIsAwful: cbp: that's just about everything in paredit for me

18:09 C-left and C-right are about all I can remember :P

18:10 which are really annoying, because I have to move my right hand :\

18:10 Frozenlock: Paredit is making me crazy

18:11 But apparently it's the best thing since sliced bread...

18:11 JavaIsAwful: Frozenlock: when doing something in paredit makes your hair fall out, don't forget M-x disable-paredit-mode

18:12 tbaldridge: Frozenlock: it takes a bit to get used to, but once you do it's really nice

18:12 _2_Heben2: olaao

18:13 cbp: Actually now tit

18:13 er

18:13 now that i remember I

18:13 * cbp curses his keyboard

18:13 Frozenlock: always the keyboard

18:13 cbp: now that I remember it might've been light table or emacs live that had it

18:14 because I remember removing it

18:29 JavaIsAwful: does cider have a keybinding or command to do a `lein run` on the current project?

18:33 cbp: JavaIsAwful: it has a keybinding for jack-in which is kinda like lein repl but not lein run afaik

18:36 JavaIsAwful: cbp: yeah I know about jack-in

18:36 I guess I could jack-in to my project's main file and run (-main) myself

18:38 cbp: JavaIsAwful: Just be careful it doesnt kill your emacs :-D

18:40 JavaIsAwful: cbp: why would it do that?

18:40 I seem to remember that happening in the past

18:40 but never understanding why

18:40 or maybe I'm just thinking about when I got infinite recursion and emacs locked up

18:41 cbp: I dont know it's been a long time since i started a clojure app from emacs, I think i had problems when I ran stuff like shutdown-agents

18:41 JavaIsAwful: and I got to run my favorite shell command

18:41 `killall java` :::)

18:46 so I noticed in the examples for tools.cli, they do things like #(Integer/parseInt %)

18:47 I saw that and thought "that's redundant, I'll just do Integer/parseInt, without the anonymous function"

18:47 lo and behold, I get an exception about being unable to find static field parseInt

18:47 unless I do it like they did

18:47 cbp: static methods arent first class

18:47 amalloy: methods aren't first-class values

18:47 JavaIsAwful: ah

18:47 is there any other way to wrap them in a function?

18:47 Wild_Cat: are they not?

18:48 Aww :(

18:48 JavaIsAwful: seems like an ugly way to do things

18:48 amalloy: well uh...use a lambda. like the example

18:48 you couldn't really ask for a more convenient way

18:48 JavaIsAwful: I'd rather do something like (some-function Integer/parseInt)

18:48 tried partial but it didn't work

18:49 I mean, using lambdas means assuming something about the arguments it takes

18:49 amalloy: it's not possible if some-function is a function, because Integer/parseInt is not a value. if it were, you wouldn't need to do this at all. you can do it as a macro, which is fine, but it's not really exciting

18:49 brehaut: there is memfn but why be silly. use the lambda

18:49 JavaIsAwful: ohhhh

18:49 amalloy: brehaut: memfn doesn't work for non-member functions

18:49 (as implied by its name)

18:49 brehaut: oh thats a static, sorry

18:49 JavaIsAwful: now I understand

18:50 but non-static methods *are* first class?

18:51 brehaut: no method is first class

18:51 myguidingstar: hi all, I tried Overtone on my Linux box and it crashed whenever I call `(use 'overtone.live)`

18:51 JavaIsAwful: whoops, well running (-main) from cider crashed cider

18:51 myguidingstar: here's the output https://gist.github.com/myguidingstar/897664b8c0c61f89556e

18:51 I tried to google but found nothing

18:54 JavaIsAwful: is there any good clojure frontend for doing sockets stuff?

18:55 cbp: java.web.socket :-P

18:55 JavaIsAwful: I said clojure!!! :P

18:56 cbp: maybe aleph

18:56 $google clojure aleph

18:56 lazybot: [ztellman/aleph · GitHub] https://github.com/ztellman/aleph

18:56 amalloy: aleph, and there's another one. clj-http, or http-kit or something?

18:57 cbp: that's actually java.net.Socket duh

18:57 amalloy: cbp: uggghhhhhh, i can't imagine the pain of trying to implement websockets on top of Socket

18:57 clojurebot: Excuse me?

18:57 amalloy: clojurebot: nobody asked you

18:57 clojurebot: No entiendo

18:57 cbp: http-kit has good websocket support

18:58 brehaut: clj-http is the requests library

18:58 noonian: yeah, depends if you want tcp sockets or websockets

18:59 http-kit is good for websockets but no socket support afaict

18:59 JavaIsAwful: actually, I just need to do udp sockets, not http

19:00 yedi_: newb question: i want to work from within the context of namespace in my repl, how would I go about doing that?

19:00 i'm trying to use (in-ns <namespace>) but none of the vars from the namespace seem to be loaded. Also I lose my other core functions like `use` and `keys`

19:00 is there a better way to do this

19:00 cbp: yedi_: require the namespace first

19:00 before you in-ns

19:00 noonian: JavaIsAwful: aleph is probably what you want: https://github.com/ztellman/aleph/wiki/UDP

19:01 cbp: or.. load-file

19:01 amalloy: yedi_: in-ns doesn't load any code, it just goes into a namespace (creating it empty if it isn't already loaded)

19:01 JavaIsAwful: noonian: ooh, this actually looks pretty good

19:01 amalloy: require is for loading namespaces from disk

19:02 JavaIsAwful: wait, is that the entire documentation for UDP? lol

19:02 cbp: JavaIsAwful: read the source! :-P

19:02 JavaIsAwful: cbp: lul

19:03 there's this too: http://ideolalia.com/aleph/aleph.udp-api.html

19:03 noonian: it looks like it just delegates to netty

19:03 yedi_: cbp amalloy: many thanks

19:04 JavaIsAwful: wait, does using two names like that highlight it for both of them?

19:04 in irc

19:07 back in 10, about to cook up some chickens

19:11 yedi_: i want to use my library in another project, what do I have to do to make my library lein friendly?

19:11 is there a guide i could look at?

19:11 justin_smith: yedi_: you probably want to put it on clojars

19:11 technomancy: yedi_: try `lein help tutorial`

19:12 yedi_: sweet, will check it out

19:21 amalloy: JavaIsAwful: it depends on the recipients' clients, of course - highlighting isn't a part of the irc protocol. but just about every client takes notice when your username appears anywhere in any message

19:29 JavaIsAwful: I'm baaack

19:29 amalloy: I knew it wasn't part of the IRC protocol, but there seem to be common conventions

19:30 I always thought it looked at the start or end of a message for your name, but I guess it really is just looking for your name anywhere in the message

19:31 justin_smith: it's 100% up to the client

19:32 JavaIsAwful: justin_smith: I know, but there are some pretty standard things that clients do

19:37 so I left out a dependency in my project.clj

19:37 and the error message I got was a ClassNotFound exception for my project's core class

19:37 how does that make any sense?

19:38 chare: ok we have two projects that need solved

19:38 (1) make clojure framework that beats out ruby on rails

19:38 amalloy: you were unable to load your project's class, because loading it depended on loading some other stuff. it should be in the stacktrace, probably as a Caused By

19:38 justin_smith: ns declaration fails because dep is missing so that class does not exist

19:38 chare: (2) why is there no tail call optimization in JVM? writing clojure code without recursion is really annoying.

19:39 JavaIsAwful: (recur)

19:39 chare

19:39 chare: recur is really annoying to use

19:39 JavaIsAwful: welp, that's how you do TCO

19:40 chare: why didn't tail call optimization ever get added to jvm

19:40 JavaIsAwful: because it's java

19:40 rasputnik: chare: pay Larry Ellison, he'll hook you up

19:40 JavaIsAwful: java's icky

19:42 chare: and what happens if you need to tail call a totally different function

19:42 then you can't use looping

19:42 beamso: trampoline

19:43 technomancy: if lack of TCO is the biggest problem in your life you've got it pretty good

19:43 beamso: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6804517

19:43 scheduled for jdk9

19:45 chare: omg thats going to take forever, 8 just got released

19:45 seangrove: Can't tell if that's serious or not

19:46 JavaIsAwful: maybe when I implement mini-java in my compiler class next semester, I'll add TCO

19:46 /s

19:47 justin_smith: JavaIsAwful: I'll one up you by making a primitive, crude version of tail call which I will name the bootycall

19:48 JavaIsAwful: lol

20:01 amalloy: JavaIsAwful: if you do implement a compiler at all, adding tco is really easy. it's only hard for java because of other decisions that have since been made that depend on not having tco

20:01 JavaIsAwful: amalloy: hmm, well maybe that's what I'll do then

20:02 from what I've heard about past years, the semester-long project is to implement a certain subset of java, plus one new thing

20:03 chare: amalloy: you suggesting we switch to racket/scheme for a clean start?

20:05 arrdem: JavaIsAwful: ohai bro

20:08 brehaut: apropos: http://i.imgur.com/5X3VwOy.png

20:08 JavaIsAwful: arrdem: eyy

20:08 brehaut: (via @webyrd)

20:09 technomancy: brehaut: that expression... so much pain.

20:09 brehaut: which?

20:10 (please excuse my uncaffenated friday brain)

20:10 cbp: its thursday

20:10 technomancy: the pic you linked to

20:10 brehaut: not in new zealand

20:10 cbp: oh i guess

20:10 * cbp bows in shame

20:10 brehaut: cbp: living in the future isnt all its cracked up to be

20:11 technomancy: oh, yes indeed

20:13 JavaIsAwful: brehaut: what's today's winning lottery number?!

20:13 brehaut: that's yesterday for you, I guess

20:16 amalloy: aussies have the future knowledge to win the lottery, but not the inclination. the prize is always a dropbear

20:18 SegFaultAX: brehaut: Was that a plea for generalized TCO or only direct recursion?

20:19 brehaut: SegFaultAX: i assume that with a picture of Steele, its generalized TCO?

20:20 you have as much context as i do though

20:21 SegFaultAX: Maybe. Even if Java only supported self recursive tail calls, that'd be a huge step up.

20:22 hiredman: http://openjdk.java.net/projects/mlvm/subprojects.html

20:23 the oracle bug database says the tco bug is targeted at version 9

20:25 the continuation bug says the same thing though

20:25 arrdem: continuations in Java....

20:25 okay.

20:25 amalloy: yeah, i assume 9 isn't getting any of this stuff. 9 is just the current "sounds cool" bin

20:25 arrdem: sounds about right to me

20:25 SegFaultAX: That would be awesome, even if it was only at the bytecode level. Native call/cc

20:26 arrdem: I think they'd just add an interproc GOTO first and let library / lang authors fudge it from there...

20:26 were such a thing to ever happen.

20:26 JavaIsAwful: lol, aleph's documentation is pretty top-tier

20:26 it linked to this page https://github.com/ztellman/lamina/wiki/Result-Channels

20:27 SegFaultAX: JavaIsAwful: I'm sure he'd love to have your help!

20:27 JavaIsAwful: SegFaultAX: if only I had the time :)

20:27 or understood how his libraries worked

20:28 arrdem: one day I will finish cloutjure... then we will all get karma for PRs :P

20:29 beamso: if i have a protocol and types that implement that protocol, does the protocol create an interface and do the types implement the interface?

20:30 amalloy: JavaIsAwful: https://github.com/amalloy/hermes/blob/master/src/flatland/hermes/server.clj is a project i did at my last job, using aleph's websocket implementation. it has some other stuff that you don't care about, but https://github.com/amalloy/hermes/blob/master/src/flatland/hermes/server.clj#L132 is most of the webserver

20:31 beamso: yogthos: i'm cool with that, but (instance? selmer.node.INode selmer.node.TextNode) returns false for me.

20:31 yogthos: beamso: not sure why that's happening...

20:31 this all lives here https://github.com/yogthos/Selmer/blob/master/src/selmer/node.clj

20:32 beamso: maybe that means i was getting INode instances whereas everyone else is getting TextNode instances

20:32 amalloy: basically a function gets called whenever a client connects, and you get a lamina channel to talk to them over. enqueue data into the channel to write to the client, receive to read from them

20:32 yogthos: beamso: you should always get either a FunctionNode or a TextNode instance

20:33 amalloy: beamso: protocol implementations don't necessarily implement any interface

20:33 they satisfy a protocol, and sometimes that's done by implementing an interface, but it's not required

20:34 JavaIsAwful: thank you amalloy, that's probably the most helpful thing anybody could have said :)

20:34 yogthos: indeed :)

20:34 beamso: amalloy: so if i've typehinted a parameter to a function call, it could go wrong?

20:34 amalloy: don't typehint protocol functions. there's no reason

20:35 i'm looking at you too, yogthos - what is the deal with the ^String in that code you pasted?

20:35 yogthos: amalloy: seemed like a good idea at the time :P

20:35 amalloy: beamso: in the selmer example, it looks like those types *do* implement the interface

20:35 but (instance some-class other-class) is never true

20:36 instance? wants an object and a class, not two classes

20:36 (yes, yes, (instance? Class other-class) works specifically for java.lang.Class, but that's not the point)

20:38 beamso: would there be something with reloading a repl that could break that instance? call?

20:42 amalloy: yes. i intended to say as much myself, but then i got sidetracked

20:42 (this assumes you mean a sensible instance? call, and not one comparing two classes)

20:43 if you (def n (TextNode.)) (require :reload 'selmer.whatever) (def m (TextNode.)), now m and n are of different classes

20:43 beamso: yeah, i worked out that using the instance and the class worked, so my apologies to both yourself and yogthos on getting that wrong.

20:43 yogthos: no worries

20:43 beamso: oh, that would explain why i was only getting the error on repl reload.

20:48 SegFaultAX: Oh the fun of redefining vars at the REPL.

20:55 JavaIsAwful: amalloy: in your hermes project, did you do any client side stuff?

20:55 or just server-side?

20:56 amalloy: oh, I see from your readme that there is a client

20:56 but it appears to be all js

20:57 I'm sure I'll figure it out in clojure

21:08 amalloy: y u no follow 80 character law?

21:09 hlship: Doing some interesting work combining Ring and core.async right now. I'll be able to make it public in a bit.

21:09 JavaIsAwful: I don't want to make my editor wider to read your code :(

21:17 brehaut: JavaIsAwful: i believe you mean the 1980s character law

21:30 akhudek: what would prevent fold from parallelizing?

21:30 JavaIsAwful: isn't there a parallelized fold in the reducers library?

21:31 akhudek: JavaIsAwful: yes, but one of my coworkers is finding that it's not using more than a single cpu in particular application: https://www.refheap.com/ca4a1f117b952a2d8e2193e3e

21:32 gfredericks: does it sound plausible that reply mis-parses "foo//"?

21:32 akhudek: everything looks right to me, and it certainly should give a speedup given the profiling I've done

21:32 gfredericks: does reply just use the builtin reader?

21:42 amalloy: gfredericks: i think it uses tools.reader

21:43 akhudek: lazy sequences aren't random-access, so folding is not possible

21:43 hiredman: amalloy: parallel folding is not possible

21:44 amalloy: yes, sorry

21:45 akhudek: amalloy: thanks, I thought it might be something like that but wasn't sure if it batched non-random access sequences or something.

21:50 gfredericks: ,clojure.core//

21:50 clojurebot: #<core$_SLASH_ clojure.core$_SLASH_@24764f>

21:50 gfredericks: https://github.com/trptcolin/reply/issues/136

21:54 seangrove: Oh man, love this https://bugzilla.mozilla.org/show_bug.cgi?id=505521#c4

22:17 yedi: technomancy: wow.. that was incredibly simple. lein is quite tight

22:17 technomancy: thanks

22:19 JavaIsAwful: so what are the idomatic ways of handling byte streams in clojure?

22:20 I need to create and read datagram packets at the raw bytes level

22:20 should I just be using ByteBuffer or whatever it's called?

22:24 technomancy: copying into bytearrayoutputstream is the normal way I think

22:26 malyn: You may also want to look at https://github.com/ztellman/byte-streams ; Aleph and Lamina have some built in byte stream support if you are using those (by way of ztellman's gloss).

22:27 hiredman: JavaIsAwful: it really depends on whatever the library you are using uses

22:28 JavaIsAwful: I've decided to just use java.net.DatagramSocket

22:28 hiredman: yeah, so that uses byte arrays

22:28 JavaIsAwful: I'm trying to do things like put a short, followed by a string, into a byte array

22:29 hiredman: JavaIsAwful: ah, well wrapping the byte array with a bytebuffer can make that easier

22:29 (ByteBuffer/wrap ...)

22:30 gfredericks: lol I did `lein help tutorial` and the first thing it did was start copying dependencies

22:30 JavaIsAwful: why is ByteBuffer abstract?

22:30 that doesn't make sense to me

22:30 shriphani: hi. how do I make lein use the pom.xml that I have in my java source directory ? I can build a jar with maven but lein can't seem to compile it

22:30 malyn: JavaIsAwful: Maybe take a look at gloss then? It gives you a DSL for encoding/decoding byte arrays. https://github.com/ztellman/gloss/wiki/Introduction

22:30 hiredman: JavaIsAwful: because there are different kinds, heap and direct(native?)

22:31 JavaIsAwful: the javadoc only lists MappedByteBuffer as a subclass

22:31 which is also abstract

22:32 is that just because the others aren't in java.nio?

22:32 hiredman: ,(class (java.nio.ByteBuffer/allocate 1))

22:32 clojurebot: java.nio.HeapByteBuffer

22:32 hiredman: maybe they aren't public

22:32 doesn't matter

22:33 wrap is all you'll need

22:34 yedi: so here, I'm opening a file that's in the libraries folder/repo -- https://github.com/yedi/rhyme-finder/blob/master/src/clj/rhyme_finder/core.clj#L15

22:34 but when I add that repo as a dependency in a different project, I get this error: Exception in thread "main" java.io.FileNotFoundException: cmudict.txt (No such file or directory), compiling:(core.clj:15:34)

22:35 JavaIsAwful: okay, I think I get it now

22:35 yedi: if I add the cmudict file to the new project, the lib works. but how can i fix rhyme-finder so that it opens/looks for the file from within its own jar

22:35 hiredman: yedi: you need to put the file in resources/ and load it from the class path using clojure.java.io/resource

22:35 JavaIsAwful: If I do .putShort, it should automatically cast to short, right?

22:36 yeah, it does

22:36 hiredman: it depends on the type, more complicated conversions won't happen automatically

22:36 ,(byte \c)

22:36 clojurebot: 99

22:36 hiredman: clojurebot: jerk

22:36 clojurebot: you cut me deep, man.

22:37 gfredericks: (defn -main [] (def the-server (start-server)))

22:37 hiredman: gfredericks: :(

22:37 gfredericks: kinda useful though...

22:37 hiredman: (def the-server) (defn -main [] (alter-var-root #'the-server (constantly (start-server))))

22:37 gfredericks: compared to that repetitive option

22:37 hiredman: don't put defs inside things

22:38 gfredericks: I know I just thought this was an interesting use case, since I don't know of concrete downsides and the alternative is repetitive

22:40 ,(def x (def y (def z (def w 'def))))

22:40 clojurebot: #'sandbox/x

22:40 gfredericks: ,x

22:40 clojurebot: #'sandbox/y

22:40 gfredericks: ,y

22:40 clojurebot: #'sandbox/z

22:40 gfredericks: ,z

22:40 clojurebot: #'sandbox/w

22:40 gfredericks: ,w

22:40 clojurebot: def

22:40 gfredericks: well that was exciting

22:41 JavaIsAwful: I think I just got a small stroke from looking at that

22:41 hiredman: gfredericks: the issue is def causes a var to get interned during compilation, but putting the def inside a function means it won't get a value until the function is run

22:42 cminus: JavaIsAwful: You'll have to run through unchecked-short and friends to use bytebuffer

22:42 JavaIsAwful: (doc unchecked-short)

22:42 gfredericks: hiredman: sure, but again for this particular use case I can't imagine that backfiring

22:42 clojurebot: "([x]); Coerce to short. Subject to rounding or truncation."

22:42 JavaIsAwful: cminus: even if I know the values are valid shorts?

22:43 hiredman: gfredericks: just because it works doesn't mean it is good

22:43 gfredericks: hiredman: yeah it's ethically indefensible

22:45 ArchPy: So is Clojure just a trendy language?

22:45 gfredericks: hiredman: come to think of it, your "won't get a value until the function is run" point applies to the alter-var-root alternative just as much

22:45 hiredman: gfredericks: no, the var has a value in that case, nil

22:45 gfredericks: ,(def hiredman)

22:45 clojurebot: #'sandbox/hiredman

22:45 gfredericks: ,hiredman

22:45 clojurebot: #<Unbound Unbound: #'sandbox/hiredman>

22:45 cminus: JavaIsAwful: I ended up doing it that way. Reading and writing to a serial port.

22:45 hiredman: well damn

22:46 anyway, at least it reads as getting no value

22:47 instead of (def foo ...) which reads like foo should have a value

22:47 SegFaultAX: ArchPy: It's trending right now, yes, but that shouldn't suggest it isn't also being used in industry.

22:47 gfredericks: fair enough

22:48 shriphani: has anyone had success with large java codebases and lein ?

22:49 hiredman: the larger the code base the more likely it is that it is taking advantage of some feature of a java build system which lein doesn't expose or have

22:49 ArchPy: SegFaultAX: How is it being used?

22:50 JavaIsAwful: is there a reader syntax for shorts?

22:50 shriphani: hiredman, I can compile with mvn install

22:50 the java codebase i.e.

22:50 I am not sure how to make lein use mvn install

22:51 SegFaultAX: ArchPy: In many of the same places that you might expect Java, Scala, Python, or Ruby for example.

22:51 hiredman: shriphani: why bother?

22:51 shriphani: hiredman, because I want to build.....

22:51 so here's my situation

22:52 ArchPy: SegFaultAX: Do you prefer Clojure over Python?

22:52 shriphani: one of the components of said java codebase I want to extend with clojure and use it from the java app

22:52 JavaIsAwful: ArchPy: as someone who started programming on Python, and loves it to bits, I personally like clojure more now

22:53 shriphani: because I have a lot of code written in clojure and porting to java is going to be a big waste of my time.

22:53 hiredman: shriphani: since the project already builds using maven, perhaps the clojure maven plugin would be a better bet

22:53 SegFaultAX: ArchPy: By a large margin, yes.

22:53 seangrove: Hey guys, I just implemented a semi-hacky drag-and-drop bit of code! For the browser! I don't think anyone had done it before, because if they had, I can't see why it wouldn't be built into the browser properly

22:53 shriphani: oh I didn't know such a thing existed

22:53 hiredman: shriphani: depending on what the clojure code does, you may just be able to include it as a resource on the maven build

22:54 shriphani: hiredman, it basically extends a java class.

22:54 hiredman: no "build" of it required

22:54 shriphani: in what way, gen-class?

22:54 shriphani: I am using :gen-class to do it and override a method

22:54 yes

22:54 hiredman: shriphani: ah, yeah, you'll want the maven plugin

22:55 I am not sure what the state of the maven plugin is, before lein existed it was what people used

22:56 beamso: i think it's still being used

22:56 the clojure.java.jdbc project using the clojure-maven-plugin

22:56 *uses

22:56 shriphani: hiredman, would that essentially mean continuing to use the java project ?

22:56 so I wanted to somehow let clojure take control of the situation

22:56 and say have my main class invoke its main

22:57 it = java

22:57 hiredman: shriphani: then make a clojure lein project that depends on your maven project as a library

22:57 shriphani: hiredman, so the class I am extending needs to be seen by another component

22:58 JavaIsAwful: just took another look at Gloss frames

22:58 and realized just how beautiful they are

22:58 exactly what I need

22:58 shriphani: and when I tried using a jar I built and a localrepo, then I could call the java project's main but it couldn't see my new class

22:58 hiredman: that isn't going to work with lein anyway, lein doesn't compile java and clojure together somehow, it compiles java using javac, then compiles clojure

22:58 shriphani: ok so I don't have an alternative I gues

22:58 yedi: ty hiredman, that did the trick

22:59 hiredman: shriphani: most likely because you didn't aot compile

22:59 shriphani: hiredman, I've got :aot :all in my project.clj

22:59 and I did lein uberjar

23:01 but yeah I just used the compiled jars from that project

23:01 but if I could somehow make my extended class visible, that would be like problem solved essentially

23:01 ArchPy: SegFaultAX: Can you speak to the advantages of Clojure over python?

23:02 yedi: seangrove: can i hear more about the drag n drop doowicky

23:03 shriphani: ArchPy, you have all of java.

23:03 there is no real python alternative to stuff like stanford-corenlp

23:03 ArchPy: shriphani: That seems like a distinct advantage of Python, no java. :p

23:05 shriphani: hiredman, although is it possible?

23:06 to somehow make my extended class visible to classes in that jar I already have

23:06 seangrove: yedi: Just making a generic-ish draggable Om component

23:07 yedi: got code anywhere?

23:08 seangrove: yedi: Just started in on it, but here are some draggable circles https://www.refheap.com/62598

23:08 SegFaultAX: ArchPy: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

23:08 JavaIsAwful: ArchPy: check out clojure-py. basically take clojure, and replace java with python, and you have clojure-py

23:08 though it's not as developed as vanilla clojure

23:09 Frozenlock: seangrove: Ahhhh so much Om everywhere! :p

23:09 seangrove: Frozenlock: ?

23:10 Frozenlock: Sorry, Om always scares me :p

23:10 seangrove: Hrm, alright...

23:11 Frozenlock: seangrove: This might interest you: If you use the html Draggable tag with https://github.com/alandipert/storage-atom, you can have some pretty nice cross tabs/windows drag n drop.

23:12 JavaIsAwful: do gloss's frames order the bytes the same way they're ordered in the frame map you give it?

23:12 seangrove: Yeah, that's a pretty cool library

23:12 ArchPy: SegFaultAX: I will check that out

23:13 Frozenlock: seangrove: give it a try http://hvac.io. Go in the controllers tab. Duplicate your browser window and drag n drop between them. Much fun! :-D

23:14 ArchPy: JavaIsAwful: checking that out. thank you.

23:14 seangrove: Frozenlock: Wow, nice!

23:14 JavaIsAwful: ArchPy: just be careful, there are a few bits of syntax that are different

23:15 ArchPy: mainly with things that interact with the underlying language

23:15 Frozenlock: seangrove: The app uses Reagent (alternative to Om) to render stuff from some atoms. The atoms are kept in sync between windows by using the storage-atom.

23:18 verma: Frozenlock, pretty cool!

23:18 seangrove: Frozenlock: I agree, pretty cool

23:19 Frozenlock: Thanks :)

23:20 The advantage over the vanilla html DnD is that you can access complex EDN --while-- you are dragging.

23:20 This is what enables the color change.

23:29 Anyhow... now I want an undo library for react.js

23:29 Any volunteer to implement Gundo/undo-tree? :-p

23:36 amalloy: JavaIsAwful: yes, frames are decoded in the same order as the input map

23:36 and because maps are not guaranteed to have any particular order, gloss provides an ordered-map construct of some kind; i forget where it is

23:36 JavaIsAwful: amalloy: ah, I saw something like that

23:36 figured that's why it was there

23:43 I see that you can put a fixed value in for one of the frame fields

23:43 e.g. I could do this (compile-frame {:a 2})

23:43 but not strings it seems

23:43 is there a workaround?

23:44 wait, maybe I'm misunderstanding what's giving me an error

23:46 now I see, I was just putting keyvals in incorrectly

23:46 I thought I had to group them like [key val] [key val]

Logging service provided by n01se.net