#clojure logs

2012-01-08

00:08espringeWhy can't I use apply with recur? Like this:
00:08espringehttp://pastebin.com/wE4gtrcL
00:08espringeIf you replace the tail call with "recur" it no longer works
00:14cemerickespringe: apply would always be in tail call position there
00:14espringeUnless it was a macro, i presume
00:14espringeBut I don't see how to solve this problem
00:14espringehow do I have tail-call-recursion, with variable amount of arguments
00:15espringelike how can i get (mymax 1 2 3 4)
00:15espringeto do a tail call to (mymax 2 3 4)
00:19clj_newbladies and gentlemen, years from now, in a dictionary far far away, it shall be written
00:19clj_newbgreatness: clojure w/ types
00:20cemerickespringe: recur is strictly positional, can't be used with variadic fn params.
00:20cemerickIn this case, why bother when there's reduce?
00:21espringecemerick: No reason, just seemed to me like the logical way to implement it, but if I guess I'll just use reduce :D
00:21cemerickIf Clojure had TCO, it might be. :-)
00:49clj_newbis there a shorter way of writing: (list ~@x) ?
00:59cemerickclj_newb: often ~x, if x is a seq
01:04amalloyyeah, it's hard to say without knowing what the goal is
01:09clj_newbthe context is writing macros
01:09clj_newb~x doesn't work, since if x = (list 1 2 3), then ~x = (1 2 3)
01:09clojurebotI don't understand.
01:09clj_newband clojure tries to apply 1 to (2 3)
01:10clj_newbto be more specific, I have a piece of code that looks like:
01:10clj_newb`( ... (map (...) (list ~@ps) (list ~@vs)))
01:13clj_newbamalloy: PING
01:42markerdmanna bit of nostalgia: http://www.therestartpage.com/#
01:45clj_newbin a *.clj file; how do I get things like (1) current line number (2) current file name (3) current namesapce name?
01:51clj_newbfurthermore, how do I print the hierarchy of a java class?
01:51clj_newbi.e. I want to know who the ancestors of AssertionError are
01:51cemerick,(ancestors AssertionError)
01:51clojurebot#{java.io.Serializable java.lang.Error java.lang.Throwable java.lang.Object}
02:03clj_newb,(ancestors AssertionError)
02:03clojurebot#{java.io.Serializable java.lang.Error java.lang.Throwable java.lang.Object}
02:04clj_newb,(doc AssertionError)
02:04clojurebotGabh mo leithscéal?
02:31graphbumis it typical for inline-spec'd protocol functions, in a defrecord, to be 7-8X slower than identical functions called from outside the protocol?
02:37amalloyclj_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
02:38amalloygraphbum: i don't understand the question, but the answer is probably no. if you gisted something to explain the question...?
02:42clj_newbamalloy: does clojure have osmethign like __LINE__ which returns the current line number in the clj file?
02:43amalloy&(-> '(blah) meta :line) probably works
02:43lazybot⇒ 1
02:45graphbumamalloy: https://gist.github.com/1577624
02:45graphbumamalloy: hadn't used gist before, sorry for the wait.
02:46clj_newb,(doc ->)
02:46clojurebot"([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."
02:46amalloyokay, 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?
02:47graphbumamalloy: 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.
02:48graphbumamalloy: if I run the concrete implementation (which is basically banging on a priority-map), it's the most performant
02:49graphbumamalloy: 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
02:50graphbumamalloy: 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.
02:51amalloysorry, i don't understand any of this code
02:53graphbumamalloy: I guess the docstrings aren't helpful to you either.
02:53graphbumamalloy: ah well, thanks for the look.
03:04clj_newbsuppose "e" = (AssertionError. "blahblahblah"). Now, how can I extract (1) msg (2) file name and (3) line number from "e" ?
03:04clj_newb(I have tried :line, :file), but I get nil
03:28espringeIs there a way to do this:
03:28espringe(defn myfunction
03:28espringe ([a b] ....something...)
03:28espringe ([&catch_all_args] ...something else...))
03:28espringeThe compiler complains: Can't have fixed arity function with more params than variadic function
03:29clj_newbsuppose it gets two arguments; does it call the first or the second one?
03:29espringeThe first
03:29espringeotherwise, it should call the second
03:29espringeI guess it doesn't work like this?
03:30espringeI was thinking it would try match the first, and then if that failed, it would go for the next
03:30espringekind of like a pattern match on the arity?
04:46gourmorning
04:49gourat 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
04:49gourwondering how mature clojure is?
04:50gourwe're not really fan of lispy-language (not dived into scheme to fix gnucash reports), but still..
05:02clj_newbquestion: 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
05:19clj_newb,(with-meta false {:a 2}) ; <-- wtf, I can't attach meta data to false ?
05:19clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IObj>
05:24clj_newbis AssertionError a clojure or a java class?
05:27zilticlj_newb: Sounds clojure-y to me.
05:27clj_newbyeah; I was just hoping for a systematic way to find it
05:27clj_newbsince ancestors only shows ancestors and not the class itself
05:28ziltiI guess you won't find any classes in Clojure, since there aren't any
05:28clj_newbi believe clojure objects are java classes
05:29ziltiBut what exactly do you want to find? The source of AssertionError?
05:29ziltiYes, in the background, many clojure things are compiled the same way as Java classes
05:30clj_newbcome to think of it, konwing whether Assertionerror is java......AssertinError or clojure......AssertionError is absolutely useless to me
06:44gouris the choise of potential GUI toolkit for desktop app written in clojure same as with e.g. lua?
06:44gours/lua/scala
07:29ziltigour: ping
07:34michaelr525hello
07:40gourzilti: pong
07:41ziltigour: Did you already find what you've searched for? Were my two recommendations a help for you?
07:41gourzilti: which recommendations? did i miss something?
07:42ziltiThere are Clarity (https://github.com/stathissideris/clarity) and Seesaw (https://github.com/daveray/seesaw) for Clojure GUIs, both are under active development
07:43gourzilti: ahh, missed it somehow...will take a look. thanks...now it's lunch time
07:43ziltino problem :)
08:33gourzilti: looks interesting...although i'm not realy fond of swing's look
08:43ziltigour: AFAIR Clarity has some kind of CSS-like styling. Don't know about Seesaw.
08:53gourzilti: this looks modern :-)
08:54ziltiWhat?
08:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
08:54gourzilti: css-like styling
08:54gourzilti: what are some other language(s) you code in?
08:54ziltiAh. Yes
08:55ziltigour: I programmed in Java and Scala, but now Clojure is the only language.
08:55ziltigour: I'm not a "professional", I code for fun until I start studying. I'm in the army at the moment
08:55gourzilti: how would you compare clojure with scala?
08:57ziltiHmm 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.
08:58ziltigour: In which army have you been?
08:59gourzilti: in ex-yugoslavia, i'm from croatia
09:00gouryou haven't work with lisp before?
09:00ziltiNo. I did a littlebit of elisp when I started using Emacs for Scala development
09:00gourwhich editor you use with clojure?
09:00ziltiEmacs, too :)
09:01ziltiI don't miss anything for development with emacs and leiningen.
09:01gouri 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 :-/
09:02ziltipaid?
09:03gour*pain
09:03gourit was not RSI, but still..
09:03ziltiOh.
09:04ziltiI've not tried vim yet. But yeah, the key combinations in emacs can be annoying sometimes.
09:05ziltigour: Do you know how Clojure support in Vim is?
09:06gourzilti: no, idea, but mostly i see that vim has good support
09:07gourhere are some hits - http://www.deepbluelambda.org/programming/clojure/programming-clojure-with-vim
09:08gourzilti: what kind of apps you plan to write in clojure?
09:09ziltigour: Currently I'm working on a web page with noir/korma/pinot, and I plan writing a small game
09:11gourheh...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
09:13ziltigour: I'd say you won't regret trying a Lisp language ;)
09:13gourzilti: heh, maybe i should try starting smalle with scheme & gnucash then ;)
09:14ziltigour: Probably. But don't forget that Clojure is quite different from the classic Lisps
09:15gouryeah, but let's try to overcome syntax barrier 1st
09:17ziltiOh 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 :)
09:20gourhe he...btw, i really didn't like java code i saw so far, and that might be one cons for scala
09:23ziltiYes, Haskell looks very clear. Didn't really try to understand it, though
09:27gourit 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
09:29bsteuberI don't really like haskell syntax
09:30gourin general?
09:30bsteuberwhen using a do block nested somewhere else it's never clear to me when you need parens and when not
09:30bsteuberor was it pattern matching?
09:30gourheh, do blocks are syntax sugar...you can use >> operators instead
09:31bsteuberat least I remember always adding parens anyways because things broke without
09:31gourmaybe it's layout issue :-)
09:31bsteuberI think my indentation was right
09:31bsteuberbut anyways
09:31bsteuberyou get used to parens pretty soon ^^
09:32gourwell, no point to discuss about one's preferences ;)
09:32gouri'm more concerned about "batteries included"...that's D's weak part atm
09:33bsteuberyou mean like an IDE?
09:33gourmore about lib support...i'm not big fan of bloated IDEs
09:33bsteuberbut I don't really believe in "syntax preferences" - it's all a matter of familiarity
09:33ziltiI'd say with clojure you get more than just the batteries
09:34gourchoice of good-looking multi-platform toolkit is the one
09:34ziltigour: 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/
09:34bsteuberright gui frameworks suck almost everywhere
09:35ziltibsteuber: I didn't try it yet but the new JavaFX looks promising. Besides the fact that it lacks real platform independence
09:35gourright, some are just sucking less to paraphrase mutt
09:35ziltilol
09:36bsteuberfor me, html+clojurescript seems to be the least sucking "gui framework" atm
09:36bsteuberso all my apps now run in the browser
09:37bsteubereven if I have to start a local webserver at my user's computer :)
09:37ziltiI once found a nice-looking small Java GUI toolkit based on XML and SVG
09:37bsteuberto be honest, it's just one app at this point ^^
09:38ziltiI don't like html/css much, but maybe that's because I don't really know it
09:38bsteuberneither did I before we started this project
09:39bsteuberbut if you generate both html and css from clojure
09:39bsteuberyou really get a nice separation of content and design
09:40bsteuberand it's amazing how many effects you can get by simple dom manipulation
09:41gouri believe that html5 won't be rich enough for our app...otherwise no problem to launch local server if needed
09:41bsteuberI think you will never be able to find a gui framework that can create as flexible and good looking designs as html
09:41bsteuberever tried to define your own swing look and feel? oO
09:42gourbsteuber: i'm thinking about wx & qt
09:43bsteubergour: not many experiences with either
09:43bsteuberwell once I had to compile a five your old c++ program using an old wx version for windows
09:43bsteuberwhich was hell
09:43ziltic++ IS hell
09:44gourclojurescript sounds good...well, anything not called JS is cool
09:44bsteuberon the other hand, clojurescript isn't very mature atm
09:44bsteuberso relying in cljs for commercial products is at least very close to insane
09:45bsteuberthough we're doing fine up to now ^^
09:45gourwell, thanks to all for your input...we have to research more and stare a bit at some clojure code
09:46goursee you later, sometime...
10:28rabbler4clojure.com is 'down'. :-( It might have been mentioned but I thought I would say something.
10:57rabblerI tweeted the info that 4clojure is down, perhaps the team will get it. Wanted to do some problems.
11:24NarviusHello. 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:27NarviusAnd lein run works fine.
11:48LauJensenHi gents -I can't find this in the docs, but isn't there an enliven selector for referencing self ?
12:08LauJensenthis-node
12:32MagnarsBit of a noob here: Why can't my REPL find clojure.string? I tried (doc clojure.string/split), I tried (use clojure.string).
12:32Bronsayou have to (use 'clojure.string)
12:32Magnarsoh
12:33Magnarsthanks :)
12:33cgraysounds like you want to (require 'clojure.string) instead though
12:36MagnarsI'm slightly surprised that require would need the symbol quoted. Isn't it a macro?
12:37cgraynope
13:27clj_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:35alexbaranoskyclj_newb, proxy
13:36alexbaranosky&(doc proxy)
13:36lazybot⇒ "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:43mrevilI'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:45Scriptor,(conj 2 (map [1 2 3] identity))
13:45clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
13:46Scriptor,(conj 2 (map identity [1 2 3]))
13:46clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
13:46Bronsa,(conj (map identity [1 2 3]) 2)
13:46clojurebot(2 1 2 3)
13:46Scriptorthanks :)
13:46ScriptorI keep mixing it up
13:52alexbaranoskymrevil, I don't know, I use lein midje, which doesn't seem to have that problem for me
13:54gf3mrevil: I don't seem to have that issue when using speclj
14:20clj_newbwtf
14:20clj_newbso I'm readinga bout gen=-class
14:20clj_newband it claims that every namespace in Clojure is also its own java class
15:03TimMcclj_newb: Every namespace, function, and file, I think.
15:05TimMcclj_newb: I have a class with 3 fns that ends up generating 6 class files.
15:05mister_robotoJoin #noir
15:14technomancymrevil: if you can construct a simple repro case please open an issue on github
15:16TimMctechnomancy: Did you see my comment on the (closed) signed-Jar lein issue #31?
15:16TimMc(Not sure if github sends notifications...)
15:17TimMchttps://github.com/technomancy/leiningen/issues/31
15:17technomancyyeah, feel free to reopen
15:17technomancyif you can construct a failing test case even better
15:18TimMcCan't reopen -- no privs. But I'll get on the failing test case.
15:19technomancyoh, weird, I'll get it then.
15:19TimMcDo you get notifications of comments on issues?
15:19technomancyyeah, I had noticed it but hadn't taken a close look
15:19TimMcThat is, email vs. web interface.
15:19technomancymy github unread message count is at 1017, so I've pretty much switched over to email =)
15:20TimMcHa, OK.
15:20technomancythough it does show up on the dashboard
15:21technomancyif you submit a patch with a failing test case you can have commit rights on lein, which will let you reopen/tag issues. =)
15:21technomancyof course if I could turn that on for everyone I would
15:22TimMc There's no intermediate permission stage?
15:22technomancynothing obvious to me
15:23technomancyyou can restrict wiki edits to collaborators only, but not issues
15:58Scriptordid anyone else just get bombarded by a dozen emails from the clojure mailing list?
16:03Bronsayes
16:04mister_robotoIs anyone using noir w/ maven here
16:06alexbaranoskyanyone know how to test an exception is thrown using clojure.test?
16:06amalloyalexbaranosky: you want `thrown?`
16:06alexbaranoskyamalloy, thx!
16:11graphbumamalloy: 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:12graphbumamalloy: 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:13graphbumamalloy: fixed the problem, performance via protocol functions is about 50% slower, not 7-8X
16:14amalloyeven 50% seems a lot higher than it should be
16:14graphbumamalloy: is that more in line with expected performance?
16:14amalloybut i'm not sure
16:15hiredman50% slower than what? measured how?
16:15amalloyi 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:15graphbumamalloy
16:15graphbumack
16:16hiredmandirect calls to protocol functions, higher order calles, or what?
16:16graphbumamalloy: I understand.. I need to clarify my presenation, an to eliminate any vagueness in "what" I'm comparing.;
16:17mdeboardAnyone here have experience with neural nets?
16:18graphbumhiredman: 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:18graphbummdeboard: I've read a lot about them, never implemented or used directly though.
16:18amalloymdeboard: ~anyone :P
16:19mdeboardjust 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:19amalloyyeah, they're just nodes that are neither inputs nor outputs
16:20graphbumhiredman: 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:20graphbumhiredman: which led me to develop a Fringe protocol
16:21mdeboardamalloy: And in the sense of search, an input would be a query, and an output would be the link the user clicks on?
16:21mdeboards/would/could
16:21amalloyi guess?
16:21graphbumhiredman: 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:22graphbumhiredman: 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:24graphbumhiredman: 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:24graphbumhiredman: first implementation was to extend protocol to clojure.lang.PersistentTreeMap
16:25graphbumhiredman: second try was to define a record, pq, with only one 'data' field, then inline define the fringe protocol in the record definition.
16:27graphbumhiredman: 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:27graphbumhiredman: 1.5 times vs calling functions from the priorityq lib directly
16:30graphbumhiredman: I tested adding weighted nodes to the Fringe up to about 10^5, and the disparity seems to be pretty consistent
16:32graphbumhiredman: 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:34graphbumhiredman: 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:35graphbummdeboard: do you mean hidden layer?
16:36mdeboardgraphbum: Yeah
16:37mdeboardhidden layer being composed of hidden nodes
16:37mdeboardafaik
16:38graphbummdeboard: the node is a function, of a vector of inputs (outpus from other nodes), which determines if the node should fire or not
16:39mdeboardI see
16:39graphbummdeboard: 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:39graphbummdeboard: the more nodes you add in the middle, the more intermediate and complex connections you can get in the network.....
16:41graphbummdeboard: 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:42mdeboardRight, I'm reading a book & papers on the concept of neural networks, just needed clarification on hidden nodes/layers
16:43graphbummdeboard: 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:43mdeboardstimulus being a set of inputs to a function?
16:44graphbummdeboard: 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:44mdeboardgraphbum: That'st he book I'm reading :P
16:45graphbummdeboard: if you get deeper...there are some really interesting turns you can take in that field.
16:45graphbummdeboard: stimulus = input, yeah
16:45graphbummdeboard: that's one of the better, actually useful books that I've run across
16:46mdeboardgraphbum: 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:48graphbummdeboard: 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:49graphbummdeboard: i mean the quality of the classifier is dependent on the quality of the training set
16:49graphbummdeboard: and /or the "teacher"
17:04LauJensenDoes a Clojure library exist, which allows me to convert XHTML -> PDF ?
17:06TimMcProbably not, but I bet there's some other JVM lib that does.
17:07LauJensenThere's a couple, yea
17:16jodaroi'm not dyslexic, but i play one when i code
17:22lynaghkLauJensen, we just wrapped up a project using PhantomJS to render SVG on the server.
17:22LauJensenNice
17:22lynaghkPhantom is a headless WebKit build, so if you don't need to be 100% on the JVM you should look into it
17:25LauJensenI will
17:27lynaghkfeel 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:56caspercDoes 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:58alexbaranosky(:line (meta (var x)))
17:58caspercoh nice, I had no idea
17:58alexbaranoskydoes it work? :)
17:58casperci'll give it a try :)
17:59jodaroso i'm playing around with ScheduledThreadPoolExecutor
17:59alexbaranoskyI just tried it, and yep, look slike it works
17:59jodaroby way of overtone.at-at
18:00jodaroand i'm tyring to figure out what happens when the scheduled task runs longer than the specified delay
18:00TimMc,(:line (meta #'first))
18:00clojurebot49
18:00jodaroits using scheduleAtFixedRate
18:00jodaroi was thinking that the internal queue used might start to fill up
18:01jodarobut from a quick test it doesn't seem to
18:02caspercyeah, works like a charm alexbaranosky, thanks alot :)
18:02alexbaranoskycasperc, no problem
18:02TimMc$findarg < (:line (meta (var %))) 60 true
18:02lazybotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)
18:02TimMc^ oh well
18:02alexbaranoskyTimMc, what was that intended to do?
18:03alexbaranoskycurious
18:03TimMcFind vars that were declared in the first 60 lines of their files. :-)
18:04caspercheh, interesting
18:04TimMcI don't think $findarg plays well with macros.
18:08TimMcRight, it uses let instead of performing surgery on the exprs.
18:11TimMcTrying 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:13Scriptorif you conj an element to the beginning of a lazy list
18:13Scriptorhow does it handle length of the new list?
18:13TimMcOK, `git branch -t 1.x origin/1.x` seems to work, followed by a checkout. I give up on finding a single command.
18:13TimMcScriptor: A lazy seq, you mean?
18:13ScriptorTimMc: right, sorry
18:13TimMcseqs don't know their length
18:14TimMc&(counted? (range 10))
18:14lazybot⇒ false
18:14Scriptor&(counted? (conj 2 (range 10)))
18:14lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection
18:14Scriptordamnit
18:14Scriptor,(counted? (conj (range 10) 2))
18:14TimMc&(counted? (into () (range 10)))
18:14lazybot⇒ true
18:14clojurebotfalse
18:14Scriptoraha
18:14TimMcGood thing we were using diff't bots.
18:15Scriptorso the full lazy seq is only realized when you actually call count on it
18:15Scriptoreven if it's been conjoined onto?
18:15TimMcyep
18:16Scriptorgot it
18:16TimMcYou can realize a lazy seq that way.
18:16Scriptorby counting it?
18:16TimMcyep!
18:16Scriptormakes sense, I was wondering about that edge case
18:16TimMcdorun or doall is a more appropriate way, though
18:16Scriptoryea
18:17jodaro(dorun run run)
18:49amalloyTimMc: git checkout 1.x is generally sufficient. if there's a remote named the same thing it automatically tracks
18:50amalloyor you can be more explicit with git checkout -b 1.x origin/1.x (which i think also tracks but not sure)
19:05TimMcGrr, I really wish we had Pattern flags on our regex literals.
19:05TimMc(Pattern. (str #"foo") Pattern/CASE_INSENSITIVE) is pretty annoying.
19:05TimMc#"foo"i would be nice.
19:10TimMcWhoa, ClojureScript has been in progress since 2008?
19:14mrevilis there some easy way to overlay one sequence over another ex: (overlay [nil nil nil] [1 2]) and I get [1 2 nil] ?
19:15mrevilor i guess merge vectors
19:18jodarohrm
19:19TimMcmrevil: Is nil the only replaceable value, or false also?
19:20mrevilit could be any value like (overlay ["" "A" "B"] [1 2]) == [1 2 "B"]
19:20TimMcOh, I see -- the first coll is completely overwritten on conflict.
19:20mrevilyeah
19:20jodaro(reduce conj ... gets you part of the way i think
19:20jodarobut
19:21TimMcmrevil: (overlay [] [1 2 3]) => [1 2 3] ?
19:21jodarowith the vecs reversed
19:21jodarooh wait nevermind
19:21TimMcor is is truncated to the length of the first?
19:22mrevilfor my purposes it doesn't matter
19:22TimMcEasier to truncate, I think.
19:22amalloy&(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:22lazybot⇒ (1 2 "B")
19:23mrevilcool, thanks!
19:23TimMcAh, I was wondering how to deal with map stopping at the end of the shortest coll.
19:23amalloymight be easier to write with just lazy-seq though
19:26amalloy(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:41TimMcHah, I guess I can just add (?i) at the beginning of my regex.
19:42amalloyTimMc: right. you can't do that for every flag, though, like /x
19:43TimMc"Comments mode can also be enabled via the embedded flag expression (?x)."
19:45amalloyokay fiiiine. maybe i'm thinking of some other language's regexes
19:51TimMcGit question: I've submitted a pull request. Is it now bad to --amend the commit and change the range on the pull request?
20:00amalloyit's bad form if anyone's actually looked at the request, probably
20:00TimMcOops, it's not possible to change the range after you create it...
20:08TimMcOh, for pete's sake...
20:09chouserfnil is my new best friend
20:09TimMctechnomancy: I can't be trusted with pull requests.
20:30TimMcMaybe I'll make one more try of it...
21:14brudrickhi
21:19brudrickI'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:22amalloyyou can probably add `:checksum-deps true` to your project.clj to suppress that when it's unnecessary
21:25brudrickI'll try that
21:31technomancynah, it'll still run deps every time you deploy. the jars themselves should be cached though.
21:41brudricktechnomancy: 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:43amalloyno, push is definitely right
21:48brudrickk
21:53technomancyyou're fine. the cache gets cleared more often than it should be, but that's an internal issue
21:58mrevilwhy is vector not a sequence?
21:58mrevil(seq? [1 2]) == false
23:35tufflaksmrevil it is sequential?. seq? is only for seqs i think
23:38mrevilyou think that vector would implement iseq
23:41F333Any documentation around support for Java @annotations ?
23:42lnostdal(. (int 261) equals 261) => false ouch
23:42lnostdal..some libraries seem to use java.lang.Integer when i input 261 .. some (like clojure) use java.lang.Long when i input 261
23:45alexbaranoskyI 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:46alexbaranoskypretty much any time you have multiple checks against the same item
23:47amalloyalexbaranosky: useful.fn/fix :)
23:49alexbaranoskyamalloy, fix is the fn version of pred-cond it appears
23:49amalloywell, it does a bit more too
23:50amalloy(fix 4 even? #(* 2 %)) => 8
23:51alexbaranoskyI really should spend more time digging around in useful
23:51amalloyanyway, 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:52amalloyat least, that's true for fix. i guess you're returning actual values instead of functions
23:53alexbaranoskyI think that's true
23:54alexbaranoskyamalloy, curious, which of your useful fns/macros do you use most often?
23:54amalloyheh. useful.debug/?, probably
23:55alexbaranoskyand on a totally unrelated note, I keep forgetting, are you still interested in cleaning up the Midje git repo?
23:56alexbaranoskyif not maybe sometime when I'm feeling into it I'll ask for any pointers
23:58alexbaranoskyamalloy, I've never tried debug/? ... I'll definitely check it out
23:59amalloyalexbaranosky: eh, marick (or whoever) is probably right that it's not worth the disruption it would cause