#clojure logs

2013-08-01

00:15rkneufeldPoo, leiningen's :repl-options {:init-ns user} option doesn't work :(
00:34chronnorkneufeld: from an emacs nrepl?
00:34rkneufeldchronno: Plain lein repl
00:35rkneufeldYou basically *have* to have a user.clj on your path somewhere for this project.clj
00:36chronnorkneufeld: Oh. I asked because I saw an nrepl.el workaround for it
00:36chronno:-(
00:37xeqirkneufeld: you wanted it to start in a 'user ns with only clojure loaded/
00:37xeqi?
00:38rkneufeldxeqi: Yeah, wanted to launch into user and then (use 'io.pedestal.app-tools.dev)
00:39rkneufeldxeqi: I'd leave :init-ns out, but :main overrides the launching ns :(, and I'd prefer to leave people in user in case they've done any special stuff
01:15Raynescallen: https://github.com/Raynes/reap My contribution to society for today
01:24bbloomRaynes: i'd heard of elixer, but hadn't seen it. very ruby-ish. looks far more pleasant than the prolog lineage in erlang
01:24callenRaynes: fun.
01:24Raynesbbloom: Yeah, the important thing is that it maintains lots of Erlang semantics and such.
01:24callenbbloom: it's a Clojure inspired language with Ruby syntax.
01:24RaynesImmutability, etc.
01:25callenbut yeah, also very close to Erlang semantically.
01:25sdegutiswhat about it is clojure-inspired, besides immutability?
01:25bbloomdoes it aim for coffeescript-like 1-to-1-ish "transpiler" output?
01:25callenbbloom: no, it's far more useful than that. it compiles directly to bytecode.
01:25bbloomah, interesting
01:26callenbbloom: it also has the distinction of being the only non-Lisp with a significant macro system.
01:26callen(IMHO)
01:26sdegutisbut what about ruby!
01:26bbloomyour opinion is not so humble….
01:26Raynessdegutis: It has protocols, records, macros, a leiningen-like build tool (yay me), etc.
01:26technomancyuh, factor?
01:26callenbbloom: honest
01:26callennot humble. I'm never humble.
01:26RaynesHe said language, technomancy, not backwards day.
01:27callenlol ^^
01:27technomancy=P
01:27sdegutisRaynes: but he ditched the consistent-syntax part
01:27bbloomhttp://docs.factorcode.org/content/article-macros.html
01:27bbloomgreat docs too
01:27RaynesYes, it isn't a Lisp.
01:28bbloomeverything about factor is awesome, except writing your whole program in postfix. i feel like it would probably make a great compiler IR :-)
01:28sdegutisyou can have consistent syntax without being a lisp
01:28sdegutismaybe
01:28RaynesAnd the fact that they never do releases and stuff shit like reddit API clients in the language itself, bbloom.
01:28callenthe point isn't to improve syntax, but by and large eliminate it.
01:28RaynesThey manage the project horribly and it'll never go anywhere because of it.
01:28technomancyreddit?!
01:28bbloomtheir BDFL is MIA
01:28Raynestechnomancy: Yes, factor includes a reddit API client.
01:28sdegutiscallen: agreed
01:29callenFactor has one of the more amusing ratios of "neat language" / "badly managed" I've seen.
01:29Raynesbbloom: Slava did all the things above as well.
01:29callenErlang is up there with Factor in that respect.
01:29technomancywow
01:29bbloom$ find . -name '*reddit*'
01:29bbloom./extra/reddit
01:29bbloom./extra/reddit/reddit.factor
01:29bbloomholy hell
01:29bbloomat least it's in extra, lol
01:29callenI'm surprised you didn't know about that
01:29callenpeople raised a fuss over the reddit client.
01:30bbloomi'm not interested in fusses
01:30RaynesI bitched about it on HN and they said that it's because it's easier to include it with the language than make it a library because Factor doesn't have a package manager or some shit.
01:30callenisn't that a sign you should fix the pkg mgr issue?
01:30Rayneshttp://img.photobucket.com/albums/v91/theemily/image-1.gif my thoughts on that.
01:30callenRaynes: so I saw a plausible package manager for Golang not too long ago. Integrated fairly cleanly, versioned repeatable builds, doesn't require any real action on behalf of the larger community to work.
01:30Rayneshttp://media.tumblr.com/tumblr_lemzzssOGn1qbroyg.gif better gif :p
01:30callenRaynes: community reaction to this compact, nicely designed package manager? crickets.
01:31sdegutiscallen: which?
01:31callenI don't even remember the name, but it's like the third in a series of similar package managers I've seen.
01:31RaynesThe one with repeatability. :p
01:31RaynesI was pretty amused at Go's approach to package management.
01:31callenI don't know if I'm more pissed at the Google devs for not giving a fuck about projects that don't store everything (including deps) in one big p4 tree or at the community for not picking up one of these package managers.
01:32RaynesWhich seemed to be "lol we're so clever we ain't really be needin' one yo"
01:32callenRaynes: run lola run?
01:32sdegutisRaynes: sums up their whole attitude
01:32Raynescallen: wat?
01:32callenRaynes: that's the Golang approach to everything.
01:32sdegutisyep
01:32callenRaynes: the gif
01:32callenRun Lola Run right?
01:32RaynesScott Pilgrim Vs. The World.
01:32callenoh
01:32callendamn.
01:32callenall gingers look alike.
01:32technomancythat a good gif
01:32Rayneslol
01:33callenit's a very expressive gif.
01:33RaynesShe was a very expressive girl.
01:34sdegutisi think the part about the Go community that gets me is how condescending they are about not *needing* anything else.
01:34callensdegutis: they're an off-shoot of the Suckless community which was basically a coven of weirdo Unix ascetics.
01:35sdegutistheir attitude feels like "yeah we dont need [whatever feature] because we're smart, and if you need them you're not smart". its just kinda off putting
01:35callenwho basically didn't believe themselves to need anything other than a hatchet, bit of rope, some flint, and a C compiler.
01:35technomancycallen: I can see the appeal of that ethos
01:35callenI like the suckless community's software but zomg the people are obnoxious.
01:35technomancysuckless has some hot shit
01:35callentechnomancy: compiling their software is nice. you just run a script and it poops out a binary.
01:36callenusually takes one second or less.
01:36technomancyno autotools <3
01:36brehauttechnomancy: its sad that that is worthy of a <3
01:36callentechnomancy: precisely.
01:37bbloomstatic linking for deployment == magical awesomeness
01:37bbloomhence the giant p4 trees :-P
01:37callentechnomancy: I generally use a bash script or scons for my C and C++ builds.
01:37sdegutishow do you motivate yourself to work on work when it screams "im too hard" at you?
01:37technomancybbloom: static linking by default is great, but completely disallowing any kind of loading at runtime is terrible
01:37callenbbloom: I'm a huge fan of static linking as well which is why I'm not a little bit envious of Golang's toolchain. I'm hoping Rust coalesces into something usable soon.
01:37bbloomtechnomancy: i would agree, except it makes perfect sense in google's case
01:37callenbbloom: know any other alternatives on that front? I don't like using C or C++ for my miscellaneous tools and mid-tier stuff anymore.
01:38bbloomand go isn't for you, it's for google & companies like google
01:38sdegutisbbloom: they sure did try hard to make me believe otherwise
01:38technomancybbloom: it's settled then
01:38callensdegutis: golang is oversold. I agree with bbloom on whom Golang is for.
01:39sdegutisi'd agree.
01:39sdegutisi just dont think they advertise that properly
01:39callenI really would like an option for generating statically linked binaries that wasn't OCaml or Golang :(
01:39sdegutisso i wasted a year trying to get something useful out of it.
01:39sdegutisand maybe i did.
01:39callenI spent a similar amount of time trying not to hate it. no dice.
01:39technomancycallen: I'd settle for a library ecosystem and build tool for ocaml =P
01:40callentechnomancy: I guess, I'm just pissed about concurrency still and would rather just build for the "future" by investing in Rust
01:40bbloomtechnomancy: considering you have experience writing such a system….
01:40sdegutiscallen: did you write your own generic versions of map/filter/etc in it using pkg/reflect?
01:40callentechnomancy: my only reservation there would be that Steve Klabnik likes Rust and anything Steve Klabnik likes I am deeply suspicious of.
01:40technomancycallen: I already have a good language to use for when I care about concurrency though
01:40bbloomi don't really trust mozilla to produce anything cutting edge w/o it being "researchy" in that it never is useful
01:40callensdegutis: who doesn't that's used an FP lang before? :P
01:40callentechnomancy: I need compact concurrent binaries. :(
01:40technomancyI just want something for places the JVM doesn't fit
01:40bbloombut rust does look interesting & i'm following it
01:41technomancyand concurrency is usually not an issue in constrained cases
01:41callentechnomancy: makes sense. I'd like something a little more general for JVM-inappropriate stuff.
01:41sdegutisnow, not to be too agist here, but im starting to think that people over 45 just dont know how to program in anything other than C.
01:41bbloomtechnomancy: bootstrap your own forth! ;-)
01:41technomancybbloom: actually considering that, but just for arduino
01:41callentechnomancy: well my use-cases extend from small tools to internal microservices (need conc) to bigger tools (need conc)
01:42callensdegutis: yeah, it's ageist.
01:42sdegutisi know thats not strictly true, since i know many people who use Clojure are that age or older.
01:42callensdegutis: I've gotten greybeards into all kinds of things.
01:42callenincluding meth
01:42technomancyclojurebot: kids these days &c
01:42clojurebotGet off my lawn!
01:42sdegutisbut the vast majority of people i know who prefer writing in C (or Go) turn out to be at least 45.
01:42callensdegutis: I know a lot of aspiring 20-something unix-beards that write Go.
01:43technomancyclojurebot: botsnack!
01:43callentechnomancy: nice pet.
01:43clojurebotThanks! Can I have chocolate next time
01:43callenLOL
01:43technomancycallen: sometimes I forget that he's not rudybot
01:43sdegutissrsly, how do you motivate yourself to work when your day job is way too overwhelming?
01:44callenRust package management documentation: https://github.com/mozilla/rust/wiki/Doc-using-cargo-to-manage-packages
01:44callenyes, it's a stub.
01:44callensdegutis: I get home at 7:30, errands and gym until 10, code until 11:30 or 12, then sleep.
01:44callensdegutis: you just develop a routine and become consistent.
01:45callensdegutis: google, jerry seinfeld don't break the chain
01:45callenof course, I don't have a family like some in this channel, so that's partly how I'm able to get away with that.
01:46callenplenty of successful and prolific people with family and kids. It's no excuse.
01:46callenjust less breathing room to waste time.
01:46sdegutisyeah i had to cut out TV and video games completely from my routine a few years back, just no time
01:47callenmy Steam queue is absurd. :(
01:47sdegutisfix it
01:48callenI explicitly do not want to play that many video games.
01:49sdegutisyou've obviously never played Halo 1 for PC in online multiplayer mode
01:49callenI have
01:49callenI don't think you understand what I mean by Steam queue
01:49callenI have a Steam account with ~300 games of which I've only played 10-15%
01:49sdegutisah, i misread as Stream queue
01:49sdegutiswhoa.
01:50callenI am not going to wrap up that queue in the next 10 years.
06:17ndunbaris there some magic to getting midje autotest working with nrepl mode in emacs?
06:17ndunbarIf I run (autotest) it works, but then doesn't seem to monitor any files
06:17ndunbarwhich change
06:18ndunbarie, and retest the facts governing that stuff
06:19ndunbarusing (require '[midje.repl :refer :all]) followed by (autotest), btw
06:34ndunbarnvm - it looks like a lot of midje-mode is hooked into slime, and I'm using nREPL
06:34ndunbarprobably means that the integration isn't quite as neat as with clojure-test-mode
06:50noncomhi, when i am trying to call (clojure.edn/read), I get CompilerException java.lang.ClassNotFoundException: clojure.edn am I missing a dependancy?
06:50llasramnoncom: Have you `require`d the `clojure.edn` namespace?
06:51noncomnope
06:51llasramWell there you go
06:51noncombut i thought that it was the fully-qualified name and it doesnot need require...? wrong, yeah/
06:51noncom?
06:52Bronsayes, the namespace still needs to be loaded
06:52llasramNamespaces need to exist before you can invoke their functions. You can make a fully-qualified reference whether or not you've `require`d it from a *particular* namespace or not, but the referenced namespace still needs to be loaded
06:57noncomi see, thanks, guys!
07:39jtoyif i had fields = [:a :b] and then a collection, how would I collect all the fields from the collection, my mind is getting stuck ,something like (map #(map (fn[x] (x %) fields) coll) is there a simpler way?
07:40llasram~juxt
07:40clojurebotjuxt is a little hard to grok but it's the best thing ever
07:40ro_st(map (juxt :a :b) coll)
07:40ro_st:b
07:41ro_st: -ing b.
07:41ro_sti really should disable smileys in adium
07:41Anderkentobligatory 'use irssi' comment
07:41llasramOr just "or use an IRC client" :-)
07:43jtoy&(map (juxt :a :b) [[:a 1 :b2][:a 5 :b 7]])
07:43lazybot⇒ ([nil nil] [nil nil])
07:43jtoy&(map (juxt :a :b) [[:a 1 :b 2][:a 5 :b 7]])
07:43lazybot⇒ ([nil nil] [nil nil])
07:43Anderkentvectors arent indexable by keys like that
07:43ro_st{:a 1 :b 2}
07:43ro_stnot []
07:43Anderkent&(map (juxt :a b:) [{:a 1 :b 2} {:a 5 :b 6}])
07:43lazybotjava.lang.RuntimeException: Invalid token: b:
07:43jtoy&(map (juxt :a :b) [{:a 1 :b 2}{:a 5 :b 7}])
07:43lazybot⇒ ([1 2] [5 7])
07:43Anderkentfgagth
07:43jtoy&(map (juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])
07:43lazybotjava.lang.IllegalArgumentException: Key must be integer
07:44Anderkentapply juxt
07:44Anderkent:)
07:44jtoy&(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])
07:44lazybot⇒ ([1 2] [5 7])
07:44jtoyhmm, I dont really understand how to use apply
07:44jtoybut cool
07:44ro_styes, you do
07:44Anderkentyou use apply whenever you want to use a list of args to a function instead of putting the args one by one
07:44ro_st(+ 1 2) = (apply + [1 2])
07:45Anderkent(apply juxt [:a :b :c :d :e :f]) is equivalent to (juxt :a :b :c :d :e :f)
07:45jtoyah, that is much clear definition than clojrue docs i think
07:45jtoy(doc apply)
07:45clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
07:45Anderkenti.e. you're applying a function to a list of args
07:45ro_stwell, the doc also talks about how you're able to supply individual args before the seq you supply
07:45Anderkentwell, because it has to handle the case where you're specifying some args manually and putting the rest in a list :P
07:45ro_stwhich is rather critical to making it a swiss army knife
07:46Anderkentthat's useful because otherwise you'd have to do (apply (partial function first second third) [fourth fifth sixth])
07:46Anderkentwhich is ugly :)
07:53jtoyso i am using apply juxt, is there a clean way to do this simple transfomr without 2 maps: (map #(str "[" (clojure.string.join "," %) "]" ) (map (apply juxt fields) data))
07:54jtoydoesnt look like it
07:56ro_st(map #(->> % (juxt fields) (string/join ",") (format "[%s]")) data)
07:58jtoyro_st: cool, that is really nice, didnt even know about format
07:58ro_stcemerick! interested to see that you're working on 'su' support in friend. i see it's still in progress. is there something to see, yet?
08:00cemerickro_st: no...but "working on" is deceptive. ;-) It really should be ~10 lines to implement, tho.
08:01ro_stcool. we have this as 'impersonation' in our system and it's been indispensible to us
08:01ro_stbe great to have it in friend, as well.
08:01ro_sti'm surprised that remember-me hasn't been added yet. people must prefer not to do that!
08:04wunkiwhen I run `lein deploy` to my S3 repository, Leiningen only deploys jar's including the date. But `lein deps` tries to find them without date.
08:04wunkiE.g, `gibbon-api-0.1.0-20130801.111350-1.jar` is available but lein deps searches for `gibbon-api-SNAPSHOT.jar`
08:05wunkianyone know what I did wrong in my `project.clj`?
08:08TEttingerwunki, did you try lein jar first? I'm not sure what type of deps these are
08:08Anderkentwunki: would be easier if we saw the project.clj. It sounds like you're deploying a non-snapshot build, but your dependency is a snapshot
08:11wunkiAnderkent: I'm deploying with this: https://gist.github.com/wunki/6b5faa5f2ee6fa2f257a
08:11wunkiTEttinger: `lein jar` doesn't change anything for `lein deploy`
08:12wunkiDeploying with `lein deploy "gibbon-snapshots" works btw, this is the output:
08:12llasramSo how are you trying to depend on it?
08:12wunkihttps://gist.github.com/wunki/29cbb36955aeca958436
08:13wunkias you can see in the above, it only upload the .jar with the data attached
08:13wunkiin another project, I depend on it like this:
08:14wunkihttps://gist.github.com/wunki/4af6b68fcf9f0f39182f
08:14Anderkentwunki: is your s3 repository marked as allowing snapshots?
08:15cemerickro_st: remember-me is a dubious feature; there have been some ranty blog posts about it compromising security, which I haven't investigated/thought about hard enough to decide either way. Also, demand for it lessens every day oauth/openid/browserid is available.
08:15wunkiAnderkent: dunno, how could I check?
08:16Anderkentwunki: hm, my bad, seems lein should derive whether that's a snapshot or not based on your version string.. Curious, looking into it
08:18Anderkentwunki: can you post output from the deploy run that pushes wrong versions?
08:18llasramThere's no wrong versions
08:18wunkiAnderkent: https://gist.github.com/wunki/4af6b68fcf9f0f39182f
08:18Anderkentprefferably from DEBUG=1 lein deploy
08:19llasramThat's how SNAPSHOT dependencies look "for real" -- a timestamp
08:19Anderkentllasram: oh, didn't know that
08:19Anderkentso it seems the problem is that it's not consulting the private repo for snapshot releases
08:19Anderkentright?
08:19clojurebottechnomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener.
08:19jtoy(map #(->> % (juxt [:a :b]) (string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])
08:19llasramthanks, clojurebot !
08:19jtoy&(map #(->> % (juxt [:a :b]) (string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])
08:19lazybotjava.lang.RuntimeException: No such namespace: string
08:20jtoy&(map #(->> % (juxt [:a :b]) (clojure.string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])
08:20lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$juxt$fn__4053
08:20jtoy&(map #(->> % (apply juxt [:a :b]) (clojure.string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])
08:20lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$juxt$fn__4055
08:20llasramjtoy: you're calling `juxt` wrong
08:21llasramAnderkent wunki: does it help to add an explicit `:snapshots true` to your private repository map in the depending project?
08:21AnderkentI'd expect that to help, yeah
08:21wunkillasram: let me try
08:21llasramOh, and maybe `:update :always`
08:21jtoyllasram: what is wrong? this one works: &(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])
08:21jtoy &(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])
08:22jtoy&(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])
08:22lazybot⇒ ([1 2] [5 7])
08:23Bronsajtoy ##(map #(->> % ((apply juxt [:a :b])) (clojure.string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])
08:23lazybot⇒ ("[1,2]" "[5,7]")
08:23wunkillasram Anderkent: `:update :always` did the trick
08:23llasramjtoy: Yes, but that's not how you're calling it with `->>`. That's just sticking it as the last arg
08:23llasramwunki: Awesome!
08:23wunkillasram: any idea why I _need_ to set it explicitly?
08:24Anderkentwunki: I suppose the default is :daily
08:24llasramI think so too
08:24Anderkenti.e. it only checks for new snapshots once a day
08:24llasramThe maven repo format (oddly, for the java-verse) is designed for simplicity over e.g. metadata efficiency
08:24llasramand checking for new snapshots involves crawling the whole (sub-)directory tree
08:24Anderkent(that's because without it if you have a snapshot dependency any command will cause a roundtrip for checking each snapshot dep, thus slowing stuff down)
08:25jtoyBronsa: why is the second parens needed?
08:25wunkillasram Anderkent: thanks a lot for your help guys
08:25Anderkentjtoy: because (->> something (apply juxt [:a :b])) means (apply juxt [:a :b] something
08:26Anderkentwhereas what you want is ((apply juxt [:a :b]) something) , or ((juxt [:a :b]) something) - juxt returns a function that you need to call with your 'something'
08:27jtoyi see
08:46ro_stjonasen: i'm the tirekicker on your datalog thing :-)
08:50jonasenro_st: Thanks for your participation
08:51ro_stmy pleasure!
08:51jonasenkeep the suggestions coming :)
08:51ro_stthanks for putting this together!
08:51ro_sti totally didn't know about the relations destructring. [[?one ?two]]. that's really handy
08:52ro_stthere are a number of typos best dealt with as a PR. so when you decide you can take those, i'd be happy to do a proof edit for you too
08:52jonasenyeah, I'm sure there are hundreds
08:53ro_stare you planning a Learn Datomic Transactions Today! too?
08:55jonasenro_st: I've been thinking about it... but no concrete plans
08:55ro_stit'd be totally worth it. perhaps we can collaborate. there are plenty of useful things to know about transacting
08:56ro_stwriting stuff directly to the in-situ transaction entity is a particularly nifty one
08:56jonasenro_st: sure!
08:57ro_stquery's working now. awesome!
08:57ro_sti'll do all the examples soon
08:57jonasengreat!
08:58snake-johnjust one diatomic question. when i get a datomic connection with (def db (d/db conn)) and then afterwards update some entity attrib and they query agains this old db var do i get the new attribute?
08:58ro_stno
08:58ro_stat that point, db is an immutable value
08:59ro_styou'd have to get a fresh db with (d/db conn)
08:59snake-johnso i then need to do a (d/db conn) again ?!
08:59ro_st:db-after in the map returned by (d/transact) also contains the new db
08:59snake-johnok thanks ! I understand ! thanks
09:00ro_styou can just use (defn db [] (d/db (conn))) and (db) in all your queries
09:00ro_stto automatically work against the 'now' database
09:00ro_stthere's no performance penalty to doing so. it's just a pointer to a transaction in the db
09:00ro_stin the index*
09:01snake-johnthanks a lot !
09:01ro_stthis is what makes it awesome, by the way. this means you CAN grab a db reference and work against it without the 'world' changing under you
09:02tbaldridgesnake-john: that being said, doing what ro_st suggests isn't really the *best* way. As much as possible, deref once and query multiple times
09:03snake-johnif i use the free edition.. can I store the data somewhere permanently or is it just in memory?
09:03tbaldridgeFor instance, in a ring based REST service I wrote, I dereffed the DB once, inside a middleware, so every query executed by a single REST request will use the same copy of the DB
09:03tbaldridgesnake-john: Free supports disk storage on the local disk
09:03ro_sti recommend playing with building transactions up with (for) etc and then using (def try-db (d/with (db) the-tx). this gives you an in memory copy of the database *as though* the transaction had been committed, which you can then query against (d/q '[…] try-db)
09:04ro_sttbaldridge: yup. thanks for mentioning that
09:07snake-johnjust guessing so the disk storage could make it appear faster then going with sql server storage? (since the sql server obviously would add some overhead)
09:07ro_stonly for initial cache filling. after the cache is warm, it wouldn't matter much
09:08ro_stany new data coming in while the peer is connected receives it directly from the transactor as it's transacted. this would only matter for data that's in storage when the peer starts up
09:09ro_stthis is important if you're using continuous deployment and your peers restart all the time. this is why PRO's memcached support is so useful
09:13snake-johnro_st: maybe you know? did garbage collection ever hit you when running datomic? I am just guessing that it could be a problem with all that happening in memory?
09:15ro_stour databases haven't yet exceeded the available ram :-)
09:15ro_stand we also deploy multiple times a day
09:15ro_stsuffice to say, we're going to keep our memcached server(s) well supplied
09:17snake-johnhow much ram?
09:18ro_stour databases are just shy of 2gb. we've more than that on the server
09:30tsdhI'm just refactoring a project to drop (:use ...) in ns declarations and to use (:require ... :as ...) instead. Is there a (lein) way of just loading all namespaces? Running the tests works, but those take quite some time...
09:31ro_stcheck out bultitude
09:31tsdhAd, even simpler: "lein check" seems to do what I need.
09:31ro_styou can glob all the namespaces using a string pattern and then iterate over them doing (require)
09:31ro_stoh, you just wanted to compile everything? yeah, lein check :-)
09:32tsdhro_st: Yeah, that's enough right now.
09:49bjacan I generate a function or a macro that actually returns two expressions? I think that I cannot, but I want to see if I'm missing something
09:49nDuffbja: what are you trying to accomplish?
09:49bjasimple template replacement with hiccup
09:50bjabut I think I need to go above
09:50bjai.e.
09:50nDuffbja: well, you can return a list with two expressions and splice it in.
09:50ro_streturn a list and use destructuring
09:51ro_st(let [[one two] (your-function args)] …)
09:51bja[:body [:label][:input] [:label][:input]] seems like I'm rewriting [:label][:input]
09:52bjawell, rewriting it a lot
09:52bjaand it would be nice to say (for [x (range N)] ...[:label] [:input]....)
09:53ro_st[:body (for [[label id] [["Name" "name"] ["Email" "email"]]] (list [:label label] [:input {:id id :type "text"}]))]
09:53bjaro_st: err, yes. I can do that if those are the only things in the body
09:54ro_styou can put more stuff before and after the (for)
09:54bjaI suppose I'm probably going to have to replace my top level [:body] with something that generates a body for me
09:54ro_stlast para and code sample on https://github.com/weavejester/hiccup
09:57atyzSup y'all
10:05bjaro_st: thanks. I don't know what I was doing last night, but I swear I tried passing hiccup a list of vectors for it to automatically expand (like the docs mention), but I couldn't get it to work. thanks again.
10:11speedwagon2Hi! When I nrepl-jack-in or start lein repl from emacs, my JAVA_OPTS are ignored (I need more heap space). When I start from the command line (i'm under windows) they are correct. Where can I find documentation ?
10:12ro_stput :jvm-opts ["-Xmx2g"] into ~/.lein/profiles.clj
10:12ro_stuse your own value, of course
10:13speedwagon2Ok, I will try that out. Thank you
10:14ro_stif you don't have such a file yet, your whole file's contents will be: {:jvm-opts ["-Xmx2g"]}
10:14duck1123Is there a way, given a symbol representing a namespace, to require that namespace and warn/ignore if the file doesn't exist, but fail on any other error from loading that ns?
10:15ro_stbultitude might have a tool for testing for the existence of an ns
10:15ro_stwe use it to glob for ns's by string pattern and then iterate over them with require
10:16duck1123This looks like it should get me started. thanks
10:16Anderkentwell, you can just check if 'package/names/namespace.clj' or the respective class files are on the classpath even if bultitude doesnt do it for you. Or if you just need a quick hack, do (try (require symbol) (catch FileNotFoundException (probably-not-available-unless-ns-compilation-throws-file-not-found))
10:17duck1123I was looking into tools.namespace and didn't find what I wanted
10:17ro_stthe FileNotFound exception thing looks promising, too, nice Anderkent
10:17Anderkenttrying hard for them internet points
10:17duck1123Anderkent: problem with that is if the required ns throws a filenotfound on one of it's deps, it won't fail
10:18Anderkentduck1123: right, that's true.
10:29konrCan't I add metadata to a string? (with-meta "foo" {:bar :baz}) fails
10:33`foguskonr: No, strings are out. http://clojure.org/metadata
10:33duck1123konr: Strings can't accept metadata. The type has to have support for metadata and strings do not. They're also final, so can't be subclassed
10:33ro_st`fogus: how applicable is functional javascript to someone who only ever plans to do clojurescript from now on? :-)
10:34`fogusro_st: You've already achieved enlightenment. No need to go backwards.
10:35ro_stthought so. just checking -grin-
10:35ro_sti tried to do JS again the other day. i cut myself on all the underscores and semi-colons
10:37duck1123`Don't forget the mandatory commas to separate list items...
10:37ro_styuck
10:37augustlfunctional programming with mutable data, oh joy
10:38`fogusIt's only mutable if you mutate it. ;-)
10:38snake-johnfogus: I have the joy of clojure book and also the "2 edition MEAP" : Since I prefer reading books can I read the book and only the chapters of the MEAP not included in the book. Or would you suggest I stick to the MEAP pdf because maybe you have updated a lot?
10:39ro_stthe structural sharing in clojure's data structures make a biiiiig difference
10:39ToxicFrogMEAP?
10:39clojurebotManning missed the opportunity to call it Manning Early Access Trial
10:39pjstadighaha that's still in there
10:39augustlro_st: I'm planning on using mori in my next js project. I've found that immutable values is what empowers me the most in Clojure
10:40`fogussnake-john: It's not likely to change much from this point (except for the still-in-progress CLJS chapter), so you can read now if you'd like
10:40ro_staugustl: that's awesome, but why js?
10:40ro_stwhhhhyyyyyy
10:41augustlro_st: mostly just convenience, not having to have a compile step, deal with source maps, etc
10:41`fogusro_st: Absolutely (re: sharing)
10:41snake-johnfocus: thanks for the info!
10:41ro_staugustl: we obviously have different ideas about what convenience means -grin-
10:41augustlhaha, zing :)
10:42speedwagon2:ro_st It looks like the ~/.lein/profiles.clj is ignored. At least i see no success and (println (.getInputArguments (ManagementFactory/getRuntimeMXBean))) shows no success either.
10:42augustlI also end up with a build step anyway, for deploying minified code to CDNs.. So yeah.
10:42ro_stspeedwagon2: lein version
10:42ro_staugustl: lein cljsbuild auto dev. boom.
10:42ro_sti've not needed a sourcemap once, yet
10:43speedwagon2Leiningen 2.2.0 on Java 1.7.0_21 Java HotSpot(TM) 64-Bit Server VM
10:44augustlro_st: I'm out of reasons, seems my next project will be cljs :)
10:44ro_stspeedwagon2: hmmm. it should work. i'm not sure what else to suggest
10:44ro_staugustl: my pleasure -grin-
10:45speedwagon2I think I will search for an answer later. It is just for one short project.
10:45`fogusOne advantage of being intimately familiar with the CLJS compiler is that I can debug the generated code and map it back in my head to the CLJS source. I wouldn't wish that one anyone however. Source maps are a "good thing"
10:46ro_sti find the :simple output quite readable
10:47augustloh nice, does it magically decomplect your code? :P
10:47ro_stin that it maps quite closely to the clj source. you do bash your head a couple times, but you quickly learn what errors mean what
10:48ro_stcould not call method 'foo' of undefined usually means a missing require, for example
10:49ro_sti must admit, having hand-coded google closure javascript for 8 months prior does help a little
10:49ToBeReplacedis there a tentative release date for core.async?
10:50ro_strelease in what sense? i thought it was already useable?
10:51ToBeReplacedonly snapshots so far
10:51ro_stah
10:51squidzget in allows to pass an index for array values like (get-in mv [:pets 1 :type]) where 1 is the first map in the array of objects- :pets. Is there a way in clojure to get all the objects values instead of just specific ones specified with indexes?
10:51tim_ToBeReplaced: not really...but there's no issue with running the snapshots is there?
10:51tim_you can grab them from sonatype
10:51squidzexample is here in line 35 http://clojuredocs.org/clojure_core/clojure.core/get-in
10:53ro_stsquidz: so you want all the :type values in all the maps in the :pets vector?
10:53ToBeReplacedno problem for hacking, but for releasing
10:53squidzro_st: yes
10:53ro_st(map :type (:pets thing))
10:54squidzoh right duh thanks
10:55speedwagon2:ro_st I changed the profiles.clj to {:user {:jvm-opts ["-Xmx2g"]} } and it seems to work in the windows shell, but not in emacs. Still no success under emacs. What is the difference between nrepl-jack-in and M-x shell lein repl anyway?
10:56ro_stspeedwagon2: what if you lein repl and then jack into the existing process from emacs?
10:56ro_stie, with M-x nrepl
10:57speedwagon2I will try that.
10:57ro_sti generally start repls from the terminal so that i can see std-out output there and then jack in
10:58ro_stgood luck, speedwagon2!
11:00functionformif loop should always be used with recur, why isn't there a loop-recur macro or something similar - or is thatwhat for is?
11:01speedwagon2Hooray, everything works.
11:01functionformi tried peeking at the for code, but it is tough to follow
11:03llasramfunctionform: No, `for` produces lazy sequences
11:03duck1123what would a loop-recur macro do? You don't exactly know where in the form your recur will appear. (aside from in a tail position)
11:04jtoycan anyone recommend a simple way to take x from a coll, and if there is not x then take the rest from another collectino, like (take-n 3 [1 2] [11 22 33 44 55]) => (1 2 33)
11:04llasramjtoy (take n (concat a b))
11:05llasramOh, not quite: (take n (concat a (drop n b)))
11:06duck1123,(let [a [1 2] b [11 22 33 44 55]] (take n (let [ca (count a)] (concat a (drop ca b)))))
11:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: n in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:07duck1123,(let [n 3 a [1 2] b [11 22 33 44 55]] (take n (let [ca (count a)] (concat a (drop ca b)))))
11:07clojurebot(1 2 33)
11:08llasramYeah, really shouldn't answer questions unless I'm going to pay full attention
11:08llasram(incn duck1123)
11:08llasram(inc duck1123)
11:08lazybot⇒ 5
11:08technomancyduck1124
11:09llasramlol!
11:10jtoy&(take 2 (concat [1] (drop 2 [3 4 5])))
11:10lazybot⇒ (1 5)
11:11jtoythanks
11:31gfrederickskind of unfortunate that ##(doc partition) doesn't mention partition-all
11:31lazybot⇒ "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complet... https://www.refheap.com/17111
11:32llasramgfredericks: Just submit a pull reqjira
11:34llasramI wonder how much fragmentation would result from a "community fork" of Clojure which focused on documentation improvements, bug fixes, usability, and easy of contribution
11:34pjstadigyeah, i'm not sure it would be worth it
11:34pjstadigbetter to keep the community together i guess
11:34pjstadignot that I or others haven't considered it
11:34antares_llasram: unfortunately, it's unlikely to take off because its authors won't have superior hair
11:35devntechnomancy: syme is borked. I don't have time to look into it at the moment but it looks like it's blowing up in syme.instance/create-security-group: 2013-08-01T15:11:18.142752+00:00 app[web.2]: java.lang.IllegalArgumentException: No matching field found: getErrorCode for class java.lang.NullPointerException
11:35llasramThe hair is a definite issue
11:36tbaldridgellasram: doc fixes are normally accepted verbatim. At least that's been my experience with JIRA and docs.
11:36tbaldridge*Clojure's JIRA
11:37antares_tbaldridge: from the priviliged developers living in teh USA or Western Europe, that is
11:37antares_others have to wait for months before they can contribute a trivial one line fix
11:38tbaldridgeThere it is...I was waiting for the obligatory comeback. Can we add that comment to lazybot or clojurebot? It'd save the community a ton of time :-P
11:39antares_:)
11:41sveduboisHello, I would like to obtain from this input: 7 (0 4 3), the output 7.
11:42sveduboisI tried this:
11:42sveduboisprint "7 (0 4 3)" | awk '{for(i=1;i<=NF;++i) if($i~!/\(*\)/) print $i}'
11:42sveduboisbut the result is (0
11:42sveduboisand not 7
11:42llasramsvedubois: You may be on the wrong channel
11:42tbaldridgesvedubois: wrong chat room?
11:42sveduboisYes,
11:42sveduboissorry
11:42tbaldridgeit's ok, it's your first offence
11:43tbaldridge*offense
11:43tbaldridgenext time we charge you $0.25 USD
11:43gfredericksllasram: ha
11:45gfrederickstbaldridge: it feels bulky to create an entire ticket for one doc fix -- is that the normal approach?
11:46bhaumanantares_: are you living in Argentina? I ask because Antares is a beer there.
11:46tbaldridgeyep. Patch to clojure has to be written by someone with a CA, every change has to be approved by Rich. JIRA is the way all that's tracked
11:46antares_bhauman: Moscow, Russia
11:47bhaumanantares_: well at least you guys have Snowden
11:48antares_bhauman: I wish Snowden had a way to let me contribute to Clojure easily, without all this idiocy with mailing pieces of paper to North Carolina
11:48antares_but alas
11:48bhaumanantares_: I'm in North Carolina and I can't imagine it would be easier for me :)
11:49tbaldridgeIt all comes down to copyright/patent law. When stupid things in America exist like patents, it's best to err on the side of too much protection. See for instance how Microsoft gets $5 for every Android phone sold.
11:49antares_tbaldridge: oh come on, how many OSS projects don't have this kind of bs?
11:49antares_please don't tell me it's the only way
11:49antares_lets face it, mr. Hickey is fucking paranoid
11:49bhaumantbaldridge: I wish you hadn't let me know that - day ruined
11:49antares_and Clojure/core does not care about improving the situation
11:50tbaldridgeantares_: that doesn't mean that they can't be sued to oblivion if someone cared enough about them
11:50piranhabecause they all have signed already :))
11:50antares_piranha: exactly!
11:50antares_tbaldridge: does that happen in practice?
11:50tbaldridgefor that matter, what does a stamp cost (weekly wages wise) to send something to NC from Russia, I'm curious, as I've heard tons of people complain about it.
11:51antares_tbaldridge: how many cases of OSS language implementators being sued can we name?
11:51antares_tbaldridge: you have two ways, either a cheap but unreliable and *really* slow regular snail mail (2+ months estimates) or $220 for fedex and such
11:51piranhatbaldridge: it's either a lot (if you use FedEx/DHL) or you have a *very* high chance that your mail will never arrive anywhere :)
11:52antares_and the situation is very much the same in India and Brazil, I know from friends there
11:52piranhaantares_: you should just give a mail to somebody going to Europe and get them to send it, hehe :-)
11:52tbaldridgeinteresting. I just remember the old days, sending letters to Turkey (my sister had a pen pal), it was what...$0.70 back in the mid 90's?
11:52piranhatbaldridge: but yeah, you see, it's quite cumbersome situation
11:53AnderkentWhy does it have to be snail mail and not for example a pgp-signed statement, or scanned doc / fax? Doesn't seem like it gives any security improvements
11:54antares_Anderkent: some believe lawyers only trust cold hard paper
11:54tbaldridgeAnderkent: like I said, outdataed US copyright/patent law
11:54piranhatbaldridge: well sending a mail from ukraine to netherlands costs around 3 dollars and it arrived in a week or so, but it's a bit better here, russian post is the worst :)
11:54nDuffUS law gives faxes privileged status.
11:54tbaldridgeremember, we're the people that consider corporations to be "people"
11:55nDuff...so a PGP-signed statement or an email I can grok being a problem; a fax, not so much.
11:55Anderkentwell, maybe clojure should run away and get asylum somewhere more reasonable... :P
11:55tbaldridgeEh...US copyright law applies most other places as well (or more correctly the less strict laws of other countries don't always apply here)
11:55Anderkentto the moon we go!
11:58antares_nDuff: I have never used faxes, how do you put a signature on it?
11:58antares_there are PDF-to-fax kind of services that are really cheap and easy to use, I know as much
11:59nDuffantares_: by printing the document, signing the piece of paper it's printed on with a pen, and then putting the signed document in a machine that both scans it and sends the fax.
11:59Anderkentyou print it out, sign it, then fax it somewhere. Or print, sign, scan, email to someone who has a fax :P
11:59boodleCan someone point me to a non-atomic way to mute a map nicely: https://www.refheap.com/17112
11:59antares_nDuff: ok, so basically by scanning first
11:59justin_smithI think the idea with a "normal" fax you are expected to feed a piece of paper in (that has been signed in this case)
12:00Anderkentboodle: did you try update-in ?
12:00antares_boodle: assoc, update-in, merge?
12:01boodleAnderkent: the trouble is I need to do comparisons before updating.. and continue with the (potentially) updated map onto the next comparison
12:01CookedGryphonboodle: that code is gaining nothing from the atom if you use reset instead of swap
12:01CookedGryphonboodle: and there should never ever be a def inside a defn
12:01boodleAnderkent: I know if could do it via a bunch of if-lets but would get kludgy too
12:01antares_boodle: well, still you should probably use assoc instead of reset! + merge
12:01justin_smithboodle: also, def inside defn is almost always wrong - especially if the value of the def is what you are returning; use let
12:02boodleOk, hehe I get it on the def inside defn (borks my vim folds too!)
12:02antares_boodle: or swap, if you need to update an atom
12:03piranhaboodle: https://www.refheap.com/17113 something like this?
12:04boodleI'd like to use let but would end up with longer if-lets I think. Case/Cond won't pass updated values along either.. and can't recurse a call because the conditions still hold ("stock" e.g.)
12:04boodlepiranha: thank you!
12:04piranhamaybe moving condition function to let will make it look nicer...
12:04boodlepiranha: but (-> is what I need I think
12:05Anderkentthe first condition doesnt look that well in update-in
12:05piranhaboodle: sure :)
12:05piranhaAnderkent: indeed, I think extracting it to let or to real function will make it look nicer
12:06boodleyep I'll write a "update-in-if" fn to wrap it nicely
12:06AnderkentI think I'd prefer https://www.refheap.com/17115
12:07Anderkentjust to keep it simple
12:07boodleAnderkent: I wanted to avoid all the "p"'s in the 'else' portions
12:07justin_smithboodle: another approach https://www.refheap.com/17114
12:08justin_smithmine is not as good as piranha's actually
12:08Anderkentboodle: right, it's a little messy but it's a pretty common thing and at some point it just becomes boilerplate that you gloss over
12:08boodlejustin_smith: sure. I kind of like pirahna's with a wrapper fn which then gets more to the core logic being clear
12:12instilledhi! I have a macro that generates two definitions (def …) where the latter depends on the former. When I invoke the macro I get an exception that (the latter) is unable to resolve the symbol defined in the former. Am I missing the obvious?
12:12technomancyclojurebot: gilardi scenario
12:13clojurebotThe Gilardi Scenario is where you can't compile a form because the form contains definitions needed to compile itself: http://technomancy.us/143
12:13technomancyinstilled: ^ you're running into that
12:14instilledtechnomancy: cheers, will read through your article!
12:15hiredmaninstilled: before you do that I recommend macro expanding your macro to see if you get what you think you'll get
12:19clj_newb_2345are there any online collaborative efforts for newbs to together-read open source clojure projects?
12:24instilledtechnomancy: nice article! that definitely solved my problem.
12:24instilledthanks.
12:25technomancyinstilled: it's a tricky one
12:44daydreamtr
12:44kmicus
12:50pjstadigt
12:50gfredericksu
12:51justin_smith,(char 118)
12:51clojurebot\v
12:52squidzdoes anybody here that is using the strokes library have an idea why using maps passed to the (.attr {:class "smth"}) doesnt work?
13:09dnolennew blog post, CSP is Responsive Design - http://swannodette.github.io/2013/07/31/extracting-processes/
13:10dnolenfeel to upvote on HN if you feel so inclined
13:11tbaldridgewill up vote first, then read
13:11kmicuI read it few days ago. Good writing.
13:11seangroveUpvoted
13:13bhaumanupvoted but it didn't take
13:14squidzcool. I have been waiting for your next post
13:14katratxodnolen: your CSP link is correct? should i search for the right meaning in wikipedia?
13:17dnolenkatratxo: thx fixed
13:17katratxodnolen: :)
13:19bhauman"It's critical that the currency of event cordonation be at a higher lever than concrete event sources like key presses and mouse movement" … that says zoo much
13:20bhaumanr/zoo/so/
13:20bhaumandnolen: ^
13:22dnolenbhauman: heh
13:22kmicudnolen: your approach is like a small Pedestal, but for UI - great separation. I look forward to the next post.
13:24bhaumankmicu: I think having a bunch of small pedestals like processes is more expressive/responsive than jamming it all into one large event stream
13:33IamDrowsydnolen: the last example does not work with firefox for me (22.0 for ubuntu) ... chromium, opera and rekonq are totally fine
13:33dnolenIamDrowsy: k thx, will look into it later
13:35kmicuThe same with 25.0a (xulrunner/conkeror), but Gecko sucks anyway.
13:41seangrovednolen: Good post, looking forward to bigger examples
13:41dnolenseangrove: the bigger example don't look much different, just more code
13:41dnolenand thus harder to understand
13:45bhaumandnolen: yes very good post. I get that you are stringing reusable components that speak a certain protocol together forwarding all messages to then next component. Might be nice to just show the simple wiring. (-> (keychan) (highlighter name-list) (selector name-list data)) 
13:49dnolenbhauman: yes it took me a while to come to that idea actually. Otherwise you need to do a lot of yucky multiplexing
13:50dnolenbhauman: it kind of makes sense and strangely aligns with how people use objects
13:50bhaumandnolen: yep, its also like piping atoms together as well
13:51kmicujavascript devs who read David's latest CSP posts... http://www.youtube.com/watch?v=vh3tuL_DVsE
13:52hiredman,(doc max-key)
13:52clojurebot"([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."
13:52bhaumankmicu: freaking funny
13:54kmicubhauman: not funny, it is based on true story
13:54kmicu;]
13:55gavriis there a built-in way for me to find the most frequently occurring element in a list?
13:55technomancy(doc frequencies)
13:55clojurebot"([coll]); Returns a map from distinct items in coll to the number of times they appear."
13:55gavritechnomancy: thanks a lot
13:55technomancyno problem
13:56bhaumankmicu: oh, does something tragic happen at the end?
13:58juhu_chapaHi guys!
13:58upwardindexI would like to add a watch to a server-side atom from clojurescript, is that possible?
13:58juhu_chapaWhy 'a is a symbol? i.e. (symbol? 'a) returns true
13:59dnolenbhauman: I never like thed atom watcher pattern
13:59dnolenliked
13:59gavrihttp://clojuredocs.org/clojure_core/clojure.core/frequencies says that frequencies is in clojure.core, but it isn't available from the console. does clojure.core have to be explicitly required?
14:00technomancygavri: are you using an old version of clojure?
14:00seangrovegavri: Seems to be available in the repl on my side, clojure 1.5.1
14:00gavri1.1.0
14:00gavriweird
14:00technomancywow, where did you get that? =)
14:01gavrithought I was working with a not-so-old distribution
14:01seangroveAn archaeology dig, I assume
14:01gavriit's my friends linux mint
14:01gavrilol
14:01gavriit's not an old linux mint, AFAIK
14:01kmicubhauman: yes - callbacks, very tragic
14:02seangrovejuhu_chapa: What else would it be?
14:03juhu_chapaseangrove: A symbol must resolve to a value. I cannot see that in this example.
14:03ToxicFrogjuhu_chapa: is this a trick question?
14:04ToxicFrogNo resolution is performed, you just get the symbol back.
14:04seangrove,(do (def f) f)
14:04clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
14:04technomancyjuhu_chapa: an evaluated symbol must resolve to a value
14:04ToxicFrogSimilarly, '(a b c) is a list of three symbols, not the result of calling a nor a list of the values those symbols evaluate to.
14:04technomancythe whole point of quoting is to prevent evaluation
14:07juhu_chapaI see, thank you guys.
14:09kmicuIt turns blue
14:12llasramgavri: If you're trying to develop with Clojure, you're best off installing Leiningen (ideally directly from http://leiningen.org/) and letting it pull in a recent version of Clojure
14:13gavrillasram: thanks. I'll do that
14:15squidzhaha
14:15llasramMan, need to work on coherence today
14:15technomancynothing to see here; move along
14:17squidzdidnt know #clojure was so shady
14:18gavrido I uninstall clojure before I use leiningen?
14:18technomancygavri: you don't need to
14:18gavridoesn't hurt if I do though, right?
14:18llasramRubber-ducking, if anyone has any thoughts/existing libraries. I want to write a reducer which yields a sequence of reductions of sub-sequences of the original list which are equal according to a provided comparator
14:18technomancyright
14:19llasramContrived example: (->> [1 1 1 2 2 2] (reduce-group = +) (r/reduce conj [])) => [3 6]
14:20llasramDoes this match any patterns/functions I'm just not already aware of?
14:23llasramActually... I think it can't be done with reducers, because there's nothing to terminate the final group :-/
14:25hiredmanyou can do it via reduce, you just need a sort of extra clean up bit at the end
14:29piranha(let [c (chan)] (go (loop ... )) c) pattern seems to happen *very* often
14:29llasramhiredman: I think you're right. The reducer object will just need to implement the reduce protocol directly instead of doing the base reducer library direct function composition approach
14:30ToBeReplacedllasram: does partition-by help?
14:31ToBeReplaced,(->> [1 1 1 2 2 2] (partition-by identity) (map (partial reduce +)))
14:31clojurebot(3 6)
14:32llasramToBeReplaced: I'm trying to stay in reducers vs lazy seqs, but good point
14:33coventryIs anyone here using the debugging facilities in ritz-nrepl on a routine basis? I'm finding it very unstable. While playing with it, I frequently have to restart "lein ritz-nrepl", apparently because the debugee clojure process it's communicating with stops responding, at least that's what I'm guessing based on the "--log-level trace" output: I see the requests going in from emacs, but nothing coming back out.
14:34ToBeReplacedllasram: so is the issue that it's hard to implement partition-by as a reducer?
14:34llasramToBeReplaced: Definitely not trivial, but may not be that hard. Trying now that you've pointed out what I want is the composition of two more basic operations :-)
14:36ToxicFrogThere's also group-by
14:36ToxicFrogWhich, unlike partition-by, will produce two subsequences for [1 2 1 2 1 2], not six.
14:37llasramToxicFrog: Naw, the semantics of partition-by are definitely what I want
14:37ToxicFrogAah, you only want contiguous subsequences?
14:37llasramyah
14:37ToBeReplacedllasram: good luck -- my concern would be that the partitioning operation is inherently sequential assuming that [1 1 2 2 2 1 1 1] -> [1 1] [2 2 2] [1 1 1] and not [1 1 1 1 1] [2 2]
14:38ToBeReplacedso you might need to just accept that part being sequential, and then you can use reducers for the remaining operations
14:40ToBeReplacedtechnomancy: on clojure-mode, is a pull request acceptable or do you prefer patches?
14:40technomancyToBeReplaced: oh, a pull request is fine
14:40technomancy"patch" is just shorter to type =)
14:41ToBeReplacedfigured, just making sure
14:41dnolenFireFox issues in my blog post resolved, thanks for the feedback people
14:41dnolenprotip - prim-seq rocks for array-likes, don't mess w/ anything else
14:43seangrovednolen: You and your cljs dark-magic
14:44gavrihow do I find out the type of a result in the console?
14:45kmicudnolen: is post updated?
14:45ToBeReplacedgavri: *1 for the last result, type for the type... so (type *1)
14:46gavricool, didn't know that types are exposed as part of the language
14:46dnolenkmicu: yep
14:46gavrican they be manipulated?
14:46dnolenkmicu: just tested in FF seems to work
14:46gavriand have new instances created from types obtained from other instances?
14:47technomancygavri: usually you don't care about the actual underlying type; just whether it's a map, list, vector, etc.
14:47gavrik, makes sense
14:47technomancyit's best to think in terms of abstractions
14:47gavriwas just wondering if it's technically possible
14:47kmicudnolen: it works now, maybe some space time anomaly... nvm
14:48technomancygavri: sure; just not common
14:52noncomis there any existing facility that could retreive a projects dependencies just like lein does it, but sources, not their jars?
14:52aboy021Does Clojure have a coalescence operator?
14:52technomancynoncom: most lein-generated jars have git clone info in them
14:52edbond,(doc fnil)
14:52clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
14:53technomancynoncom: in the pom
14:53aboy021awesome, tyvm
14:53noncomtechnomancy: looks like a nice place for me to start
14:53noncom:)
14:54technomancynoncom: it's not a standard thing outside lein though
14:54technomancyplus it won't work on subprojects or non-git projects
14:54technomancybut it's a start
14:54noncomyeah..
14:54technomancynoncom: relevant to your interests: https://github.com/Seajure/melange
14:55noncomcool!
14:57seangrovetechnomancy: Not enough dune-related project names
14:57technomancyseangrove: my dummy test app at work is called shadout-mapes
14:57leifwseangrove: agree
14:58technomancyI had a "baliset" once, but that turned out to be a dead end
14:58seangrovetechnomancy: You had mentioned find-usages for clojure. Curious if you think it'd be reasonable to do via tools.reader loading up a source directory and keeping track of all mentions of symbols
14:58technomancyseangrove: I think analyze might be a better fit
14:58technomancyIIRC it can handle resolving for you
14:59gfredericksI used analyze to do such a thing
14:59gfrederickshttps://github.com/fredericksgary/clj-usage-graph
15:00technomancyhey now look at that
15:00seangrovegfredericks: That looks like what technomancy was talking about previously
15:00technomancynice and short
15:00seangroveWith a graph output on the end of it, of course
15:01noncomtechnomancy: could you also please tell me is it true that lein and it's dependencies all use clojure.java.io for talks to filesystem and handling urls?
15:01technomancynoncom: lots of URL access happens outside of c.j.io
15:02gfredericksseangrove: the usages code is super slow for moderate sized functions
15:02technomancypossibly some filesystem stuff goes directly through Java classes too
15:02gfredericksI suspect the analyze output has a lot of duplication in its data structure
15:02technomancy(lein is older than clojure.java.io)
15:02noncomi see
15:02technomancynoncom: plus tons of HTTP access from the underlying java Aether lib
15:03jaleyI just noticed http://clojure.org/runtime_polymorphism has no mention of protocols, reify, etc. Presumably hasn't been updated since 1.2 was released?
15:03technomancyjaley: don't trust clojure.org =\
15:03technomancythe essays are good, but the rest is questionable
15:03stuartsierraclojure.org has been updated, but there is a separate page for protocols/records
15:04jaleytechnomancy: yeah, well… it's funny, some of the documentation there for core language features is really thorough, i don't know of a better source for certain things
15:04sdegutistheres no freenode channel for discussing language-agnostic general program design
15:04sdegutisso im giving #generaldesign a shot
15:04technomancyjaley: clojure-doc.org is a good place to start
15:04stuartsierraActually that runtime_polymorphism page might be an orphan - it isn't linked from anywhere on the main site.
15:05jaleystuartsierra: Features (side bar) -> Runtime Polymorphism
15:05stuartsierraoh, ok
15:05lagging_trollhas anyone connected sqlkorma with sybase?
15:05stuartsierraShould probably just link to the separate protocol & multimethod pages.
15:05jaleystuartsierra: actually I don't think any of the features pages mention it, and this one cites multi methods as the primary method for runtime polymorphism
15:05stuartsierraThe 'feature' pages have gotten less attention than the 'documentation' pages.
15:06technomancyjaley: multimethods are great
15:06jaleyyeah cool, i didn't need these docs personally, I'm just preparing some slides so was using them for reference, but I thought it was worth flagging in case it confuses newcomers
15:07stuartsierraI'll try to find somebody with access to clojure.org
15:17technomancywhoa; patrick stewart played Gurney Halleck in the Lynch adaptation
15:17Raynes…………….. acting.
15:17callentechnomancy: making me wanna rewatch it.
15:17callentechnomancy: I'm a massive Dune nut.
15:18technomancycallen: I've only seen the newer adaptation
15:21callentechnomancy: that's the better one to see if you care about Dune.
15:26Farehi! Who's in charge of clojure-conj, these days?
15:27stuartsierraFare: conj-info@thinkrelevance.com
15:31RaynesIt's stuartsierra. Storm the castle!
15:31stuartsierraI have little involvement with organizing clojure-conj these day.s
15:32edwAnyone else here see Calca, think that maybe this is what LightTable should have been, but using Clojure?
15:33seangrovecalca?
15:33edwCalca.io.
15:34edwIt hurts that I can't write Clojure a literately as I can do basic arithmetic. Or even not so basic arithmetic.
15:36Farestuartsierra, thanks!
15:48jweiss(defrecord Foo [a b c d e]) (Foo. "asdf" "foo" 12343 1 2) -> ClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentMap
15:48jweisswhat gives here? ^ it seems to only fail trying to pr the value, the constructor works fine.
15:48Bronsajweiss: works to me
15:48jweissBronsa: in nrepl?
15:49Bronsano, I'm not using nrepl
15:49timjweiss: shouldn't you be using (->Foo ) instead of Foo.?
15:49jweisstim: what's the difference
15:49llasramjweiss: works fine in nrepl.el
15:49timone's a constructor, the other is a function
15:50tbaldridgefor records, I don't know if it makes a difference or not.
15:50hiredmanmy guess is jweiss is omiting relevant bits
15:50jweissyeah the example i gave works for me too, but the record i'm using doesn't work
15:50jweissbut i can't see what difference there is here
15:51tbaldridgemetadata is a IPersistentMap...is it trying to set metadata to a int?
15:51stuartsierraThe difference is that ->Foo is a first-class function: you can refer it from other namespaces and use it in higher-order functions.
15:51jweissok this fails: (defrecord InstanceDefinition [name template-name memory sockets cores]) (InstanceDefinition. "foo" "baa" 12343 1 2)
15:51tbaldridgejweiss: works for me via a repl
15:52jweisshrm.
15:52stuartsierrame too
15:52jweissfor me it prints this- ovirt.client.InstanceDefinition
15:52jweissClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentMap ovirt.client.InstanceDefinition (client.clj:12)
15:52hiredmanmy guess is jweiss is using some broken weird repl
15:52Bronsathe only way I can think you could get a ClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentMap from a record ctor is if you were trying to use the n+2 ctor
15:52ToBeReplacedisn't there some kind of weirdness that occurs when you try to redefine a protocol? maybe fresh repl?
15:52`fogusRecords have a secret 2 extra parameter ctors
15:52jweissah that would do it
15:52`fogus(inc Bronsa)
15:52lazybot⇒ 7
15:53jweissso.. why does it work for others?
15:53Bronsaeg (defrecord x []) (x. 1 nil) would throw that error
15:53jweissbut it seems to fail printing the value, not in the ctor
15:53`fogusIt's not checked in the ctor
15:53tbaldridgejweiss: your repl is probably using some old version of the record or something
15:53jweiss->InstanceDefinition works, guess i know to use that now.
15:54Bronsathere may be some funny things happening with dynamic classloaders
15:54jweissthe stacktrace is in pr.
15:54tbaldridgeThat's why I never boot a repl...to dangerous.
15:54jweissin meta, in fact
15:55tbaldridge(j/k)
15:55stuartsierratbaldridge does all his coding with a magnetized needle.
15:55tbaldridgenah, I use butterflies and cosmic rays: http://xkcd.com/378/
15:56Bronsajweiss: http://sprunge.us/hhQH does this match your stacktrace?
15:58jweissBronsa: yup
15:58mccraiganyone know of a good user-agent string parser in clojure ?
15:58hiredmanI've seen older versions of nrepl + nrepl.el do weird things (seemingly insert extra round trips thourhg prn, etc)
16:01dnolenkonr: whoa
16:03gfredericksI was thinking about using it the other day for some tests; I think even .nominal might have been appropriate
16:03mgaareI'm running into a problem with enlive, and I"m not sure what I'm doing wrong. Anyone able to take a look at this? https://gist.github.com/mgaare/0ab86563ecacc76a7ab9
16:03gfredericksthen I instead opted to iterate over all permutations of a sequence because it was easier :)
16:04konrdnolen: some simple pattern matching, but cool, nonetheless :)
16:08justin_smithI just tried searching for a clojure based implementation of logo (the language that was basically mexps connected to a geometry lib for children) but the google search just gives me a bunch of hits for THE clojure logo
16:08`fogusTry "turtle"
16:09`fogushttp://nakkaya.com/2010/01/09/a-simple-turtle-graphics-implementation-in-clojure/
16:09justin_smithcool, thanks
16:09technomancyjoin us next time, on "languages named before google"
16:10stuartsierraYeah, like "Dart" and "Go."
16:10justin_smithI was reading about the original logo and its use of a robotic turtle with actual retractable pen, and thinking "3D VERSION WITH IR DRONE"
16:10`fogusThe languages named after Google (and by Google) are way wrose
16:10`fogusworse
16:10arohneryeah, go is just the worst to google for
16:11technomancyscala -> https://encrypted.google.com/search?tbm=isch&amp;q=staircase
16:11justin_smithmy next project and/or child (whichever comes first) is going to be named One Weird Trick Free Ipad
16:11technomancyhahah
16:11justin_smithprivacy in a post google world
16:12rboyd_Work From Home Mom
16:12justin_smiththat's a catchy one
16:12technomancyPaying Way too much Car Insurance, Esq.
16:12justin_smithlol
16:20Raynes`fogus: Did you ever end up doing anything with Elixir?
16:21`fogusRaynes: Not yet. Once this book is done I'll check it out.
16:22tbaldridgeI like the fact that Elixir give a better syntax...I just wish it was sexprs. But it looks cool
16:22edbondare there any core.logic cheatsheet?
16:22dnolenedbond: somebody put one together on the Clojure mailing list recently
16:22dnolenanybody encounter issues w/ multimethods where you use Object to match defaults?
16:23dnolenin a complex match
16:23dnolen[Foo Object], [Object Foo] etc
16:23hiredmanyou can't do that, as far as I recall
16:23hiredmanthere is no way to have "wildcards" inside collections like that
16:24dnolenhiredman: so there just no way to do wildcards with multimethods?
16:24kmicuedbond: first entry in google https://rawgithub.com/dedeibel/clojure-core-logic-cheatsheets/master/out/cheatsheet-use-title-attribute-no-cdocs-summary.html
16:24dnolenhiredman: so bizarre that it works normally, but fails at compile time ...
16:24dnolenwell "normally"
16:24edbondkmicu, thanks
16:24hiredmanhmmm, does it work normally?
16:24dnolenhiredman: yes this is the source of the AOT problems in core.match, everything seems to work fine interactively, but AOT fails
16:25hiredman,(isa? [Object] [:a])
16:25clojurebotfalse
16:25amalloydnolen, hiredman: Object is fine as a wildcard as long as what you're matching is a class
16:25hiredman,(isa? [:a] [Object])
16:25clojurebotfalse
16:25amalloyObject won't match other objects like [:foo]
16:25technomancyisa? is terrible
16:25hiredman,(isa? [String] [Object])
16:25clojurebottrue
16:25hiredmanhuh
16:25dnolenamalloy: yeah, this doesn't seem to be true in the presence of AOT
16:25technomancyI mean, terribly named
16:26amalloydnolen: could be because classes don't have the same hashcodes across jvm instances?
16:26amalloybut then i guess i'd expect it to fail for lots of classes, not just Object
16:29noncomi have a fun where i pass a map of optional params, and i want to make an action on each of them, if it is present, so i have a (when) for each possible params key. is there an idiomatic way to shorten that, avoid having a handful of whens?
16:29stuartsierraAnybody feel up to debugging some issues with type erasure?
16:29stuartsierrahttp://dev.clojure.org/jira/browse/CLJ-1243
16:32hiredmanactually I just ran in to that
16:32hiredmanhttps://github.com/jfager/functional-critbit/ has a private abstract class with public methods
16:33atyzHey all. I have config value that needs to be present in several namespaces - would creating a config.clj and having defs defined within that and requiring within those namespaces be a bad idea? Is there a more correct approach to this?
16:33ystaelnoncom: i don't know about 'idiomatic', but sometimes i map options onto functions that consume their value, and reduce the result by comp
16:34atyzEssentially something like a singleton in an OO approach would be what I'm looking for
16:34noncomaha...
16:34atyzBut I'm unsure of the correct way to do this functionally
16:35justin_smithatyz: better to have a config function that returns a config object (probably a nested map) that way you can seamlessly get re-entrancy by having multiple config objects
16:37justin_smiththe config object can just be a value defined in a namespace (on a user level rather than library, preferably)
16:38justin_smithhaving a special var or a with-* binding form are popular functional ways of handling this
16:38atyzjustin_smith: so something similar to {:configs {:someapikey {:somestuff "dkfjdkfj"} {:someotherapikey {:secret "sdkfjsdf"}}}
16:38justin_smithyeah
16:39justin_smithfor example see how clojure.java.sql does it
16:39justin_smithyou pass in a db config, or use a with-config block
16:39justin_smiththat way you can have multiple dbs, but still not have to give a config/auth arg to every function
16:41justin_smithsomeone on this channel had a nice article with an argument against using with-* macros
16:41stuartsierrahiredman: Got the specific class/method?
16:42stuartsierrajustin_smith: That was me. http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope
16:42justin_smithcool, thanks stuartsierra, bookmarking this time
16:43cmajor7is there any built in seq/sort function, or this needs to be written out => need to sort a list of lists in this way: input "[[2 4 6] [1 3 6] [1 2] [1 3 5] [2 5] [3 4]]", output "[[1 2] [1 3 5] [1 3 6] [2 4 6] [2 5] [3 4]]" (sorted by first, second… all the values)
16:44hiredmanstuartsierra: I am not 100% sure, I think it was https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/AbstractCritBitTree.java#L394 the size method with the implementing class being https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/CritBitTree.java#L172
16:45llasramcmajor7: For some reason unclear to me, Clojure's default sorting rules compare by length first, so you'd need to write your own comparator function which returns {-,0,+} based purely on sequence content
16:45hiredmanI just forked it, made the abstract class public, and rolled on
16:45atyzHeh: This brings me to one of my top anti-patterns in Clojure: the Dynamically-Scoped Singleton Resource (DSSR).
16:45amalloyllasram: for vectors. seqs don't sort at all
16:45stuartsierrahiredman: I've been looking at Netty 4, which uses this pattern all over the place.
16:46llasramamalloy: Right -- thanks for the clarification
16:46pbostromI want to do a simple xy-plot, is incanter the best bet? It seems kinda heavyweight, the uberjar is 42MB to plot a cosine function
16:47cmajor7llasram: right, that is what I am in the middle of (writing a comparator to plugin to sort-by), but then when I do these things, later I stumble upon that same functionality built in, so wanted to see if anyone knows it is..
16:48llasramcmajor7: Isn't builtin AFAIK. In Clojure 1.5 `reduced` should make it pretty compact though
16:50hiredmanstuartsierra: have you looked at the compiler? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1424 seems to be the problem
16:50stuartsierrahiredman: I've been digging at this all day, haven't found it yet.
16:51llasrampbostrom: Until lynaghk finishes https://github.com/keminglabs/c2po-clojure, I think Incanter is about the best you get in JVM Clojure
16:51stuartsierrahiredman: But yes, it's somewhere around that line.
16:51llasrampbostrom: Or you can call JFreeChart directly. Or you can just use R
16:51hiredmanso the issue is clojure tries to find the public class the method is delcared on, and there is none, so boom
16:52stuartsierraIt's more subtle than that, I think. It only happens on generic methods.
16:52hiredmanwhen it can find the method on that line it falls back to reflection, and the reflector uses the same logic
16:52hiredmanstuartsierra: not in my experience
16:53stuartsierrahiredman: Really? Do you have a test case? I can't reproduce it without generics.
16:54hiredmanstuartsierra: the method for the critbit stuff I linked don't have generics
16:54hiredmanyou may have two issues going on, one with generics, one with private base classes
16:55justin_smithI have an answer for cmajor7, but he appears to be gone. (fn [[X x] [Y y]] (let [c (compare X Y)] (if (= c 0) (compare x y) c)))
16:57hiredmanstuartsierra: thinking about it, I'm not sure it was the size method that I had the problem on, it could have been get(), which is generic, let me try and check
16:58stuartsierrahiredman: ok thanks, if you can show me the code that causes the error that would be helpful
16:59pbostromllasram: thanks, I'll stick with incanter I think, learning jfreechart or R is too much work I think, I exhausted my mental energy reading the incanter docs
17:00hiredmanah, it was .get()
17:01mgaaresolved the earlier enlive problem... needed to call as-nodes in the nested transform
17:02hiredmanstuartsierra: so https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/AbstractCritBitTree.java#L305-316 is the method of the abstract class, https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/CritBitTree.java is the concrete class, and to get the error all I have to do is call .get (it is a map) on an instance of io.prelink.critbit.CritBitTree
17:03stuartsierrahiredman: OK, thanks, will add to the ticket as another example.
17:10stuartsierraWhat's really weird is when I disassemble compiled Java code calling one of these methods, it appears to be calling it on the public derived class, even though no such method exists.
17:18amalloystuartsierra: it's not declared in the derived class, but it exists there
17:19amalloyso it should be perfectly valid to call it on that class
17:19stuartsierraamalloy: It's definitely valid, because javac allows it.
17:19stuartsierraBut darned if I can make sense of the bytecode generated by my test case.
17:20stuartsierraSome weird stuff happening there with type erasure and synthetic methods.
17:42stuartsierraI can't even invoke the method using the reflection API.
17:45stuartsierraJava throws an IllegalAccessException.
17:49hiredmanstuartsierra: how are you getting the method object with reflection? from the implementing class via getDeclaredMethod(s) or from the private base class?
17:50hiredman(via getMethod or whatever)
17:50stuartsierraFrom Class.getMethod
17:50stuartsierraOn the public derived class.
17:52hiredmanhave you tried replacing your getMethod call with getDeclaredMethod?
17:53stuartsierrahiredman: That gives me NoSuchMethodException
17:53hiredmanhuh
17:54stuartsierraOK, the best part: in *Java* code, using the reflection API, I cannot call the method.
18:04stuartsierraFor the compiled Java bytecode, the disassembly shows a call to a method which I cannot find via the reflection API.
18:08hiredmanon my critbit example I can find the method (on the implementing class, via both getMethod and getDeclaredMethod) and if I setAccessible it, I can invoke it via reflection
18:10hiredmanooh, so .getDeclaredMethod and .getMethod will return an arbitrary choice of methods if they have more than one to choose from, so maybe there is more than one and we are getting the wrong one
18:11hiredmanhttp://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getMethod%28java.lang.String,%20java.lang.Class...%29
18:11stuartsierraYes, .setAccessible(true) will allow me to call it.
18:11stuartsierraBut I don't think we want the Clojure compiler running around changing access permission on Java methods!
18:11hiredmannope
18:12hiredmanwell, actually, I wouldn't mind
18:12hiredmanbut I hate all things private and protected
18:12stuartsierraMe too.
18:13stuartsierraBut I really want to know why, even in Java, I can't call the method reflectively without changing its access permissions.
18:16amalloystuartsierra: i think hiredman was right in saying that getMethod can return methods from the derived or the base class, and when there are two matches it chooses arbitrarily. so you're getting the (private) method from the base class, rather than the (public) method from the derived class
18:17amalloyif you called getMethods instead and iterated through them, you'd find one that matches and is callable
18:17stuartsierraNope. Even if I enumerate everything returned by getMethods, only the base class method is there.
18:19hiredmanyeah, ditto
18:19hiredmanthat was disappointing
18:19stuartsierraHoly crap, this might be a JDK bug.
18:19stuartsierrahttp://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4283544
18:20dnolensubmit date 1999
18:21hiredmanso if you have some heuristic to find this situation, to at least let the clojure compiler generate non-reflective calls like this then you can work around it
18:23stuartsierrayeah
18:28stuartsierraOK, that can wait until tomorrow.
18:28stuartsierraThanks, hiredman & amalloy.
18:33ToBeReplacedis org.clojure/java.data still the preferred way to go from a java object into a clojure map?
18:37mthvedtfriend is baffling
18:38callenmthvedt: don't use it.
18:38mthvedtcallen: suggested alternative?
18:39RaynesNot using it.
18:39callenmthvedt: what Raynes said.
18:39RaynesFriend makes very little sense to me as well, fwiw.
18:39callenmthvedt: very rarely do you need an uber magick tool and in the darkness bind them to do that sort of thing.
18:39RaynesI imagine it's wonderful and awesome. I've just never really been able to get it, I suppose.
18:39mthvedti can't help but think if gandalf had to use 'friend', he'd still be stuck outside that one door
18:39RaynesAnyways, you can simply roll your own authentication if you want.
18:39callenit only makes sense if you're doing an absurdly complicated auth flow as part of an existing enterprise system. Outside that, no.
18:40RaynesOr use Personas like refheap.
18:40RaynesIn fact, look how refheap does it. It's insanely simple, which is why I like Personas so much.
18:40callenpeople seem to like Persona. I just roll my own auth.
18:40RaynesI only like it because it's simple.
18:40callentechnomancy: what?
18:40Raynestechnomancy: Stop using shitty browsers. -.-
18:40mthvedtraynes: i have to replace an existing auth flow depending on google app engine
18:40Raynescallen: He uses conkeror or whatever and it can't handle the personas. :p
18:40technomancyRaynes: says the guy whose browser doesn't even have dotfiles
18:40callenRaynes: LOL
18:41callenI forgot he used a ghetto browser.
18:41gtrakfriend works fine for simple stuff, you can jack in some credentials easily
18:41callen"works"
18:41callen"fine"
18:41gtrakhttps://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L57
18:41technomancyI rolled my own oauth in syme and it took like 20 lines
18:41gtraksimple back-door, avoid all the workflow stuff
18:41Rayneshttps://oauth.io/#/home
18:42akurilinQuick question, does it make sense to use a sorted map when I need to eventually encode it to json and pass it to another non-clj system that might not care much about ordering? Seems like it might be just simpler to go with a vector.
18:42callenakurilin: use whatever.
18:42tkdjson objects are generally order independent.
18:43Raynesakurilin: If a sorted map is easier for you to work with in Clojure then sure.
18:43RaynesIf your non-clj client doesn't care, then you should care about what helps you.
18:44Raynestkd: Which is the point sir here was making by saying "what's the point"
18:44akurilinCool, thanks for the tips.
18:44RaynesI assume anyways.
18:49dnolencore.async needs something like this http://www.kickstarter.com/projects/noflo/noflo-development-environment
18:57gtrakthe inevitability of spaghetti code is the result of one thing, text :-)..mmhmm.
18:57callen#SomebodyGetTheMenInWhiteCoats
18:57justin_smithin my experience in visual programming spaghetti code literally looks like spaghetti
18:58callenIn my experience, non-programmers shouldn't be programming.
18:58gtrakI'll write text and generate diagrams from it, thankya...
18:58justin_smithheh, there is that too
18:58callenbeen there, MS Access and Excel'd that.
18:58justin_smithalso, the tooling for text is far superior
18:58callenvastly.
18:59RaynesAs a programmer, I can confirm callen's claims.
18:59justin_smithas soon as I found myself writing code to manipulate and investigate the save files of puredata, I was done with puredata
18:59dnolenAs a programmer I still think it's useful
18:59dnolenthe Quartz Composer model was quite nice
18:59dnolenwrite your OpenGL logic as a component then wire it up at higher level
18:59callenStoryboard I think is pretty indicative how impotent the medium is for expressing intent.
19:00callendeclaratively or otherwise.
19:00calleneventually the graphical medium would become inundated with either context-specific glyphs or they'd end up resorting to text decorations on top of the graphical medium
19:00dnolenin serious asynchronous work flows it's pretty damn hard to see the wires, text doesn't help worth shit
19:01justin_smithalso, you don't notice how many dimensions of transformation your code has until you are stuck with only two of them being readable
19:01callenyou can't express information you haven't expressed and graphical media are less information dense for code than text.
19:02justin_smithdnolen: how much visual programming have you done?
19:02Raynesdnolen: What did he say that was incorrect here?
19:02dnolenjustin_smith: at one point quite a lot
19:02justin_smithwhat language?
19:03dnolenRaynes: "less information dense then text"
19:03dnolenjustin_smith: C, Obj-C, C++, Java, JavaScript
19:03dnolenjustin_smith: also played with Quartz Composer, and I fooled around with Max MSP and Pure Data
19:04dnolenand I've quite liked the Cocoa tools for what they're good for.
19:05justin_smithok, I was thinking in terms of puredata where text code isn't even an option, and that got clunky for me - it worked at a macro level but beyond a certain level of size/complexity it was incredibly brittle
19:05dnolenjustin_smith: yeah I'm not suggesting an all or nothing here
19:05callenthe Russians tried a very progressive form of visual programming
19:06dnolenjustin_smith: that's why I said specifically I liked the options of writing the code as a component, and using the a tool for wiring. this really isn't conceptually different than Interface Buildern
19:06dnolenthe problem w/ IB is that it really isn't oriented around event streams
19:06callenhttp://upload.wikimedia.org/wikipedia/commons/2/26/Quicksort_DRAKON.png
19:06justin_smithdnolen: ok, yeah, at a high level of abstraction that makes sense, I misunderstood you
19:06dnolenjustin_smith: yes
19:06dnolenjustin_smith: I mean "yes" that's what I was trying to say.
19:08justin_smitha good reflective tool could probably draw the connections between your go communicators automatically (maybe with a little help from judicious annotations)
19:09callenincidentally, that sort of thing is possible because we have such good tooling around processing text.
19:09karvusis there an incantation I can make at the lein repl in order to "re-evaluate" the project.clj? or some way to load a new dependency without restarting my instance?
19:09justin_smithI once hooked up the find-callers functionality from swank to graphiz to make a big flowchart style call tree that taught me a lot about a new (to me) code base - it was ugly and took forever to run, but it was informative
19:10justin_smithcallen: yes, I was the one who brought up how much better text tooling was, yes? :)
19:11callenjustin_smith: reinforcing the point against what you said about reflection.
19:39chordwhy did lisp fail to take off?
19:40xybrechord: parentheses are heavy and not very aerodynamic.
19:41chordif the outermost parentheses could be removed would that have helped lisp a lot?
19:41justin_smithmexps were never popular
19:44chordwhat do you mean?
19:44callenjrecursive: "Software begins as diagrams on a whiteboard, NoFlo keeps it that way" i suspect they will find this to be true
19:46xybrecallen: keeps it on the whiteboard?
19:47justin_smithchord: m-expressions were a thing in the original lisp that had less parens, sexps (what we use today) were designed to be an internal representation http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/m-expression/m-expression.lisp
19:47ztellmanxybre: http://i2.kym-cdn.com/entries/icons/original/000/012/132/thatsthejoke.jpg
19:47callenxybre: yep
19:50justin_smithchord: example of a session in a repl using m-expressions http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/m-expression/
19:52clj_newb_2345dumb question: how do I debug code with trampolines?
19:52clj_newb_2345it's rather annoying that I have no idea what the call stack looks like
19:56justin_smithclj_newb_2345: problem is implicit in trampolining, debugging tail recursive code has the same problem - the point is removing the call stack
19:56soulman__is it possible to unroll a seq one level only? not flatten the whole seq
19:56justin_smithone option is to use an atom as an artificual call stack
19:56justin_smithsoulman__: (apply concat s)
19:57soulman__[[a][b]] -> [a][b]
19:57justin_smithok, concat returns the wrong part of the nesting
19:57justin_smithis that in order to provide [a] [b] as an arg to a function? if so (apply f s)
19:58xybreI-Expressions look extra fun. http://srfi.schemers.org/srfi-49/srfi-49.html
19:58amalloysoulman__: it is not possible for anything to return [a][b], because that is not a value
19:58justin_smithyeah, I should have specified "as separate args" above
19:59soulman__it will go into a function eventually
19:59justin_smithalso you can map to get each element individually
20:00soulman__(apply f (filter (complement nil?) [['a] nil ['a]]))
20:00soulman__that should to the trick, hopefully
20:01justin_smithlooks right, if (f ['a] ['a]) is what you want to happen
20:03justin_smith(apply f (remove nil? [['a] nil ['a]]))
20:03justin_smithslightly more readable
20:04soulman__justin_smith, yes, the f would choke on the nil
20:04seangroveThe Carmack quakecon talk was pretty good, seems to be a very coherent guy
20:04seangroveAdvocates Haskell's static typing over lisp, interestingly
20:07callenNot really that surprising.
20:07callenthe weaker parts of C and C++'s type system and legacy crap has bitten him over and over for decades.
20:11brehauthe's also a huge fan of static analysis, which haskell is pretty good at
20:13justin_smithyeah, games are about optimizing everything, and the best optimizations are the ones that are fully applied before the executable is even linked
20:17clj_newb_2345alright
20:17clj_newb_2345I now need to be able to spit out HTML files
20:17clj_newb_2345what library should I learn?
20:17bhaumanhiccups
20:18bhaumanclj_newb_2345: ^
20:18clj_newb_2345bhauman: hmm, was just about to start on enlive
20:19bhaumanclj_newb_2345: haven't used it, although it's really popular as far as I can tall
20:20bhaumanclj_newb_2345: guess it depends on your task, hiccups is very simple
20:29akurilinEnviron question: I open a repl in my ring app, the profile is dev. I run lein test, the profile switches to test, now I have to reboot the repl or reset the env manually.
20:29akurilinIs there any way of having lein test not affect existing repls?
20:31justin_smithakurilin: so you are running the tests in the same process as the repl?
20:32akurilinI'm not sure, I guess. I have the repl open in one tmux pane, vim with fireplace connected to it. In another tmux pane I run lein repl. I'm assuming it starts a separate process.
20:33akuriliner
20:33akurilin*lein test
20:33justin_smithwhy would it even affect the other process? I don't even understand how that would happen
20:33callenhttp://golang.org/doc/faq#nil_error lol
20:37bhaumanakurilin: do you know if you have two repls running? one for 'lein test' and one for 'lein repl' ?
20:39hiredmanakurilin: it looks like environ works by just writing to .lein-env, and there is one .lein-env per checkout
20:40akurilinHere's a printout from a repl: http://pastebin.com/2bL5cSp3
20:40akurilinthe DB address changes after running lein test, from within the same repl
20:41akurilinoops, back.
20:41akurilinIt only happens when you do :reload-all
20:41hiredmanI don't like environ (keeping configuration information for your app in your build tool's configuration file is weird)
20:41hiredmansure
20:42hiredmanbecause :reload-all causes environ to rebuild it's config map by slurp in the file it writes config info to
20:42akurilinhiredman, I use it only for dev/test modes, I use envdir (from within runit) in production, which environ works well with.
20:42hiredmanI suppose that makes sense
20:43akurilinI guess this issue doesn't bite you unless you get pretty reload-all happy, which I do sometimes.
20:44akurilinhiredman, thanks for looking into it though, that was awesome.
20:59technomancyhiredman: I use environ such that all the dev settings live in the codebase and only defer to prod settings if they're actually in the environment
20:59technomancybecause otherwise you get into crazy situations due to not being able to change env vars on the jvm
21:00hiredman(because you work at heroku where they use ENV vars instead of config files)
21:00technomancyhiredman: also because I don't work on large codebases that need more than a handful of config entries
21:00technomancyor nesting
21:02schaeferhi folks - i have a question about dynamic vars. https://gist.github.com/anonymous/6136672 returns an unexpected result
21:02hiredman~map
21:02clojurebotmap is lazy
21:02schaeferah ha
21:03schaefergot it. wrapping in a doall returns the right result. thanks
21:03hiredmanyou know you can just bind *F* to a function and leave out the condp, yes?
21:04hiredman(binding [*F* count] ...) (binding [*F* identity] ...)
21:04schaeferyeah. i uber-simplified the real problem
21:04hiredmanok, just making sure
21:05schaeferappreciated
21:05amalloyschaefer: also consider using case instead of condp =
21:06amalloybut i guess that might not be part of the real problem anyway
21:06schaeferamalloy: actually, it is. i was wondering about that. i'm a bit surprised that the condp macro doesn't allow for :else
21:07amalloyschaefer: sure it does. just supply an odd number of cases
21:07hiredmanit does, read the doc string
21:07schaeferi guess i missed that
21:07schaeferthen, what's the advantage of using cond over (condp = ...) ?
21:08hiredmancase, he said case
21:08hiredman,(doc case)
21:08clojurebot"([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...
21:08RaynesWell, condp is an entirely different thing for starters
21:08schaeferha. now you know why i missed the :else in the condp docstring ;)
21:08schaefercool. i didn't know about case
21:46schaeferhow do i force a deep evaluation? https://gist.github.com/anonymous/c328a0c06fcb3aa872d3
21:47schaeferi could walk the data structure with prewalk... i'm wondering if there is a better approach
21:49schaefernevermind. i see that pre/postwalk force evaluation by themselves.
22:00johannhey guys i saw that SICP was on the front page of hackernews today and started reading through it
22:00johanndid some googling and found a version of it put in terms of clojure
22:00johannthought i'd share even though it may be common knowledge http://ecmendenhall.github.io/sicpclojure/
22:20cmajor7johann: interesting. I read it as "SICP did not help 'personally' Rich with Clojure", but it will help many of us Earthy humans
22:24johanncmajor7: what do you mean?
22:25cmajor7johann: SICP is not _about_ Clojure, it's just about problems and computers and how to marry those two via a human medium: us.
22:27clj_newb_2345clojure sets are unordered right? therefore, in https://github.com/swannodette/enlive-tutorial how is it possible that the orders are preserved in tutorial/scrape2.clj since the selectors are put in a _set_
22:27cmajor7johann: so, while SICP may not help you with understanding Clojure's hash array mapped tries (wikipedia will help you though), it will definitely help you understand how to solve problems with Clojure or any other language
22:28johanncmajor7: i just started so far so maybe i have yet to experience your point first hand. but i think a lot of my blocks in learning are me 'overthinking' and finding resources that lay out big pictures first actually help me learn technically faster (so i theorize)
22:29cmajor7johann: started in SICP or Clojure?
22:30johanncmajor7: i have been doing clojure koans kinda passively the past month because i was focusing on getting a grip on coffeescript--so it's safe to say both
22:31johanncmajor7: i found the lighttable ide last night and it really helped me get through that anxiety of the new syntax and see ideas translated to clojure *work*
22:31cmajor7johann: I would say just come up with a little project and complete it fully in Clojure, you'll hit a lot of things to google, but that'll be useful googling.. with the real goal
22:31bhaumanclj_newb_2345: i think it's due to the order of appearance on the page
22:32clj_newb_2345err, can't selectors end up selecting "interleaved" components?
22:34mgaareclj_newb_2345: when you have a set in a selector, that specifies "or" logic
22:35mgaareclj_newb_2345: the order of the nodes returned from selectors is determined by the input tree - ie the original html
22:35clj_newb_2345ah, I see, thus the need for partition
22:35gfredericksis it messy to make a protocol in a lib, give an impl for nil, but expect that a user might want to give a different impl for nil?
22:35clj_newb_2345okay, so it's not returning for me two stremas
22:35clj_newb_2345it's returnig for me one interleaved stream
22:35clj_newb_2345then we use the partition function to "split it into groups of 2"
22:35clj_newb_2345and then okay; this makes sense, thanks
22:46gfrederickscan anybody else login to jira?
22:50coventryDo you need to do anything special to a lein project to have it compile properly under Intellij/La-Clojure? Invoking "Run -> Run 'core'" results in a strange error message "Clojure Compiler: java.io.IOException: No such file or directory, compiling: /path/to/core.clj". /path/to/core.clj definitely exists, though!
23:14ubikationhey why does clojure make a big deal about tail call optimization being impossible if kawa scheme can do it?
23:15futileubikation: it doesnt make a big deal about it.
23:16ubikationI don't know I just remember reading a few big blog posts about recur.
23:16ubikationI'm probably the fool then since I can't seem to find those blog posts...
23:16futileubikation: aint no fool, worry not.
23:16brehautubikation: its not impossible; its impossible while maintaining clean interop with java
23:16futileit just needs recur, thats all
23:16futileyeah, that
23:17brehautubikation: im pretty sure you could go find some discussion about the tradeoffs scala made to implement true tail calls
23:18ubikationthanks!
23:30soulman__i'm trying to parse an eclipse .classpath file with a xml zipper
23:30soulman__(zx/xml-> zip1 :classpath)
23:30soulman__gets me an empty list
23:31soulman__while (zx/xml-> zip1) returns the complete xml
23:32soulman__the root element is classpath, so it should be selected by :classpath
23:32soulman__strange...
23:34sandwichmakerClojure array of maps (from db+extra calculations) + Incanter... Am I the only one that feels like a cheater? It is too damn easy to get things done!
23:35brehautactually an array?
23:35brehaut(in comparison with a vector or list)
23:38technomancyubikation: TCO isn't impossible; just impossible to do well on the JVM
23:38technomancykawa makes it really slow; everyone who uses kawa turns off TCO
23:38callenloop/recur is better.
23:39twoflowerhey everyone, is it possible to run http-kit from a .war?
23:40brehauthopefully guy steele gets his way
23:42sandwichmaker*sorry, s/array/sequence
23:50clj_newb_2345correct me if I'm wrong, the mental model for enlive for generating HTML is as follows: (1) I have some clojure datastructure, which is tagged, but has no HTML/CSS code (2) I have a sample HTML document. Then, (3) I select (in a jquery style) snipplets of the HTML code, and (4) using the sepected template, I attach my existing data into it, thus generating HTML
23:55callentwoflower: that doesn't remotely make sense. no.