#clojure logs

2012-09-23

00:36djanatynwhoever wrote or contributed anything to hiccup, I *love* you
00:36djanatynhiccup has made my life so much easier.
00:36djanatynI have to work through a very large portion of a java textbook, and I used clojure to write a program that creates a small static website with my Java code indexed by chapters, and the answers I gave indexed by chapter
00:37akhudekweavejester has done a lot for the community, including hiccup :-)
00:37djanatynI have all the answers in a huge map, in it's own file. I've been writing little helper functions to make putting stuff in easier
00:37djanatynI'll have to write him a thank you note and see if there's any bugs I could try to fix
00:38akhudekhttps://github.com/weavejester/hiccup/issues
00:55duck1123has anyone had an issue recently where nrepl.el doesn't give you the repl? All I get is a blank buffer
00:55casionare you using autocomplete?
00:56duck1123yes, I was trying to
00:56casionthat happened to me as well
00:56casionare you jacking in to a project or not?
00:56duck1123I start a nrepl connection when my server starts
00:57duck1123then I connect to that
00:57casionthat should work fine...
00:57casionthere's an issue with your ac-nrepl and/or autocomplete config
00:58SgeoI should figure out the autocomplete stuff too
00:58casionautocomplete is a pain until lein prev 1 comes out :|
00:58SgeoHmm?
00:58casionlein 2.0 prev 1
00:58casionbecause it has an old clojure-complete dependency for headless repls
00:58SgeoI thought there were 10 previews already
00:59casionRC1
00:59casionit's late :\
00:59duck1123The thing is, I tried using a clean .emacs.d (actually, I used starter kit) and I still had the issue
01:00duck1123should I remove complete-core from my deps?
01:00casionno
01:00casiondid you use package.el for installing ac-nrepl and auto-complete?
01:00duck1123yes
01:00eggsbyhmm, I have autocomplete and nrepl, but I had to install nrepl from git, not from marmalade
01:01casiondo you have (package-intialize) in your .emacs?
01:01duck1123I believe so
01:01duck1123ssh giving me issues, one sec
01:01casionok
01:03duck1123I do have package-initialize
01:03casioncan you paste the relevant portion of your .emacs?
01:03casionthe ac-nrepl had bad docs recently, but it was fixed iirc
01:04casionmaybe you somehow picked up that elisp though?
01:04duck1123which relevant portion?
01:04casionac-nrepl and auto-complete config
01:06duck1123well, it's not working even with none of auto-complete set up
01:07casionyou remove all of auto-complete config and it still chokes?
01:07duck1123yes
01:08casionif you clone and clear your emacs.d?
01:08casionand I assume lein repl works fine?
01:09casionand or connecting to lein repl :headless
01:11duck1123Ok, I just wiped my config, added marmalade, installed clojure-mode and nrepl and it's still doing it
01:12casionlein repl works ok?
01:12duck1123it says it started the server
01:12duck1123trying to connect
01:13duck1123Wrong type argument: integer-or-marker-p, nil
01:14casionare you using emacs 23?
01:14duck1123GNU Emacs 24.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-07-17 on lawrencium, modified by Debian
01:15duck1123this worked earlier today
01:16clj_newb_2345_argh
01:16casiononly thing I can think of is increasing the timeout or retry limit
01:16clj_newb_2345_has anyoe in the world gotten lein + swt + osx ot work together?
01:16casionbut I don't recall exactly now to do that in lein
01:16casionyes clj_newb_2345, and it's a pain
01:16clj_newb_2345_I've already passed it -XstartOnFirstThread
01:16clj_newb_2345_has a jvm-opts
01:16clj_newb_2345_yet it still bitches about not on main thread
01:16duck1123but wouldn't that only apply if I was using jack-in?
01:17clj_newb_2345_casion: do ou have a working project.clj I can copy?
01:17casionduck1123: I don't think so
01:17casionclj_newb_2345: I do not currently
01:17clj_newb_2345this thing basically looks imposisble
01:17casionthat project is currently in a fubar state
01:17clj_newb_2345i don't even know how to check if a given thread is the main thread
01:17casionand I started to learn seesaw instead
01:18clj_newb_2345what project
01:18clj_newb_2345?
01:18clj_newb_2345i manually insatlled swt.jar via maven
01:18duck1123clj_newb_2345: check out seesaw, I beleive he's solved all the annoying bits
01:19clj_newb_2345i neet swt
01:19clj_newb_2345in order to embed a webview
01:19duck1123oh well, I'll fix nrepl later, the wife hasn't seen the new doctor who yet
01:19duck1123seesaw is a wrapper
01:20casionhttps://github.com/CMPITG/clojure-swt-examples
01:20casionthat is what I followed/worked with getting swt working
01:21clj_newb_2345that is linux only
01:21casionyou have to find the osx swt dependency yourself and make a local repository to pull from
01:21casionat least that's what I did
01:21casion(and it subsequently broke…)
01:26clj_newb_2345i've done all that
01:26clj_newb_2345I don't think you've heard me clearly
01:27clj_newb_2345i've installed swt.jar manually, I've included "-XstartOnFirstThread in jvm-opts, but it still bitches that it's not on mthe main thread
01:32clj_newb_2345alright; I got swt + clojure working
01:32clj_newb_2345unfortunately, just not with lein
01:33casionwhat did you do?
01:37McFritzenclj_newb_2345, do you believe that Flash is the best SC2 player?
01:38clj_newb_2345?
01:38clj_newb_2345I think you have me confused with someone else.
01:38clj_newb_2345so I currently have swt + clojure working, but I can't use it via lein.
01:38clj_newb_2345java -cp clojure.jar clojure.main <-- starts a repl. Is there a way to have clojure.jar start out by loading another file instead?
01:39clj_newb_2345i.e. something like java -cp clojure.jar my-main.clj
01:39McFritzenclj_newb_2345, not at all, I have no idea who you are namely.
01:41rlbclj_newb_2345: java -cp ... clojure.main foo.clj
01:43clj_newb_2345rlb: I need "-i foo.clj"
01:44clj_newb_2345http://clojure.org/repl_and_main
01:44clj_newb_2345now, I need to do one last thing: somehow tell clojure.main to search for class 'foo" in src/foo
01:44clj_newb_2345rather than "./foo"
01:44clj_newb_2345what is the option that tells clojure where to search for *.clj files?
01:45SgeoDo the suggested keybindings for org-mode conflict with nrepl.el or slime?
01:50shachafSgeo: Fancy seeing you here!
01:50Sgeoshachaf, I guess you're new to my language hopping and obsession.
01:52scottjSgeo: Are you planning on doing org-babel?
01:52Sgeoscottj, I don't know what that is
01:54clj_newb_2345*compile-path* = "classes"
01:54clj_newb_2345how do I tell clojure hwere to search for *.clj files
01:55scottjSgeo: I don't think the global org-mode bindings conflict.
01:58samratthe clj-oauth docs seems to be outdated, how do I use it with clj-http instead of clj-apache-http?
02:16wei_is this the proper place for clojurescript questions? how would I translate "OAuth.SignatureMethod.sign(message, accessor);" to clojurescript?
02:19SgeoC-u M-x nrepl-jack-in, after I attempt to type the project root, and I press enter, just puts a newline into the minibuffe
02:19Sgeominibuffer
02:27unlinkWhy isn't it unspeakably bad practice to use other people's namespaces for their own projects?
02:38scottjSgeo: you tried opening project.clj and starting it from there and it doesn't work?
02:39Sgeoscottj, hadn't tried that
02:40amalloyunlink: huh?
02:41Sgeoscottj, is that the typical usage?
02:41SgeoRather than C-u M-x nrepl-jack-in?
02:41SgeoDoesn't seem to have worked
02:42scottjSgeo: idk, I don't use nrepl, was just a guess I thought slime-jack-in behaved that way
02:44scottjSgeo: I guess start nrepl with lein from terminal and then M-x nrepl to connect
02:45scottjthat's what I do (except lein swank and M-x slime-connect)
02:46SgeoIt might actually be easier
02:47scottjI think ritz with slime is very good, but you may run into your own problems there and there are far fewer users to help. but doesn't take long to try.
02:47scottjSgeo: are you coming from Haskell? what editor did you use there?
02:48SgeoMostly gedit (I was on Ubuntu)
02:48SgeoAnd sometimes JEdit when I was on Windows
02:48Sgeo(at school)
02:49SgeoI do want some of the functionality that ritz claims to offer
02:49SgeoEspecially project.clj reloading. And is it offering to allow resuming from an exception?
02:50SegFaultAXDoes anyone know anything about high frequency trading?
02:50SgeoAlso, will l the version of SLIME it uses conflict with recommended versions of SLIME if I want to try Common Lisp again?
02:51djanatyn,(let [seconds 72010, hours (mod seconds 3600), minutes (mod (- seconds (* hours 3600)) 60)] (- seconds (+ (* hours 3600) (* minutes 60))))
02:51clojurebot35410
02:51djanatyn:| I don't understand what I'm doing wrong here
02:51scottjSegFaultAX: anything is pretty broad :)
02:52djanatyn,(let [seconds 72010, hours (mod seconds 3600), minutes (mod (- seconds (* hours 3600)) 60)] {:hours hours :minutes minutes :seconds (- seconds (+ (* hours 3600) (* minutes 60))))
02:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
02:52djanatyn,(let [seconds 72010, hours (mod seconds 3600), minutes (mod (- seconds (* hours 3600)) 60)] {:hours hours :minutes minutes :seconds (- seconds (+ (* hours 3600) (* minutes 60)))})
02:52clojurebot{:hours 10, :minutes 10, :seconds 35410}
02:52djanatynthe hours and minutes are right, but I don't know what I'm doing wrong with the seconds
02:52SegFaultAXscottj: I'm cursious if it's possible for a person to get into it, or if it's reserved for large institutions.
02:53scottjSgeo: ritz uses a specific version of slime that is incompatible with swank-clojure but works with common lisp so long as you use the same version of swank as ritz, I think (which is pretty old)
02:53scottjSegFaultAX: I think it's very hard for an individual to do.
02:54scottjSegFaultAX: because you have to rent servers at the exchanges, and those aren't cheap, and the feed level that you have to get is also very expensive.
02:54SegFaultAXWhat if I just wanted to do "pretty-fast frequency trading?"
02:54scottjSegFaultAX: btw I've never worked in HFT, so this is all just my impression
02:55scottjSegFaultAX: well you can do day trading, but I think the strats used by HFT require very fast responses (<1ms maybe)
02:56SegFaultAXscottj: Maybe day trading is what I mean.
02:57SegFaultAXscottj: Mostly just algorithmic trading. HFT is probably the wrong word, then.
02:58amalloydjanatyn: i think the hours are only right by coincidence
02:58amalloy(mod seconds
02:58amalloy3600) doesn't divide by 3600, it gives the remainder
02:58scottjSegFaultAX: it's definitely possible for an individual to make money in that game, but realize that it's super competitive and you're going up against thousands of very experienced opponents in a zero sum game)
02:58djanatyndoh. thanks!
02:59amalloyyou want rem, or div; i don't think there's a difference for positive numbers
02:59SegFaultAXscottj: Well, I'm thinking it might be a fun hobby application of FP.
03:00SegFaultAXscottj: A couple thousand is a reasonable margin for me. I'm not looking to make this my day job.
03:01SegFaultAXscottj: I'm working up some prototypes of using core.logic for this sort of thing.
03:02scottjSegFaultAX: interactivebrokers.com is what the small day dtraders use I believe, it has a java api iirc
03:02scottjand a simulation mode
03:04scottjSegFaultAX: there's a wrapper on clojars, not sure how complete it is (probably not very, it's 0.0.1)
03:05SegFaultAXIt costs $10k just to open an account?!
03:06SegFaultAXPft, maybe I should think of a different hobby.
03:07SegFaultAXOh, $3k for ages 26 or younger. Sweet.
03:17scottjSegFaultAX: out of curiousity, what instruments are you thinking about trading?
03:18SegFaultAXscottj: Umm, pianos, trumpets and clarinets.
03:18SegFaultAXI don't know what you're asking. :)
03:18SegFaultAXStocks?
03:20scottjyeah that was basically the question
03:20SegFaultAXWell then, stocks.
03:21SegFaultAXscottj: When I was much younger, my dad and I played around with futures. I don't remember much, though.
03:25SegFaultAXIs Scala worth learning?
03:25SegFaultAXIt just looks so... ugly.
03:47amalloySegFaultAX: depends what you've already learned, i suppose. ugly is a terrible reason either way; lots of people think clojure is ugly
03:47SgeoCan nREPL servers be secured with passwords, or otherwise made safely Internet-accessible?
03:53luxbockhttp://www.4clojure.com/problem/166
03:53luxbockcould someone help me out with this one?
03:53luxbock"Write a function that takes three arguments, a less than operator for the data and two items to compare."
03:54luxbockI'm confused if the function I
03:55luxbockI'm writing is supposed to use the less than operator for all cases, and ignore the function supplied in the examples, eg. (fn [x y] (< (count x) (count y))) in the second case
03:56SegFaultAXluxbock: But the problem gives you the less-than function to use.
03:58amalloyis it clearer if i switch it to: "three arguments: ..."?
03:59luxbockhmm, not sure if I follow
03:59SegFaultAXluxbock: Do you understand the problem statement?
04:00luxbocknot really
04:00SegFaultAXluxbock: Well, we know we're going to receive 3 arguments to our function
04:00mpstyler.
04:00SegFaultAXThe first will be a comparator function, and the second/third will be the operands.
04:01luxbockright, so in the first example the first argument is "<", in the second it is "(fn [x y] (< (count x) (count y)))" and so on?
04:01SegFaultAXluxbock: So what might out function signature look like?
04:01SegFaultAX(fn [f a b] ...) perhaps?
04:02SegFaultAXOr (fn [lt a b] ...) if it makes it clearer that it's a less-than function
04:02luxbockyes, I tried fn [f a b] (cond (f a b) :gt approach at first, but that failed for the second example
04:03SegFaultAXWhat was your full solution?
04:04luxbockhmm, I was doing it yesterday and don't have it typed up anymore
04:04luxbockbut I realize it wasn't a working solution
04:04SegFaultAXWell, what are the 3 possible conditions?
04:05SegFaultAXa > b, a < b, a == b
04:05luxbockright
04:05SegFaultAXBut we only have the 1 operator
04:05SegFaultAXSo how can we derive the other 2?
04:07luxbockoh, is the description saying that I'm not allowed to use > or ==?
04:07SegFaultAXluxbock: They aren't given.
04:07luxbockah I see
04:07SegFaultAXluxbock: You just have the one, but you need to be able to figure out the other two from that one.
04:08luxbockok got it, I should be able to do that with cond
04:08luxbockor do I need some other trickery_
04:08SegFaultAXluxbock: Try it.
04:09luxbockalright
04:14SegFaultAXluxbock: Any luck?
04:15luxbocknot quite, this problem is making me feel stupid
04:16SegFaultAXluxbock: Can you solve just the first one?
04:20luxbockwell for that one I can just use fn [f a b] (cond (< b a) :gt) and it passes the first example but obviously none of the others
04:20SegFaultAXWhy don't you use f if you know it's your less-than function?
04:21luxbockoh right
04:22mpanis there a built-in for "shelling out"? i.e. I want to execute some string in the shell and get back all its output as a string
04:22mpanwould prefer not to introduce a heavier dependency
04:23luxbockSegFaultAX, got it now
04:23luxbockthanks
04:25luxbocklooks like most people solved it by using "if" rather than "cond", but I think "cond" makes for more readable code
04:25luxbockI guess it's pretty much the same thing
04:25mpanoh, dunno how I missed it, but there's almost the exact name
04:25SegFaultAXluxbock: I like cond better there too.
04:28mpanin case anyone was wondering how to do the same: http://richhickey.github.com/clojure/clojure.java.shell-api.html , dunno how I missed it the first time
04:28lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.java.shell-api.html and try to stop linking to rich's repo.
04:28mpaneven better
04:29mpanwow that bot's good
04:29mpan(inc lazybot)
04:29lazybot⇒ 7
05:04wunkianyone have a clue why I get the following stacktrace when I try to jump to definition in Emacs (nrepl): https://gist.github.com/ce48e26f08d9c9a7806f ?
05:29piranhaHi all. Does anybody have some insight into how well ClojureScript will perform? Especially given that I have an idea to store all data my application needs in a single atom (which means I could have quite a lot of update-in/assoc-in going deep for few levels).
05:38mpancan anyone explain at a high level how "going up the tree" works in zippers?
05:42SgeoThe zipper stores not just what's below you, but also what's above you... kind of
05:42SgeoThe entire structure is stored in a zipper, the only difference between a zipper and a regular structure, conceptually, is that with a zipper, it's more efficient to access the "location"
05:43mpanlike a "how I got here"?
05:43SgeoPretty much. (Please note that I may be mistaken in parts of my explanation)
05:43mpanbecause the underlying structure I'm expecting to feed in has an innate concept of "down" but not "up"
05:43SgeoTry actually displaying a zipper at the REPL
05:44ludston? Wouldn't Zippers just be doubly linked lists?
05:45SgeoWell, with a zipper, you need "where you are" to be the most efficient thing to access.
05:45SgeoThere's no mutability involved
05:45Sgeohmm, what to do
05:46SgeoIt's more like gluing together two lists, than a doubly-linked lists
05:46ludstonYou mean like an iterator on a node of a doubly linked list?
05:46SgeoTwo singly-linked lists
05:46Sgeo(But that analogy doesn't do well with trees, just what zippers are like on lists)
05:46Sgeo&(require '[clojure.zip :as zip])
05:46lazybot⇒ nil
05:47Sgeo&(zip/vector-zip [:a :b :c :d :e])
05:47lazybot⇒ [[:a :b :c :d :e] nil]
05:47mpanhuh? the bot lets you mess with its namespaces?
05:47Sgeo&(-> (zip/vector-zip [:a :b :c :d :e])) zip/down
05:47lazybot⇒ [[:a :b :c :d :e] nil]
05:47Sgeo&(-> (zip/vector-zip [:a :b :c :d :e]) zip/down)
05:47lazybot⇒ [:a {:l [], :pnodes [[:a :b :c :d :e]], :ppath nil, :r (:b :c :d :e)}]
05:48SgeoUh... ok, so the first element is the value where we are. The next is a map, telling us what's to the left, what's to the right, and ...I guess what's above us?
05:49Sgeo&(-> (zip/vector-zip [:a :b :c :d :e]) zip/down zip/right)
05:49lazybot⇒ [:b {:l [:a], :pnodes [[:a :b :c :d :e]], :ppath nil, :r (:c :d :e)}]
05:49mpanhuh?
05:49mpanwhere's "up"?
05:49SgeoYou can see that now that we moved right, the first element is b, and in the second element, keys :l and :r give us what's to our left and right
05:49Sgeompan, I guess that's in the :pnodes key
05:49ludstonOkay, so it's a tree where nodes have pointers to their root.
05:50ludstonWhy's it called a zipper?
05:50mpanis this like, the tree that has :a through :e as direct children of the root?
05:51SgeoIt contains sufficient information to easily access the current element, almost as easily the nearby elements, and ultimately, enough information to move around in any direction
05:52Sgeo&(-> (zip/vector-zip [[:a :b :c] [:d :e :f]]) zip/down zip/down)
05:52lazybot⇒ [:a {:l [], :pnodes [[[:a :b :c] [:d :e :f]] [:a :b :c]], :ppath {:l [], :pnodes [[[:a :b :c] [:d :e :f]]], :ppath nil, :r ([:d :e :f])}, :r (:b :c)}]
05:52mpankind of the illusion of imperative moving?
05:52mpanthat's pretty cool
05:52Sgeompan, yeah, that's a good way to put it, I ... think
05:53SgeoEach direction movement can be done in O(1) time (I think)
05:54Sgeo&(-> (zip/vector-zip [:a :b :c :d :e]) zip/down zip/right zip/path)
05:54lazybot⇒ [[:a :b :c :d :e]]
05:54Sgeo&(-> (zip/vector-zip [[:a :b :c] [:d :e :f]]) zip/down zip/down zip/path)
05:54lazybot⇒ [[[:a :b :c] [:d :e :f]] [:a :b :c]]
05:54Sgeo...I have no idea about the internal structure of this thing
05:54SgeoThere may be some good Haskell guides to this stuff, but they're in terms of Haskell
05:59RaynesSgeo: Do you sleep?
06:24SgeoRaynes, not at sane times.
06:24RaynesSgeo: Word.
06:24SgeoIt is currently 6:20 AM
06:25SgeoMy time
06:27mpanis there a way to pass to map the current fn I'm in [analogous to recur]?
06:28mpanit's for a function that recursively converts a tree-like structure to a string by some domain logic
06:34Raynesmpan: Just pass it in?
06:35RaynesI don't understand your problem.
06:35mpanI would like to pass it in a way that doesn't consume stack
06:35mpanalthough, now I'm beginning to wonder if that's an actual concern here
06:43luxbockcan anonymous functions call themselves?
06:44RaynesYes.
06:44luxbockhow?
06:44clojurebotwith style and grace
06:44luxbockheh
06:44Raynes&(fn foo [x] (foo x))
06:44lazybot⇒ (serializable.fn/fn foo [x] (foo x))
06:44Rayneslol
06:44RaynesI wonder who require'd serializable-fn.
06:45Raynes$login
06:45lazybotYou've been logged in.
06:45Raynes$reload
06:45lazybotReloaded successfully.
06:45Raynes&(fn foo [x] (foo x))
06:45lazybot⇒ #<sandbox103110$eval106402$foo__106403 sandbox103110$eval106402$foo__106403@3950bb>
06:46Sgeoluxbock, even without that bit of syntax, there's a thing called the Y-combinator
06:46SgeoWhich would allow for it
06:46mpanI keep thinking I need something trampoline-like /outside/ the map
06:46luxbockyeah I read about Y-combinator once and it sounded really complicated
06:46SgeoAnd even if that didn't exist, which it does, there's also some possible macrology
06:47mpansince F kind of depends on mapping F onto its inputs
06:47luxbockbut yeah I forgot I could name the anonymous function, which in itself sounds weird, because wouldn't that make the function not anynymous, since now it has a name?
06:47luxbockor is that just a matter of semantics
06:47mpanbut the name only exists inside?
06:48RaynesIt's anonymous to the outside world.
06:48luxbockI see
07:01Sgeohttps://github.com/pallet/ritz/tree/develop/swank
07:01SgeoI don't understand the jack-in thing.
07:02SgeoIt says SLIME cannot be installed. But what use is SWANK without a UI like SLIME? What does jacking-in do, exaclly, without SLIME?
07:12Sgeo:( M-x pacakge-install-file apparently requires tar?
08:06mpenetyup
08:07SgeoAm I going to end up bouncing between cursing at emacs and cursing at Eclipse?
08:08mpenetwell you can continue to bounce between editors and curse after 5 min everytime, or do it properly and be done with it
08:08mpenetI don't think installing tar on windows is so hard
08:41samrathow do I sign API requests with clj-http? could someone provide any examples(I'm using clj-oauth)
08:46broquaintSgeo: There's always Gow (Gnu on Windows) for tar et al - https://github.com/bmatzelle/gow/downloads
08:46mpenetreduce-kv doesn't work on java HashMaps (or even Maps I think) :( any good reason for that?
08:51broquaintmpenet: Because they're not native clojure types so won't have the necessary interface, wouldn't take much to get it working though I imagine.
08:51Sgeobroquaint, I found a tar, that worked, but the install had some problems
08:53mpenetyup figured that much, I was wondering if that would justify an issue or not, if this was by design
08:55broquaintIt's just the nature of interop I suppose.
08:56broquaintSgeo: FWIW I installed Gow + Emacs and found stuff Just Worked.
09:44green_transistorwell this place is quiet
09:46ludstongreen_transistor: If you ask a question, I'll say hi.
09:47green_transistorwhats up with reducers in clojure? :)
09:47ludstongreen_transistor: hi
09:47green_transistorindeed :)
09:48ludstongreen_transistor: What's a reducer?
09:49green_transistorThere was a talk by hickey on how reducers speed up some list operations. http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
09:49green_transistorso he says map will be implemented using reduce.. i pretty much lost him there
09:51ludstongreen_transistor: We have a cruel god.
09:52green_transistorhaah in what context?
09:53ludstongreen_transistor: I mean the guy that writes Clojure, using his smarts to bend our minds.
09:53green_transistorah subtle. his stuff is pretty radical :)
09:56green_transistorAnd why does *inferior-lisp-mode* suck so bad on emacs?
09:58ludstongreen_transistor: That's the common lisp mode isn't it? Nothing to do with clojure...
10:06green_transistorwell it sucks for elisp :) no auto-complete
10:19megamindwat do you think of clojure ?
10:21ivanmegamind: #clojure might be a little biased. in the right way.
10:22Scriptorare you conidering learning it, megamind?
10:22megamindit's my intend to ask for positive things here
11:01duck1123oh well, it looks like I'm back to swank for the time being
11:57technomancyit's good
12:01SrPxHey guys trying to install clojure again. This time I got leiningen 2.0. What is again that script you told me to download to integrate clojure with vim ? clojure leph or something
12:02technomancySrPx: probably lein-tarsier?
12:02SrPxtechnomancy: yes eh, far from leph heh. Thanks
12:03gfredericksall new languages are at best an inspiration for a new clojure library: discuss
12:03technomancywell I don't actually know anything about vim, so don't thank me till it works
12:05hiredmangfredericks: the presentation coming up is another lisp
12:07gfrederickshiredman: oh crap
12:10SrPxnew-host-8:bundle srpx$ lein vimclojure Couldn't find project.clj, which is needed for vimclojure
12:10SrPxany idea ?
12:11SrPxOh I guess I should cd to the folder I want my project in, create it with lein new and start lein vimclojure from there? Is that it?
12:11SrPxlet me see
12:13ToxicFrogYeah, that message is telling you that you actually need a lein project before you can use lein vimclojure
12:13ToxicFrogSo, exactly as you said
12:22SrPxThanks
12:22SrPxI'm almost there, getting just this error when I open a project:
12:23SrPxhttp://o7.no/O2LRzD telling ng is misconfigured, I'm not sure what I have done, just created a project on -/Clojure/my-stuff
12:27hiredmanI call "meh" on Plan
12:27redline6561+1
12:28SrPxworked, thanks ! (=
12:28swarmerwhat's Plan?
12:28gfredericksa friend of mine in there says something similar: optional parens + confusing type system
12:28gfredericksswarmer language that was discussed at EML
12:28redline6561wow
12:28gfredericksEMC
12:28gfredericksELC
12:28gfredericksemerging languages camp
12:30gfredericksI'm trying to make a serious effort to learn haskell while I'm here
12:45samrathaving some Noir trouble: https://www.refheap.com/paste/5249, the session seems to somehow get cleared up. how do I prevent that?
13:25Hodappapparently, if you enter something like (iterate (fn [x] (+ x 1)) 1) in the REPL in CCW, it tries to make the entire list un-lazy to show it to you
13:26Hodapp,(iterate (fn [x] (+ x 1)) 1)
13:26clojurebot(1 2 3 4 5 ...)
13:26Hodapphrmph
13:30Hodappdoes Emacs handle lazy sequences okay?
13:30casionI thought lazy sequences were always forced in the repl
13:30casionunless you have some specific wrapping
13:31mpenetHodapp: same with emacs/slime
13:31Hodappmpenet: same as in same as CCW, or same as clojurebot?
13:32casionclojurebot forces the lazy seq too
13:32mpenetHodapp: same as CCW
13:32Hodappcasion: but right here it's only bothered with 5 elements
13:33mpenetprobably the clojail doing its magic
13:33Hodappahh, hmm
13:33casionI believe so
13:33HodappI think it was maybe just SBCL or CMUCL or something that showed lazy sequences un-forced in its REPL
13:33mpenetI wouldn't know
13:34jkkramerHodapp: (set! *print-length* 103)
13:34Hodappoooh
13:34jkkrameralso, *print-level*
13:35Hodappthanks, good to know
13:42rich_Hi I'm pretty new to Clojure but I'm thinking of using it for a project in college. I'm wondering is there any tools for designing applications like class diagrams for OO or is stuff like that considered redundant?
13:56firesofmayxeqi, hey, is there a way to turn off lein-pedantic for a given project?
13:57Hodapphmm... wondering if I should actually try to make a lazy object such that (tree child) equals tree, or just not to bother
14:05Hodappsince I've also emerged with some annoying mutually recursive cases
14:05Hodappwhere I might just have to store a reference to something rather than trying to use it directly, bleah
14:08Hodappthis is a case where statefulness almost makes things easier 9_9
14:50xeqifiresofmay: you could comment it out of your profiles.clj; or setting :pedantic :warn in your project.clj will make it warn only
14:50firesofmayxeqi, yeah I commented it out for now. thanks :)
14:51xeqithats what I do, just comment/uncomment as needed
14:51jro__I've a function "rebuild-index". I want to run this in background, and only print the result of the evaluation to the log when it finishes, what is the correct way to do this. Not creating a thread, I suppose.
14:51technomancy`lein with-profile pedantic some-task`
14:52HodappHere is a clue-by-four. Please hit me with it for thinking that a good first project with Clojure would be a context-free graphics language that requires mutual recursion.
14:52xeqitechnomancy, firesofmay: haha, or that
14:53xeqijro__: (future (logger/log (rebuild-index))) ?
14:53firesofmaytechnomancy, interesing. thanks
14:53firesofmayinteresting*
14:53technomancyfiresofmay: not that it exists, but if you move it from the :user profile to the :pedantic profile it would work
14:54technomancyplus you could add :aliases {"pedantically" ["with-profile" "pedantic"]}
14:54jro__xeqi: thanks. Future dispatch that to a threadpool, which does not interfere with existing threads that are serving http threads?
14:54firesofmaytechnomancy, okay.
14:57jro__Programming Clojure / Emerick index points to me that "future" is something related to "ClojureScript", "ClojureCLR", "Heroku", "Overtone"... :-)
14:58cemerickjro__: Take a look at the entry for DSL :-P
14:58cemerickThe index was one place that we didn't have a hand in.
14:58xeqijro__: it dispatches to the agent send-off pool, so I don't expect it to interfere with other threads
15:00jro__cemerick: lol DSL -> (Digital Subscriber Line) versus Korma, 500
15:01jro__but the content of the book is good! Thanks, if you were involved with it.
15:02cemerickjro__: I'm the 'Emerick' part. :-P
16:02cheburakshaI'm trying to install Leiningen 2 on windows, so far not so good
16:02cheburakshaException in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core__init.class or leiningen/core.clj on classpath:
16:03technomancycheburaksha: some code is expecting lein1
16:07cheburakshatechnomancy: how did you determine that? inside the leiningen-2.0.0-preview10-standalone.jar there is a leiningen/core.clj
16:09RonnieDkcheburaksha: I installed Leiningen on Windows a few days back without any issues
16:10technomancycheburaksha: where did you get that jar? core.clj hasn't existed since 1.x.
16:14cheburakshatechnomancy: actually you're right! there is no core.clj in that folder. what i did was replace the version in the lein.bat file from from 1.5 to 2.0.0-preview10, and ran the bat file
16:16technomancyyeah, that's definitely not going to work
16:20cheburakshaRonnieDk: did you install it using cygwin or cmd?
16:20cheburakshaim doing it the cmd way, not a lot of info on the web for installing leiningen2 that way
16:20RonnieDkcheburaksha: The cmd
16:20RonnieDkcheburaksha: you're using the self-installer, right?
16:23RonnieDkcheburaksha: basically downloading wget manually and putting it in the current path, and they running the self-installer, if I remember correctly
16:23cheburakshai think so. unpack v1.5, add to PATH, modify lein.bat for 2.0.0, run "lein self-install", it downloads, run "lein", get the error
16:23RonnieDkcheburaksha: modify lein? Why not download from github?
16:23technomancy...?
16:24RonnieDkcheburaksha: you should get the latests from here: https://raw.github.com/technomancy/leiningen/preview/bin/lein
16:26technomancyare there programs where you can do stuff like that and it would actually work?
16:32RonnieDkcheburaksha: Oops, wrong link. That's not the DOS cmd file. Add .bat at the end
16:34cheburakshaRonnieDk: great! the one in the 1.5.2 distro was the latest i could find. is there a special way to navigate to the link you posted?
16:35RonnieDkwget the link
16:37RonnieDktechnomancy: How come you don't link to the bat file on the github page?
16:38cheburakshathat's what im asking, it's like an underground link, hidden from unsuspecting noobs
16:38hiredmantechnomancy: is away from his computer, but I imagine it is because he wants to stay as far as possible from supporting lein on windows
16:40cheburakshaand if you go to the directory above, it doesn't exist. weird
16:40RonnieDkc
16:41RonnieDkcheburaksha: If you navigate to the folder where lein (the bash version) is you discover that bat file. That's how I found it
16:43RonnieDkcheburaksha: https://github.com/technomancy/leiningen/tree/master/bin
16:45cheburakshaoh, i c. cool, thanks :)
16:45technomancyRonnieDk: it is linked from the readme
16:45RonnieDkcheburaksha: So if you go with the bat file and setup emacs with marmelade, I haven't had any issues using Windows
16:47RonnieDktechnomancy: Ah, yes. Sorry
16:52aibwhat's the syntax for referring to a static function? (let [trunc #((if (< % 0) Math/ceil Math/floor) %)] (trunc -1.5))
16:54broquaintYes? http://clojure.org/java_interop
16:54mpanis there another name to use for passing + as a fn that doesn't confuse ccw+eclipse?
16:55aibbroquaint: => Math/floor ;CompilerException java.lang.RuntimeException: Unable to find static field: floor in class java.lang.Math, compiling:(NO_SOURCE_PATH:1)
16:58mpanis there a way to partially apply a macro?
16:58mpan(that sounds so strange to ask)
16:58technomancyunfortunately no; macros aren't really first-class
16:58mpanwhat's the closest work-around?
16:59mpanthis is what I would have liked to write: (def soln-count (partial tree-reduce (constantly 1) +))
16:59mpanwhere tree-reduce is a macro I need to fix
17:01mpanwould apply help?
17:02aibmpan: maybe another macro?
17:02mpanaib: hm?
17:02technomancyit's best to implement the bulk of your macro in a function, then make the macro a trivial wrapper around the function
17:02AimHereAnother macro? That's one of those 'Now he has two problems' solutions? ;)
17:03aibyeah. I'd go for nth-order functions myself
17:03mpancurrently, the macro substitutes 2 functions into place in an otherwise constant structure
17:03mpanthis is what I currently have (by far not working): https://www.refheap.com/paste/5257
17:04mpanwhat's the recommended way to do this?
17:05hiredmanthere is no reason for that to be a macro
17:05hiredmanwrite it as a function
17:06mpanoh, good point
17:06mpanI'm confused about my train of thought that led here, then
17:06mpanat some point earlier, I did think to myself I couldn't get what I wanted from just higher order functions
17:06mpanthank you
17:13mpanhow can I randomly select a node from a tree? the two properties I'd ideally like to have are: traverses tree only once, gives the location not just the value of the node (because I need to modify the subtree there)
17:13jro__I've two macros: (defmacro json-response [data & [status]] `(try .. (catch Exception #e ...)) and (defmacro is-authenticated? [cookies action] `(try ... (catch Exception #e ...). The exception part is similar in both, but I cannot reduce to one (defmacro with-exceptions [action] `(try ~action ...) because varargs of action.
17:14mpanlike, doing it recursively works, but every node at depth d gets hit d times
17:14jro__I've tried (defmacro with-exceptions [action] `(try ~action (catch Exception e#)... but I end up to arity problems.
17:15casionmpan: are you using zippers?
17:16mpannot currently but considered the possibility I might end up needing them
17:17mpanI guess I should mention: the per-node pmf calculation is more expensive than traversing nodes, so that's the main thing I want to avoid
17:18casionhow would you like the distrobution to occur?
17:18mpanuh, not sure, but the current plan is
17:19mpanpass in a probability mass generating function, and weighted according to the mass over total mass
17:19mpanor, perhaps, just uniform
17:19broquaintaib: Right, yeah, the field/method distinction is annoying, you'll probably need another layer of indirection :/
17:19casionmpan: I assume you don't know the depth of the current node?
17:20aibI'll make do with #(Math/floor %) for now :/
17:20mpannot unless I specifically make a note to know
17:20mpanas in, I'm always starting this computation at the root
17:21casionyou could just create a collection of 'random' traversal functions
17:21casionbut that does assume you know the depth to allow for a distribution towards the middle of the tree
17:22mpanthe tree is likely to be terribly imbalanced
17:22mpanso local decision-making is risky
17:23jro__I would like to have something generic: (defn wrapped-json-exceptions [& args] (with-exceptions (apply json-response args)))
17:24straxhey guys, how do you change a character at a certain index in a string?
17:25casionmpan: I think you have to simply traverse the tree with an arbitrary/random termination point
17:26mpanthe question is how to get a uniform or per-node probability mass
17:26mpanin a way that doesn't hit every node at depth d a total of d times
17:26casionI can think of ways to do it if you have an implicitly 'flat' tree (like an array indexed tree in C)
17:27mpanI'm trying to think (from domain knowledge) the max reasonable depth
17:28casionif you have a way of a way of treating the tree, or a branch as flat then you can get uniform distribution
17:28casionmaybe using zip/next to an arbitrary termination?
17:29mpanI mean, suppose I wish to explicitly flatten it
17:29mpanhow would I preserve the ability to go back in and change the subtree?
17:29jro__strax: catenating a string from beginning to CharAt, then charAt, and then appending
17:30casionmpan: with zippers you can store a loc, or do a depth first walk
17:31casionbut the former doesn't really help if you've explicitly flattened it, and the latter removes the need to
17:31mpanthe first part sounds like it
17:31mpanthank you
17:49mpanI'm at a breakpoint inside a function in eclipse-ccw; how do I see the args?
17:50mpanor the local bindings as I make them? or the intermediate values of subexprs?
17:50mpanI have no idea what I did but they started showing up o_o
17:53Raynesmpan: I was going to suggest you try praying.'
17:54mpanRaynes: it may have been I was at the edge of it and not actually IN the function
17:58lpvbIs there good autocomplete for clojure
18:01technomancylpvb: sure; lein repl in 2.x has it
18:02lpvbI mean, autocomplete for vim
18:02lpvbsorry
18:05black_joeI'm getting an error relating to java.lang.String when I try to run a function called "getBetween".
18:05black_joeThis is the offending line: (let [x (doto string (.substring 0 (+ 1 (.indexOf charBetween))))]
18:06black_joeIt says there is no matching field named indexOf for class String.
18:06black_joeBut there obviously is.
18:07raek_black_joe: 'doto' won't add the "string" symbol to the .indexOf call
18:07hiredmanare you should it said class String?
18:07hiredmanand are you sure charBetween is a char?
18:07raek_,(macroexpand-1 '(doto string (.substring 0 (+ 1 (.indexOf charBetween))))
18:07metellus"doto string" will insert string into consecutive forms, not nested ones
18:07clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
18:07raek_,(macroexpand-1 '(doto string (.substring 0 (+ 1 (.indexOf charBetween)))))
18:07clojurebot(clojure.core/let [G__54 string] (.substring G__54 0 (+ 1 (.indexOf charBetween))) G__54)
18:08lpvbwhich book is better for someone who knows a bit of haskell and java: joy of clojure or programming clojure?
18:08black_joeI am sure that it is String. Not that it is a char.
18:08black_joeLet me just make sure.
18:09raek_black_joe: so in this case I would just write (let [x (.substring string 0 (inc (.indexOf string char-between)))] ...)
18:09black_joeIt also fails with a character.
18:09black_joeSame reason.
18:10metellusblack_joe: the problem is that that's not how doto works
18:10raek_black_joe: doto only inserts "string" into the outermost call
18:10raek_(.indexOf charBetween) remains the way it is
18:11black_joeAh. I consulted the doto documentation and the wording was a bit confusing. That explains it.
18:11antonautHi! I just started with clojure in emacs, and I wonder how I can load a file into a repl so I can play with it? I think i've got everything setup correctly (with swank-clojure and slime), because after running 'M-x clojure-jack-in' I can type 'slime' to get a repl. Its really only the loading part that's bugging me...
18:11raek_and you get an error because you try to call (.indexOf charBetween) instead of (.indexOf string charBetween)
18:11black_joeI thought it took and object and ran every other method on that object.
18:13technomancyantonaut: the swank-clojure readme has a good overview of the commands it provides
18:14antonauttechnomancy: thank you!
18:16technomancysure
18:18raek_black_joe: it adds the object to each call in a sequence of calls, not to arbitrarily nested calls
18:18raek_you usually use it for methods that have side-effects
18:19raek_,(doto (ArrayList.) (.add 1) (.add 2) (.add 3))
18:19clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ArrayList, compiling:(NO_SOURCE_PATH:0)>
18:19raek_black_joe: also, it returns the object and not the result of any of the method calls
18:20black_joeWell I think I'll just try to do this with sequences instead of strings then.
18:20raek_the above example expands into (let [foo (ArrayList.)] (.add foo 1) (.add foo 2) (.add foo 3) foo)
18:20raek_black_joe: there's no reason to abandon the String approach...
18:21raek_but you don't need doto in order to make a simple method call
18:21black_joeWell, even with the code you supplied it still fails. So I am going for an alternative.
18:22jhowarthWith korma, is it possible to order by the count of an association?
18:23raek_,(let [s "foo bar"] (.substring s 0 (inc (.indexOf s " ")))
18:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
18:23raek_,(let [s "foo bar"] (.substring s 0 (inc (.indexOf s " "))))
18:23clojurebot"foo "
18:23raek_black_joe: ^
18:23raek_black_joe: it's probably easier to use regexes here, though
18:24black_joeRegexes are on my list. I just haven't learned them well enough.
18:26raek_but it depends on what you are trying to do
18:27black_joeIn this context it is used to remove an internal comment from commands a bot reads from a file.
18:28black_joeThe file itself uses a LOT of markup, so I will probably learn regex before the rewrite is through.
18:30nybbles_hey how do i use clojurescript libraries with leiningen? I am trying to use jayq, but i get "goog.require could not find: jayq.core " errors :|
18:32mpenetnybbles_: are you using lein-cljsbuild ?
18:33nybbles_yuppp
18:34mpenetand jayq is in the list of dependencies of course?
18:35nybbles_yes in project.clj, under :dependencies
18:35nybbles_although thats strange, its in there with all the clj deps too
18:36mpenetif you just added it and are using lein cljsbuild auto you might need to relaunch it, also try lein cljsbuild clean before
18:36nybbles_ah okay
18:36nybbles_will try the clean thing
18:37nybbles_great, thanks :)
18:37nybbles_clean/auto did it
18:37mpenetyou're welcome
18:52mpanis there a way to unpack args, or should I go and use apply?
18:54firesofmaywhat is the correct way to add :dev-dependencies in lein2? I am getting error trying to add Marginalia to my project by doing :profiles {:dev {:dependencies [[midje "1.4.0"]
18:54firesofmay [lein-marginalia "0.7.1"]]}})
18:55firesofmay :profiles {:dev {:dependencies [[midje "1.4.0"]
18:55firesofmay [lein-marginalia "0.7.1"]]}})
18:55technomancyfiresofmay: :plugins rather than dependencies
18:56technomancyfor lein-marginalia anyway
18:56firesofmaytechnomancy, oh so I should add it to my user profiles?
18:59firesofmaytechnomancy, thanks. that worked.
19:10firesofmayHi, when I do lein marg, I ge this : "WARNING: conj-dependencies is deprecated." What does it mean?
19:11firesofmayI get* this
19:15djanatyncan I add lazytest to my profiles.clj, so I can use it for every project without having to add it to the project.clj?
19:20mpancould someone look over https://www.refheap.com/paste/5259 please? tree-reduce isn't working properly; if I give a nested tree to soln-str, the leaves don't get passed to the function
19:22mpanit ends up str'ing it directly instead of passing it through the argument fn first
19:27mpanseems to me it's behaving differently with the same args depending of called directly or recursively, but that must be my imagination
19:44lpvbdoes the eclipse public license make all clojure projects EPL licensed?
19:57pandeiroanyone know how to deactivate special quote behavior with clojure.data.csv ?
20:13tjohnson...
20:23black_joeI am having trouble making (or finding) a function that tests a string to see if it contains a character.
20:24black_joe(.contains) does not work on char's. And (str) turns the char into a lazy-sequence, so that doesn't work either.
20:27Bronsa,(some #{\a} "asd")
20:27clojurebot\a
20:27Bronsa,(.contains "asd" (str \a))
20:27clojurebottrue
20:27Bronsayou choose
20:28black_joe(str c) (where c is a character) returned a lazy sequence when I used it. I would have used that way.
20:29Bronsathat shouldn't be the case, try to check whether c is really a char
20:31pandeirois there an easy way to use a destructuring vector _and_ get bind all args to one symbol?
20:32pandeiroah nvm :as works fine
20:32amalloyblack_joe: (str x) never returns a lazy sequence for any x
20:33amalloy(str some-lazy-seq) does return a string containing "LazySeq", but it's still a strong
20:34black_joeBronsa and amalloy: It does indeed work. I think the problem was that let created a lazy sequence before it was turned into a string for some reason.
20:34Bronsathat'd be the case if you map'ed over the string
20:35black_joeThe exact scenario used split-at.
20:40tjohnson2059.
20:46black_joeNow this is either down to a logical error or just some facet of Clojure that I haven't been able to figure out.
20:46black_joehttp://pastie.org/4788419
20:46black_joeThe function returns false even though both halves of the string contain the character.
20:52black_joeAnd it seems that in the above snippet (str) on (first x) is actually a lazy sequence. I got that wrong on the debug.
20:52black_joeBut lazy-seq does not turn it into plain text.
20:57metellus,(str '(1 2))
20:57clojurebot"(1 2)"
20:58black_joeIn the example above (lazy-seq (str (first x))) becomes (c l o j u r e . l a n g . L a z y S e q @ 2 0 a 6 e)
20:58metelluswhy are you calling lazy-seq on it?
20:59black_joeI thought that turned a lazy sequence into text?
21:00metellusI don't know the particulars of lazy-seq, but that's not what it does
21:03metellusblack_joe: I think you'll be better off *only* functions on strings or *only* functions on seqs, rather than a mixture of them
21:04metellusso for example, you'd use .substring and then .contains
21:05black_joeAlright. I will use split here then.
21:06black_joeInstead of split-at.
21:06black_joeI read in "Clojure Programming" that since Strings are homoiconic with sequences it is good practice to make functions compatible with both.
21:08metellusthe problem is that (str (first x)) and (str (first (rest x))) aren't doing what you want them to do
21:09metellus(and if your function uses .contains on a string it's not really going to be compatible with sequences)
21:09metellusI'm not really good enough to Clojure to offer a better suggestion, though
21:10amalloywell, seqs have a .contains method too
21:10amalloybut i agree this isn't a good way to do it
21:10black_joeWell, either way, you've been helpful. I'm too new to Clojure to fully understand sequences or lazy sequences.
21:10metellus(.contains (str x)) isn't going to do what you want for any x that isn't a string, though
21:12black_joeWell, then I may just embed a let form and assign the string there.
21:12black_joeI'll play with these suggestions tomorrow.
21:12black_joeThanks for helping.
21:12metellushmm, it actually looks like his function will work if he gets rid of the (str ..)s he has everywhere
21:25mpanhow does slash for divide not conflict with namespacing?
21:27SegFaultAXmpan: What do you mean?
21:28mpanso I wanted keyword :/ but it wasn't allowed
21:29ivansee SLASH and CLOJURE_SLASH in LispReader.java
21:29mpanah, so it's special cased earlier on?
21:29ivanyes
21:29mpanah thanks
21:29tomojis it normal for clojure-dev membership to remain pending for some time after one's CA is received?
21:41mpansay I have a tree from which I make a zipper
21:41mpanis there a way to get a flat seq of zippers representing each tree elem?
21:42tomojmpan: if I understand what you mean, (->> z (iterate z/next) (take-while (complement z/end?)))
21:43tomojwhich, imo, would be nice to have in clojure.zip (as "nexts"?)
21:43mpancould you please explain how that works?
21:44mpanas in, the tree has both terminal and nonterminal nodes, similar to
21:44mpan[a [b c d] [e [f g h] [i j k]]]
21:45mpanthe actual tree is approx that layout, just with more metadata dumped into the leaves
21:54mpantomoj: got it to work. awesome! thanks!
21:55mpanit's got some extras in it, though
21:56mpanoh!
21:56mpanit's because it's interpreting the structure to mean something else
21:56mpan(as in, the zipper was constructed to mean something else)
21:58mpan(as in, I was interpreting the tree differently than vector-zip does)
21:59mpan[a b c] being 1 node w/ 3 children rather than 1 node w/ 2 children
22:41uvtcpppaul, are you getting a lot of rain where you are?
23:07mpanis there an equivalent of iterate for something really expensive that you don't want evaluated more often than necessary?
23:08mpanI think last time I ended up writing the iteration fn directly or something, but that seemed redundant
23:09shachafWhat's wrong with iterate for that?
23:09mpanthe lazy seq got evaluated in chunks
23:10mpanand a chunk is actually pretty significantly expensive when we don't want the rest of it
23:10shachafOh, I don't know how Clojure lazy seqs work.
23:10shachafI assumed it was like real lazy lists. :-(
23:10mpanI heard there was a way to get entirely lazy behavior
23:10mpanbut didn't hear what it was
23:10ChongLidoes this help:
23:10ChongLihttp://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/
23:10ChongLi?
23:11Hodappprobably oft-repeated question: how might I reliably achieve a Clojure REPL with functioning history?
23:11Hodappshort of tryclj.com
23:11shachafrlwrap?
23:11tomojshachaf: hey!
23:11Hodappat some point all answers are probably going to converge on "learn emacs"
23:12brehautHodapp: my lein2 repl has it out of the box
23:12tomojmpan: iterate is not chunked afaik
23:12QUACKALPACATRONshachaf, you are like that person that is everywhere
23:12QUACKALPACATRONwhat is her name again, emma or something like thast.
23:12tomoj&(do (first (map println (iterate inc 0))) nil)
23:12lazybot⇒ 0 nil
23:12Hodappbrehaut: silly question, can I easily get to a lein2 repl outside of a project?
23:12Hodappguess I could just make an empty one
23:12brehautyes
23:12mpanoh awesome
23:12brehautlein repl
23:12mpanwhat did that guy do last night with printing a whole chunk then?
23:13shachafhi tomoj
23:13Hodapphuh, for some reason I was thinking that wouldn't work, but it is working
23:13Hodappawesome
23:13shachafhi QUACKALPACATRON
23:13tomojdunno, was it my example? don't have a good sense of time
23:13tomoj&(do (first (map println (range))) nil)
23:13lazybot⇒ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 nil
23:13mpanah, map is causing chunking? iterate doesn't?
23:13mpanthanks!
23:13tomojno, (range) is chunked
23:13Hodappgawd, I am about to stab Eclipse though. If I enter in an open-quote, the lag for input in the file approaches seconds
23:14Hodappuntil I close that quote
23:14tomojmap inherits the chunkiness of its inputs
23:14mpanooh
23:14mpanthanks
23:21unlinkDoes clojure.java.jdbc support simultaneously operating on two different database connections?
23:27mpanis there an analogue of -> that keeps allows a chain of assocs?
23:27mpanor should I just use -> with a bunch of partial applications?
23:28mpanoh wait, I can precompute all my stuff, so I can just use assoc
23:29mpandoesn't strictly need the chaining order
23:38tomojhmm, chain of assocs?
23:40tomojlike assoc-in?
23:41mpansorry, along the other dimension
23:42mpanlike assoc with multiple pairs, except I had originally thought order mattered for me
23:42mpanlike, I would need to calc stuff after each assoc
23:43mpanturns much more cleanly into a let and an assoc
23:43mpanif I drop that requirement
23:50Hodappdamn, I dread going to bed... when I wake up, I have to walk into a job where immutability isn't kosher.
23:51shachafHodapp: Watch out for those people trying to mutate 4 into 3.
23:51tomojI never thought of it that way, but I guess I have the same problem
23:52Hodappstill working at 4clojure problems, but they are interesting for sure
23:52Hodappjust did the fibonacci one
23:53Hodapp,((fn [n] ((fn fib [m sum1 sum2] (if (> m 0) (cons sum1 (fib (- m 1) sum2 (+ sum1 sum2))))) n 1 1)) 20)
23:53clojurebot(1 1 2 3 5 ...)