2012-04-09
| 00:00 | autodidakto | :) and that sketchbook link? dusting off a 3 year old project? |
| 00:02 | technomancy | yeah, that was a crazy pre-leiningen project.clj file |
| 00:02 | technomancy | :dependencies [["clojure" "1.0.0" "org.clojure"] ...] |
| 00:02 | xeqi | I'm more surprised by the :source-dependencies |
| 00:03 | autodidakto | ah yes I see. Sometimes it's embarrassing to look at old work, but that's part of always getting better :) |
| 00:30 | aperiodic | can i access docs for the bots somehow? |
| 00:34 | amalloy | wellll, i'm not sure how much they actually have in the way of documentation. depending on what you want, lazybot's github wiki might be enough? |
| 00:38 | aperiodic | yeah, i just resorted to ddg after the first two things i tried didn't work |
| 01:28 | y3di | nothing in disclojure for over 10 days =/ |
| 01:38 | amalloy | i guess you missed the Great Disclojure Drought of '11? |
| 01:49 | tbatchelli | y3di, amalloy: sorry. Life gets busy sometimes |
| 01:49 | tbatchelli | :( |
| 01:49 | amalloy | tbatchelli: i don't mind |
| 01:49 | amalloy | sorry if i implied you have a civic duty or something; i was attempting to humorously put 10 days in perspective for y3di |
| 01:50 | tbatchelli | I didn't read it that way |
| 01:50 | tbatchelli | just letting you guys know that I'll be back soon :) |
| 02:28 | aperiodic | $mail samaaron i'm having a very odd issue with core protocols when using a particular java library with quil. could you take a look at this gist? https://gist.github.com/2341911#comments |
| 02:28 | lazybot | Message saved. |
| 03:40 | dsabanin | hi guys! |
| 03:40 | dsabanin | if I have macro defined like this: (defmacro job [job-name args & body] ...) how can I print job-name to the screen? |
| 03:41 | dsabanin | if I do `(println ~job-name) I get #<my.namespace$job-name@4af14e50> |
| 03:47 | lnostdal | "Tying polymorphism to inheritance is bad, protocols free you from that" .. ok..... by typing the same code over and over again? .. declaring the same fields over and over again? .. i still do not get all this stuff .. and books and blog posts only show possible solutions as fragments of a whole .... x) |
| 03:47 | dsabanin | solved it by doing `(println ~(str job-name)) |
| 03:49 | lnostdal | "Encapsulation of information is folly" but then why isn't it possible to access the fields; ..not even from subtypes? |
| 03:50 | lnostdal | this just does not make sense to me ... i see some of the benefits of extend-type and extend-protocol, but this other stuff i do not |
| 05:45 | ngw | hi * |
| 05:45 | mega` | good morning |
| 05:45 | mega` | * |
| 05:48 | Iceland_jack | hey * |
| 06:13 | ngw | do you guys know of any example of noir not using hiccup for HTML? |
| 06:13 | ngw | I would like to use clostashe |
| 06:16 | Bronsa | https://github.com/Raynes/refheap |
| 06:16 | Bronsa | this one is using stencil |
| 06:19 | ngw | oh very nice |
| 06:19 | ngw | thank you Bronsa |
| 06:19 | ngw | what are the differences between clostache and stencil? |
| 06:21 | Bronsa | i believe stencil is a bit faster |
| 06:25 | fliebel | How does eval work with namespaces? |
| 06:29 | fliebel | There must be a way to do (symbol *ns* 'foo) |
| 06:30 | Bronsa | intern? |
| 06:32 | fliebel | Bronsa: Lets see... it returns a var, but it might work. |
| 07:42 | Cr8 | nuts |
| 07:42 | Cr8 | i have an a list of numbers i really need to spit to a file as unsigned shorts |
| 07:43 | mega` | Oo |
| 07:44 | AimHere | Heh, dcpu16, I take it ;) |
| 07:49 | Cr8 | AimHere: yes :) |
| 07:52 | Cr8 | i'm surprised i haven't run into java's lack of unsigned types being a major pain before |
| 08:10 | kahlin | Hey... I'm trying to grasp clojure concurrency. If I want to pass messages between threads (I want to get messages from RabbitMQ in one thread and "use" them in another thread), is it a good idea to use agents and add-watch? |
| 08:29 | bhenry | can someone point me in the direction of an open source project that uses lobos? |
| 08:39 | Cr8 | well, dealt with my unsigned short issue |
| 08:40 | Bronsa | how did you do? |
| 08:40 | jayunit100 | hi guys |
| 08:41 | jayunit100 | Wtf is a "chunked seq?" |
| 08:41 | rod_ | jayunit100: doesn't clojure's lazyseq chunk by default, so probably that? |
| 08:42 | jayunit100 | ah i see now |
| 08:42 | Bronsa | it also refers to how some datastructures are implemented afaik |
| 08:42 | jayunit100 | if you call "seq" on a vector, you get a "chunked seq" back. |
| 08:42 | jayunit100 | and then, you cant call things like "subvec" |
| 08:43 | jayunit100 | there should be a "subseq" thats analagous to (subvec) |
| 08:43 | Bronsa | when a persistent vector is chuncked, it means that walking the persistent vector tree is necessary only after 32 elements |
| 08:43 | Bronsa | if i understand it correctly |
| 08:44 | jayunit100 | ,(subseq '("a" "b" "c") 0) |
| 08:44 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$subseq> |
| 08:45 | jayunit100 | toooo bad i guess. So is there a generic way to get a sublist (i.e. that works on vectors, seqs, anything seqable?) |
| 08:46 | Bronsa | ,(drop 1 '(1 2 3)) |
| 08:46 | clojurebot | (2 3) |
| 08:47 | jayunit100 | hmm can we drop from both ends? |
| 08:48 | Bronsa | ,(subvec [1 2 3 4 5 6 7] 2 5) |
| 08:48 | clojurebot | [3 4 5] |
| 08:48 | Bronsa | ,(take 3 (drop 2 '(1 2 3 4 5 6 7))) |
| 08:48 | clojurebot | (3 4 5) |
| 08:49 | jayunit100 | yup i guess that'll do it. definetly deserves a utility func. |
| 08:49 | jayunit100 | should be in core. sublists are pretty fundamental. |
| 08:49 | Raynes | Pretty slow too. |
| 08:49 | Bronsa | you just need to (take (- end start) (drop start seq)) i guess |
| 08:50 | jayunit100 | sublists shouldnt be slow for vectors. maybe for lists. |
| 08:50 | jayunit100 | and especially if they were lazy, they should be constant time for a vector. |
| 09:25 | Raynes | clj-php |
| 09:25 | Raynes | This must be promising. |
| 09:54 | dnolen | for CLJS users who may not have heard - there's a comprehensive optimizations branch https://github.com/clojure/clojurescript/compare/master...all-optimizations |
| 09:55 | dnolen | please try it out. So far the reports have been positive. If I don't hear any serious complaints I'll probably merge it in a couple of days. |
| 09:55 | halfprogrammer | exit |
| 10:02 | dgrnbrg | technomancy: I was wondering if you could help me debug my lein-guzheng plugin? It's at github.com/dgrnbrg/lein-guzheng. It fails w/ a loader error, and I don't understand how the system works (lein 1.6.2) |
| 10:05 | bhenry | survey: what is the community consensus on what to use for creating and managing relational db schemas with clojure? |
| 10:06 | bhenry | specifically postgresql if that makes a difference |
| 10:27 | zaargy | hi, i'm working through the book practical clojure and come across this error: http://pastie.org/3755803 |
| 10:28 | zaargy | help? thanks! |
| 10:29 | S11001001 | zaargy: why are you calling apply in with-line-item-conditions? |
| 10:29 | zaargy | that's what hte book says |
| 10:29 | zaargy | i don't even know why yet :) |
| 10:30 | S11001001 | zaargy: did you follow the example for *calling* w-l-i-c exactly? |
| 10:30 | rod_ | zaargy: looks like you don't need apply, just use (f price quantity) |
| 10:30 | zaargy | in the book, it's executed via repl |
| 10:30 | zaargy | but otherwise same |
| 10:30 | S11001001 | zaargy: what about basic-item-total? |
| 10:31 | zaargy | the pastie is as it appears in the book |
| 10:31 | zaargy | maybe it's an older version? |
| 10:31 | gtrak` | apply takes sequences |
| 10:31 | zaargy | removing apply works |
| 10:31 | gtrak` | you pass in 1 and it's not a sequence |
| 10:31 | S11001001 | zaargy: most certainly not; apply is an old function with decades of the same semantics |
| 10:32 | zaargy | well the book is incorrect |
| 10:32 | babilen | Hi, I am looking for the website that listed clojure libraries by number of reverse dependencies. Can't seem to find it again though :-/ |
| 10:32 | S11001001 | (except in clojure you can pass infinite sequences as the last arg, of course :) |
| 10:32 | zaargy | book is clojure in action actually |
| 10:32 | zaargy | can upload a screenshot of the page if you don't believe me ;) |
| 10:32 | rod_ | zaargy: then last argument to apply needs to be a sequence. ie. (with-live-item-conditions 1 [2]) |
| 10:33 | gtrak` | look at the function signature and you will understand: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L596 |
| 10:34 | zaargy | http://dl.dropbox.com/u/29336917/clojurebookerror.png fwiw |
| 10:34 | zaargy | gtrak`: thanks |
| 10:34 | zaargy | as i said, i've only just started working through the examples in the book |
| 10:35 | zaargy | opps, wrong page |
| 10:35 | yangsx | babilen: maybe you mean 'used by' in http://clojuresphere.herokuapp.com/ |
| 10:36 | cemerick | zaargy: yeah, that code is wrong :-( |
| 10:36 | zaargy | http://dl.dropbox.com/u/29336917/clojurebookerror.png now |
| 10:36 | babilen | yangsx: yes, exactly :) thanks! |
| 10:37 | S11001001 | zaargy: Huh. Well, the manning forum's there for errata |
| 10:38 | zaargy | yes, yes. will add. |
| 10:38 | fdaoud | zaargy: I remember that exactly. It's an error in the book. |
| 10:41 | fdaoud | Authors do their best to avoid errors. But readers -> working through those things are part of learning. |
| 10:41 | gtrak` | just add liberal use of 'an exercise left to the reader' |
| 10:41 | fdaoud | yeah that can be abused. |
| 10:42 | gtrak` | 'you know that thing you're trying to learn? go figure it out' |
| 10:42 | cemerick | A living code repo helps. |
| 10:43 | fdaoud | gtrak`: mix with a healthy helping of "outside the scope of this book" |
| 10:43 | gtrak` | haha |
| 10:43 | zaargy | sure. it's a pretty good book otherwise. |
| 10:43 | gtrak` | i'd rather them just not say anything if they start saying stuff like that |
| 10:44 | fdaoud | gtrak`: used in twice in my book :/ |
| 10:44 | gtrak` | oh, did you write one? |
| 10:44 | cemerick | I think the only time we say something like that when discussing improvements you could make to the mandelbrot set visualization (e.g. use continuous colors instead of discrete, etc) |
| 10:45 | cemerick | s/when/is when |
| 10:45 | S11001001 | The benefits and drawbacks of automatic repl inclusion: http://book.realworldhaskell.org/read/systems-programming-in-haskell.html#x_Bc |
| 10:46 | gtrak` | cemerick, that sounds reasonable, I've had some texts that angered me though :-) |
| 10:46 | fdaoud | gtrak`: yes, this one- http://www.amazon.com/gp/product/1934356212 |
| 10:46 | gtrak` | ahh, awesome, I hope one day I will know something enough to write about it |
| 10:47 | fdaoud | gtrak`: I'd like to write about Clojure. Still need to learn more though. :) |
| 10:48 | cemerick | oh right, there's also the question of whether the variant of Wilson's maze algorithm we show is probabilistically fair. |
| 10:48 | cemerick | "Empirical measures (looking at the maze distribution over samples generated by both Wilson’s and our algorithms) hint that this property still holds in our variant, but we haven’t proved it formally and we haven’t computed its time complexity. This is left as an exercise to the reader." :-| |
| 10:48 | cemerick | So, two instances. |
| 10:49 | fdaoud | I know readers love that, so the first time I wrote "had to use that 'outside the scope' phrase didn't I" and the second time I wrote "going into more depth is--wait for it--outside the scope of this book." |
| 10:49 | Bronsa | fair enough |
| 11:13 | Vinzent | Is it just me or second level headers (##) in marginalia-generated page are bigger than the first level ones (#)? |
| 11:35 | Scorchin | ANN: I was bored this morning and thought I'd start work on a simple PDF generation/manipulation library. Camelot: https://github.com/KushalP/camelot |
| 11:53 | y3di | do the devs of prismatic hangout in this irc? |
| 11:53 | y3di | channel* |
| 12:03 | groove | hi guys, it looks like (dissoc-in) isn't working for me (I get a symbol not found error). I'm using (assoc-in) without any problems. Any ideas? |
| 12:04 | Bronsa | there's no dissoc-in in clojure.core |
| 12:05 | groove | do I need to (:use clojure.contrib.core)? |
| 12:06 | groove | here's the doc I'm looking at: http://clojuredocs.org/clojure_contrib/clojure.contrib.core/dissoc-in |
| 12:06 | dnolen | groove: old contrib is deprecated |
| 12:06 | Bronsa | is it in core.incubator maybe? |
| 12:06 | Bronsa | yeah |
| 12:08 | groove | ah, thanks. How do I add that to my namespace? |
| 12:08 | groove | and, I suppose I should ask if there's a better, more up-to-date way to return a map without a nested object? |
| 12:10 | Bronsa | groove: put [org.clojure/core.incubator "0.1.0"] |
| 12:10 | Bronsa | then (:use [clojure.core.incubator :only [dissoc-in]]) |
| 12:11 | Bronsa | *put on your :depenencies |
| 12:11 | groove | Bronsa: thank you! sorry I'm such a newb. |
| 12:11 | Bronsa | nevermind :) |
| 12:15 | nDuff | ...having CLJ-318 marked as closed in release 1.2 is very encouraging, but I'm having getting some trouble getting annotations to attach to static methods in the 1.4-beta series. |
| 12:33 | llasram | nDuff: Do you have it working for non-static methods, and just not for static methods? |
| 13:22 | nDuff | Gah. |
| 13:22 | llasram | ? |
| 13:22 | mdeboard | nnf |
| 13:26 | kurtharriger | Is there a function in clojure 1.3 that will re-export a var imported from another ns into this one? e.g. (require 'other) (def somethingcool other/somethingcool), but also copying doc strings? |
| 13:27 | lpetit | Eclipse users: I've just released the first beta version of Leiningen support for Eclispe |
| 13:28 | lpetit | As a separate update site, here: http://ccw.cgrand.net/updatesite-lein-betas |
| 13:28 | heow | woohoo! |
| 13:28 | technoma` | kurtharriger: that kind of thing is generally considered to be problematic unless done for backwards-compatibility reasons |
| 13:28 | lpetit | Should work both with Counterclockwise 0.6.0 and Counterclockwise 0.7.0.beta |
| 13:29 | nDuff | ...hmm. Uncommenting the tests for the expected-to-work bits, they *do* work... so clearly I'm doing something different. |
| 13:29 | lpetit | I'm considering this Lein support Beta as quite stable, tho still not feature complete. Please install and report feedback on the Counterclockwise mailing list! |
| 13:32 | kurtharriger | yeah thats mostly the idea, doing some refactoring and want to reorganize my packages a bit without breaking existing code. |
| 13:32 | technoma` | kurtharriger: here's what I did in Leiningen 1.x: https://github.com/technomancy/leiningen/blob/1.x/src/leiningen/core.clj#L13 |
| 13:32 | kurtharriger | I guess maybe a better option is to (def ^{:doc "deprecated, please use..."} dosomethingcool..) |
| 13:33 | technoma` | kurtharriger: I like using a delay to emit the warning only once |
| 13:33 | kurtharriger | yeah thats cool |
| 13:34 | kurtharriger | technoma`: thanks, this looks even better than what I expected |
| 14:01 | karchie | I have a bunch of XML processing code done in clojure.xml and data.zip. I'd like to re-export as XML; is there a smart way to do this? c.xml/emit appears to be broken; c.data.xml has a working emit but uses an entirely different format. |
| 14:28 | mac | whats the sinatra/flask equivalent for clojure? |
| 14:29 | technoma` | compojure is often compared to sinatra |
| 14:29 | mac | is noir more like a rails? |
| 14:29 | Bronsa | i wont say so |
| 14:30 | Raynes | Noir is nothing like rails. |
| 14:30 | technoma` | it's ... more like rails than compojure is, I guess =) |
| 14:30 | Raynes | One could compare noir to sinatra as well. |
| 14:30 | Raynes | technoma`: A piece of string is more like rails than compojure is. |
| 14:30 | technoma` | Raynes: this is true |
| 14:31 | fdaoud | mac: if you want something that's trying to be like rails, you'd probably look at https://github.com/macourtney/Conjure |
| 14:31 | rod_ | don't think anyone's made anything as "complete" as rails in clojure. |
| 14:32 | mac | no rails is whack, i want a lightweight framework akin to flask (and sinatra i guess) |
| 14:32 | Raynes | Does anyone actually use conjure? |
| 14:32 | technoma` | well, conjure is a long way away from rails, despite its intentions |
| 14:32 | Bronsa | mac: I'd go with noir. |
| 14:33 | mac | how would you compare noir to ring |
| 14:33 | technoma` | Raynes: http://clojuresphere.herokuapp.com/conjure |
| 14:33 | fdaoud | Raynes: I tried it, and it's kind of like rails, which is why I stopped using it. |
| 14:33 | jaen | Well, maybe it's for the better. I code in Rails and I still don't know how it works. |
| 14:33 | jaen | If I implemented a site in Noir |
| 14:33 | jaen | I would be better off probablt |
| 14:33 | jaen | *probably |
| 14:33 | Bronsa | mac: noir is built on top of compojure that it is built on top of ring |
| 14:33 | mac | ah |
| 14:34 | Raynes | technoma`: Guess not. |
| 14:34 | Raynes | Noir is just a bit higher level than compojure with some built in niceties like stateful sessions and stuff. |
| 14:35 | muhoo | can anyone recommend an overview of how to deal with nosql stuff (like couch) for someone steeped in decades of thinking in SQL? |
| 14:35 | Bronsa | and a really nicer API |
| 14:38 | mac | are there any options other than noir> |
| 14:38 | devn | madison square clabango |
| 14:38 | devn | clabango |
| 14:39 | devn | http://clojure-log.n01se.net/date/2009-03-11.html |
| 14:41 | devn | clojurebot: I was just minding my own business, when suddenly... |
| 14:41 | clojurebot | No entiendo |
| 14:41 | devn | clojurebot: suddenly is <reply>CLABANGO! |
| 14:41 | clojurebot | c'est bon! |
| 14:44 | technoma` | devn: clojurebot is fuzzy, but he's not THAT fuzzy |
| 14:44 | devn | :( |
| 14:44 | devn | technoma`: i had issue with the lein-heroku plugin on lein2, you know about that? |
| 14:44 | fliebel | muhoo: CouchDB has a guide, which has a cookbook full of common things in the SQL and Couch way. |
| 14:45 | devn | technoma`: something about not finding core util or something |
| 14:45 | technoma` | devn: not specifically, but it doesn't surprise me. I'm still on the fence about whether lein-heroku is worth maintaining in addition to the gem |
| 14:45 | technoma` | would be interested in feedback on that question, actually. |
| 14:45 | devn | gotcha -- i just went about upgrading to lein2 yesterday and found myself on the plugins page trying out a slew of them |
| 14:46 | ibdknox | technoma`: I'd remove it |
| 14:46 | devn | technoma`: i go back and forth. i re-watched neal ford's conj 2011 talk last night and the "productivity pirates" will be enticed by an easy story around heroku deployment |
| 14:46 | technoma` | devn: definitely interested in data on which other plugins need upgrading |
| 14:46 | technoma` | ibdknox: well, at most I'd just add a "don't use this" note to the readme/description |
| 14:46 | ibdknox | devn it's already stupid easy |
| 14:46 | devn | technoma`: ill make you a list tonight. |
| 14:47 | ibdknox | heroku create --stack cedar |
| 14:47 | ibdknox | git push heroku master |
| 14:47 | ibdknox | done |
| 14:47 | ibdknox | you don't even *have* to have a procfule |
| 14:47 | technoma` | devn: I think the more likely split re: enterprisey folks is that of CLI-phobes rather than people interested in avoiding ruby |
| 14:47 | ibdknox | procfile* |
| 14:47 | devn | not so fast! if you have an .rvmrc and a Gemfile in your git repo |
| 14:47 | Raynes | Procfile* |
| 14:47 | devn | you will be recognized as a ruby project |
| 14:48 | devn | i dont use heroku in every project, so it's not a global for me. |
| 14:48 | technoma` | now that you can install the heroku CLI without using rubygems I think the main motivation behind lein-heroku goes away |
| 14:48 | devn | just sayin... i guess i would say that having a heroku lein plugin is cool, but it could be a subset of features the gem provides to aid its maintainability |
| 14:48 | devn | technoma`: good point |
| 14:56 | fliebel | technoma`: I thought one of the nicer things abour cake was that you could simply say gem install cake. |
| 14:56 | Raynes | Some people actually complained about that. |
| 14:56 | fliebel | So what is good about heroku without gems? |
| 14:56 | fliebel | hm |
| 14:57 | Raynes | "HEY, YOU GOT RUBY ON MY CLOJURE!" |
| 14:57 | muhoo | fliebel: thanks |
| 14:57 | technoma` | fliebel: lots of people prefer installing via apt-get |
| 14:57 | technoma` | it's much better integrated into the system and supports signed packages a lot better |
| 14:58 | fliebel | Raynes: I wasn't aware that windows users where using Clojure ;) |
| 14:58 | muhoo | wow. |
| 14:58 | fliebel | muhoo: ? |
| 14:58 | muhoo | this is the first time since the 1990's that i've had to register to read a white paper. :-0 |
| 14:58 | Raynes | fliebel: Only Windows 95 users. |
| 14:59 | muhoo | i've been in linux/foss land too long, i guess. |
| 14:59 | emezeske | devn, technomancy: I've noticed that at least one plugin has to be installed with a different version under lein1 and lein2 to work (lein-midje). Probably worth keeping in mind during testing. |
| 15:00 | technoma` | yeah, I think we've been able to keep that to a minimum though |
| 15:00 | technoma` | afaik midje is the only culprit |
| 15:00 | emezeske | technomancy: Oh, good! |
| 15:01 | technoma` | well, of the plugin authors that have asked me at least =) |
| 15:01 | fliebel | Raynes: Cool. That explains why I never see them on IRC, with their dialup modems. |
| 15:01 | emezeske | technomancy: FYI, cljsbuild is 100% on lein2 now |
| 15:04 | technoma` | sweet |
| 15:06 | technoma` | emezeske: you mean 100% compatible, or 100% required for cljsbuild? |
| 15:11 | dnolen | emezeske: oh so did 0.1.7 go out? |
| 15:12 | emezeske | technomancy: Oh, that was ambiguous |
| 15:12 | emezeske | technomancy: 100% compatible ^_^ |
| 15:13 | technoma` | cool |
| 15:13 | emezeske | dnolen, technomancy: Err, 0.1.7 is not out yet, so I'm actually lying about 100% compat until the next release X) |
| 15:14 | emezeske | dnolen: Is there a specific feature you need from 0.1.7? |
| 15:14 | devn | technoma`: the immutant guys were sounding like they couldnt maintain compatibility between lein versions. i dont know if their issue was like the one you're referring to in midje, but if there's a fix for that maybe it's worth mentioning to jcrossley3 or tcrawley |
| 15:15 | dnolen | emezeske: not really - analyzing the source-path before launching the repl would be nice - but that can arrive at your convenience. |
| 15:16 | emezeske | dnolen: Okay, cool. I *could* push it out, but I'm finally writing comprehensive unit tests, and want to wait till I'm done with that first |
| 15:16 | tcrawley | devn: technoma`: it's been a couple of weeks since I looked at our plugin, so I don't remember the specific difficulty for not supporting both. I'll take a look at that soonish |
| 15:16 | emezeske | dnolen: The analyze stuff might be 0.1.8, not sure yet |
| 15:16 | ibdknox | the analysis trees from the analyzer are hard to work with |
| 15:17 | ibdknox | I'm finding |
| 15:17 | dnolen | emezeske: sure sounds good. |
| 15:17 | dnolen | ibdknox: what are you finding problematic? Having spent a lot of time in the compiler this weekend they seem nice. |
| 15:17 | ibdknox | they weren't designed for some of the things I'm trying to do with them :) |
| 15:18 | dnolen | ibdknox: like what? |
| 15:19 | ibdknox | maybe I'm just misreading it somehow, but take the case of (let [x 1 x (inc x)] x) |
| 15:19 | technoma` | wow, unit tests for a lein plugin; that's a first =) |
| 15:20 | ibdknox | I can't seem to get the analysis tree to map cleanly back to that code such that I can known with certainty what x is at each point |
| 15:20 | ibdknox | part of that is I'm having trouble making sure that meta flows through the compiler for everything correctly |
| 15:20 | ibdknox | dnolen: ^ |
| 15:21 | dnolen | ibdknox: metadata on forms? |
| 15:21 | ibdknox | I have position data on symbols now too :) |
| 15:22 | dnolen | ibdknox: well aren't symbols forms too? :) |
| 15:22 | ibdknox | right lol |
| 15:22 | ibdknox | right now I'm struggling with losing things from the sym -> var transition |
| 15:23 | dnolen | ibdknox: yeah there will probably need to be changes to preserve metadata. I ran into that the same thing getting type inference to work. |
| 15:37 | nDuff | Why does (meta ^{DoesNotExist true}[]) return nil? I would expect either a RuntimeException on being unable to resolve DoesNotExist or a map with some variant on DoesNotExist (as a symbol, perhaps?) as a key. |
| 15:37 | TimMc | nDuff: ^ attaches metadata for the compiler |
| 15:37 | TimMc | nDuff: meta acts on runtime-level values |
| 15:38 | TimMc | You're probably looking for with-meta |
| 15:39 | nDuff | ...well -- my *actual* intent is to better understand what's going on during add-annotations calls from gen-class |
| 15:39 | amalloy | quick, someone write a blog post about the difference between ^{:foo 1} and (with-meta x {:foo 1}) so we can give clojurebot a factoid |
| 15:39 | TimMc | amalloy: SOunds like you're volunteering! |
| 15:39 | amalloy | TimMc: my blog has been idle for like a year, man. it's your turn to write something |
| 15:40 | TimMc | I fail to follow this logic. |
| 15:40 | amalloy | you can put that in your blog too |
| 15:40 | TimMc | sweet |
| 15:40 | kurtharriger | nDuff: I do get an exception unable to resolve symbol: DoesNotExist in this context. are you missing : (meta ^{:DoesNotExist true} []) returns {:DoesNotExist true} |
| 15:40 | TimMc | Well, DoesNotExist is presumably some imported class, here. |
| 15:40 | nDuff | kurtharriger: ...if I got that exception too, the world would make more sense. |
| 15:41 | nDuff | ahh. |
| 15:41 | amalloy | kurtharriger: the compiler's error handling changed in 1.3 |
| 15:41 | amalloy | i believe is what makes the difference there |
| 15:41 | nDuff | (this is 1.4-beta6) |
| 15:41 | kurtharriger | I'm using 1.3 now, just typed that in my repl... do you have a dirty repl where DoesNotExist is some how defined |
| 15:42 | kurtharriger | ah okay that might be it maybe its a 1.4 regression |
| 15:45 | jondot_ | hi all, i have a list of predicate functions to run (each taking 2 arguments) |
| 15:45 | jondot_ | what would be an idiomatic to run all of them on a single input and perform a logical AND between all? |
| 15:45 | amalloy | every?/map? |
| 15:45 | jondot_ | i was thinking map'ing all of the functions on an input and then collapsing the true/false result list |
| 15:45 | ibdknox | (every? #(% 1 2) funcs) |
| 15:46 | jondot_ | ah. perhaps every? is more suitable |
| 15:47 | nDuff | ...well, waitaminute here... |
| 15:47 | nDuff | doesn't look like a 1.4 regression -- I get the same behavior in 1.3.0 |
| 15:47 | arohner | man does git make the worst mess of clojure merge conflicts |
| 15:48 | muhoo | we need a scm in clj that understands forms and can make merges at the symbol level :-) |
| 15:48 | TimMc | structural diff |
| 15:48 | TimMc | the holy grail |
| 15:48 | arohner | muhoo: yes. line-based diffing has horrific results in lisps |
| 15:48 | muhoo | arohner: indeed )))))))))) |
| 15:49 | jtoy | recently when i reload my ode in the repl, i get this error: java.lang.Exception: Unable to resolve symbol: in this context (NO_SOURCE_FILE:0) |
| 15:49 | jtoy | pretty hard to debug :( |
| 15:50 | llasram | nDuff: I'd asked earlier -- do you have annotations on non-static methods working fine? Only having problems with static methods now? |
| 15:50 | Raynes | Obviously just need to find an invisible symbol. |
| 15:50 | TimMc | grep for \b\b, duh :-P |
| 15:51 | amalloy | TimMc: that should match anywhere \b does, right? |
| 15:51 | amalloy | i mean, i get the joke, but it doesn't seem quite right |
| 15:51 | nDuff | llasram: sorry, I missed that question; initially I'd only tested with static methods, but non-static methods have the same issue. |
| 15:51 | muhoo | jtoy: i suspect a macro has gone wonky somewhere |
| 15:52 | llasram | nDuff: pastie for how you're adding the metadata? |
| 15:52 | jtoy | muhoo: ok, i'll try to remove them one at a time |
| 15:52 | llasram | Er, refheap rather |
| 15:52 | nDuff | llasram: http://stackoverflow.com/questions/10049060/clojure-attaching-annotations-to-aot-compiled-methods |
| 15:53 | foodoo | What kind of data types does the (shorts) function accept? I can't come up with a working example except for (shorts (make-array Short/TYPE 5)) which is pointless. |
| 15:53 | hiredman | have you read the docstring for shorts? |
| 15:54 | foodoo | hiredman: yes, it just says that it casts to short[] |
| 15:54 | gfredericks | does emezeske or anyone know how easy it would be to use the lein-cljsbuild support module from maven? |
| 15:55 | TimMc | foodoo: Well, that's all it does. It's just used for interop, as far as I know. |
| 15:55 | llasram | nDuff: From reading the source code, I'm pretty sure that the annotation metadata ... er, annotations :-) need to go on the method-name symbol. The :static metadata is in the right place though |
| 15:55 | foodoo | TimMc: I'd like to write a sequence of shorts to a file. What is the best approach for this? |
| 15:55 | nDuff | *facepalms* |
| 15:56 | emezeske | gfredericks: I know very little about maven |
| 15:56 | TimMc | foodoo: You probably don't want to mess with arrays, then. |
| 15:56 | emezeske | gfredericks: But I have tried to make the support module fairly generic |
| 15:57 | TimMc | Hmm. It depends on what kind of serialization you are interested in. |
| 15:57 | emezeske | gfredericks: Mostly I've tried to keep all the config/lein-specific stuff in the plugin module |
| 15:57 | nDuff | llasram: ...thinking you're right -- at least I'm seeing them in the disassembled class files now. |
| 15:57 | foodoo | My current situation is that I have a list of Longs and I need to truncate them to 16 bits for writing |
| 15:58 | foodoo | and these Longs should be smaller than 2^16 so truncating would be okay |
| 15:58 | gfredericks | emezeske: what's the interface like to the support module? I imagine it wouldn't accept the :cljsbuild map from the project.clj? |
| 15:58 | emezeske | gfredericks: Yeah, the :cljsbuild map stuff is all handled by the plugin itself |
| 15:58 | TimMc | foodoo: What consumes this data? |
| 15:58 | emezeske | gfredericks: The support API is lower-level than that |
| 15:58 | TimMc | foodoo: Humans? and/or Java? and/or Clojure? |
| 15:58 | foodoo | TimMc: I'm writing an Assembler. |
| 15:59 | foodoo | So I have no choice about the output format. I have to stick to the specification |
| 16:00 | TimMc | foodoo: Ah, a specified binary format? You may be interested in gloss. |
| 16:00 | TimMc | https://github.com/ztellman/gloss |
| 16:00 | gfredericks | emezeske: my coworker wrote an ad-hoc build script that spits out the single-file compilation |
| 16:00 | foodoo | thanks. I'll have a look |
| 16:00 | gfredericks | so I need to figure out how to emulate the everything-in-one-file thing that cljsbuild does |
| 16:02 | emezeske | gfredericks: I don't think cljsbuild does anything special there, really; it all comes out in one file if you use :optimizations |
| 16:03 | mklappstuhl | Which Clojure book can you recommend for one who is also interested in the broader aspects of Lisp-alike languages? |
| 16:04 | gfredericks | hrm |
| 16:04 | gfredericks | I didn't think optimizations had anything besides :whitespace |
| 16:04 | cemerick | mklappstuhl: an odd question, methinks :-) |
| 16:04 | ibdknox | :simple :advanced |
| 16:04 | ibdknox | gfredericks: either of those will concat |
| 16:05 | mklappstuhl | cemerick: Is it? There are just a few books out there but I am not enough into clojure to judge for myself I guess ;) |
| 16:05 | gfredericks | ibdknox: yes I mean I thought my cljsbuild was configured with :whitespace yet still went to one file |
| 16:05 | ljos | Hi - is it just my emacs/slime or is there a problem with (read) and (read-string) in slime? I've tried it in the repl and it seems to work there. |
| 16:06 | cemerick | mklappstuhl: well, talking about "Lisp in general" would be a dubious objective IMO, even leaving Clojure aside |
| 16:06 | ljos | (read-line) not string. |
| 16:06 | ibdknox | gfredericks: ah, whitespace probably concats too then :) |
| 16:06 | gfredericks | ibdknox: emezeske: just confirmed it was whitespace |
| 16:06 | cemerick | mklappstuhl: The closest you can get to that is e.g. On Lisp or Lisp in Small Pieces, but those hardly generalize to e.g. CL and all the schemes and dylan and… |
| 16:07 | mklappstuhl | cemerick: I want more pages on macros and functional programming idioms than on web-development related stuff for example |
| 16:08 | cemerick | ah |
| 16:08 | mklappstuhl | a more pure programming book and less a tutorial |
| 16:08 | mklappstuhl | I hope that makes it a little more understandable |
| 16:08 | cemerick | mklappstuhl: I am biased towards http://clojurebook.com of course; we try to hit both the principled and the practical very hard |
| 16:09 | cemerick | mklappstuhl: Joy of Clojure might be more of what you're looking for, if you're actively avoiding practicums, etc. |
| 16:09 | emezeske | gfredericks: Yeah, I think any non-nil :optimizations compile to one file if you provide an :output-to |
| 16:09 | mklappstuhl | cemerick: I read your history with the clojure community once, really great story :) |
| 16:10 | cemerick | mklappstuhl: someone wrote up my history with the community? o.0 |
| 16:10 | ljos | mklappstuhl: I came in a little late and I am a bit unsure what you are talking about, but I very much enjoyed Let Over Lambda. Even though it's focus is CL it goes over macros in a very good way. |
| 16:10 | nDuff | llasram: ...well, not so much: I'm able to attach Deprecated now, which is an improvement, but the QueryModule$Requires and QueryModule$Deterministic annotations are nowhere to be seen. |
| 16:10 | gfredericks | emezeske: oh maybe I'll have to figure out what behavior :output-to triggers |
| 16:11 | emezeske | gfredericks: I think that's the right direction to look. |
| 16:11 | gfredericks | emezeske: ty sir |
| 16:11 | emezeske | gfredericks: No prob. |
| 16:12 | mklappstuhl | cemerick: Didn't you do? Maybe I'm mixing something up here but I though it would be you :p |
| 16:12 | amalloy | Let Over Lambda is not really a book i'd recommend to someone looking for a general survey of lispy things |
| 16:13 | mklappstuhl | did anyone walk through The Little Schemer with clojure? |
| 16:13 | amalloy | there was definitely some interesting stuff in there, but he spends a lot of his time talking about how the only sensible lisp is Common Lisp |
| 16:14 | jaen | Duh, another Clojure book I would have to get from overseas. I don't get it why they don't translate any FP books save SICP here ; < |
| 16:14 | llasram | nDuff: Ok, this is very screwy, but here's what I think is going on |
| 16:14 | amalloy | and a fair amount of other things that rather grate on my nerves. if you don't want to focus on specifically clojure, On Lisp is a great read |
| 16:15 | amalloy | and of course SICP |
| 16:15 | llasram | nDuff: It looks like `ns` emits `gen-class` *prior* to the `import` forms |
| 16:15 | jayunit100 | i kinda feel like learning C before Java was helpful... But I dont know if its worth it to know Lisp before learning Clojure. |
| 16:16 | llasram | nDuff: `gen-class` tries to `resolve` symbols in metadata to see if they map to metadata classes. `resolve` returns `nil` if there's no mapping, and `gen-class` continues on |
| 16:16 | llasram | nDuff: I think if you pull your :gen-class ns sub-form out into a top-level `gen-class` form, it'll work |
| 16:16 | jaen | jayunit100: Because it is helpful I think. I think that CS courses that don't start out with C and Scheme in either order are doing it wrong. |
| 16:19 | muhoo | is there a simple, quick hack to make lein 1.7 include java source files in jar? |
| 16:19 | mklappstuhl | amalloy: I think I'll give On Lisp a spin since it's available for free now |
| 16:20 | amalloy | cool, enjoy |
| 16:20 | emezeske | muhoo: symlink them into your resource-dir ? |
| 16:21 | muhoo | emezeske: then i'd need a hack to get git to include symlinks |
| 16:22 | muhoo | ah, maybe git already does that |
| 16:24 | nDuff | llasram: That was it; thanks! This sounds like a bug; if you concur, I'll file a JIRA ticket. |
| 16:25 | llasram | nDuff: Glad to help! And I don't know. The documentation on gen-class is pretty sparse. If I hadn't been digging around in it recently, I wouldn't even have known it supported annotations. I'll defer to the judgment of others on the utility of a ticket |
| 16:34 | llasram | nDuff: If you're doing a lot of work with gen-class, I may be able to interest you in: https://github.com/llasram/shady |
| 16:36 | jayunit100 | How to get the key out of a map, which corresponds to the max value? |
| 16:36 | Bronsa | o |
| 16:37 | jayunit100 | (without doing something crazy like sorting all the values and then doing an inverse selection) |
| 16:37 | amalloy | you could use magic |
| 16:37 | jayunit100 | oh actually i guess you could do (myMap (max (vals myMap))) |
| 16:38 | jayunit100 | or maybe not gotta see |
| 16:38 | jtoy | clojure is magic |
| 16:38 | ibdknox | In the compiler what are these tag fields? |
| 16:39 | jayunit100 | bimaps in clojure |
| 16:40 | dnolen | ibdknox: in which compiler? |
| 16:40 | ibdknox | JVM clojure |
| 16:41 | dnolen | ibdknox: tag field on expression objects right? |
| 16:41 | ibdknox | yessir |
| 16:41 | hiredman | ^String |
| 16:41 | ibdknox | ah |
| 16:41 | hiredman | type hint |
| 16:41 | dnolen | ibdknox: type hint information |
| 16:41 | jondot_ | long shot - is there a way to decompose a string into a clojure list by its parts? i.e "235;2352:33" without doing the splits and munges myself? |
| 16:41 | dnolen | ibdknox: same thing that I'm doing in my all-optimizations branch. |
| 16:41 | ibdknox | hiredman: dnolen: thank you gentlemen |
| 16:42 | amalloy | &(doc clojure.string/split) |
| 16:42 | lazybot | ⇒ "([s re] [s re limit]); Splits string on a regular expression. Optional argument limit is the maximum number of splits. Not lazy. Returns vector of the splits." |
| 16:43 | amalloy | &(clojure.string/split "235;2352:33" #"[;:]") |
| 16:43 | lazybot | ⇒ ["235" "2352" "33"] |
| 16:43 | jondot_ | in my case i'd like ["235" ["2352" "33"]] but i get the direction |
| 16:44 | TimMc | &(require '[clojure.string :as str]) |
| 16:44 | lazybot | ⇒ nil |
| 16:45 | TimMc | &(update-in (str/split "235;2352:33" #";") [1] str/split #":") |
| 16:45 | lazybot | ⇒ ["235" ["2352" "33"]] |
| 16:46 | autodidakto | ,(doc update-in) |
| 16:46 | clojurebot | "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created." |
| 16:47 | autodidakto | *head explodes* |
| 16:50 | jondot_ | TimMc, yep, i kinda wanted some magic like C's scanf in a sense |
| 16:51 | jondot_ | so not doing repetitive str/split again and again |
| 16:51 | jondot_ | but ok it was a long shot |
| 16:53 | TimMc | &((juxt first rest) (rest (re-matches #"(.*);(.*):(.*)" "235;2352:33"))) |
| 16:53 | lazybot | ⇒ ["235" ("2352" "33")] |
| 16:54 | TimMc | *shrug* |
| 16:56 | amalloy | jondot_: you were looking for something like https://gist.github.com/2346469? |
| 16:56 | jondot_ | amalloy, wow, yes. |
| 16:57 | jondot_ | that'll be very nice to study, thanks! |
| 17:06 | dnolen | technomancy: only in ClojureScript do you get your wish - https://gist.github.com/2346460 |
| 17:06 | technomancy | dnolen: oooooh nice! |
| 17:06 | technomancy | that is a thing of beauty =) |
| 17:07 | TimMc | What happens if his lib extends using re-matches and mine does it with re-find? |
| 17:08 | ibdknox | ooo |
| 17:09 | fdaoud | nice |
| 17:09 | dnolen | TimMc: won't work. |
| 17:09 | dnolen | TimMc: same problem exists in Clojure as well. |
| 17:10 | technomancy | oh yeah, that extending should happen in clojure.core |
| 17:10 | TimMc | So the second extend will blow up? |
| 17:10 | dnolen | TimMc: no, it will replace |
| 17:10 | TimMc | OK |
| 17:10 | gfredericks | what's that thing ruby 2 was supposed to get? |
| 17:11 | gfredericks | that would let you modify classes only in a certain context or something |
| 17:11 | TimMc | technomancy: Any thoughts on which of re-find and re-matches is better for that protocol? |
| 17:12 | technomancy | I've never used re-matches |
| 17:12 | kjellski | Why is clooj always putting "" as input and never asking me for stuff to type in? |
| 17:13 | rmarianski | is that possible because IFn is a protocol in clojurescript? |
| 17:13 | gfredericks | rmarianski: yes |
| 17:13 | technomancy | TimMc: I'd probably go with re-seq |
| 17:13 | rmarianski | that is amazing |
| 17:13 | gfredericks | oh oh do extend-type for 'number' |
| 17:14 | technomancy | I usually use re-find in my conditionals because I only care about one match, but re-seq is more general |
| 17:14 | dnolen | far as I know similar limitations exist for Haskell type classes - http://www.haskell.org/haskellwiki/Multiple_instances |
| 17:17 | duncanm | dnolen: i hope i didn't embarrass myself here, http://funcall.blogspot.com/2012/04/20-minute-puzzle.html, https://gist.github.com/2346450 |
| 17:17 | jondot_ | dnolen, you turned a regex into a function? |
| 17:18 | eggsby | now you got 3 problems |
| 17:18 | dnolen | jondot_: not me Relevance's Alan Dipert |
| 17:18 | duncanm | dnolen: cool (regexp hack) |
| 17:19 | jondot_ | oh. |
| 17:19 | duncanm | i thought regexps are already functions, the way sets are functions |
| 17:19 | dnolen | duncanm: they are not in Clojure. |
| 17:19 | amalloy | as long as you don't try to call them as functions, you can continue to believe that |
| 17:19 | duncanm | heh |
| 17:21 | eggsby | is there an http mocking lib for clojure? Something where I can 'record' http responses and play them back for the purposes of a test suite? |
| 17:21 | technomancy | clj-http-fake IIRC |
| 17:23 | eggsby | thanks technomancy i'll look into it :) |
| 17:25 | TimMc | dnolen: Do you know if any work is being done on Source Maps in CLJS? http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ |
| 17:25 | dnolen | TimMc: yes Brandon Bloom has submitted patches to Clojure and ClojureScript |
| 17:25 | amalloy | TimMc: someone is working on it |
| 17:25 | TimMc | Nice! |
| 17:26 | TimMc | I was wondering if the two-step transformation of CLJS -> JS -> compressed JS would make trouble for that. |
| 17:28 | dnolen | TimMc: dealing w/ the 2 step case is a broader goal - at the moment I think most folks would be happy to be able to debug :simple or :whitespace optimizations |
| 17:29 | TimMc | I see. |
| 17:31 | kjellski | Is is possible for counterclockwise to get some input from myself? Whenver I (real-line) it will show a null… not waiting for any input... |
| 17:33 | kjellski | I want my clojurebox back! ^^ |
| 17:41 | jtoy | I'm learning how to do io in clojure, what is wrong with this: (with-open [rdr (clojure.java.io/reader "/Users/jtoy/test.json")] ((json/parse-string (line-seq rdr)))) => java.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.lang.String (NO_SOURCE_FILE:0) |
| 17:42 | technomancy | jtoy: missing a call to map, a call to doall, and has one level too many of parens |
| 17:42 | jtoy | technomancy: why is a map needed? |
| 17:43 | technomancy | you're trying to call parse-string on a seq of strings |
| 17:47 | jtoy | technomancy: so do something like this? (apply str my-char-seq) instead of map? |
| 17:47 | technomancy | well... depends on what you're trying to do |
| 17:48 | jtoy | hmm, that gives me java.lang.OutOfMemoryError: Java heap space (NO_SOURCE_FILE:0) |
| 17:48 | technomancy | line-seq makes me think that your file has a bunch of json objects in it that need to be parsed independently |
| 17:48 | technomancy | but if it's only one, then you should use (json/parse-string (slurp "/Users/jtoy/test.json")) |
| 17:48 | jtoy | technomancy: each line is json |
| 17:48 | technomancy | ok, so you would need to map then |
| 17:49 | jtoy | technomancy: with map I get : java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.String (NO_SOURCE_FILE:0) |
| 17:49 | jtoy | (with-open [rdr (clojure.java.io/reader "/Users/jtoy/test.json")] (json/parse-string (map str (line-seq rdr)))) |
| 17:50 | technomancy | think about what line seq returns and what parse-string expects |
| 17:55 | jtoy | technomancy: is there a recommended doc you have for lazy-seq, this is not informative enough: http://clojuredocs.org/clojure_core/clojure.core/line-seq |
| 17:56 | Cyrik | does anyone know why this throws and error? ((fn [{args :args}] args) '(:and :a :b)) |
| 17:56 | Cyrik | i would expect it to return nil |
| 17:56 | technomancy | jtoy: that page tells you everything you need to know. what type does line-seq return? |
| 17:57 | kjellski | in the instructions for labrepl emacs, it said I should run emacs -l ~/.emacs.d/emacs-starter-kit/init.el but the file doesn't exist. |
| 17:57 | kjellski | technomancy, any hints? |
| 17:58 | technomancy | kjellski: sorry, I haven't used labrepl. those instructions are sound highly suspect. |
| 17:58 | jtoy | technomancy: right, i don't know why my conversion doesn't work |
| 18:00 | technomancy | jtoy: what does mapping str over the return value of line-seq get you? |
| 18:00 | ipostelnik | Cyrik, your fn expects a map as input |
| 18:01 | jtoy | technomancy: I'm not sure, i don't know how to test line-seq from repl, i want to test with something like (map str (line-seq "test")) |
| 18:01 | technomancy | why can't you test line-seq? |
| 18:02 | Cyrik | ipo i know, but it works fine on every datatype other then lists. only lists make it throw and i dont get why they do |
| 18:02 | jtoy | I'm writing a longer test now |
| 18:05 | jtoy | still testing: (with-open [rdr (clojure.java.io/reader "/etc/resolv.conf")] (map str (line-seq rdr))) => (java.io.IOException: Stream closed |
| 18:06 | technomancy | ok, that's caused by laziness conflicting with dynamic binding. need to call doall on the result of map to force the lazy seq |
| 18:06 | jtoy | this works : (with-open [rdr (clojure.java.io/reader "/etc/resolv.conf")] (println (map str (line-seq rdr)))) |
| 18:07 | jtoy | ok, doall works: (with-open [rdr (clojure.java.io/reader "/etc/resolv.conf")] (doall (map str (line-seq rdr)))) it looks like it returns a list of strings as each line |
| 18:08 | ipostelnik | Cyrik, actually any lazy sequence will fail |
| 18:10 | antares_ | is there a good example of a library that uses, say, multiple data stores that users can choose from? I'm looking for approaches to implementing "adapters" in Clojure. I know tools.logging does it but it's the only one I know of. |
| 18:10 | Cyrik | ipostelnik: oh thhat makes sense. i guess he´s trying to eval it at each step. thanks |
| 18:11 | technomancy | antares_: java.jdbc maybe? |
| 18:12 | antares_ | technomancy: hm, well, that probably relies heavily on the JDBC part |
| 18:12 | antares_ | while my code will be all Clojure |
| 18:12 | jtoy | hmm, I thought do all would fix it: (with-open [rdr (clojure.java.io/reader "/Users/jtoy/test.json")] (doall (json/parse-string (map str (line-seq rdr))))) => java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.String (NO_SOURCE_FILE:0) |
| 18:12 | technomancy | oh yeah, that's probably handled for you |
| 18:13 | technomancy | jtoy: what does mapping str over the return value of line-seq get you? |
| 18:13 | antares_ | jtoy: are you trying to read a JSON file from the filesystem? |
| 18:13 | jtoy | technomancy: it looks like a list of strings: ("#" "# Mac OS X Notice" "#" "# This file is not used by the host name and address resolution" "# or the DNS query routing mechanisms used by most processes on" "# this Mac OS X system." "#" "# This file is automatically generated." "#" "domain cic" "nameserver 204.9.221.30" "nameserver 204.9.223.18" "nameserver 204.9.223.19" "nameserver 8.8.8.8") |
| 18:13 | jtoy | antares_: yes |
| 18:14 | technomancy | jtoy: and what if you don't map str over it? |
| 18:14 | antares_ | jtoy: https://github.com/michaelklishin/urly/blob/master/test/clojurewerkz/urly/test/url_dump.clj#L7 |
| 18:14 | jtoy | technomancy: the printed output is the same |
| 18:15 | antares_ | jtoy: if it's OK for you to load it from the classpath (test/resources is a common location), then you can use the example above |
| 18:16 | jtoy | so using doseq is the main difference? |
| 18:18 | ipostelnik | Cyrik, destructing code will call (apply hash-map arg) on any argument which is a se |
| 18:18 | ipostelnik | Cyrik, s/se/seq/ |
| 18:19 | technomancy | jtoy: the difference is that the parsing function gets the type it wants |
| 18:20 | jtoy | technomancy: ok, I'm not sure why that is bc i think I'm still too much of a clojure newbie, but this does work: (with-open [rdr (clojure.java.io/reader "/Users/jtoy/test.json")] (doseq [x (line-seq rdr)] (json/parse-string x))) |
| 18:21 | technomancy | that's much better |
| 18:21 | technomancy | now the only problem is that doseq is intended for side-effects and doesn't have a return value |
| 18:21 | technomancy | (doc for) |
| 18:21 | technomancy | ,(doc for) |
| 18:21 | clojurebot | "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ... |
| 18:21 | clojurebot | "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when test. ( |
| 18:21 | technomancy | oops |
| 18:22 | technomancy | hm; I suppose that is not very helpful |
| 18:22 | jtoy | (doc do all) |
| 18:22 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (2) passed to: core$eval27$fn--28$my-doc> |
| 18:22 | jtoy | (doc doall) |
| 18:22 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 18:22 | technomancy | jtoy: for is the equivalent of doseq that produces a return value instead of executing for side-effects, but it's lazy |
| 18:22 | technomancy | so in the case of with-open you need a doall |
| 18:22 | technomancy | or consume the seq inside the with-open call |
| 18:24 | jtoy | technomancy: yeah, i think i need to program more clojure before i fully understand what that mean |
| 18:24 | jtoy | means |
| 18:29 | jtoy | how does one sleep from the repl? this doesn't work (Thread/sleep 5) |
| 18:30 | amalloy | jtoy: you can count 5ms that accurately in your head? |
| 18:30 | jtoy | oh ok, i thought it was seconds, oops |
| 18:31 | muhoo | llasram: what's the proper workflow in shady for reloading from the repl a class defined with gen-class? |
| 18:31 | muhoo | llasram: i keep getting : ClassCastException clojure.lang.Symbol cannot be cast to java.lang.String shady.gen-class/reload-class (gen_class.clj:13) |
| 18:37 | jtoy | so i am finding errors in my file: (with-open [rdr (clojure.java.io/reader "/Users/jtoy/test.json")] (doseq [x (line-seq rdr)] (try (json/parse-string x) (catch Exception e (println e)) ))) is there a clojure method where I can get the line number with each line I process? |
| 18:38 | technomancy | jtoy: maybe (.printStackTrace e) |
| 18:39 | antares_ | jtoy: clojure.stacktrace/print-stack-trace |
| 18:39 | jtoy | technomancy: I mean the line where the error occurs, not stacktrace |
| 18:40 | jtoy | i have a 800K line file, with each line as joan, there are 5 lines that are broken |
| 18:40 | emezeske | ,(map vector ["line" "line" "line"] (range)) |
| 18:40 | clojurebot | (["line" 0] ["line" 1] ["line" 2]) |
| 18:41 | technomancy | or just replace (println e) with (println e x) |
| 18:42 | emezeske | ^^ what he said |
| 18:43 | TimMc | map-indexed can help as well |
| 18:43 | jtoy | the println way does not work: #<JsonParseException org.codehaus.jackson.JsonParseException: Illegal character ((CTRL-CHAR, code 0)): only regular white space (\r, \n, \t) is allowed between tokens |
| 18:43 | jtoy | at [Source: java.io.StringReader@1cfb765a; line: 1, column: 2]> |
| 18:43 | jtoy | it says almost the same thing for all 5 lines |
| 18:44 | muhoo | maybe those are the bad lines? and they have illegal chars between tokens, like it says? |
| 18:44 | muhoo | 0 is null, IIRC |
| 18:45 | TimMc | jtoy: Did you try the (println e x) thing? |
| 18:45 | jtoy | it can't be line 1 every time? |
| 18:45 | jtoy | TimMc: yes, that is println results |
| 18:45 | TimMc | OK, so maybe the whole line is "\x00" |
| 18:45 | TimMc | ANyway, search for a NUL. |
| 18:46 | muhoo | nulls in file, i've had that problem before |
| 18:47 | jtoy | ok, so \x00 is 0 is NULL ? |
| 18:48 | muhoo | ya |
| 19:03 | lynaghk | emezeske: have you ever had problems running large datasets through CLJS? |
| 19:04 | emezeske | lynaghk: Hmm, what do you mean by "running through" ? Like processing them? |
| 19:04 | lynaghk | just importing |
| 19:04 | lynaghk | I'm moving my data visualization grab bag to cljs: https://github.com/lynaghk/vomnibus/tree/cljx |
| 19:05 | lynaghk | I'm just trying to import (def large-vector [...]) into another namespace, and ClojureScript just pegs the CPU at 100% until I kill it after a few minutes |
| 19:05 | emezeske | lynaghk: I'm not sure that I've run into that |
| 19:05 | emezeske | lynaghk: But I haven't necessarily worked with really huge datasets |
| 19:05 | lynaghk | I believe this is an issue with ClojureScript, not cljsbuild, because I've run into it before |
| 19:05 | lynaghk | it's not even that huge, we're talking 100kb of state outlines |
| 19:06 | emezeske | lynaghk: Yeah, that doesn't seem huge enough to warrant breakage :) |
| 19:06 | lynaghk | I'll dig into it a bit more then. |
| 19:06 | lynaghk | yep. I've run it through Closure directly too, so I think it's some weird interface between Closure/ClojureScript |
| 19:06 | lynaghk | did you have a nice time in PDX last week, btw? |
| 19:06 | emezeske | Eek, that could be interesting to track down |
| 19:07 | lynaghk | emezeske: interesting is one word. |
| 19:07 | lynaghk | =P |
| 19:07 | emezeske | I actually was in salem, and just passed through PDX airport on the way out |
| 19:07 | emezeske | But yeah, it was good! |
| 19:07 | lynaghk | sweet |
| 19:07 | lynaghk | back in the land of abundant sunshine now? |
| 19:08 | emezeske | Oh yes, it's very abundant! |
| 20:03 | brehaut | a clojure implementation of http://www.webkit.org/blog/1875/announcing-remote-debugging-protocol-v1-0/ could be a great aid to web app testing |
| 20:20 | autodidakto | why is a one-sentence description and no external link the norm on clojars? |
| 20:21 | aperiodic | because those are the defaults in the project.clj that leiningen generates |
| 20:21 | autodidakto | Ahh. It reads the project.clj |
| 20:22 | technomancy | clojars 2 will require a URL and license info |
| 20:22 | technomancy | FWIW |
| 20:22 | autodidakto | technomancy: most awesome news |
| 20:23 | autodidakto | Library discovery and organization shall separate us from that which is CL.. |
| 20:23 | technomancy | autodidakto: in the mean time, try http://clojuresphere.herokuapp.com; it's pretty great |
| 20:23 | autodidakto | nice. I'll check that out |
| 20:26 | technomancy | also leiningen 2 includes a nice little :url "http://example.com/FIXME" in project.clj |
| 21:27 | rplevy | it's not possible to capture output from java libraries used in Clojure is it? *out* and *err* don't come into play so with-out-str won't work, is this true? |
| 21:28 | rplevy | in particular clojure.tools.log output? |
| 21:29 | rplevy | s/log/logging/ |
| 21:29 | antares_ | rplevy: doesn't it depend on individual java libraries? |
| 21:30 | rplevy | interesting, how so? |
| 21:30 | antares_ | Quartz will use SLF4J if it is available |
| 21:30 | antares_ | so if you use tools.logging with slf4j, you will also have Quartz log output in your log |
| 21:30 | antares_ | by default, you can separate them, too |
| 21:31 | antares_ | different Java libraries log differently, some may even log to stdout but that's not the norm (fortunately) |
| 21:31 | rplevy | is there some way to capture the output of clojure.tools.logging when I call it (in a unit test, just to make sure that it happens) |
| 21:32 | antares_ | rplevy: tools.logging has pluggable loggers, it should not be too hard to implement one based on a string buffer or *out* |
| 21:32 | antares_ | maybe there even is one |
| 21:33 | rplevy | interesting, I didn't know that, and that explains what you said a above re sl4j, which I didn't quite understand, but now I do, thanks! |
| 21:34 | nodename | Hi, I'm sure I've seen an example of how to specify a github repo as a dependency in project.clj but I can't find it now. Any help? |
| 21:36 | rplevy | actually I just realized it's just as good to mock out the warning function, not sure what I was even thinking haha |
| 21:39 | S11001001 | rplevy: as long as all warnings go through the function |
| 21:40 | rplevy | S11001001: yup |
| 21:42 | muhoo | is there a way to have certain libraries loaded in lein 1.7, ONLY in the repl, but not included in jars? |
| 21:42 | S11001001 | muhoo: that's what dev-dependencies are for |
| 21:43 | muhoo | i thought dev-dependencies loaded only during the compiliation, not the repl? |
| 21:43 | muhoo | ok, thanks, will try. |
| 21:43 | S11001001 | I don't know about the cmdline, but in swank dev-deps are available |
| 21:44 | muhoo | also, i don't necessarily want them in the project.clj, because they're only for my personal use, they can't ship with the project, they're not on clojars, etc |
| 21:46 | muhoo | i suspect it'll be somewhere in ~/.lein/init.clj or :repl-init then |
| 21:46 | S11001001 | Hmm. Well, you could always java -cp "`lein classpath`:myjar.jar" clojure.main --repl |
| 21:47 | muhoo | good point. i'm sure there's a more lein-y way to do it though. |
| 21:47 | S11001001 | probably make a plugin |
| 22:03 | rplevy | is it the case that calling a function as a var breaks midje prequisites? e.g. (provided (#'v ...)) I am finding this to be the case but I may be doing it wrong |
| 22:23 | llasram | muhoo: Hey, I was out earlier. The 'reload-class' function is just a private function which loads the class in a DynamicClassLoader |
| 22:24 | llasram | muhoo: You should just need to use the shady.gen-class version of `gen-class` instead of the clojure.core version |
| 22:25 | llasram | muhoo: And new versions of the class will be loaded as the class is re-defined |
| 22:31 | antares_ | rplevy: if you have a function in a var f, you can call it as (f …) or (f) |
| 22:31 | antares_ | rplevy: from your example I am not sure what #'v means |
| 22:34 | brehaut | antares_: #' is var quote; #'v is equivalent to (var v). It means you get the var back from the symbol, rather than what the var references |
| 22:35 | autodidakto | brehaut: can you talk about the differences between CL #' and clojure? |
| 22:35 | brehaut | nope |
| 22:35 | brehaut | i have no idea about how CL works |
| 22:35 | autodidakto | fair enough |
| 22:35 | antares_ | brehaut: ah, ok. I am familiar with (var …) |
| 22:36 | brehaut | all i can tell you is that a var lets you indirect the var, meaning that when the var is changed (ie, redefed at dev time) the code that has the var will change as expected |
| 22:36 | S11001001 | autodidakto: Sure. #' means something completely different in CL, but it is similar in that it is sugar for a two-element list whose CADR is the form that follows the #', and whose CAR is a symbol |
| 22:40 | muhoo | llasram: thanks, i decided to use defclass instead. much prettier, and works great. |
| 22:41 | muhoo | hmm, is there a form of every? that takes multiple predicates but one value? |
| 22:41 | muhoo | so instead of wanting to run onoe test on multiple data values, to run multiple tests on one data value, and return true if they're all true? |
| 22:42 | S11001001 | muhoo: hint: functions are data values |
| 22:42 | muhoo | S11001001: oh, so something with map, gotcha |
| 22:43 | y3di | has anyone here used erlang? |
| 22:43 | S11001001 | muhoo: not quite, you still only need every? |
| 22:43 | muhoo | ah |
| 22:44 | S11001001 | muhoo: fill this in: (every? <something-with-my-test-val???> [function1 function2 ...]) |
| 22:45 | muhoo | but wait, doesn't that do something like (pred item-from-collection) , so it'd be (value function1) (value function2), in otherwords, the wrong order? |
| 22:45 | S11001001 | not literally your test value, something containing it |
| 22:46 | muhoo | oh, a function that takes a function as an arg, calls the arg with the value as an, um, arg, i think. |
| 22:46 | muhoo | i'll play with it, thanks |
| 22:46 | S11001001 | np |
| 22:47 | S11001001 | and sounds like you're on the right track |
| 22:47 | muhoo | yeah, thanks a lot, a little brain-melting is what i needed there. |
| 22:47 | muhoo | fun stuff. |
| 22:49 | S11001001 | this is just the tip of the iceberg |
| 22:50 | muhoo | (every? #(% some-value) [pred1 pred2 pred3]) |
| 22:50 | S11001001 | looks cool to me |
| 22:52 | Scriptor | (every? ((juxt pred1 pred2 pred3) some-value)) might work too, muhoo |
| 22:52 | Scriptor | oh wait, never mind |
| 22:52 | Scriptor | wait, yes mind |
| 22:52 | muhoo | juxt'd work too, thanks. |
| 22:53 | S11001001 | albeit strict over the predicates |
| 22:53 | muhoo | i'd have to apply if i had a list of preds tho |
| 22:53 | muhoo | gets kinda ugly then |
| 22:53 | S11001001 | and their invocation results |
| 22:56 | tmciver | S11001001: what do you mean it would be 'strict over the predicates'? |
| 23:01 | jtoy | hello? |
| 23:01 | clojurebot | BUENOS DING DONG DIDDLY DIOS, fRaUline jtoy |
| 23:02 | Scriptor | hi jtoy |
| 23:04 | jtoy | was seeing if I'm still online |
| 23:04 | jtoy | my computer seems borked |
| 23:04 | jtoy | i hate computers |