#clojure log - Sep 23 2012

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:36 djanatyn: whoever wrote or contributed anything to hiccup, I *love* you

0:36 hiccup has made my life so much easier.

0:36 I 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

0:37 akhudek: weavejester has done a lot for the community, including hiccup :-)

0:37 djanatyn: I 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

0:37 I'll have to write him a thank you note and see if there's any bugs I could try to fix

0:38 akhudek: https://github.com/weavejester/hiccup/issues

0:55 duck1123: has anyone had an issue recently where nrepl.el doesn't give you the repl? All I get is a blank buffer

0:55 casion: are you using autocomplete?

0:56 duck1123: yes, I was trying to

0:56 casion: that happened to me as well

0:56 are you jacking in to a project or not?

0:56 duck1123: I start a nrepl connection when my server starts

0:57 then I connect to that

0:57 casion: that should work fine...

0:57 there's an issue with your ac-nrepl and/or autocomplete config

0:58 Sgeo: I should figure out the autocomplete stuff too

0:58 casion: autocomplete is a pain until lein prev 1 comes out :|

0:58 Sgeo: Hmm?

0:58 casion: lein 2.0 prev 1

0:58 because it has an old clojure-complete dependency for headless repls

0:58 Sgeo: I thought there were 10 previews already

0:59 casion: RC1

0:59 it's late :\

0:59 duck1123: The thing is, I tried using a clean .emacs.d (actually, I used starter kit) and I still had the issue

1:00 should I remove complete-core from my deps?

1:00 casion: no

1:00 did you use package.el for installing ac-nrepl and auto-complete?

1:00 duck1123: yes

1:00 eggsby: hmm, I have autocomplete and nrepl, but I had to install nrepl from git, not from marmalade

1:01 casion: do you have (package-intialize) in your .emacs?

1:01 duck1123: I believe so

1:01 ssh giving me issues, one sec

1:01 casion: ok

1:03 duck1123: I do have package-initialize

1:03 casion: can you paste the relevant portion of your .emacs?

1:03 the ac-nrepl had bad docs recently, but it was fixed iirc

1:04 maybe you somehow picked up that elisp though?

1:04 duck1123: which relevant portion?

1:04 casion: ac-nrepl and auto-complete config

1:06 duck1123: well, it's not working even with none of auto-complete set up

1:07 casion: you remove all of auto-complete config and it still chokes?

1:07 duck1123: yes

1:08 casion: if you clone and clear your emacs.d?

1:08 and I assume lein repl works fine?

1:09 and or connecting to lein repl :headless

1:11 duck1123: Ok, I just wiped my config, added marmalade, installed clojure-mode and nrepl and it's still doing it

1:12 casion: lein repl works ok?

1:12 duck1123: it says it started the server

1:12 trying to connect

1:13 Wrong type argument: integer-or-marker-p, nil

1:14 casion: are you using emacs 23?

1:14 duck1123: GNU Emacs 24.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-07-17 on lawrencium, modified by Debian

1:15 this worked earlier today

1:16 clj_newb_2345_: argh

1:16 casion: only thing I can think of is increasing the timeout or retry limit

1:16 clj_newb_2345_: has anyoe in the world gotten lein + swt + osx ot work together?

1:16 casion: but I don't recall exactly now to do that in lein

1:16 yes clj_newb_2345, and it's a pain

1:16 clj_newb_2345_: I've already passed it -XstartOnFirstThread

1:16 has a jvm-opts

1:16 yet it still bitches about not on main thread

1:16 duck1123: but wouldn't that only apply if I was using jack-in?

1:17 clj_newb_2345_: casion: do ou have a working project.clj I can copy?

1:17 casion: duck1123: I don't think so

1:17 clj_newb_2345: I do not currently

1:17 clj_newb_2345: this thing basically looks imposisble

1:17 casion: that project is currently in a fubar state

1:17 clj_newb_2345: i don't even know how to check if a given thread is the main thread

1:17 casion: and I started to learn seesaw instead

1:18 clj_newb_2345: what project

1:18 ?

1:18 i manually insatlled swt.jar via maven

1:18 duck1123: clj_newb_2345: check out seesaw, I beleive he's solved all the annoying bits

1:19 clj_newb_2345: i neet swt

1:19 in order to embed a webview

1:19 duck1123: oh well, I'll fix nrepl later, the wife hasn't seen the new doctor who yet

1:19 seesaw is a wrapper

1:20 casion: https://github.com/CMPITG/clojure-swt-examples

1:20 that is what I followed/worked with getting swt working

1:21 clj_newb_2345: that is linux only

1:21 casion: you have to find the osx swt dependency yourself and make a local repository to pull from

1:21 at least that's what I did

1:21 (and it subsequently broke…)

1:26 clj_newb_2345: i've done all that

1:26 I don't think you've heard me clearly

1:27 i've installed swt.jar manually, I've included "-XstartOnFirstThread in jvm-opts, but it still bitches that it's not on mthe main thread

1:32 alright; I got swt + clojure working

1:32 unfortunately, just not with lein

1:33 casion: what did you do?

1:37 McFritzen: clj_newb_2345, do you believe that Flash is the best SC2 player?

1:38 clj_newb_2345: ?

1:38 I think you have me confused with someone else.

1:38 so I currently have swt + clojure working, but I can't use it via lein.

1:38 java -cp clojure.jar clojure.main <-- starts a repl. Is there a way to have clojure.jar start out by loading another file instead?

1:39 i.e. something like java -cp clojure.jar my-main.clj

1:39 McFritzen: clj_newb_2345, not at all, I have no idea who you are namely.

1:41 rlb: clj_newb_2345: java -cp ... clojure.main foo.clj

1:43 clj_newb_2345: rlb: I need "-i foo.clj"

1:44 http://clojure.org/repl_and_main

1:44 now, I need to do one last thing: somehow tell clojure.main to search for class 'foo" in src/foo

1:44 rather than "./foo"

1:44 what is the option that tells clojure where to search for *.clj files?

1:45 Sgeo: Do the suggested keybindings for org-mode conflict with nrepl.el or slime?

1:50 shachaf: Sgeo: Fancy seeing you here!

1:50 * shachaf would never've expected it.

1:50 Sgeo: shachaf, I guess you're new to my language hopping and obsession.

1:52 scottj: Sgeo: Are you planning on doing org-babel?

1:52 Sgeo: scottj, I don't know what that is

1:54 clj_newb_2345: *compile-path* = "classes"

1:54 how do I tell clojure hwere to search for *.clj files

1:55 scottj: Sgeo: I don't think the global org-mode bindings conflict.

1:58 samrat: the clj-oauth docs seems to be outdated, how do I use it with clj-http instead of clj-apache-http?

2:16 wei_: is this the proper place for clojurescript questions? how would I translate "OAuth.SignatureMethod.sign(message, accessor);" to clojurescript?

2:19 Sgeo: C-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

2:19 minibuffer

2:27 unlink: Why isn't it unspeakably bad practice to use other people's namespaces for their own projects?

2:38 scottj: Sgeo: you tried opening project.clj and starting it from there and it doesn't work?

2:39 Sgeo: scottj, hadn't tried that

2:40 amalloy: unlink: huh?

2:41 Sgeo: scottj, is that the typical usage?

2:41 Rather than C-u M-x nrepl-jack-in?

2:41 Doesn't seem to have worked

2:42 scottj: Sgeo: idk, I don't use nrepl, was just a guess I thought slime-jack-in behaved that way

2:44 Sgeo: I guess start nrepl with lein from terminal and then M-x nrepl to connect

2:45 that's what I do (except lein swank and M-x slime-connect)

2:45 * Sgeo is wondering if he should just use ritz

2:46 Sgeo: It might actually be easier

2:47 scottj: I 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.

2:47 Sgeo: are you coming from Haskell? what editor did you use there?

2:48 Sgeo: Mostly gedit (I was on Ubuntu)

2:48 And sometimes JEdit when I was on Windows

2:48 (at school)

2:49 I do want some of the functionality that ritz claims to offer

2:49 Especially project.clj reloading. And is it offering to allow resuming from an exception?

2:50 SegFaultAX: Does anyone know anything about high frequency trading?

2:50 Sgeo: Also, will l the version of SLIME it uses conflict with recommended versions of SLIME if I want to try Common Lisp again?

2:51 djanatyn: ,(let [seconds 72010, hours (mod seconds 3600), minutes (mod (- seconds (* hours 3600)) 60)] (- seconds (+ (* hours 3600) (* minutes 60))))

2:51 clojurebot: 35410

2:51 djanatyn: :| I don't understand what I'm doing wrong here

2:51 scottj: SegFaultAX: anything is pretty broad :)

2:52 djanatyn: ,(let [seconds 72010, hours (mod seconds 3600), minutes (mod (- seconds (* hours 3600)) 60)] {:hours hours :minutes minutes :seconds (- seconds (+ (* hours 3600) (* minutes 60))))

2:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

2:52 djanatyn: ,(let [seconds 72010, hours (mod seconds 3600), minutes (mod (- seconds (* hours 3600)) 60)] {:hours hours :minutes minutes :seconds (- seconds (+ (* hours 3600) (* minutes 60)))})

2:52 clojurebot: {:hours 10, :minutes 10, :seconds 35410}

2:52 djanatyn: the hours and minutes are right, but I don't know what I'm doing wrong with the seconds

2:52 SegFaultAX: scottj: I'm cursious if it's possible for a person to get into it, or if it's reserved for large institutions.

2:53 scottj: Sgeo: 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)

2:53 SegFaultAX: I think it's very hard for an individual to do.

2:54 SegFaultAX: 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.

2:54 SegFaultAX: What if I just wanted to do "pretty-fast frequency trading?"

2:54 scottj: SegFaultAX: btw I've never worked in HFT, so this is all just my impression

2:55 SegFaultAX: well you can do day trading, but I think the strats used by HFT require very fast responses (<1ms maybe)

2:56 SegFaultAX: scottj: Maybe day trading is what I mean.

2:57 scottj: Mostly just algorithmic trading. HFT is probably the wrong word, then.

2:58 amalloy: djanatyn: i think the hours are only right by coincidence

2:58 (mod seconds

2:58 3600) doesn't divide by 3600, it gives the remainder

2:58 scottj: SegFaultAX: 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)

2:58 djanatyn: doh. thanks!

2:59 amalloy: you want rem, or div; i don't think there's a difference for positive numbers

2:59 SegFaultAX: scottj: Well, I'm thinking it might be a fun hobby application of FP.

3:00 scottj: A couple thousand is a reasonable margin for me. I'm not looking to make this my day job.

3:01 scottj: I'm working up some prototypes of using core.logic for this sort of thing.

3:02 scottj: SegFaultAX: interactivebrokers.com is what the small day dtraders use I believe, it has a java api iirc

3:02 and a simulation mode

3:04 SegFaultAX: there's a wrapper on clojars, not sure how complete it is (probably not very, it's 0.0.1)

3:05 SegFaultAX: It costs $10k just to open an account?!

3:06 Pft, maybe I should think of a different hobby.

3:07 Oh, $3k for ages 26 or younger. Sweet.

3:17 scottj: SegFaultAX: out of curiousity, what instruments are you thinking about trading?

3:18 SegFaultAX: scottj: Umm, pianos, trumpets and clarinets.

3:18 I don't know what you're asking. :)

3:18 Stocks?

3:20 scottj: yeah that was basically the question

3:20 SegFaultAX: Well then, stocks.

3:21 scottj: When I was much younger, my dad and I played around with futures. I don't remember much, though.

3:25 Is Scala worth learning?

3:25 It just looks so... ugly.

3:47 amalloy: SegFaultAX: depends what you've already learned, i suppose. ugly is a terrible reason either way; lots of people think clojure is ugly

3:47 Sgeo: Can nREPL servers be secured with passwords, or otherwise made safely Internet-accessible?

3:53 luxbock: http://www.4clojure.com/problem/166

3:53 could someone help me out with this one?

3:53 "Write a function that takes three arguments, a less than operator for the data and two items to compare."

3:54 I'm confused if the function I

3:55 I'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

3:56 SegFaultAX: luxbock: But the problem gives you the less-than function to use.

3:58 amalloy: is it clearer if i switch it to: "three arguments: ..."?

3:59 luxbock: hmm, not sure if I follow

3:59 SegFaultAX: luxbock: Do you understand the problem statement?

4:00 luxbock: not really

4:00 SegFaultAX: luxbock: Well, we know we're going to receive 3 arguments to our function

4:00 mpstyler: .

4:00 SegFaultAX: The first will be a comparator function, and the second/third will be the operands.

4:01 luxbock: right, so in the first example the first argument is "<", in the second it is "(fn [x y] (< (count x) (count y)))" and so on?

4:01 SegFaultAX: luxbock: So what might out function signature look like?

4:01 (fn [f a b] ...) perhaps?

4:02 Or (fn [lt a b] ...) if it makes it clearer that it's a less-than function

4:02 luxbock: yes, I tried fn [f a b] (cond (f a b) :gt approach at first, but that failed for the second example

4:03 SegFaultAX: What was your full solution?

4:04 luxbock: hmm, I was doing it yesterday and don't have it typed up anymore

4:04 but I realize it wasn't a working solution

4:04 SegFaultAX: Well, what are the 3 possible conditions?

4:05 a > b, a < b, a == b

4:05 luxbock: right

4:05 SegFaultAX: But we only have the 1 operator

4:05 So how can we derive the other 2?

4:07 luxbock: oh, is the description saying that I'm not allowed to use > or ==?

4:07 SegFaultAX: luxbock: They aren't given.

4:07 luxbock: ah I see

4:07 SegFaultAX: luxbock: You just have the one, but you need to be able to figure out the other two from that one.

4:08 luxbock: ok got it, I should be able to do that with cond

4:08 or do I need some other trickery_

4:08 SegFaultAX: luxbock: Try it.

4:09 luxbock: alright

4:14 SegFaultAX: luxbock: Any luck?

4:15 luxbock: not quite, this problem is making me feel stupid

4:16 SegFaultAX: luxbock: Can you solve just the first one?

4:20 luxbock: well 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

4:20 SegFaultAX: Why don't you use f if you know it's your less-than function?

4:21 luxbock: oh right

4:22 mpan: is 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

4:22 would prefer not to introduce a heavier dependency

4:23 luxbock: SegFaultAX, got it now

4:23 thanks

4:25 looks like most people solved it by using "if" rather than "cond", but I think "cond" makes for more readable code

4:25 I guess it's pretty much the same thing

4:25 mpan: oh, dunno how I missed it, but there's almost the exact name

4:25 SegFaultAX: luxbock: I like cond better there too.

4:28 mpan: in 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

4:28 lazybot: Nooooo, 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.

4:28 mpan: even better

4:29 wow that bot's good

4:29 (inc lazybot)

4:29 lazybot: ⇒ 7

5:04 wunki: anyone have a clue why I get the following stacktrace when I try to jump to definition in Emacs (nrepl): https://gist.github.com/ce48e26f08d9c9a7806f ?

5:29 piranha: Hi 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).

5:38 mpan: can anyone explain at a high level how "going up the tree" works in zippers?

5:42 Sgeo: The zipper stores not just what's below you, but also what's above you... kind of

5:42 The 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"

5:43 mpan: like a "how I got here"?

5:43 Sgeo: Pretty much. (Please note that I may be mistaken in parts of my explanation)

5:43 mpan: because the underlying structure I'm expecting to feed in has an innate concept of "down" but not "up"

5:43 Sgeo: Try actually displaying a zipper at the REPL

5:44 ludston: ? Wouldn't Zippers just be doubly linked lists?

5:45 Sgeo: Well, with a zipper, you need "where you are" to be the most efficient thing to access.

5:45 There's no mutability involved

5:45 hmm, what to do

5:46 It's more like gluing together two lists, than a doubly-linked lists

5:46 ludston: You mean like an iterator on a node of a doubly linked list?

5:46 Sgeo: Two singly-linked lists

5:46 (But that analogy doesn't do well with trees, just what zippers are like on lists)

5:46 &(require '[clojure.zip :as zip])

5:46 lazybot: ⇒ nil

5:47 Sgeo: &(zip/vector-zip [:a :b :c :d :e])

5:47 lazybot: ⇒ [[:a :b :c :d :e] nil]

5:47 mpan: huh? the bot lets you mess with its namespaces?

5:47 Sgeo: &(-> (zip/vector-zip [:a :b :c :d :e])) zip/down

5:47 lazybot: ⇒ [[:a :b :c :d :e] nil]

5:47 Sgeo: &(-> (zip/vector-zip [:a :b :c :d :e]) zip/down)

5:47 lazybot: ⇒ [:a {:l [], :pnodes [[:a :b :c :d :e]], :ppath nil, :r (:b :c :d :e)}]

5:48 Sgeo: Uh... 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?

5:49 &(-> (zip/vector-zip [:a :b :c :d :e]) zip/down zip/right)

5:49 lazybot: ⇒ [:b {:l [:a], :pnodes [[:a :b :c :d :e]], :ppath nil, :r (:c :d :e)}]

5:49 mpan: huh?

5:49 where's "up"?

5:49 Sgeo: You 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

5:49 mpan, I guess that's in the :pnodes key

5:49 ludston: Okay, so it's a tree where nodes have pointers to their root.

5:50 Why's it called a zipper?

5:50 mpan: is this like, the tree that has :a through :e as direct children of the root?

5:51 Sgeo: It 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

5:52 &(-> (zip/vector-zip [[:a :b :c] [:d :e :f]]) zip/down zip/down)

5:52 lazybot: ⇒ [: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)}]

5:52 mpan: kind of the illusion of imperative moving?

5:52 that's pretty cool

5:52 Sgeo: mpan, yeah, that's a good way to put it, I ... think

5:53 Each direction movement can be done in O(1) time (I think)

5:54 &(-> (zip/vector-zip [:a :b :c :d :e]) zip/down zip/right zip/path)

5:54 lazybot: ⇒ [[:a :b :c :d :e]]

5:54 Sgeo: &(-> (zip/vector-zip [[:a :b :c] [:d :e :f]]) zip/down zip/down zip/path)

5:54 lazybot: ⇒ [[[:a :b :c] [:d :e :f]] [:a :b :c]]

5:54 Sgeo: ...I have no idea about the internal structure of this thing

5:54 There may be some good Haskell guides to this stuff, but they're in terms of Haskell

5:59 Raynes: Sgeo: Do you sleep?

6:24 Sgeo: Raynes, not at sane times.

6:24 Raynes: Sgeo: Word.

6:24 Sgeo: It is currently 6:20 AM

6:25 My time

6:27 mpan: is there a way to pass to map the current fn I'm in [analogous to recur]?

6:28 it's for a function that recursively converts a tree-like structure to a string by some domain logic

6:34 Raynes: mpan: Just pass it in?

6:35 I don't understand your problem.

6:35 mpan: I would like to pass it in a way that doesn't consume stack

6:35 although, now I'm beginning to wonder if that's an actual concern here

6:43 luxbock: can anonymous functions call themselves?

6:44 Raynes: Yes.

6:44 luxbock: how?

6:44 clojurebot: with style and grace

6:44 luxbock: heh

6:44 Raynes: &(fn foo [x] (foo x))

6:44 lazybot: ⇒ (serializable.fn/fn foo [x] (foo x))

6:44 Raynes: lol

6:44 I wonder who require'd serializable-fn.

6:45 $login

6:45 lazybot: You've been logged in.

6:45 Raynes: $reload

6:45 lazybot: Reloaded successfully.

6:45 Raynes: &(fn foo [x] (foo x))

6:45 lazybot: ⇒ #<sandbox103110$eval106402$foo__106403 sandbox103110$eval106402$foo__106403@3950bb>

6:46 Sgeo: luxbock, even without that bit of syntax, there's a thing called the Y-combinator

6:46 Which would allow for it

6:46 mpan: I keep thinking I need something trampoline-like /outside/ the map

6:46 luxbock: yeah I read about Y-combinator once and it sounded really complicated

6:46 Sgeo: And even if that didn't exist, which it does, there's also some possible macrology

6:47 mpan: since F kind of depends on mapping F onto its inputs

6:47 luxbock: but 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?

6:47 or is that just a matter of semantics

6:47 mpan: but the name only exists inside?

6:48 Raynes: It's anonymous to the outside world.

6:48 luxbock: I see

7:01 Sgeo: https://github.com/pallet/ritz/tree/develop/swank

7:01 I don't understand the jack-in thing.

7:02 It says SLIME cannot be installed. But what use is SWANK without a UI like SLIME? What does jacking-in do, exaclly, without SLIME?

7:12 :( M-x pacakge-install-file apparently requires tar?

8:06 mpenet: yup

8:07 Sgeo: Am I going to end up bouncing between cursing at emacs and cursing at Eclipse?

8:08 mpenet: well you can continue to bounce between editors and curse after 5 min everytime, or do it properly and be done with it

8:08 I don't think installing tar on windows is so hard

8:41 samrat: how do I sign API requests with clj-http? could someone provide any examples(I'm using clj-oauth)

8:46 broquaint: Sgeo: There's always Gow (Gnu on Windows) for tar et al - https://github.com/bmatzelle/gow/downloads

8:46 mpenet: reduce-kv doesn't work on java HashMaps (or even Maps I think) :( any good reason for that?

8:51 broquaint: mpenet: 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.

8:51 Sgeo: broquaint, I found a tar, that worked, but the install had some problems

8:53 mpenet: yup figured that much, I was wondering if that would justify an issue or not, if this was by design

8:55 broquaint: It's just the nature of interop I suppose.

8:56 Sgeo: FWIW I installed Gow + Emacs and found stuff Just Worked.

9:44 green_transistor: well this place is quiet

9:46 ludston: green_transistor: If you ask a question, I'll say hi.

9:47 green_transistor: whats up with reducers in clojure? :)

9:47 ludston: green_transistor: hi

9:47 green_transistor: indeed :)

9:48 ludston: green_transistor: What's a reducer?

9:49 green_transistor: There 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

9:49 so he says map will be implemented using reduce.. i pretty much lost him there

9:51 ludston: green_transistor: We have a cruel god.

9:52 green_transistor: haah in what context?

9:53 ludston: green_transistor: I mean the guy that writes Clojure, using his smarts to bend our minds.

9:53 green_transistor: ah subtle. his stuff is pretty radical :)

9:56 And why does *inferior-lisp-mode* suck so bad on emacs?

9:58 ludston: green_transistor: That's the common lisp mode isn't it? Nothing to do with clojure...

10:06 green_transistor: well it sucks for elisp :) no auto-complete

10:19 megamind: wat do you think of clojure ?

10:21 ivan: megamind: #clojure might be a little biased. in the right way.

10:22 Scriptor: are you conidering learning it, megamind?

10:22 megamind: it's my intend to ask for positive things here

11:01 duck1123: oh well, it looks like I'm back to swank for the time being

11:56 * gfredericks regrets not registering for ELC

11:57 technomancy: it's good

12:01 SrPx: Hey 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:02 technomancy: SrPx: probably lein-tarsier?

12:02 SrPx: technomancy: yes eh, far from leph heh. Thanks

12:03 gfredericks: all new languages are at best an inspiration for a new clojure library: discuss

12:03 technomancy: well I don't actually know anything about vim, so don't thank me till it works

12:05 hiredman: gfredericks: the presentation coming up is another lisp

12:07 gfredericks: hiredman: oh crap

12:10 SrPx: new-host-8:bundle srpx$ lein vimclojure Couldn't find project.clj, which is needed for vimclojure

12:10 any idea ?

12:11 Oh 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:11 let me see

12:13 ToxicFrog: Yeah, that message is telling you that you actually need a lein project before you can use lein vimclojure

12:13 So, exactly as you said

12:22 SrPx: Thanks

12:22 I'm almost there, getting just this error when I open a project:

12:23 http://o7.no/O2LRzD telling ng is misconfigured, I'm not sure what I have done, just created a project on -/Clojure/my-stuff

12:26 * gfredericks reads the blog post on Plan

12:27 hiredman: I call "meh" on Plan

12:27 redline6561: +1

12:28 SrPx: worked, thanks ! (=

12:28 swarmer: what's Plan?

12:28 gfredericks: a friend of mine in there says something similar: optional parens + confusing type system

12:28 swarmer language that was discussed at EML

12:28 redline6561: wow

12:28 gfredericks: EMC

12:28 ELC

12:28 emerging languages camp

12:28 * gfredericks gives up

12:30 gfredericks: I'm trying to make a serious effort to learn haskell while I'm here

12:45 samrat: having some Noir trouble: https://www.refheap.com/paste/5249, the session seems to somehow get cleared up. how do I prevent that?

13:25 Hodapp: apparently, 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:26 ,(iterate (fn [x] (+ x 1)) 1)

13:26 clojurebot: (1 2 3 4 5 ...)

13:26 Hodapp: hrmph

13:30 does Emacs handle lazy sequences okay?

13:30 casion: I thought lazy sequences were always forced in the repl

13:30 unless you have some specific wrapping

13:31 mpenet: Hodapp: same with emacs/slime

13:31 Hodapp: mpenet: same as in same as CCW, or same as clojurebot?

13:32 casion: clojurebot forces the lazy seq too

13:32 mpenet: Hodapp: same as CCW

13:32 Hodapp: casion: but right here it's only bothered with 5 elements

13:33 mpenet: probably the clojail doing its magic

13:33 Hodapp: ahh, hmm

13:33 casion: I believe so

13:33 Hodapp: I think it was maybe just SBCL or CMUCL or something that showed lazy sequences un-forced in its REPL

13:33 mpenet: I wouldn't know

13:34 jkkramer: Hodapp: (set! *print-length* 103)

13:34 Hodapp: oooh

13:34 jkkramer: also, *print-level*

13:35 Hodapp: thanks, good to know

13:42 rich_: 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:56 firesofmay: xeqi, hey, is there a way to turn off lein-pedantic for a given project?

13:57 Hodapp: hmm... wondering if I should actually try to make a lazy object such that (tree child) equals tree, or just not to bother

14:05 since I've also emerged with some annoying mutually recursive cases

14:05 where I might just have to store a reference to something rather than trying to use it directly, bleah

14:08 this is a case where statefulness almost makes things easier 9_9

14:50 xeqi: firesofmay: you could comment it out of your profiles.clj; or setting :pedantic :warn in your project.clj will make it warn only

14:50 firesofmay: xeqi, yeah I commented it out for now. thanks :)

14:51 xeqi: thats what I do, just comment/uncomment as needed

14:51 jro__: 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:51 technomancy: `lein with-profile pedantic some-task`

14:52 Hodapp: Here 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:52 xeqi: technomancy, firesofmay: haha, or that

14:53 jro__: (future (logger/log (rebuild-index))) ?

14:53 firesofmay: technomancy, interesing. thanks

14:53 interesting*

14:53 technomancy: firesofmay: not that it exists, but if you move it from the :user profile to the :pedantic profile it would work

14:54 plus you could add :aliases {"pedantically" ["with-profile" "pedantic"]}

14:54 jro__: xeqi: thanks. Future dispatch that to a threadpool, which does not interfere with existing threads that are serving http threads?

14:54 firesofmay: technomancy, okay.

14:57 jro__: Programming Clojure / Emerick index points to me that "future" is something related to "ClojureScript", "ClojureCLR", "Heroku", "Overtone"... :-)

14:58 cemerick: jro__: Take a look at the entry for DSL :-P

14:58 The index was one place that we didn't have a hand in.

14:58 xeqi: jro__: it dispatches to the agent send-off pool, so I don't expect it to interfere with other threads

15:00 jro__: cemerick: lol DSL -> (Digital Subscriber Line) versus Korma, 500

15:01 but the content of the book is good! Thanks, if you were involved with it.

15:02 cemerick: jro__: I'm the 'Emerick' part. :-P

16:02 cheburaksha: I'm trying to install Leiningen 2 on windows, so far not so good

16:02 Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core__init.class or leiningen/core.clj on classpath:

16:03 technomancy: cheburaksha: some code is expecting lein1

16:07 cheburaksha: technomancy: how did you determine that? inside the leiningen-2.0.0-preview10-standalone.jar there is a leiningen/core.clj

16:09 RonnieDk: cheburaksha: I installed Leiningen on Windows a few days back without any issues

16:10 technomancy: cheburaksha: where did you get that jar? core.clj hasn't existed since 1.x.

16:14 cheburaksha: technomancy: 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:16 technomancy: yeah, that's definitely not going to work

16:20 cheburaksha: RonnieDk: did you install it using cygwin or cmd?

16:20 im doing it the cmd way, not a lot of info on the web for installing leiningen2 that way

16:20 RonnieDk: cheburaksha: The cmd

16:20 cheburaksha: you're using the self-installer, right?

16:23 cheburaksha: basically downloading wget manually and putting it in the current path, and they running the self-installer, if I remember correctly

16:23 cheburaksha: i 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:23 RonnieDk: cheburaksha: modify lein? Why not download from github?

16:23 technomancy: ...?

16:24 RonnieDk: cheburaksha: you should get the latests from here: https://raw.github.com/technomancy/leiningen/preview/bin/lein

16:26 technomancy: are there programs where you can do stuff like that and it would actually work?

16:32 RonnieDk: cheburaksha: Oops, wrong link. That's not the DOS cmd file. Add .bat at the end

16:34 cheburaksha: RonnieDk: 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:35 RonnieDk: wget the link

16:37 technomancy: How come you don't link to the bat file on the github page?

16:38 cheburaksha: that's what im asking, it's like an underground link, hidden from unsuspecting noobs

16:38 hiredman: technomancy: 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:40 cheburaksha: and if you go to the directory above, it doesn't exist. weird

16:40 RonnieDk: c

16:41 cheburaksha: If you navigate to the folder where lein (the bash version) is you discover that bat file. That's how I found it

16:43 cheburaksha: https://github.com/technomancy/leiningen/tree/master/bin

16:45 cheburaksha: oh, i c. cool, thanks :)

16:45 technomancy: RonnieDk: it is linked from the readme

16:45 RonnieDk: cheburaksha: So if you go with the bat file and setup emacs with marmelade, I haven't had any issues using Windows

16:47 technomancy: Ah, yes. Sorry

16:52 aib: what's the syntax for referring to a static function? (let [trunc #((if (< % 0) Math/ceil Math/floor) %)] (trunc -1.5))

16:54 broquaint: Yes? http://clojure.org/java_interop

16:54 mpan: is there another name to use for passing + as a fn that doesn't confuse ccw+eclipse?

16:55 aib: broquaint: => Math/floor ;CompilerException java.lang.RuntimeException: Unable to find static field: floor in class java.lang.Math, compiling:(NO_SOURCE_PATH:1)

16:58 mpan: is there a way to partially apply a macro?

16:58 (that sounds so strange to ask)

16:58 technomancy: unfortunately no; macros aren't really first-class

16:58 mpan: what's the closest work-around?

16:59 this is what I would have liked to write: (def soln-count (partial tree-reduce (constantly 1) +))

16:59 where tree-reduce is a macro I need to fix

17:01 would apply help?

17:02 aib: mpan: maybe another macro?

17:02 mpan: aib: hm?

17:02 technomancy: it's best to implement the bulk of your macro in a function, then make the macro a trivial wrapper around the function

17:02 AimHere: Another macro? That's one of those 'Now he has two problems' solutions? ;)

17:03 aib: yeah. I'd go for nth-order functions myself

17:03 mpan: currently, the macro substitutes 2 functions into place in an otherwise constant structure

17:03 this is what I currently have (by far not working): https://www.refheap.com/paste/5257

17:04 what's the recommended way to do this?

17:05 hiredman: there is no reason for that to be a macro

17:05 write it as a function

17:06 mpan: oh, good point

17:06 I'm confused about my train of thought that led here, then

17:06 at some point earlier, I did think to myself I couldn't get what I wanted from just higher order functions

17:06 thank you

17:13 how 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:13 jro__: 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:14 mpan: like, doing it recursively works, but every node at depth d gets hit d times

17:14 jro__: I've tried (defmacro with-exceptions [action] `(try ~action (catch Exception e#)... but I end up to arity problems.

17:15 casion: mpan: are you using zippers?

17:16 mpan: not currently but considered the possibility I might end up needing them

17:17 I 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:18 casion: how would you like the distrobution to occur?

17:18 mpan: uh, not sure, but the current plan is

17:19 pass in a probability mass generating function, and weighted according to the mass over total mass

17:19 or, perhaps, just uniform

17:19 broquaint: aib: Right, yeah, the field/method distinction is annoying, you'll probably need another layer of indirection :/

17:19 casion: mpan: I assume you don't know the depth of the current node?

17:20 aib: I'll make do with #(Math/floor %) for now :/

17:20 mpan: not unless I specifically make a note to know

17:20 as in, I'm always starting this computation at the root

17:21 casion: you could just create a collection of 'random' traversal functions

17:21 but that does assume you know the depth to allow for a distribution towards the middle of the tree

17:22 mpan: the tree is likely to be terribly imbalanced

17:22 so local decision-making is risky

17:23 jro__: I would like to have something generic: (defn wrapped-json-exceptions [& args] (with-exceptions (apply json-response args)))

17:24 strax: hey guys, how do you change a character at a certain index in a string?

17:25 casion: mpan: I think you have to simply traverse the tree with an arbitrary/random termination point

17:26 mpan: the question is how to get a uniform or per-node probability mass

17:26 in a way that doesn't hit every node at depth d a total of d times

17:26 casion: I can think of ways to do it if you have an implicitly 'flat' tree (like an array indexed tree in C)

17:27 mpan: I'm trying to think (from domain knowledge) the max reasonable depth

17:28 casion: if you have a way of a way of treating the tree, or a branch as flat then you can get uniform distribution

17:28 maybe using zip/next to an arbitrary termination?

17:29 * casion shrugs

17:29 mpan: I mean, suppose I wish to explicitly flatten it

17:29 how would I preserve the ability to go back in and change the subtree?

17:29 jro__: strax: catenating a string from beginning to CharAt, then charAt, and then appending

17:30 casion: mpan: with zippers you can store a loc, or do a depth first walk

17:31 but the former doesn't really help if you've explicitly flattened it, and the latter removes the need to

17:31 mpan: the first part sounds like it

17:31 thank you

17:49 I'm at a breakpoint inside a function in eclipse-ccw; how do I see the args?

17:50 or the local bindings as I make them? or the intermediate values of subexprs?

17:50 I have no idea what I did but they started showing up o_o

17:53 Raynes: mpan: I was going to suggest you try praying.'

17:54 mpan: Raynes: it may have been I was at the edge of it and not actually IN the function

17:58 lpvb: Is there good autocomplete for clojure

18:01 technomancy: lpvb: sure; lein repl in 2.x has it

18:02 lpvb: I mean, autocomplete for vim

18:02 sorry

18:05 black_joe: I'm getting an error relating to java.lang.String when I try to run a function called "getBetween".

18:05 This is the offending line: (let [x (doto string (.substring 0 (+ 1 (.indexOf charBetween))))]

18:06 It says there is no matching field named indexOf for class String.

18:06 But there obviously is.

18:07 raek_: black_joe: 'doto' won't add the "string" symbol to the .indexOf call

18:07 hiredman: are you should it said class String?

18:07 and are you sure charBetween is a char?

18:07 raek_: ,(macroexpand-1 '(doto string (.substring 0 (+ 1 (.indexOf charBetween))))

18:07 metellus: "doto string" will insert string into consecutive forms, not nested ones

18:07 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

18:07 raek_: ,(macroexpand-1 '(doto string (.substring 0 (+ 1 (.indexOf charBetween)))))

18:07 clojurebot: (clojure.core/let [G__54 string] (.substring G__54 0 (+ 1 (.indexOf charBetween))) G__54)

18:08 lpvb: which book is better for someone who knows a bit of haskell and java: joy of clojure or programming clojure?

18:08 black_joe: I am sure that it is String. Not that it is a char.

18:08 Let me just make sure.

18:09 raek_: black_joe: so in this case I would just write (let [x (.substring string 0 (inc (.indexOf string char-between)))] ...)

18:09 black_joe: It also fails with a character.

18:09 Same reason.

18:10 metellus: black_joe: the problem is that that's not how doto works

18:10 raek_: black_joe: doto only inserts "string" into the outermost call

18:10 (.indexOf charBetween) remains the way it is

18:11 black_joe: Ah. I consulted the doto documentation and the wording was a bit confusing. That explains it.

18:11 antonaut: Hi! 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:11 raek_: and you get an error because you try to call (.indexOf charBetween) instead of (.indexOf string charBetween)

18:11 black_joe: I thought it took and object and ran every other method on that object.

18:13 technomancy: antonaut: the swank-clojure readme has a good overview of the commands it provides

18:14 antonaut: technomancy: thank you!

18:16 technomancy: sure

18:18 raek_: black_joe: it adds the object to each call in a sequence of calls, not to arbitrarily nested calls

18:18 you usually use it for methods that have side-effects

18:19 ,(doto (ArrayList.) (.add 1) (.add 2) (.add 3))

18:19 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ArrayList, compiling:(NO_SOURCE_PATH:0)>

18:19 raek_: black_joe: also, it returns the object and not the result of any of the method calls

18:20 black_joe: Well I think I'll just try to do this with sequences instead of strings then.

18:20 raek_: the above example expands into (let [foo (ArrayList.)] (.add foo 1) (.add foo 2) (.add foo 3) foo)

18:20 black_joe: there's no reason to abandon the String approach...

18:21 but you don't need doto in order to make a simple method call

18:21 black_joe: Well, even with the code you supplied it still fails. So I am going for an alternative.

18:22 jhowarth: With korma, is it possible to order by the count of an association?

18:23 raek_: ,(let [s "foo bar"] (.substring s 0 (inc (.indexOf s " ")))

18:23 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

18:23 raek_: ,(let [s "foo bar"] (.substring s 0 (inc (.indexOf s " "))))

18:23 clojurebot: "foo "

18:23 raek_: black_joe: ^

18:23 black_joe: it's probably easier to use regexes here, though

18:24 black_joe: Regexes are on my list. I just haven't learned them well enough.

18:26 raek_: but it depends on what you are trying to do

18:27 black_joe: In this context it is used to remove an internal comment from commands a bot reads from a file.

18:28 The file itself uses a LOT of markup, so I will probably learn regex before the rewrite is through.

18:30 nybbles_: 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:32 mpenet: nybbles_: are you using lein-cljsbuild ?

18:33 nybbles_: yuppp

18:34 mpenet: and jayq is in the list of dependencies of course?

18:35 nybbles_: yes in project.clj, under :dependencies

18:35 although thats strange, its in there with all the clj deps too

18:36 mpenet: if you just added it and are using lein cljsbuild auto you might need to relaunch it, also try lein cljsbuild clean before

18:36 nybbles_: ah okay

18:36 will try the clean thing

18:37 great, thanks :)

18:37 clean/auto did it

18:37 mpenet: you're welcome

18:52 mpan: is there a way to unpack args, or should I go and use apply?

18:54 firesofmay: what 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:54 [lein-marginalia "0.7.1"]]}})

18:55 :profiles {:dev {:dependencies [[midje "1.4.0"]

18:55 [lein-marginalia "0.7.1"]]}})

18:55 technomancy: firesofmay: :plugins rather than dependencies

18:56 for lein-marginalia anyway

18:56 firesofmay: technomancy, oh so I should add it to my user profiles?

18:59 technomancy, thanks. that worked.

19:07 * djanatyn installs midje and plays around with it

19:10 firesofmay: Hi, when I do lein marg, I ge this : "WARNING: conj-dependencies is deprecated." What does it mean?

19:11 I get* this

19:15 djanatyn: can 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:20 mpan: could 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:22 it ends up str'ing it directly instead of passing it through the argument fn first

19:27 seems to me it's behaving differently with the same args depending of called directly or recursively, but that must be my imagination

19:44 lpvb: does the eclipse public license make all clojure projects EPL licensed?

19:57 pandeiro: anyone know how to deactivate special quote behavior with clojure.data.csv ?

20:13 tjohnson: ...

20:23 black_joe: I am having trouble making (or finding) a function that tests a string to see if it contains a character.

20:24 (.contains) does not work on char's. And (str) turns the char into a lazy-sequence, so that doesn't work either.

20:27 Bronsa: ,(some #{\a} "asd")

20:27 clojurebot: \a

20:27 Bronsa: ,(.contains "asd" (str \a))

20:27 clojurebot: true

20:27 Bronsa: you choose

20:28 black_joe: (str c) (where c is a character) returned a lazy sequence when I used it. I would have used that way.

20:29 Bronsa: that shouldn't be the case, try to check whether c is really a char

20:31 pandeiro: is there an easy way to use a destructuring vector _and_ get bind all args to one symbol?

20:32 ah nvm :as works fine

20:32 amalloy: black_joe: (str x) never returns a lazy sequence for any x

20:33 (str some-lazy-seq) does return a string containing "LazySeq", but it's still a strong

20:34 black_joe: Bronsa 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:34 Bronsa: that'd be the case if you map'ed over the string

20:35 black_joe: The exact scenario used split-at.

20:40 tjohnson2059: .

20:46 black_joe: Now this is either down to a logical error or just some facet of Clojure that I haven't been able to figure out.

20:46 http://pastie.org/4788419

20:46 The function returns false even though both halves of the string contain the character.

20:52 And it seems that in the above snippet (str) on (first x) is actually a lazy sequence. I got that wrong on the debug.

20:52 But lazy-seq does not turn it into plain text.

20:57 metellus: ,(str '(1 2))

20:57 clojurebot: "(1 2)"

20:58 black_joe: In 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:58 metellus: why are you calling lazy-seq on it?

20:59 black_joe: I thought that turned a lazy sequence into text?

21:00 metellus: I don't know the particulars of lazy-seq, but that's not what it does

21:03 black_joe: I think you'll be better off *only* functions on strings or *only* functions on seqs, rather than a mixture of them

21:04 so for example, you'd use .substring and then .contains

21:05 black_joe: Alright. I will use split here then.

21:06 Instead of split-at.

21:06 I read in "Clojure Programming" that since Strings are homoiconic with sequences it is good practice to make functions compatible with both.

21:08 metellus: the problem is that (str (first x)) and (str (first (rest x))) aren't doing what you want them to do

21:09 (and if your function uses .contains on a string it's not really going to be compatible with sequences)

21:09 I'm not really good enough to Clojure to offer a better suggestion, though

21:10 amalloy: well, seqs have a .contains method too

21:10 but i agree this isn't a good way to do it

21:10 black_joe: Well, either way, you've been helpful. I'm too new to Clojure to fully understand sequences or lazy sequences.

21:10 metellus: (.contains (str x)) isn't going to do what you want for any x that isn't a string, though

21:12 black_joe: Well, then I may just embed a let form and assign the string there.

21:12 I'll play with these suggestions tomorrow.

21:12 Thanks for helping.

21:12 metellus: hmm, it actually looks like his function will work if he gets rid of the (str ..)s he has everywhere

21:25 mpan: how does slash for divide not conflict with namespacing?

21:27 SegFaultAX: mpan: What do you mean?

21:28 mpan: so I wanted keyword :/ but it wasn't allowed

21:29 ivan: see SLASH and CLOJURE_SLASH in LispReader.java

21:29 mpan: ah, so it's special cased earlier on?

21:29 ivan: yes

21:29 mpan: ah thanks

21:29 tomoj: is it normal for clojure-dev membership to remain pending for some time after one's CA is received?

21:41 mpan: say I have a tree from which I make a zipper

21:41 is there a way to get a flat seq of zippers representing each tree elem?

21:42 tomoj: mpan: if I understand what you mean, (->> z (iterate z/next) (take-while (complement z/end?)))

21:43 which, imo, would be nice to have in clojure.zip (as "nexts"?)

21:43 mpan: could you please explain how that works?

21:44 as in, the tree has both terminal and nonterminal nodes, similar to

21:44 [a [b c d] [e [f g h] [i j k]]]

21:45 the actual tree is approx that layout, just with more metadata dumped into the leaves

21:54 tomoj: got it to work. awesome! thanks!

21:55 it's got some extras in it, though

21:56 oh!

21:56 it's because it's interpreting the structure to mean something else

21:56 (as in, the zipper was constructed to mean something else)

21:58 (as in, I was interpreting the tree differently than vector-zip does)

21:59 [a b c] being 1 node w/ 3 children rather than 1 node w/ 2 children

22:41 uvtc: pppaul, are you getting a lot of rain where you are?

23:07 mpan: is there an equivalent of iterate for something really expensive that you don't want evaluated more often than necessary?

23:08 I think last time I ended up writing the iteration fn directly or something, but that seemed redundant

23:09 shachaf: What's wrong with iterate for that?

23:09 mpan: the lazy seq got evaluated in chunks

23:10 and a chunk is actually pretty significantly expensive when we don't want the rest of it

23:10 shachaf: Oh, I don't know how Clojure lazy seqs work.

23:10 I assumed it was like real lazy lists. :-(

23:10 mpan: I heard there was a way to get entirely lazy behavior

23:10 but didn't hear what it was

23:10 ChongLi: does this help:

23:10 http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/

23:10 ?

23:11 Hodapp: probably oft-repeated question: how might I reliably achieve a Clojure REPL with functioning history?

23:11 short of tryclj.com

23:11 shachaf: rlwrap?

23:11 tomoj: shachaf: hey!

23:11 Hodapp: at some point all answers are probably going to converge on "learn emacs"

23:12 brehaut: Hodapp: my lein2 repl has it out of the box

23:12 tomoj: mpan: iterate is not chunked afaik

23:12 QUACKALPACATRON: shachaf, you are like that person that is everywhere

23:12 what is her name again, emma or something like thast.

23:12 tomoj: &(do (first (map println (iterate inc 0))) nil)

23:12 lazybot: ⇒ 0 nil

23:12 Hodapp: brehaut: silly question, can I easily get to a lein2 repl outside of a project?

23:12 guess I could just make an empty one

23:12 brehaut: yes

23:12 mpan: oh awesome

23:12 brehaut: lein repl

23:12 mpan: what did that guy do last night with printing a whole chunk then?

23:13 shachaf: hi tomoj

23:13 Hodapp: huh, for some reason I was thinking that wouldn't work, but it is working

23:13 awesome

23:13 shachaf: hi QUACKALPACATRON

23:13 tomoj: dunno, was it my example? don't have a good sense of time

23:13 &(do (first (map println (range))) nil)

23:13 lazybot: ⇒ 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:13 mpan: ah, map is causing chunking? iterate doesn't?

23:13 thanks!

23:13 tomoj: no, (range) is chunked

23:13 Hodapp: gawd, I am about to stab Eclipse though. If I enter in an open-quote, the lag for input in the file approaches seconds

23:14 until I close that quote

23:14 tomoj: map inherits the chunkiness of its inputs

23:14 mpan: ooh

23:14 thanks

23:21 unlink: Does clojure.java.jdbc support simultaneously operating on two different database connections?

23:27 mpan: is there an analogue of -> that keeps allows a chain of assocs?

23:27 or should I just use -> with a bunch of partial applications?

23:28 oh wait, I can precompute all my stuff, so I can just use assoc

23:29 doesn't strictly need the chaining order

23:38 tomoj: hmm, chain of assocs?

23:40 like assoc-in?

23:41 mpan: sorry, along the other dimension

23:42 like assoc with multiple pairs, except I had originally thought order mattered for me

23:42 like, I would need to calc stuff after each assoc

23:43 turns much more cleanly into a let and an assoc

23:43 if I drop that requirement

23:50 Hodapp: damn, I dread going to bed... when I wake up, I have to walk into a job where immutability isn't kosher.

23:51 shachaf: Hodapp: Watch out for those people trying to mutate 4 into 3.

23:51 tomoj: I never thought of it that way, but I guess I have the same problem

23:52 Hodapp: still working at 4clojure problems, but they are interesting for sure

23:52 just did the fibonacci one

23:53 ,((fn [n] ((fn fib [m sum1 sum2] (if (> m 0) (cons sum1 (fib (- m 1) sum2 (+ sum1 sum2))))) n 1 1)) 20)

23:53 clojurebot: (1 1 2 3 5 ...)

23:53 * gfredericks hails

Logging service provided by n01se.net