#clojure logs

2014-11-09

00:02grandyjustin_smith: ok cool i'll keep investigating.. thanks again for the help
00:04aderethls
00:04bodie_does cljs support normal clojure testing or do I need to integrate with a js testing kit?
00:09TEttinger##(* 55 11)
00:09Guest35098⇒ 605
00:09TEttingerthat's odd
00:13justin_smithTEttinger: authentication issues, protected nick
00:13TEttingerheh
00:14justin_smithI forgot to verify authenticating with nickserv when I did the irclj update
00:15TEttingeryay
00:15RaynesHe oughta stick this time.
00:15justin_smith&*clojure-version*
00:15lazybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
00:15justin_smithWOO
00:16Raynes&*clojure-version*
00:16amalloy(inc justin_smith)
00:16lazybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
00:16lazybot⇒ 122
00:16amalloy(inc Raynes)
00:16lazybot⇒ 53
00:16TEttinger(inc justin_smith)
00:16lazybot⇒ 123
00:16Raynes(inc justin_smith)
00:16lazybot⇒ 124
00:16TEttinger(inc Raynes)
00:16lazybot⇒ 54
00:16Rayneslol
00:16TEttinger(inc lazybot)
00:16lazybot⇒ 33
00:16RaynesThat escalated quickly.
00:17rritochTEttinger: What is this (inc username) about?
00:17justin_smithso liberal with the karma, what will we do in the dead of winter and the karma fields are frozen over? our egos may starve!
00:17TEttingerit's karma for users or other words
00:17RaynesIt's an ego system.
00:17justin_smithrritoch: it's an informal way to say you appreciate someone's work, or agree with them
00:17TEttinger$karma rritoch
00:17lazybotrritoch has karma 0.
00:17TEttinger$karma technomancy
00:17lazybottechnomancy has karma 155.
00:18rritochAah, I see
00:18justin_smith$karma amalloy
00:18lazybotamalloy has karma 187.
00:18TEttinger(inc procedural generation)
00:18lazybot⇒ 1
00:19Rayneslol
00:19justin_smith$karma procedural
00:19lazybotprocedural has karma 0.
00:19TEttinger$karma procedural generation
00:19lazybotprocedural has karma 0.
00:19justin_smith$karma procedural generation
00:19lazybotprocedural has karma 0.
00:19TEttingerhm
00:19justin_smithhrmph
00:19justin_smith(identity procedural generation)
00:19lazybotprocedural generation has karma 1.
00:19TEttingerI thought you fixed it
00:19justin_smithI thought the fix for that regex went in
00:19justin_smithBronsa fixed it, and I made sure to propagate that (or I thought I did)
00:21RaynesKinda losing faith in you guys and your ability to regex.
00:21Raynes:P
00:21justin_smithI'ts not the regex at all!
00:21RaynesDO I HAVE TA DO EVERYTHING MYSELF? GAWSH
00:21rritochBefore I forget to ask again. Is there a good maven repository to use for unofficial (alpha) releases of clojure technologies? I used clojars for my nativedep project, but I'm considering making my web platform public but it's nowhere near ready for a release so I'm not sure where to put the builds so anyone can play with it.
00:21justin_smithhttps://github.com/Raynes/lazybot/blob/master/src/lazybot/plugins/karma.clj#L61 Raynes this is the line that does it
00:21justin_smithnotice it only looks at first args
00:22justin_smiththat's the issue
00:22justin_smithor wait, should (inc procedural generation) only inc procedural?
00:22justin_smithis that it?
00:23justin_smithrritoch: there is a lot of sketchy / not ready for prime time stuff on clojars
00:23RaynesActually, yeah, that looks correct.
00:23RaynesTEttinger: What did you expect to be fixed here? :o
00:23TEttinger$karma acting like (identity)
00:23lazybotacting has karma 0.
00:23RaynesOh
00:24justin_smithTEttinger: which one is broken right now
00:24TEttinger$karma
00:24justin_smithright, so the issue is that call to first
00:24justin_smithlike I said
00:24justin_smithcahnge (first args) to (string/join \space args)
00:24justin_smiththe regex is fine
00:25TEttingerI remember in ##anyone , justin_smith fixed identity, inc, and dec for multiple words
00:25justin_smithunless we can get the raw line and use that? that may or may not be better
00:25Raynesjustin_smith: YES I TOO KNOW HOW TO PROGRAM GOD
00:25justin_smithhaha
00:25RaynesIt's 9:30PM on a Saturday
00:25RaynesYou're gonna have to be real patient with me.
00:25Raynes:P
00:25justin_smithdude, it's pair programming on IRC - fun stuff :)
00:25justin_smithmy memory of the codebase is pretty fresh
00:26justin_smithalso I have not been sniffing glue, for a change
00:27zerkmshm, why does this http://pastebin.com/1tnv6MPq prints all 3 lines but does not return control back to terminal?
00:27rritochjustin_smith: This is fairly far from ready for primetime though I did manage to achieve most of my objectives. I still need to implement the fscript deployment in the default theme and there's a bug in the servlet context wrapper because it isn't grabbing .jsp sources from OSGi packages but once those are done I think I'm going to make it public because I'm loosing interest in the project.
00:27justin_smithzerkms: (shutdown-agents)
00:28justin_smithzerkms: you have to tell clojure to stop the thread-pool if you used it, basically
00:28rritochjustin_smith: It was just too much coding and debugging of systems-level code with so little to show for it, nothing more than a giant just to support a "hello world" app.
00:28zerkmsokay, I though it would do that itself
00:28Raynes$login
00:28lazybotYou've been logged in.
00:28zerkmsthanks
00:28Raynes$reload
00:28lazybotReloaded successfully.
00:28Raynes$karma procedural generation
00:28lazybotprocedural generation has karma 1.
00:29RaynesTEttinger: ^
00:29justin_smiththere we go, nice
00:29TEttingeryaaaay
00:29justin_smith$karma karma karma karma karma chameleon
00:29lazybotkarma karma karma karma chameleon has karma 0.
00:29justin_smith(inc karma karma karma karma chameleon)
00:29lazybot⇒ 1
00:30justin_smith$karma karma karma karma karma chameleon
00:30lazybotkarma karma karma karma chameleon has karma 1.
00:30justin_smith(inc semantic satiation)
00:30lazybot⇒ 1
00:32Raynes$grim clojure.core/some->
00:32lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/some->
00:32Raynesarrdem: ^
00:32TEttinger(inc amalloy)
00:32lazybot⇒ 1
00:32TEttingeroh no!
00:32TEttingerwhat could have happened!
00:32Rayneswut
00:32RaynesI didn't do that.
00:33dbasch$karma police
00:33lazybotpolice has karma 0.
00:33TEttinger(inc Raynes)
00:33lazybot⇒ 1
00:33RaynesWhat on earth
00:33TEttinger(inc Raynes)
00:33lazybot⇒ 55
00:33Raynes...
00:33justin_smith$karma amalloy
00:33lazybotamalloy has karma 187.
00:33RaynesOkay.
00:33justin_smithhe is playing games with nonprinting characters :)
00:33RaynesOH.
00:33TEttinger:D
00:33RaynesI HATE YOU.
00:34TEttingerpanic attack for a second there?
00:34justin_smith(dec amalloy)
00:34lazybot⇒ 0
00:34RaynesBriefly
00:34justin_smithit's the evil twin
00:34justin_smithRaynes: no need for you to panic, I would have been the one to blame after all
00:34RaynesI don't think that would be the case as I made a change immediately prior to the purported breakage.
00:35justin_smith&(map int "amalloy")
00:35lazybot⇒ (97 65279 109 97 108 108 111 121)
00:35TEttingerthe character is \ufeff btw
00:35justin_smith&0xfeff
00:35lazybot⇒ 65279
00:35justin_smithindeed it is
00:36justin_smithsilly TEttinger, putting BOMs in things
00:36TEttinger(let [ss (java.awt.datatransfer.StringSelection. "(inc a\ufeffmalloy)")] (.setContents (.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)) ss ss)) ;; in a repl generates whatever untypeable chars I want
00:36justin_smithnot the inverse mind you, that would be crude
00:44john2xhow do I update my repl session with changes in my project.clj? (not dependency changes, just updated :dev values)
00:44justin_smithjohn2x: lein is not a runtime tool
00:45justin_smithjohn2x: that said, you can use, for example, pallet/alembic to add dependencies from maven at runtime based on your project.clj
00:50john2xoh ok. thanks.
00:56technomancyI think he said not dependency changes
00:57technomancyjohn2x: some changes can be done on the fly and some can't
00:57rritochjustin_smith: I just opened the source, so it is officially public though I still need to fix some issues, document, and properly license everything
00:57technomancy:dev values is kind of imprecise
00:57justin_smithtechnomancy: oh, I missed the not depenency part, oops
00:59rritochhttps://github.com/rritoch/clj-grid - Leiningen Plugin
00:59rritochhttps://github.com/rritoch/clj-grid-kernel - Kernel
00:59rritochhttps://github.com/rritoch/clj-grid-mvc - MVC Support
00:59rritochhttps://github.com/rritoch/clj-grid-core - Core Library
00:59rritochhttps://github.com/rritoch/clj-grid-version - Example app
01:00john2xnah I think I'll be fine restarting for now.. just found out about :headless repl, and the startup isn't too bad (at least it feels like it)
01:00rritochWith no docs open sourcing this monster is probably futile, but it is the first MVC web platform for clojure
01:01john2xnow if only I could figure out how to make cider "refresh" the repl connection. or is cider smart enough to detect the restarted repl?
01:02justin_smithjohn2x: no it isn't. What kind of stuff are you trying to reset? you may want to look at stuartsierra's component system if you have things that need to restart / reset.
01:02godd2hyPiRion I just read your blog posts on persistent vectors and transients in Clojure. Thanks for the clear explanations :)
01:03rritochI also need to move this junk to clojars I guess
01:03rritochhome.vnetpublishing.com is my development server and isn't up 24/7
01:05rritochIt is also no open to the public so I guess none of this code is functional without an account on my dev server :(
01:06john2xjustin_smith: oh just trying to figure out a smoother workflow.. trying to start a new project using vagrant. so the repl needs to run in the vagrant VM. I was used to just cider-jack-in and then cider-restart, but jack-in starts its own repl.
01:07john2x*afaik
01:07justin_smithjohn2x: right, it does. component gives a really nice flexible way of resetting the state of various parts of your code without having to shut down the repl.
01:08justin_smithjohn2x: in terms of workflow, I like to start lein repl manually in a terminal, then use M-x cider to connect to it
01:09justin_smithamong other things that means I can directly access it to quickly shut it down if it has frozen up my editor (which luckily only happens if I make big mistakes...)
01:10john2xah good point on that. do you know if cider-restart remembers the parameters you passed to M-x cider?
01:10justin_smithI have never used cider-restart
01:11technomancyjustin_smith: ya know, if you use a stable cider then the ability to quickly shut down when it freezes isn't actually all that useful =)
01:11justin_smithtechnomancy: I switched to 0.6.0 recently, maybe my habits will change
01:13justin_smithtechnomancy: bet you can make your emacs repl freeze up by printing a series of very long lines full of unprintable objects
01:13justin_smiththere's a regex matcher that freaks the fuck out, and the more unreadable objects on a line the worse it gets
01:13justin_smithmaybe one day I will try to narrow down and fix it
01:15rritochjustin_smith: Can you check out the example app https://github.com/rritoch/clj-grid-version and let me know what you think about the end product, and provide some feedback? I would like to move away from the gen-class's and move to pure clojure but since clojure doesn't have namespace inheritance I'm not sure that will be possible.
01:15justin_smithrritoch: sure, I am getting more and more braindead tonight, but I'll leave it open and check it out
01:17justin_smithTEttinger: have you seen nanogenmo? https://github.com/lizadaly/nanogenmo2014 seems up your alley, they are making pretty cool stuff
01:17justin_smithmaybe not to late to enter the competition?
01:18justin_smith*too
01:18justin_smithhttps://github.com/dariusk/NaNoGenMo-2014
01:19rritochjustin_smith: I think it's going around... I've been working on this thing for about 3 months (on and off) and I've lost all direction which is the main reason I've decided to open source it to let the internet community decide it's future.
01:20rritochjustin_smith: Security wise it is a trade off, in the publics hand security holes can be discovered and repaired sooner, but it's also less secure since anyone can review the code and abuse any security flaws they find.
01:27TEttingerhm wha
01:27justin_smithpretty cool and flasy for an algorithmically generated text
01:27justin_smith*flashy
01:28TEttingerneat, justin_smith
01:28rritochI opened up the apache server @ http://home.vnetpublishing.com:8080/~vwpdev/ where you can see the hello world in action, the version app is implemented as an OSGi plugin @ http://home.vnetpublishing.com:8080/~vwpdev/?app=version accept it doesn't work because the bug I mentioned where the securitycontext wrapper isn't looking into the OSGi plugins, it's currently only looking into tomcat paths.
01:28justin_smithTEttinger: whether or not I submit anything, it will be cool to see the results. But that manuscript is a tough act to follow
01:28TEttingeryah
01:31justin_smithI have a character-token markov chain, I may try tweaking it and putting together a submission. Feeding it the gettysburg address + little red riding hood got me some amusing results.
01:34zerkmsguys, any hint why this notifies about every line twice: http://pastebin.com/zkMRL3Sv
01:34zerkms?
01:34zerkmstailer sources: http://commons.apache.org/proper/commons-io/apidocs/src-html/org/apache/commons/io/input/Tailer.html#line.395
01:38rritochIf you want to break it to see a stack trace you can request a non-existant app... http://home.vnetpublishing.com:8080/~vwpdev/?app=fu
02:05luther0701:03 [ certainty ] [ ggherdov ] [ karls ] [ nhanH ] [ shem ] [ yogthos|away ]
02:22john2xwhere can I read about testing with fixtures? e.g. how to properly setup a test database all the way up to writing the actual tests?
03:11arrdemRaynes: Fuck yeah.
03:12TEttingerwhat's up, arrdem?
03:12arrdemTEttinger: just got back from Interstellar, saw Raynes testing the new $grim command
03:12TEttingercool!
03:13TEttingerInterstellar is that thar space movie then?
03:13arrdemfor "testing" here defined to be "my patch made it live"
03:13TEttinger:D
03:13arrdemTEttinger: yeah. I can't say anything because it's very spoilers sensitive, but as a bit of a space geek it was a v good albeit emotional movie
03:14TEttingerI do know it has space in it because it's called Interstellar
03:14arrdemhehe
03:14arrdem$grim clojure.core/concat
03:14lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/concat
03:14arrdemnoice
03:14TEttinger$grim join
03:14TEttinger$grim clojure.core/join
03:14lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/join
03:14arrdemTEttinger: you have to fully qualify it at present :/
03:14TEttinger$grim clojure.string/join
03:14lazybothttp://grimoire.arrdem.com/1.6.0/clojure.string/join
03:15arrdemGrimoire won't get a "real" search feature until 0.4.0, which is still in the works, so $grim is a bit of a hack :P
03:16arrdemit parses a fully qualified symbol, checks that it's in the Clojure core lib, and only then generates a URL.
03:16arrdemEx.
03:16arrdem$grim me.arrdem.detritus.logging/debug
03:17arrdemnot in a core namespace, so lazybot doesn't bother trying to generate a bad URL
05:02godd2is it possible to destructure params to an anonymous function?
05:09TEttingergodd2: ##(map (fn [[x y]] (+ x y)) [[1 2] [2 3] [3 4]])
05:09lazybot⇒ (3 5 7)
05:11godd2TEttinger I'm a dummy
05:11godd2Is it possible to do it with the #(...) form?
05:11TEttingerno worries
05:11TEttingernot with #()
05:12TEttingeryou can however do...
05:12TEttinger##(map (let [[x y] %] (+ x y)) [[1 2] [2 3] [3 4]])
05:12lazybotjava.lang.RuntimeException: Unable to resolve symbol: % in this context
05:12TEttinger##(map #(let [[x y] %] (+ x y)) [[1 2] [2 3] [3 4]])
05:12lazybot⇒ (3 5 7)
05:12TEttingersince let allows destructuring too
05:13godd2ooh I like that. okay awesome thank you :)
05:13TEttingernp
05:23supersymoh, the bot had an upgrade some time as well... nice
05:24supersymsomething ##(map list '[bim bum bam])
05:24lazybot⇒ ((bim) (bum) (bam))
05:24supersymcute
05:36TEttinger##(doc map)
05:36lazybot⇒ "([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted... https://www.refheap.com/92975
05:37TEttinger##(map inc)
05:37lazybot⇒ #<core$map$fn__4338 clojure.core$map$fn__4338@3020a258>
05:40TEttinger,(def xf (map inc))
05:40clojurebot#'sandbox/xf
05:40TEttinger,(sequence xf (range 6))
05:41clojurebot(1 2 3 4 5 ...)
05:41TEttinger,(def xf2 (comp (filter odd?) (map inc)))
05:41clojurebot#'sandbox/xf2
05:41TEttinger,(sequence xf2 (range 6))
05:41clojurebot(2 4 6)
05:42TEttinger,(into [] xf2 (range 6))
05:42clojurebot[2 4 6]
05:42TEttingerneat
05:54rritochTEttinger: Is that a bug? The documentation for comp says it applies functions from right to left, if that was true shouldn't your example be dumping the odd values?
05:55TEttingerhmmm
05:55Bronsarritoch: no, that's how transducers work. by composing they create a stack of transformations that are applied from the outermost to the innermost
05:55TEttinger,(doc comp)
05:55clojurebot"([] [f] [f g] [f g & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
05:56TEttingerBronsa, right, but here it applies the transducers left to right
05:56metellus,(filter odd?)
05:56clojurebot#<core$filter$fn__4368 clojure.core$filter$fn__4368@683f5>
05:56BronsaTEttinger notice the "from the outermost to the innermost" part of
05:57TEttingerin the docs for comp?
05:57Bronsa((comp f g) x) -> (f (g x))
05:57BronsaTEttinger in my message :)
05:57TEttinger,(do (def xf3 (comp (map inc) (filter odd?))) (into [] xf3 (range 6)))
05:57clojurebot[1 3 5]
05:57BronsaTEttinger rritoch the way transducer seem to apply from right to left has nothing to do with comp
05:57Bronsait has to do with how transducers are implemented
05:58TEttingerthe docs for comp should be updated, this is confusing
05:58rritoch,((comp str +) 8 8 8)
05:58clojurebot"24"
05:58metellushow recently were the single arity versions of filter and map added?
05:58BronsaTEttinger again, this has *nothing* to do with comp
05:58Bronsametellus: 1.7
05:58metellusneat
05:58Bronsametellus: which is still in alpha
05:59metellusthat makes me feel better about not expecting them to work in the first place, then
05:59TEttingerso... if the docs don't go in the fn you're using, where do they go?
05:59BronsaTEttinger this behaviour is documented in the clojure.org page for transducers
05:59TEttingerk
06:00TEttingerI'm getting too sleepy to understand this
06:00TEttingernight
06:01Bronsa,(def f (fn [f] (fn [x] (println "1") (f x))))
06:01clojurebot#'sandbox/f
06:01rritochBronsa: It's not so late here and I don't quite follow... (comp (filter odd?) (map inc)) should => (filter odd? (map inc args#)) shouldin't it?
06:01Bronsa,(def g (fn [g] (fn [x] (println "2") (g x)))
06:01clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
06:01annelieshi
06:01Bronsa,(((comp f g) identity) 3)
06:01clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: g in this context, compiling:(NO_SOURCE_PATH:0:0)>
06:02Bronsaas you can see this runs f before g even thoug composition is left to right
06:02Bronsathough*
06:02Bronsarritoch: no. transducers """compose""" right to left
06:03Bronsarritoch: you can think of comp as ->> when using transducers
06:03Bronsa"The transducer xf is a transformation stack that will be applied by a process to a series of input elements. Each function in the stack is performed before the operation it wraps
06:03BronsaComposition of the transformer runs right-to-left but builds a transformation stack that runs left-to-right (filtering happens before mapping in this example).
06:03BronsaAs a mnemonic, remember that comp of transducer functions is applied in the same order as ->> with sequence functions.
06:03Bronsarritoch: this is what's written in http://clojure.org/transducers, if that's clearer to you
06:05Bronsametellus: if you look at the example I just evaluated in clojurebot you'll understand how transducers seem to compose right to left
06:05rritoch,((comp (partial str "A") (partial str "B") (partial str "C")) "=IN=")
06:05clojurebot"ABC=IN="
06:05Bronsarritoch*
06:05Bronsa(metellus sorry the message was not for you)
06:06metellus'sok
06:06rritochBronsa: So basically the documentation is wrong?
06:06Bronsarritoch: no the documentation is right
06:06rritochhttps://clojuredocs.org/clojure.core/comp
06:06Bronsarritoch: again, composition always happens left to right
06:06rritochThat says functions are applied right to left, output of rightmost fed to the next
06:07Bronsadurr, right to left
06:07Bronsarritoch: did you look at my example? I'll paste it again in a nopaste
06:07Bronsarritoch: http://sprunge.us/QIah
06:08Bronsarritoch: notice that it's not invoking directly the result of (comp f g)
06:10rritochI see your example, it is running left to right but the documentation says right to left
06:10Bronsano.
06:10Bronsaone sec, I'll try to make this clearer
06:11rritoch((comp println inc) 1)
06:11rritoch,((comp println inc) 1)
06:11clojurebot2\n
06:11rritoch,((comp str inc) 1)
06:11clojurebot"2"
06:12rritoch,((comp even? inc) 1)
06:12clojurebottrue
06:12Bronsarritoch: http://sprunge.us/FLZV?clj take a look at this
06:12Bronsarritoch: you can see it's printing g before f, showing that the composition does happen right to left
06:13Bronsarritoch: but the composition of those two function doesn't yield a function that can be invoked directly, rather invoking *that* function will return another function to be invoked
06:14Bronsarritoch: inside *that* function f and g run in the "opposite" order
06:15Bronsarritoch: the key to understanding this is to notice that it's not doing ((comp f g) val), but (((comp f g) h) val)
06:18Bronsarritoch: https://www.youtube.com/watch?v=6mTbuzafcII&amp;t=25m30s here's how Rich Hickey explained this
06:22Bronsarritoch: if you still don't understand how this works, take my example an try to manually comp f and g and follow the execution flow
06:23rritochI'm actually still trying to figure out how to load that youtube link, I'm using synergy so copy/paste between machines doesn't always go smoothly
06:25rritoch,((comp (filter odd?) (map inc)) (range 6))
06:25clojurebot#<core$filter$fn__4368$fn__4369 clojure.core$filter$fn__4368$fn__4369@b1567b>
06:25Bronsarritoch: transducers are not partially applied functions
06:27rritoch,(((comp (filter odd?) (map inc)) (range 6)))
06:27clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn>
06:28rritoch,(take 3 ((comp (filter odd?) (map inc)) (range 6)))
06:28clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$filter$fn__4368$fn__4369>
06:28hyPiRiongodd2: good to hear you found them useful :)
06:29rritochWhat kind of voodoo is this?
06:30rritochIn my first test it says it returned a lazy sequence, so I try totake 3 from it and it says the result was a function
06:30rritochIs there comprehensive documentation on this comp function?
06:31Bronsarritoch: for the nth time, comp has nothing to do with this and transducers are not partially applied functions
06:31Bronsarritoch: read this http://clojure.org/transducers
06:31rritoch,(type ((comp (filter odd?) (map inc)) (range 6)))
06:31clojurebotclojure.core$filter$fn__4368$fn__4369
06:34rritochBronsa: Well, thanks for your patience, as you can guess I've never used comp or transduce in any of my code but I really thought it was like a partial that combined functions together
06:35Bronsarritoch: that's your mistake. (map f) is not (partial map f)
06:35Bronsarritoch: if you're interested I suggest you read the page I just linked, transducers are really powerful
06:37rritochI'm reading it now, and going to run over these examples for a bit, but right now it still looks like voodoo to me
06:39luxbockrritoch: I'd really recommend watching the entire talk from the youtube link Bronsa linked here
06:46rritoch,(type ((comp (filter odd?) (map inc)) (range 6)))
06:46clojurebotclojure.core$filter$fn__4368$fn__4369
06:46rritochHmm
06:47rritochI don't see why that doesn't throw an exception either, I took a look at the source code for comp and it's just a function
06:47rritoch,(filter odd?)
06:47clojurebot#<core$filter$fn__4368 clojure.core$filter$fn__4368@99b936>
06:47rritochHmm
06:47rritochWhat happened there?
06:47rritochLocally I get an arity exception
06:48Bronsarritoch: you're using clojure <=1.6.0
06:48Bronsarritoch: the transducer arity was added in 1.7.0-alpha1
06:49rritochOk, I think that clears up my confusion a bit
06:52rritoch,((comp (partial str "A") (partial str "B") (partial str "C")) "=IN=")
06:52clojurebot"ABC=IN="
06:53rritochSo in this simple example, The innermost (first action) returns "C=IN=" and the string gets built backwards
06:54Bronsayes
06:55rritochOk, so it is really these transducers that threw me, when I saw this example I was thinking that comp was a macro which was moving things around and creating a function out of the result.
06:56Bronsano, comp is just a regular function
06:56Bronsa(comp f g) === (fn [& args] (f (apply g args)))
06:58rritoch,((filter odd?) (range 6))
06:58clojurebot#<core$filter$fn__4368$fn__4369 clojure.core$filter$fn__4368$fn__4369@fe1155>
07:02rritoch,((filter odd?) 1)
07:02clojurebot#<core$filter$fn__4368$fn__4369 clojure.core$filter$fn__4368$fn__4369@171dea8>
07:03rritoch,(((filter odd?) 1))
07:03clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
07:05rritoch,(transduce (filter odd?) 1)
07:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/transduce>
07:07rritoch,(transduce (filter odd?) + (range 5))
07:07clojurebot4
07:07rritoch,(transduce (filter odd?) + (range 99))
07:07clojurebot2401
07:08rritoch,(transduce (filter odd?) identity (range 99))
07:08clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/identity>
07:10rritoch,(transduce (filter odd?) (fn [&x] (last x)) (range 99))
07:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:11rritoch,(transduce (filter odd?) (fn [& x] (last x)) (range 99))
07:11clojurebot97
07:11rritoch,(transduce (filter odd?) (fn [& x] (last x)) (range 101))
07:11clojurebot99
07:11rritoch,(transduce (filter odd?) (fn [& x] (last x)) (range 100))
07:11clojurebot99
07:12rritoch,(transduce (filter odd?) (fn [& x] (last x)) (range 49))
07:12clojurebot47
07:12rritoch,(range 9)
07:12clojurebot(0 1 2 3 4 ...)
07:12rritoch,(last (range 9))
07:13clojurebot8
07:15kzarHas anyone made a chrome extension using clojurescript before? I'm trying to figure out how it would fit together
07:19mi6x3mhey clojure, any off-the-shelf function to zip data through ZipOutputStream?
07:26rritochmi6x3m: I think doseq is your best option
07:30rritochkzar: I've never used clojurescript before, but I have made chrome plugins, as far as I can tell you should just be able to drop the generated .js file from compiling the clojurescript into your plugin (folder) and it should just "work". I don't know how you call javascript from clojurescript but that is what you'll probably need to do to register listeners, etc.
07:32kzarrritoch: That's not my issue, the thing is you traditionally have separate Javascript files for chrome extensions. One for the popup page, one for the background "page", one for options or other pages. Clojurescript compiles down all the clojurescript files to one Javascript file normally. I think you can have them separate but then I think you have the Google closure dependencies etc in there once for each separate
07:32kzar page
07:32mi6x3mrritoch: I settled for that yeah, but what is a proper argument name for a stream?
07:33kzarrritoch: It's not a complete disaster, just wondered if anyone had figured out all those issues before or not
07:35rritochkzar: The plugins I was working on were all in one source file which used ajax+eval for all additional functionality. Fundamentally that isn't really too much different than clojure bringing everything to a single source file.
07:36kzarrritoch: You didn't need separate functionality between the popup page and the background "page" for example?
07:37rritochmi6x3m: I use "path" for my argument name when creating jars
07:38mi6x3mrritoch: I mean parameter name in a clojure function :) when passing a stream
07:38mi6x3mI just use dst now
07:41rritochTHe code I use is @ https://github.com/rritoch/clj-grid/blob/master/src/leiningen/grid/bundle.clj#L239-L249
07:43rritochmi6x3m: I just loop over the paths that I want in the jar, and then dig into each path for all of the entries which get placed individually via a "write-entry" function which uses clojure.io/copy to add files to the jar
07:51rritoch,((comp clojure.string/trim (partial apply str)) (conj (range 6) " "))
07:51clojurebot"012345"
07:54rritoch,((comp clojure.string/trim (partial apply str) (conj \")) (conj (range 6) " "))
07:54clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn>
07:55rritoch,((comp clojure.string/trim (partial apply str) (partial (conj \"))) (conj (range 6) " "))
07:55clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn>
07:57rritoch,((comp clojure.string/trim (partial apply str) (fn [& x] (conj x \"))) (conj (range 6) " "))
07:57clojurebot"\"(\" \" 0 1 2 3 ...)"
08:03rritoch,((comp (fn [& x] (str \" (pr-str x) \")) clojure.string/trim (partial apply str) ) (conj (range 6) " "))
08:03clojurebot"\"(\"012345\")\""
08:03elsen_Hey guys, what's up?
08:03BenceFHi, i'm having trouble with tools.namespace
08:04BenceFits page says it is deprecated (but doesn't name an alternative)
08:04rritoch,((comp (fn [x] (str \" x \")) clojure.string/trim (partial apply str) ) (conj (range 6) " "))
08:04clojurebot"\"012345\""
08:04BenceFmaven says it has 0.2.7 but I can't seem to name it right
08:05Bronsahttps://github.com/clojure/tools.namespace where does it say it's deprecated?
08:05BenceFhttps://clojure.github.io/tools.namespace/index.html
08:06BenceF"This namespace is DEPRECATED; most functions have been moved to other namespaces"
08:06BenceFI need .repl btw
08:06BenceFbut don't know how to add it to my dependencies
08:07BronsaBenceF: that's referring to the "clojure.tools.namespace" namespace only, the functions have been moved to "sub" namespaces
08:07toxmeisterhey, anyone seen or experienced this too? https://github.com/ato/clojars-web/issues/270 - would be grateful for some interim workarounds...
08:08BenceFi tried these: [org.clojure.tools.namespace "0.2.7"] then clojure.tools.namespace then tools.namespace
08:08BronsaBenceF: the docstring for each function in that namespaces tells you where to find the new version
08:08BenceFand try to do a lein deps and it says it can't find it in maven
08:08BronsaBenceF: https://github.com/clojure/tools.namespace#releases-and-dependency-information
08:09BenceFahh I need a slash!
08:09BenceFthank you Bronsa
08:10BenceFfound it thank you :)
08:13BenceFoh but i need to require it as (require '[clojure.tools.namespace.repl :refer [refresh]])
08:13BenceFseems a bit inconsistent
08:14rritochWhere is volitile! documented? I see it being used in the "Transducers with reduction state" example, but I'm not familiar with volitile symbols.
08:16Bronsarritoch: that's another new 1.7 function
08:16rritochhmm, I feel like I'm living in the stone ages, I really need to upgrade
08:16BronsaBenceF: why does it seem inconsistent to you?
08:17Bronsarritoch: no, this is all new stuff, 1.7.0 isn't out yet
08:17rritochIs there any "WHats new" documentation for 1.7?
08:17Bronsarritoch: yeah in the changelog
08:17rritochAaah
08:17Bronsarritoch: https://github.com/clojure/clojure/blob/master/changes.md
08:18BenceFonce you use a / then a .
08:18BronsaBenceF: those are completely unrelated things
08:19BronsaBenceF: one is a clojure namespace, the other is a maven dependency coordinate
08:19BronsaBenceF: a lib could be called foo/bar and provide a baz.buz namespace, there's no correlation between those
08:20BenceFah ok
08:23elsenWhat's the current way to work on a clojure backend and clojurescript frontend at the same time?
08:23elsenI'm trying to setup a clojure REPL to run my backend, and a clojurescript one connected to the browser
08:26elsenI setup austin to run a REPL in the browser, but it replaces the current REPL that run the clojure backend, am I missing something to work in both REPL at the same time?
08:29rritochIs rich taking requests for the new version? I think clojure.core/in? and clojure.string/ucfirst would be useful addons. I have them isolated in my apps since they're so commonly needed.
08:29rritochhttps://github.com/rritoch/clj-grid-kernel/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/util.clj
08:38ingsocin list comprehensions the keyword :when is used to apply a filter. I thought keywords where just symbolic identifiers ?
08:46rritochingsoc: They are, the macro applies the functionality to it.
08:47ingsocrritoch: so what is the macro
08:48rritochingsoc: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L4254-L4339
08:48rritochThats the macro for "for"
08:51ingsocok so a keyword is just being used by the macro to trigger the filtering logic as it doesn't make sense to use up another name that could otherwise be used as a variable ?
08:51rritoch,(macroexpand '(for [x '(9 10 11) :when (not= x 10)] x))
08:51clojurebot(let* [iter__4763__auto__ (clojure.core/fn iter__27 [s__28] (clojure.core/lazy-seq (clojure.core/loop [s__28 s__28] (clojure.core/when-let [s__28 (clojure.core/seq s__28)] (if (clojure.core/chunked-seq? s__28) (clojure.core/let [c__4761__auto__ (clojure.core/chunk-first s__28) size__4762__auto__ (clojure.core/int #) b__30 ...] (if (clojure.core/loop # #) (clojure.core/chunk-cons # #) (clojure.core...
08:52rritochHmm, it got cut, but in the full version you can see the not= in the resulting code
08:59rritochingsoc: Yes the keyword is used to trigger the filtering logic, I believe it's possible to change macro expansion based on the symbols passed, but it would probably be ambiguous to use the symbol 'when instead of the keyword :when
09:00rritoch,(let [when 5] when)
09:00clojurebot5
09:06rritoch,(defmacro foo [& x] `(println (str ~@(map name x))))
09:06clojurebot#'sandbox/foo
09:06rritoch,(foo bar)
09:06clojurebotbar\n
09:10rritoch,(defmacro foo [x] (println ~(if (= x (symbol "foo")) "FOO!" "NOT FOO!"))
09:10clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:10rritoch,(defmacro foo [x] (println ~(if (= x (symbol "foo")) "FOO!" "NOT FOO!")))
09:10clojurebot#'sandbox/foo
09:10rritoch,(foo foo)
09:10clojurebot#<CompilerException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote, compiling:(NO_SOURCE_FILE:0:0)>
09:11rritoch,(defmacro foo [x] ~(println ~(if (= x (symbol "foo")) "FOO!" "NOT FOO!"))
09:11clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:11rritoch,(defmacro foo [x] ~(println ~(if (= x (symbol "foo")) "FOO!" "NOT FOO!")))
09:11clojurebot#'sandbox/foo
09:11rritoch,(foo bar)
09:11clojurebot#<CompilerException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote, compiling:(NO_SOURCE_FILE:0:0)>
09:12rritoch,(defmacro foo [x] `(println ~(if (= x (symbol "foo")) "FOO!" "NOT FOO!")))
09:12clojurebot#'sandbox/foo
09:12rritoch,(foo bar)
09:12clojurebotNOT FOO!\n
09:12rritoch,(foo foo)
09:12clojurebotFOO!\n
09:12rritochThere we go :)
09:40rdsrhas anyone tried setting jvm-opts when using CCW with eclipse?
09:40rdsrI can't get this to work..
09:43rdsrI've searched online and found a few posts around it. Mostly the solution seems to be to modify the launch configuration of the clojure application ran before… But the under the clojure tree in the "run-as" menu I don't see any entry .
10:01justin_smithrdsr: does counterclockwise run clojure in a separate vm?
10:02rdsrum I'm not sure
10:04rdsrI'm checking that right now
10:09rdsryes, so I'checked that it is starting two jvm..
10:10rdsrI think one is the nrepl server?
10:12justin_smithis it using lein to launch the clojure process?
10:15rdsrI've searched a little… I think it does uses lein partially.. in that is uses the dependencies I've added in the project.clj.. but it skips the jvm-opts I've specified there
10:15justin_smithare you using ^:replace as a metadata for the jvm-opts?
10:16rdsrno
10:16rdsrhere's my jvm-opts from lein…
10:16justin_smithit merges options by default, in order to get certain configurations the ^:replace metadata is needed
10:16rdsrjvm-opts ["-Dsun.security.krb5.debug=true -Djava.security.auth.login.config=conf/user.conf -Djavax.security.auth.useSubjectCredsOnly=false"]
10:17justin_smithwhat if you start counterclockwise with those options?
10:17rdsru mena I add the metadata in my project.clj?
10:17rdsr*mean
10:18rdsrsomethign like…. :jvm-opts ^:replace […] ?
10:18justin_smithhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L76 it's described for the :repositories key here, but yeah
10:18justin_smithbecause sometimes opts dont' work because they are merged with the defaults
10:18justin_smithI don't know if that is the case with your setup though
10:18rdsrlet me try this ou
10:18rdsr*out
10:20justin_smithrdsr: this thread says you want to look at "Run Configurations" https://groups.google.com/forum/#!topic/clojuredev-users/_NkhrgJOaAw
10:21justin_smithperhaps counterclockwise just can't / won't use your jvm opts from lein?
10:21justin_smithrdsr: another option would be starting "lein repl" yourself and telling counterclockwise to connect to its port
10:21justin_smithif that is an option
10:24rdsrcool.. I'll try that too
10:24rdsrthks
10:25justin_smithrdsr: with emacs, I prefer to launch my repl from the terminal and connect via the port, rather than launching automatically
10:25justin_smithrdsr: it eliminates a point of failure when things get weird :)
10:25rdsroh… well.. it is working somehow with replace … but I'm not sure how
10:26justin_smithoh nice!
10:26justin_smiththat was a long shot, but glad it works
10:26rdsrbut the jvm-opts are not here :/
10:26rdsr:jvm-opts concat "[\"-Xdebug\" \"-Xrunjdwp:transport=dt_socket,server=y,suspend=n\"]"
10:26justin_smithsome jvm opts are mutually incompatible, so you need ^:replace before some configurations work
10:27rdsrthose jvm-opts (the one I pinged) are from the command-line ccw used to startup a repl
10:27justin_smithodd
10:28justin_smithyeah, seems like counterclockwise is not respecting your full project.clj config - the thread I linked to indicates that at some point that was considered a feature for the future?
10:29rdsrohk
10:38csd_````How would would I cast a str "(foo bar)" as a list, i.e. as if I were using (read) and then wanted to use first/second on it?
10:39gfrederickscsd_: read-string
10:40csd_thanks
10:48gfredericks$findfn "[:a :b]" [:a :b]
10:49csd_one other question, how would I map `quote` across a list?
10:49lazybot[clojure.core/load-string clojure.core/read-string]
10:49gfrederickscsd_: you wouldn't, that doesn't make sense; can you give an example use for that?
10:49justin_smithcsd_: read-string does not eval
10:50gfredericks,'(a b c)
10:50justin_smithif that is your concern
10:50clojurebot(a b c)
10:50justin_smith&(read-string "[a b c]")
10:50lazybot⇒ [a b c]
10:50csd_id like to read in "foo bar" and then eval (foo 'bar)
10:51justin_smithcsd_: you need to write some string transformation code then
10:51csd_CL lets you map quote, i'm surprised clojure doesn't
10:51justin_smithcsd_: read-string works by sexps
10:51justin_smith,(read-string "foo bar")
10:51clojurebotfoo
10:52justin_smithyou need read, and a pushbackreader, to get all the sexps
10:52justin_smithor make sure it is all in one sexp
10:52justin_smitheither way
10:52gfredericks,(str "(\n" "foo bar" "\n)")
10:52clojurebot"(\nfoo bar\n)"
10:52anneliesclojurebot I love you
10:53Bronsait's a shared feeling
10:53csd_,(read-string (str \( "foo bar" \) ))
10:53clojurebot(foo bar)
10:53justin_smithgfredericks: yeah, like I said, string transformation. Btw lazybot is cool too ##(println "hi")
10:53lazybot⇒ hi nil
10:53Bronsalazybot: isn't bad either
10:53anneliesBronsa: I don't think so :'(
10:53justin_smithand I got lazybot updated!
10:53Bronsa&*clojre-version*
10:53lazybotjava.lang.RuntimeException: Unable to resolve symbol: *clojre-version* in this context
10:53justin_smith&*clojure-version*
10:53lazybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
10:53Bronsa&*clojure-version*
10:53lazybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
10:53Bronsaw00t
10:53justin_smithhehe
10:53Bronsa(inc justin_smith)
10:53lazybot⇒ 125
10:55justin_smith$karma procedural generation
10:55lazybotprocedural generation has karma 1.
10:55justin_smiththat works now :)
10:56csd_So if I have (foo bar) as output by read-string, what's the easiest way to do the transform to map ' ? Am I best served by doing it before applying read-string?
10:56justin_smithcsd_: why would you need to map ' on it?
10:57Bronsacsd_: ##(map #(list 'quote %) '(a b))
10:57lazybot⇒ ((quote a) (quote b))
10:57csd_justin_smith: I'm trying to translate some of the code in Land of Lisp from CL to clj
10:57csd_The code is sort of goofy, basically evals directly what the user types in
10:58justin_smithan amusing failed attempt ##(map #(quote %) '(a b c))
10:58lazybot⇒ (p1__17767# p1__17767# p1__17767#)
10:58csd_so if I type in "foo bar" it evaluates it as (foo 'bar)
10:58Bronsajustin_smith: wait what
10:58justin_smithcsd_: clojure has nothing that prints as 'bar
10:58Bronsaah.
10:58justin_smithBronsa: yeah, tricky :)
10:58csd_justin_smith: what do you mean?
10:58justin_smithnothing prints naturally as 'bar
10:58justin_smith,'bar
10:58clojurebotbar
10:59csd_defun game-read ()
10:59csd_ (let ((cmd (read-from-string
10:59csd_(concatenate 'string "(" (read-line) ")"))))
10:59csd_ (flet ((quote-it (x)
10:59justin_smith'bar is a read syntax, but not part of any printing syntax
10:59csd_ (list 'quote x)))
10:59csd_(cons (car cmd) (mapcar #'quote-it (cdr cmd))))))
10:59csd_that's the code in CL
10:59Bronsacsd_: please use a nopaste
10:59csd_sorry
10:59justin_smithcsd_: I am sure common lisp does this, clojure does not
11:00justin_smithyou can fake it if you like, or alter print-method for symbol I guess?
11:00justin_smithbut nothing in clojure prints with a leading ' naturally
11:01csd_interesting, ok
11:01justin_smithcsd_: would it butcher the whole thing to use keywords instead?
11:02justin_smith,:bar
11:02clojurebot:bar
11:03csd_justin_smith: i don't think it would butcher it, although it'd definitely require rewriting some of the earlier code
11:04justin_smithit might be a more natural fit, since they have a proper print/read conversion
11:04justin_smithor, I mean, print/read/eval
11:12csd_justin_smith: could it be done with a recursive macro? Something like `('~foo (macro-name (rest input)))
11:18TimMclazybot: #1
11:18justin_smithcsd_: that still would not print with a '
11:19csd_i just need to eval it so that all symbols but the first are treated as if quoted, not to print to screen with '
11:19justin_smithoh, than don't eval
11:19justin_smithjust read
11:19Bronsacsd_: what you need is (some-function "identity foo") ;-> foo?
11:20technomancy(apply (resolve (first x)) (rest x))
11:20Bronsa^
11:20Bronsawell, after read-string'ing obviously
11:21technomancyyou don't even need eval, assuming the first refers to a var
11:24csd_technomancy: perfect!
11:27csd_Does the CL code I pasted overcomplicate the CL solution, or is there no better way for them to do the above?
11:58thesaskwatchHello, how to start with ClojureScript if I have some Clojure knowledge, but 0 about CS?
12:02Glenjaminthesaskwatch: do you have something in mind to build?
12:03thesaskwatchGlenjamin: yes, github milestone / issues visualization
12:04Glenjaminhows your JS?
12:04Glenjaminand have you done any previous work with React?
12:04thesaskwatchGlenjamin: good js, I understand how react works
12:04Glenjamincool, so i'd say try figwheel with reagent
12:04thesaskwatchGlenjamin: thanks
12:06Glenjaminif you want a proper repl, try weasel or austin, but they're a little fiddly to link to figwheel
12:08Glenjaminon the subject of clojurescript, does anyone know if there's an open bug for giving a better message than "cannot call method 'call' of undefined" when the fn being applies is missing? I'm searching jira atm but can't see anythin
12:08afhammadI have record A implemented in ns x.a, and record B in ns x.b. How can I use A in an instance of B and vice versa?
12:10Glenjaminafhammad: if you need the underlying Record type, you need to use :import in the (ns) form with the JVM name
12:10Glenjaminbut if you just want to create one, you can import the factory function ->MyRecord
12:11Glenjaminor did you mean how to resolve the circular dependency?
12:11afhammadyes, circular dep. does importing the factory func get around it?
12:11thesaskwatchGlenjamin: are there any basic concepts I should start with? I see that at least cljbuild is one
12:11Glenjaminthesaskwatch: yeah, cljsbuild is probably the main one, but the defaults figwheel generates are reasonable
12:12Glenjaminapart from that it's a lot like clojure in terms of the core fns
12:12thesaskwatchGlenjamin: ok, great
12:12Glenjaminand there's some fancy stuff like #js and js* but you should be able to avoid them until you need them
12:15afhammadGlenjamin: yes, circular dep. does importing the factory func get around it?
12:15Glenjaminhttp://stackoverflow.com/questions/3084205/resolving-clojure-circular-dependencies seems sensible
12:16Glenjamintl;dr is have a namespace with the types in
12:19afhammadGlenjamin: yeh read that, saying a refactor is required is fine, but no one gives an example of what that might look like. I am using records to represent db models, dumping them all into one ns isnt really a great option
12:20Glenjaminwhy do you say that?
12:20Glenjaminyou could also just combine the ones which are circular
12:21Glenjaminif they're coupled to each other, you're probably not gaining much from separating
12:24afhammadhow are models represented in clojure, where you are trying to encapsulate a certain domain into a ns? For example a "Project" and a "User" are totally diffrerent things, why would I want to combine them
12:25rweirwhy would you combine them? put them in different namespaces
12:26Glenjaminafhammad: perhaps the question then becomes, why is there a circular dependency between them if they are totally different things?
12:29afhammadGlenjamin: because things need to talk to each other in order for a system to work, otherwise whats the point. A better example, I have a Project and a Feature, where a Project might want to grab features that it is associated with without rewriting the db call, while a feature wants to grab a project is bleongs to.
12:29Glenjaminafhammad: sorry, i'm not trying to be snarky, just trying to get at the core of why it's currently structured this way
12:30Glenjaminthere's a few valid constructions for that, and circular dependencies is one of them - but not supported in Clojure
12:31Glenjaminyou could have the records be in a namespace that contains only records, while functions live elsewhere
12:31Glenjaminyou could say "projects and features are related, so they live in the same ns"
12:32Glenjaminyou could have a namespace that contains cross-model fns, while encapsulated things stay in the same ns as the records themselves
12:32Glenjaminif you treat it as a model/mapper separation, i think that would work also
12:34afhammadGlenjamin: hmm ok thanks, i'll think about those some more.
12:45justin_smithafhammad: one option is to define (a) protocol(s) that both A and B know how to access, and write all their code that touches one another in terms of (those|that) protocol(s)
12:47justin_smithso User and Project could be protocols (each with their own ns) and then your records would implement User and access a Project and visa versa
12:47justin_smithafhammad: this is quite clean in practice, and as a bonus allows easy outside extension
12:48justin_smithafhammad: everywhere where I say protocol above, you could instead use a group of multimethods if you prefer the flexibility of doing it that way, but your design as expressed so far sounds more protocol friendly
12:49afhammadjustin_smith: they both implement ModelBase protocol which contains the fns that I need right now. Lets say in fn get-one of Project I need to call get-all of Feature. what would that look like?
12:49justin_smithafhammad: another thing to consider, backing up Glenjamin's reasoning, is that in clojure we decouple data from code, and that is actually a Good Thing™
12:49justin_smithafhammad: are get-one and get-all part of the ModelBase protocol?
12:50afhammadjustin_smith: yes
12:50Glenjaminthis sounds quite active-record-like
12:50justin_smiththen call the protocol method
12:50justin_smithyou don't need to know anything about the concrete implementation, that's the point of protocols
12:50justin_smitha Project shouldn't have to know the concrete type of a Feature, just that it implements some protocol Project cares about
12:51afhammadwhat does that call look like? just so I follow along
12:51justin_smithcall the protocol method on the object
12:52justin_smithit works just like a function in clojure (proto-ns/proto-method thing)
12:52justin_smithif you give me concrete names of things I can make that example more specific
12:53justin_smithafhammad: mind you the protocol function is namespaced to where the protocol is defined, not to where the implementation is defined
12:53Glenjaminpresumably the problem is you want to do (defn features [project] (features/get-all :project-id (:id project))
12:53afhammadso for example, Project's get-one needs to call Feature's get-all
12:53justin_smithis features a protocol namespace?
12:53Glenjaminand also (ns features) (defn project [feature] (project/get-one :id (:project-id feature)))
12:53justin_smithif not you are doing it wrong
12:54justin_smithGlenjamin: n/m sorry, I got confused about who was pasting what
12:54justin_smithafhammad: get all and get-one should not belong to Project or Feature, they should belong to some protocol
12:55justin_smithif you are using protocols, use protocol methods and treat the class of the argument as irrelevant
12:55afhammadjustin_smith: well they do, but they are implemented in record Project in (ns x.project) and record Feature in (ns x.feature)
12:55justin_smithafhammad: place of implementation does not matter!
12:56justin_smithyou call the protocol method based on the namespace where the protocol is defined
12:56justin_smiththat's the point of protocols
12:56justin_smiththe calling code should only know the protocol, and know nothing about the objects that implement them
12:57afhammadjustin_smith how does it know which implementation to use?
12:57justin_smithafhammad: it doesn't
12:57Glenjaminjustin_smith: that would still require a protocol per entity, in this scheme, would it not?
12:57justin_smiththe protocol knows
12:57afhammadhow does the protocol know?
12:57justin_smithafhammad: extend / defrecord tell the protocol who extends it
12:57justin_smithGlenjamin: he wants them to both be based on the same protocol, or so he said
12:58Glenjaminright, but the problem is they want to both reference each other
12:58justin_smithafhammad: you call the protocol, the protocol calls the method that that object registered with that protocol
12:58Glenjaminfeature would load it's parent project, and projects would load their child features
12:58Glenjamini don't see how a single protocol helps there
12:58justin_smithGlenjamin: they shouldn't reference each other, only instances of the protocols one another implement
12:58justin_smithGlenjamin: this is how nearly the entirety of clojure.core is done, it works
12:59justin_smithGlenjamin: it can be N protocols
12:59Glenjaminright, the protocols (types) live separately from the implementation
12:59afhammadjustin_smith: when you call the protocol, are you supposed to pass in an instance of the record? are there any examples of this
12:59justin_smiththe point is no circularity is needed if both objects call protocol methods, and both can know all protocols involved
12:59justin_smithafhammad: exactly, the first argument to a protocol method is the thing extending it
13:00justin_smithafhammad: all the container knows is "this is an instance of Foo" and it call some protocol method of Foo on it
13:00justin_smithFoo being a protocol of course
13:00afhammadso basically I need to pass an instance of the other record in the function i'm calling, in order to pass it to the protocol call?
13:01Glenjaminafhammad: can you provide a sample of what you'd like code that uses these models to look like?
13:01justin_smithGlenjamin: afhammad: to be more concrete - the protocols, however many exist, clearly don't need to know about one another. By coding in terms of these isolated protocols (implementing them, calling their methods) you get arbitrary interoperation with no circularity
13:02justin_smithafhammad: right, and if something needs to know about both User and Project, then it must be a higher order thing that works with both
13:02Glenjaminjustin_smith: right, but you still need to extract a bunch of protocols into a separate namespace from the implementations, and i don't think that abstraction is worth it over a similarly structured non-protocol approach in this case
13:02justin_smithand it can put them together as it likes
13:02Glenjaminassuming i'm understanding the problem statement properly
13:02justin_smithGlenjamin: fair point, that is often the case
13:03justin_smithGlenjamin: I am trying to present how one properly uses a technique afhammad already started using (definign and implementing protocols)
13:03afhammadjustin_smith: I THINK that solves the issue, was hoping it didnt come to that, but i guess thats it
13:03Glenjaminon the surface, it sounds like you're trying to build quite and OO-style active-record-style api, which I don't think works all that well in Clojure
13:03justin_smithafhammad: I don't know your code, but that almost always works
13:03justin_smithGlenjamin: well, activerecord was one of his premises, arguing about that is another can of worms altogether :)
13:04Glenjaminheh, very true
13:04justin_smithbut yes, proper clojure design is often about decoupling data and functions
13:04justin_smithin a way that is very unlike OO
13:04Glenjamini think it's possible that the complexity here comes from trying to build an api that isn't very clojurey
13:05justin_smithGlenjamin: yeah - but clojure CAN do that stuff, if you use the tools as intended
13:05afhammadjustin_smith: Glenjamin: perhaps, not because i want to, but because i have yet to see a decent clojure approach to it, do you know of any?
13:05justin_smithafhammad: use vanilla datastructures. Write functions that work on said vanilla datastructures. Rely on immutability and purity of functions instead of data hiding and encapsulation.
13:06Glenjaminafhammad: personally i would keep separate the definitions of my models & pure functions that deal with them, form the code which marshalls them to and from the database
13:07Glenjaminand then you'd end up with something like (app.feature-mapper/get-all project) and (app.project-mapper/get-one feature)
13:08afhammadjustin_smith: Glenjamin: Thanks for the input guys, will need to rethink the structure with the points uv raised
13:10justin_smithafhammad: I find that I use protocols etc. for things that really benefit from OO. Unlike some clojure folks I think there are some problem domains where that really is the case. But Clojure style OO is about interfaces and message passing, not inheritance and encapsulation.
13:10justin_smithwell that binary may be overstated, but that's where the emphases / deemphases are
13:12afhammadjustin_smith: The only reason i went down the protocol/record path is because I thought i would solve my circular dependency issue
13:13justin_smithafhammad: the alternate solution is to use generic data structures (things like maps, vectors, lazy-seqs, sets, + keywords as markers)
13:13justin_smithyou can easily write code that utilizes these without circular dependencies
13:14afhammadjustin_smith: the records arent really holding any data, they just have a bunch of fuctions
13:14afhammadjustin_smith: the functions return what ever data they get to you, not persisted to the record
13:14justin_smithafhammad: aha, implicit in that approach is that the data comes first, and the functions are just ways to gather / massage the data
13:15justin_smithso you would have functions that can grab each data source, and functions which perform the transformations you need
13:15justin_smiththe approach is a tradeoff compared to OO, but it really does have powerful aspects
13:24engblomIs it possible to "configure" clojure to automatically switch from integer to biginteger instead of throwing an exception.
13:24engblom=
13:25engbloms/./?/
13:25arrdemYou can switch to using +', -' and soforth...
13:26arrdemthe "normal" core math functions will never auto-promote
13:26arrdem$grim clojure.core/+'
13:26lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/+'
13:27arrdembut there isn't some configuration dynamic var you can bind to alter the behavior of + if that's what you're looking for.
13:29engblomarrdem: +' -' etc are what I am looking for
13:42razum2umcan delete/yank a version from clojars?
13:43AeroNotixrazum2um: nope
13:43AeroNotixNot without someone at Clojars doing it for you
13:43arrdemin general no, however technomancy has been prevailed upon in the past when there was a good reason to do so
13:43justin_smithrazum2um: you can ask one of the folks who run clojars nicely, if there is a security or stability issue
13:43justin_smithrazum2um: the people who can do that tend to hang out here, and also #leiningen
13:44razum2umbut is this intentionally or just nobody pushed a PR?
13:44AeroNotixintentionally
13:44justin_smithintentionally
13:44razum2umwtf?
13:44AeroNotixrazum2um: think about it
13:44AeroNotixIf someone pushed a dependency, then people depended on it, then someone deleted it. What happens then?
13:45AeroNotixA good dependency management system needs immutable dependencies
13:45AeroNotixEnd of story as far as I am concerned.
13:46justin_smithAeroNotix: I make exceptions for greivous security concerns, where it's better that your app crash rather than run said code
13:46razum2umAeroNotix: not exaclty. a good dependency tool can let specify dependencies like bundler ~> 1.0 this means 1.x but not 2.0, and it will just fetch latest version of 1.x branch
13:46justin_smithrazum2um: that really sucks in practice
13:46razum2umAeroNotix: this way yanking is nothing special
13:46justin_smithrazum2um: you can do that with mvn, it just breaks all sorts of things
13:47AeroNotixrazum2um: dependency ranges are not incongruent with immutable dependencies
13:47justin_smithdependency ranges suck though
13:47Glenjaminbeing able to yank a dependency seems reasonable
13:47Glenjaminbeing able to change one is terrible
13:47justin_smithagreed
13:47Glenjaminthe assumption is that people wouldn't yank without a good reason
13:48AeroNotixGlenjamin: which is why the option goes through humans, I think it's a reasonable way to do it
13:48AeroNotixlike justin_smith said, security threats are a good reason to yank a version
13:49arrdemthe only things I remember technomancy or anyone else removing from clojars were internal dependencies that shoudln't have been deployed
13:51razum2umand what about some sad hotfixed versions, which are pushed and then realized some bug, fix it and push another one again, is this a good practice to leave known buggy version out there?
13:52AeroNotixrazum2um: push a new version and live with your mistake
13:52AeroNotixyou shouldn't be pushing new things willy-nilly
13:52andyfrazum2um: Which versions don't have bugs?
13:53razum2umAeroNotix: ok then )
13:53Glenjaminit'd be nice to be able to mark versions as "don't use this because X"
13:54Glenjaminwhile still leaving them public
13:54Glenjaminbut i've never used a package registry that did that
13:55andyfGlenjamin: Kind of like a signed addendum to a released version of "This has bugs with severity >= n" ?
13:55andyfOne that a dependency manager tool like Leiningen would be able to inform you of with a certain command?
13:55Glenjaminyeah, that'd be neat
13:58andyfMaybe that would be a Clojars enhancement that Nelson Morris could find a way to get paid for.
13:58justin_smithandyf: Glenjamin: doesn't lein ancient help with this
13:58andyfI'll send him a message in case it helps
13:59justin_smithit would be cool if lein ancient said 1.x has a newer version, also you could upgrade to 3.x
13:59andyfjustin_smith: It tells you whether there are newer versions, not how severe any known bugs are
13:59justin_smithandyf: right
13:59Glenjaminjustin_smith: it does that, but doesn't distinguish between "is fundamentally broken" vs "has new stuff"
13:59arrdemandyf: random tooling idea I've been kicking around
13:59justin_smithyeah - a bug/security metadata feature for versions would be awesome
14:00arrdemandyf: take the set of var/fns and their arities, spit it to a file, compare between "releases" to confirm at least nominal SemVer adherence
14:01andyfarrdem: I'll send that idea to Nelson, too, giving you credit, if you don't mind.
14:01arrdemandyf: go for it. I think it'd be nice to see.
14:01Glenjaminxeqi: ping?
14:01andyfNot sure if it will go anywhere, but I know he has been looking for ways to get paid for Clojars work that adds value.
14:02xeqiGlenjamin: surprise pong
14:02Glenjaminoh neat, lazybot counts
14:02Glenjaminwe were discussing some potential money-worthy clojars features just up
14:05xeqihttps://www.youtube.com/watch?v=JjYAnBhF2JU has some neat ideas in this general area as well
14:09andyfxeqi: Cool. I sent you an email with a couple of ideas just discussed in the last few minutes here, in case they are useful. I have no idea what paying customers are interested in, though.
15:07martinklepschwhats the syntax in enlive to do whats in css slectors "#a, #b" ? [:#a :#b] means it looks for #b in #a
15:09justin_smithmartinklepsch: intuitively I would expect #{:#a :#b}
15:09justin_smithsince that is unordered
15:15borkdudewhat's the recommended way to embed a video in an octopress blogpost?
15:30anneliesmartinklepsch: from the documentation:
15:30csd_Why is it that sometimes my nREPL session becomes borked up and I can't (read-line) anymore without opening a new REPL?
15:30annelies> At the top level you can have a big "or" between selectors by wrapping several selectors in a set. #{[:td :em] [:th :em]} is going to match any em insides either a th or a td. This is equivalent to [#{:td :th} :em].
15:31justin_smithannelies: cool, I guessed right
15:31anneliesOr rather
15:31annelies> Similarly, sets group predicates in an union.
15:31justin_smithannelies: also, regarding that markov thing you shared the other day, did you hear about the generative text competition going on?
15:32anneliesNo!
15:32justin_smithhttps://github.com/dariusk/NaNoGenMo-2014
15:32justin_smiththere is some stiff competition already
15:33justin_smithhttps://github.com/lizadaly/nanogenmo2014 this thing is amazing, even if it weren't algorithmically generated
15:33anneliesI don't like competitions. :p
15:33justin_smithhehe
15:34justin_smithanyway, that lizadaly project is like, wow
15:34martinklepschannelies: what documentation did you find this in?
15:34anneliesenlive readme
15:34martinklepschoh
15:34martinklepschI was thinking this was most extensive about selectors: http://cgrand.github.io/enlive/syntax.html#selector-step
15:34annelies> #{selector-step*} ; union
15:34anneliesThat page also mentions it!
15:35martinklepschI misunderstood that then. Was expecting something different with union. anyways thanks to both of you :)
15:38justin_smithannelies: I go to liza daly's web site, and see why her contribution is so good: http://lizadaly.com/ she's in the digital publishing business
15:40csd_,(do (print-str "aaa") (Thread/sleep 5000) (print-str "bbb"))
15:40clojurebot"bbb"
15:40csd_Someone care to explain this?
15:40justin_smithcsd_: print-str does not do what you think it does
15:41csd_It just returns as string?
15:41justin_smith,(do (println (print-str "aaa")) (Thread/sleep 5000) (print-str "bbb"))
15:41clojurebotaaa\n"bbb"
15:41justin_smithright
15:41justin_smith,(do (prn (print-str "aaa")) (Thread/sleep 5000) (print-str "bbb")) ; prn, so we see the data more clearly
15:41clojurebot"aaa"\n"bbb"
15:41AeroNotixanything for libnotify ?
15:41csd_justin_smith: playing around in the REPL, i've experienced a few times where i'll read in, printing will fail, and then when i call the same command again,w hat should have been printed the first time is then printed.
15:42csd_what exactly are the mechanics behind that?
15:42csd_i'm guessing its a buffer that doesn't get released the first time around
15:42justin_smithcsd_: print or println?
15:42justin_smithcsd_: the default in the jvm is to buffer until newlines
15:42csd_using print-str only
15:42justin_smithprint-str is not a printing function
15:43justin_smith(doc print-str)
15:43csd_i've never used it until now, but it seemed to be working, until it wasnt
15:43clojurebot"([& xs]); print to a string, returning it"
15:43justin_smithit is a string function
15:43justin_smithyour stuff was only accidentally working
15:44csd_is there a corollary to print/println that flushes the read buffer?
15:51anneliescsd_: not in clojure.core
15:51justin_smithprintln flushes
15:51justin_smithbecause newlines flush
15:51justin_smithand there is also the flush function
15:51justin_smith,(doc flush)
15:51clojurebot"([]); Flushes the output stream that is the current value of *out*"
15:51anneliesit flushes the output buffer, not the input buffer, right?
15:51justin_smithannelies: oh right, my bad
15:51anneliesalso depends on *flush-on-newline*
15:51justin_smithI misread
16:38technomancyI saw discussions above about clojars deletions... a compromise that we're open to is allowing deletions for packages that have no downloads.
16:38technomancybut no one has submitted a patch for this yet.
16:38technomancyalso allowing "do not use this" advisories is something we'd consider a patch for
16:45thesaskwatchHi, I'm trying to use figwheel and I'm getting a Caused by: java.lang.RuntimeException: No such var: clojure.core.cache/through error. Anyone has an idea what's wrong?
16:46thesaskwatchthat's my project.clj https://gist.github.com/mateusz-fiolka/d8f45b656c449861724b
16:46JefffreyMorning
16:46arrdemthesaskwatch: not having org.clojure/core.cache in your deps?
16:47thesaskwatcharrdem: the tutorial doesn't say it's needed. Example pom in figwheel repo doesn't have it.
16:47annelieshi Jefffrey
16:47arrdemRaynes: is there a lazybot plugin for searching up the latest clojars version of something?
16:47Raynes$search useful
16:47thesaskwatcharrdem: https://github.com/bhauman/lein-figwheel/blob/master/example/project.clj
16:47RaynesI'm sure there is somewhere.
16:47RaynesSomewhere in there.
16:48arrdemthesaskwatch: it's a transitive dep.
16:48Raynes$latest useful
16:48lazybot[useful] -- https://clojars.org/useful
16:48thesaskwatcharrdem: then shouldn't it just be dependency of figwheel?
16:48Rayneshm
16:48technomancythesaskwatch: there's a bug in clojure's AOT compiler that causes problems like that some times with plugins
16:48clojurebotHuh?
16:48RaynesOh
16:49Raynesarrdem: There's a function that does screen scraping.
16:49thesaskwatchtechnomancy: ok, thanks
16:49Raynesarrdem: But it's broken due to the design changes a while back.
16:49Raynesarrdem: fix plz
16:49Bronsathesaskwatch: I believe some of your deps requires a version of core.cache, and another pulls in an older version
16:49arrdemRaynes: :/
16:49JefffreyHi annelies
16:49Raynesarrdem: It's the latest command in clojure.clj
16:49thesaskwatchBronsa: any way to do something like maven dependency:tree with lein?
16:49Rayneslein deps :tree
16:50arrdemRaynes: yeah I'll take a look later
16:50technomancythesaskwatch: sounds like this problem is related https://github.com/technomancy/leiningen/issues/1563
16:52thesaskwatchlooks like core.async needs it
16:52thesaskwatchI'll add it explicitly
16:56thesaskwatchtechnomancy: so what's the workaround? specifying latest core.cache in dependencies doesn't help
16:57technomancythesaskwatch: it's a bug in the clojure compiler. you can't work around it in a plugin.
16:57technomancyI guess the workaround is to not use a plugin.
16:58Bronsatechnomancy: how is that a bug in the clojure compiler?
16:58thesaskwatchtechnomancy: I'm confused. This is my first approach to clojurescirpt. I thought that figwheel is an often used plugin. Does it mean it's broken?
16:59technomancythesaskwatch: dunno, I've never heard of figwheel before
16:59technomancylots of the clojurescript tooling is broken though from what I can tell just observing on irc
16:59technomancyBronsa: hrm. I may be getting this confused with an earlier bug.
16:59thesaskwatchtechnomancy: ok, thank you
17:00arrdemRaynes: wait why are you doing screen scraping?
17:00technomancyBronsa: I know there are issues with mixing AOT and non-AOT, which is why I try to AOT as late as possible.
17:00technomancyplugins make this difficult.
17:00Raynesarrdem: uh, because it was the only trivial way to do it at the time?
17:00arrdem's legit
17:03Bronsathesaskwatch: you might have more luck asking in the #clojurescript channel when there's more activity btw
17:03thesaskwatchBronsa: yes I just joined it :)
17:09justin_smithanyone recall how to get a binary data source from clj-http?
17:10justin_smithn/m, found it
17:16arrdemat macro invocation time, *ns* will be the expansion context namespace right?
17:17Bronsayes
17:40cristianHi guys. Is there any function that allows me to convert a clojure map to a Java bean? There's a function called `bean` that converts from Java bean to clojure map... I'm looking for the opposite.
17:43justin_smithcristian: maybe this is what you want? https://github.com/clojure/java.data/blob/master/src/main/clojure/clojure/java/data.clj#L93
17:45justin_smithcristian: actually, maybe this http://clojure.github.io/java.jmx/#clojure.java.jmx/create-bean
17:45justin_smithI guess you need to put it in an atom first?
17:46justin_smithor maybe jmx beans are different...
17:47cristianYes, JMX is a different beast. By bean I mean just simple POJOs
17:47justin_smithright, right
17:49justin_smithcristian: according to this, sometimes a record works (if you can make a record with the fields that matter) https://groups.google.com/forum/#!topic/clojure/Z7MwDUys8NA
17:50arrdemdnolen_: damn thanks for the fast turnaround :D
17:50dnolen_arrdem: np
17:53cristianjustin_smith: Thanks, I'll take a look at that
17:58justin_smithcristian: just figured this out in my repl https://www.refheap.com/93004
17:58justin_smithcristian: depending how specifically you know the fields you care about beforehand, that approach should be usable
17:58justin_smithcristian: the trick is that you need the protocol in order to have the getX methods
18:00arrdemdnolen_: I messed up and forgot the namespace separator. Shall I just update the ticket?
18:00cristianjustin_smith: interesting!
18:00justin_smithcristian: Clojure is very opinionated about implementing to an interface rather than a class, so you can only create the methods if you get them from a defined interface
18:01justin_smithcristian: a protocol is just a clojure abstraction for an interface (and java can use what it creates as an interface)
18:01dnolen_arrdem: fixed in master
18:01arrdemdnolen_: thanks.
18:03justin_smithcristian: to be clear "bean" is for turning beans into hash-maps, so an instance of Foo should work where a bean is expected
18:04justin_smithcristian: if not, you could instead reify the FooProto and use that
18:05cristianok
18:10Glenjamindoes anyone know of a good primer/cheatsheet on clojure syntax?
18:10arrdemreidrapper's clojure tutorial posts are good...
18:10bbloomGlenjamin: http://clojure.org/reader
18:11bbloomGlenjamin: and http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
18:11Glenjaminthis is to use as a reference for a cljs workshop where people won't know any clojure
18:11Glenjaminbut will be familar with FP
18:12Glenjamini've written half an app, so the plan is they'll be able to finish it
18:12bbloomthe second one is probably the easiest to use as a quick reference
18:12Glenjamini might try and write something that only covers the bits i'm using
18:13Glenjamincan't decide whether to reduce myself to a smaller subset
18:13Glenjaminmaybe remove any destructuring and use (fn [] over )#()
18:14justin_smithGlenjamin: "reduce myself to a smaller subset" sounds like nerdy jargon for going on a diet
18:18Glenjamincheers for the links bbloom
18:18Glenjaminwhat language intro tutorial do people tend to recommend these days?
18:31dnolen_Glenjamin: the best ones are the books still - there are several things online now that's useful - http://www.braveclojure.com/, Kyle Kingsbury's (aka aphyr) intros
18:31dnolen_Timothy Baldridge and Eric Normand have nice inexpensive videos
18:36razum2umcan I composite filtering functions via "and" & "or" (say I have divisible-by-3 and divisible-by-5) or do I need to stick with #(and (divisible-by-3 %) (divisible-by-5 %)) because "and" is a macro?
18:37razum2umi mean is there a more "clojurish" way to comp them?
18:39metellus,(doc every-pred);; razum2um would this do what you want?
18:39clojurebot"([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates."
18:39RaynesI believe so.
18:40razum2ummetellus: that's ok, thanks, but there is some-pred for OR ?
18:40justin_smith,((every-pred #(zero? (mod % 5)) #(zero? (mod % 3))) 15)
18:40clojurebottrue
18:41razum2um,(filter #(or (divisible-by-3 %) (divisible-by-5 %)) (range 20))
18:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: divisible-by-3 in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:42razum2umbut you got the idea
18:42justin_smith,(filter (every-pred #(zero? (mod % 5)) #(zero? (mod % 3))) (range))
18:42clojurebot(0 15 30 45 60 ...)
18:42metellussome-fn, maybe?
18:42justin_smithoh you want or, not and?
18:42metellushe asked for both
18:43razum2umjustin_smith: yes, wrote it twice already
18:43justin_smithrazum2um: sorry, I missed that
18:43razum2umi just wonder why (comp & fns) is so neat and logical composition not
18:43justin_smith,(filter (some-fn #(zero? (mod % 5)) #(zero? (mod % 3))) (range))
18:44clojurebot(0 3 5 6 9 ...)
18:44RaynesIn these cases I tend to just use for.
18:44justin_smithlogical composition is neat
18:44RaynesIt represents these complex structures better.
18:44justin_smithyou just need to use the right functions
18:44justin_smithevery-pred for and, some-fn for or
18:44Raynesfilter, map, etc are great, but they're usually unwieldly when the predicate gets hairy.
18:44razum2umok, we have "some-fn" and "every-pred" - very consistent :D
18:44RaynesDon't be afraid to use for just because it's for.
18:45arrdemfor is one of my favorite features of Clojure
18:45razum2umbut again, it's not equal to logical AND'ing and OR'ing functions
18:45RaynesNeither are doorknobs.
18:49metellusrazum2um: juxt might be useful here
18:49metellusas another option for combining functions
18:59razum2ummetellus: thanks! I needed exactly these to build what i need: (defn and-fns [& fns] (fn [& args] (every? true? (apply (apply juxt fns) args))))
19:00razum2umand (defn or-fns [& fns] (fn [& args] (some true? (apply (apply juxt fns) args))))
19:00justin_smithrazum2um: how are those better than some-fn and every-pred?
19:00razum2umjustin_smith: they are better composable
19:01justin_smithin what way?
19:01razum2umand resulting function can be composited with other
19:01justin_smiththese things are all true of some-fn and every-pred?
19:02razum2umsome-fn and every-pred are very limited in usage
19:02justin_smithno they aren't
19:03arrdemsome-fn and every-pred have the same type signatures as your and-fns and or-fns. what on earth do you mean they aren't equally composable.
19:03arrdemactually they don't, because or-fns isn't gonna be lazy...
19:03arrdemand ever-pred is explicitly lazy
19:05razum2umhm, you're right
19:05razum2ummy bad, sorry,
19:09crack_userhello guys
19:09crack_usersome one knows a good way to start in clojure?
19:11TEttingercrack_user, what experience do you have in other languages?
19:11crack_userruby, rails
19:12crack_userI am rails guy basicaly, and I find some dificult to start in clojure
19:12crack_useris very diferent to I am used to do
19:12TEttingerhttp://www.braveclojure.com/ I have heard good stuff about
19:12TEttingerI used 4clojutr
19:12TEttinger4clojure
19:13TEttinger$google 4clojure
19:13lazybot[4clojure – Welcome!] https://www.4clojure.com/
19:13justin_smithyeah 4clojure / clojure koans can help you get a feel for things
19:13justin_smith~koans
19:13clojurebotGabh mo leithscéal?
19:13justin_smithclojurebot: koans |is| http://clojurekoans.com/
19:13clojurebotIn Ordnung
19:13justin_smith~koans
19:13arrdemof all the "learn clojure" resources that aren't print books, the koans have had the most effort put into them
19:13clojurebotkoans is http://clojurekoans.com/
19:13arrdem,(+ 1 2)
19:13clojureboteval service is offline
19:14TEttinger##(+ 1 2 3)
19:14lazybot⇒ 6
19:14TEttinger(inc lazybot)
19:14lazybot⇒ 34
19:14arrdemno... clojurebot is fine I'm checking to see if I'm still on hiredman's blacklist
19:15TEttingerlol
19:15oskarkv,(+)
19:15clojurebot0
19:15crack_userthx, I whill check theses links
19:15TEttingerhow'd that happen, arrdem?
19:15arrdemTEttinger: hell if I know. I assume I got the stick transitively when bitemyapp did
19:16TEttingerare you on the same box?
19:16justin_smithcristian: updated the paste with an example of using reify, which is more succinct if you are only doing it once https://www.refheap.com/93004
19:16arrdemnah
19:16arrdemhttps://github.com/hiredman/clojurebot/issues/5
19:28cristianjustin_smith: awesome, thanks dude
19:30justin_smithI haven't really played with gen-class, since I haven't done much of the sort of interop that requires it. Is there a way to play with gen-class in the repl? does that even make any sense?
19:59amalloyjustin_smith: no, you can't
20:00justin_smithamalloy: OK, that's what I was afraid of
20:00justin_smithverified: the truth hurts
20:17technomancyhm; can't you just bind *compiling-files* or whatever?
20:18technomancyerr--not bind, but change
20:19justin_smith,(apropos "compiling")
20:19clojurebot()
20:19justin_smith,(apropos "files")
20:19clojurebot(clojure.core/*compile-files*)
20:20justin_smith&(doc *compile-files*)
20:20lazybot⇒ "; Set to true when compiling files, false otherwise."
20:21justin_smithtechnomancy: but I would still need to put the class definition into a file before it could be compiled though I think
20:22rritoch@justin_smith: There is another way, I believe I talked to you about it but the code is now open sourced.
20:22justin_smithrritoch: oh yeah, I still intend to look at that
20:22rritochI think it's in the kernel, I"m checking now
20:22justin_smithI tried to run marginalia but it couldn't resolve some of the deps
20:23rritochYeah, because it's linked to my private repository, I need to move everything to clojars
20:24rritochjustin_smith: Take a look at this code https://github.com/rritoch/clj-grid-kernel/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/kernel.clj#L500-L503
20:24rritochThis compiles from a URL as an inputstream
20:24justin_smithOK
20:24rritochSo there's no need to write a file first
20:28technomancyjustin_smith: are you sure?
20:28technomancyI don't see why
20:28rritochAnyhow, today is my day off so I hope to resolve the final resource loading issue with the servletcontext, and move everything to clojars (in that order).
20:28technomancyafaik compiling is just loading with *compile-files* set to true
20:29justin_smithtechnomancy: right, so I need to load something, it isn't a repl thing
20:29justin_smithtechnomancy: that's all I meant
20:29justin_smithtechnomancy: or do you mean if I turn *compile-files* on, things I enter in the repl will get compiled?
20:29technomancysorry, not loading, evaling
20:30technomancy~tias
20:30clojurebotTry it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.
20:30justin_smithahh, interesting
20:30technomancyheh, I forgot that factoid had that commentary attached to it
20:31rritochtechnomancy: That is not completely true, setting compile-files to true doesn't generate the __init classes needed to instantiate gen-class's
20:31technomancyrritoch: hm; ok. interesting.
20:31justin_smithtechnomancy: https://www.refheap.com/93012
20:32rritochtechnomancy: That is why I had to hack directly into the compiler and call Compiler/compile to get those __init classes
20:32technomancynow we know =)
20:32rritochtechnomancy: Personally though I think it would be much better if simply enabling *compile-files* would compile everything that gets eval'd
20:33technomancyrritoch: yeah, me too.
20:33technomancyare they emitted by c.c/compile?
20:34technomancyoh, probably that's just a wrapper around Compiler/compile
20:37rritochtechnomancy: The code which does it is @ https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7378-L7382
20:40rritochtechmomancy: As for the clojure.core/compile, that wraps clojure.lang.RT/load
20:41rritochtechnomancy: That is what caught me while trying to figure out how to compile an input stream because I was confusing Compiler/load with clojure.lang.RT/load which are two entirely different things.
20:48luther07uther07(+i)] [2:freenode/#clojure(+cnt)] [Act: 1]
21:00rritochIs there a "with" syntax for calling a method on an object if the passed object argument isn't null?
21:02rritochThis is the code I have but it seems like there must be a good way to reduce (golf) this code... (defn -getResourceAsStream [this path] (let [r (get resource path)] (if x (.openStream r))))
21:03rritocherr: it's (get-resource path) not (get resource path) ...
21:05amalloyrritoch: do you mean x there, or r?
21:06justin_smith(defn -getResourceAsStream [this path] (if-let [r (get-resource path)] (.openStream r)))
21:06rritochamalloy: r
21:06rritochjustin_smith: thx, that is much better
21:06amalloys/if/when
21:06rritochjustin_smith: It is such a common case though, there should really be a macro for it
21:07justin_smithif-let / when-let are said macros
21:07amalloyindeed. and if you really want to, you can write a more specialized version yourself
21:07justin_smithoh, there is some-> too
21:07rritochjustin_smith: Like (if-with ob (.Somefunc arg1 arg2 ...))
21:08justin_smith(defn -getReasourceAsStream [this path] (some-> (get-resource path) .openStream))
21:08justin_smithamalloy prefers () around the .openStream
21:08rritochHmm... I'll need to check that out, I never used some->
21:09justin_smithit is that common case you talked about - it stops chaining if any of the results are nil
21:09rritochjustin_smith: Yeah, I think some-> is what I want :)
21:09amalloyit's true, i do prefer (.openStream)
21:10crack_userhey guys
21:10crack_userwhat its the bets way to resolve this koan
21:10crack_user(= (__ (list 1 2 3 4 5)) 4)
21:10crack_userI made "(fn [x] (first (rest (reverse x))))"
21:11crack_userthere is a better solution?
21:12rritochAre you allowed nth? #(nth (reverse %) 1)
21:13justin_smith,(first (take-last 2) [0 1 2 3 4])
21:13clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/take-last>
21:13justin_smitherr
21:13justin_smith,(first (take-last 2 [0 1 2 3 4]))
21:13clojurebot3
21:15crack_userthx for the answers guys
21:16justin_smiththe doc-string on take-last is a bit iffy - "Depending on the type of coll may be no better than linear time" - then it does a loop over seq no matter the input type
21:16justin_smithso it should just say "no better than linear time"
21:20TEttingercrack_user: #(dec (count %))
21:21rritochBah!
21:21rritochI resolved the resource loader issue and ran into another nasty bug
21:21rritochhttp://home.vnetpublishing.com:8080/~vwpdev/?app=version
21:21justin_smithtake-last could theoretically use rseq,take,reverse on vectors...
21:22crack_userTEttinger this is like a cheat, xP
21:25justin_smithTEttinger: surely you mean (comp dec count)
21:25rritochI've gone to great lengths to avoid making a custom class loader for this system but I think this the JSP servlet is going to force me :(
21:29rritochYAY!
21:29rritochClojure classloader worked
21:29rritochhttp://home.vnetpublishing.com:8080/~vwpdev/?app=version
21:31rritochThe some-> syntax is MUCH cleaner..... https://github.com/rritoch/clj-grid-core/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/webapp/servlet_context_wrapper.clj#L73-L74
21:31rritochAnyhow, now to "fight" with clojars
21:31justin_smithyeah, some-> is very nice
21:32justin_smith(inc some->)
21:32lazybot⇒ 1
21:32rritochI have no idea where I put my clojars key
21:32rritochThe only clojars project I have so far is clj-nativedep https://github.com/rritoch/clj-nativedep/blob/master/README.md
21:34rritochI coded it a long time ago, it's still in C-style formatting
21:35dbaschcrack_user: for that matter, (constantly 4) would work too :)
21:36crack_useryep :D
21:38rritochDo I need to add clojars to my project.clj :repositories to do a lein deploy clojars ?
21:41rritochAlso... What java version should I deploy with? I'm currently using java 1.8 but should I use 1.6 or lower for compatibility purposes?
21:41justin_smithrritoch: I think clojure will target 1.6 regardless?
21:42justin_smithperhaps not though
21:43rritochIt doesn't. I specifically had to install this version of java because it's what my client uses, I usually prefer to stick with oracle releases but at the time oracle didn't yet have 1.8.20+ released so I had to use openjdk
21:44rritochCan I add something to my project.clj to force compiling to 1.6 using the 1.8 JRE?
21:45rritochHmm, actually I guess I need 1.7+ since it uses tomcat libraries
21:50rritochOk, I see this here..... https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L248
21:50rritochBut I'm not sure about this -Xlint:-options param.
21:52rritochI guess I'll just try it and see if it burns to the ground
21:59liathitWhich is web framework most popular now?
21:59liathitJodo, luminus, etc..
22:05rritochliathit: Do you have a link for Jodo? I honestly haven't heard of either framework, but I'm developing my own clojure/mvc framework
22:06rritochliathit: My framework is targeting Web 4.0 -> Web 5.0 technology though so it won't be market ready for awhile.
22:07liathitrritoch, http://www.joodoweb.com/
22:08rritochthx
22:08rritochliathit: from my research all I could find was that most lojure web-apps were built on the back of ring
22:08rritochI had to forsake ring though because my framwork provides jsp support which is mutually exclusive with ring at this time.
22:10ddellacostarritoch: why, curious?
22:11ddellacostaliathit: I don't know that frameworks are that heavily used by people doing "real" Clojure web dev, but if anyone is I'd guess luminus
22:12rritochddellacosta: Ring provides it's own javax/servlet/Servlet.class and forbids any external libraries which incliude that class. Since the tomcat libraries which provide JSP support include that class there it won't load from ring.
22:12ddellacostarritoch: ah, I see
22:13rritochddellacosta: Tomcat isn't the only JSP compiler on the market though, I suppose there may be one that's compatbile with ring, but the tomcat version is most widely tested and has the best licensing in my opinion so for now I don't have any ring support
22:14rritochddellacosta: Though I still have some code fragments remaining incase this issue gets resolved
22:14rritochhttps://github.com/rritoch/clj-grid-core/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/ring/core.clj
22:15rritochIt doesn't work anymore but I'll maintain that piece of code if I can convince the ring team to allow tomcat dependencies
22:17rritochWithout ring I'm probably going to need to add a standalone server from lein eventually, but for now I just use a CGI-like execution to test with, and I deploy to tomcat.
22:20rritochI set :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"] in my project.clj and the generated class files are saying major version: 49 ???? How do I get these to compile to 1.7?
22:23justin_smithyou may need :javac-options ^:replace there
22:23justin_smithnot sure though
22:24justin_smithbut wait, javac options are only for javac
22:24justin_smithclojure code is not compiled with javac
22:24justin_smithit's compiled with asm.java
22:24rritochjustin_smith: Aaah, that makes sense
22:26rritochjustin_smith: So is there any way to alter the version of the .clj gen-classes?
22:27justin_smith I really don't know
22:27justin_smith49 is pretty conservative
22:27justin_smithnobody should be using an older version than that
22:27rritochI guess it doesn't matter, these 49's are working inside Tomcat7 which is good enough for me
22:27rritochTomcat7+ is my target
22:27justin_smith49 is java 5
22:28justin_smithI don't know if you can make clojure output a different target version or not
22:28justin_smithmajor versions as documented here: http://en.wikipedia.org/wiki/Java_class_file#General_layout
22:29rritochjustin_smith: What is the normal way to deal with these private repositories in :repositories
22:30justin_smithI don't know, I have never used private repositories actually
22:30rritochjustin_smith: end-users shouldn't have to deal with the gpg-authentication since they won't have access to my private repositories anyhow, will they be auto-ignored since they're not listed in the users local gpg credentials?
22:30justin_smithrritoch: gpg credentials are only for uploads
22:31justin_smithif they want to upload, they can make their own clojars or maven-central account
22:31rritochjustin_smith: No, I get queried for gpg credentials on compiles, probably because these are private repositories, only members can read
22:31justin_smithweird, I have no idea
22:31justin_smithlike I said, I have never used private repos
22:32rritochI guess I'll just remove these repositories, since I'm moving to clojars anyhow I shouldn't need the local copies anymore anyhow
22:36rritochHmm, I really lost my clojars keys
22:37rritochAah, I figured it out, I entered the wrong password *doh*
22:40rritochOk, clj-grid-kernel is now on clojars, I should have the rest up soon
22:41rritochjustin_smith: That should solve any problems you're having with the sources, but you should probably checkout again
22:41rritochafter I'm done with all these uploads
22:42rritocherr: git update = checkout again
22:43rritochThe version plugin gets built via "lein grid bundle" which should be available once I have all of this stuff uploaded
22:49justin_smithrritoch: thanks, I hosed libc on a server today, otherwise I would have taken the time to look it over today
22:49justin_smithhaha
22:50rritochowech
22:50justin_smithrritoch: I was able to fix it though :)
22:50justin_smithit's fun using a system that has no glibc installed
22:52rritochHmm, last I recall nothing runs without glibc if it utilizes any shared libraries. I once built a custom (LFS) system and ran into a lot of malfunctioning states like invalid glibc
22:52justin_smithyup, the first part is figuring out what doesn't use shared libs
22:52justin_smithbusybox is a lifesaver
22:53justin_smithluckily every distro makes sure it is installed
22:53justin_smithed for editing files :)
22:54justin_smithbonus points: make sure you have a user whose login shell is statically compiled, then you may even be able to execute new logins
22:56rritochhmm, well back when I played with LFS entering single user mode via the bootloader was trivial and standard practice so I didn't need a valid login, but that does sound like a good trick
22:57rritochI think for "catostrophic" states I had a static chroot setup and would chroot to a 100% static environment
22:57rritochNot ram efficieint, but it worked
23:11rritochjustin_smith: Ok, clj-grid* is now deployed to clojars
23:12rritochJust let me know if you run into any more issues. These have snapshot dependencies, which I believe my machine is specifically setup to allow which may cause a problem for users.
23:13rritochBut this codebase is really not ready for any kind of release
23:13rritochEven trivial things like delivering javascript resources contained in OSGi modules for <script src=...> hasn't been dealt with.
23:17rritochThe next stage of development for the grid platform is to implement the fscript deployment for optimization purposes, and then deal with the resource delivery issues.
23:19rritochThis is why I'm losing motivation, I've been digging through the "trenches" of systems-level code for so long that when it finally functioned correctly it was an anti-climax.
23:53TEttingerhiredman, arrdem, ddellacosta: I am curious what led to this https://github.com/hiredman/clojurebot/commit/fd3d1a7c036118ba4a3984fa789227c138133630
23:54ddellacostaTEttinger: yeah, me too, and also curious why hiredman doesn't respond to this: https://github.com/hiredman/clojurebot/issues/5 , but I've basically given up on him
23:55ddellacosta,(println "freaking lame")
23:55clojureboteval service is offline
23:55ddellacosta&(println "luckily lazybot exists")
23:55lazybot⇒ luckily lazybot exists nil
23:56justin_smithddellacosta: and check this, I got him updated ##(clojure-version)
23:56lazybot⇒ "1.7.0-alpha1"
23:56ddellacostajustin_smith: oh, nice. :-)
23:57justin_smithno more 1.4 ghetto for the ignored folks
23:57ddellacostahahaha...sweet.
23:57seancorfieldjustin_smith: any reason for alpha1 rather than alpha3? :)
23:58justin_smithseancorfield: has to do with the version that was current when I started doing my update
23:58justin_smithseancorfield: it's a simple pr if you care to make it :)
23:58seancorfieldAh ok
23:59justin_smithreally I should have double checked the current clojure cutting edge release before submitting my pr to raynes/lazybot
23:59stapleris there a "clojure in a box" for windows?
23:59stapleroh gee nevermind, answered my own question.