#clojure log - Jan 08 2012

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

0:08 espringe: Why can't I use apply with recur? Like this:

0:08 http://pastebin.com/wE4gtrcL

0:08 If you replace the tail call with "recur" it no longer works

0:14 cemerick: espringe: apply would always be in tail call position there

0:14 espringe: Unless it was a macro, i presume

0:14 But I don't see how to solve this problem

0:14 how do I have tail-call-recursion, with variable amount of arguments

0:15 like how can i get (mymax 1 2 3 4)

0:15 to do a tail call to (mymax 2 3 4)

0:19 clj_newb: ladies and gentlemen, years from now, in a dictionary far far away, it shall be written

0:19 greatness: clojure w/ types

0:20 cemerick: espringe: recur is strictly positional, can't be used with variadic fn params.

0:20 In this case, why bother when there's reduce?

0:21 espringe: cemerick: No reason, just seemed to me like the logical way to implement it, but if I guess I'll just use reduce :D

0:21 cemerick: If Clojure had TCO, it might be. :-)

0:49 clj_newb: is there a shorter way of writing: (list ~@x) ?

0:59 cemerick: clj_newb: often ~x, if x is a seq

1:04 amalloy: yeah, it's hard to say without knowing what the goal is

1:09 clj_newb: the context is writing macros

1:09 ~x doesn't work, since if x = (list 1 2 3), then ~x = (1 2 3)

1:09 clojurebot: I don't understand.

1:09 clj_newb: and clojure tries to apply 1 to (2 3)

1:10 to be more specific, I have a piece of code that looks like:

1:10 `( ... (map (...) (list ~@ps) (list ~@vs)))

1:13 amalloy: PING

1:42 markerdmann: a bit of nostalgia: http://www.therestartpage.com/#

1:45 clj_newb: in a *.clj file; how do I get things like (1) current line number (2) current file name (3) current namesapce name?

1:51 furthermore, how do I print the hierarchy of a java class?

1:51 i.e. I want to know who the ancestors of AssertionError are

1:51 cemerick: ,(ancestors AssertionError)

1:51 clojurebot: #{java.io.Serializable java.lang.Error java.lang.Throwable java.lang.Object}

2:03 clj_newb: ,(ancestors AssertionError)

2:03 clojurebot: #{java.io.Serializable java.lang.Error java.lang.Throwable java.lang.Object}

2:04 clj_newb: ,(doc AssertionError)

2:04 clojurebot: Gabh mo leithscéal?

2:31 graphbum: is it typical for inline-spec'd protocol functions, in a defrecord, to be 7-8X slower than identical functions called from outside the protocol?

2:37 amalloy: clj_newb: [~@x] may be better, although it's fairly rare to be in this position in the first place; that is, the position of having something in a macro that you know will be a seq but you want not to be

2:38 graphbum: i don't understand the question, but the answer is probably no. if you gisted something to explain the question...?

2:42 clj_newb: amalloy: does clojure have osmethign like __LINE__ which returns the current line number in the clj file?

2:43 amalloy: &(-> '(blah) meta :line) probably works

2:43 lazybot: ⇒ 1

2:45 graphbum: amalloy: https://gist.github.com/1577624

2:45 amalloy: hadn't used gist before, sorry for the wait.

2:46 clj_newb: ,(doc ->)

2:46 clojurebot: "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

2:46 amalloy: okay, i see a bunch of code. what's the question? whether you should use a record that wraps a map, or extend your protocol to maps?

2:47 graphbum: amalloy: my goal is to have a generic "fringe" protocol to modularize search algorithms (i.e. swap out queue, stack, priorityq implementations easily). I started with the concrete implementation based off of priority-map, then went about looking at ways to wrap it.

2:48 amalloy: if I run the concrete implementation (which is basically banging on a priority-map), it's the most performant

2:49 amalloy: when I extended the protocol to to clojure.lang.PersistentTreeMap, using the same functions from the concrete implementation, I get into the 7x speed hit

2:50 amalloy: final approach was to wrap it via a defrecord, and inline the protocol. similar speed-hit. I don't know where the hit is coming from, trying to figure out how I incurred that kind of penalty, and if it's expected.

2:51 amalloy: sorry, i don't understand any of this code

2:53 graphbum: amalloy: I guess the docstrings aren't helpful to you either.

2:53 amalloy: ah well, thanks for the look.

3:04 clj_newb: suppose "e" = (AssertionError. "blahblahblah"). Now, how can I extract (1) msg (2) file name and (3) line number from "e" ?

3:04 (I have tried :line, :file), but I get nil

3:28 espringe: Is there a way to do this:

3:28 (defn myfunction

3:28 ([a b] ....something...)

3:28 ([&catch_all_args] ...something else...))

3:28 The compiler complains: Can't have fixed arity function with more params than variadic function

3:29 clj_newb: suppose it gets two arguments; does it call the first or the second one?

3:29 espringe: The first

3:29 otherwise, it should call the second

3:29 I guess it doesn't work like this?

3:30 I was thinking it would try match the first, and then if that failed, it would go for the next

3:30 kind of like a pattern match on the arity?

4:46 gour: morning

4:49 at the moment thinking to use D for our open-source multi-platform desktop app. tinkering with haskell in the past, liked it a lot, but it lacks some productivity to write desktop apps today...after considering python for a short time, decided not to use scripting language and considered D, which is nice language, but not really ready to write today (e.g. missing GUI libs, database stuff...), so we're

4:49 wondering how mature clojure is?

4:50 we're not really fan of lispy-language (not dived into scheme to fix gnucash reports), but still..

5:02 clj_newb: question: is there a way in clojure to say: "print a gist of this variable in 20 chars or less". Context: during error reporting, I want to know some intuition about why there was an error, and a simple representation fo the object would be helpful

5:19 ,(with-meta false {:a 2}) ; <-- wtf, I can't attach meta data to false ?

5:19 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IObj>

5:24 clj_newb: is AssertionError a clojure or a java class?

5:27 zilti: clj_newb: Sounds clojure-y to me.

5:27 clj_newb: yeah; I was just hoping for a systematic way to find it

5:27 since ancestors only shows ancestors and not the class itself

5:28 zilti: I guess you won't find any classes in Clojure, since there aren't any

5:28 clj_newb: i believe clojure objects are java classes

5:29 zilti: But what exactly do you want to find? The source of AssertionError?

5:29 Yes, in the background, many clojure things are compiled the same way as Java classes

5:30 clj_newb: come to think of it, konwing whether Assertionerror is java......AssertinError or clojure......AssertionError is absolutely useless to me

6:44 gour: is the choise of potential GUI toolkit for desktop app written in clojure same as with e.g. lua?

6:44 s/lua/scala

7:29 zilti: gour: ping

7:34 michaelr525: hello

7:40 gour: zilti: pong

7:41 zilti: gour: Did you already find what you've searched for? Were my two recommendations a help for you?

7:41 gour: zilti: which recommendations? did i miss something?

7:42 zilti: There are Clarity (https://github.com/stathissideris/clarity) and Seesaw (https://github.com/daveray/seesaw) for Clojure GUIs, both are under active development

7:43 gour: zilti: ahh, missed it somehow...will take a look. thanks...now it's lunch time

7:43 zilti: no problem :)

8:33 gour: zilti: looks interesting...although i'm not realy fond of swing's look

8:43 zilti: gour: AFAIR Clarity has some kind of CSS-like styling. Don't know about Seesaw.

8:53 gour: zilti: this looks modern :-)

8:54 zilti: What?

8:54 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

8:54 gour: zilti: css-like styling

8:54 zilti: what are some other language(s) you code in?

8:54 zilti: Ah. Yes

8:55 gour: I programmed in Java and Scala, but now Clojure is the only language.

8:55 gour: I'm not a "professional", I code for fun until I start studying. I'm in the army at the moment

8:55 gour: zilti: how would you compare clojure with scala?

8:56 * gour did his 'army' share long ago

8:57 zilti: Hmm what's really awesome about Scala is its type system. But that's also Scala's drawback, because it can get very complex. And there are so many hacks in scala to allow DSLs that it's imo kinda annoying. I really prefer Clojure because it doesn't have such hacks.

8:58 gour: In which army have you been?

8:59 gour: zilti: in ex-yugoslavia, i'm from croatia

9:00 you haven't work with lisp before?

9:00 zilti: No. I did a littlebit of elisp when I started using Emacs for Scala development

9:00 gour: which editor you use with clojure?

9:00 zilti: Emacs, too :)

9:01 I don't miss anything for development with emacs and leiningen.

9:01 gour: i moved (back) from emacs to vim when switching from orgmode to taskwarrior, although i'll probably use geany...had developed paid in my left wrist with emacs :-/

9:02 zilti: paid?

9:03 gour: *pain

9:03 it was not RSI, but still..

9:03 zilti: Oh.

9:04 I've not tried vim yet. But yeah, the key combinations in emacs can be annoying sometimes.

9:05 gour: Do you know how Clojure support in Vim is?

9:06 gour: zilti: no, idea, but mostly i see that vim has good support

9:07 here are some hits - http://www.deepbluelambda.org/programming/clojure/programming-clojure-with-vim

9:08 zilti: what kind of apps you plan to write in clojure?

9:09 zilti: gour: Currently I'm working on a web page with noir/korma/pinot, and I plan writing a small game

9:11 gour: heh...i'd need to learn some scheme to to tweak some reports in gnucash, but i'm not so thrilled with those parentheses-based language...will research more about clojure

9:13 zilti: gour: I'd say you won't regret trying a Lisp language ;)

9:13 gour: zilti: heh, maybe i should try starting smalle with scheme & gnucash then ;)

9:14 zilti: gour: Probably. But don't forget that Clojure is quite different from the classic Lisps

9:15 gour: yeah, but let's try to overcome syntax barrier 1st

9:17 zilti: Oh by the way, about "parentheses-based language" - Rich Hickey once showed a code in his presentation, a clojure and a java version. Turned out the clojure version had fewer parens :)

9:20 gour: he he...btw, i really didn't like java code i saw so far, and that might be one cons for scala

9:21 * gour likes haskell's syntax with less noise

9:23 zilti: Yes, Haskell looks very clear. Didn't really try to understand it, though

9:27 gour: it is very nice language, but monads and those things makes some things more complex than it should maybe be...gui libs are also not great...gtk2hs is good, but the rest not so

9:29 bsteuber: I don't really like haskell syntax

9:30 gour: in general?

9:30 bsteuber: when using a do block nested somewhere else it's never clear to me when you need parens and when not

9:30 or was it pattern matching?

9:30 gour: heh, do blocks are syntax sugar...you can use >> operators instead

9:31 bsteuber: at least I remember always adding parens anyways because things broke without

9:31 gour: maybe it's layout issue :-)

9:31 bsteuber: I think my indentation was right

9:31 but anyways

9:31 you get used to parens pretty soon ^^

9:32 gour: well, no point to discuss about one's preferences ;)

9:32 i'm more concerned about "batteries included"...that's D's weak part atm

9:33 bsteuber: you mean like an IDE?

9:33 gour: more about lib support...i'm not big fan of bloated IDEs

9:33 bsteuber: but I don't really believe in "syntax preferences" - it's all a matter of familiarity

9:33 zilti: I'd say with clojure you get more than just the batteries

9:34 gour: choice of good-looking multi-platform toolkit is the one

9:34 zilti: gour: For Libraries, besides the fact that you can use all Java libraries without a problem, this gives a nice overview: http://www.clojure-toolbox.com/

9:34 bsteuber: right gui frameworks suck almost everywhere

9:35 zilti: bsteuber: I didn't try it yet but the new JavaFX looks promising. Besides the fact that it lacks real platform independence

9:35 gour: right, some are just sucking less to paraphrase mutt

9:35 zilti: lol

9:36 * gour is, otherwise, using claws

9:36 bsteuber: for me, html+clojurescript seems to be the least sucking "gui framework" atm

9:36 so all my apps now run in the browser

9:37 even if I have to start a local webserver at my user's computer :)

9:37 zilti: I once found a nice-looking small Java GUI toolkit based on XML and SVG

9:37 bsteuber: to be honest, it's just one app at this point ^^

9:38 zilti: I don't like html/css much, but maybe that's because I don't really know it

9:38 bsteuber: neither did I before we started this project

9:39 but if you generate both html and css from clojure

9:39 you really get a nice separation of content and design

9:40 and it's amazing how many effects you can get by simple dom manipulation

9:41 gour: i believe that html5 won't be rich enough for our app...otherwise no problem to launch local server if needed

9:41 bsteuber: I think you will never be able to find a gui framework that can create as flexible and good looking designs as html

9:41 ever tried to define your own swing look and feel? oO

9:42 gour: bsteuber: i'm thinking about wx & qt

9:43 bsteuber: gour: not many experiences with either

9:43 well once I had to compile a five your old c++ program using an old wx version for windows

9:43 which was hell

9:43 zilti: c++ IS hell

9:44 gour: clojurescript sounds good...well, anything not called JS is cool

9:44 * gour wants to avoid C(++)

9:44 bsteuber: on the other hand, clojurescript isn't very mature atm

9:44 so relying in cljs for commercial products is at least very close to insane

9:45 though we're doing fine up to now ^^

9:45 gour: well, thanks to all for your input...we have to research more and stare a bit at some clojure code

9:46 see you later, sometime...

9:46 * gour is going afk

10:28 rabbler: 4clojure.com is 'down'. :-( It might have been mentioned but I thought I would say something.

10:57 I tweeted the info that 4clojure is down, perhaps the team will get it. Wanted to do some problems.

11:24 Narvius: Hello. I have a problem with lein/compilation. I'm generally using emacs/swank/lein, and I have a project that spans 7 files so far. When I run (slime-eval-buffer) over the main file and execute the -main function, everything works fine, but when I try to compile the project it throws a NullPointerException, the location given being game.clj:1.

11:27 And lein run works fine.

11:48 LauJensen: Hi gents -I can't find this in the docs, but isn't there an enliven selector for referencing self ?

12:08 this-node

12:32 Magnars: Bit of a noob here: Why can't my REPL find clojure.string? I tried (doc clojure.string/split), I tried (use clojure.string).

12:32 Bronsa: you have to (use 'clojure.string)

12:32 Magnars: oh

12:33 thanks :)

12:33 cgray: sounds like you want to (require 'clojure.string) instead though

12:36 Magnars: I'm slightly surprised that require would need the symbol quoted. Isn't it a macro?

12:37 cgray: nope

13:27 clj_newb: (defrecord MyError [msg] Throwable) <-- does not work; since Throwable is not an interface. Is ther a way to create a clojure objecta that inherits from a java class?

13:35 alexbaranosky: clj_newb, proxy

13:36 &(doc proxy)

13:36 lazybot: ⇒ "Macro ([class-and-interfaces args & fs]); class-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which cre... https://refheap.com/paste/202

13:43 mrevil: I'm using 'lein test' to run unit tests, but when I mess something up, like a syntax error, or mistype a function name it just hangs instead of giving me a useful stack trace and it takes me a long time to hunt down what's wrong. is there a way to get more useful information?

13:45 Scriptor: ,(conj 2 (map [1 2 3] identity))

13:45 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>

13:46 Scriptor: ,(conj 2 (map identity [1 2 3]))

13:46 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>

13:46 Bronsa: ,(conj (map identity [1 2 3]) 2)

13:46 clojurebot: (2 1 2 3)

13:46 Scriptor: thanks :)

13:46 I keep mixing it up

13:52 alexbaranosky: mrevil, I don't know, I use lein midje, which doesn't seem to have that problem for me

13:54 gf3: mrevil: I don't seem to have that issue when using speclj

14:20 clj_newb: wtf

14:20 so I'm readinga bout gen=-class

14:20 and it claims that every namespace in Clojure is also its own java class

15:03 TimMc: clj_newb: Every namespace, function, and file, I think.

15:05 clj_newb: I have a class with 3 fns that ends up generating 6 class files.

15:05 mister_roboto: Join #noir

15:14 technomancy: mrevil: if you can construct a simple repro case please open an issue on github

15:16 TimMc: technomancy: Did you see my comment on the (closed) signed-Jar lein issue #31?

15:16 (Not sure if github sends notifications...)

15:17 https://github.com/technomancy/leiningen/issues/31

15:17 technomancy: yeah, feel free to reopen

15:17 if you can construct a failing test case even better

15:18 TimMc: Can't reopen -- no privs. But I'll get on the failing test case.

15:19 technomancy: oh, weird, I'll get it then.

15:19 TimMc: Do you get notifications of comments on issues?

15:19 technomancy: yeah, I had noticed it but hadn't taken a close look

15:19 TimMc: That is, email vs. web interface.

15:19 technomancy: my github unread message count is at 1017, so I've pretty much switched over to email =)

15:20 TimMc: Ha, OK.

15:20 technomancy: though it does show up on the dashboard

15:21 if you submit a patch with a failing test case you can have commit rights on lein, which will let you reopen/tag issues. =)

15:21 of course if I could turn that on for everyone I would

15:22 TimMc: There's no intermediate permission stage?

15:22 technomancy: nothing obvious to me

15:23 you can restrict wiki edits to collaborators only, but not issues

15:58 Scriptor: did anyone else just get bombarded by a dozen emails from the clojure mailing list?

16:03 Bronsa: yes

16:04 mister_roboto: Is anyone using noir w/ maven here

16:06 alexbaranosky: anyone know how to test an exception is thrown using clojure.test?

16:06 amalloy: alexbaranosky: you want `thrown?`

16:06 alexbaranosky: amalloy, thx!

16:11 graphbum: amalloy: I don't know if you remember (from like 3 am) but I had a problem with a wierd speedhit (7-8x slower) that I attributed to my usage of protocols....

16:12 amalloy: turns out, I had duplicated names between functions in another namespace and the protocol, and did not catch the problem due careless :use statements

16:13 amalloy: fixed the problem, performance via protocol functions is about 50% slower, not 7-8X

16:14 amalloy: even 50% seems a lot higher than it should be

16:14 graphbum: amalloy: is that more in line with expected performance?

16:14 amalloy: but i'm not sure

16:15 hiredman: 50% slower than what? measured how?

16:15 amalloy: i still don't understand what two things you were trying to compare, so i don't know if 50% is reasonable, but in general protocols aren't very slow

16:15 graphbum: amalloy

16:15 ack

16:16 hiredman: direct calls to protocol functions, higher order calles, or what?

16:16 graphbum: amalloy: I understand.. I need to clarify my presenation, an to eliminate any vagueness in "what" I'm comparing.;

16:17 mdeboard: Anyone here have experience with neural nets?

16:18 graphbum: hiredman: I have a little graph library I'm mucking with, one of the offshoots of which is the need for a priorityq. I wrote a little wrapper around sorted-map to get me something useful for representing a priorityq, where the keys are (generally) floating point priorities

16:18 mdeboard: I've read a lot about them, never implemented or used directly though.

16:18 amalloy: mdeboard: ~anyone :P

16:19 mdeboard: just trying to understand what exactly a hidden node is, I'm getting the impression it's just logic used to transform inputs to outputs

16:19 amalloy: yeah, they're just nodes that are neither inputs nor outputs

16:20 graphbum: hiredman: after that, I decided to provide an abstraction for the datastructure, since it's really conforming to something that stores and retrieves fringe nodes in a search...

16:20 hiredman: which led me to develop a Fringe protocol

16:21 mdeboard: amalloy: And in the sense of search, an input would be a query, and an output would be the link the user clicks on?

16:21 s/would/could

16:21 amalloy: i guess?

16:21 graphbum: hiredman: with the intent of having a couple of different implementations (one for a queue (BFS), one for a stack (DFS), one for djikstra (the priorityq), and possibly a random queue

16:22 hiredman: so I started with the existing priorityq implementation (implemented via sorted-map), and tried a couple of different ways to implement the Fringe protocol

16:24 hiredman: Both implementations use the functions I defined in the priorityq lib, so I figured the performance would have to be >= that, any overhead is due to protocols or something introduced...(I'd think)

16:24 hiredman: first implementation was to extend protocol to clojure.lang.PersistentTreeMap

16:25 hiredman: second try was to define a record, pq, with only one 'data' field, then inline define the fringe protocol in the record definition.

16:27 hiredman: both the record and the extend-protocol implementations are close in performance. they take about 1.5 times as long to add a test-set of 100 nodes to a priorityq using operations defined in the Fringe protocol.

16:27 hiredman: 1.5 times vs calling functions from the priorityq lib directly

16:30 hiredman: I tested adding weighted nodes to the Fringe up to about 10^5, and the disparity seems to be pretty consistent

16:32 hiredman: so basically, the 3 different implementations are sharing that same underlying functions (defined as operations on a sorted map in my priorityq lib), but using the functions (in this case aliased) by the Fringe protocol, results in the performance hit.

16:34 hiredman: bearing in mind, that it's still performant overall, I'm just trying to gauge why there may be overhead, if any...I can understand that in the case of extend-protocol, but in the case of inlining the protocol in a defrecord, I would have expected the performance to be closer to the raw functino calls against the sorted-map

16:35 mdeboard: do you mean hidden layer?

16:36 mdeboard: graphbum: Yeah

16:37 hidden layer being composed of hidden nodes

16:37 afaik

16:38 graphbum: mdeboard: the node is a function, of a vector of inputs (outpus from other nodes), which determines if the node should fire or not

16:39 mdeboard: I see

16:39 graphbum: mdeboard: the only reason it's "hidden" is because it's neither a source nor a sink node, i.e. it's not at "either end" of the network.

16:39 mdeboard: the more nodes you add in the middle, the more intermediate and complex connections you can get in the network.....

16:41 mdeboard: the whole network can be trained (via back propogation, and other methods - even a genetic algorithm) to respond in a particular way to a set of any input....it can be seen as a giant black-box function

16:42 mdeboard: Right, I'm reading a book & papers on the concept of neural networks, just needed clarification on hidden nodes/layers

16:43 graphbum: mdeboard: in all, don't let "hidden" get you too confused. it's the structure of the network that's in the middle, not directly connected to the stimulus, or the final output neruons

16:43 mdeboard: stimulus being a set of inputs to a function?

16:44 graphbum: mdeboard: there's a great book called collective intelligence, which does a good job building a bunch of these types of things.....it's in python, but is clear to follow and no too wrapped around the axle on the math.

16:44 mdeboard: graphbum: That'st he book I'm reading :P

16:45 graphbum: mdeboard: if you get deeper...there are some really interesting turns you can take in that field.

16:45 mdeboard: stimulus = input, yeah

16:45 mdeboard: that's one of the better, actually useful books that I've run across

16:46 mdeboard: graphbum: Yes I'm very interested in the topic, I've been doing a lot of work with Solr implementation/integration at work. I'd like to use Mahout to handle building recommendations and delivering better search results eventually.

16:48 graphbum: mdeboard: the only thing you have to bear in mind with any pattern classifier, is that it's totally dependent on input data. I hadn't hear of Solr until you brought it up, looks cool.

16:49 mdeboard: i mean the quality of the classifier is dependent on the quality of the training set

16:49 mdeboard: and /or the "teacher"

17:04 LauJensen: Does a Clojure library exist, which allows me to convert XHTML -> PDF ?

17:06 TimMc: Probably not, but I bet there's some other JVM lib that does.

17:07 LauJensen: There's a couple, yea

17:16 jodaro: i'm not dyslexic, but i play one when i code

17:22 lynaghk: LauJensen, we just wrapped up a project using PhantomJS to render SVG on the server.

17:22 LauJensen: Nice

17:22 lynaghk: Phantom is a headless WebKit build, so if you don't need to be 100% on the JVM you should look into it

17:25 LauJensen: I will

17:27 lynaghk: feel free to shoot me an email (kevin@keminglabs) if you want a hand running ClojureScript on it. I've spent many hours doing data vis on zombie-DOMs =)

17:56 casperc: Does anyone know, given that I have a var loaded in the repl how do i find the line number where it was defined in the original source file?

17:58 alexbaranosky: (:line (meta (var x)))

17:58 casperc: oh nice, I had no idea

17:58 alexbaranosky: does it work? :)

17:58 casperc: i'll give it a try :)

17:59 jodaro: so i'm playing around with ScheduledThreadPoolExecutor

17:59 alexbaranosky: I just tried it, and yep, look slike it works

17:59 jodaro: by way of overtone.at-at

18:00 and i'm tyring to figure out what happens when the scheduled task runs longer than the specified delay

18:00 TimMc: ,(:line (meta #'first))

18:00 clojurebot: 49

18:00 jodaro: its using scheduleAtFixedRate

18:00 i was thinking that the internal queue used might start to fill up

18:01 but from a quick test it doesn't seem to

18:02 casperc: yeah, works like a charm alexbaranosky, thanks alot :)

18:02 alexbaranosky: casperc, no problem

18:02 TimMc: $findarg < (:line (meta (var %))) 60 true

18:02 lazybot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)

18:02 TimMc: ^ oh well

18:02 alexbaranosky: TimMc, what was that intended to do?

18:03 curious

18:03 TimMc: Find vars that were declared in the first 60 lines of their files. :-)

18:04 casperc: heh, interesting

18:04 TimMc: I don't think $findarg plays well with macros.

18:08 Right, it uses let instead of performing surgery on the exprs.

18:11 Trying to hack on lein... I want to creating a local tracking branch for 1.x -- how do I do it? Everything I've tried has ended up attached to master somehow.

18:13 Scriptor: if you conj an element to the beginning of a lazy list

18:13 how does it handle length of the new list?

18:13 TimMc: OK, `git branch -t 1.x origin/1.x` seems to work, followed by a checkout. I give up on finding a single command.

18:13 Scriptor: A lazy seq, you mean?

18:13 Scriptor: TimMc: right, sorry

18:13 TimMc: seqs don't know their length

18:14 &(counted? (range 10))

18:14 lazybot: ⇒ false

18:14 Scriptor: &(counted? (conj 2 (range 10)))

18:14 lazybot: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection

18:14 Scriptor: damnit

18:14 ,(counted? (conj (range 10) 2))

18:14 TimMc: &(counted? (into () (range 10)))

18:14 lazybot: ⇒ true

18:14 clojurebot: false

18:14 Scriptor: aha

18:14 TimMc: Good thing we were using diff't bots.

18:15 Scriptor: so the full lazy seq is only realized when you actually call count on it

18:15 even if it's been conjoined onto?

18:15 TimMc: yep

18:16 Scriptor: got it

18:16 TimMc: You can realize a lazy seq that way.

18:16 Scriptor: by counting it?

18:16 TimMc: yep!

18:16 Scriptor: makes sense, I was wondering about that edge case

18:16 TimMc: dorun or doall is a more appropriate way, though

18:16 Scriptor: yea

18:17 jodaro: (dorun run run)

18:49 amalloy: TimMc: git checkout 1.x is generally sufficient. if there's a remote named the same thing it automatically tracks

18:50 or you can be more explicit with git checkout -b 1.x origin/1.x (which i think also tracks but not sure)

19:05 TimMc: Grr, I really wish we had Pattern flags on our regex literals.

19:05 (Pattern. (str #"foo") Pattern/CASE_INSENSITIVE) is pretty annoying.

19:05 #"foo"i would be nice.

19:10 Whoa, ClojureScript has been in progress since 2008?

19:14 mrevil: is there some easy way to overlay one sequence over another ex: (overlay [nil nil nil] [1 2]) and I get [1 2 nil] ?

19:15 or i guess merge vectors

19:18 jodaro: hrm

19:19 TimMc: mrevil: Is nil the only replaceable value, or false also?

19:20 mrevil: it could be any value like (overlay ["" "A" "B"] [1 2]) == [1 2 "B"]

19:20 TimMc: Oh, I see -- the first coll is completely overwritten on conflict.

19:20 mrevil: yeah

19:20 jodaro: (reduce conj ... gets you part of the way i think

19:20 but

19:21 TimMc: mrevil: (overlay [] [1 2 3]) => [1 2 3] ?

19:21 jodaro: with the vecs reversed

19:21 oh wait nevermind

19:21 TimMc: or is is truncated to the length of the first?

19:22 mrevil: for my purposes it doesn't matter

19:22 TimMc: Easier to truncate, I think.

19:22 amalloy: &(let [empty (Object.)] ((fn [as bs] (map (fn [a b] (if (= b empty) a b)) as (concat bs (repeat empty)))) ["" "A" "B"] [1 2]))

19:22 lazybot: ⇒ (1 2 "B")

19:23 mrevil: cool, thanks!

19:23 TimMc: Ah, I was wondering how to deal with map stopping at the end of the shortest coll.

19:23 amalloy: might be easier to write with just lazy-seq though

19:26 (fn merge-vecs [xs ys] (lazy-seq (when-let [[a & as] (seq xs)] (if-let [[b & bs] (seq ys)] (cons b (merge-vecs as bs)) xs))))

19:41 TimMc: Hah, I guess I can just add (?i) at the beginning of my regex.

19:42 amalloy: TimMc: right. you can't do that for every flag, though, like /x

19:43 TimMc: "Comments mode can also be enabled via the embedded flag expression (?x)."

19:45 amalloy: okay fiiiine. maybe i'm thinking of some other language's regexes

19:51 TimMc: Git question: I've submitted a pull request. Is it now bad to --amend the commit and change the range on the pull request?

20:00 amalloy: it's bad form if anyone's actually looked at the request, probably

20:00 TimMc: Oops, it's not possible to change the range after you create it...

20:08 Oh, for pete's sake...

20:09 chouser: fnil is my new best friend

20:09 TimMc: technomancy: I can't be trusted with pull requests.

20:30 Maybe I'll make one more try of it...

21:14 brudrick: hi

21:19 I'm playing with the noir on heroku tutorial. Wondering if a "git push heroku master" is the correct command to run everytime I change the source code. Each time, heroku seems to run 'lein deps' on the remote side.. quite a heavy-weight change each time I want to change one line.

21:22 amalloy: you can probably add `:checksum-deps true` to your project.clj to suppress that when it's unnecessary

21:25 brudrick: I'll try that

21:31 technomancy: nah, it'll still run deps every time you deploy. the jars themselves should be cached though.

21:41 brudrick: technomancy: for some reason heroku is pulling every time. Should I be using another command other than push? like merge? I'm new to git.

21:43 amalloy: no, push is definitely right

21:48 brudrick: k

21:53 technomancy: you're fine. the cache gets cleared more often than it should be, but that's an internal issue

21:58 mrevil: why is vector not a sequence?

21:58 (seq? [1 2]) == false

23:35 tufflaks: mrevil it is sequential?. seq? is only for seqs i think

23:38 mrevil: you think that vector would implement iseq

23:41 F333: Any documentation around support for Java @annotations ?

23:42 lnostdal: (. (int 261) equals 261) => false ouch

23:42 ..some libraries seem to use java.lang.Integer when i input 261 .. some (like clojure) use java.lang.Long when i input 261

23:45 alexbaranosky: I find uses for this macro I wrote, pred-cond, everywhere now: https://github.com/marick/Midje/blob/master/test/midje/util/t_form_utils.clj#L58

23:46 pretty much any time you have multiple checks against the same item

23:47 amalloy: alexbaranosky: useful.fn/fix :)

23:49 alexbaranosky: amalloy, fix is the fn version of pred-cond it appears

23:49 amalloy: well, it does a bit more too

23:50 (fix 4 even? #(* 2 %)) => 8

23:51 alexbaranosky: I really should spend more time digging around in useful

23:51 amalloy: anyway, the important point is that there's no reason for it to be a macro - there's no implicit scope or delayed evaluation, since everything is functions anyway

23:52 at least, that's true for fix. i guess you're returning actual values instead of functions

23:53 alexbaranosky: I think that's true

23:54 amalloy, curious, which of your useful fns/macros do you use most often?

23:54 amalloy: heh. useful.debug/?, probably

23:55 alexbaranosky: and on a totally unrelated note, I keep forgetting, are you still interested in cleaning up the Midje git repo?

23:56 if not maybe sometime when I'm feeling into it I'll ask for any pointers

23:58 amalloy, I've never tried debug/? ... I'll definitely check it out

23:59 amalloy: alexbaranosky: eh, marick (or whoever) is probably right that it's not worth the disruption it would cause

Logging service provided by n01se.net