#clojure logs

2014-02-19

00:00noprompt;)
00:00_ericdoesn't help me with \" though
00:00noprompt_eric: youre editor doesn't help you w/ that?
00:00_ericwhat do you mean by help?
00:01nopromptdammit i cannot type. :(
00:01noprompt_eric: ie. "foo | bar" (type "" at |) => "foo \" bar"
00:01nopromptthe editor doesn't automatically escape it for you?
00:02_ericI guess not
00:02noprompt_eric: hmm. are you using paredit?
00:02_ericintellij/cursive is failing me
00:02_ericI guess
00:03noprompt_eric: ah, i think there's a paredit mode for it. i've used it just a tincy bit when pairing w/ folks but i don't recall if it does *that* automatically. ;_;
00:03_ericI have to say I can't understand how to use cursive's structural editing mode
00:04noprompt_eric: no worries, i usually end up breaking everything all together when i try to drive on it. i end up letting my pair just take over. ha!
00:04_erichah
00:09nopromptdnolen_: did you see that nasty slurp hack? :-P
00:09nopromptha, that's pretty neat. i should find some way to abuse that...
00:25echosaW00T! Just push some major updates to my first clojure project: https://github.com/echosa/clojure-greed
00:25echosa*pushed
00:26echosaI'm particularly proud of greed.grid/get-number-of-cleared-spaces... wrote that one myself. nested recudes! (that was a fun exercise....)
00:31echosa67% code coverage... not bad
00:39jjttjjanyone messing with game developement in clojurescript lately?
01:05alandipertztellman, https://github.com/alandipert/hyperturbo#examples
01:05ztellmanalandipert: wat
01:05alandipertztellman, i tried to use proteus for the vars but i had some issues
01:05ztellmanoh yeah? anything I can help with?
01:06alandipertdigging around a little, not sure yet. does proteus walk fn*'s?
01:06ztellmanonly if you mark them as :local
01:06ztellmanotherwise it doesn't let the container escape the local context
01:07ztellmanotherwise it's anarchy
01:07ztellmanyou can have race conditions, dogs lying with cats, etc
01:07alandipertok sweet, :local is exactly what i need
01:07ztellmanreadme explains it in more depth: https://github.com/ztellman/proteus
01:08alandiperti think it makes a lot of sense to use proteus with gotos
01:08ztellmansweet troll library, btw
01:08ztellmanhaha, I should reuse the core.async inversion of control code to implement gotos in clojure
01:08ztellmanmy new goal for 2014
01:08nopromptlol
01:09noprompthaha
01:09nopromptalandipert: this is rad.
01:09ztellmancore.goto
01:09noprompti need to stop doing serious shit.
01:09ponyprincessI'm just getting into clojure, any good beginner resources?
01:09nopromptlike generate haikus that pass the turing test.
01:10nopromptor rather the ginsberg test.
01:10nopromptas in, alan ginsberg.
01:10nopromptthe alan ginsber test.
01:11nopromptponyprincess: theres http://clojure-doc.org/
01:32dsrxthere's also http://www.braveclojure.com/
01:34dsrx,';
01:34clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
01:41ponyprin_What's good noob clojure?
01:43dsrxponyprin_: http://clojure-doc.org or http://www.braveclojure.com
01:43amalloywww.4clojure.com
01:44ponyprin_woah neat
01:44ponyprin_I want to be brave and true.
01:56ddellacostaponyprin_: +1 on 4clojure.com. I learned a lot by going through that at the beginning. I should get back into it actually...still haven't gotten through all of it.
02:03ponyprin_I went to a haskell meetup and they wanted me to join a cabal so I decided to learn clojure instead.
02:10tuyenhmGuys, good morning from russia
02:11xuserponyprin_: but haskell is the ultimate lisp
02:14Platzwhat would joining a cabal entail?
02:15Platzis it like a fight club
02:18minikomihiya
02:19felherHey folks. :) I am currently reading 'Programming clojure' and it's written there that "(next seomthing)" ist equivalent to "(seq (rest something))". But it seems to me that "(rest something)" alraedy returns a seq, even if fed an array. Did I miss something, or ist "(seq (rest something))" just equivalent to "(rest something)"?
02:21hiredman,(rest (lazy-seq ()))
02:21clojurebot()
02:21hiredman,(seq (rest (lazy-seq ())))
02:21clojurebotnil
02:21felherhiredman: ah, got it, thanks :)
03:18quizdryou guys working professionally with clojure (or anyone who could guess a good answer for this), how many lines of good clojure code do you strive to write on an average day?
03:19quizdrif I can write 100 effective lines, i consider that a good day, but i'm just a noob
03:32locksquizdr: I don’t, but that sounds like the wrong thing to worry about
03:33locksif those 100 lines are solving business problems I’d say that’s pretty good
03:33nathan7on a good day in a pleasant language, I delete a hundred lines of code
03:34locksone year into this project I’ve deleted more than I’ve added
03:34supersymdelete 1 char in the 'system' I work in and it dies
03:34nathan7So, I'm trying to get ClojureScript stuff going
03:35nathan7and I'm quite clueless about Leiningen and real-world Clojure (ie outside a REPL)
03:35nathan7and… even trying to use the lein-cljsbuild example breaks
03:35nathan7 ~/code/lein-cljsbuild/example-projects/simple ⮀ ⭠ master ⮀ lein cljsbuild once
03:35nathan7Compiling ClojureScript.
03:35nathan7java.lang.IllegalArgumentException: Duplicate key: org.clojure/clojure
03:35nathan7which seems to be some kind of dep conflict
03:36nathan7I have no idea how to debug a dep conflict like this, however
03:37supersymnathan7: https://github.com/magomimmo/modern-cljs
03:38supersymI believe some prefer to use that one for reasons I'm not sure but seems a lot was outdated on the web
03:38nathan7Yeah
03:39nathan7I can't find a lot of information at all
03:39supersymyeah I dont do CLJS besides a little in pedestal
03:40nathan7I come from node-land, but I'm quite interested in bridging the client/server gap with a more powerful language
03:41nathan7*** Warning: This project requires Leiningen 2.2.0, but you have 2.0.0 ***
03:41nathan7…that may explain some things
03:42quizdrlocks valid point just curious how much code typically is written in lisp on a given day; my output is much smaller, but i feel the end result is about the same as writing many more lines of code in other languages.
03:43supersymnathan7: yeah thats how I came here too
03:43amalloyquizdr: i don't think i've had many days of producing a hundred lines of clojure. more time thinking, condensing, planning, reducing
03:43supersymyou'll probably never go back
03:43nathan7supersym: It worries me
03:44nathan7supersym: I like JS a lot
03:44supersymI was here for some temporary 'bridging' too :P
03:44locksquizdr: from my experience with clojure I’ve come to a similar conclusion
03:44supersymyeah well lucky for you then, stuff doesn't go *that* fast
03:45supersymthat is with webframeworks and clj
03:46supersymthen again, that might be exactly the problem I did have with Node.... every man and his dog poluting the ecosphere with projects :P
03:46supersymnow a lot of people who suck at JS can write crappy code for the server too... yay
03:47nathan7My JS leans strongly towards the functional
03:48quizdramalloy any idea the lisp background of a lot of the major contributors to 4clojure? you think most are coming from years of lisp exposure?
03:49quizdramalloy or how about yourself?
03:49amalloyno way
03:49amalloyi'm pretty sure clojure was the first serious lisp exposure any of the main contributors had
03:50quizdrsmart guys, getting the idioms mastered so quickly. i see the answers of others at 4clojure and am always impressed at the creative and elegant solutions they come up with
03:50amalloyi'd been doing clojure for...what, just under a year? when i did most of my work on 4clojure
03:50amalloywait, are you talking about the people who solve problems? i thought you meant writing 4clojure
03:51quizdrboth, actually.
03:51amalloyi don't know about the history of people who answer the questions
03:52quizdri've been at clojure for about 2 months and am making progress but when you see guys offering a 5-character solution on 4clojure where the average solution is like 30 characters, it is impressive
03:53hhenkelHi all, I'm currently stuck in something completly simple...I got a multiple similar json data and now I need to create a new list with only part of those values.
03:53hhenkelWhat is the best way to do this?
03:57hhenkelI'm iterating over the data and now I'm stuck in appending those values to a list....
04:04supersymhhenkel: you are using cheshire?
04:27hhenkelsupersym: yes
04:30hhenkelsupersym: but the data is allready transformed to clojure datastructures so it doesn't matter as far as I know.
04:35supersymno thats why I asked. It kinda depends on your returned types
04:36clgvhhenkel: do you want something like `select-keys`?
04:37clgv,(map #(select-keys % [:a :b]) [{:a 1 :b 2 :c 3} {:a 4 :c 5}])
04:37clojurebot({:b 2, :a 1} {:a 4})
04:38hhenkelclgv: Yes, that looks like what I'm looking for...first I wasn't sure but with your example it looks good.
04:38supersymright... or dissoc
04:38hhenkelI'll give it a shot.
04:38supersym,(dissoc {:a 1 :b 2 :c 3} :c :b)
04:38clojurebot{:a 1}
04:38supersymthe other way around ;)
04:39clgvprobably the "positive way" is the better documenting one here ;)
04:40supersymsurely
04:41clgvbut a while ago someone asked for the inverse of select-keys ;)
04:42clgv*opposite
04:59hhenkelclgv: I'm still struggling with this: https://www.refheap.com/41925
04:59hhenkelsupersym: ^^
05:05rurumatehello, I've started using liberator and noticed that ring's :auto-reload option doesn't work. Is there a workaround or will I have to restart jetty after each change?
05:05clgvhhenkel: well you first have to get down to the level where you have the list of requests
05:06clgvhhenkel: (map #(select-keys % [:request]) (->> data vals first)) should work for the displayed data
05:07clgvhhenkel: but probably in that case you just want the content of the request
05:07clgvhhenkel: (map :request (->> data vals first))
05:08clgvwell if we are threading already then: (->> data vals first (map :request))
05:23hhenkelclgv: I get an error regarding data...
05:24clgvhhenkel: "data" is the binding or var to the data you displayed in your gist
05:25hhenkelclgv: okay...
05:26hhenkelclgv: with the pure data I get: clojure.lang.Keyword cannot be cast to java.util.Map$Entry
05:26hhenkelclgv: with (val mydata) used I get: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry
05:28clgv,(->> {:30000 '({:request 1, :values 2}, {:request 2, :values 3})} vals first (map :request))
05:28clojurebot(1 2)
05:28clgvhhenkel: when you one of the exceptions you mentioned than the data layout is different from the one you provided in your gist
05:29Anderkent]awayclgv: hhenkel: no, I think he's using 'val' instead of 'vals'
05:29Anderkent]away,(doc val)
05:29clojurebot"([e]); Returns the value in the map entry."
05:29Anderkent]away,(doc vals)
05:29clojurebot"([map]); Returns a sequence of the map's values."
05:30clgvhhenkel: the key idea here is (1) extract the list where the maps with the :request are contained (2) map over that list to extract the :request data
05:31clgvyou can build up (1) incrementally on the REPL
05:33hhenkelclgv: I updated https://www.refheap.com/41925
05:33hhenkelclgv: It should now be more clear what the inital data is...as the data before was only the part I'm interested in.
05:55ddellacostawhat do I need to have configured to ensure my ClojureScript macros (with same namespace, and file w/.clj extension) are picked up and available to my CLJS?
06:10lvhHi
06:10lvhSo I hear that clojure.contrib isn't a thing anymore? How do I get the << strint macro defined here: http://clojure.github.io/clojure-contrib/strint-api.html
06:10lvhmaybe I am just confused :)
06:13arcatanyeah, the monolithic clojure-contrib isn't maintained anymore. i don't know if strint was migrated anywhere, though.
06:14ddellacostalvh: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
06:14ddellacostaclojure.contrib.strint — Migrated to clojure.core.incubator - lead Rich Hickey. Status: latest build status, latest release on Maven, report bugs.
06:18lvhddellacosta: Thanks!
06:18ddellacostalvh: np
06:36clgvlvh: I think clojure.core.incubator has string interpolation
06:37clgvoh right. as above stated ;)
06:38_bartHi
06:39_bartI' getting "Unable to resolve symbol: mk-pool", anything I'm missing?
06:41_bartI included overtone.live and overtone.live and overtone.inst.piano
06:42_bartwhich means that overtone.at-at is also already included I think (I'm not allowed to add it with (use 'overtone.at-at))
06:42lvhHow do I chain seqs ([:a :b :c], [:d :e :f]) into one seq :a :b :c :d :e :f
06:42_bartbecause that creates an IllegalStateException interspaced already refers to: #'overtone.live/interspaced
06:42lvhI think flatten does that, but that seems kind of elephant-gunny.
06:43lvhconcat!
06:43_bartlvh yeah concat
06:43hhenkelclgv: Had you time to have a look at the refheap stuff? I guess my problem once more is based on the interating.
06:43_bart(lvh, I usually check http://adambard.com/blog/clojure-in-15-minutes/ )
06:50clgvhhenkel: well, as hinted before. extract the list and map over it
06:57hhenkelclgv: Currently I'm failing to get your example working on the repl... :(
06:58hhenkel,(->> {:30000 '({:request 1, :values 2}, {:request 2, :values 3})} vals first (map :request))
06:58clojurebot(1 2)
06:58hhenkelSame thing on the repl gives me: RuntimeException EOF while reading, starting at line 1 clojure.lang.Util.runtimeException (Util.java:219)
07:01hhenkelclgv: Full error on the repl: https://www.refheap.com/41964
07:03clgvhhenkel: thats because of a different data structure. in the example above there is one map whose only value contains the list of requests
07:04clgvoh you mean that example.
07:04hhenkelclgv: yes, the example you provided.
07:04clgvyou probably have some copy&paste error there
07:05clgvsince you see that it works with clojurebot ;)
07:14hhenkelclgv: nope, it's not a c&p problem...seems like it is something within my project resulting in problems.
07:16clgvhhenkel: try it on a fresh repl. you'll see it works there as well as in clojurebot
07:17hhenkelclgv: Yes, allready did that...currently trying to figure out what's wrong with my lein project.
07:18lvhSo, I did added [:require [clojure.core.incubator :refer [<<]]] to my ns; but it doesn't work
07:18lvhI get java.lang.IllegalAccessError: << does not exist
07:20hhenkelclgv: I just created a complete new lein project, started the repl and I fail with that code...can you confirm that?
07:21hhenkelclgv: With a native clojure repl session your code works for me.
07:25lvhCan I require names from other test source files in a test?
07:31hhenkelclgv: looks like there is an issue with numbers as keywords when using leiningen?
07:35dsrxis it intended right now that js->cljs's keywordize-keys option does not apply recursively?
07:35dsrxer, js->clj
07:35hhenkelclgv: https://www.refheap.com/41965 => my test cases that seem to indicat a problem with leiningen.
07:36lvhis it normal that I can't destructure a #{:a :b} as [one two]?
07:39CookedGryphonlvh: vector destructuring like that relies on nth
07:40CookedGryphonsets have no order so nth doesn't make sense
07:40lvhCookedGryphon: That's how I'm interpreting the error message; but I don't care about order
07:40lvhI guess I should throw the set through seq first?
07:40dsrxwhat would you expect 'one two' to be bound to?
07:40dsrxer one and two
07:43lvhdsrx: the set has two elements; I would expect either element to be bound to one, and the other element to be bound to two.
07:43clgvhhenkel: hmm weird. in a "lein repl" I have the same problem. but not in counterclockwise....
07:44dsrx,(let [[x y] (seq #{1 2})] (+ x y))
07:44clojurebot3
07:44clgvhhenkel: it is the keyword starting with a digit in that case
07:46hhenkelclgv: yes, had an issue with that in my json config data and had to change that to "30000": to get it going...
07:46hhenkelclgv: It's kind of strange as it works in a pure repl.
07:46clgvhhenkel: it's either repl-y or leiningen
07:47hhenkelclgv: I'm currently thinking about my options - maybe I can fill up the data differently?
07:48clgvhhenkel: oh. replace the quoted list with a vector then it works
07:48clgv(->> {:30000 [{:request 1, :values 2}, {:request 2, :values 3}]} vals first (map :request))
07:48clgv,(->> {:30000 [{:request 1, :values 2}, {:request 2, :values 3}]} vals first (map :request))
07:48clojurebot(1 2)
07:48clgvso it is definitely some reader (or eval) bug in leiningen or repl-y
07:51hhenkelclgv: hmm, the datastructure I get from parsing yaml (not json as I wrote before) - not sure if I'm able to change the behavior which datastructures are used.
07:51hhenkelclgv: Also good thing is, that it seems like it does not matter when used with lein run.
07:52Anderkenthhenkel: clgv: reply bug; lein run -m clojure.main works, lein run -m reply.main doesn't
07:54hhenkelAnderkent: okay...good to know that I'm not completly dumbthen.... ;)
07:56Anderkentone of you want to raise the ticket or should I?
07:57clgvAnderkent: go ahead
07:58jonasenI'm trying to use core.async pub/sub but I get "Uncaught Error: No protocol method Mux.muxch* defined for type null" if I have a topic that no subs are registered for. Is this expected? I'm probably missing something since I don't fully understand this stuff yet.
07:58dsrxblehh
07:59CookedGryphonjonasen: refheap?
07:59CookedGryphonsounds like your arguments are just in the wrong order or something and you're passing in nil instead of a channel somewhere
08:00jonasenI'll try to come up with a minimal example
08:06CookedGryphonlvh: what happens if you pass in a bigger set though? You get two sort-of-but-not-always random elements from it
08:06CookedGryphonlvh: destructuring like that doesn't make sense for sets. If you want to do something with all the elements, reduce over it or something
08:07CookedGryphonallowing destructuring makes it very easy to do something which will break weirdly later on down the line
08:09jonasenCookedGryphon: https://www.refheap.com/42002
08:10Anderkentclgv: hhenkel: https://github.com/trptcolin/reply/issues/132
08:10jonasenCookedGryphon: this is in cljs. I have not tried the clojure version
08:12CookedGryphonjonasen: I think you need to capture the returned channel from sub
08:13CookedGryphonI don't quite get the reasoning behind it, but I think it'll work if you do let [c (async/sub my-pub :foo (async/chan))] ...
08:14jonasenCookedGryphon: thanks, that works too. But I still get the same error if noone is listening to :foo
08:15jonasenbut maybe that is to be expected?
08:43jonasenCookedGryphon: I don't see the same behaviour in Clojure..
09:03jonasenCookedGryphon: I think it's a bug in the cljs source: the line at https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L869 is missing from the cljs version: https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async.cljs#L646
09:22CookedGryphonjonasen: that does look a little suspicious doesn't it...
09:24jonasenCookedGryphon: I opened a ticket on JIRA: http://dev.clojure.org/jira/browse/ASYNC-56
09:25AnderkentCookedGryphon: jonasen: yeah, compare https://github.com/clojure/core.async/commit/cf8dc1bf#diff-5c087e8e400be45f4d03e0a618ef9d46L855 and https://github.com/clojure/core.async/commit/76b25bf91c6#diff-eff29afee9dd0dffc6769d2702ff9eadL636
09:25Anderkentseems like a simple mistake
09:26rkneufeldIs there anyone who's read or worked on the Clojure Cookbook who would care to render a quote for the back cover? (Think: "Is this an important book for the community?" "Was their an aspect of its development you thought was novel?" "Is it a particularly good book you would recommend to others?")
09:26rkneufeldLooking for a quote today, with name and job title for attribute. Feel free to email me at ryan@cognitect.com if you'd rather share privately
09:29dnolen_jonasen: fixed in master
09:29jonasendnolen_: thanks
09:29Anderkent26 minutes turnaround? Nice!
09:30_bartHello, I'm getting this exception: ClassCastException overtone.sc.node.SynthNode cannot be cast to java.lang.Runnable overtone.at-at/schedule-job
09:30_bartwith this line: (overtone.at-at/every (/ 60 bpm) (kick) beats-pool :desc "kick")
09:30thesaskwatchHi, I tried to do git diff <(echo abc) <(echo def) ... but it says unsuported file type
09:30jonasendnolen_: when are new versions released to maven central?
09:30_bartIt's probably the (kick) thing that's being cast, but why?
09:31thesaskwatchis it possible to bypass it somehow?
09:31dnolen_jonasen: I think tbaldrige usually pushes the button these days?
09:31dnolen_jonasen: no specific schedule, just when some significant changes have landed
09:31_bartIf I replace (kick) with #(println "I am cool!") I get: IllegalArgumentException java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate (ScheduledThreadPoolExecutor.java:420)
09:32jonasendnolen_: ok. I can use a local version for now
09:32jonasendnolen_: does 'lein install' work for core.async?
09:32dnolen_jonasen: yep
09:32Anderkent_bart: in the first case, is kick a function or does it return a function?
09:32stuartsierraYou can always get latest -SNAPSHOT builds of Clojure artifacts dev.clojure.org/display/community/Maven+Settings+and+Repositories
09:32Anderkent_bart: in the second, what does (/ 60 bpm) return?
09:32_bartAnderkent: kick is: (def kick (sample (freesound-path 171104)))
09:33stuartsierraHudson on build.clojure.org polls GitHub every 5 minutes, rebuilds and uploads -SNAPSHOTS to Sonatype.
09:33Anderkentright, so you probably want (every (/ 60 bpm) kick beats-pool :desc "kick")
09:33AnderkentI'd also check if your beats-pool is initialized properly!
09:34Anderkentbecause the second example should work
09:34jonasenstuartsierra: where are the docs on using contrib -SNAPSHOT? I remember reading about it somewhere...
09:34_bartAndorkent: yes now I get #<RecurringJob id: 1, created-at: Wed 03:29:30s, ms-period: 600, initial-delay: 0, desc: "kick", scheduled? true>
09:34stuartsierrajonasen: ^^^ dev.clojure.org/display/community/Maven+Settings+and+Repositories
09:35_bartAnorkent: which is great, but I don't hear the kick. When I run (kick) I do hear it though
09:35jonasenstuartsierra: thanks
09:35Anderkent_bart: hm, make it #(do (println "Kicking") (kick)) instead and see if the print happens?
09:36_bartAnderkent: just did #(do (kick)) and it works, hearing the kicks :)
09:37Anderkentweird!
09:37Anderkentas in, really weird. You sure your speakers werent off? :P
09:38_bartAnderkent: now I don't know how to stop it though :p
09:38_bartAnderkent: (overtone.at-at/stop-and-reset-pool! beats/beats-pool) not working
09:38Anderkentdo :strategy :kill, maybe
09:39_bartAnderkent: no difference, it just says 0 jobs but I'm definitely hearing the kicks
09:39_bart(this is all in REPL by the way)
09:39AnderkentI think you must have another job scheduled against a different pool then
09:40Anderkentjust kill the repl :P
09:41_bartyeah :p I should start to use the vim fireplace thing, maybe that's better.
09:41Anderkentare you using the lein repl or vim-clojure?
09:41AnderkentI'd expect everything to work in the lein repl
09:42Anderkentif you're doing everything from vim then you might be getting weird behaviour if it reevaluates your file, for example
09:42Anderkentfor example your current issue could be caused by you running a job against a pool, then reevaulating the file that creates the pool (thus replacing the reference)
09:43Anderkentnow you try to shutdown-pool but it's a different pool than the one that actually runs your kick
09:43Anderkent(that can be fixed by using (defonce beats-pool) rather than (def beats-pool) btw)
09:44_bartYes that's messy, but now I'm constantly switching tabs, :reload'ing the namespaces and then executing the functions
09:44Anderkentyrgh, yeah. At least use defonce in that case :
09:45Anderkent(for the pool)
09:45Anderkenthaving your files behave nicely when reevaluated is always nice
09:53_bartAnderkent: just tried to reset the pool, it works. maybe I reloaded stuff in between last time
09:55lgs32awow, just switched over to cider. company-complete is really awesome. what a difference from ac-nrepl
09:56lgs32ahow fast it interacts, and all that in emacs.
09:56jonasenstuartsierra: not sure which version I should be using? Is it "0.1.0-SNAPSHOT"? Also, I don't see any activity on http://build.clojure.org/builds
09:56lgs32ais something like popup integration planned for docstrings again?
09:57stuartsierrajonasen: build.clojure.org polls the Git `master` branch periodically, I forget what interval. The SNAPSHOT version number is in the pom.xml file for the project.
09:59stuartsierraOh, drat. core.async isn't in the standard set of builds, because someone had to get clever with version strings.
09:59stuartsierraSo forget everything I just said.
09:59jonasenstuartsierra: heh.. ok
10:00jonasenstuartsierra: I'll try 'lein install' instead then
10:00stuartsierraor `mvn install` if there's no project.clj file
10:01Anderkentthere is in async; though until recently it didnt have the group name :p
10:05CookedGryphonDoes anybody else have issues AOT compiling macros that expand into other macros?
10:06CookedGryphonI have had issues aot compiling core.match macros in combination with go blocks
10:06CookedGryphonand have come across the same thing now with a macro that expands to a core.match
10:06Anderkentis that the <! not used in go block thing?
10:06Anderkentor just compiler barfing?
10:06stuartsierracore.match does some weird things with &env I think
10:06Anderkentah.
10:06CookedGryphonwhere I get OrPattern not defined on first run, but then if i compile again without a clean it works
10:08jonasen'lein install' worked fine. Thanks stuartsierra dnolen_ and CookedGryphon. Back to coding then!
10:10laurentpetitHi. Say I want the same feature as agents, but in java: like a producer / consumer process, guaranteed with one consumer, but no imperative loop in the consumption side. And reaching for clojure is not a solution in the current case. Any ideas?
10:11mdrogalislaurentpetit: j.u.c Blocking Queue?
10:12clgvlaurentpetit: threadpoolexecutor
10:12laurentpetitmdrogalis: I'm really not an expert in concurrent programming, so excuse my noob questions. With Blocking Queue, i'll need a single blocking thread, right ? So I'll have to do some cleanup when e.g. the webapp is reloaded (the app disposed) ? I'd like to avoid that, if possible.
10:14mdrogalislaurentpetit: I think GC should pick that off for you
10:14mdrogalisBut yeah, one thread will block
10:14laurentpetitclgv: a threadpoolexecutor and fixing the params so that I'm certain only one consumer thread can execute place anytime ?
10:15laurentpetits/place//
10:15llasramlaurentpetit: Why can't you actually just use a Clojure agent?
10:15clgvlaurentpetit: that would work, yes
10:16laurentpetitllasram: because even if i'm a clojure afficionado, it's for a java-only project
10:16clgvlaurentpetit: how is work with CCW going recently?
10:17laurentpetitclgv: sorry, no time to develop on this this afternoon, lots of things on my plate. But in a nutshell, going well, even if some family events have cut a little bit of work time off recently. Nothing too bad, and I intend to catch up during the following weeks.
10:18clgvlaurentpetit: good to hear :)
10:19laurentpetitclgv: threadpoolexecutor seems like a big gun for my problem. Not even sure I'll set all the right parameters to use it correctly ...
10:21llasramlaurentpetit: Do you just need a separate dedicated chewing through a linear queue of tasks?
10:21tim_laurentpetit: I think if you start up the thread as a daemon thread you won't have to kill it at the end
10:21clgvlaurentpetit: well, a thread and a blocking queue will work as well
10:21llasrams,dedicated,dedicated thread,
10:21llasramLike everyone else is suggesting :-)
10:21clgvlaurentpetit: yeah you can set backgroundthread to true
10:22tbaldridgelaurentpetit: that being said, use a fixed size thread pool
10:22laurentpetitclgv: will it not create a memory leak if the application is restarted again and again from tomcat's manager interface without restarting the JVM ?
10:22tbaldridgelaurentpetit: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int) with the size set to 1
10:23tbaldridgelaurentpetit: then you can just do execute(runnable) to queue new tasks.
10:23laurentpetittbaldridge: ok, so new tasks will be queued, and executed one at a time? Exactly what I want.
10:23tbaldridgeyeah, assuming you use a size of 1.
10:24tbaldridgelaurentpetit: executors also include .shutdown that allows you to flush the queue before shutting down the executor. That'll make sure that you won't end up throwing away work.
10:24laurentpetittbaldridge: yeah, I'll do that. I guess I'll have to hook a call to the shutdown method of the ExecutorService when the webapp is noticed that it is shut down
10:25laurentpetittbaldridge: ok
10:26lvhuh, is it normal that when I call functions something with -> in the name that the error message drops everything starting with the dash
10:26lvhI may be misdiagnosing but I appear to be getting this error: ArityException Wrong number of args (1) passed to: csv$pair clojure.lang.AFn.throwArity (AFn.java:437)
10:26lvhabout a function named pair->rows
10:26lvh(there is no function named pair)
10:26laurentpetittbaldridge tim_ clgv llasram mdrogalis thanks all for your help and your time
10:27mdrogalis:)
10:35quizdris it possible to throw a custom string when an assert fails?
10:38quizdrah, i was using assert, i see that clojure.test/is is a better choice for custom error messages
11:09btcNeverSleepsre everyone... In Emacs / cider is there an easy way and is it a good idea to do something like this: switch to the namespace of the buffer the cider-jack-in is called from and then call also (use 'clojure.repl) and (use 'clojure.pprint). Does this already exist in cider?
11:11btcNeverSleepsfor example I take it I could set a hook (?) calling (cider-repl-set-ns) upon after running cider-jack-in? But then how do I do to execute (use 'clojure.repl) and (use 'clojure.pprint) inside the REPL? (I tend to do these two all the time after creating a new REPL)
11:18AeroNotixis https://github.com/technomancy/s3-wagon-private still what I should use for private jars?
11:18AeroNotixI have some artefacts I want to push out privately.
11:21clgvAeroNotix: you can also set up apache archiva or something similar. archiva was set up here pretty fast without any problem
11:21AeroNotixclgv: cheers!
11:21michaniskinbtcNeverSleeps: perhaps you can use some "magic" like this: https://github.com/pjstadig/scopes-magic
11:22llasram*shiver*
11:22llasrampjstadig: what have you done? don't people get the joke?
11:23michaniskinllasram: i hate it when i don't get the joke
11:25llasrammichaniskin: The way scopes-magic works is an awesome kludge, in pretty much all senses of "awesome."
11:25llasramFor actual use though -- and I think pjstadig may disagree -- I would argue there are very few situations where the kludge is appropriate
11:25michaniskinllasram: but adding things to the repl seems like a reasonable use case to me, no?
11:26michaniskinyou wouldn't have to include that dependency in production or testing
11:26michaniskinjust in the repl profile
11:27llasramI could see the argument, but for just REPLs there are cleaner ways to get the same effect
11:27llasramClojure will actually auto-load any file named `user.clj` which it finds on the classpath
11:28jasoncofI just installed Clojure mode and Paredit for Emacs and I notice the indention doesn't match most Clojure code I see online; for example, when starting a vector with '[' followed by newline the next symbol is aligned one space to the right of the '[' rather than two spaces to the right of the first character of the previous line.
11:28Anderkentllasram: but if you then switch namespace won't that get rid of the bindings?
11:28michaniskinllasram: but if you do (in-ns 'foo) you'd still have to refer in vars from 'clojure.repl and so on?
11:28Anderkentjasoncof: that's the common indentation for clojure code. You're viewing badly indented code online, apparently :)
11:28llasrammichaniskin, Anderkent: If you just load things into the 'user namespace, but your user.clj could inject things into core, just like scopes-magic does
11:29Anderkentllasram: ah, good point
11:29michaniskinllasram: so what's the difference?
11:29llasrammichaniskin, Anderkent: My objection is to the specific mechanism of hijacking data_readers.clj loading
11:29llasramIt's a really cool hack, but (IMHO) doesn't buy you anything over user.clj for dev, and shouldn't be used in production
11:30michaniskinbut how is that any different? i mean other than the fact that the code is weird in there because the #= evaluation is weird
11:30jasoncofAnderkent is the project.clj located here not using the normal Clojure indention? https://github.com/swannodette/om
11:31michaniskinllasram: what it buys you over user.clj is you can package it as a versioned dependency and deploy to maven
11:31llasrammichaniskin: For one example, it will totally break if you build an uberjar w/ it in Leiningen >=2.3.3
11:31llasrammichaniskin: Yes, which in mind is a *negative*
11:31Anderkentmichaniskin: that's good. Where do you see vectors have 2-space indent rather than aligning to [?
11:31michaniskinllasram: but you don't include that dependency in builds, only in dev profiles, of course
11:31Anderkentouf
11:31Anderkenti ment jasoncof
11:32AnderkentI keep doing that, sorry!
11:32llasrammichaniskin: We seem to have differing opinions here. I'm willing to admit that mine is just opinion, so -- agreeing to disagree :-)
11:32michaniskinllasram: i see your point, too :)
11:32Anderkentjasoncof: {<newline> causes next line to be indented by 2 spaces, [<newline> causes next line to be indented one space to the right of [
11:32jasoncofAnderkent Ah, I'm looking at another example; but the same exact thing happens with my hashes, with the beginning '{'.
11:33Anderkentnow that'd be a mistake
11:33llasramjasoncof, Anderkent: yeah for some reason dnolen doesn't like standard (Emacs) Lisp indentation
11:33jasoncofAnderkent anyway to fix it? I don't think I did anything unusual.
11:34llasramWhere that's "Standard (Emacs)" and not "(Emacs) Lisp"
11:34Anderkentthough I'd still say the right way to write that is https://www.refheap.com/42166
11:34Anderkenti.e. don't leave hanging open braces
11:34`cbpI don't think it makes too much sense either for clojure since we don't really use lists outside of code :P
11:34jasoncofAnderkent ah, I see
11:36michaniskindo clojure projects generally adhere to semantic versioning conventions?
11:36Anderkent>working on windows >double-clicking '.xml' opens IE. Wat.
11:36btcNeverSleepsI was more thinking of a pure Emacs hack to send a few Clojure function everytime a new cider-repl-mode buffer pops up
11:36Anderkentmichaniskin: I think most projects attempt that
11:36sjlAnderkent: you sometimes see the hanging-brace style for maps of big elements, you almost never see it for vectors in the wild
11:37Anderkentsjl: I'd rather see {:key<newline>long-value<newline><newline>:next-key ... in those cases
11:37sjlyeah that's another way to do it
11:39btcNeverSleepsdisgressing but... Regarding number of spaces, tabs vs no tabs, where brace should go, etc. I so wish new language designers would simply make that part of the language's specs, with a tool (not unlike Go's gofmt, but stricter) that formats the code in the "one true way" the language designer meant. And then there'd be no arguing anymore :-/
11:40teslanickThat's called Python. And man is that annoying. :)
11:40AeroNotixteslanick: python is a clusterfuck of styles.
11:40btcNeverSleepsteslanick: but Python uses the number of spaces to determine what to execute right?
11:40AeroNotixGo is literally the only language which gets this right
11:41btcNeverSleepsI'm talking about something which would have no influence on the compilation. But just a standard, which nobody could argue about (well, they could argue that the standard is bad... But not following it -> no compilation).
11:41btcNeverSleepsAeroNotix: which *mostly* get this right : )
11:42btcNeverSleepsit would be great if in the future language designer were to follow that lead that Go showed
11:42michaniskinbtcNeverSleeps: that future language designer is you! doit!
11:45michaniskini mean no reason not to, i'm writing a clojure editor that uses my own preferred syntax and just emits regular clojure to files
11:49btcNeverSleepsregarding my issue, I ended up using: blog.jenkster.com/2013/12/a-cider-excursion.html and the cider-interactive-eval and it seems to be working nicely
11:58toxmeisterhi, if i want to support `apply` for a deftype in clojure i can provide an `applyTo` implementation, what is the equivalent in CLJS? It doesn't seem to be the same...
12:00michaniskintoxmeister: did you implement IFn for your deftype? i believe that is enough to get apply, too.
12:00toxmeisteryes, i did.. but IFn only specifies `invoke`
12:01toxmeistereven in CLJ i have to provide an `applyTo` fn
12:01michaniskintoxmeister: https://github.com/tailrecursion/hoplon/blob/master/src/tailrecursion/hoplon.cljs#L115-121
12:01michaniskintoxmeister: apply works on those
12:03toxmeistermichaniskin: interesting, I thought you can't have varargs for protocol methods
12:03michaniskintoxmeister: sssh
12:03toxmeistermichaniskin: is that a recent change?
12:03michaniskinno, it just works
12:04toxmeistermichaniskin: oki, thanks - will give that a try
12:04clgvtoxmeister: very likel CLJS specific ;)
12:05toxmeistermichaniskin: think so too, since every fn has potentially varargs
12:05toxmeistermichaniskin: ...in JS i mean
12:05michaniskintoxmeister: totally agree with you there
12:05michaniskinhopefully nobody will "fix the bug"
12:06toxmeistermichaniskin: then let's quickly change topic :)
12:07michaniskin…so i told the man, bangor, i hardly even know her!
12:07dnolen_michaniskin: definitely undefined behavior, I wouldn't recommend relying on it.
12:08michaniskindnolen_: i know
12:08clgvdnolen_: so there is a CLJS protocol for applyTo?
12:08michaniskinis there a way to achieve the same without varargs?
12:09dnolen_clgv: what for?
12:09dnolen_michaniskin: no protocols just don't support varargs.
12:10michaniskindnolen_: do protocols collect arguments after a certain number into a seq or something?
12:10dnolen_michaniskin: this long a outstanding compiler enhancement a ticket exists
12:10nopromptdnolen_: is there anybody reason i might see warnings for goog imports in the latest cljs?
12:10dnolen_michaniskin: should put them into a seq after 20th argument
12:10dnolen_noprompt: 2156?
12:11dnolen_noprompt: there some spurious warnings you'll see around goog.string, fixed in master
12:12nopromptdnolen_: i'm seeing stuff like WARNING: No such namespace: goog.net.XhrIo
12:12nopromptdnolen_: the same code in 2138 didn't complain.
12:12dnolen_noprompt: that isn't a namespace
12:12nopromptdnolen_: those are being :imported
12:12dnolen_noprompt: namespace resolution has been broken for a while.
12:12dnolen_noprompt: (:import [goog.next XhrIo])
12:13toxmeisterdnolen_: hey david, so if i want to support apply with seqs upto 3 args do i just provide different arities for (-invoke) impl?
12:13nopromptdnolen_: right. anyway, everything still works so the warnings don't bother me. ;)
12:14dnolen_toxmeister: I don't see why you need to implement applyTo, apply will work.
12:15toxmeisterdnolen_: it doesn't seem to work in clj without and I wasn't sure what the correct cljs way is
12:17dnolen_toxmeister: try it
12:17dnolen_want this so bad, http://twitter.com/suprematic_aav/status/436184769420738561
12:20toxmeisterdnolen_: will prep a gist
12:22dnolen_toxmeister: ok, but like I said you don't need to implement applyTo to, IFn generates the apply implementation for you.
12:27abpHi, can i get junit xml out of expectation tests for ci? I've seen the class for intellij integration but a pointer on how to run that using junit.jar or something would be helpful.
12:27toxmeisterdnolen_: is that specific only for CLJS then? here's my issue in compressed form: https://gist.github.com/postspectacular/9096806
12:28dnolen_toxmeister: only true for CLJS
12:28ambroseb_,(meta (symbol (with-meta 'a {:my-foo 1})))
12:28clojurebot{:my-foo 1}
12:29ambroseb_I wonder if that is intentional behaviour.
12:29ambroseb_seems like it
12:34dnolen_toxmeister: michaniskin: relevant code, http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L722
12:35dnolen_we generate call and apply methods for you. call is necessary for the case where don't have a type.
12:35michaniskindnolen_: maybe i'll have a look at the protocol argument collecting ticket, do you have a link handy?
12:35dnolen_michaniskin: this is why doing var args is bound to break in the future, if we start using more type inference information in the compiler we want to direct invoke
12:35dnolen_michaniskin: we're not going to make your usage work
12:36dnolen_and it will break under more aggressive optimizations
12:36michaniskindnolen_: as long as it works for now i'm ok :)
12:37clgvfamous last words? ;)
12:37michaniskindnolen_: although if i implement the enhancement you mentioned with the argument collecting i can make a macro to obtain vararg support
12:37michaniskinthis is something we've done with clojure already
12:38toxmeisterdnolen_: thanks mister! that helps a lot
12:38dnolen_michaniskin: CLJS-364 CLJS-365
12:38dnolen_toxmeister: np
12:38toxmeisterdnolen_: btw. a big hello to your neighbor amit :)
12:39michaniskindnolen_: ty
12:39dnolen_toxmeister: haha, I'll let him know!
12:39dnolen_michaniskin: so the only place you need to change to make this work is :invoke in compiler.clj
12:40dnolen_michaniskin: it's pretty gnarly, should be refactored - but that where all the function calling optimization occurs
12:41michaniskindnolen_: ok great, i'll have a look and see what i can do
12:41dnolen_michaniskin: we might not need to fix apply - it may already be handled today
12:49clgvdoes anyone know of a small program that enables client-server interaction to check whether I can perform two-way communication (client->server, server->client) with a remote machine?
12:49clgvor what would be the easiest was to do that? provided the client runs within a cluster with some scheduling machinery around
12:50technomancyclgv: netcan?
12:50technomancynetcat, rather
12:50clgvI dont know on which remote machine the client program will run in advance.
12:51llasramclgv: What are you trying to do? :-)
12:52clgvllasram: trying to find out whether there is a firewall that might forbid to call the remote machines from outside the cluster. there is no documentation about that
12:53clgvin principle. I could fall back to java's sockets for the test. but maybe something more comfortable is available to have a small ping-pong-protocol with two different conenctions
12:54llasramclgv: Um, but what's your actual end goal? WHy do you need to know this?
12:54clgv(1) client ->ping-> server (2) server remembers IP (3) server ->pong-> client
12:55llasramAre there not already services running on these cluster nodes which you could simply attempt to contact?
12:55clgvllasram: I have some task distribution thats currently implemented on a per-message basis where clients and server initiate communication (kind of like for P2P)
12:56llasramWhat sort of cluster is this?
12:56clgvllasram: you can only access the cluster nodes through submitting a task to the scheduling system
12:57llasramWell... then haven't you answered your question already? :-)
12:58clgvnot really. there is a login node where I submit the tasks.
12:59clgvthe question is whether there is a firewall prohibiting that these client programs (tasks) can be reached by my server program
13:00llasramOk... That just really sounds like a policy question, to resolve by asking someone
13:01clgvllasram: humm yes, gotta try to find out who is in charge there
13:28gtrakhow would I get this back to a clojure.java.io/resource-able form? "file:/home/gary/.m2/repository/org/clojure/clojurescript/0.0-SNAPSHOT/clojurescript-0.0-SNAPSHOT.jar!/clojure/string.cljs"
13:29gtrakthis actually works: (clojure.java.io/resource "clojure/string.cljs")
13:29gtrakreturns #<URL jar:file:/home/gary/.m2/repository/org/clojure/clojurescript/0.0-SNAPSHOT/clojurescript-0.0-SNAPSHOT.jar!/clojure/string.cljs>
13:29gtrakjust trying to do something not too fragile
13:30gtrakmy best guess at this point is to prepend jar: if it contains 'jar!'
13:34gtrakcemerick: seems like the issue is on my end of things, the piggieback patch you pulled and the pending cljs patch should be enough :-)
13:34stuartsierragtrak: It's on the classpath? Use (clojure.http://java.io/resource &quot;classpath/relative/file/name.foo&quot;)
13:35stuartsierraWTF is up with my IRC client.
13:35gtrakstuartsierra: yea, but I'm not in control of how that string gets generated.
13:35gtrakso, I could truncate... or something :-).
13:36gtrakneed a reliable way to both detect and convert to a classpath-relative form.
13:37gtrakor I can just pass it straight through, maybe it'll work.
13:37gtrakbut it'd be nice to normalize these things.
13:39gtrakno such luck, cider doesn't like it
13:45TravisDIs there any way to get the clojure REPL to align multi-line entries?
13:45ohcibihi.. how to easily manipulate nested data structures? e.g. if i have a set of maps whichs values are also sets of maps and I want to remove certain members of those sets based on values in the maps. I kinda know how to get them easily but to set I end up doing some nasty merge-with or merge or *somethingother* constructs?
13:45ohcibiisn there a "simpler" approach?
13:47delluminatusohcibi: depending on what you want to do, maybe take a look at the update-in function
13:47TravisDohcibi: I'm not an expert, so disregard this if you want. But it seems like your best bet might be to find some primitive operations that are suitable to your data structure, and implement those however you want. Then hopefully you can write everything else you wan to do in terms of those more primitive operations
13:48amalloyohcibi: (set (for [m set-of-maps] (into {} (for [[k v] m :when (keep? v)] [k v]))))?
13:49amalloywhere keep? is whatever function you use to decide whether to keep an inner set-of-map
13:49cemerickgtrak: nice :-)
13:50ohcibidelluminatus: update-in would only work if there are only maps, but in my nested structure are also sets
13:50ohcibiamalloy: looks very interesting... thanks
13:50amalloyprobably better written as (set (for [m set-of-maps] (into {} (filter (comp keep? val) m))))
13:51delluminatusoh, I guess I just skimmed the question, sorry
13:53jonasendnolen_: I'm still looking at Om cursors. They seem to extend lots of protocols.. in particular I find it strange that they extend IDeref (i.e. they are mutable) as well as protocols that are often associated with immutable things: ICollection, ILookup, ISeqable etc. Is this for convenience or are all the protocol extensions essential?
13:53dnolen_jonasen: have you gone through the tutorials?
13:54jonasendnolen_: I have read the first one
13:54dnolen_jonasen: then just think a bit more about why they are implemented they way they are.
13:55dnolen_jonasen: also consider consistency issues brought upon by rendering on requestAnimationFrame
13:58jonasendnolen_: I'll read through the tutorials again. I would have guessed that all you would need is IDeref to get the value out and something like ITransact to move to the next state. I must have missed something essential..
13:58dnolen_jonasen: a clue is that during render the value of a cursor is consistent and can be treated as a value - all access outside the render phase is problematic - go loops and event handlers. Thus deref.
13:59jonasendnolen_: So I would have thought that you always have to deref if you want to access the value. Like the rest of clojure ref types
13:59dnolen_jonasen: deref during the render aka React phase is not allowed, and outside the render phase, cursor is an inert handle you can only deref or transact
14:00mr-foobarin cljs, how do I convert an atom to json, for console logging ?
14:00dnolen_jonasen: deref means getting a value, but you would just get another cursor another reference type - I don't see the point
14:00dnolen_jonasen: uglier and doesn't reify the phase distinction
14:01ohcibimr-foobar: (console.log @atom-name) ?
14:03ziltiI'm tying to call a Java-function, like this: "(.setTopAnchor root content (double 0))" It does exist and all, but something seems to not match. I get an exception saying this method doesn't exist.
14:03AeroNotixclgv: So I'm evaluating archiva. It's running. I have :repositories with [["releases" "http://localhost:8081/archiva/releases&quot;]] (according to the lein docs) but `lein deploy releases' gives me a 405
14:04mr-foobarohcibi: i'm getting a very complex datastructure as output for a simple Hashmap. I just want to print the kv as json.
14:04clgvAeroNotix: you need to provided your login credentials, e.g. in ~/.lein/profiles.clj
14:04AeroNotixclgv: it prompts me for login creds
14:04`cbpmr-foobar: (clj->js @atom)
14:05zilti"#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: setTopAnchor for class javafx.scene.layout.AnchorPane>"
14:05joegallozilti: this is on a javafx.scene.layout.AnchorPane?
14:05ziltijoegallo: Yes
14:05joegallothat method is stati
14:05joegallostatic, even
14:05joegalloyou don't pass in root
14:05zilti...oh. That explains a lot. Why didn't I notice that. Thanks!
14:05joegallonp
14:05clgvAeroNotix: I have :auth data in my :user profile - it works with that configuration
14:06mr-foobar`cbp++
14:06AeroNotixclgv: let me try that then, seems odd that it would prompt for me it
14:06AeroNotixprompt me for it**
14:07clgvAeroNotix: I use ^:replace for the :repositories data as well
14:07AeroNotixclgv: what does ^:replace do?
14:07clgvAeroNotix: getting rid of all the default repos so that my archiva acts as proxy
14:08AeroNotixclgv: ok
14:08clgvmy archiva url looks like archiva.mydomain.de/archiva/repository/internal
14:09AeroNotixhmm, ok
14:09clgvAeroNotix: though I have the old 1.3.6 - didnt notice that 2.0.0 was already released
14:10AeroNotixclgv: so I have tried auth in the profiles.clj and still 405
14:10AeroNotixyour url pattern 404s
14:10clgvhttps://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md
14:10AeroNotixAlready read it
14:11clgvAeroNotix: skip the virtual host.
14:11semperostrying out Om 0.5.0-rc1, inside IDidMount's did-mount, if I do transact!/update! on cursor or even a simple set-state! on owner, I get an error "No protocol method IDidUpdate.did-update defined for [my top-level component]"
14:11clgvI think the URL scheme in the DEPLOY.md is the correct one if you add the archiva port
14:11AeroNotixclgv: it says it prompts for password -- which it does. I can't imagine it would prompt me for password if it needed them in profiles.clj
14:11AeroNotixclgv: I'm using the same one as the DEPLOY.md
14:11semperosdnolen_: if/when you have a moment ^^
14:12clgvAeroNotix: just to make sure - you created a user account that has all the rights it needs?
14:12AeroNotixclgv: yeah
14:14clgvAeroNotix: well cant diagnose it from here.... gotta go home now anyway
14:14AeroNotixclgv: cheers anyway
14:15dnolen_jonasen: also note that people can technically transact the app state during render, and that won't affect render because cursors are using values when the render phase began.
14:15dnolen_semperos: did you run a lein-cljsbuild clean? CHANGES.md points out did-mount and did-update changed, they no longer take dom node.
14:15dnolen_semperos: this is to match React 0.9.0-rc1
14:16semperosright, I did a full clean and changed sig for did-mount to take just one arg
14:16semperosif I don't touch the component state in did-mount, no error is thrown
14:16semperoswill re-clean just to make doubly sure
14:17dnolen_semperos: if that doesn't fix it then open an issue w/ a minimal example exhibiting the problem. Thanks.
14:17semperosdnolen_: can do, thx
14:18winkwtf, this has got to be the sneakiest bug in a while. I used to use (pos? (Integer/parseInt x)) on a varchar field, i.e. string. but the field is now integer, so the 2 is a clojure Long. so this fails. doh
14:22`cbpwink: use Long/valueOf :-p
14:24`cbpAlthough if it changes to a double then it will not work again so I guess you need a better parser :-D
14:24semperosdnolen_: do you mean for this page to still show did-update as taking 4 args instead of the new 3?
14:24semperoshttps://github.com/swannodette/om/wiki/Documentation#wiki-ididupdate
14:25dnolen_semperos: feel free to update
14:25semperoscool
14:25semperoswanted to make sure you weren't trying to pin the page to a particular version of Om
14:25dnolen_semperos: I prefer that docs reflect the latest released version.
14:25dnolen_0.5.0-rc1 is out so docs should match it.
14:25semperosthought so and makes sense, given your pace of dev :)
14:25semperosthat was my issue
14:26semperoshad [_ _ _ _] to did-update instead of [_ _ _]
14:26bbloom[_O_o_]
14:27semperosexactly :)
14:30dnolen_semperos: thank for updating the docs
14:30semperosalrighty, corrected did-mount and did-update, quick search for 'node' on that page is now limited to references to om.core/get-node
14:30semperosnp
14:31abpso i'm taking the Paradigms of Computer Programming course on edx, so glad i didn't miss it and regretful i weren't forced to go through that stuff earlier. van roy does an incredibly good job so far :)
14:32toxmeisteris there a fixed hashing procedure for vectors in CLJS? is it the same as in CLJ (prior to 1.6.0)? are there plans to adopt 1.6.0 changes in CLJS too?
14:33abpis Concepts, Techniques, and Models of Computer Programming worth studying in its entirety? the course only cover about 1/3
14:33dnolen_toxmeister: on the list of todos - need to port Murmur3
14:33toxmeisterI've got a 32bit murmur3 lying around somewhere
14:33toxmeister(in JS)
14:34dnolen_toxmeister: would want a pure CLJS port
14:34dnolen_Murmur3.java is like 130 lines long, seems easy enough todo
14:34ro_stshould i be able to use binding with defmethod?
14:35toxmeisterdnolen_: yeah, only issue is doing this without 64bit longs needed as intermediates
14:35ro_sti'm not seeing the bound values inside the defmethod when it's invoked. it still has the old unbound value
14:35dnolen_toxmeister: I don't see long requirement looking at Murmur3.java
14:36ro_st(def ^:dynamic foo false) (defmulti a :b) (defmethod a 1 [] (prn foo)) (binding [foo :woohoo] (a {:b 1})) ; prints false, not :woohoo
14:37ro_stis this expected behaviour?
14:38Anderkentro_st: doesn't happen to me. Also your defmethod seems wrong, should take 1 arg
14:38amalloyro_st: you have a stale defmulti - expected behavior for that code is an ArityException
14:38ro_stgrr. that toy example works. thanks guys. will dig
14:41ro_stlooking forward to seeing your clojurewest talk, dnolen. a pity i can't be there this year
14:45ro_stdoes the bindable var need to be declared before the defmulti?
14:46ro_stgrar. toy example works, but prod code does not. weird.
14:49`cbp e
14:49`cbper sorry
14:53ro_stto clear the way for a new compilation of a multimethod, i use (ns-unmap *ns* 'the-defmulti)
14:53ro_stif i then recompile the ns with the multi in it, will that remove stale defmethods?
14:55amalloyall defmethods vanish when you unmap the multimethod (or when you (def the-defmulti nil)
14:55ro_stgreat, thanks
15:03ro_stfound the issue. the binding doesn't survive a (partial) boundary
15:07toxmeisterdnolen_: correct don't *need* them, but in JS you can't rely on normal int32 overflow as in java which is caused by multiplies with the 2 murmur constants - so need to manually simulate it...
15:08ro_stno;
15:08ro_stlazy sequence. sequence realised outside the binding. doh!
15:11dnolen_toxmeister: i guess we can do this with bit shifting, and given modern JS engines (and tuning for asm.js) hopefully not much of a hit.
15:21dnolen_toxmeister: looks promising http://jsperf.com/bit-multiply
15:28xperaHello, any recommendations for large scale caching? My project is a big computational project with lots of intermediate results. I'd like to keep as much as possible in RAM, but some might need to go to disk if it is not used as recently.
15:30TravisDis there a strict version of map?
15:30turbofailmapv is strict, though it returns a vector
15:31TravisDah, that's actually good for this case :)
15:31TravisDthanks
15:31hiredmanxpera: I'd look at guava's caching
15:37TravisDWould you guys mind crituiqing some code I wrote to incrementally compute the mean of a lazy-seq of numbers? https://www.refheap.com/42316 I ran into some issues writing a similar bit of code in Haskell
15:43gfredericksdocstrings on individual args is an interesting idea
15:44llasramTravisD: In what way is it incremental?
15:44TravisDah, actually, in the snippet I pasted it's bad to define nn the way it is there, since that prevents the rest of the sequence from being freed
15:44TravisDllasram: The memory usage is O(1)
15:46llasramTravisD: Ok. Well, you might think about using `map-indexed` or even just manually tracking the index in the `reduce` function
15:46xperahiredman: thanks
15:47llasramTravisD: Outside of the immediate code, this algorithm is prone to loss of significance, and would not be advisable for real-world use
15:49TravisDsorry, somehow my IRC client crashed
15:49TravisDI missed any messages you sent
15:49llasramOne:
15:49llasramTravisD: Outside of the immediate code, this algorithm is prone to loss of significance, and would not be advisable for real-world use
15:49llasramWell, and the earlier one you might have missed:
15:49llasramTravisD: Ok. Well, you might think about using `map-indexed` or even just manually tracking the index in the `reduce` function
15:50TravisDllasram: Ah yeah, shouldn't compute the sum and length
15:52TravisDllasram: that is all good advice
15:56xperahiredman: looks like Guava's Cache doesn't have disk persistence but it does have "removal notifications" so I could roll my own disk layer
16:06toxmeisterdnolen_: yes, that's the kind of hoop i ended up jumping through, didn't realise that it causes almost no hit though. v.good to know
16:22seangrovetechnomancy: It seems better for far. Haven't had any timeouts yet.
16:26technomancyseangrove: cool. our perc99 for clojure builds hasn't gone over 250s in a while
16:27TravisDWhat is perc99?
16:30technomancy99th percentile
16:41amalloyTravisD: you might find it an interesting exercise to have incremental-mean return a lazy sequence of "average so far"
16:42amalloythen you can write actual-mean as (last (incremental-mean xs))
16:42TravisDamalloy: ah, that would be neat
16:44amalloyi expect the lazy version to be more natural, because it avoids some of the gotchas you had to deal with, like using mapv to avoid stackoverflow
16:44marce808simple question for you guys: if I define an env var to the JVM using -Dfoo=bar, shouldn't I be able to recover it using (System/getenv "foo")?
16:44stuartsierramarce808: That's a system property, not an environment variable.
16:44stuartsierra(System/getProperty "foo")
16:46Wild_Catmarce808: note that if you're doing that, it might be a good idea to use the "env" library.
16:46Wild_Catmarce808: er, environ. https://github.com/weavejester/environ
16:48marce808ah, rookie error. thanks guys.
16:59jasoncof Is there an idiomatic way to store application settings/config in Clojure apps? Perhaps by tying into Leiningen's profile system?
17:01stuartsierra(read-string (slurp (clojure.java.io/resource "my/app/config.clj")))
17:01stuartsierraahem, config.edn
17:02gfredericksoh snap we gotta learn a new file extension now
17:03gfredericksstuartsierra: also edn/read-string
17:03stuartsierrayeah, doesn't really matter if it's part of your code
17:03jasoncofstuartsierra Thank you. I figured something like that. I was wondering if there was a way to tie it into leiningen's profiles because I my configuration usually matches the profiles (different db setting for dev vs production for example).
17:03stuartsierra"If you can't trust your config file, who can you trust?"
17:04stuartsierrajasoncof: You can use profiles with different resource dirs.
17:04jasoncofstuartsierra: ah right! thank you, I didn't think of that.
17:05shoepieany here using vim-clojure-static?
17:06delluminatusshoepie: I just started with it a few days ago
17:06shoepiewondering why clojure keywords arent highlighted differently
17:06shoepieor maybe i'm doing something wrong
17:07delluminatusshoepie: there is another package for keyword highlighting
17:07shoepiedelluminatus: know what that would be?
17:07delluminatusshoepie: actually, I just looked it up, and it's only for highlighitng refered/aliased vars
17:08delluminatusso you oughtn't need it
17:08shoepiedelluminatus: oh, yeah, already have that one
17:08delluminatusare you sure you installed the packages right? ;)
17:09shoepiepretty sure but know knows :)
17:09delluminatusif you're not using something like Vundle (or at least pathogen) I recommend it
17:09shoepieeverything else is highlighted but i'd like my hash keywords highlighted
17:09shoepieI'm using Vundle
17:09delluminatuslike hash-map?
17:09shoepieyeah
17:09delluminatusoh
17:09delluminatuswell look
17:10delluminatusare they not all highlighted?
17:10delluminatuswell anyway they should be. I guess I can't help you much beyond that
17:10shoepienuh uh, i wonder if it's just my colorscheme
17:10delluminatusmaybe
17:10delluminatusI'm using vundle as well and have no issues
17:11delluminatusin fact I love it, with the rainbow parens plugin, my source files are gorgeous :)
17:12shoepiewow, i'm stupid
17:12shoepieit was the colorscheme
17:12delluminatusit happens
17:12shoepiewell, thanks for letting me talk it out
17:13delluminatusnp
17:13shoepiei like rainbow parens, too. getting used to paredit
17:14delluminatushmm, I'll have to take a look at that
17:21TravisDamalloy: That is a much nicer solution: https://www.refheap.com/42343
17:22TravisDthis one also has fewer numerical issues
17:27stcredzeroI am confuzzed. The send-a message-around-a-ring example here <http://clojure.org/agents&gt; seems to suggest that send/send-off can contain side effects?
17:28justin_smithstcredzero: yes, an action sent to an agent will only be run once for each send / send-off
17:28justin_smith(unlike atoms there are no retries with agents)
17:29stcredzerojustin_smith: Ok, cool!
17:37amalloyTravisD: well, it's always fun to use reductions, but i often find it hard to see what's going on. i would have just written it as https://www.refheap.com/42345 (the second version if you have lazy-loop from flatland/useful available)
17:37stcredzeroHow bad an idea is it to use add-watch/remove-watch? (Says alpha - subject to change)
17:38amalloystcredzero: it will never chaneg
17:38amalloyi think 1.6.0-alpha1 finally removed the warning, even
17:38justin_smithlot's of things still say "subject to change" in clojure
17:38justin_smith*lots
17:38amalloyjustin_smith: except the values! those never change
17:39TravisDamalloy: Ah, I ended up using reductions because it's meaning is clearer with the naive implementation. You could use reduce to compute the sum, and reductions is a good way of getting all the partial sums
17:39stcredzeroWhat folks used to say about Lispers: Lispers know the value of everything and the cost of nothing.
17:39TravisDamalloy: but it's not particularly clear
17:39toxmeisterwhat is the role of the ASeq protocol in CLJS? I guess a marker protocol, but what for? What's the diff to ISequential?
17:42whodidthishttp://www.closurecheatsheet.com/ damn, should have found this sooner=(
17:44delluminatuswhodidthis: this is #clojure not #closure ;)
17:44delluminatusGet out of here with your S's
17:45whodidthisim telling nolen on you!
17:49TravisDAh, trampoline is a cool idea
17:51dnolen_toxmeister: it's just a marker protocol, at one point I used it to optimize something which has since been removed.
17:52toxmeisterdnolen_: thx, so I can leave it out from my types?
17:53dnolen_toxmeister: you can
17:53toxmeisterdnolen_: oki (sorry for spamming w/ all those cljs Q's today...)
17:53dnolen_toxmeister: np
17:55`cbpwhodidthis: nice thanks
18:08bfn,(keyword '1)
18:08clojurebotnil
18:08bfn,(keyword "1")
18:08clojurebot:1
18:08bfnwhy doesn't (keyword '1) give :1?
18:09amalloybecause '1 is a number
18:09amalloykeyword wants instances of Named, ie keyword/symbol/string
18:09Cr8' isn't "interpret this as a symbol", it's short for (quote ...)
18:09amalloyi mean, quietly returning nil is not necessarily great, but it's defensible
18:10Cr8and '1 is just 1
18:10Cr8,'1
18:10clojurebot1
18:10bfnoh thanks, I thought ' was "interpret this as a symbol"
18:10amalloyCr8: the clojurebot example doesn't really help, since a symbol would print the same way
18:10Cr8nah, it's "don't apply evaluation rules, use the following form as is"
18:10Cr8yeah
18:10amalloy&(class '1)
18:10lazybot⇒ java.lang.Long
18:11amalloyor even, ##(identical? 1 '1)
18:11lazybot⇒ true
18:11Cr8,[(+ 1 2) '(+ 1 2)]
18:11clojurebot[3 (+ 1 2)]
18:11Cr8,(map class '(+ 1 2))
18:11clojurebot(clojure.lang.Symbol java.lang.Long java.lang.Long)
18:12bfn,(= '"foo" "foo")
18:12clojurebottrue
18:13Cr8,(= = '=)
18:13clojurebotfalse
18:15bfnthank you all for your quick explanations
18:19benkayanyone know why the test in this function isn't running?
18:19benkayhttps://www.refheap.com/42320
18:23justin_smithbenkay: how are you running the tests?
18:25cespare|homedo people typically just use clojure.test for unit tests? We've been using midje but are thinking of moving off of it.
18:25cespare|homejust looking for anecdotes and personal opinions :)
18:25justin_smithI find clojure.test does everything I need for reasonably fp code
18:25justin_smithie. pure functions reduce the need for mocking etc.
18:26technomancycespare|home: there was a blog post a while back about circle CI moving from midje to clojure.test
18:26technomancygood stuff
18:26cespare|hometechnomancy: yep, I read that.
18:27cespare|homewe may end up using their translation code.
18:27TimMcAny news on the clojure-tests-as-library front?
18:27TimMce.g. futile's test2
18:27shoepiednolen_: i keep getting "prepareEnvironmentForDOM" errors in om. Looks like it might be a known issue...?
18:27dnolen_shoepie: never heard any one complain about that one before.
18:28dnolen_shoepie: known issue?
18:28dnolen_shoepie: like in React?
18:28shoepiehttps://github.com/swannodette/om/issues/21
18:28dnolen_shoepie: that's not an issue, that's user error
18:28dnolen_shoepie: read the thread
18:29`cbpTimMc: Sorry for the dumb question but what would be the use of that?
18:30TimMc`cbp: If the test-runner is more of a library than a framework, you can control it with external tools or hook it into an IDE or a reporting function.
18:30shoepiednolen_: I did, and I'm using the tutorial markup. Just wondering if you've seen anything related lately. I'll keep trying
18:31justin_smithbenkay: https://www.refheap.com/42354 <- it works, and that's how
18:31dnolen_shoepie: so you're making sure to load your script tags *after* your markup?
18:31shoepiednolen_: Had it working at one point. I must've screwed something up.
18:31justin_smithmay not work with lein test unless one of your test namespaces causes the function with the test to be loaded
18:31shoepiednolen_: yep
18:31TimMc`cbp: As opposed to the tests themselves being a library, which I suspect is how my question could also have been interpreted.
18:31dnolen_shoepie: gist of your markup?
18:31justin_smithbenkay: since I think lein test just loads your test definitions under test/ by default
18:32benkayjustin_smith: splice that assertion out of the function definition in the metadata and recompile it.
18:32justin_smith?
18:32justin_smithOK
18:33shoepiednolen_: https://gist.github.com/kevincolyar/152deb68c1f3525d52aa
18:33benkay,(defn ^{:test {(assert (= 1 (adder 1)))} adder [thing] (+ 1 thing))
18:33clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
18:33benkay,(defn ^{:test (assert (= 1 (adder 1)))} adder [thing] (+ 1 thing))
18:33clojurebot#<CompilerException java.lang.AssertionError: Assert failed: (= 1 (adder 1)), compiling:(NO_SOURCE_FILE:0:0)>
18:33justin_smithhttps://www.refheap.com/42354 updated, same repl
18:34justin_smithtest passes without the assertion in it
18:34justin_smithif that is what you meant
18:35benkaynah not really
18:35benkayupdated: https://www.refheap.com/42320
18:35benkaysecond function definiiton throws the expected error
18:36dnolen_shoepie: oh what version of Om are you using?
18:36justin_smithwell the second version should throw at compile time
18:37justin_smithI guess I don't understand what you were trying to do
18:37benkayget tests to fail at compile time :)
18:38benkaybut include multiple tests.
18:38justin_smithbut that isn't running the test
18:38justin_smiththat's just throwing an error at compile time
18:38shoepiednolen_: 0.3.6, I tried 0.5.0-rc1 but run into autobuild slowness so I switched back
18:39benkayjustin_smith: so then why does the third (updated: https://www.refheap.com/42320) function definition pass compilation?
18:39dnolen_shoepie: yeah I can't say, not supporting anything but the latest release at this point. 0.3.6 -> 0.5.0-rc1 is not a difficult upgrade path
18:39dnolen_shoepie: autobuild slowness doesn't make sense to me, same build times for all version of Om IME
18:40justin_smithbenkay: it's not a test, it's arbitrary code run at compile time
18:40`cbpTimMc: I'm not sure what that would look like :( But I'm free for a OSS project
18:40shoepiednolen_: I'll give it another try. Might just need to step away from the machine for a minute.
18:40shoepiednolen_: Thanks for the help
18:40justin_smithbenkay: on my machine, that throws an error (as it should) because adder is not yet defined
18:40justin_smithit's not a test
18:41dnolen_shoepie: also 0.8.0 was bad about swallowing errors, 0.9.0-rc1 much better, so there's that.
18:41dnolen_React
18:41dnolen_should be less confusing now
18:42shoepiednolen_: oh yeah, should I be including react in my project.clj and index.html? I don't see it listed in the readme anymore under :dependencies.
18:43dnolen_shoepie: Om depends on a React JAR that I put together and push to Clojars, no need to specify yourself.
18:43shoepiednolen_: k, cool
18:44dnolen_shoepie: but yes react needs to be included in your index.html during dev, in the production case you can use :prelude compiler option
18:44benkaygot it. so i'm testing the stale function definition.
18:45justin_smithbenkay: yeah, and it isn't a "test", it's just an assertion built into the compiling code
18:45shoepiednolen_: good to know, thanks
18:46justin_smithbenkay: tests defined in metadata are meant to be run the same way any other test is, with an explicit run-tests call
18:46benkay(test-var adder) would run those tests though, correct?
18:46justin_smithI think it should, I haven't tried it that way
18:46benkaygot it. thanks for clearing that up for me, justin_smith
18:46justin_smithbut I think the test should be a function
18:47justin_smithnp
18:47justin_smithnote how in my examples I used an fn, and it ran with run-tests
18:47benkayyup.
18:48justin_smithalso you probably want some call to is or are, of course
19:21shoepiednolen_: doesn't seem related to om, but when I changed to 0.5.0-rc1 my "lein cljsbuild auto" is really flakey
19:22shoepiednolen_: works about 1 of 5 times, build times from <1 to 10 seconds
19:24shoepiednolen_: lot's of "Unexpected end of input" js errors and "EOF" clojurescript compile exceptions
19:31shoepiednolen_: wow, nevermind. protip: don't run a second cljsbuild autobuild in another tmux window...
19:34dnolen_shoepie: yep that's burned a few people including myself
19:41shoepiednolen_: been one of those days :)
19:50logic_progare there any langauges that form some way of halfway point between erlang and clojure?
19:51logic_progI want the convenience of clojure + clojurescript via cljx + read-string + pr-str .... but I really want erlang's supervision trees and error handling
19:53dnolen_logic_prog: http://lfe.github.io/?
19:53AmnesiousFunesThis suggestion is not very related to your specifics on read-string and pr-str, but Elixir has been receiving a fair amount of attention in Erlang circles
19:53logic_progdnolen_: !
19:53logic_progdnolen_: I
19:54AmnesiousFunesIn addition to what dnlone said, of course.)
19:54logic_progdnolen_: I've been wanting ot talk to you about facebook react / your Om library.
19:54dnolen_logic_prog: though there's not really a good story as far as running Erlang on the client like Clojurescript, far as I know
19:54logic_progI recently implemented a tree-diff algorithm
19:54logic_progso it does the dom-tree diffing part of React.
19:54logic_progBesides virtual-events, does React have anything else?
19:54logic_progi.e. I believe React = diff on dom-tree + virtual events
19:55logic_progdnolen_: lfe looks interesting, though the _opposite_ would be even better, erlang like semantics, on clojure / the jvm
19:56dnolen_logic_prog: you mean besides 1 year of performance optimizations and real users battle testing it production? :)
19:57logic_progdnolen_: what preformance optimizations are there besides 1) use js/requestAnimationFrame, 2) _never_ read back from the DOM -- my system only reads to the DOM, never reads from the DOM, and 3) clojure equality testing is even fatster than testing javascript data structures
19:57logic_progdnolen_: my system has been used by 1 user for 2 weeks now; everything appears to be fine with my drag/drop window system in cljs
19:57dnolen_logic_prog: don't know of anything like that, Erjang is Erlang on the JVM, but the JVM is somewhat ill suited for Erlang's design.
19:58logic_progdamn it, cljs + erlang is just not as nice as cljs + clj
19:58brehautin todays issue of news that surprises nobody ;)
19:59dnolen_logic_prog: there aren't really any performance optimizations in Om beyond using identical? checks when we can and batching updates + requestAnimationFrame
19:59tickinglogic_prog dnolen_: I think joxa is far more similar to clojure than LFE http://joxa.org/
19:59dnolen_logic_prog: almost all the value in Om is derived from the model which emphasizes modularity w/o sacrificing global time management
20:00technomancyreally not a fan of LFE
20:00technomancylisp-2 is just =(
20:00RaynesElixir
20:01Raynes<3
20:01RaynesI'm a heathen, I know.
20:01tickingtechnomancy: yeah, joxa is a lisp-1 thoug
20:02technomancyticking: yeah, it looks way nicer
20:02Wild_CatRaynes: is irclj still under development/support? I might have a minor pull request for it soonish
20:02RaynesWild_Cat: It is if you send that there pull request!
20:03tickingtechnomancy: it was heavily inspired by clojure, the only bad thing is that it looks like very old clojure (stuff like use instead of refer)
20:03Wild_CatRaynes: good good. I'm still investigating the bug, but the PR is likely to be a simple (.setKeepAlive) call. :p
20:05quizdrwhat is the appropriate comparator to use when sorting keywords in alphabetical order? I would have though < or > could work, but apparently not
20:06technomancyticking: if that's the main complaint I'd say that's a great sign =)
20:07Raynes&(compare :a :b)
20:07lazybot⇒ -1
20:07Raynes&(compare :c :b)
20:07lazybot⇒ 1
20:07Raynes&(compare :c :c)
20:07lazybot⇒ 0
20:07quizdrRaynes well that was easy. I was looking for what to pass to sort-by, thanks
20:07tickingtechnomancy: yeah, they have a horribly small userbase though and all the perks that come with it :(
20:09RaynesSo did Clojure once.
20:09RaynesNever forget.
20:09Wild_Catwell, even when very young Clojure had the advantage of Java interop
20:10Wild_Catwhich mitigates a large part of the "small userbase" problem (lack of libs)
20:11quizdrIf you write a function that takes a single parameter (arity of 1) and then pass to this function a map { ... } shouldn't this satisfy the arity?
20:12quizdrI'm finding it gives me error based on arity
20:13RaynesCould you show the code in question?
20:13daccexample?
20:13RaynesWhat you describe is indeed very unlikely, which is why the code is necessary.
20:14quizdrRaynes dacc here: https://www.refheap.com/42378
20:14quizdrI try: (kfdefaults {:a [1 2 3]}) and get Wrong Number of Args error
20:16quizdroops i see a syntax error
20:17quizdrgeez i need to go for a jog or something.
20:36quizdris there a rule for which arity overload is chosen if more than one suffices, such as if you pass two args and arities exist of [a b] and [& a] ?
20:40gfredericks,((fn ([& zs] :zs] ([a b] :ab)) 1 2)
20:40clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
20:41amalloyquizdr: you can't define such a function
20:41gfredericks,((fn ([& zs] :zs) ([a b] :ab)) 1 2)
20:41clojurebot#<CompilerException java.lang.RuntimeException: Can't have fixed arity function with more params than variadic function, compiling:(NO_SOURCE_PATH:0:0)>
20:41stcredzeroWhat's the time complexity of (keys) and (vals) on a map?
20:41gfredericks,((fn ([z1 z2 & zs] :zs) ([a b] :ab)) 1 2)
20:41clojurebot:ab
20:41gfredericksstcredzero: it returns a lazy sequence in constant time
20:41amalloyyeah, time complexity is a slippery notion with laziness
20:42gfredericksignoring the laziness I have a hard time imagining it could reasonably be anything other than linear
20:42stcredzerogredericks: woohoo!
20:42amalloyit's O(1) time to return, and then probably O(n) to traverse it all
20:42quizdramalloy ok good to know thanks
20:42gfredericksI guess worst case O(n log n) wouldn't be shocking
20:43amalloygfredericks: pretty hard to imagine, though
20:43hyPiRionamalloy: well, depends on input data structure
20:44hyPiRionit'll be O(n log n) for sorted collections
20:44amalloyhyPiRion: how confident are you in that? i wouldn't be at all surprised if it were O(n)
20:45stcredzerohyPiRion: aren't sorted collections implemented as a tree? That would be O(n)
20:45amalloyto traverse from one key to the next will usually take O(1) time, since they're adjacent; sometimes it will take longer as it retraces its path back up a few levels towards the root, but perhaps it amortizes out to O(n)
20:49stcredzeroamalloy: yes, it amortizes quite simply. Every time you follow a link "down" you go back "up". It's freshman year binary tree stuff.
20:50stcredzero(At least it was back in the 80's)
20:50hyPiRionstcredzero: right, assuming they are balanced
20:50amalloyhyPiRion: his argument doesn't depend on balance at all
20:50hyPiRionwait, nevermind that. It's O(n) anyway
20:50hyPiRionyeah
20:51stcredzerohyPiRion: it doesn't matter a whit if it's balanced or not
20:51amalloystcredzero: that is what i would expect too, but i don't think either one of us actually knows enough about how the sorted collections are laid out to be sure that it actually applies
20:51stcredzeroamalloy: yeah. they're based on trees, but then they have the persistent magic layered on top of them.
20:53hyPiRionyeah
20:55hyPiRionIt's log(n) for the first key, then constant time thereafter for the remaining keys
20:55hyPiRionYou know, I think I should just shut up, because that's not true either
20:55hyPiRion:p
20:58amalloyhyPiRion: it's much safer to just say O(1) to create the seq, and amortized O(n) to traverse it. you can sweep all kinds of silly nonsense under the amortized rug
20:59hyPiRionamalloy: well, that's no fun.
21:00hyPiRionbut I guess that's the easiest thing
21:01stcredzerohyPiRion: I recommend going over algorithms again. That stuff is genuinely useful.
21:01hyPiRionAnd uh, if lazy seqs need to realise the first element, then it would actually take O(log n) time to create it for sorted collections.
21:01stcredzeroYeah, laziness does complicate things a bit
21:02johnwalkeri'm pretty sure okasaki pushed laziness under the rug in his book
21:03hyPiRionjohnwalker: well, there are still similar complications for e.g. persistent queues
21:04johnwalkerif you blog about it i'll read it lol
21:04hyPiRionI think he mentions he calculates amortized time for those structures. But as he's working through the parts in ML, stuff is being realised eagerly.
21:05hyPiRionstcredzero: I'm just tired and have knee-jerk reactions where I don't think before hitting enter, really. It's a bad habit
21:06stcredzerohyPiRion: A friend of mine was runnig a project with really good metrics, and he managed to reduce the number of bugs checked in to the repo by disallowing check-ins after 4:00 pm.
21:06hyPiRionI'm not surprised
21:10johnwalkerhyPiRion, do you know if there's been any progress on #1411 for leiningen
21:11hyPiRionjohnwalker: no, it's mostly technomancy who's pushing that one. AFAIK noone has started working on it
21:12johnwalkeri feel like it might not be a great idea, given the amount of pain most scms deliver to developers
21:13technomancyjohnwalker: as long as the `lein release` stuff turns out fine, I might just close that.
21:13technomancythey're basically addressing the same problem
21:14johnwalkertechnomancy: which issue addresses lein release?
21:14johnwalkeroh, i found it
21:14johnwalkeryeah, i'd be happy with that
21:16technomancyjust keep having issues piling up; not sure when I'll get to the release stuff
21:17johnwalkeri'll try to help out with the programmatic modifications, i've gotten a lot of utility out of leiningen and appreciate the work that you've done
21:18toxmeisterin CLJS what's the equivalent (or closest) solution to `extends?` or `satisfies?`?
21:19johnwalkerrewrite-clj looks like it solves the problem of preserving comments
21:21toxmeisterbasically, I'm having a bunch of unit tests verifying that a type implements certain protocols & I'd really like to have this test in CLJS as well
21:22dsrxtoxmeister: satisfies? exists in cljs
21:22dsrxit's used all over core.cljs
21:23dsrxi think it's a macro though
21:25toxmeisteri thought so too, but i'm working in the chrome js repl... just realized in the compiled version, satisfies lives in cljs.core.native ns... couldn't find it, sorry
21:26dsrxtoxmeister: satisfies? is a macro that expands to something using cljs.core/native-satisfies? (which is an implementation detail I imagine) https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L1013
21:58ddellaco_how do I get foo-macro to evaluate the argument foo-fn is passing it not as a symbol, but as the thing it is bound to--is it possible? https://www.refheap.com/42465
22:01ddellaco_oh, I should add--there is an unstated requirement here that I cannot modify the macro, only the function.
22:01ddellaco_(which is why I'm bothering at all)
22:01johnwalkeroh. well for the macro, i think you would just use ` on v
22:02vladimustWhich http server do you guys recommend?
22:03brehautit depends on your needs
22:03brehautjetty (perhaps with an nginx proxy pass for the front end) does great for smaller sites
22:04johnwalkeri'm not actually clear on your question. doesn't foo-fn already evaluate to a symbol?
22:05johnwalkerdo you want foo-fn to return not a symbol?
22:05vladimustbrehaut: thanks for the recommendation. So jetty is probably better than http-kit?
22:06brehautvladimust: depends on your needs. jetty is very simple to get started with
22:06johnwalkerhttp-kit is a drop in replacement, and has support for websockets
22:06brehautjohnwalker: almost all ring server adapters are drop in replacements. its the point
22:06johnwalkerit's not hard to use or change from either
22:06johnwalkeryep
22:17n0n3suchwhy do all scala developers have hyphenated last names ?
22:18brehautis this a joke?
22:18n0n3suchlol yes
22:18n0n3suchi asked the same question on #scala and nobody responded.
22:18n0n3suchglad to see that there is life in the universe
22:19systemfaultHaha
22:20vladimustsorry to ask a dumb question, but can anyone tell me what ring is?
22:20brehautvladimust: not a dumb question. its the common HTTP abstraction used in clojure
22:20brehautanalogous to wsgi in python or rack in ruby
22:20brehauthttps://github.com/ring-clojure/ring
22:22vladimustbrehaut, so I noticed that a few of the clojure http frameworks are built off of it? If I look into jetty, will I also need ring?
22:22brehautvladimust: yes. basically all of clojures web stuff is built on top of it.
22:23vladimustthanks brehaut :)
22:23brehautthe ring project provides a jetty adaptor that wraps up an internal jetty server.
22:23brehauthow about http://brehaut.net/blog/2011/ring_introduction
22:24brehautstill relevant even though the clojure and lib versions are old
22:24vladimustthanks, I have another dumb question
22:25vladimustAre namespaces used to do the job of classes in oop languages?
22:25vladimustfor instance, a models namespace?
22:25brehautnot really no
22:25vladimustso more like node modules?
22:25brehautlets hope not ;)
22:26brehautthey are just a way of group related names together
22:26vladimusthaha!
22:26vladimustso I can group related functions together, with them?
22:26brehautyes
22:26brehautbut functions dont have datatype ownership like methods in a class
22:28vladimustBy datatype ownership, do you mean inheritance, or..? (sorry, I'm new haha)
22:28brehautor anything like that
22:28brehaut'classical oo' (oo with classes) bundles a lot of ideas together in 'object' and 'class' concepts
22:29brehautone of those things is that methods that operate on a piece of data are owned by that data
22:29brehautyou might have some data that is created in a function in ns foo.bar, but a function in baz.bop has just as much right to work on it
22:29vladimustah
22:30vladimustso namespaces don't own the functions in them?
22:30vladimustand there is nothing stopping functions from one namespace calling on functions from another namespace?
22:31brehautthat'll do for now
22:31brehautjust keep in mind that in clojure you generally dont create datatypes, you use maps and vectors etc
22:31brehautso as an example
22:31brehautring creates a request map for you
22:32brehautbut when your code gets it, its just a map and you have as much access to its internals as ring
22:33vladimustThanks for your help, brehaut. I've saved your page to my Pocket, and will read it when I get home :)
22:33brehautcool
23:04s1gs3gvso how does the performance and scalability of net applications written in clojure compare to those written with the typesafe reactive framework ?
23:16bob2sounds like it'd be up to your code, rather than the frameworks
23:27TEttingers1gs3gv, from what I've observed on single-user applications (not servers), clojure can perform very well but things like pmap for auto-parallel aren't as useful as you'd hope. all my slowdowns in clojure have been algorithmic in my code rather than a result of using a lib or framework
23:28s1gs3gvbob2: TEttinger: ty for your reply
23:28s1gs3gvbenchmarks show clojure much slower than scala
23:30akyteIt depends how it's written. Type annotations can remove much of a performance difference
23:30TEttingers1gs3gv, kinda. I think the PL benchmarks game has some pretty slow implementations for the clojure programs, but they're idiomatic
23:31s1gs3gvakyte: ty
23:32arubinThe TechEmpower benchmarks are more interesting.
23:32arubinBut not every framework has an implementation for every test yet.
23:34s1gs3gvhadn't seen those techempower figures before. ty.
23:40s1gs3gvi am surprised at go's consistent placing near the top of tehempower's benchmarks
23:41bob2also depends on whether you include the scala compile time
23:42s1gs3gvtechempower's figures include compile time ?????
23:44nopromptdnolen_: pretty close to having a beta of this inspector. :)
23:45TEttingerI really consider clojure useful primarily for how expressive it is, and how easy it is to do fairly complex operations on data. if performance was extremely constrained I wouldn't choose it, but I really find it a good language to get stuff done in.
23:46s1gs3gvTEttinger: ^
23:46nopromptTEttinger: one thing i appreciate about clojure, and this is for me personally, is that i find a minimum amount of friction between an idea in my head and code on the screen.
23:47TEttingers1gs3gv, no idea about techempower's benchmarks and compile time, but I doubt they include it
23:47s1gs3gv^
23:47TEttingerscala has really awful compile times is the thing
23:47nopromptso far the limits are really to the extent of my abilities as a programmer. ie. if i can't solve a problem it's because i don't know *how* to solve it.
23:48s1gs3gvTEttinger: we've been spoilt lol. Scala compile times are not really the problem that some make it out to be.
23:48nopromptscala looks like a syntax bomb went off.
23:48sm0keno shit
23:48TEttingers1gs3gv, I knew someone who had to stop using scala because it was taking over a minute to compile... anything
23:48s1gs3gvwell there is the static typing system ... but if it compiles, it generally works
23:49TEttingerhis computer wasn't exactly great
23:49s1gs3gvi think noprompt has expressed the critical issue : how well a language maps to the abstractions in which we think
23:49noprompti've always been curious as to why no type safe lisp has surfaced.
23:49TEttingershen?
23:50inahandizhahttp://VisitsToMoney.com/index.php?refId=386970
23:50TEttingerI'm guessing that's spam
23:50s1gs3gvTettinger: when I started programming, a build was an excuse to hang out in the hallway for half an hour with colleagues lol
23:50nopromptTEttinger: aside frome shen. i've heard mixed opinions about it but have never given it a shot so can't speak to that.
23:50sm0kejscheme
23:51TEttingers1gs3gv, sure but it's still wasted time
23:51dsrxs1gs3gv: having watched paul phillips's collections talk, I believe less in the "if it compiles it probably works" claim :P
23:51bob2shen is both a statically typed non-free lisp and a dynamically typed non-free lisp!
23:51nopromptwrt the clojure as a language dicussion, i wrote garden w/in the first six months of learning clojure.
23:51s1gs3gvTettinger: its not wasted, its an opportunity to interact
23:51s1gs3gvwe have become slaves to instant results
23:52sm0kehmm weird that creator of jscheme is tim hickey
23:52sm0kewhats the odd
23:52s1gs3gvdsrx: in my limited experience, its true
23:52dsrxhttp://www.youtube.com/watch?v=uiJycy6dFSQ
23:53s1gs3gvdsrx: i'm sure there are exceptions
23:53dsrxs1gs3gv: but yeah, it's generally true in the case of languages with powerfulish type systems
23:54s1gs3gvit takes a while to wrap your head around all the complexity of the type systems for sure
23:55dsrxone example is that the scala collections library map doesn't follow the basic law that fmap (f . g) == fmap f . fmap g
23:56dsrxand if you're relying heavily on inference it can break your code in subtle ways
23:56s1gs3gvdsrx: the world isn't perfect, you are correct
23:56s1gs3gvbut i didn't come here to pimp scala
23:57s1gs3gvi like the feel of clojure. i'm just concerned about performance.
23:58s1gs3gvis it possible to write a scalable reliable maintainable net app in clojure that can scale to 100000 users
23:58mark[oz]s1gs3gv: it's still a young language.. it'll improve.. I think the important thing unless you're crunching a lot of data is developer speed & happiness :)
23:58dsrxit isn't a perfection thing, the example phillips gives in the talk is something anyone might write and then end up refactoring into the (broken) state
23:58bob2how could anyone answer that for any language
23:58bob2depends on what the app does
23:58nopromptfor some reason as much as i enjoy languages which rely heavily on type systems, i've never been convinced in one of them that it was the *right* way to program.
23:58sm0kes1gs3gv: given enought machines, yes
23:58s1gs3gvconfigurable scalability ?
23:58nopromptof course, type heads will fight you tooth and nail and tell you how stupid you are.
23:59mark[oz]lol @ s1gs3gv. you're an idiot :)
23:59s1gs3gvlol what's new ?
23:59mark[oz]obviously not the "can it scale" conversation
23:59bob2noprompt, have you tried haskell?