2014-03-20
| 00:08 | SegFaultAX | Has anyone here ever tried to embed elasticsearch in their application? |
| 00:11 | technomancy | SegFaultAX: as I understand it, elasticsearch is a distributed dynamo-style cluster; not sure how that would work. |
| 00: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) |
| 00:12 | SegFaultAX | http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html |
| 00:13 | technomancy | not sure what the point of ES is if you don't have clustering though? |
| 00:14 | technomancy | just use lucene |
| 00:14 | SegFaultAX | It still connects to the cluster. |
| 00:14 | SegFaultAX | It works exactly the same way, just embedded. |
| 00:14 | SegFaultAX | "When you start a Node, it joins an elasticsearch cluster." - that page I linked |
| 00:14 | technomancy | I guess you would gain faster access for whatever data happens to be on the local node? |
| 00:15 | technomancy | might make sense for smaller corpuses |
| 00:15 | hiredman | technomancy: it isn't a data node |
| 00:15 | SegFaultAX | technomancy: Actually in this case I'm wondering if it would ease deployment if I want to use elastic beanstalk or something. |
| 00:15 | hiredman | technomancy: what we did before we switched to the rest api |
| 00:16 | SegFaultAX | I guess I could deploy ES directly to EB. |
| 00: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? |
| 00:16 | technomancy | skip a hop or whatever |
| 00:17 | hiredman | technomancy: if I recall, yeah |
| 00:18 | SegFaultAX | Anyway, it doesn't seem like it'd be that hard to do. Maybe not worth it though. |
| 00:19 | SegFaultAX | 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. |
| 00:20 | hiredman | SegFaultAX: that is not really how es works |
| 00:20 | SegFaultAX | hiredman: In what way do you mean? |
| 00:21 | SegFaultAX | I had a ~5 node cluster at my last company so I'm familiar running it as a silo'd service. |
| 00: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 |
| 00:23 | SegFaultAX | Yea that was my main concern, too. |
| 00:23 | SegFaultAX | 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 |
| 00:23 | SegFaultAX | Basically they had an embedded solr instance in each app node (also Clojure) |
| 00:24 | SegFaultAX | And I've heard of a similar architecture at Guardian (one of the tech leads gave a talk about it) |
| 00: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 |
| 00:26 | SegFaultAX | (Relevant guardian talk: http://www.infoq.com/presentations/guardian-content-api) |
| 00:26 | SegFaultAX | hiredman: Why do you think that won't work for ES? |
| 00:26 | hiredman | SegFaultAX: es is clustered |
| 00:27 | hiredman | SegFaultAX: they are talking about non-clustered completely indepedent solr instances |
| 00:27 | hiredman | the clustering will not respond well to many and rapid changes in cluster membership |
| 00:27 | SegFaultAX | Well it's not like instances come up and down every couple minutes. |
| 00:28 | SegFaultAX | But I see your point anyway. |
| 00:28 | hiredman | if your data set is small enough for one machine, just build and ship lucene indices, no need for solr or es |
| 00: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. |
| 00: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 |
| 00:37 | dakrone | (sometimes) |
| 00:58 | jph- | dakrone, btw, thanks for cheshire |
| 00:59 | dakrone | jph-: you're welcome! |
| 01:12 | jph- | is it ok to put bigger functions in your (extend-type or should call functions defined elsewhere? |
| 01:12 | jph- | i kinda feel like the latter is the better approach |
| 01:12 | jph- | they otherwise feel hidden away in (extend-type |
| 01:22 | vertup | f/clear |
| 01:23 | jph- | accidentally left a () in my code, the stack trace was less than helpful |
| 01:32 | turbofail | it always is |
| 01: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 :/ |
| 02:11 | michel_slm | hi everyone |
| 02:11 | michel_slm | what's the best practice for dealing with dependencies pulling multiple versions of some components like clojure? |
| 02:27 | storme | echo ,(println "&(+ 1 2)") |
| 02:27 | lazybot | ,(println "&(+ 1 2)") |
| 02:27 | clojurebot | &(+ 1 2)\n |
| 02:27 | storme | echo ,(println "(+ 1 2)") |
| 02:27 | lazybot | ,(println "(+ 1 2)") |
| 02:27 | clojurebot | (+ 1 2)\n |
| 02:27 | katratxo | michel_slm: perhaps using `:exclusions` ? https://github.com/search?l=Clojure&q=%3Aexclusions&ref=advsearch&type=Code |
| 02:28 | katratxo | https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L48 |
| 02:31 | michel_slm | katratxo: aha, thanks. |
| 02:31 | michel_slm | 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 |
| 03: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 |
| 03:13 | opqdonut | akhudek: you import edu.washington.cs.knowitall.regex.RegularExpressionParser, you refer to them with RegularExpressionParser/character and RegularExpressionParser/word |
| 03:13 | opqdonut | akhudek: as you can see they're not really classes, but fields |
| 03:14 | akhudek | opqdonut: that's what I thought too, but it's giving me illegal access errors |
| 03:14 | opqdonut | mm, sorry, I typoed |
| 03:14 | opqdonut | should be RegularExpressionParser_s_ and RegularExpressionParser_s_/character |
| 03:14 | opqdonut | akhudek: weird, could you paste the error somewhere?= |
| 03:15 | dbasch | is there a way to know if a compojure route would match a path without calling it? |
| 03:15 | akhudek | https://www.refheap.com/3b078fda1a1cb483a50207b32 |
| 03:19 | akhudek | there is serious magic going on in this library |
| 03:19 | akhudek | https://github.com/knowitall/openregex/blob/master/src/main/java/edu/washington/cs/knowitall/regex/RegularExpression.java |
| 03:19 | akhudek | at the bottom you can see it use RegularExpressionParsers |
| 03:19 | akhudek | but it never imports it |
| 03:19 | akhudek | O.o |
| 03:20 | opqdonut | akhudek: it's in the same package, no need to import |
| 03:21 | opqdonut | akhudek: I just checked and I can access "public static final" fields ok |
| 03:22 | akhudek | opqdonut: yeah, I've done it before too. Not sure why this one isn't working. |
| 03:27 | ArchPy | I was told to come here to learn more. |
| 03:27 | SegFaultAX | What do you want to know? |
| 03:28 | ArchPy | Why is clojure worth paying attention to? |
| 03:29 | SegFaultAX | Are you primarily a Python hacker? |
| 03:31 | jack_rabbit | Clojure is probably one of the easier functional languages to write significant applications in. And lisp is great. |
| 03: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? |
| 03:35 | tsdh | I know I can use take-while/drop-while, but those are linear whereas special sorted-set aware functions could be logarithmic. |
| 03:37 | ArchPy | SegFaultAX I work primarily with python and powershell |
| 03:37 | ArchPy | 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. |
| 03:38 | akhudek | opqdonut: I think the reason is that RegularExpressionParsers itself is not marked public |
| 03:40 | SegFaultAX | ArchPy: Well other people have spent a lot of time and effort describing the wonderful and attractive aspects of clojure. |
| 03:41 | SegFaultAX | They do it more justice than I can off the cuff here. Try googling "why clojure" or something. |
| 03:42 | scottj | here's one http://clojure.org/rationale |
| 03:42 | opqdonut | akhudek: riiiight, yeah |
| 03:42 | opqdonut | akhudek: so it has only package visibility |
| 03:43 | SegFaultAX | Or here: http://www.quora.com/Clojure/Why-would-someone-learn-Clojure |
| 03:44 | SegFaultAX | Or here: http://michaelochurch.wordpress.com/2013/08/07/why-clojure-will-win/ |
| 03:52 | jph- | how might i thread-first this... (merge (get {:a 1} :b) (get {:a 1 :b 2} :b)) ? |
| 03:53 | jph- | i know how to thread-first (-> {:a 1} (get :b) (merge)) |
| 03:53 | jph- | woops, its the second get im not sure how to represent |
| 03:58 | scottj | jph-: I don't think there's a reason to thread that. (merge (map :b [{:a 1} {:a 1 :b 2}] |
| 03: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. |
| 03:59 | jph- | scottj, i havent seen it written that way, cheers |
| 03:59 | beamso | isn't a :: symbol the symbol for the current namespace |
| 04:00 | jph- | *ns* |
| 04:00 | jph- | ,*ns* |
| 04:00 | clojurebot | #<Namespace sandbox> |
| 04:00 | scottj | beamso: that's for keywords, which I think are called symbols in other languages |
| 04:00 | beamso | ,(symbol "foo") |
| 04:00 | jph- | learnt that when playing with macros |
| 04:00 | clojurebot | foo |
| 04:03 | tsdh | Just to make my point clear: how can I distinguish `foo and 'foo? |
| 04:03 | tsdh | ,[(name 'foo) (name `foo) (= 'foo `foo)] |
| 04:03 | clojurebot | ["foo" "foo" false] |
| 04:03 | jph- | user=> (symbol (str *ns*) "help") |
| 04:03 | jph- | user/help |
| 04:03 | jph- | then you can (resolve ..) |
| 04:03 | jph- | and (deref (resolve ..)) |
| 04:04 | tsdh | jph-: That requires that foo is an existing var which it is not in my case. |
| 04:06 | tsdh | 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. |
| 04:07 | tsdh | (Plus some extra logic for let, loop, and fn, etc.) |
| 04:10 | tsdh | Argh, that was way too obvious: ,(namespace `foo) |
| 04:10 | tsdh | ,(namespace `foo) |
| 04:10 | clojurebot | "sandbox" |
| 04:10 | tsdh | :-) |
| 04:10 | jph- | hah |
| 04:10 | jph- | nice |
| 04:34 | jph- | silly question, whats the purpose of including type in a functions parameter list |
| 04:34 | jph- | it's not casting is it? |
| 04:35 | jph- | (def x [^java.math.BigDecimal y] y) |
| 04:35 | TEttinger | that's a type hint |
| 04:35 | jph- | for when you are (doc x) ? |
| 04:35 | jph- | ie, is it more for self-documenting code |
| 04:35 | beamso | the type hint is to prevent using reflection when executing methods/functions |
| 04:36 | scottj | jph-: clojurebook.com or read all the docs on clojure.org |
| 04:36 | beamso | lein check tells you the methods in your project that are using reflection |
| 04:36 | jph- | beamso, ahh, got it |
| 04:36 | beamso | i think *warn-on-reflection* is the setting in the repl |
| 04:36 | TEttinger | type hints are important for making clojure run faster, and the doc thing is nice too |
| 04:37 | jph- | oh so it also allows optimization when JITing |
| 04:37 | jph- | ok |
| 05:40 | ivan-kanis | what's the equivalent of CL progn in clojure? |
| 05:40 | clgv | ivan-kanis: `do` |
| 05:41 | ivan-kanis | ok |
| 05:41 | clgv | ,(do (println 1) (println 2) 3) |
| 05:41 | clgv | &(do (println 1) (println 2) 3) |
| 05:41 | lazybot | ⇒ 1 2 3 |
| 05:41 | clojurebot | 1\n2\n3 |
| 05:41 | clgv | hm ok not that illustrative with the bots |
| 05:42 | clgv | &(+ 5 (do (println 1) (println 2) 3)) |
| 05:42 | lazybot | ⇒ 1 2 8 |
| 05:42 | ivan-kanis | no worry |
| 05:42 | ivan-kanis | How do I close the cider repl? |
| 05:43 | ArchPy | Clojure for sys admin projects? yea or nay? |
| 05:44 | pyr | ArchPy: what type specifically |
| 05:44 | ArchPy | pyr: Mostly task automation. But of every kind really. |
| 05:44 | ivan-kanis | nm it's C-c C-q |
| 05:44 | ArchPy | In a mixed enviroment windows and linux |
| 05:45 | mskoud | If startup time is not an issue, i dont see why not. |
| 05:45 | ArchPy | mskoud: How is Clojure with .NET? |
| 05: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 |
| 05:48 | ArchPy | pyr: I'm curious as to what that would be? |
| 05:48 | clgv | ArchPy: probably "nay" when you need fast startup times |
| 05:48 | pyr | ArchPy: because clojure doesn't even remotely look like bash |
| 05:49 | pyr | ArchPy: mostly :-) |
| 05:50 | clgv | ArchPy: Clojure CLR is tracking Clojure JVM closely afair |
| 05: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. |
| 05:51 | ArchPy | I mean, I guess I do use bash. But not really in the toolmaking category. |
| 05:52 | clgv | ArchPy: powershell has a tight .NET integration right? |
| 05:52 | ArchPy | I guess I was wondering if there are any unique advantage to using Clojure for toolmaking |
| 05:52 | ArchPy | clgv: It's ridiculously good. Super-fast and easy. |
| 05:53 | ArchPy | 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. |
| 05: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 |
| 05:54 | ArchPy | clgv: Could you rephrase that? I dont think I totally understood you. |
| 05:59 | rocknrollMarc | powershell is windows only right? |
| 05:59 | rocknrollMarc | have you tryed the fish shell? that one realy kicks as |
| 05:59 | rocknrollMarc | s |
| 06:00 | xsyn | zsh ? |
| 06:00 | rocknrollMarc | http://fishshell.com/ |
| 06:01 | rocknrollMarc | 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 |
| 06:01 | rocknrollMarc | is you have a mac and use vim like me have a look at this please https://github.com/skwp/dotfiles |
| 06:35 | dsrx | who needs fish or zsh when you have eshell? ;) |
| 06:39 | xsyn | or cshell |
| 06:39 | xsyn | (on the sea shore) |
| 06:53 | sm0ke | hello all |
| 06:53 | sm0ke | what clojure datastructure should i use which is composite and comparable aprt from lists vectors |
| 06:54 | sm0ke | ,(sort [{:a 1} {:a 3}]) |
| 06:54 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Comparable> |
| 07:11 | CookedGryphon | sm0ke: what are you trying to achieve there? |
| 07:11 | CookedGryphon | ,(sort-by key [{:a 1} {:a 3}]) |
| 07:11 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry> |
| 07:11 | CookedGryphon | oh, oops |
| 07:11 | sm0ke | ,(sort-by :a [{:a 1} {:a 3}]) |
| 07:11 | clojurebot | ({:a 1} {:a 3}) |
| 07:11 | CookedGryphon | ,(sort-by :a [{:a 1} {:a 3}]) |
| 07:11 | clojurebot | ({:a 1} {:a 3}) |
| 07:12 | sm0ke | yea i dont want to sort, i want data abstraction which can have multiple components and be comparable |
| 07:13 | sm0ke | so for instance ##(sort [[:a 1] [:a 2] [:a -1] [:z 0]]) |
| 07:13 | lazybot | ⇒ ([:a -1] [:a 1] [:a 2] [:z 0]) |
| 07:13 | sm0ke | makes sense right? |
| 07:14 | sm0ke | but only that i am not allowed to use list |
| 07:15 | sm0ke | athough weird requirement, i think one way would be to have a Record which implments Comparable |
| 07:17 | sm0ke | its weird though that maps have equality but are not comparable |
| 07:17 | sm0ke | ,(= {:a 1} {:a 1}) |
| 07:17 | clojurebot | true |
| 07:17 | sm0ke | ,(compare {:a 1} {:a 1}) |
| 07:17 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Comparable> |
| 07:22 | pyrtsa | sm0ke: Unlike equality comparison, there is no cheap inequality comparison for maps. |
| 07:23 | pyrtsa | So that's, AFAICT, the reason there is no such thing defined by default. |
| 07:23 | sm0ke | true |
| 07: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.) |
| 07:26 | sm0ke | unless its a sorted map |
| 07:26 | sm0ke | ,(compare (sorted-map :a 1) (sorted-map :a 1)) |
| 07:26 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be cast to java.lang.Comparable> |
| 07:27 | pyrtsa | Why don't you just create your own comparator for that? |
| 07:27 | sm0ke | yea doing that |
| 07:35 | clgv | ArchPy: my guess is that Clojure CLR interop with .NET is probably as good as Clojure JVM interop with the JVM/Java |
| 07:35 | clgv | ArchPy: I did not tray it yet though |
| 07:38 | CookedGryphon | does anybody know of any libraries which nicely wrap safe posixy atomic file operations? |
| 07:39 | CookedGryphon | I can't seem to find anything |
| 07:40 | sm0ke | CookedGryphon: wouldnt anything over jvm be already posixy? |
| 07:41 | CookedGryphon | different part of posix :P I mean the safe atomic read/write conventions |
| 07:41 | CookedGryphon | 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 |
| 07: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 |
| 07:44 | clgv | BartAdv: ah ok. yeah in .NET genrics are at vm-level right? |
| 07:45 | BartAdv | yes |
| 07:46 | sm0ke | anyone working with nippy had problem with de/se of Records? |
| 08:32 | abcdw | Are any GSoC mentors here? |
| 08:48 | clgv | abcdw: more likely in a few hours (2-3) |
| 09:05 | abcdw | why this channel is so silent?) |
| 09:05 | teslanick | People are busy working on great stuff? |
| 09:06 | clgv | because the vast number of US people is not here, yet |
| 09:06 | fu86 | Is there a function to prepend a string to another which I can use in a (-> ...) form? |
| 09:06 | cemerick | +1 to irc channels that aren't busy just to be busy :-) |
| 09:07 | clgv | fu86: I guess you are not threading the prefix, right? |
| 09:07 | clgv | fu86: in that case you probably need a custom function to do that |
| 09:07 | fu86 | clgv: ok, thanks |
| 09:09 | hyPiRion | fu86: ##(-> "foobar" ((partial str "p:"))) |
| 09:09 | lazybot | ⇒ "p:foobar" |
| 09:10 | hyPiRion | eventually just use ##(-> "foobar" (->> (str "p:")) (str "-postfix)) |
| 09:10 | cemerick | there's always ##(-> "foobar" (->> (str "p:"))) |
| 09:10 | lazybot | ⇒ "p:foobar" |
| 09:10 | cemerick | my irc game has gone stale :-P |
| 09:11 | hyPiRion | cemerick: well, you didn't forget to end the string :) |
| 09:12 | fu86 | is ->> inside a -> okay? |
| 09:13 | cemerick | it's probably overly-clever, but yes |
| 09:13 | hyPiRion | I tend to use as-> inside -> in small doses, so I guess it is okay |
| 09:13 | cemerick | as-> is perhaps a better option |
| 09:14 | fu86 | thanks a lot! |
| 09: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 :) |
| 09:15 | clgv | hyPiRion: yeah but this form defeats the point of the threading somehow |
| 09:15 | fu86 | okay. I still having some trouble finding "the clojure way"^TM |
| 09:40 | jjl` | /win 42 |
| 09:40 | fu86 | http://hastebin.com/jupapeyixe.lisp |
| 09:40 | fu86 | is there a better way to write this? |
| 09:40 | devn | so weird and "magic" that midje has "typo tolerance" just 'cause |
| 09:41 | devn | "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--." |
| 09:41 | devn | blech. |
| 09:43 | shep-werk | devn: metaconstant is close enough to magicconstant anyway ;-) |
| 09: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" |
| 09:44 | devn | that's where you just go: |
| 09:46 | jjl` | they do this in npm |
| 09:48 | mikerod | ,(let [or #'clojure.core/or] (or 1 2)) |
| 09:48 | clojurebot | nil |
| 09:49 | mikerod | ,(let [or #'clojure.core/or] (or 1 2)) |
| 09:49 | clojurebot | nil |
| 09:49 | mikerod | Why? |
| 09:49 | clojurebot | http://clojure.org/rationale |
| 09:50 | clgv | mikerod: first of all `or` is a macro so that did not have any chance to work at all |
| 09:55 | shep-werk | clgv: the macroexpand for it looks reasonable though... |
| 09:55 | shep-werk | ,(let* [or #'clojure.core/or] (let* [or__3943__auto__ 1] (if or__3943__auto__ or__3943__auto__ 2))) |
| 09:55 | clojurebot | 1 |
| 09: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 |
| 09:57 | berdario | (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) |
| 09:57 | berdario | I guess that the execution order of functions sent in this way isn't well defined... is this expected behavior? |
| 09:58 | Bronsa | mikerod: you need to take into account &form and &env |
| 09:59 | Bronsa | ,(#'or nil nil 1 2) |
| 09: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 | mikerod | I have a chunk of unevaluated code. I want to qualify all of the unqualified symbols in it, if they can be. |
| 10:10 | mikerod | but I want to respect local shadowing. |
| 10:10 | mikerod | So I had this good idea, of just shadowing all the symbols |
| 10:10 | mikerod | In an outer-let |
| 10:11 | mikerod | that wraps the original form |
| 10:11 | mikerod | ... |
| 10:11 | clgv | shep-werk: nothing. as Bronsa pointed out there are the two "hidden" parameters to every macro |
| 10:12 | clgv | 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 | mikerod_ | I think I've heard of it before. |
| 10:13 | mikerod_ | I am curious about this behavior though. I guess I could dig into the evaluation to understand it. |
| 10:13 | mikerod_ | ,(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 | mikerod_ | ,(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 | Bronsa | &form and &env |
| 10:14 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: form in this context |
| 10:14 | mikerod_ | ah |
| 10:14 | mikerod_ | Bronsa: I see what you mean now. |
| 10:14 | mikerod_ | 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 | TimMc | In master, it uses Util/hasheq, which for String uses the Murmur3 hash. |
| 11:01 | TimMc | ,*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 | matthavener | 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 | matthavener | 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 | tbaldridge | 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 | TimMc | ,(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 | TimMc | return Murmur3.hashInt(o.hashCode()); |
| 11:22 | TimMc | 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 | tbaldridge | 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 | TimMc | ,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 | TimMc | &(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 | Bronsa | user=> ,(map #(clojure.lang.Murmur3/hashUnencodedChars %) ["Aa" "BB"]) |
| 11:35 | Bronsa | (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 | tbaldridge | "hashcodes get combined in collection hashes" |
| 11:37 | TimMc | what |
| 11:38 | TimMc | OK, brainstorm: Murmur3(o.hashCode() + Murmur3(head(o))) |
| 11:39 | TimMc | 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 | TimMc | (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 | clgv | 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 | shep-werk | 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 | katox | 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 | katox | 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 | CookedGryphon | Other than consuming and throwing away everything until I get a nil |
| 12:01 | tbaldridge | CookedGryphon: nope |
| 12:01 | tbaldridge | 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 | puredanger | matthavener: your original question about PHM and collision DoS attacks is a good one |
| 12:07 | puredanger | 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 | matthavener | 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 | puredanger | I knew about some but not all of those changes |
| 12:10 | puredanger | I also was not aware that sun.misc.Hashing has a murmur3 impl which we might be able to use directly |
| 12:11 | puredanger | when we require java 7+ that is :) |
| 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 | cbp | 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 | clgv | but real cryptographic ones are much slower than e.g. murmur |
| 12:21 | puredanger | yeah, I'm not suggesting that |
| 12:22 | puredanger | 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 | puredanger | and then using Murmur3 as we do now |
| 12:23 | mercwithamouth | hmm still no bueno. |
| 12:23 | mercwithamouth | i'll take a few more minutes to see where my ignorance lies... |
| 12:25 | mercwithamouth | 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 | sandwichmaker | 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 | TimMc | 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 | puredanger | looks like they moved it down into hotspot itself for Strings |
| 12:48 | puredanger | http://docs.oracle.com/javase/8/docs/technotes/guides/collections/changes8.html |
| 12:48 | puredanger | 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 | Bronsa | 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 | hlship | I have a namespace with meta: |
| 12:54 | hlship | https://gist.github.com/anonymous/cd5db37da6bed1da9a15 |
| 12:54 | hlship | 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 | hlship | 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 | Bronsa | 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 | hlship | 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 | hlship | that should either take precedence or be merged |
| 13:02 | hlship | 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 | mmitchell | 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 | noonian | 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 | mindbender1 | (update-in m ks #(dissoc % k))) |
| 13:13 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 13:13 | TimMc | *yeah |
| 13:13 | TimMc | 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 | TimMc | ugh |
| 13:14 | TimMc | &(update-in {} [] assoc 1 2) |
| 13:14 | lazybot | ⇒ {nil {1 2}} |
| 13:14 | mindbender1 | I think it should be patched then? |
| 13:14 | mindbender1 | 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 | puredanger | coming at it from different angles |
| 13:19 | puredanger | 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 | mindbender1 | 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 | tbaldrid_ | 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 | bodie_ | 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 | bodie_ | cause data structures and heap behavior? |
| 13:39 | bodie_ | it's a voxel rts kind of thing with lots of units on screen, so... might be vaguely comparable |
| 13:39 | bodie_ | 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 | tbaldridge | 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 | tbaldridge | 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 | ssa | 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 | ssa | it does seem to override it some, but not all the time |
| 13:59 | ssa | so i thought it could be a binding issue? |
| 13:59 | ssa | 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 | AeroNotix | 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 | borkdude | 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 | AeroNotix | 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 | JavaIsAwful | the clojure frontend bit |
| 16:08 | JavaIsAwful | 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 | justin_smith | dacc: latest csound allows definition of instruments at runtime |
| 16:09 | justin_smith | (and redefinition) |
| 16:09 | justin_smith | it also compiles to pnacl such that you can run it in a chrome browser(!) |
| 16:09 | bob2 | AeroNotix, integrate how? |
| 16:10 | bob2 | pretty sure midje runs core.test tests |
| 16:10 | justin_smith | http://vlazzarini.github.io/ (link to run csound in your browser) |
| 16:12 | justin_smith | 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 | justin_smith | 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 | amalloy | 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 | seangrove | ? |
| 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 | dbell | 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 | dbell | still not clear |
| 16:28 | dbell | trying to extend the protocol |
| 16:28 | dbell | to *my* type |
| 16:28 | dbell | and wanting to use the implementation of the 3rd-party type |
| 16:28 | dbell | i mean i can just copy paste |
| 16:28 | dbell | 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 | seangrove | 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 | seangrove | Got it |
| 16:38 | dnolen_ | seangrove: look at how Pure is constructed now in master |
| 16:38 | dnolen_ | seangrove: you can just create your like Pure is constructed but you just assoc in your custom render method |
| 16:38 | dnolen_ | 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 | JavaIsAwful | just GNU General Public License? |
| 16:56 | JavaIsAwful | 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 | JavaIsAwful | 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 | JavaIsAwful | 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 | JavaIsAwful | thanks for giving me something to waste the next 5 minutes reading |
| 17:24 | JavaIsAwful | 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 | JavaIsAwful | 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 | amalloy | 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 | arrdem | 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 | JavaIsAwful | in (ns), that is |
| 18:01 | gtrak | () is weird imo |
| 18:02 | JavaIsAwful | yeah |
| 18:02 | JavaIsAwful | 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 | JavaIsAwful | C-left and C-right are about all I can remember :P |
| 18:10 | JavaIsAwful | which are really annoying, because I have to move my right hand :\ |
| 18:10 | Frozenlock | Paredit is making me crazy |
| 18:11 | Frozenlock | 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 | cbp | er |
| 18:13 | cbp | now that i remember I |
| 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 | cbp | 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 | JavaIsAwful | 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 | JavaIsAwful | I seem to remember that happening in the past |
| 18:40 | JavaIsAwful | but never understanding why |
| 18:40 | JavaIsAwful | 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 | JavaIsAwful | `killall java` :::) |
| 18:46 | JavaIsAwful | so I noticed in the examples for tools.cli, they do things like #(Integer/parseInt %) |
| 18:47 | JavaIsAwful | I saw that and thought "that's redundant, I'll just do Integer/parseInt, without the anonymous function" |
| 18:47 | JavaIsAwful | lo and behold, I get an exception about being unable to find static field parseInt |
| 18:47 | JavaIsAwful | 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 | JavaIsAwful | is there any other way to wrap them in a function? |
| 18:47 | Wild_Cat | are they not? |
| 18:48 | Wild_Cat | 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 | amalloy | 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 | JavaIsAwful | tried partial but it didn't work |
| 18:49 | JavaIsAwful | 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 | amalloy | (as implied by its name) |
| 18:49 | brehaut | oh thats a static, sorry |
| 18:49 | JavaIsAwful | now I understand |
| 18:50 | JavaIsAwful | 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 | myguidingstar | 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 | cbp | $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 | noonian | 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 | yedi_ | 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 | yedi_ | is there a better way to do this |
| 19:00 | cbp | yedi_: require the namespace first |
| 19:00 | cbp | 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 | JavaIsAwful | 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 | JavaIsAwful | in irc |
| 19:07 | JavaIsAwful | 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 | yedi_ | 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 | JavaIsAwful | amalloy: I knew it wasn't part of the IRC protocol, but there seem to be common conventions |
| 19:30 | JavaIsAwful | 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 | JavaIsAwful | so I left out a dependency in my project.clj |
| 19:37 | JavaIsAwful | and the error message I got was a ClassNotFound exception for my project's core class |
| 19:37 | JavaIsAwful | how does that make any sense? |
| 19:38 | chare | ok we have two projects that need solved |
| 19:38 | chare | (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 | JavaIsAwful | 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 | chare | 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 | beamso | 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 | JavaIsAwful | /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 | JavaIsAwful | 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 | brehaut | (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 | brehaut | cbp: living in the future isnt all its cracked up to be |
| 20:11 | brehaut | technomancy: oh, yes indeed |
| 20:13 | JavaIsAwful | brehaut: what's today's winning lottery number?! |
| 20:13 | JavaIsAwful | 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 | brehaut | 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 | hiredman | the oracle bug database says the tco bug is targeted at version 9 |
| 20:25 | hiredman | the continuation bug says the same thing though |
| 20:25 | arrdem | continuations in Java.... |
| 20:25 | arrdem | 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 | arrdem | were such a thing to ever happen. |
| 20:26 | JavaIsAwful | lol, aleph's documentation is pretty top-tier |
| 20:26 | JavaIsAwful | 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 | JavaIsAwful | 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 | yogthos | 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 | amalloy | 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 | amalloy | 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 | amalloy | but (instance some-class other-class) is never true |
| 20:36 | amalloy | instance? wants an object and a class, not two classes |
| 20:36 | amalloy | (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 | amalloy | (this assumes you mean a sensible instance? call, and not one comparing two classes) |
| 20:43 | amalloy | 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 | JavaIsAwful | or just server-side? |
| 20:56 | JavaIsAwful | amalloy: oh, I see from your readme that there is a client |
| 20:56 | JavaIsAwful | but it appears to be all js |
| 20:57 | JavaIsAwful | I'm sure I'll figure it out in clojure |
| 21:08 | JavaIsAwful | 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 | amalloy | 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 | JavaIsAwful | I need to create and read datagram packets at the raw bytes level |
| 22:20 | JavaIsAwful | 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 | hiredman | (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 | JavaIsAwful | 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 | JavaIsAwful | which is also abstract |
| 22:32 | JavaIsAwful | 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 | hiredman | doesn't matter |
| 22:33 | hiredman | 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 | yedi | 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 | JavaIsAwful | yeah, it does |
| 22:36 | hiredman | it depends on the type, more complicated conversions won't happen automatically |
| 22:36 | hiredman | ,(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 | gfredericks | ,(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 | hiredman | anyway, at least it reads as getting no value |
| 22:47 | hiredman | 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 | shriphani | the java codebase i.e. |
| 22:50 | shriphani | 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 | shriphani | 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 | hiredman | shriphani: in what way, gen-class? |
| 22:54 | shriphani | I am using :gen-class to do it and override a method |
| 22:54 | shriphani | yes |
| 22:54 | hiredman | shriphani: ah, yeah, you'll want the maven plugin |
| 22:55 | hiredman | 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 | beamso | the clojure.java.jdbc project using the clojure-maven-plugin |
| 22:56 | beamso | *uses |
| 22:56 | shriphani | hiredman, would that essentially mean continuing to use the java project ? |
| 22:56 | shriphani | so I wanted to somehow let clojure take control of the situation |
| 22:56 | shriphani | and say have my main class invoke its main |
| 22:57 | shriphani | 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 | JavaIsAwful | and realized just how beautiful they are |
| 22:58 | JavaIsAwful | 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 | shriphani | and I did lein uberjar |
| 23:01 | shriphani | but yeah I just used the compiled jars from that project |
| 23:01 | shriphani | 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 | shriphani | 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 | shriphani | 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 | JavaIsAwful | 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 | JavaIsAwful | 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 | Frozenlock | The advantage over the vanilla html DnD is that you can access complex EDN --while-- you are dragging. |
| 23:20 | Frozenlock | This is what enables the color change. |
| 23:29 | Frozenlock | Anyhow... now I want an undo library for react.js |
| 23:29 | Frozenlock | 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 | amalloy | 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 | JavaIsAwful | figured that's why it was there |
| 23:43 | JavaIsAwful | I see that you can put a fixed value in for one of the frame fields |
| 23:43 | JavaIsAwful | e.g. I could do this (compile-frame {:a 2}) |
| 23:43 | JavaIsAwful | but not strings it seems |
| 23:43 | JavaIsAwful | is there a workaround? |
| 23:44 | JavaIsAwful | wait, maybe I'm misunderstanding what's giving me an error |
| 23:46 | JavaIsAwful | now I see, I was just putting keyvals in incorrectly |
| 23:46 | JavaIsAwful | I thought I had to group them like [key val] [key val] |