#clojure logs

2012-11-22

00:00ChongLiand also note that if you ask for rand-int
00:00ChongLiit returns instantly
00:00ChongLiit does not compute the stock-price
00:01amalloyChongLi: yikes, don't use .foo for protocols. just foo
00:02ChongLiI was merely illustrating that it really is a reified java interface
00:02ChongLi.foo breaks if you use try to extend the protocol, I know :)
00:03FrozenlockI really like the example, helps me understand the whole reify thing. However I don't think it will apply in my case; I would just use the java methods on the existing java object, which is what I'm trying to hide.
00:03FrozenlockBut thanks for the example, I really appreciate it!
00:03amalloyeven if you know it's best to point out that it's not the only (or indeed best) way to use it
00:04ChongLiFrozenlock: may I ask why you're trying to hide it?
00:04ChongLiamalloy: it can be helpful if you want to ensure you're not using an extended protocol (for some odd reason)
00:05ChongLisuch as wanting to call it from java code I guess
00:11FrozenlockChongLi: Sure. I want to make an abstraction layer. There's a great number of objects, each with their own properties, and each of them with their own methods. I would prefer to work with a map, and only when necessary fallback to the underlying library. This way I could do (:name custom-map), instead of (get-name custom-object).
00:12ChongLiwhat do all of these objects do?
00:12ChongLiyou mentioned stock price
00:12ChongLiis this some kind of dashboard thing?
00:14FrozenlockIt was only an (unrelated) example. I'm working with a BACnet library. You can look there if you want to see http://dl.dropbox.com/u/40737386/bacnet4J-doc/index.html
00:16ChongLiyou don't need to use a map
00:17ChongLiyou can just implement the interfaces necessary to support what you want
00:23Frozenlock*cricket*
00:24ChongLisorry, I went down a long path of googling
00:24ChongLiclojure.lang.ILookup
00:24ChongLiis the interface
00:24FrozenlockNo no, I was trying to figure out what you meant I failed miserably...
00:24ChongLithat's what reify does
00:25ChongLiit implements an interface
00:25ChongLiit's a pretty weird thing you want to do here
00:25ChongLihehe
00:25ChongLi(:method-name a)
00:26ChongLiinstead of (method-name a)
00:27FrozenlockSo http://stackoverflow.com/questions/5583841/overloading-keywords-in-clojure/5586959#5586959 is near the solution?
00:27ChongLiyeah
00:27ChongLithat's what I looked at
00:28ChongLiI still can't figure out why you'd want to do this though
00:28FrozenlockI'll make a blog post if I can put it in words. Or I'll scratch everything tomorrow morning when I'll realize it won't work :p
00:28ChongLiit may be that you are fixated a little bit on a specific implementation
00:29ChongLiwhen there's a much simpler path to take
00:30FrozenlockStory of my life. If you knew how I tried to seduce my first 'real' love.... :P
00:35wingyChongLi: have you been using clojure for a long time?
00:35ChongLiwingy: maybe 2 months
00:35ChongLiso no
00:36ChongLiI'm trying to learn right along with everyone here
00:36ChongLiI hope if I say something stupid I'll be corrected :)
00:38wingyChongLi: why clojure?
00:38ChongLiwingy: I started off with Haskell
00:38wingycool .. the legendary haskell
00:39ChongLiI had heard some good things about Haskell programmers who moved to Clojure
00:39ChongLiI decided to try it and was very happy
00:40ChongLithere were just some things about Haskell that really bothered me
00:40wingywhat?
00:40clojurebotWhat is @
00:40ChongLithe standard Prelude, for one
00:40ChongLiso much of it is defined in terms of concrete data structures such as lists
00:41ChongLievery project ends up using a ton of libraries just to patch over this flaw in the Prelude
00:41ChongLiand then you run into cabal hell
00:43ChongLiI've also grown to love lisp enough that Haskell's syntax (particularly layout) bothers me
00:44wingyi see
00:44ChongLiand the fact that Template Haskell has this weird syntax; macros in lisp being much better integrated
00:44ChongLibut there are things I really like about Haskell
00:44ChongLilazy evaluation is really cool, as is currying
00:44ChongLiyou can't have everything you want in one language though
00:44ChongLiand I think Clojure has more of what I want
00:46wingyclojure has lazy eval
00:47ChongLiI know
00:47wingydoes it have currying?
00:47ChongLibut it's not by-default
00:47ChongLiyou can do currying as well
00:47ChongLibut it's also not by-default
00:47wingy(partial)
00:48ChongLiin Haskell you can do partial application without any special operator
00:48amalloyit's more like clojure has partial application, which is like currying but done by hand
00:48ChongLiit has other implications
00:48ChongLilike the flip example mentioned hours ago
00:49RaynesYou don't do partial application in Haskell.
00:49RaynesEverything is curried.
00:49RaynesEvery function in fact only takes one argument.
00:50RaynesIt's awesome.
00:50ChongLiit's great for that
00:50ChongLiless great for variable args functions
00:51ChongLiyeah, I know about the printf type trickery
00:51ChongLiit's a hassle
00:51RaynesYeah, it's sad you can't do it in Haskell.
00:51RaynesI still like Haskell though.
00:51RaynesI like Haskell around as much as I like Clojure.
00:51RaynesAnd lately I've been doing as much of it as I have Clojure.
00:52ChongLithey're both really great languages
00:52ChongLiHaskell would be amazing though if its libraries were rebooted
00:53ChongLiit's kinda funny
00:53RaynesMy biggest gripe is the lack of documentation for the JSON parsing libraries (aeson is amazingly easy and fun to use, but it's almost impossible to figure out the easiest way to use it) and the fact that the http lib is documented for the hard things and not the simpler cases.
00:53ChongLilike how people declare .emacs bankruptcy
00:53RaynesI've got blog posts to write.
00:54SgeoI saw a proxy-type in some reflection and thought it was some Java weirdness leaking through, so I filtered looking for stuff that would be only from the library
00:54SgeoTurns out the library does in fact have VP_PROXY_TYPE
00:55ChongLiSgeo: yay
00:55ChongLiyou can dispatch on that then?
00:55SgeoI have working(ish) code now, which uses more reflection
00:55SgeoIs there a way to delete an entire form?
00:55SgeoIn paredit?
00:56ChongLiyeah
00:56RaynesI prefer using evil-mode for that.
00:56ChongLiparedit-kill
00:56Raynesdab
00:57ChongLiparedit-kill is just C-k
00:57ChongLiif you're inside the form
00:57ChongLiuse paredit-backward-up
00:57SgeoI'm sure there are less repetitive ways to write the code than what I wrote
00:57ChongLiC-M-u
00:59ChongLiparedit is another reason I love Clojure
01:00ChongLidespite Clojure having no responsibility for it
01:04amalloywellll, C-M-k is better for "kill single form". C-k is a bit more aggressive
01:05jyuhow to execute a block of test in emacs
02:03bbloomi love how i was able to implement a syntax-quote like system in 19 lines of code :-)
02:03bbloom<3 clojure, you're so pretty
02:04tomojI'm curious, why?
02:04bbloomtomoj: all will be revealed soon :-)
02:05bbloomi'm almost certain that i know what i'm doing
02:05bbloomalmost...
02:05bbloomheh
02:06wingyclojure has made my life better
02:09tomojI didn't mean to suggest it seemed crazy to do that
02:10tomojdatomic makes me want a custom syntax-quote-alike
02:11tomojalmost...
02:11bbloomtomoj: you can built one pretty easily: https://gist.github.com/4129774
02:13bbloomtomoj: and i'm doing a code-as-data type thing, just like datomic's transaction data… so hence the desire for such a syntanx-quote type system…
02:17bbloomtomoj: worth noting: my syntax quote thing doesn't do symbol/namespace resolution
02:18bbloomtomoj: probably pretty easy to add with a (symbol? form) (list 'quote (resolve form)) provided you have a resolve function
02:19tomoj... interesting
02:20tomojyou _could_ set up custom resolution for keywords like :x/foo, and maybe symbols
02:25tomoj(qq :alias [(blog [post :as p] [comment :as c])]
02:25tomoj [:find ?d ?c :in $ ?p :where [(p/comments ?p ?c)] [?c :c/postedAt ?d]] db post)
02:25tomoj:/
02:26ucblovely perl code you got there
02:27tomojdatalog is small and contained at least.. :/
02:27ucb:)
03:37WokenFurydoes anyone else have a problem with lein install installing to current dir target/ instead of ~/.m2? 2.0.0-preview10
03:46WokenFurynmind. it does actually install, just doesn't print anything about it
04:15p_l|workrecommended IDE for Clojure? I have both Eclipse and IntelliJ, but I don't exactly know recommended setups for them for clojure. Emacs is (unfortunately) completely out.
04:15sporkballp_l|work: why is emacs completely out?
04:16sporkballp_l|work: I tend to either use emacs or Sublime Edit (not an IDE, I know)
04:16p_l|worksporkball: because I'm fed up with god-damned-ancient version of SLIME used by Clojure
04:17WokenFuryp_l|work: try nrepl for emacs
04:17thorwilp_l|work: you can get rid of slime and use nrepl
04:17p_l|workhmm
04:17p_l|workhow does it compare to SLIME?
04:18thorwilhaven't used enough of either to say
04:18p_l|workhmm
04:19WokenFuryit's solid. I use it every day at work
04:19p_l|workwhat about stuff for Eclipse/IDEA? I have to use Eclipse for some of the projects at work anyway
04:19winkI'm actually using vim with vim-clojure right now
04:19WokenFurycounterclockwise then. think it's come a long way and has some paredit support now as well
04:19winkand using maybe 5% of the features besided highlighting
04:20winkI suck at productivity? :(
04:20winkp_l|work: try CCW, I found it really good actually
04:20p_l|workanother question: how is the debugging support, and debugging from IDE?
04:20p_l|workLast time I checked, it was "holy fuck stack salad"
04:20winkit's not that it does things so special there's a cost for learning :P
04:24WokenFurydon't know about CCW, but emacs has ritz now
04:24p_l|worklol
04:24WokenFuryhaven't tried it though. printlns have solved most of my problems...so far :)
04:25p_l|workthough truly, my clojure use will be very limited (I'm just investigating using it instead of java for a selenium test suite)
04:25p_l|workshouldn't hit debugging much :)
04:25WokenFurythen you'll be fine. our entire tech stack is clojure from the browser to devops automation :)
04:27ucbWokenFury: nice
04:27ucbp_l|work: you should check out (if you haven't yet) clj-webdriver
04:28p_l|workucb: I did :)
04:28p_l|workthat's why I'm considering clojure
04:28ucbheh, nice
04:28p_l|workotherwise I fear the code would make the guy coming after me to curse me :D
04:29p_l|workstill might
05:00bbloomi'm trying to learn how to use `lein deploy clojars`
05:00bbloomnot sure why i get all sorts of weird errors on this page: https://clojars.org/backtick
05:22Bergle_1anyone got an opionion if its worth getting Oreilly "Clojure Programming" if ive been through Pragmatics "Programming Clojure" and liked it?
05:23ucbBergle_1: I've not read it but in my experience I went from the pragmatic book to the joy of clojure and it turned out ok
05:23ucbi.e. I didn't bomb a shopping centre or anything like that
05:24Bergle_1heh uhm good hear, not sure i dont think im in that level of risk scenario
05:25ucbI'd go for it anyway
05:25ucbthere's always the web, irc and lots of practise :)
05:28augustlBergle_1: I would recommend Joy of Clojure, it's my favorite :)
05:29Bergle_1have you read the pragmatic one ?
05:30augustlI haven't
05:30augustlonly the two on manning
05:30Bergle_1k looking at joy of info
06:19p_l|workgah. Can someone explain to me why CounterClockWise doesn't support Java EE perspective, only Java and Plugin ones?
06:32jakubHbecause Clojure and Enterprise (in the bad meaning of it) are contradictions? :-)
06:32p_l|workha ha very punny
06:44ambrosebsIs it possible to (.setDynamic #'v) some var v that is in another namespace? Any downsides?
06:48foodooI want to add a local jar to the project's classpath using the leiningen localrepo plugin. I used the following command: lein localrepo install java-otr.jar ca.uwaterloo.crysp.otr/java-otr 0.1.0 #but after that, lein localrepo coords doesn't find java-otr.jar. What am I doing wrong?
06:55degStyle question: I want to pass a boolean parameter to a function, to cause it to perform an auxiliary action. (In my case, to graph or trace some results). Obviously, clojure is a lisp-1, so I need different names for the parameter and the function supplying the auxiliary action. What is the most accepted Clojure naming style for this?
06:57degMy first though is to write (defn my-fcn [... trace-results?] ... (when (trace-results? (trace-results)))) But, does the "?" prefix imply a function, rather than a boolean? If so, what is the common convention?
06:58ucbdeg: ? implies a predicate I'd say
06:59degRight. Oh, I had a typo above... Add ")" after the "trace-results?". As is, I really muddied my attempt.
06:59degucb: Is there a Clojure convention for naming boolean parameters?
07:00degAnd, please, no one suggest the Redmondian Hungarian bTraceResults. That would be so beyond wrong here. :-)
07:00winkb-trace-results *ducks*
07:01degYikes... I need some sleep. I miswrote my correction. Should have said "no '(' before" not what I said. Let's do this again (sorry folks).
07:01ambrosebswhy not ^boolean trace-results
07:01deg(defn my-fcn [... trace-results?] ... (when trace-results? (trace-results))))
07:02degambrosebs: That won't solve the naming clash with the function I'm calling.
07:02degTo my mind, this is the one weakness of lisp-1s.
07:03ambrosebsI'm too biased to lisp-1 to give a balanced view. But lisp-1's behaviour here seems much more pleasant :)
07:04ambrosebshow about namespace qualifying trace-results
07:05degambroseb: Agreed. I come from a CL background (years ago), but I still agree that lisp-1 is nicer for most thing. It's only in this kind of situation that a naming clash hits. Arguably, it's a problem of English, since we don't distinguish well between verbs and nouns.
07:06degNamespace would be overkill here. This is a helper function that, if not one-time-use, is certainly not going to be widely used. It's coupled with the function calling it. (do-something and trace-something-results).
07:07degIt could almost be an anonymous function (which would solve the problem nicely) but, because it is doing trace output, it is relatively long and ugly, and will read better at top-level.
07:07alexnixondeg: it's not answering your question, but provided you're docstring is insightful and your code clear, I wouldn't get too hung up on it
07:08degalexnixon: Sure. And there are a lot of easy answers like "do-trace-something" for the function. If I was in a rush to get the code out, sure. But, I'm using this project as a learning exercise to get the feel of Clojure, so I want to invest extra time into learning standard practices.
07:09alexnixonsure, and it's a good question :-)
07:10alexnixonyou could avoid the situation altogether with named parameters
07:10alexnixonalthough personally I find them a bit cumbersome
07:10ambrosebsdeg: if it's coupled with the function calling it, use letfn
07:12alexnixonambrosebs: bearing in mind that that prevents you from unit testing
07:13degambroseb: I don't understand your solution.
07:13ambrosebsdeg: also, giving an anonymous fn a name like (fn my-name [a b] ...) shows up in exceptions
07:13degambroseb: It seems like letfn leaves me with both problems. I have the name clash with the parameter and I've got more complexity nested in one textual scope.
07:14degalexnion: I don't understand your solution either. A named parameter would still give me the name clash, no? (or do I misunderstand what you mean?)
07:16alexnixon(defn foo [trace & {:as arg-map}] (if (:trace arg-map) (trace)))
07:17alexnixonthough I don't think it's idiomatic
07:17alexnixonpersonally I think a ? suffix is the best solution
07:17degalexnion: I think that fails, since it binds trace to the local.
07:18alexnixondeg: 'trace' is the tracing function, and (:trace args) is the boolean
07:18ucbdeg: so you have a fn called trace which when passed a boolean (potentially named trace) it should also trace?
07:19degalexnixon: I'm currently divided between param= trace-x?; fnc = trace-x or param=trace; fnc=do-trace. Neither is brilliant.
07:19alexnixondeg: I'd go for trace-x? and trace-x
07:19alexnixonI think it's clear
07:20degYes, except for ucb's very valid objections that trace? would normally be a predicate function.
07:20alexnixonwell in my mind, a predicate *should* have a ? suffix, but a ? suffix does not imply a predicate.
07:20degucb: Fcn named x gets parameter (maybe named trace-x?) and if true, calls fcn named trace-x
07:21alexnixonjust use a docstring and either is fine
07:21ucbdeg: if the fn is called x and the parameter is called trace-x where's the issue then? the use or not of ?
07:22degucb: (defn x [trace-x?] (when (trace-x? trace-x)) ...do-other-stuff..)
07:23ucbah, gotcha
07:23ucbhere's yet another poor name for trace-x?: should-trace-x
07:23alexnixondeg: you mean (defn x [trace-x?] (when trace-x? (trace-x)) ...do-other-stuff..)
07:23oddylads and gents, does someone have a couple of free minutes to help newbie? The question is regarding leiningen
07:24ucboddy: just ask :)
07:24degalexnixon: Yes. Did I typo and not write that?
07:24alexnixondeg: you were using trace-x? as a function
07:25degYes, I typo'd, sorry. Lack of sleep and a 15 year digression into C, C++, and Java.
07:25ucbregression you mean?
07:25oddyucb: running lein run gives Exception in thread "main" java.lang.ClassNotFoundException:
07:25ucboddy: difficult to diagnose without extra context
07:26degucb: Yes, 100% agreed. Before that, I was in CL for many years, in the Lisp Machine world.
07:26oddyucb: I know, I only started :) The project is https://github.com/zerg000000/mario-ai
07:26ucbdeg: :)
07:26ucboddy: sorry for being impatient :)
07:27oddyucb: Project is full Java except for an agent which is Clojure
07:27degoddy: Do you have a :main clause in your project.clj?
07:27ucbI see no project.clj
07:27oddydeg: yes
07:28oddyucb: https://github.com/zerg000000/mario-ai/tree/master/example/mario-ai-example-clj
07:29ucboddy: I've very little experience with creating classes and stuff from clojure, but you've no gen-class in core.clj
07:29oddydeg: it tries to compile main, but cannot find one of the imports, even though it physically there
07:29oddyucb: I don't even know what it is :)
07:30oddyucb: I only started with Clojure, and Leiningen is totally alien to me so far :)
07:30ucb:)
07:31ucblunch - biab
07:31oddyucb: Enjoy!
07:31ucbta
07:31antares_oddy: add (:gen-class) to the namespace you intend to be runnable, like so (ns my.service (:gen-class)), this will cause Clojure compiler to generate .class file ahead of time that leiningen or java -jar can use to start your program.
07:32oddyantares_: will try right now
07:32antares_oddy: gen-class and runnable namespaces are mentioned in the Leiningen tutorial: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md
07:34oddyantares_: Yes. I just wanted to run the agent. My intention was just to look at how it works :) Trying it
07:34antares_oddy: then why not use lein repl?
07:34oddyantares_: I.e. yes, my fault I didn't read carefully
07:35antares_oddy: agents are covered with examples in http://clojure-doc.org/articles/language/concurrency_and_parallelism.html
07:35antares_oddy: http://clojure-doc.org is your friend, use it
07:35degucb: (if you see this when back from lunch). Thanks for the should- idea above. Perhaps no more idiomatic than my other two ideas, but I like it better.
07:36oddyantares_: because I never used repls before (except for IPython for some time, but that doesn't count)
07:36antares_oddy: REPL is much easier to use than creating and running one-off programs :)
07:38Mr_Bond`lein run` is nice for running one-off problems as well, when you are done testing code in `lein repl` :)
07:38maleghastHello All :-)
07:39oddyantares_: same thing. My runable (class defined in :main) has now this definition: ns mario-ai-example-clj.core (:gen-class)
07:39oddyantares_: runing lein run gives the same
07:40antares_oddy: can you paste full trace of java.lang.ClassNotFoundException?
07:41oddyantares_: sure. D:\Development\Home\Projects\ai-mario\mario-ai\example\mario-ai-example-clj>lein
07:41oddy run -ag example.agents.ForwardJumpingAgent
07:41oddyCompiling mario-ai-example-clj.core
07:41oddy[~ Mario AI Benchmark ~ 0.1.9]
07:41oddyException in thread "main" java.lang.ClassNotFoundException: example.agents.Forw
07:41oddyardJumpingAgent, compiling:(mario_ai_example_clj/core.clj:7)
07:41antares_oddy: any particular reasons why you use that repository? it seems to be full of pretty weird code
07:42oddyantares_: it's not mine github :)
07:42antares_oddy: yes but to try out agents you can just open the repl in a completely fresh Leiningen project
07:42oddyantares_: I really don't know why the guy does not use local jars
07:43si14is there any way to evaluate stuff from nrepl in *nrepl* buffer?
07:43oddyantares_: I'll try. What should I do except for `lein repl`? %-)
07:43si14I would really like to get evaluated form and it's result there instead of echo area
07:44antares_oddy: nothing, lein repl and then enter some code and hit enter
07:44antares_oddy: you can start with (+ 1 2 3 4 5), for example
07:44maleghastHas anyone in here had occasion to use SpyGlass (Clojurewerkz memcached library)?
07:45antares_maleghast: I am the author of Spyglass, so yes
07:46maleghastantares_: Oh cool - I never know who anyone is in these IRC rooms… Thanks for putting your hand up :-)
07:46oddyantares_: Ah, no, agents are quite leghty. I'm new to Clojure itself and thus trying lengthy Clojure scripts in repl which extend and implement various interfaces and base classes is not gonna work for me %-)
07:47FoxboronNewb question, whats the right way of assigning anothers var's value to a var?
07:47Foxboronwould it be with def?
07:48pyrare there any gotchas for protocols in clojurescript ?
07:49pyrgiven this simple ns which works in plain clojure: https://gist.github.com/4131010
07:49maleghastI'm pretty new to Clojure and I'm certainly new to using it "in anger" but I am building a prototype at the moment, and I have run into two issues (with my implementation of it I am sure) with SpyGlass that I've as yet had no joy in unravelling… The first is: How do I get spyglass to stop trying to connect to a server when it's tried and failed? The second is: I need my code to try to connect and then either use the cache + DB for uncached / expired or
07:49maleghastthe DB if the cache is absent. How would you achieve that, and for a bonus point, how would you implement a mechanism to check back in case the cache has come back up?
07:49maleghastantares_: Sorry, took a while to type this ^^
07:50antares_maleghast: I will need to take a look at Spymemcached to answer the first part. As for the second, I'd probably implement core.cache and use that. There are examples in Monger and Welle.
07:51pyrah it seems reify doesn't exist in cljscript
07:52antares_maleghast: this is what it takes to implement core.cache on top of mongodb, should be even less code with spyglass and memcached: https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/cache.clj
07:52pyrso no reify means doing a defrecord and wrapping that in defn + let
07:53maleghastantares_: Thanks, that's a great place for me to start :-) I appreciate it :-)
07:53antares_maleghast: if you give me a few hours, I will finish something and then implement core.cache in Spyglass
07:53antares_it's pretty trivial
07:53maleghastWow, that would be awesome
07:53maleghast:-)
07:53antares_looking at how to limit reconnection attempts right now
07:54oddyantares_: Wow, something new now: Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to
07:54oddy create ISeq from: clojure.lang.Keyword
07:54antares_oddy: in the REPL?
07:54antares_oddy: in a new project?
07:54oddyantares_: that's after I added :gen-class, no, `lein run`
07:55antares_oddy: it means that the (ns …) macro is misused, can you paste the exact code? (only the ns part)
07:56oddyantares_: ns mario-ai-example-clj.core :gen-class
07:56oddyantares_: bracets, I c
07:56maleghast(OT) This is weird, I don't seem to be able to set myself to "away"… Anyway, I'll be gone for a bit *waves*
07:57antares_maleghast: ok, I found it, there is a way to make Spyglass retry, redistribute attempts across other servers or cancel operations
07:57firesofmayHi, How do I make the nrepl to always start paredit mode? in Emacs 24
07:57antares_maleghast: that will also need a small feature added to spyglass if you want to avoid direct Java interop
07:57maleghastantares_: That got my attention, was about to go and buy lunch
07:57antares_oddy: can you paste it exactly to gist.github.com please?
07:58antares_maleghast: no problem, bon appétit
07:58maleghastantares_: If you are prepared to make the mod, I would love having it without Java InterOp; thanks :-)
07:58antares_maleghast: all in all it is maybe 40 minutes of work this evening
07:58maleghastantares_: à bientôt
07:59oddyantares_: https://gist.github.com/4131055
07:59foodoohas anyone here worked with lein-localrepo before? Does the .jar file have to have anything special in it?
08:01antares_oddy: ok, that looks fine
08:02oddyantares_: but it still complains on ClassNotFoundException: example.agents.ForwardJumpingAgent
08:03antares_oddy: that class needs to be compiled, too
08:03oddyantares_: which is defined in another script
08:03oddyantares_: can I compile whole stuff at once? :)
08:04oddyantares_: or is there a way I can use repl?
08:04antares_by adding :aot [mario-ai-example-clj.agents]
08:04antares_:aot :all if I remember correctly
08:04antares_that repo uses non-standard source layout, it wasn't supposed to be used as a runnable app as far as I can see
08:04antares_only loaded from the REPL
08:05oddyantares_: project has aot
08:05antares_but what is listed for AOT?
08:05oddyantares_: :aot [mario-ai-example-clj.agents]
08:05antares_oddy: does lein compile succeed?
08:06antares_oddy: I am trying that repo here
08:06oddyantares_: No. Complains on missing class
08:06oddyantares_: I'm using lein 2.0 preview10
08:07oddyantares_: If that matters at all %)
08:23FoxboronSo i got a loop-recur, i want the varible a's value to replace b's value. Tried let and def, nothing works so far.
08:25antares_oddy: ok, so it looks like it first tries to compile :main namespace
08:25antares_oddy: if you comment out :main, run lein compile, then comment it back in and run lein run, it works
08:26antares_Foxboron: post your code to gist.github.com or something
08:27oddyantares_: Cool! I'll try that right now. Is there a normal way of making that work? :) I.e. is there a way to compile sources and then run as opposed to compile-first-file-run-see-what-happens?
08:27antares_Foxboron: "replacing" variables is exactly what you don't generally do in Clojure but with locals can do that
08:28antares_oddy: it seems to be the issue with that project's non-standard source layout
08:29oddyantares_: hmmm... I'll take a closer look at an official doc as you've suggested and try to follow official prescriptions.
08:29Foxboronantares_, hard getting used to functional programming <.<
08:29oddyantares_: btw, I have an error again %)
08:30oddyantares_: another one
08:30antares_oddy: I am working on a fix
08:30Foxboronantares_ http://hastebin.com/yehitudiwo.lisp
08:30FoxboronBasic fib sequence, (fib 10) prints the 10 first numbers.
08:30oddyantares_: Exception in thread "main" java.lang.NullPointerException
08:30oddy at ch.idsia.tools.MarioAIOptions.setArgs(MarioAIOptions.java:89)
08:31antares_Foxboron: you can use an atom and mutate it very similarly to how you reassign variables. http://clojure-doc.org/articles/language/concurrency_and_parallelism.html#atoms
08:31antares_oddy: well, that's something from their Java code
08:31Foxboronantares_, i have yeat to actually use or read about them. Can look at them tho.
08:31Foxboronyet*
08:32oddyantares_: Hmmm... Strange, I can run java just fine. And tests run as well. have you managed to run the code locally?
08:32antares_Foxboron: you are on the right path but I don't understand the intent on line 6 and what "rang" is for
08:32oddyantares_: I've submitted an issue to that project for zerg000000, jsut in case
08:33Foxboronantares_, hah. Because i forgot an if there :P rang is x, and c counts how many steps we have taken. when (= rang c) we stop the loop.
08:33Foxboronbut i actually forgot the if, so yeah....
08:35antares_oddy: now I am getting the same null pointer as you do
08:35oddyantares_: :D
08:35antares_oddy: it may be an issue in Leiningen when it tries to first compile the :main namespace even though you want the opposite order
08:35hugodWould anyone have a set of emacs indentation rules for core.logic?
08:36oddyantares_: mate, I don't want to waste your time on it. I'm really gratefull you've pointed where to look (project config). It's night here, I'll take a fresh look at it tomorrow. Thanks you!
08:37antares_oddy: good night
09:05p_l|workhmmm... nrepl might make me pick up clojure again for serious use
09:09winkgood luck!
09:14gfredericksdangit it didn't work
09:14gfrederickswell it probably upgraded all the things but it is still an older emacs
10:00gfredericksis IFn a special case in cljs? it seems (extend-type js/Number IFn ...) doesn't work?
10:00gfrederickswell I mean the extend-type call seems to go okay but (8) still emits 8.call(null)
10:01winkcan you work with IFn in proper clojure code? I've always just noticed it in errors :P
10:02gfredericksyeah you can make a type that implements IFn
10:02gfrederickswhat you can't do in clj-proper is extend IFn to existing types, because it's not a protocol it's an interface
10:02gfredericksin cljs it's actually a protocol but I'm thinking you still can't use it all the time
10:08AnderkentIn Midje, how can I specify that a function should be called with an argument that matches some check?
10:41tomojhttps://www.refheap.com/paste/38243d70af02f0a6816f694ab .. interesting, clojure.test/are seems unhygienic
10:42tomojI guess the do-template args should be replaced by gensyms?
10:46iosicaNeed some macros help ppl
10:46iosicaI'm trying to write a clojure wrapper around apache crunch http://incubator.apache.org/crunch/
10:46iosicathis is how I want the classical word count example to look like https://gist.github.com/4090665 or the average bytes by ip log parser https://gist.github.com/4090665
10:46iosicahere mem-pipeline is a macros transforming the body into a sequence of java calls
10:47iosicaproblem I'm having is with parallelDo it translates to java call PCollection.parallelDo
10:48iosicataking 2 params: a function and a type T
10:48ivenkysfolks - anyone here using La-Clojure (IDEA clojure plugin) - how do you set breakpoints in clojure scripts ? (latest version of IDEA)
10:48iosicanow T can have 2 values A or B
10:49iosicaso it should be (parallelDo function A) or (parallelDo function B)
10:50ivenkysfailing - LaClojure + IDEA - any other preferred way of debugging clojure apps ?
10:52iosicanow I want my macros to decide if it's A or B depending on first param to parallelDo
10:53iosicaif function returns a vector of 2 elements I want value to be A otherwise B
10:53thorwiliosica: what's the range of possibilities for the first param?
10:54iosicais this possible?
10:54iosicaany fn
10:55thorwili think you have to call an fn to get to know what it returns
10:55tomojcurious, you only use two PTableTypes? what are they?
10:56iosicaPType and PTableType
10:56iosicaonly one PTableType
10:56tomojoh, I see
10:57iosicaso I need to decide if it's a PType or a PTableType
10:57tomojwhy not make different names for the two different parallelDo calls?
10:58iosicabecause parallelDo here is not a clojure method
10:58iosicait's amethod on a java class
10:58iosicanot under my control
10:58tomojI mean make two different names for yourself, maybe:
10:58iosicaI'm translating it directly to .parallelDo func type
10:59iosicaparallelDoAsTable ?
10:59iosicaand parallelDoAsNotTable
11:00tomojpmap / pmap-kv ?
11:00tomojhard for me to tell what those parallelDo actually do
11:00iosicait's possible with different names but I want to ake that decision out from the user
11:01iosicamainly because this is an internal thing in crunch
11:01iosicaclojure users would have no idea which one to use
11:01tomojthere is no way to determine whether an arbitrary function will return a vector pair
11:01iosicaI have another criteria I could use
11:01iosicamaybe that one is possible
11:01tomojthe only other option I can think of is to annotate the function or var with metadata
11:02tomojbut that still requires the user to make the choice when defining the function
11:02iosicayep
11:02iosicain this example
11:02iosicahttps://gist.github.com/4091142
11:02iosicaparallelDo groupdByKey combineValues are methods on java classes
11:03iosicaPCollection and PTable (extends PColelction)
11:03iosicaso in theory I could use the next method to decide if this parallelDo needs to return a type or a table type
11:04tomoje.g. if it's groupByKey, table type?
11:04iosicaand specifically if this is a method on PColleciton -> ptype else if this is a method on PTable -> table type
11:04iosicayes
11:04tomojseems like the user ought to know whether it's a table, to me
11:04tomojbut I don't know crunch
11:06tomojwhat if you want a PTable, but you call some PCollection method first (since PTable extends PCollection) and then some PTable method second?
11:06iosicayep it's not that simple
11:07iosicaI'd have to carry the state somehow from the bottom up
11:07iosicastate means is it type or tabletype
11:10iosicahere in readme is how I have it working now
11:10iosicahttps://github.com/viacoban/crackle
11:10iosicanot the most fluent dsl
11:38Anderkentgah. Anyone got any code coverage tool to work with clojure? JaCoCo 'almost' works, except it outputs *a lot* of noise like missing branches that don't exist... And the line number support is not that good ;/
11:47ambrosebsIn CLJS: I want to implicitly load another CLJS namespace when I `:require-macros` a specific Clojure namespace. Ideas?
11:47ambrosebsload = :require
11:48gfredericksah because the macros should expand to calls to some other hidden ns?
11:48ambrosebsYes.
11:48ambrosebsI might be stuck with just needing an extra :require in the `ns` declaration
11:48gfredericksthat's certainly the easiest thing
11:49gfredericksmight be able to call into the compiler from the macro namespace? but that'd be terribly ugly.
11:50ambrosebsThat's possibly the only other option.
11:50gfredericksthe whole macros-in-clj thing makes everything a bit awkward :/
11:51tomojhmm
11:51ambrosebsIt's kinda useful in my situation. I'm calling Typed Clojure (written in Clojure) via CLJS's macros.
11:51ambrosebs... to check CLJS code
11:51tomoj(ana/analyze-deps '(your/ns)) ?
11:52tomojcouldn't be that easy..
11:52ambrosebstomoj: that sounds about right?
11:52tomojso since (I assume) you will fully qualify in the macro, you just need the file to have been analyzed?
11:54ambrosebsI want to properly :require the internal CLJS namespace.
11:54noididoes cljs have the plain `require` function? you could have your macro inject the `require` call into the generated code.
11:54gfredericksI'm 98% sure it doesn't
11:54ambrosebsnoidi: no
11:54gfredericksit handles the ns form as a very-special case
11:55niclhey all, I'm developing an API using compojure and connecting to a mongodb database. Just wondering if there is an existing config library/solution so that I can store db connection info for dev/prod and use the correct one automatically (based on some kind of environment setting). If something doesn't exist, any tips on how to do this (in particular how I can distinguish between prod and dev environments automatically)
11:55tomojyou want the analysis output of your macro-using namespace to show the require?
11:55tomojwhat other effect of require would there be besides having it analyzed?
11:56nicl- in PHP I would set an env variable using apache. But what are my options for clojure?
11:56weavejesternicl: Environment variables are a solution used in a lot of applications
11:56tomojif you really want the analysis output to show the require, I think you will have to patch the analyzer..
11:57noidinicl, this library was announced recently on the mailing list https://github.com/sonian/carica
11:57weavejesternicl: As they're very universal - most languages and most OSes support them
11:58tomojoh, of course you want the dep
11:58niclweavejester: ok thanks, will investigate
11:58tomojotherwise the code won't get included :)
11:58ambrosebstomoj: Just looking through, I think I really want cljs.compiler/compile-file
11:58niclnoidi: thanks - will check it out
11:58ambrosebsanalyze doesn't emit :)
11:58noidire: different configs for different environments: I'd have one master configuration file with env-specific settings marked with placeholders
11:58noidithen you can generate env-specific configuration files as a part of the build process
11:59noidigradle makes that trivial, don't know how to do that with leiningen, though
12:00tomoj(swap! ana/namespaces update-in [*cljs-ns* :requires] conj 'your/ns) ?
12:00niclnoidi: ah ok, so you'd run something like 'lein build prod' / 'lein build dev' (just as an example)
12:00noidiyeah
12:00niclnoidi: and the process would then update/insert the correct config
12:01tomojwould be very odd to emit in your macro I'd think
12:01tomojdunno about the format for the require either, it's probably not 'your/ns
12:01ambrosebstomoj: no, my thinking is that :require-macros loads the CLJ file, so just put a call to the CLJS `compile-file` in that CLJ ns
12:02gfredericksambrosebs: only loads it the first time probably
12:02tomojbut how will that js get included in the final output?
12:03ambrosebsI'm completely new to CLJS. So deps *must* be in the `ns` form?
12:03tomojI don't understand the compiler/analyzer all too well myself, but, yes
12:04ambrosebsI understand the compiler much better than the lang, but I didn't notice that.
12:04ambrosebsHmm, that's easy then, no choice but an extra dep.
12:05tomojwell, no
12:05antares_maleghast: hey
12:05tomoj(swap! ana/namespaces update-in [*cljs-ns* :requires] assoc 'your/ns 'your/ns)
12:05tomojer, ana/*cljs-ns*
12:05gfredericksI don't think he wants to emit js, I think he just wants to throw if the type-check fails?
12:05gfredericksu.
12:05gfredericks~ping
12:05clojurebotPONG!
12:05tomojI think that should work
12:06tomojobviously not a great solution since if the cljs compiler changes it could break
12:06tomojbut note that e.g. the binding macro in cljs does this kind of thing
12:06ambrosebsI'll explain my use case
12:06tomojer, no, I guess it doesn't
12:08tomojmacro expands to call to internal cljs function, right? so in the macro, do the swap! above, and the calling ns gets the internal ns added to its requires
12:08tomojoh and you also need to analyze the file..
12:09tomojwhich the ana/analyze-deps bit above should do?
12:09noidiambrosebs, seeing you here reminded me to finally give Typed Clojure a try! I'm very excited about the project, thanks so much for working on it :)
12:10ambrosebstomoj: Ok, that sounds kinda reasonable.
12:10ambrosebsnoidi: :)
12:11tomojthen when the compiler emits the analyzed code, it will follow the :requires and compile your internal ns
12:12ambrosebstomoj: ah got it.
12:13tomojthe analyzer could maybe be refactored a bit to provide ana/require for macro use
12:14ambrosebstomoj: makes sense. It's just the side effect which is important, not the `ns`, which I'm just realising :)
12:15AnderkentAnyone knows why clojure produces unreachable bytecode for functions? See https://gist.github.com/4119799
12:16ambrosebsI was also playing around with changing the `ana/specials` to stop macroexpansion. It's kinda useful, but you do have to make sure you analyze the children correctly
12:16ambrosebsI was excited to use `ana/specials`, but perhaps it isn't as useful as I thought.
12:16ambrosebsThe wrapper macros were my second option.
12:18tomojoh, I see what you meant by "use case"
12:19ambrosebslol I didn't end up explaining cos you already knew.
12:41ambrosebsnoidi: let me know how you go playing with Typed Clojure. Feedback has been sparse.
12:42tomojI didn't take the time to understand it yet
12:42maleghastantares_: Hey there, how did you get on today.?
12:42ambrosebsHopefully my conj talk will get ppl started
12:42tomojbut I just realized I'm struggling somewhat with the lack of a type system
12:42tomojslides available? couldn't find them
12:43maleghastambrosebs: can you paste a link to your github repo for this, please?
12:43ambrosebshttps://github.com/downloads/frenchy64/papers/conj%20main%20talk.pdf
12:43maleghastambrosebs: Thx :-)
12:44ambrosebsTyped Clojure is at https://github.com/frenchy64/typed-clojure
12:44ambrosebsThere is an honours dissertation also if you're so inclined.
12:45noidiambrosebs, will do
12:45ambrosebsnoidi: cheers
12:45tomojoh! I was playing with analyze. I wonder if it's easy to include the original :form like the cljs analyzer?
12:45maleghastambrosebs: Possibly, but I'm struggling with limited time and brane-power at the moment, between my day-job and my 12 week old son and my 18 month old daughter… ;-)
12:45tomojbbloom's cps on analyzer output is nice, but I'm in clojure right now so I'm writing an old-school macro :/
12:45ambrosebstomoj: I can't do anything past what the Clojure compiler does.
12:46ambrosebsso I'd have to reverse engineer analysis to emit a form
12:46ambrosebstoo much work for me, but I'd accept a patch.
12:46tomojI see
12:47noidiambrosebs, typed clojure doesn't seem to like nrepl/counterclockwise.
12:47noidi=> (require '[typed.core :refer [ann]])
12:47noidiCompilerException java.lang.AssertionError: Assert failed: (FilterSet? %), compiling:(core.clj:1992:19)
12:48tomojI hope it won't be all that long before we are somewhat liberated from Compiler.java
12:48ambrosebsnoidi: thx, having a look
12:48ambrosebstomoj: amen
12:48noididoing the same in a plain repl seems to work fine
12:48tomojwe can make analysis better before doing full c-in-c maybe?
12:48noidithis is with typed 0.1.2
12:49ambrosebsnoidi: can you paste the stack trace?
12:49ambrosebstomoj: But don't we all just want CLJS analysis? :-)
12:51tomojreally I do :). but I'm working in clojure for a bit because it's easier, and eventually I want to cross over
12:51noidiambrosebs, https://www.refheap.com/paste/6921
12:51noidiI'll upgrade to the latest CCW beta to see if it makes any difference
12:55ambrosebsnoidi: I might cut a new SNAPSHOT, give me a few minutes
12:56ambrosebsI have no idea what's causing that error :)
12:58ambrosebsIf it still happens, print a (clojure.repl/pst 1000) or equivalent
12:58noidiambrosebs, it's probably a CCW issue
12:59noidiwhen I connect to an Nrepl started from Leiningen, it works
12:59ambrosebsinteresting
12:59noidibut it fails when I try it in a REPL started from CCW
13:01noidihere's the output of (pst 1000) https://www.refheap.com/paste/6922
13:05ambrosebsI really want the second exception, but I forget how to print it.
13:05ambrosebsor maybe that's it?
13:07noidiI think that's it
13:08ambrosebsGreat.
13:09ambrosebsclojure.repl/root-cause was what I was thinking of.
13:10ambrosebsCould you add the first TC issue? :) https://github.com/frenchy64/typed-clojure/issues
13:11antares_maleghast: quick question, so being able to control handling of down servers and core.cache implementation is all you need in Spyglass?
13:11maleghastYeah
13:11noidiambrosebs, sure
13:12maleghastsorry, antares_ Yeah that's what I am in need of
13:12antares_maleghast: ok
13:12maleghastantares_: Thanks :-)
13:16augustl2are there any XML parsers out there that parses to a hiccup like data structure?
13:26ambrosebsnoidi: cheers
13:27acagle /flush
13:31ambrosebstime for sleep actually.
13:31noidigood night!
13:33noidiI'll post about the issue to the ccw-users mailing list
13:34noidias it only appears in a CCW REPL
13:51winkhm, how do I create a lazy seq that repeats nil nil <arg>" or something?
13:51gfrederickswat
13:51gfredericksyou want (nil nil arg nil nil arg nil nil arg ...)?
13:51winkyes
13:52gfredericks,(take 20 (cycle [nil nil :arg]))
13:52clojurebot(nil nil :arg nil nil ...)
13:52winkcycle... doh. thanks :)
13:52winkwas trying interleave and take
13:55raek,(take 20 (interleave (repeat nil) (repeat nil) (repeat :arg))) ; you can of course do it with interleave too...
13:55clojurebot(nil nil :arg nil nil ...)
13:56gfredericks(apply interleave (map repeat [nil nil :arg]))
14:23Sgeo_In Lamina, is there a way to have a callback get called when a channel is grounded?
14:23Sgeo_As in, when something calls ground on the channel, I want to know about it
14:24Sgeo_Not even entirely sure of the difference between ground and close
14:32raekSgeo_: when you ground a channel you make sure that elements won't build up in it (presumably the elements are being processed in forks of the channel)
14:34bbloomtomoj: my cps transform isn't quite finished yet…. it was delayed while i got some changes into the cljs codebase, but now i need to get the energy back together to finish it
14:35raek(let [c (...)] (receive-all (fork c) processor-a) (receive-all (fork c) processor-b) (ground c))
14:35raekhere both processors can consume all the elements in their own pace
14:35Sgeo_Wait, why can't you just ground c and do receive-all on c?
14:36raekif you only had one processor, you could just (let [c (...)] (receive-all c))
14:36raek(receive-all c processor)
14:36Sgeo_And the reason I want to know if a channel is grounded is because I want to disconnect from an underlying event-based SDK
14:37raekto me that sounds like something that you would do when it is closed
14:37Sgeo_Ah, ok
14:37raek(i.e. no processors are interested in the values)
14:38Sgeo_Can a processor in receive-all somehow decide it's not interested anymore?
14:38raekbut I don't know how close and fork work together
14:38raekI assumed that that's what close does (you let it close its fork)
14:38Sgeo_Ah
14:38Sgeo_Ok
14:39RaynesHappy Thanksgiving USAians.
14:39raek'seal' closes the producing end, 'close' closes the consuming end
14:39raekI think
14:39RaynesUSA! USA! TURkEY! TURKEY!
14:39gfredericksRaynes: that's an odd pair of countries to cheer for
14:39raekI think the first example could have been written like (let [c (...)] (receive-all (fork c) processor-a) (receive-all c processor-b))
14:40danlarkinSgeo_: isn't there an on-grounded function?
14:40danlarkinI think there is
14:40Sgeo_I should probably actually read the API docs
14:40Sgeo_Rather than just the intro stuff
14:40raekSgeo_: have you seen this? https://github.com/ztellman/lamina/wiki/Channels-new
14:40Sgeo_raek, that's what I meant by intro docs
14:40Sgeo_Admittedly, I sort of skimmed it
14:41danlarkinoh I think I was wrong
14:41danlarkinthere's on-closed, on-error and on-drained
14:42raekhrm, I don't find any 'seal' function...
14:42Sgeo_Hmm, a processor closing its channel might not be that helpful if there's still stuff remaining in that channel
14:42raekmaybe I just imagined it
14:42Sgeo_But I think I want on-closed
14:42danlarkinraek: seal was around in 0.2.x
14:43raeknow there seems to be a 'drained?' predicate and a 'on-drain' function
14:43Sgeo_I don't know if I should provide a more direct API and then just layer Lamina on top of that, or provide access only via Lamina.
14:44danlarkinSgeo_: provide where?
14:44Sgeo_danlarkin, to users of my wrapper
14:44Sgeo_(Which will likely be only me, but whatever)
14:44danlarkinwhat is your wrapper
14:45Sgeo_It's for bots for http://virtualparadise.org/
14:53thorwiloriginally i had an "Could not locate tlog/test/data/account__init.class or tlog/test/data/account.clj on classpath" on "lein midje"
14:53thorwilfixed that with :test-path in my project.clj
14:54thorwilbut now: All claimed facts (0) have been confirmed.
14:54thorwili claimed 3 facts. or at least i'm attempting to!?
14:59wink,(map (fn [coll] (drop 3 coll)) '(1 2 3 4 5 6))
14:59clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
14:59winkwhy doesn't that work?
14:59gfrederickscoll is a number
14:59gfredericksif you map over a list of numbers, your map function should expect a number as its argument
15:00winkdoh. I think I should stop for today
15:00winkI actually have no clue how I managed ot work o_O
15:08konr_trabIs there a more elegant way to get the element where foo == 2 in [{:foo 1}{:foo 2}{:foo 3}] than (->> [{:foo 1}{:foo 2}{:foo 3}] (filter #(= (:foo %) 2)) first)?
15:09gfredericksnot really; you can replace the anon fn with (comp #{2} :foo) if you like that better
15:09gfredericksbut find-first is one of the more common not-in-core functions probably
15:23gfredericksI just noticed that in cljs (= (type "foo") (type :foo) (type 'foo))
15:30simardhow do you split the content of a string intro a list of its s-expressions ? something like clojure.string/split-lines but for s-expressions
15:31gfredericks,(let [my-string "foo bar (some s-expression)"] (read-string (str "[" my-string "]")))
15:31clojurebot[foo bar (some s-expression)]
15:33Raynesgfredericks: NaN
15:34gfredericksRaynes: I can't argue with that
15:34simardok I meant, how do you split a string into a list of string representation of its s-expressions
15:34gfredericksoh hm.
15:34simardi.e.: ["foo" "bar" "(some s-expression)"]
15:34gfrederickswell a hacky way is to map that back to pr-str
15:35simardthat would also kindly eliminate comments and stuff.
15:35gfredericksthat would take care of comments and things, but also (by default) lose metadata and reader macro stuff
15:35simardof btw Raynes, I'm using Clojail in my game project, so thank you for that
15:36simardoh*
15:36gfrederickswhich may be fine for your purposes
15:36Rayneso/
15:39xeqisimard: what game?
15:40simarda little project of mine, it's not out yet.. it's a 3d game that happens in a space setting
15:40simardmultiplayer and all that stuff.
15:40simardnothing really, I'm just having fun.
15:45tomojhmm https://www.refheap.com/paste/0c2610aa6554fc7cfc91db9a4
16:01simardwhat is the dual of merge for a map ? assoc and dissoc could work, but they expect a list and not a map, so I have to use apply and would like to avoid that.
16:02danlarkinsimard: please give an example
16:02gfredericks+1
16:03brehautgfredericks: s/+1/inc/
16:03gfredericks(dec brehaut)
16:03lazybot⇒ 6
16:04simardyeah, I understand why it wouldn't make much sense for a function like that to exist now. but here: (unmerge {:KEY_A 1, :KEY_B 2} {:KEY_B 2, KEY_C 5}) -> {:KEY_A 1}
16:04simardbasically, a map is not needed, only keywords
16:04simardbut.. I'm dealing with maps right now, and I want to do map A - map B
16:04gfrederickswell it's easy enough to define it
16:04gfredericks(defn unmerge [m1 m2] (apply dissoc m1 (keys m2)))
16:05simardand so now I can use unmerge with (swap! unmerge B)
16:07gfredericks(swap! an-atom unmerge B) yes
16:07simardyes
16:09bbloomdnolen: was just tidying up my github "inbox" and since you had made me a contributor, you get to benefit from my OCD need to drive counts to zero :-)
16:39alex_baranoskyanyone know where all of the print-method method definitions are?
16:41alex_baranoskythe multi-method is defined in core here, https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3298, … I wanted to see the code for how maps get printed
16:43gfredericks,(doc print-method)
16:43clojurebot"; "
16:44gfrederickswhat the heck are the args for print-method
16:44alex_baranoskyfound it: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj
16:45alex_baranoskygfredericks: args -> [x writer]
17:24jodaroclojure.core.memoize memo-ttl ftw
17:35Sgeo_Lamina does not seem to be thoroughly documented
17:44sporkballThis seems like a silly question, but how do you shut down the Netty server you've created when using aleph?
17:47Sgeo_(namespace/import-macro namespace/import-macro)
17:47mpenetsporkball: the fn you used to lauch the server returns a shutdown fn
17:47mpenetlaunch*
17:48FoxboronAny Clojure conj vids up yet?
17:48Bronsatoo early i think
17:49sporkballmpenet: Hm… I saw that in the unit tests, but then I swear yesterday I tried it and when I tried to restart it complained about the socket being in use… but today it seems like it works. Thanks!
17:49tufflaxjodaro, i started reading about memo-ttl, but what is "unk"? "Unlike many of the other unk memoization functions..."
17:49tufflaxFoxboron, some respectable person, i forgot who, said wait til june for conj vids
17:49tufflax:p
17:50sporkballmpenet: Must of have been doing something wrong yesterday (it was late, blah, etc.)
17:50Foxborontufflax, june D:?!
17:50mpenetsporkball: possibly a bug, it was broken a couple of month, and it went through a major rewrite recently
17:50tufflaxyeah :p I dunno why but, apparently it will take a long time :P
17:50mpenetsporkball: a couple of months *ago*
17:51Bronsawtf.
17:51Bronsa6 months?
17:52tufflaxWe can only hope that it was an hyperbole
17:54tufflax"Seriously it will take a long time" i can remember him saying
17:55Foxborontufflax, for next Clojure Conj someone should just sneaky record everything and put it up asap. Then we don't have to wait ._.
17:55tufflaxyeah :P
17:55tufflaxI love me some clojure talks
17:56wingyi have been having these thoughts about testing all the time .. perhaps running the code in production is the best test?
17:56sporkballmpenet: more than likely it was me… I was having a pretty brain-free day yesterday. Love Aleph, though -- helluva lot nicer than working with raw sockets
17:57wingyah nvm
18:07mpenetsporkball: I mostly use it as an http client/server and redis client, it's a lovely lib as you say
18:08sporkballmpenet: Was just looking at your Ash IRC bot… I'm working on creating an IRC server, and using aleph to power the TCP server.
18:09mpenetsporkball: sounds interesting
18:10mpenetsporkball: I didn't want to rewrite an irc client from scratch, I just use a fairly popular java client and build on it
18:10mpenetsporkball: and so far it has worked fine. It is really simple (not a lot of code)
18:11sporkballmpenet: Honestly I'm doing it as a "get up to speed in Clojure" project more than anything. I'm interested in actually using it for some projects, too, but I thought it would be a fun project to tackle.
18:11mpenetsporkball: yes I understand that
18:11mpenetsporkball: good way to learn gloss as well
18:11mpenetsorenmacbeth: if that's the route you chose to take
18:12sporkballmpenet: Indeed. Gloss seems pretty great.
18:12mpenetdamn fingers
18:12mpenetsporkball: it is
18:13mpenetsporkball: ztellman has produced some amazing libs, Lamina is worth some interest as well, you probably know bits of it because of Aleph already
18:38wingyanyone having issues with "Unsupported escape character" errors
18:40ucbI'm guessing that there aren't still any tutorials/howtos on debugging with ritz?
18:42alex_baranoskyanyone know how can I do fast batch updates using Korma or clojure.java.jdbc?
18:47ucbugh, nrepl-ritz is megaslow for me, has anybody else found this? I'm on OS X 10.7.x
18:47mammothI think I know now what was bothering me about parenthesis and have come to a solution that won't give you guys heart attack.
18:48mammothfor example if we have this
18:48mammoth(defn as-string [date]
18:48mammoth (let [y (year-from date)
18:48mammoth m (month-from date)
18:48mammoth d (day-from date)]
18:48mammoth (str-join "-" [y m d])))
18:49mammothi would format it as this
18:49mammoth
18:49mammoth(defn as-string [date]
18:49mammoth (let [ y (year-from date)
18:49mammoth m (month-from date)
18:49mammoth d (day-from date) ]
18:49mammoth (str-join "-" [y m d]) ))
18:49p_lugly
18:50mammoththe idea is to add whitespace to closing parens that are not opened in the same line. That makes it a little easier to tell what's what without wasting more lines
18:52Foxboronthat just gives the whole block of code a unatural look
18:52Foxboronatm, my eyes are grouping the str-join line together with the let.
18:52Foxboronwhich is not ideal
18:52Foxboron<- personal opinion
18:53wingyim getting: "java.lang.RuntimeException: Unsupported escape character: \g" has anyone else stumbled upon this error?
18:53alex_baranoskymammoth: please take this well, but… just get used to it.
18:54alex_baranoskymaybe that didn't come out right… But I mean eventually none of that stuff matters, you'll just find it a non-issue eventually
18:54p_lmammoth: had it been CL, I'd tell you to just not look at parens, but at indentation, but I don't know how well it will fly with clojure's syntax sugar
18:55mammothokay, bigger tab size
18:55mammoth
18:55mammoth(defn as-string [date]
18:55mammoth (let [ y (year-from date)
18:55mammoth m (month-from date)
18:55mammoth d (day-from date) ]
18:55mammoth (str-join "-" [y m d]) ))
18:55mammothIll get it right eventually.
18:56mammoththanks for feedback, guys.
18:59alex_baranoskytesting
19:00Sgeo_I wonder if mammoth has done picolisp before, they have a similar convention
19:01mammothSgeo_: no
19:01mammothI came up with this
19:01mammothSgeo_: EXTREMELY obsesive compulsive, thought.
19:02tufflaxmammoth I'm sure you've heard this before, but focus on the indentation :P
19:02mammothtufflax: I'll try.
19:03tufflaxAnd learn to love the simplicity of the Lisp syntax
19:03mammothtufflax: seven closing brackets is not my definition of simple.
19:03tufflaxwhat's not simple about it?
19:04tufflaxAnd why does it matter if there is seven closing parens?
19:04FoxboronNothing? *points at Python*
19:04nightfly_The book I learned common lisp with "The Elements of Artificial Intelligence Using Common LISP" advocated the same thing mammoth is suggesting. It really helped me when learning but I don't feel I need it anymore.
19:05tufflaxWhen you get to the point of the closing backets, everthing is already done, and you don't need to care anymore
19:05tufflax:p
19:05FoxboronI'd argue that, if a syntax was simple, more people would be coding lisp :P
19:05FoxboronHowever, most people turn 180 degrees when they see tonstonsandmoretons of parens
19:05tufflaxFoxboron, I don't know if that would be a strong arument
19:06tufflaxFoxboron have you seen Rich's talk Simple Made Easy?
19:06FoxboronI believe i got it buffered up in the background, planning to see it the past hour :P
19:07tufflaxDo it!
19:07tufflaxDo it now
19:07FoxboronBut i got a bed calling on me :/
19:07tufflaxIt's more important than sleeping
19:07FoxboronMore important then an important test :c?
19:07tufflaxWay more
19:07Foxborondamn.
19:08tufflaxAnd don't stop watching it until you agree with everything :D
19:09tufflax...he says
19:09yediwhat's the difference between a seq and a collection?
19:10gfredericksa seq implements ISeq
19:10gfredericksI can't remember if there's a formal definition of a collection
19:10tufflaxseq is an abstraction that defines first and rest
19:10Foxboronummm
19:10Foxboronthink easy
19:10yeditufflax: ah ok
19:10FoxboronWhat is a collection? a collection of numbers are: 350 43 100
19:10Foxborona sequence of numbers are: 1 2 3 4 5 6
19:11Foxboronsimple enough :3?
19:11tufflaxas gfredericks says, I'm not sure if there is a definition of a collection, but in Java there is
19:11tufflaxFoxboron, note that a seq and a sequence is NOT the same thing
19:13wingyregarding the error: "java.lang.RuntimeException: Unsupported escape character: \g"
19:13wingyi just escaped it : \\g
19:13wingyand it works
19:13Foxborontufflax, like. Even if you would pick on the diff between seq and sequence...i am not sure if he actually wanted a indepth difference guide, but a basic one.
19:14Foxboronand if he wanted a basic one, i don't see any problem with the one i wrote <.<
19:14gfredericksFoxboron: well for starters it's not obvious what distinction you were trying to make
19:14gfredericksin both cases you listed some numbers separated by spaces
19:14tufflaxFoxboron, 1 you did not explain any difference between a sequence and a collection 2 i think he asked specifically what a seq is
19:15jodarotufflax: http://www.fogus.me/fun/unk/
19:15Foxborongfredericks, well. I maybe didn't think that far as if he would understand the difference.
19:16Foxborontufflax, well he never really replyed anything after the question :P So i dunno rly.
19:17yediFoxboron: it just seemed like you were seqs were lists of sequential items
19:17yediim pretty sure that's not what the distinction in clojure is
19:17gfredericksa vector is not a seq, for instance
19:18yedimaps aren't seqs either right?
19:18gfrederickscorrect
19:18gfredericks,(seq? {})
19:18clojurebotfalse
19:18Foxboronyedi, i assumed you wanted the basic explenation ^^ I am not the right guy if you wanted the real difference ^^
19:18gfredericks,(map seq? [[] {} #{} () "foo" (range)])
19:18clojurebot(false false false true false ...)
19:19gfredericks,(doc sequential?)
19:19clojurebot"([coll]); Returns true if coll implements Sequential"
19:19yediFoxboron: the basic explanation was what tufflax said. You instead said something incorrect, conflating seqs with a list of sequential items
19:19gfredericks,(doc seq?)
19:19clojurebot"([x]); Return true if x implements ISeq"
19:19Foxboronyedi, then i was wrong :) Nothing more to it ^^ I am still human last time i checked
19:20yedino biggie, thanks for tryna help
19:20Foxboronnp :P
19:20FoxboronRich said "You should never be afraid of being wrong."
19:20yedigfredericks: thanks, so basically lists are the only seq structures in clojure?
19:20gfredericksFoxboron: I learn a lot in #clojure by responding with my best guess and getting corrected :)
19:20Foxborongfredericks, thats how i learned programming ;P
19:21gfredericksyedi: no; there are lazy seqs, and there are seqs that are views over other collections
19:21yediwhich you get by calling seq on one right?
19:21gfredericks,((juxt identity type) (seq {:foo 43}))
19:21clojurebot[([:foo 43]) clojure.lang.PersistentArrayMap$Seq]
19:21gfredericksyedi: yep
19:21tufflaxActually, now I'm a bit unsure of what to call things that you can do first and rest on but that is not seqs
19:21gfredericksyedi: furthermore you can make a custom seq by implementing ISeq
19:22yeditufflax: it's not?
19:22gfrederickstufflax: you mean things that clojure.core/{first,rest} accept?
19:22yediwhat does ISeq give you/do?
19:22tufflaxgfredericks, yes
19:22gfrederickstufflax: those are the seqable things :)
19:22tufflaxyes, I mixed the two concepts
19:23gfredericksyedi: that's the interface that the seq functions use, so if you have a collection-thing and you implement ISeq, you can use the clojure functions with that collection-thing
19:24yediwhat are the main clojure functions you would want to/typically use on a seq?
19:25tufflaxHm gfredericks help me out here. Does {} implement ISeq? And if not, what interface/protocol does make sure that one can do first and rest etc on it?
19:27gfrederickslooks like there's a Seqable interface
19:28gfredericksjust defines a seq function
19:28gfredericksso something that is seqable can provide a seq, which actually provides the first/rest
19:29gfredericksso you when call clojure.core/first with a map, it will first call seq on the map, then first on that sq
19:29tufflaxyeah
19:30gfredericksbut I don't understand ##(.seq {:foo 'bar})
19:30lazybotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
19:30gfredericksO_O
19:32yediis the . how you run a java class method?
19:32yedi,(doc .seq)
19:32clojurebotCool story bro.
19:33gfredericksyedi: an instance method in this case
19:33gfredericks,(class {2 3})
19:33clojurebotclojure.lang.PersistentArrayMap
19:34tufflaxyedi a class method is like Math/sqrt
19:34yediyea my b, used wrong terminology
19:34gfredericks,(. Math (sqrt 7))
19:34clojurebot2.6457513110645907
19:34gfredericksalso that
19:35tufflaxthen there is also this clojure.lang.RT that gets inbetween
19:35gfredericksyeah
19:36tufflaxI mean like collections defines cons but then it's somehow called conj :p
19:36gfredericksI give up trying to make sense of ##(.seq {2 2})
19:36lazybotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
19:36tufflaxdefine*
19:36gfredericks,(.seq [2 2])
19:36clojurebot(2 2)
19:37gfredericks,(.seq #{2 3})
19:37clojurebot(2 3)
19:39gfredericksfound an unused line in clojure.core: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L495
19:40tufflax:p
19:41tufflaxI find that PersistentArrayMap business strange too
19:42gfredericksit's not obviously a bug since ##(seq {2 2}) still works
19:42lazybot⇒ ([2 2])
19:43wingyhttp://postbin.heroku.com/ is the shit for debugging
19:51yediI keep getting a symbol not found error when trying to run a function in my nrepl repl. Does anyone know of some common pitfalls that could have led to this issue?
19:52yedii've tried both loading the whole file C-c C-l and executing the function
19:52yediand they don't error, so I'm not sure what the issue might be
19:53tufflaxyedi maybe your repl is not in the right namespace
19:54tufflaxe.g. your file is (ns myfile) but your repl says "user>"
19:55yediyea
19:55tufflaxwas that it? :P
19:55yedii think
19:55yedihow can I change namespace to the proper one?
19:55tufflaxjust do (ns the-right-one)
19:55tufflaxi think that should work
19:55tufflaxin the repl
19:56yediis there a function to check what the current namespace is
19:56tufflaxthere is a var i think
19:56tufflaxlike *ns*
19:56tufflaxor somthing
19:59tufflaxyedi there are a lot of useful vars, like *command-line-args* *e (the last error) *1, *2 (the last, second to last, etc return value to the repl) *ns*
19:59tufflaxand a few more
20:07yedicool thanks
20:09Sgeo_Does Lamina spawn any threads, or do I have to be careful of, say, taking a long time to do something in a receive-all if there are multiple things wanting to read from forks of the channel?
20:16yedii have two functions that need to load the same thing from a file, but the functions do different things
20:16yedisometimes i want to call the two functions in the same function
20:17yedibut i don't want to have to load something twice
20:17yediis there a semantic way to only load it once and share it between the two files
20:18tufflaxyedi well if you separate out the loading part, and instead let the functions take the string as input
20:18tufflaxthen it's pretty simple
20:19tufflaxwatch this: http://www.infoq.com/presentations/Simple-Made-Easy :)
20:21yediso obvious, thanks tufflax
20:22sporkballIs there a way to have a test in clojure.test fail if an exception _is_ thrown? using (is (thrown? passes if the exception is thrown, but I want the test to pass in all cases unless a specific exception is thrown
20:22ivanyedi: http://blog.getprismatic.com/blog/2012/10/1/prismatics-graph-at-strange-loop.html is a much more general solution to the problem
20:22ivananyone know when prismatic graph will get released?
20:24yediyea i was thinkin that ivan
20:24yedibut i figured my systtem wasn't complex enough to need it
20:25Sgeo_Is there a way to have a Lamina channel close if there are no references to it?
20:28yediis there an last(inverse-first) and inverse-rest
20:34bbloomnow I recall why I stopped writing blog posts… I'm as verbose as yegge…. i'll finish later…. it's turkey time.
20:50TimMcOh man, it was such a pain to try to write a Clojure webapp while offline yesterday.
20:52TimMc`lein2 ring server` was a surprise source of pending dependencies; a lot of Clojure syntax isn't discoverable from the source; some important libs rely on online-only docs.
20:56tufflaxTimMc, I'm sorry, what syntax are you talking about?
21:08hakujinis the volkmann tutorial the best place to start learning?
21:09yedi,(doc when)
21:09clojurebot"([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
21:11brehauthakujin: it claims to have been updated in the last few months, but it doesnt list a clojure version that i can see, so i guess its still current
21:11hakujinbrehaut: thanks
21:12moogatronichakujin: probably implement something easy, and ref that tut.
21:12hakujinshould I just start with the repl? or dive in to leiningen
21:12moogatronic(among others)
21:12moogatronichakujin: leiningen will let you just use the repl, and make the class path stuff easier when you want to experiment with various libs.
21:13hakujinmoogatronic: thanks
21:13moogatronicif you install leiningen, you can do 'lein new fooproject', and then in the fooproject directory, type 'lein repl' and it will use the class path libs specified in the project.clj
21:13brehauthakujin: lein is the front end to the language so yeah, use it
21:14moogatronichakujin: I suggest lein2, which i believe is the default now on the github page.
21:14moogatronichakujin: do you use emacs?
21:16brehautit is not recommended that anyone learn a new editor while learning clojure
21:17moogatronicbrehaut: yeah, but if he already uses emacs, emacs+nrepl.el / etc is significantly more awesome than just lein repl
21:17brehautagreed
21:18moogatronicI'm not sure what the 'state of the art' is with regards to sublime text 2 and nrepl integration. Anyone use that combo?
21:20muhooTimMc: i've had that problem. you almost have to do all your lein check stuff ahead of time, make sure all the libs are loaded, and hope you don't need new ones.
21:21muhooi also git clone all libraries i might need, so the README.md file is local
21:22TimMctufflax: Destructuring, mostly.
21:22muhoosource is in the actual jar files, which is nice. it'd be nice if lein included the readme and docs in jars though. then you could have offline docs
21:23hakujinmoogatronic: I use vim
21:25jyuneed i load file by shortcut when I make change using emacs and nrepl.el, the book programming clojure says some change have to load again, is it?
21:31yeditufflax: the namespace thing wasn;t the problem
21:33yedibecause I set the namespace to my file and nrepl's repl still can't resolve any symbols
21:35moogatronicyedi: what is your issue? this sounds similar to something I'm hitting
21:37yedii can't run any functions in my repl because i keep getting the unable to resolve symbol error
21:37moogatronicis this after you've re-started nrepl?
21:38moogatronici could be reading into your issue… =) I have trouble with nrepl.el and symbol errors unless i switch into an arbitrary namespace in my project and recompile. (only after killing the server and restarting it though)
21:38yediill try restarting the server
21:39yediim new to both nrepl and emacs, so things are lil bit confusing
21:40moogatronicyedi: yeah, it's sadly still a bit confusing. Once you figure it all out though, it seems easy. =)
21:42moogatronicyedi: are you running nrepl-jack-in or connecting to some other nrepl server that you started from cmd line?
21:42yedijack-in
21:44moogatronicit *should* work if you kill the nrepl-server buffer, and run jack-in again. I still have some weirdness where i have to run (in-ns 'arbitrary.namespace.in.project) before C-c C-k or C-x C-e will work
21:49FrozenlockClojure/java interop: Is there a way to get all the fields from a class, as usually seen in "Field summary" in a javadoc? I tried .getFields and .getDeclaredFields, but some things returned aren't in the class Field summary.
22:01john__greetings
22:01john__lisp newb here
22:01moogatronichi john__
22:01john__i'm trying to write a simple blackjack CLI app and (coming from ruby) not sure how to store the current value of the cards
22:02john__its basically "while (n < 21) (add (rand-int 10) count)"
22:02john__but i'm not sure how to store stuff in a variable, since theres no variables like in ruby
22:02moogatronicWell, you can use Atoms if you want some sort of mutable state
22:03john__i don't think i need atoms since its not async or anything, i think i'm just missing 'the lisp way' on how to do this
22:03john__like pass a number through a function repeatedly or something
22:03moogatronicah.
22:03john__i read somethin about recursive functions
22:04john__where i could call the same function again but pass in the new number?
22:04moogatronicseems to always boil down to map and reduce. You can do loop / recur as well
22:04john__ah recur is the one i think
22:04moogatronicjohn__: Loop recur matches what you're talking about.
22:04john__is that where it calls the same function again?
22:04brehaut(let [cards (atom #{})] (while (< 21 (blackjack-sum @cards))) …))
22:05moogatronicrecur re-enters at the point where you set up your (loop [bindings] … (recur new-bindings))
22:05john__cool that looks like the one
22:05john__so i'd bind [count] to 0 initially, and do (recur <new-count>)
22:07moogatronicthat should work. there may be better idioms to employ here, but without seeing the entire code and all, I can't say. I always go with what works *now* and then revise later. =) Especially if you're learning.
22:07john__sure i'm just starting out
22:07john__i got intrigued by all the each'ing and map'ing in ruby ;)
22:08moogatronicthis has some examples, and is generally useful. Perhaps you've seen it: http://clojuredocs.org/clojure_core/clojure.core/loop
22:08john__yea i got there from the cheat sheet thx
22:08moogatronicah ok
22:08brehaut(just btw, that while loop was not a serious suggestion)
22:09john__brehaut: heh
22:14zerokarmaleftmoogatronic: heyo, long time
22:14moogatroniczerokarmaleft: hey! no doubt. were you at the conj this year?
22:14zerokarmalefti had a ticket, but i had to cancel my trip :(
22:15zerokarmaleftmoogatronic: did you go?
22:15TimMcmuhoo: Yeah, I updated my ring and compojure clones ahead of time. :-)
22:15moogatronicah. yeah, I did. it was awesome. The presentations make much more sense after having had a year to implement things using clojure. =)
22:17zerokarmaleftindeed, looking forward to the talks getting posted on infoq or wherever
22:18brehautTimMc: it is a pity compojures docs are mostly on the wiki
22:19moogatroniczerokarmaleft: I ended up staying at the Sheraton this year as well. That was nice. No 1.3 mile walk each morning and night.
22:19john__haha nice almost there
22:20moogatronicClojure west is in portland, which has me contemplating. Can't really justify another trip in march… but Portland is on my should-visit list...
22:21john__is there a command to quit the program when i bust over 21?
22:21john__or would i reverse engineer it in a way that the program only continues below 21
22:22yedimoogatronic: thanks alot, in-ns worked
22:22moogatronicyou could just (if (> val 21) (return value branch) (recur blah blah branch))
22:22moogatronicyedi: yeah, i'm not sure why you have to do that. I recently switched from swank to nrepl, and discovered that issue.
22:23zerokarmaleftmoogatronic: i'll have to convince my wife that portland in march is the ideal place for a second honeymoon
22:23moogatroniczerokarmaleft: Microbrew capital of the world? Gigantic second hand book store? Clojure? Bikes? Portlandia?
22:24brehautthe dream of the 90s is alive
22:24john__moogatronic: i have a 'round' function determining if i win and a 'main' function with the loop. seems like i would have to have the test and the recur in the same function?
22:24zerokarmaleftshe's allergic to gluten sadly, which severely limits the kinds of beer she can drink sadly
22:25zerokarmaleftplenty of wineries around though
22:25john__zerokarmaleft: on the other hand, she'll always stay thin :)
22:25moogatronicjohn__ if you want to break out of the recur, yeah, you have to have some test in your loop.
22:26moogatroniczerokarmaleft: I think there are some micro-distilleries in portland as well. My wife has an issue with tyramine which is present in all fermented things, so distilled liquor is the only way to go for her. I'm not sure of residual gluten levels in whiskies though.
22:30john__moogatronic: sweet, i did it with 'let'
22:30john__returned the new value from round and only recur if it isn't nil
22:30moogatronicjohn__: sounds legit! =)
22:31john__in general, do you guys write (function-name [args] ..) or do you put everything into its own line?
22:31moogatronicyou mean when defn 'ing ?
22:31john__both defn'ing and invoking
22:32john__i currently do (defn welcome []
22:32brehautit depends
22:32moogatronicwell, i like my docstrings… so i do
22:32moogatronic(defn \n "some docs" \n [the args] \n the other stuff)
22:32moogatronicbut if the function is small and obvious and fits < 80 chars, then one line.
22:32john__ok
22:32john__next question: how do i comment out a line containing quotes?
22:34moogatronicnot sure i understand. ;; / ; work for me. depending on your editor/mode
22:35john__ah, i thought you commented stuff out using ""
22:35john__thx for that
22:35moogatronicin emacs, sometimes you select the line and M-; it.
22:35john__i use vim
22:35john__but yea everybody who uses lisp seems to be loving emacs
22:35john__maybe i'll look into that some time
22:36john__the ; did it, thx
22:36moogatronicI saw some pretty impressive vim users at the conj.
22:36moogatronicpresenters, etc.
22:36john__vim is amazing if you know it
22:36john__it doesn't seem to integrate witht he repl well
22:36moogatronicwhen my ergo-wrist-problem flares up, I switch to EViL mode in emacs.
22:36john__as opposed to emacs, which IS a repl
22:36moogatronicmodal editing seems to be more ergonomic for me at any rate.
22:37john__yup that's wht i gather
22:38moogatronicjohn__: are you using the VimClojure stuff?
22:38brehautmoogatronic: travis rudd has voice controlled emacs
22:38moogatronicbrehaut: !!
22:39john__moogatronic: i have it installed, but haven't used any of it yet. this is my very first .clj file ;)
22:39brehauti understand it is a bit ductape and twine, but nevertheless
22:39moogatronicbrehaut: i'm already on a kinesis advantage, trackball, etc. but that sounds interesting.
22:40brehautwhoa, my bad, tavis rudd, no r
22:41moogatroniclooks like he presented this setup at Strangeloop. I need to remember to watch that talk.
22:41brehautyeah i believe so
22:42brehautalso, his emacs.d is on his github
22:43moogatronicit's an interesting concept. I wonder if switching between dictation and typing has any other side-effect benefits.
22:44john__at the end of a 'do', i want to return either a number or nil. can i do this using (if (stuff) (println "should return nil) number) ?
22:44brehauthuh, emacs itunes binding. thats handy
22:45john__or does the else branch of an if have to be a function?
22:45moogatronicyou can return anything at th end of an else branch
22:45john__k
22:46flying_rhinojust to check something: appart from let, there are no local vars?
22:48john__wooo :) it works!
22:50john__http://pastebin.com/mTKTjRKa
22:50john__if you wnt to see the code
22:52moogatronicjohn__: you don't need most of those explicit (do …) statements
22:52john__oh?
22:52john__can i just jam a bunch of functions?
22:52moogatronicyeah, you can just jam all the functions in the defn
22:53moogatronicyou need it for your if branches tho
22:53john__ok
22:53john__but not in defn?
22:54moogatronicyeah
22:58john__i still sometimes get a nullpointer exception at the end
22:58john__when it tries to add up nil and the number in add-card
23:02moogatronicjohn__: you could return 0 instead of (println …) (do (println "blah") 0)
23:05john__feels like i should move the busted? test from the round function into the main function
23:05john__now i'm having to test twice essentially
23:06john__but it did fix the NPE, thx
23:06moogatronicyeah, i think it fits better there.
23:12john__cool
23:12john__thx for your help guys, especially moogatronic
23:12john__i like the way you have to think differently in clojure
23:12john__see you later!
23:12moogatronicNo prob. Later, and good luck. The FN thinking re-boot is quite nice.
23:13moogatronicrecovering j2ee guy here… =)
23:13john__hehe see you
23:23atom_Happy Thanksgiving clojurites
23:23atom_and if you're not in the US, hi.
23:25wingywoohoo
23:26sporkballatom_, what if you're an American, but not in the US #edgecase :)
23:27atom_sporkball: It would apply then. You're included!
23:27sporkballatom_: hooray! Happy Thanksgiving to you, too
23:28atom_sporkball: Thanks! Nothing like ending a feeding frenzy day like letting Clojure kick you around for awhile. :D
23:30sporkballatom_: It's a quick cure for a tryptophan hangover, for sure.
23:30sporkballatom_: whole turkeys are ridiculously expensive here in China, though, so we had chicken and duck instead -- delicious, but not quite the same. A turducken missing it's most important layer.
23:31atom_sporkball: Well, it is the most important part. However, duck is an adequate substitution! Especially with the crispy skin.
23:32sporkballatom_: it was respectable, especially considering that I cooked it and well… I don't really _do_ that sort of thing.
23:33atom_sporkball: I hear you. I leave the cooking to grandma and mom. Although I did venture out into baking and did a gluten free pumpkin pie.
23:34sporkballatom_: nice!
23:34akhudekHas anyone written a sorted bag data structure for clojure?
23:58flying_rhinowhat begginer's IDE would you recommend for me? (Right now I mostly use clojure vie repl via leiningen)
23:58flying_rhino*via