#clojure logs

2012-01-25

00:00skelternetThank you, dnolen
00:00dnolenas you can see it can get complicated, easier to see if you use an editor that has pretty-printed macroexpansion
00:00skelternetlack of pretty-printing was what killed my interest in lisp in college
00:01skelternetthey had us using some sort of environment that ate up white-space, too. was terrible.
00:02clj_newbprintln is kinda like cout; does clojure have osmething like cerr? (I hate it when my debugging print statements gets interleaved with the java stack trace exception) = hard to read
00:02skelternet,(macroexpand '(doseq [i [1 2 3 4]] (print i)))
00:02clojurebot(loop* [seq_67 (clojure.core/seq [1 2 3 4]) chunk_68 nil count_69 ...] (if (clojure.core/< i_70 count_69) (clojure.core/let [i (.nth chunk_68 i_70)] (do (print i)) (recur seq_67 chunk_68 count_69 (clojure.core/unchecked-inc i_70))) (clojure.core/when-let [seq_67 (clojure.core/seq seq_67)] (if (clojure.core/chunked-seq? seq_67) (clojure.core/let [c__3921__auto__ (clojure.core/chunk-first seq_67)] (...
00:03jayunit100dnolen i tried to make the clojure meetup in ny last wk but got busy ---- any chance of another one on the east coast soon where we do some intermediate lisp thinking / clojure programming .
00:03adam_jayunit100, nice blog, i have read a couple of your entries!
00:03jayunit100cool thanks adam :]
00:03adam_no problem, I'm trying to use clojure for some bioinformatics stuff myself
00:04dnolenjayunit100: definitely! I try to go everytime but I had to miss the last one as well
00:04jayunit100yeah. what are the odds that we schedule to do one in new haven. ... how many people you think would come ?
00:04Raynesclj_newb: (binding [*out* *err*] (println "some message"))
00:05jayunit100adam_ you should contribute to RudolF with us.
00:05jayunit100https://github.com/jayunit100/RudolF
00:05clj_newbRaynes: nice
00:07adam_okay, that sounds good, I have been trying to get involved in a project
00:07clj_newbRaynes: nice; thanks
00:07jayunit100u on github?
00:07jayunit100@adam_
00:08adam_yeah, adamwespiser is my username
00:08jayunit100@adam_ what type of bioinformatics do you do ?
00:09adam_i am working in structural biology
00:09adam_mostly on protein-protein interaction site prediction methods
00:09jayunit100aweseome well you'll love the examples in RudolF. Integration with the PDB structural utilities.
00:09skelternetflashbacks to my summer at ciba-geigy
00:09adam_yeah, check out the code base I am working on:
00:10jayunit100check this out : http://writequit.org/papers/files/RudolF.pdf
00:10dnolenso is anyone offended by the inclusion of IFn to ClojureScript? It's now fully baked - https://github.com/clojure/clojurescript/compare/master...96-ifn
00:10adam_http://pfaat.sourceforge.net/ is my boss's project that I contribute to
00:12adam_jayunit100: has this paper been submitted anywhere?
00:12amalloydnolen: what would be the reason for being offended? because js already has first-class functions and it's silly to invent our own, or what?
00:13jayunit100yeah itng
00:13adam_nice, good luck, i think its a great idea
00:14dnolenamalloy: heh, no reason really, IFn inclusion moves some ugliness into the compiler so people don't have to write yucky stuff by hand when adding fn capability to their custom types.
00:15jayunit100adam_: BioClojure has been replaced by RudolF --- just saw you were following it .
00:16adam_yeah, I am going to take a look at it, I'm sure there are features I can add
00:17jayunit100in any case adam_ I have a publication idea i can write up if you want to help add some code. I'll ping you about it offline.
00:18jayunit100oh nevermind you have no email : email me at jayunit100@gmail.com
00:18jayunit100and ill add you to RudolF as a commiter also .
00:20jayunit100looking at pfaat this would be great for venn. that would be awesome if you could add some lispy alignment examples
00:21adam_okay
00:24dnolenbunch 'o goodies just landed in CLJS
00:33adam_jay, can I download the venn source code and run it locally?
00:47chouserdnolen: are you still around?
00:48chousertrying to figure out native deps via lein, using your plugin.
00:49dnolenchouser: off I haven't messed w/ that in ages
00:49dnolenoof I mean
00:49chouseryeah, I guessed.
00:49dnolenchouser: it was a convention more than anything else really
00:49chouseryour plugin looks helpful, and I've got to close.
00:50dnolenchouser: it never solved the packaging problem ever
00:50chouserI don't expect you to work through anything with me, but thought if you recognized my issue off the top of your head...
00:50dnolenit was just about making it easy to pull down native deps off clojars and expand them into the project folder
00:50chouserif I use -Djava.library.path on a manual java command line, I can load the native lib
00:51dnolenk
00:51chouserand I have :native set right in project.clj, I think, and can see a -Djava.l.p that looks right in a ps of the repl process
00:52dnolenand you ran- lein deps, lein native deps -in that order?
00:52dnolenlein native-deps rather
00:52chousermaybe not. let me try again.
00:54chouserUnsatisfiedLinkError
00:54chouserI don't get it. Using ps I definitely see -Djava-library-path=/home/chouser/shadowfax/native/linux/x86_64
00:54amalloychouser: i think the flatland projects tokyocabinet and jiraph show how to bundle and use a native dependency, if i understand what you mean by the term. they work in lein (used to be cake), but Raynes is probably the guy to ask about how to do the native-specific stuff
00:55dnolenhmm, sounds like the path isn't right
00:55RaynesFor native deps to work properly, you need to be using leiningen off of the 1.x branch.
00:55chouserls at that path shows my .so's
00:55RaynesOtherwise it wont set java.library.path
00:55chouserthis is lein 1.6.2
00:56chouser(System/getProperty "java.library.path") does *not* show my path
00:57chouseroh
00:57RaynesYou don't need to run 'lein native-deps' at all.
00:57RaynesIt just works.
00:57RaynesAnd you don't have to set :native either.
00:57technomancyjkkramer: did you evaluate neo4j for clojuresphere at all?
00:57chouserlein is using -Djava-library-path. Running java manually with -Djava.library.path works
00:58Rayneschouser: Yes, that's what I fixed in the 1.x branch of Leiningen.
00:58RaynesWhich is what I just told you, BUT YOU DON'T LISTEN TO ME!
00:58RaynesBah!
00:58dnolenchouser: perhaps native-deps is getting in the way :)
00:58chouserdashes simply don't work. dots do.
00:59chouserRaynes: I'm running 1.6.2. How is that not 1.x?
00:59RaynesIt has to be specifically from the git repo 1.x branch.
00:59RaynesAnd a relatively recent commit on said branch.
00:59chouseroh
01:00RaynesIt will be in the 1.7.0 release.
01:00jkkramertechnomancy: i did not. does heroku support it?
01:00Raynesjkkramer: Yep.
01:00technomancychouser: this is something I broke in 1.6.mumble
01:01chouserok
01:01technomancyjkkramer: specifically asking because of http://neo4j-challenge.herokuapp.com/
01:02chouserso my plan is to git clone lein and symlink ~/bin/lein to something in the git repo. Is that a sane plan?
01:02chouserI'm a lein newb and don't understand how it installs itself
01:02technomancychouser: absolutely respectable
01:03technomancychouser: also acceptable would be to fall back to 1.6.1 stable or 1.5.2, I can't remember which version introduced the bug
01:03Raynestechnomancy: I don't support that.
01:03jkkramertechnomancy: interesting. been meaning to play with neo4j
01:03Raynestechnomancy: No version behind 1.6.2 works with lein-newnew for some reason.
01:03technomancyo_O
01:03technomancyodd
01:03RaynesNever did figure out why.
01:03technomancymaybe InsufficientUnicodeException?
01:04RaynesI don't think so. Look at the closed issues for lein-newnew.
01:04technomancyjoke ruined!
01:04RaynesOh. I didn't catch it.
01:05technomancyreferring to the lack of © in newnew skeletons
01:05RaynesI assume that even the most ridiculous exceptions are plausible with any Clojure code using Java code.
01:05technomancythe readmes thereof
01:05RaynesYeah, I'm going to get to work on all of those issues and such soon. Probably tomorrow.
01:07technomancyhah; no rush
01:10chouserheh. where'd rlwrap go?
01:10brehauta circle of hell?
01:10brehautor am i thinking of jline
01:11hiredmanjline
01:11hiredmanrlwrap is the one that works with unicode
01:12brehauti'll rescind that joke then
01:15chouserso this snapshot lein seems to set the native lib path correctly, but doesn't use rlwrap
01:18chouserthe jar I built has a 'native' dir that seems to be unpacked correctly, but it has a 'lib' dir with jars in it that are not on the classpath in lein repl
01:19chouserdo my java .jars belong somewhere else besides in the 'lib' dir next to the 'native' dir?
01:20hiredmanwhat does lein classpath say?
01:23chouserit includes my native-deps.jar but not the .jars inside it.
01:23technomancyhttp://p.hagelb.org/lein-os.png
01:23hiredmanoh
01:23hiredmanI see you have one of those weird things that is like an uberjar but not
01:24chouserI made my native-deps.jar according to the instructions for dnolan's native-deps plugin
01:24technomancyjars-inside-jars isn't supported; it's just the native .so-and-friends extraction that leiningen does
01:25chouserso I need separate deps for the .jars and the .so's they depend on?
01:25hiredmanchouser: I think dnolen's plugin might have been from before lein got it's own native deps handling
01:25chouserhiredman: yes, I'm getting that impression. So I'm trying to learn how I ought to do it now.
01:25technomancychouser: not necessarily; you could put the .so's in the same jars as the .class files
01:26chouserah. hm.
01:26technomancyI didn't realize the old jars-in-jars was actually documented somewhere.
01:26brehauttechnomancy: i was expecting a screenshot of a lein based distro
01:26technomancychouser: where were you when I was trying to get testers when I was implementing this? =)
01:29chouserheh. The last time I touched any native deps was when writing clojure-jna.
01:29technomancychouser: improved native-deps creation and documentation has been on the roadmap for a while; it's just a bit hard to find people interested in giving feedback. so expect a few pings down the line.
01:30technomancynative-deps consumption should make it into lein2-preview; creation might be a bit further off.
01:30technomancyanyway, off to bed
01:30technomancyfeel free to ask on the mailing list if you get lost
01:30chouserthat was about 6 months before your initial commit to lein. :-)
01:30technomancyhah
01:31chousertechnomancy: if we end up using this for work, it's likely I'll be able to pitch in for docs, testing, etc.
01:53unlinkIs there a function like this in the stdlib? (defn tails [xs] (when-let [s (seq xs)] (cons xs (lazy-seq (tails (next xs))))))
01:54hiredman,(doc iterate)
01:54clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
01:59unlinkTrue, it could have been written (defn tails [xs] (take-while identity (iterate next xs))).
03:01clj_newbIs there a way to have clojure compile errors (resulting rom load-file) to report the _full_ name, relative to `pwd`, rather than just the filename
03:33Blktgood morning everyone
03:37caspercgood morning
03:55kralmorning pals
04:02muhoois there a way to tell the lein repl which port to listen on?
04:03raekmuhoo: yes, check out sample.project.clj in the Leiningen docs
04:04muhooah, cool :repl-port, thanks
04:17muhoousing the jdbc stuff. it seems like everything is wrapped in with-connection.
04:17muhoois there a way to store a connection somewhere globally, and then use it multiple times, instead of having to open and close connections with with-connection all the time?
04:18muhooor, alternately, wrapping the whole program inside with-connection?
04:27caspercIs there a good way to set up a thread or daemon to perform a task at certain intervals?
04:29caspercin my specific case i want to check an event queue for new events to react to, but that's not important. Could be any task
04:40llasrammuhoo: That's the sort of thing people tend to use ^:dynamic *vars* for
04:42llasramcasperc: java.util.Timer?
04:48caspercllasram: hmm, might be a good option
04:50Raynescasperc: Would a thread that loops and sleeps for a certain amount of time be too simplistic?
04:51llasramcasperc: If you need complicated stuff there's http://quartz-scheduler.org/ for which there's even https://github.com/pingles/clj-quartz, but I've never used either
04:52caspercWell, I would want a way to pause it and generally inspect its state (not quite sure yet what this would entail)
04:54caspercllasram: i hadn't thought of quartz actually. That might be a good option.
04:55caspercIn essence we have a bunch of things which we will want to do a regular intervals. We want to be able to pause these tasks and inspect the state
04:56caspercI'll probably end up making a dashboard for it.
04:58caspercllasram & Raynes: thanks for the input. I'll have a look at quartz so see if it fits our needs :)
04:59Raynes'our'. We are legion!
05:00bluezenix2Are there methods to inspect a deftype? Say i have (deftype Dude [name, age]) ; is there a way to get a vector of [:name :age] or something simlar?
05:01bluezenix2(props-or-whatever Dude) ; => ["name" "age"]
05:03llasrambluezenix2: defrecords will implement the map interface for you by default, but deftypes are barebones, so you'll need to implement anything like that yourself
05:05bluezenix2right
05:15morphlingbluezenix2: deftype (on the jvm at least) creates a class, so you should be able to get this information through reflection
05:31student1test
05:32student1you don't have to register nowadays, to be able to speak in #clojure?
05:32raekyeah
05:32student1ok
05:54bluezenix2when using (defrecord Dude [name age]) ; i can use (keys (Dude. "blue" 12))
05:55bluezenix2but what I want is to find the properties a Dude is allowed to have
05:55bluezenix2like (keys Dude)
05:55bluezenix2i can't construct a temporary Dude
05:55bluezenix2so i guess i'll have to dig into java reflection?
07:59samaaron/
08:03samaaronRaynes: howdy
08:15TimMcbluezenix: You can create a map, and once it has all the attributes, convert it into the record. (I think...)
09:07aidanfHi all,
09:07aidanfCan anyone tell me why this doesn't work as I was expecting?
09:07aidanfhttp://pastie.org/3249922
09:08aidanfI was expecting the output from the two threads to be mixed up.
09:08aidanfBut it seems to run all the way through f1 before starting f2 i.e. the threads are not running concurrently
09:10TimMcaidanf: That'll happen. Try a longer run e.g. 1e5, or just add some .sleeps in there.
09:12aidanfThanks TimMc
09:13clgvaidanf: it works over here with my dualcore cpu
09:13TimMcTo test concurrency stuff, you often have to simulate it with sleeps. :-/
09:14aidanfcljv: Thanks, works for me now after adding Thread/sleep
09:14TimMcor long-running processes with lots of jittery computations.
09:14clgvTimMc: I never tested - does thread creation consume a decent amount of time?
09:15clgvlooking at my run I'd say that shouldnt be the problem
09:16TimMcaidanf: Even running your original one several more times should get you some interleaving occasionally.
09:21aidanfTimMc: I tried it several times without sleep and got the same every time. Playing with it now - for small (range n) and no sleep I never see interleaving. If I add sleep or make n really big I see the results interleaving.
09:23AWizzArdclgv: Creating threads can be expensive. Typically I follow the rule of thumb that a calculation should take at least one msec for it to be outsourced into its own future or agent.
09:25clgvAWizzArd: yeah thats true. although 1ms isnt enough. in one of my experiment I parallel tasks with 20ms and the overhead ruined the performance
09:31AWizzArdclgv: I tried this:
09:31AWizzArd,(time (count (map (fn [_] (Thread/sleep 1)) (range 1000))))
09:31clojurebot"Elapsed time: 2206.241 msecs"
09:31clojurebot1000
09:31AWizzArdvs
09:31AWizzArd,(time (count (pmap (fn [_] (Thread/sleep 1)) (range 1000))))
09:31clojurebot"Elapsed time: 322.43 msecs"
09:31clojurebot1000
09:31AWizzArdThe example with map took just a bit over one second on my machine, as expected.
09:32AWizzArdThe second one runs here in 60 msecs.
09:32clgvok. I had an algorithm with lots of double operations
09:35clgvAWizzard: btw. pmap has its "lazy problem" that it in fact does not do good cpu utilization since it tries to be lazy and the last task of a batch can prevent moving pmaps sliding window further.
09:35clgvthats almst only a problem when parallelizing tasks with different runtimes.
09:40AWizzArdclgv: but my example from above is flawed anyway, because when one Thread is sent to sleep then that thread becomes free for other jobs. This way I can have pmap running 25 threads that each sleep for one second within around one second, on 4 cores.
09:41clgvAwizzard: yes thats true. you need an active waiting loop ;)
09:43jsabeaudrydakrone, Is there any facility in clj-http to access the streams directly as available in the apache httpcomponents? (I'm working with responses too big to fit in memory)
09:46AWizzArdclgv: For example (time (count (map #(dotimes [i 10000] %) (range 1000000)))) runs in 2,8 seconds on my machine, and in 1,9 seconds with pmap. So on my system it seems that even for sub-msec tasks it is already worthwhile to run parallel.
09:47AWizzArdclgv: But for a dotimes 1000 finally map is much faster than pmap, because of the threading overhead.
09:47clgvAWizzard: you should calc the parallel efficiency value. its not even half the time with 4 cores - that does not seem good
09:50jsabeaudrydakrone, Found the answer right in the doc, "Note that where Ring uses InputStreams for the request and response bodies, the clj-http uses ByteArrays for the bodies." Too bad...
09:51dakronejsabeaudry: I'd like to be able to provide a stream as a response, hopefully in the future
09:54dakrone*near future
10:15jsabeaudryNetty is so incredibly heavy I wonder how anyone can tolerate it
10:16jsabeaudryAll that cpu spent in SelectorUtil.select...
10:17lucianjsabeaudry: are you joking?
10:19jsabeaudrylucian, Not at all, I'm cpu bound serving a file with netty. I do the same thing with Jetty and I get more than 10x the transfer rate
10:19jsabeaudrylucian, So I profiled Netty and more than 50% of the cpu time is spec in SelectorUtil.select
10:19jsabeaudrys/spec/spent
10:20lucianjsabeaudry: that sounds like a bug. select is the system call
10:20lucianalthough i'd expect netty to use epoll or something. what os?
10:21jsabeaudrylinux, I tried both on Ubuntu and Angstrom with the same results
10:21jsabeaudryOn the openjdk and on oracle's
10:22lucianit seems odd to me. i don't have experience with netty in particular, but it should behave like twisted
10:22lucianand use epoll when available, no cpu on I/O, etc
10:23lucianit sounds like a bug in netty, either in its select binding or in its sniffing of native async APIs
10:30TimMcjsabeaudry: Is this still on the little constrained platform?
10:31jsabeaudryTimMc, Yes and no, I tried on both, with the same results. The profiling was done on a regular ubuntu
10:34gtrak``jsabeaudry: it's odd, but any particular reason to prefer netty? jetty uses NIO, too
10:38jsabeaudrygtrak``, Simply because aleph is built on netty
10:39gtrak``I remember there being a perf issue with aleph and netty
10:40romain_pHi everyone, could anyone help me understand functional programming with an example ? I am trying to represent NFAs in Clojure
10:40gtrak``anyone recall what that was about?
10:40romain_pSo my initial idea was:
10:40romain_p(defrecord NfaState [final char_transitions empty_transitions])
10:40romain_pUsing this or something else, how do I represent two nodes that point at each other?
10:41romain_p(for instance, two nodes transitioning to one another on the character 'a', char_transistion being a map<char, nfastate> in my mind)
10:41gtrak``jsabeaudry: take a look at this hackernews: http://news.ycombinator.com/item?id=3135662 it might explain the discrepancy, specifically the post by prospero
10:55jsabeaudryJust tested it again, the only thing that changed in my code is switching from aleph/start-http-server vs noir.server/start, all the handlers are the same. Transfer rate with aleph/netty 330KB/s, transfer rate with noir/jetty 10.5 MB/s (maximum because 100Mbps ethernet)
10:57gtrak``on the arm?
10:57jsabeaudrygtrak``, yes
10:57gtrak``might be worth asking ##java if netty on arm sucks
10:58jsabeaudrygtrak``, good idea
11:10clgvromain_p: with immutable data you cant build direct referencing cycles. but you can build them by indirection like having edge ids and looking them up in a hash-map or such
11:11romain_pclgv: yup, so my graph would be a set of states, each one having a name (atom)...
11:11gtrak``or atoms/refs?
11:12clgvgtrak: you often dont want to use them if you have no real concurrency scenario there. but they might be an option if suited
11:12romain_pclgv: well actually, not an atom
11:13gtrak``clgv: if not concurrent, then they're quite fast
11:13clgvromain_p: you can have nodes and edges immutable if you do not insist to link them directly by reference
11:14gtrak``an atom's just a java AtomicReference, a loop and a CAS, so mutating one is just a CAS in single-threaded code
11:14clgvgtrak``: but why should I make my data representation more complicate by using them? I think it really depends on what you are doing.
11:15romain_pOkay, bear with me (newbie and all): why does this throw an exception?
11:15clgvI think you'll have to discuss "indirection vs. atoms" for your concrete problem
11:15romain_p(defrecord NfaState [name final char_transitions empty_transitions])
11:15romain_p(def my-graph {(NfaState. :a false {} {:b})})
11:15romain_puser=> java.lang.ArrayIndexOutOfBoundsException: 1
11:16llasramgtrak``: If you're going to use atoms that way, you might as well use `deftype' with mutable fields -- it'll be faster and the intent will be clearer
11:16llasram(IMHO)
11:16SomelauwDoes clojure allow importing classes? This is probably a bad idea but sometimes convenient. For example when using Math.
11:16clgvromain_p: because of {:b} since you have a hash map with only the key and not the value
11:16romain_pclgv: OK so that's a map. How do I represent a set?
11:16clgvromain_p: #{:b
11:17clgvoops. #{:b}
11:17romain_pclgv: thanks!
11:17seancorf`anyone know if cascalog can be used with amazon's elastic map/reduce? or should i go ask on the cascalog ML?
11:17SomelauwSo I can use sin, cos, tan directly?
11:18llasramSomelauw: Oh, you mean import static methods of a class? There isn't a builtin way to do that, but here
11:18clgvSomelauw: you can use whatever class you like by specifying it completely like java.util.Math/sin or importing it via (:import java.util.Math) within the ns statement and use it like Math/sin
11:19llasrams,here,there, used to be an 'import-static' in contrib, which you could rip off
11:19romain_pclgv: so given my previous definition, that would be a sensible method of representing graphs in clojure? : {(NfaState. :a false {} #{:b}) (NfaState. :b false {} #{:a})}
11:20TimMcllasram: It would also be lovely to be able to rename imports, like Math :as M
11:20TimMcM/sin would be acceptable.
11:21TimMcor Point2D$Double :as P2D !
11:22clgvromain_p: "sensible" depends how you are using them. I went with nodes and edges as deftype but both referencing with IDs
11:22dnolenSomelauw: make a lib (defn sin ^double [^double n] (Math/sin n))
11:25llasramTimMc: I've wanted that a few times, and it seems like it shouldn't be too hard, since normal importing works by interning the short name as a reference in the namespace to the class anyway
11:25TimMcclgv: I guess transients are no help here either, since they hide their mutability somewhat.
11:25Somelauwclgv: I tried (ns hello.hi (:import (java.util.Math))) on a repl and it didn't give an error, but I couldn't use sin directly. Maybe I did it wrong since I am still a bit new to clojure.
11:26TimMcllasram: Ooh, that would be a good group project at a meetup.
11:26TimMcSomelauw: You'll have to do Math/sin
11:26dnolenSomelauw: you can't use it "directly", it's not first class
11:26dnolenSomelauw: make a lib and then you're all set and you have something first class
11:26dnolenSomelauw: no overhead it will inline
11:26clgvSomelauw: like I wrote and the others told you, it's Math/sin you can use then
11:27TimMcdnolen: It doesn't even need an :inline clause?
11:27dnolenTimMc: nope
11:27TimMcBecause of HotSpot, or the Clojure compiler?
11:27dnolenTimMc: HotSpot
11:28TimMcOK, cool.
11:28TimMc<3 HotSpot
11:28Somelauwokay, Math.sin works
11:28TimMcSomelauw: Math.sin or Math/sin?
11:29SomelauwMath/sin
11:29dnolenclgv: not true
11:29dnolenclgv: the expansion has to be something inlineable by HotSpot
11:31SomelauwMath/sin probably works anyway even if nothing is included
11:32TimMcSomelauw: Right, java.lang.* are automatically imported.
11:33gtrak``Math's not a package, it's a class
12:01chouserdnolen: thanks for the help last night. Got some native deps working in the end.
12:03dnolenchouser: sorry I couldn't be of more help :) I've pretty much forgotten everything I learned as far as native-deps :)
12:12phil_why is (for [x (range) :when (< x 100)]) not terminating?
12:13phil_ah cause :when is a filter not a stop condition
12:13phil_sry :D
12:13TimMcphil_: :while
12:13phil_TimMc: thx
12:14semperosway to see docs for fn's at cljs repl?
12:14TimMcor [x (range 100)], but I assume that was a simplified example
12:14dnolensemperos: nope, I created a ticket for that in JIRA today.
12:14semperosdnolen: sweet
12:15semperosany metadata-querying abilities?
12:15phil_TimMc: yeah i need to go through some seqs lazily while some condition holds
12:15semperosI saw meta in the source, but not sure on status of things
12:15dnolensemperos: metadata on the actually source is not available from the JS side,
12:16dnolensemperos: open question on how to best provide access to that stuff
12:16semperosdnolen: understood; happy to have it done right vs. fast
12:16dnolenit exists, it's just a matter of how to get to it
12:16dnolencurrently hooking into the analyzer from CLJS REPL means a macro
12:17dnolenbut it's a macro that can never work in your actual source
12:17semperos:)
12:17dnolenoh rather a macro is one way, not sure if it's the best
12:18dnolenanother interesting way might be a reflection system, where the JS communicates back w/ the compiler/analyzer
12:19dnolenthen we can avoid the macro goofiness. perhaps a special reflect namespace or something ...
12:19semperosright
12:24llasramHow reasonable would it be to try to get '_' added as an "internal whitespace character" (for lack of a better term) in numeric literals, like in Ruby? Ex: (= 50_000 50000)
12:25dnolenllasram: low I imagine
12:25llasramOh?
12:25dnoleni mean the likelihood is low
12:25llasramWhy so?
12:28dnolenllasram: it's a cosmetic enhancement - those get pretty very low priority.
12:28hiredmanand it seems of questionable utility
12:28llasramEven with a patch? (Not that I've submitted a CA yet, although it is on my todolist)
12:29llasramhiredman: I find it pretty useful myself
12:29dnolenllasram: even with a patch, just based on my experience with patches like this
12:29llasramOk. Fair enough
12:33TimMcllasram: 5e4 in that particular example. :-)
12:34llasramTimMc: But then it's floating-point :-p
12:34TimMcOh man, you're right. I learned that at some point and totally forgot it again.
12:36samaarondnolen: is there any documentation describing how the cljs repl works? It's all voodoo to me - particularly given the absence of eval
12:37TimMcI tried to reverse-engineer the cljs repl for try-cljs and totally failed.
12:37TimMcIf there's documentation, it's not in the source.
12:38dnolensamaaron: TimMc: I know of no docs beyond the source, but it's not that complicated from what I've seen.
12:39samaarondnolen: ok cool - i'll tackle it when i get some spare cycles
12:39samaaronmy main issue is that i know no js
12:39dnolenI have a half-baked Node.js CLJS REPL that shows the basics, though it has some real issues.
12:39samaaronand i know nothign about how browsers present a js execution env
12:39TimMcdnolen: I never did figure out how to get cljs.core referred.
12:39dnolensamaaron: so how long before we get to run Overtone in the browser, Chrome Audio API is pretty cool :D
12:40dnolenTimMc: there's no magic, you just need to push the whole thing to get eval'ed
12:40samaarondnolen: well, you'd have to build your own 'mini-supercollider' implementation
12:40samaaronand then use the standard Overtone stuff on top of that
12:41dnolensamaaron: heh, yeah i know, just day dreaming :)
12:41samaaron:-)
12:41dnolenTimMc: samaaron: https://github.com/swannodette/clojurescript/tree/node-repl
12:41dnolenhttps://github.com/swannodette/clojurescript/blob/node-repl/bin/repl.js
12:41samaaronwe've been talking about building protocols for defining and controlling synths
12:41dnolenhttps://github.com/swannodette/clojurescript/blob/node-repl/src/clj/cljs/repl/node.clj
12:41dnolenthose are the relevant files for a minimal hacky REPL, at least for Node.js
12:41samaaronso then it would "simply" be a matter of implementing them on top of the Audio API ;)
12:41dnolensamaaron: neat :)
12:42samaaronyeah, Overtone seriously needs a good looking at from a protocol perspective
12:42samaaronwe really need to make more stuff modular and pluggable
12:42samaaronand much less monolithic
12:43TimMcdnolen: THanks, I'll try to figure out why that works and mine doesn't.
12:55jaleyhey guys. I'm using Clojure 1.3 for some java interop which used to work with 1.2. The problem is all numbers are now java.lang.Long and that won't cast to Integer. How do I force Clojure to use an Integer? I've tried (int x), (.intValue x), nothing seems to work...
12:59TimMc(Integer. ...)
13:00TimMcYou need to produce an Integer object, since an int will get turned into a Long. :-/
13:00semperosjaley: ^^^ what TimMc said
13:00AimHerejaley: ^^^ what semperos said
13:01jaleysemperos: but Integer has no constructor that takes a Long?
13:01jaley& (class (Integer. 1)) ;; appears to work
13:01lazybot⇒ java.lang.Integer
13:01gtrak``Integer.valueOf?
13:01gtrak``&(class (Integer.valueOf 1))
13:01lazybotjava.lang.ClassNotFoundException: Integer.valueOf
13:02TimMcTHat's a static and it takes a string.
13:02jaleybut once compiled, I get a runtime error that it can't find the constructor
13:02muhoojsabeaudry: isn't there an async package in clojure? "aleph", IIRC? , instaead of natty/jboss?
13:02TimMc&(Integer. 50L)
13:02lazybotjava.lang.NumberFormatException: Invalid number: 50L
13:02TimMcoops
13:03gtrak``ah, so you can't use the integer cache without having to convert to string? lame
13:03TimMc&(let [l 50] [(class l) (Integer. l)])
13:03lazybot⇒ [java.lang.Long 50]
13:03TimMcgtrak``: No, it turns out it will take a long.
13:03TimMcNot sure why, looking at the docs.
13:04gtrak``hmmmmmm
13:04TimMc&(let [l (Long. 50)] [(class l) (Integer. l)]) ; just to be sure
13:04lazybot⇒ [java.lang.Long 50]
13:04gtrak``TimMc: http://docs.oracle.com/javase/6/docs/api/java/lang/Long.html
13:04gtrak``looks like it was added in 1.6
13:05gtrak``&(class (Integer/valueOf 1L))
13:05lazybotjava.lang.NumberFormatException: Invalid number: 1L
13:05TimMcgtrak``: Oh, good. But that doesn't resolve my confusion over Integer's constructor.
13:05gtrak``&(class (Integer/valueOf 1))
13:05lazybot⇒ java.lang.Integer
13:05gtrak``what's the confusion?
13:06TimMcgtrak``: Integer's constructors in Java v1.6 take String or int, not long
13:07jaleyTimMc: yeah, that's exactly what's messing me up[
13:07gtrak``ah, you're right, I gave you the Long html page
13:07jaleyTimMc: it works at my repl - i'm guessing clojure is detecting I need something other than a long and passing the right object appropriately?
13:07gtrak``maybe it gets cast automatically
13:08jaleyTimMc: but it won't work after compilation for some reason
13:08gtrak``really? now that's odd
13:08jaleyNo matching ctor found for class java.lang.Integer
13:08jaleymy mind is full of **** :p
13:08TimMcWell, I thought at first that (Integer. 50) was getting an int 50 because the compiler saw that it didn't need to promote it to long, but... nope, works with (Long. 50) input.
13:09jaleyTimMc: yeah I just tried that too. it's bizarre
13:10jaimefanyone run clojure apps on embedded hardware?
13:10TimMcjaimef: jsabeaudry is doing some work on an arm7 device or whatever it is
13:16jaimefok. just wondering if 256 megs of ram is sufficient for lein deps/jar on compojure
13:18technomancybest not to run lein itself on the device
13:18technomancyjust prep an uberjar
13:19jaimefk
13:20jaleyi think i'm going to have to revert to 1.2 :(
13:20jaleythere's just no way i can find to prevent it from using Long
13:21TimMcjaley: Of course there is.
13:22TimMc...and I'm not even getting the compilation error that you were. WTF?
13:22jaleyTimMc: well... I think the problem is that I'm adding them to a collection, then the java app expects Integer to come up
13:22TimMcjaley: (Integer. (int ...)), does that work?
13:23jaleyTimMc: nope. wait let me see if i can give an isolated example...
13:25Somelauwjaley: please describe the error you are getting
13:26SomelauwI mean the console output
13:26jaleySomelauw: for which method of creating an integer? the constructor call one?
13:27dnolenjaley: (Integer. (int n))
13:28SomelauwOr I can just wait for the isolated example
13:28pandeiroare <_include>s in clojurescript one's templating lib supposed to show up in development mode?
13:29jaleydnolen: that works!
13:29SomelauwI was just wondering if it just said RuntimeError or if there was further info
13:30jaleySomelauw: so for some reason, if I do (Integer. 1), I get an integer in my repl, but then putting that in a java object collection, then passing that collection to a java library that casted it back to Integer was giving a cast error, claiming the object was a Long
13:31dnolenjaley: (Integer. 1) won't work, 1 is primitive long
13:31dnolen,(Integer. 1)
13:31clojurebot1
13:32SomelauwAnd (Integer. (int 1)) does work instead?
13:32dnolen,*clojure-version*
13:32clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
13:32jaleydnolen: should (int 1) without the Integer constructor call work?
13:33dnolenhuh weird oh well
13:35dnolenoh ok, prim long can cast to prim int
13:35dnolenjaley: you were seeing something like this
13:35dnolen,(Integer. (fn [] 1))
13:35clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer>
13:35dnolen,(Integer. (int (fn [] 1)))
13:35clojurebot#<ClassCastException java.lang.ClassCastException: sandbox$eval105$fn__106 cannot be cast to java.lang.Character>
13:35dnolen,(Integer. (int ((fn [] 1))))
13:35clojurebot1
13:35dnolen,(Integer. ((fn [] 1)))
13:36clojurebot1
13:36hiredmanI was gonna say
13:36jaleydnolen: I was... when I was calling the constructor with a long, yes
13:36dnolenhuh, I give up, don't know why that wasn't working
13:36dnolenjaley: I can't get it to break like you did
13:37jaleydnolen: well, (Integer. (int x)) seems to work
13:37jaleydnolen: so thanks for that guys - my head hurts now. i need beer. :-)
13:37TimMcdnolen: Any idea why (Integer. (Long. 50)) *does* work?
13:38dnolenTimMc: not really
13:38TimMceep
13:38dnolenbut the rule is simple, if Java interop wants prim int, prim to cast int
13:39dnolencast to prim int
13:39TimMcI don't think that's true.
13:39dnolenTimMc: in what way?
13:40TimMcI've seen (Integer.) be required, (int) didn't work,
13:40TimMcalthough that may have been due to some overloading with Object or Long or something.
13:41sr71-blackbirdwhat's a good way to do write a typed validation system/ err recommended in Clojure, defprotocol, defrecord?
13:41dnolenTimMc: that doesn't make any sense, if Integer is required, that pass Integer
13:41dnolenif prim int is required pass prim int
13:42dnolensr71-blackbird: defprotocol deftype/record don't do validation
13:42dnolensr71-blackbird: you could contribute to the analyzer
13:42sr71-blackbirdanalyzer?
13:42dnolensr71-blackbird: https://github.com/frenchy64/analyze
13:43sr71-blackbirddnolen, I know, I was writing validate and convert methods to defprotocol and using that with records
13:43sr71-blackbirddnolen, analyzer actually looks sweet
13:45dnolensr71-blackbird: it is, hopefully more people contribute
13:46dakronesea
13:46sr71-blackbirddnolen, any quick easy issues to get my feet wet? or features needed?
13:49dnolensr71-blackbird: you should message the maintainer, nice fellow
13:50TimMcdnolen: Checked the logs -- I misremembered re: Integer.
13:50dnolensr71-blackbird: also https://github.com/frenchy64/typed-clojure
13:51TimMcHmm, javac bails on new Integer(new Long(50))
13:58phil_why is this running out of memory?
13:58phil_https://gist.github.com/1677918
13:58phil_it is an attempted solution to problem #108 on 4clojure: https://www.4clojure.com/problem/108
14:00gtrak``4clojure looks to be hung
14:00phil_desc: Given any number of sequences, each sorted from smallest to largest, find the smallest number which appears in each sequence. The sequences may be infinite, so be careful to search lazily.
14:01llasramphil_: I believe the problem is `:when' vs `:while' in `for'
14:01llasram(or if not versus, you do need some terminating condition)
14:01gtrak``Raynes: I get a 504 gateway time-out on 4clojure
14:02phil_llasram: doesnt for return a lazy seq?
14:02RaynesDamn. And Alan isn't here. Guess that means I have to *gasp* restart it myself.
14:02llasramphil_: Oh, it does. I missed that `first' should be being applied to it
14:03apwalkgtrak``: glad you see it too. i thought my solution was just *that* good.
14:03Raynesapwalk: It probably was. ;)
14:03RaynesAlex is bringing it back up.
14:03phil_yea, for small ranges it terminates and if there are no matching numbers then its gonna hang but its not part of the requirements :)
14:04phil_however it bombs out with an outofmemoryexception actually
14:04llasramOh, wait
14:04llasramActually, nm. :-)
14:05phil_can it be because lazy seqs are cached?
14:05phil_but shouldnt they be garbage collected whenever they go out of scope?
14:05gtrak``they're not?
14:06phil_gtrak``: theyre not?
14:06Raynesgtrak``, apwalk: It's back up.
14:06gtrak``lazy seqs aren't cached, if you hold on to a reference as you iterate though, they'll never be freed
14:06TimMcWithout looking at the code, I'm gonna say you're holding onto the head of some seq.
14:06RaynesThanks for reporting it.
14:06gtrak``Raynes: thankyousir
14:08phil_ok im a little confused now... if they arent cached, holding on to the head shouldnt cause any additional memory consumtion?
14:08TimMcphil_: THey aren't so much *cached* as nonexistent before they are realized and... existent... after they are realized.
14:08gtrak``if you have an infinite seq, you can realize it, you'll get an oom if you hold on to the head and an infinite loop otherwise
14:10gtrak``&(range)
14:10lazybotjava.lang.OutOfMemoryError: Java heap space
14:10phil_ok, just to have a clear concept, what is cached then? i read somewhere that some type of seq was cached, i.e. elements arent recomputed on subsequent queries
14:10gtrak``it's not cached, you've realized it
14:10TimMcphil_: Would you say that the elements of [1 2 3 4 5] are cached?
14:11gtrak``if you can access a prior value, that means you've held on to the head of a seq
14:11gtrak``if you discard it, then the GC can collect it
14:12llasramphil_: I for some reason can't see why, but if add a :while condition to terminate the `for' when y exceeds x, the function generates no results. So some logic error is causing you to walk all of (range)
14:12gtrak``if you can only care about 'first' and 'rest' in your iteration then you're fine
14:12phil_from clojure.org/lazy: (talking about lazy-seq): returns a logical collection that implements seq by calling the body
14:12phil_invokes the body only the first time seq is called on it, caches result
14:12phil_will call seq on the body's return value if not already a seq or nil
14:13gtrak``and?
14:13phil_well here they talk about caching
14:13tavisdnolen: jumping back to what you were talking about earlier, re the cljs metadata open question: is metadata something that is definitely on the roadmap?
14:14phil_or is "realizing" a seq and "caching" a seq the same thing?
14:14TimMcphil_: And I'm encouraging you to think about it differently.
14:14gtrak``the function caches its value so it doesn't have to compute it again, it's up to you to hold on to that cache by holding on to a reference and preventing the GC from doing its job, there's no global seq cache
14:15phil_TimMc: yes, i just wanted to understand if those two things are different concepts or not
14:15TimMcThey are confusingly similar in this instance.
14:15phil_gtrak``: yes, i wasnt implying that there was a global cache
14:16phil_TimMc: but still different? then, when is a seq cached and when realized?
14:16gtrak``well, so if there was a cache, you'd have to be holding a reference to it for it to matter
14:17TimMcphil_: "cache" implies an eviction algorithm or timeouts
14:17TimMcat least to me
14:17gtrak``phil_: it's really an implementation detail that shouldn't affect how you use seqs
14:17cemerick"never" isn't an eviction strategy? :-P
14:17TimMcheh
14:18TimMcphil_: I'll say this, then get back to work: An infinite lazy seq is always only partially constructed, there's always a dangly bit at the end that's just an IOU promising to construct some more as needed, a.k.a. lazily. The more you ask for, the more gets constructed (realized), and the bigger it gets.
14:19phil_when i say cache i mean that the body isnt recomputed again on subsequent calls, whenever the ref to the seq goes out of scope then the "cache" is garbage collected
14:19TimMcphil_: Since it is a linked list, you can drop stuff off the beginning by dropping your references to it.
14:19TimMcphil_: There is *no cache*.
14:19gtrak``phil_: there are other details like chunking that are also irrelevant
14:19TimMcThe seq *is the cache*.
14:20phil_TimMc: "cache" in this context meaning the head
14:20llasramphil_: AH! It's the order of iteration in the for. The recursive call is lazy, but generates over a potentially lazy list. Since there's no terminating condition in the `for', the penultimate recursive call waits forever for the ultimate recursive call to generate more values
14:20llasramphil_: If you swap to [y (apply ! more), x a], then it works
14:20TimMcphil_: "cache" in this context meaning you're going about this all wrong.
14:20phil_llasram: but if you swap the arguments? is it gonna work as well? :/
14:21llasramphil_: Er, why wouldn't it?
14:21phil_TimMc: i think i understand the whole concept, it just seems the word "cache" is the wrong one
14:22phil_TimMc: sry if i made you rage :)
14:23phil_llasram: well try it, [1 2 100] (range) [3 5 100]
14:24llasramOh. If you need it to work in that case, you need a :while condition in your `for'. Otherwise you'll always be iterating over a potentially infinite list (which never actually generates more than one result)
14:24gtrak``&(println (range))
14:24lazybotjava.lang.OutOfMemoryError: Java heap space
14:25gtrak``it's odd that it actually tries to print in my cmd repl, I wonder how that works
14:26phil_gtrak``: maybe print just iterates over the seq if the argument is a seq
14:26phil_lazily
14:27TimMcphil_: Reading the source of LazySeq.java is quite illuminating, actually. (Even though there are no docs...)
14:28gtrak``phil_: hmm, I don't see it yet
14:29phil_llasram: well for returns a lazy seq and i access the first element, so it shouldnt iterate over the whole infinite seq, i.e. [100 101] (range) and (range) [100 101] both wok
14:30phil_work*
14:32phil_TimMc: yes, and what else is sval() if not a one-value cache?
14:32phil_i.e. if you already know the value of fn.invoke() dont recompute it again
14:33amalloyare we asking why lazybot doesn't "try" to print (range)?
14:33llasramphil_: Without a termination condition, the ultimate (deepest) call to `for' returns a lazy infinite sequence. Then the penultimate `for' (the one containing the recursive function call which makes the depeest `for') iterates over that sequence. If it can't generate any results from the values the deepest `for' generates, then it iterates over the deepest lazy sequence forever
14:33llasramphil_: The solution is to add a :while to your `for' so that it terminates
14:34gtrak``amalloy: well I think I get why lazybot doesn't try, I'm just not sure why the real repl does try
14:34amalloygtrak``: print just walks the sequence streaming to *out*
14:35amalloylazybot has *out* bound to a StringWriter, so it just chews up memory until it runs out; it doesn't stream like the built-in output stream
14:35RaynesIt'd get a little hairy streaming to IRC. ;)
14:35phil_llasram: but why shouldnt it be able to generate values from the values of the deepest for? this is what i dont understand
14:36TimMcRaynes: I do it all the time!
14:36TimMcA user, after all, is just a slow, buggy I/O device.
14:36amalloyRaynes: clojurebot actually does something fairly close to that, i think
14:36Raynesamalloy: I'm pretty sure it sets *print-length*.
14:36amalloyfor sure
14:36RaynesAnd it prints a new message per newline.
14:36RaynesBut I don't think streaming is the right word for either of those things.
14:37RaynesWe should probably set *print-length* too, just for fun.
14:37phil_llasram: the probelm is that i dont see a valid :while condition in this case, but it should terminate in any case :/
14:37amalloy,(dotimes [x 3] (Thread/sleep 1000) (println x))
14:37clojurebot0
14:37clojurebot1
14:37clojurebot2
14:38amalloyRaynes: he prints those as they arrive, rather than bundling them up: streaming
14:38amalloyhe flushes the stream at each newline
14:38TimMcamalloy: Hard to tell with that slowpoke.
14:39Raynesamalloy: Okay, sure, but he isn't streaming character by character to IRC. It has to be a single message per.
14:39llasramphil_: why not?: :while (>= x y)
14:39TimMcI get the same timing with sleep 1.
14:39amalloyRaynes: no argument there
14:39amalloy,(dotimes [x 3] (Thread/sleep 4000) (println x))
14:39clojurebotExecution Timed Out
14:39amalloyokay, maybe you win this time, TimMc
14:40TimMcI think it's a rate limiter between messages.
14:40TimMc,(dotimes [x 3] (println x)) ; no sleep, ma!
14:40clojurebot0
14:40clojurebot1
14:40clojurebot2
14:40amalloyyeah. i seem to have misinterpreted it as a streaming thing
14:41RaynesEven Einstein was wrong a couple of times.
14:41phil_llasram: still bad, try it on (map #(* % % %) (range)) (filter #(zero? (bit-and % (dec %))) (range)) (iterate inc 20)
14:43llasramphil_: wfm
14:43phil_llasram: and while (>= x y) is still gonna produce an infinite seq if both are infinite
14:44phil_llasram: really? what is the result?
14:44llasram64
14:44phil_can you paste the soure somewhere?
14:46llasramHmm.
14:46phil_llasram: nvm
14:46phil_i got it
14:46phil_now i must understand it :)
14:47phil_llasram: thanks a lot for the help!
14:48llasramphil_: np! It was a fun puzzle. It can be hard debugging these sorts of problems
14:48phil_llasram: yea, it definately can :) did you some tracing macro or just the old good brain? :D
14:49geefwhat do clojurers use instead of cadr,cdadr and caaar?
14:50TimMcgeef: get-in
14:50TimMcand less reliance on lists of lists of lists of lists...
14:50RaynesLogical sentences.
14:50llasramphil_: Tracing is hard when the problem is getting infinite list somewhere :-) I do wish there were better tooling for such issues, but I'm not sure what it would look like
14:50RaynesWords with definitions. Etc.
14:52phil_llasram: yea, functional debugging is a lot harder it seems... unfortunately :while doesnt work either: [1 2 3 4 5 6 7] [0.5 3/2 4 19]
14:52phil_it returns 1 instead of 4
14:52cemerickFYI: use couchdb like it was a clojure collection: http://groups.google.com/group/clojure-clutch/browse_frm/thread/4520716eb37a90cc
14:52cemerickfeedback on the API, etc. most welcome
14:54brehautcemerick: thers no magic for views yet with that new api right?
14:54Raynescemerick: I want to use couchdb like a couch. And sit on it.
14:54llasramphil_: Like this? https://gist.github.com/1678269
14:55cemerickbrehaut: aside from _all_docs via seq, no
14:55cemerickcoming, coming :-)
14:55cemerickviews are tricky bastards
14:55amalloygeef: fewer cons cells
14:55brehautcemerick: dont mean to sound pushy. i've not updated all my code to the 0.3.0 stuff yet :P
14:56Raynescemerick: Wow, that's pretty awesome.
14:56Raynesamalloy: I bet he is writing down all of our clever responses so that he can worship them later.
14:57amalloyheh
14:57llasramcemerick: OOC, does clutch support lazily generating results from couch's 'Transfer-encoding: chunked'?
14:58phil_llasram: perfect, thanks a lot again :)
14:59Raynescemerick: We plan to add proper Github-like rendering of markdown to refheap. You should add asciidoc support.
15:01Raynescemerick: I'm basically throwing that off to you in order to avoid grumbling about not supporting it in the future. I can just say "well, I told you to do it ages ago".
15:01TimMcI'm not actually a fan of GitHub-flavored Markdown. Specifically, I wish single line breaks were ignored so I could write super-ragged (SCM-friendly) docs.
15:11cemerickf'n macbook BSOD'd on me. :-X
15:11cemerickllasram: you asked something?
15:11gtrak``is it blue on a macbook?
15:12cemerickgtrak``: it actually a very well-styled gray, logoed screen with antialiased text indicating that you're SOL.
15:12llasramOh, sorry. I was just wondering if clutch can allow lazy processing of results as couch streams them via chunked-encoding
15:12gtrak``ha, it's good to bomb out in the most aesthetically pleasing way
15:13cemerickMy problem is actually not that — every now and then, the whole business freezes, with the screen frozen with odd animated artifacts. I think it's either an overheating video card, or bad memory.
15:13llasramI don't know my underlying Java well enough to tell if the HTTP facilities support that...
15:13cemerickllasram: Yes, absolutley
15:13llasramAwesome!
15:13brehautcemerick: is that the multiligual F U bezel ?
15:13cemerickbrehaut: yeah, something like that!
15:14brehautmac os x has a more dire error mode; kernel panic text just slowly rights down the screen over everything
15:14cemerickI'm lucky enough to have never seen that.
15:14brehautyou need to seriously damage the mobo i think
15:14cemerickI'm salivating at the next upgrade.
15:14brehaut(or have it ship with a dodgy nvidia card)
15:15brehautoh yeah?
15:15sritchiedo you guys know how to use the multi-arity version of aset?
15:15sritchie,(doto (int-array 10) (aset 1 10))
15:15clojurebot#<int[] [I@1449b2b>
15:15sritchie,(seq (doto (int-array 10) (aset 1 10)))
15:15clojurebot(0 10 0 0 0 ...)
15:15cemerickmmm, maybe I should switch to use the on-chip video…
15:16sritchienot sure how to use this version: [array idx idx2 & idxv]
15:16cemericksritchie: that's for N-dimensional arrays
15:16brehautcemerick: i get the occasional f u bezel from sshing into VBox bridged vms
15:16sritchiecemerick: I see, so setting a corner of 2d array would be (aset arr 0 0 10)
15:18cemericksritchie: yeah, although, you should never really use it: it uses apply, so boxes like mad. You want to use deep-aset from http://clj-me.cgrand.net/2009/10/15/multidim-arrays or the much-enhanced version that's in the book.
15:18cemerick(we should put that out in a separate project…)
15:18sritchieI'm going through clojure.core w/ Anki
15:18sritchiecemerick: awesome, thanks for the reference
15:18brehautcemerick: have they told you when to expect the next revision of the pdf to occur?
15:19cemerickbrehaut: Any minute now?
15:19sritchieLove cgrand's blog heading: »When the pupil is ready to learn, a teacher will appear
15:19brehautcemerick: awesome :)
15:19cemerickIt's like trying to choose the right pipe out of 100 into which one can drop a message, and hope it hits the right person in the head.
15:28chousercemerick: congrats, btw. feeling the relief yet?
15:29cemerickchouser: Thanks :-)
15:29cemerickTo some degree. It's a bit odd — the days are so much longer all of a sudden!
15:31chouser:-)
15:32chouserdoes anyone know how to declare a dep on a particular version of a snapshot dep?
15:32chouserthe jar I want is in me ~/.m2, but I can't figure out how to tell lein that's the one I want (vs. the newer broken version it's trying to use)
15:33cemerickchouser: that's called "locking snapshots" in maven-land
15:33cemerickreplace SNAPSHOT with the timestamp from the particular rev you want
15:37sritchietechnomancy: quick question on dependency resolution
15:37chouserI tried that, but I screwed it up. Trying again...
15:37jsabeaudrywhat exactly is reported when clojurebot says "recently on clojars.org..." Is is that a new version was uploaded?
15:38sritchieI'm pulling from an artifactory repo where some dependencies are <packaging>jar</packaging> and some are <packaging>pom</packaging>
15:38TimMcyeah
15:38sritchietechnomancy: the pom packages are just bundles of jar dependencies
15:38TimMcjsabeaudry: I think it's a different message when something new is added.
15:38sritchieleiningen doesn't seem to be able to handle these properly, though everything works fine if I manually include everything
15:38chousercemerick: thanks, that did it. I was repeating the package name in the version string. for some reason *that* didn't work. :-P
15:39jsabeaudryTimMc, So what does this one mean exactly? Someone downloaded a library?
15:39TimMcjsabeaudry: Nah, someone uploaded a new version of something.
15:40jsabeaudryTimMc, Ah ok! Thanks!
15:40cemericksritchie: what if you specify packaging of "pom" in your relevant :dependencies?
15:40cemerickchouser: Good; something to automate that really should be in lein.
15:40sritchiecemerick: interesting, like :packaging "pom" ?
15:41sritchieI know the exclusions key
15:41sritchiecemerick: the problem is when some jar pulls in a dependency that's packaged like this
15:41sritchieI can explicitly include it in project.clj, but that doesn't feel right, really
15:42cemericksritchie: looks like it's :type "pom"
15:42cemericksritchie: do you have an example (publicly-accessible) dep that has this issue?
15:43cemerickIt's been a while since I messed with pom deps.
15:43sritchieme too, I don't know where I can find one of these guys
15:43sritchieor how to deploy one to clojars, for that matter
15:44cemerickWhy would you want to deploy one to clojars?
15:44sritchiethat's the only public maven repo I know of that I can push an example to
15:44cemerickoh, I see :-)
15:44cemerickThere's plenty of pom deps in central, I just don't know of one off the top of my head
15:45cemerickProbably gobs of 'em in spring, etc.
15:45brehautthey are seasonal?
15:46sritchie:type "pom" works
15:46sritchiecemerick: but not if some other dependency pulls in a pom packaged dep
15:46sritchieeven if I override it, it'll still fail
15:46sritchielet me check central
15:47sritchie[org.kohsuke/pom "2" :type "pom"] works, [org.kohsuke/pom "2"] fails
15:53sritchiecemerick: https://github.com/sritchie/Example-Deps-Issue
16:05jodarohuh
16:05sritchietechnomancy: issue here: https://github.com/technomancy/leiningen/issues/380
16:05jodaroi don't seem to be getting any google group digests
16:06Raynesjodaro: You're a blessed man.
16:06jodaroi know
16:07jodaroexcept there are a couple i kinda like
16:07jodarofor example
16:07jodaroclojure
16:07cemericksritchie: that's expected behaviour AFAIK
16:07sritchiecemerick: the question is how I can deal with dependencies that haven't formatted their poms in the way that lein expects
16:09cemericksritchie: a pom dependency that doesn't declare a <type> is broken
16:09jsabeaudryAnyone has some experience with clj-time? (No matter if I use (from-time-zone or not the time is always printed in UTC)
16:09cemerick<type> defaults to "jar", and shouldn't ever resolve to a .pom AFAIK
16:10cemerickalthough, presumably, they *are* working, so…
16:12cemericksritchie: adding the <type>-less dep on org.kohsuke/pom to a maven project yield a dependency resolution error (Could not find artifact org.kohsuke:pom:jar:2 in central)
16:13sritchieI'll see if I can track down this issue on the twitter side and make them fix it
16:13jsabeaudryAh all is well, from-time-zone was erroneous I was supposed to use .withZone on the formatter
16:23cemericksritchie: It'd be interesting to hear what would make that succeed, if you ever find out. :-)
16:27technomancyso it sounds like the problem is with the dependency?
16:28sritchietechnomancy: yeah, and with my maven understanding, I guess
16:28sritchieI had thought there was some way to look at the deps in the pom to figure out the type
16:28technomancyok.
16:28sritchieif that's missing from the pom (the type), then there's nothing we can do
16:29sritchieexcept fix it up inside twitter, which I'll do
16:29technomancysritchie: btw, I think the user-level repos thing you mentioned earlier is something you get for free with profiles in lein 2
16:29sritchietechnomancy: nice
16:29sritchiethe profile isn't project-based?
16:29technomancyexcept it's basically repeatability-poison, so it will probably emit a big ol' warning
16:30technomancyprofiles are read from the project and the user config
16:30sritchieI think it'd be nice to be able to have an internal config for leiningen
16:30sritchieso you could use lein in a closed environment
16:30technomancyyeah, cemerick has sketched some of that out; shared project middleware
16:31technomancysritchie: https://github.com/technomancy/leiningen/wiki/Project-Middleware
16:31technomancyfeedback welcome
16:31cemerickthat was actually ninjudd
16:31technomancyoh?
16:31cemerickwell, I was instigating something, I'm sure :-P
16:31technomancyoh right; he wrote it up, but I thought that it addressed a number of use cases you were pining for
16:32cemerickyeah
16:32cemerickI think my initial email to the lein ML described a couple of scenarios that profiles and middleware will address
16:32cemericktechnomancy: readability is only going to get more important; viz. chouser wanting to lock snapshots earlier
16:32cemerickstuff like that can and should be automated.
16:34technomancyI agree, but giving up the ability to comment your project is a ridiculously high cost.
16:35cemerickI think a formatting- and comment-preserving alternative reader impl would be a perfectly fine idea.
16:35technomancyabsolutely
16:35technomancyjust don't want to be the one to write it
16:35cemerickit's not like requirements like this are going to get less common
16:35cemerick:-D
16:35technomancyheh
16:35technomancyI'd consider it a prerequisite to automated project.clj modification
16:35brehauti could throw out so much code if there was a preserving reader that i could use in clojurescript
16:35cemericktechnomancy: don't talk the task down!
16:36chousera preserving reader would be great in so many contexts
16:36chousercemerick: gah! crossed posts! I wasn't volunteering!
16:36cemerickLOL
16:36cemerickchouser: it's so great that it worked out that way, though!
16:36technomancyhiredman: you spiked out a lossless reader, right?
16:37technomancythat'd make a great demo at the next seajure
16:39chouserif everything that could be read could hold metadata, that'd be an intruiging option. But without that, I'm not even sure what such a reader should return.
16:42TimMcHow does Eclipse handle refactoring Java code?
16:42gtrak``TimMc: it has its own compiler
16:42TimMcThat sort of thing might be a good research starting point.
16:43gtrak``in other words, they have control of the AST
16:43technomancythis is actually the one interesting thing about Go IMO; the AST is actually an explicit part of the language spec
16:44cemerickit seems like comments and contiguous whitespace just turn into instances of some other type; no reason why a lossless reader wouldn't return (mostly) the same as what the current reader does
16:44cemerickAnd then 1:1 correspondence is a postwalk away
16:45TimMcThere are some tough questions about insertion of forms and preserving indentation, etc. Eclipse has a configurable formatter built in, which is probably what they fall back to.
16:46gtrak``the formatter's not terribly smart
16:53arohnercemerick: I just started using bandalore. it looks good. Great docs too
16:54cemerickarohner: oh, cool. :-) I haven't touched it in a while, glad it's still up to snuff.
16:54cemerickwell, great docs if github wasn't so bloody broken these days :-X
16:55arohnercemerick: so far, I've only done the 'send' side of hello world. I'll you know about the rest soon :-)
16:55arohneryeah, but the docstrings are good too
16:55cemerickglad it's clear for you
16:56cemerickI really have no idea why markdown holds such sway with programmers.
16:56brehauthistorical accident i think
16:56technomancyleast-common denominator
16:57technomancyjust be glad textile seems to have withered; it was king of '06-era rubyland
16:57brehautgruber wrote good docs and a solid implementation for it back when tools of its ilk were rare. the php port that everyone used with wordpress was also pretty good
16:58Raynescemerick: I know markdown. I do not know asciidoc.
16:58RaynesIs that not good enough?
16:58technomancyhe forgot to write a spec, unfortunately
16:58brehautindeed
16:58brehautand its a big bag of regexps to bash against the input, so good luck reverse engineering that
16:58cemerickRaynes: insofar as markdown is an impoverished format, no.
16:59Raynes$dict impoverished
16:59lazybotRaynes: adjective: Reduced to poverty; poverty-stricken. See Synonyms at poor.
16:59Raynescemerick: Everything you say to me makes me feel like an illiterate hick. Just FYI.
16:59jsabeaudryTypically does version "0.0.1-SNAPSHOT" come before or after version "0.0.1" ?
16:59RaynesWay, way before.
17:00technomancy(as well as immediately before)
17:00brehautjsabeaudry: -SNAPSHOT is the untrustworthy imposter release of the version.
17:00RaynesI never use snapshots.
17:01jsabeaudryAlrighty, thanks, I guess I can see snapshot as some kind of RC0
17:01cemerickRaynes: You're plenty erudite, don't worry. :-P
17:01RaynesIf I need to release something before a stable release, I release alphas and betas.
17:01Raynes0.1.0-alpha1.
17:01Raynes$dict erudite
17:01lazybotRaynes: adjective: Characterized by erudition; learned. See Synonyms at learned.
17:01Raynescemerick: I'm learned!
17:01gtrak``maven tends to always check for new snapshot releases upstream, is this true for lein as well?
17:01jodaronice
17:02technomancygtrak``: once a day
17:02technomancygtrak``: actually, no with the latest lein it's only whenever your :dependencies list changes
17:02technomancyor when you explicitly run "lein deps"
17:02gtrak``ah
17:02TimMcso if deps doesn't run, the daily SNAPSHOT check doesn't run
17:03gtrak``that makes sense
17:03TimMcRaynes: Wait, I thought 1.0.0-SNAPSHOT came after 1.0.0 because it's not known what the next version will be.
17:04gtrak``WRONG
17:04gtrak``:-D
17:04RaynesTimMc: I thought that the chicken came before the egg, but even that is cloudy these days.
17:04brehautactually the chicken came from asia and is a domesticated red jungle fowl
17:05hiredmansounds correct to me
17:05hiredmanjust don't check wikipedia
17:06TimMcgtrak``: This is terrible. I thought it was such a cool thing!
17:06jodaro$know chicken
17:06lazybotjodaro: chicken (the domesticated bird)
17:06jodarovague but not incorrect
17:07Raynes$know leiningen
17:07lazybotRaynes: "Leiningen Versus the Ants" by Carl Stephenson, the classic short story published in the December 1938 edition of Esquire Magazine
17:07TimMcRaynes: The egg came first, because the genetics are what matters, and the egg has the same genetics as the chicken it turns into, not its parents. Whereever you draw the line across the lineage, it will be between an egg and its parents.
17:07Raynestechnomancy: ^ lazybot knows. It *knows*.
17:08RaynesTimMc: You and aren't friends anymore.
17:08TimMcme and some invisible username?
17:08RaynesYes.
17:08TimMcI'm pedantic for your benefit, Raynes.
17:09jodaroi think we all benefit from said pedantry
17:10TimMcI know *I* do.
17:19TimMcSo, is there any way to version something as v.Next?
17:21TimMcLATEST, is that it?
17:22TimMcNever mind, that's instead of a version range.
17:24technomancyholy smokes, do you really need to set the JAVA_HOME environment variable to use Oracle's JDK on windows?
17:25Raynestechnomancy: I've just given up on supporting Windows in anything I do ever.
17:25RaynesI'm mostly a "patches welcome if you need windows support" kind of guy, though the Windows patches I get tend to be completely insane and unformatted by people who don't really know Clojure.
17:26technomancyoh man, this guy is telling people to manually download libssl in order to do curl in order to do lein self-install.
17:26RaynesHaha
17:27technomancyI don't even know; that could be a reasonable thing to tell people to do on Windows?
17:29TimMctechnomancy: Is that with Cygwin?
17:30technomancyTimMc: nah
17:30TimMcI mean, if you're doing anything outside of Cygwin, it's going to be that nmuch worse.
17:31technomancy"disable your antivirus to allow lein plugin install to work" =(
17:31technomancyis this the price of enterprise domination?
17:31the-kennyAlso, try to reboot if M-x clojure-jack-in doesn't work.
17:31brehautlets just let the enterprise use F#
17:32technomancybrehaut: tempting!
17:32technomancyI wonder if relevance's sponsorship of CCW was a strategic move in that direction
17:33brehauta reasonably hypothesis
17:33brehautand a more approachable enviroment than emacs
17:34the-kennyWell, if I had to use windows, I'd use emacs.
17:34the-kennySo I have at least some kind of abstraction between me and Windows :)
17:34technomancybrehaut: what; that's a reasonable thing to say.
17:34TimMcbrehaut: Emacs is in no way approachable... and you'll have to pry it from my cold, dead RSI-riddled hands.
17:34brehauttechnomancy: yes, but i fear jihad nontheless
17:34gtrak``the-kenny: then all you'd need is a decent text editor
17:35TimMcI'm sure you canload vim in a buffer.
17:35the-kennygtrak``: I can use vim inside emacs for that.
17:35technomancybrehaut: the objections come when people value approachability over other good things
17:35brehautthe-kenny: visual studio + F# is actually a pretty good buffer too
17:35technomancyfortunately you have to already understand that familiarity is orthogonal to elegance and power to even want to use Clojure in the first place
17:36Scriptor+
17:36technomancyso we don't get too many of those types
17:36technomancy(the mailing list being the exception that proves the rule I guess?)
17:36brehauttotally
17:36AimHereI always thought of emacs as RMS's method of having some kind of usable abstraction between him and Unix ;)
17:37technomancyAimHere: for a long time it was the only thing keeping the dream of the Lisp Machine alive
17:37AimHereYup
17:38brehautactually, i think i avoid the ML because of google groups more than any personalities
17:39technomancyugh; the stupid new hashbang UI
17:39technomancybrehaut: it has a nice email interface too, you know =)
17:39brehautbrehaut: haha nah they broke that for me with my apps for domains accoutn
17:40brehauti gave up trying to fix it
17:40TimMcI used to have my domain email hosted with Google but now I use Cotse -- much less sketchy.
17:40TimMcalthough I do miss the UI
17:40brehautTimMc: yeah thats why ive stayed with gmail; my family also have email addresses at my domain
17:41TimMcaha
17:41brehautgmail and reader are the only things i use google for these days
17:41technomancynot jabber?
17:41brehautoh
17:41brehautmaybe i do actually
17:41brehautthat'd be trivialy to switch out though
17:41llasramtechnomancy, brehaut: And a usenet interface via gmane!
17:42technomancyllasram: hm; I should check that out
17:42technomancyprobably not as sluggish as gnus+imap
17:44brehautTimMc: you havent lived till you've tried to read comp.lang.lisp
17:45TimMcheh, I bet
17:45fhd_Can't seem to find something equivalent to seq-utils/find-first (from contrib) in 1.3, any leads?
17:45jodarowouldn't that make it unusednet?
17:45AimHereIf you ever go on Usenet, TimMc, just type the word 'Kibo' in there somewhere, as a test
17:45TimMcAimHere: Oh, I've browsed around his site.
17:46AimHereI'm just curious as to if he still greps all of Usenet
17:46AimHereKibo was the Candyman of the internet back in the day
17:46TimMcfhd_: You mean (first (filter ...)) ?
17:46fhd_TimMc: No, I don't want to filter the whole seq, only up to the first match
17:46fhd_TimMc: But filter is lazy, eh?
17:47fhd_TimMc: OK, thanks :)
17:47brehautfhd_: thanks to the magic of lazy seqs, thats mostly true (except for chunked seqs)
17:56TimMc&(first (filter #(do (println %) true) (range)))
17:56lazybot⇒ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0
17:56TimMcI guess filter is chunked!
17:57brehautrange and vector produce chunked seqs, rather than filter being chunked isnt it?
17:57TimMcHmm...
17:57technomancybrehaut: yes
17:57brehautTimMc: have a look at (source filter); its got a bunch of extra code to handle chunked seqs though
17:57TimMcfilter isn't in control of what its predicate gets applied to?
17:58TimMc&(first (filter #(do (println %) true) (iterate inc 0)))
17:58lazybot⇒ 0 0
17:58frankstechnomancy: the 1.7.0-SNAPSHOT code for lein still doesn't seem to use rlwrap - you mentioned before that you may have accidently deleted it... should I submit an open issue for that?
17:58brehautTimMc: it does maintain a chunked-seq if it gets one, buti it doesnt generate one otherwise
17:58TimMcANd now I see the purpose of unchunk.
17:58brehaut,(apropos 'chunk)
17:59clojurebot(chunked-seq? chunk-buffer chunk-cons chunk-append chunk-rest ...)
17:59TimMcbrehaut: It's not a standard fn.
17:59amalloybrehaut: i believe that describes all chunked-seq functions (those that take a seq as input, anyway; i'm not including range here)
17:59brehautamalloy: yes i think you are right; i was just using it as an example
17:59technomancyfranks: hmm; I thought I had fixed that
18:00technomancyapparently not! feel free to open an issue and/or pull request
18:00frankstechnomancy: maybe i'm looking in the wrong branch...
18:00technomancynope; it's gone
18:00franksok
19:13frankstechnomancy: is the "-XX:+TieredCompilation" option for the jvm valid in general or only for the trampoline case?
19:26technomancyfranks: no, it should always be active
19:54picklesanyone have any tips on general optimization?
19:54picklesany functions to avoid?
19:54picklesI rewrote part of a program, and what would take a few seconds before in the old, ugly code on my netbook's Atom now takes over 15 on my dual-core athlon
19:55pickles(granted I'll have to review the algorithms I'm using now, but any tips would be appreciated)
19:55dnolenpickles: look at test.benchmark for ideas when perforamnce is actually critical
19:56picklesmmk, I'll take a look
19:56pickles(I'm still new to clojure so I'm not that familiar with things yet)
19:56dnolenpickles: common pitfalls including trying to do operations like nth and count on seqs
19:56picklesmm... I am doing a couple of count calls
19:56dnolenincluding -> include
19:56pickles[]s are seqs, right?
19:57dnolenpickles: vectors are random access, but not if you put them through seq operations like map/filter/etc
19:57picklesyup, using map and mapcat alot
19:58pickleson vectors
19:58dnolenpickles: there's nothing wrong with those use well, but expect operations like nth and count to be linear after those have been applied, you longer have a vector but a seq
19:58dnolenused well
19:58pickleshm
19:58picklesso if i wrap it in a vect cal will it ease that a bit?
19:59picklesi was using that alot more in my earlier code
19:59dnolenpickles: 1.4.0 alphas have mapv / filterv as well
19:59picklesi'm still on 1.2 atm
19:59dnolenpickles: but yes you could put them back into vectors (into [] ...)
20:00picklesok, would you recommend that before counts, or just generally after maps?
20:00dnolenanything that would be linear otherwise
20:00picklesmm
20:01technomancypickles: my advice would be don't optimize before you profile
20:01dnolenpickles: and I'm not recommending that in general, just depends on what you're doing
20:01picklesright (to both)
20:01technomancya common cause of slowdown is reflection, but until you've confirmed that's a problem you don't want to waste your time with type hints
20:01picklesright
20:01technomancyespecially considering it's likely you only need a handful of them in a few strategic locations
20:02pickleswas just reading something to that effect
20:02dnolenpickles: best to assess your changes since an order of magnitude slowdown sounds weird
20:02picklesyeah
20:03picklessadly that'll have to wait till another nite, when my brain isn't so fried
20:03brehautre:type hinting and global *warn-on-reflection*, if you set w-o-r to true in lein, do all the dependancies also warn?
20:03picklesthx for the help guys
20:04picklestime for some profiling
20:04technomancybrehaut: they should, possibly except for the ones that have been AOTd?
20:04technomancyI actually have no idea; I never profile or AOT personally.
20:04brehauttechnomancy: right. so if you were to release a library, would you type hint it so that it had no reflection warnings ?
20:04brehaut(ie, to prevent it being noise in someone elses codebase)
20:05technomancyI would release it with reflection and wait till someone yelled at me, then I would accept a pull request from them. =)
20:05brehautlol :)
20:05brehautfair enough :)
20:05technomancyit depends on the lib and its likelihood to be used in a tight loop I guess
20:05brehautie, its a complete waste of time in an xml-rpc lib ;)
20:06brehautand i shouldnt have bothered
20:06technomancythe problem tooling-wise is that there's no way to say "I don't care about reflection warnings from these namespaces; they are all I/O bound anyway"
20:06technomancyI don't think you can fix that outside the compiler
20:06brehautright
20:06frankstechnomancy: just checked-in a pull-request for that rlwrap fix for the 1.7.0-SNAPSHOT branch...
20:07technomancybrehaut: so someone could have a legitimate need for warn-on-reflection but have the useful info they need buried by my crap, and that would make me feel at least marginally bad even if it's not necessary for my code
20:07technomancybut really I would shift most of the blame to clojure itself =)
20:07technomancyfranks: great; thanks!
20:10amalloymapv, interesting. i guess that avoids creating as many temporary seqs?
20:10brehautand can use a transient ?
20:10technomancyhmm; I smell a doall/map replacement =)
20:11frankstechnomancy: ...just one other issue that I noticed - you only enable rlwrap for options of repl/interactive, which doesn't allow a plugin to enable rlwrap... I kind of hardcoded my plugin in there for now - you should be able to enable rlwrap always and still pipe input in thru stdin without rlwrap getting in the way - otherwise maybe enable for any plugin starting with "repl*" ;-)
20:11technomancyfranks: yeah, I do feel a bit bad about special-casing the built-in tasks. it's probably fine to enable in unconditionally.
20:12brehautanswering my own question: yes
20:13frankstechnomancy: you could still test whether there is a terminal connected to enable rlwrap...
20:13brehautwhoa. the definition for *clojure-version* is way more complicated than i expected
20:13technomancyfranks: should already be doing that actually
20:17frankstechnomancy: correct - and that test alone should suffice
20:26frankstechnomancy: modified the pull-request to include a change that would remove the tests for internal tasks.
20:44jedahutrying to get lein to start a rhino repl
20:44jedahuno joy: http://paste.lisp.org/display/127304
20:45dgrnbrgIs there a good way to report an error from inside a macro and get a stacktrace?
20:45dgrnbrgCan I just (throw (RuntimeException. msg))?
20:45dgrnbrgCan I integrate with clojure's compiler errors?
20:46jedahuyou know macros don't create stack frames right?
20:46technomancyfranks: sorry if I was unclear; the removal of the check for the trampoline task was intentional
20:46amalloyjedahu: that's an overstatement that assumes something about what he means
20:46technomancysince with the addition of :plugins we need to be able to trampoline from arbitrary tasks
20:47jedahuamalloy: just trying to clarify exactly that :-)
20:47dgrnbrgI am writing some code that does very complex tasks within macros
20:47dgrnbrgand they can fail
20:47amalloyan error occuring during macroexpansion will certainly result in a stacktrace in the compile phase
20:47dgrnbrgI want the line number where they fail
20:47dgrnbrgamalloy, that's what I'm wondering
20:47dgrnbrgI feel like i've seen my environment not give me stacktraces
20:47dgrnbrgsometimes, but other times I see them
20:49dgrnbrgIs there a shortcut to throw a runtime exception? Like, a utility function or the like?
20:49brehautthrow ?
20:49dgrnbrgBut I want to write (throw "problem is this var" the-var)
20:50dgrnbrgWrite my own?
20:50amalloydgrnbrg: so write a function for that, problem solved
20:50technomancyslingshot sorta does that
20:50dgrnbrgI like to not maintain my system
20:50dgrnbrgand to integrate with the best solutions
20:51dgrnbrgso that I can just focus on my actual problem, instead of the solved problem
20:51dgrnbrgis slingshot the conditions lib?
20:51technomancyyeah, its successor
20:51brehauta one line function isnt really that onerous is it?
20:51dgrnbrgright, i've read about that
20:52dgrnbrgbrehaut, ;)
20:52jedahutechnomancy: any ideas?
20:52clojurebotGabh mo leithscéal?
20:54technomancyjedahu: weird... I haven't done any clojurescript beyond hello world, so it's hard to say
20:55technomancythe task function looks legit though
20:56technomancyI tend to use fully-qualified references + require instead of require :as in eval-in-project, but that's just a style thing
20:57jedahutechnomancy: thanks for looking
20:57dgrnbrgwhat is a better way of doing (flatten (partition 1 2 [1 2 3 4]))?
20:58dgrnbrg,(flatten (partition 1 2 [1 2 3 4]))
20:58clojurebot(1 3)
20:58jedahuthere isn't a channel where clojurescript gurus hang out is there?
20:58dgrnbrgrather, is that idiomatic?
20:59technomancyclojurebot: flatten?
20:59clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
20:59amalloy&(take-nth 2 [1 2 3 4])
20:59lazybot⇒ (1 3)
20:59amalloyjedahu: #clojure
21:00dgrnbrgamalloy, take-nth is exactly the function. And thanks for telling me about concat--I forgot about it
21:03philis it considered cleaner style to work with defprocols/records or with just maps of functions when polymorphism isnt needed?
21:33jeremyheilerIs it conventional to have an ! at the end of a function name that does IO?
21:35apwalk"Use the bang! only for things not safe in an STM transaction."
21:35apwalkhttp://dev.clojure.org/display/design/Library+Coding+Standards
21:40dgrnbrgHow do I diff data structures?
21:40dgrnbrgahh, clojure.daat
21:41jeremyheilerapwalk: What is considered not safe? I suppose if I'm not touching the transaction, then it's safe.
21:42jeremyheilerWell, by "touching" I mean not changing a var/ref/agent/atom etc.
21:45apwalkI'm new, but I'd say yes, that and using transients.
21:46apwalkI'm looking through the source of *! functions on clojuredocs and looking for patterns.
21:48apwalkPretty looks like anything that's expected to have side-effects, unless protected by STM.
21:48jeremyheilerNice, yeah, I would agree.
21:48jeremyheilerThanks
21:49brehautfunctions whose name end in a ! are not safe for use within an STM transaction
21:49brehaut(rather than side effects in general like in other lisps)
21:50apwalkAh, so replace my "unless" with "and can't be" ...
21:51jeremyheilerbrehaut: Yeah, I was thinking the definition could also include other side-effecty things, but now that we've talked about it, it makes sense to keep it STM related stuff.
21:52jeremyheilerGiven that STM is essential here
21:52brehautsend is a good example: its side effecting, but the STM holds all agent sends till after the transaction succeeds
21:52brehautcontrast with atoms that have swap!
21:53brehautim pretty sure this is _somewhere_ on the dev.clojure.org site, but i can never find it
21:53jeremyheilerapwalk provided the link to the one-liner, but that doesn't explain much. unless you're thinking of something else?
21:54brehautmaybe ive confused two articles then
21:54brehautbecause thats the article i was thinking of, but not not the right exposition
21:56brehautim curious how dosync and send actually coordinate the holding back of the agent message
21:57brehautsend itself is rather brief
21:57jeremyheilerhttp://clojure.org/refs explains it very well, but doesn't mention the formality of the bang
21:57brehautsorry, i mean the implementation details
21:58dgrnbrgI'm trying to test out a macro, and I'm noticing that if I use macroexpand-1 in a deftest, it doesn't seem to expand the macro
21:58jeremyheilerbrehaut: no, my bad, I was replying to your message about the article
21:59brehautah i see. clojure.lang.Agent dispatchAction explicitly looks for the running transaction https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L248-258
21:59jeremyheilerwas just loading that file on github myself haha
22:01jeremyheilerso basically then it just queues it up into the transaction. but that doesn't mean it waits until the end, or does it?
22:01dgrnbrgHmm, the tests work if I namespace-qualify the quoted macro form I want to expand
22:01dgrnbrgbut I don't need to on the repl
22:01brehautjeremyheiler: looking at LockingTransaction it does
22:01jeremyheileroh nevermind, i see iterate over the actions in the finall block
22:02jeremyheileri see it*
22:02jeremyheilerfinally*
22:02brehauti wonder why its specific to agents
22:02brehautand not just arbitrary ifns
22:03brehautit seems like it would useful to package up all sideeffecting, non transactional stuff like that
22:05jeremyheilerit seems like you could by referencing all your side effecty objects with an agent?
22:05brehauti guess so
22:06brehautthat does make them asyncronous, i wonder if thats a problem
22:06brehautthis is all well above my pay grade
22:06jeremyheilerim not sure what the bounds of a transaction are yet, though. but i can imagine you may not want... yeah, asynchronous.
22:06jeremyheilerlol
22:08jeremyheilerit'
22:08jeremyheilerit's cool to think about, though.
22:08amalloydgrnbrg: deftest has all kinds of weird and crazy behaviors, especially related to macros
22:10brehautjeremyheiler: definately is. ive learnt a lot by spelunking like that
22:11amalloyi believe this is because (deftest foo (blah)) expands to something like (defn ^{:test (fn [] (blah))} foo []), and there's something weird about metadata that i don't entirely understand
22:13jeremyheilerbrehaut: do you know what the bounds of a transaction are?
22:14brehautjeremyheiler: well, the body of a transaction is wrapped in a thunk fn and passed to LockingTransaction.runInTransaction
22:14brehautso i presume that the thunk defines the bounds
22:14brehaut(unless it happens to be within an existing transaction)
22:15jeremyheilerthunk?
22:15brehautfunction of zero arguments
22:15brehaut(fn [] :foo)
22:15jeremyheilerah ok
22:16brehautclojure's transactions have a very simple nesting model: if you are in a transaction already, just run the thunk with that, otherwise, create a new transaction. If any of the transactions fail for some reason, then it rolls back the entire thing
22:17brehautthe details however, are a little more involved ;)
22:19jeremyheilerYeah, i'm fully aware of the complexity of concurrency :-P but that sounds like the transactions work like java reentranlocks
22:19brehautlast time i really looked at java's concurrency primatives was 2003 ;)
22:20jeremyheilernice, i did some stuff a couple years ago with jsr166 before it was released into java 7, but i haven't done much since :-P
22:20brehautjeremyheiler: a lot of the magic is actually in tracking what refs have been touched
22:21brehautpart of what appealed to me about clojure was that id done threaded stuff in python and it hurt a lot
22:21brehauteven with blocking queues
22:24jeremyheileryeah, i know what you mean. there are some interesting and cool agorithms, like non-blocking queues that leave messes, but the next guy to come through knows how to clean it up. i got a chance to learn form doug lea himself, and it's crazy all the little tiny details that need to be taken care of in order to implement something seemingly simple.
22:25jeremyheilerbecause of that, is why I started to learn clojure
22:26jeremyheilerwith clojure, you can still learn the nitty gritty details, but not have to worry about it if you don't want :-P
22:26adam_i concur, the transaction system is why i'm learning clojure now
22:26brehautironically, most of the code ive written with clojure hasnt used the concurrency features :P
22:26brehaut(at least, not explicitly)
22:26adam_yeah, Purely Functional Data Structures by Okasaki has a lot to teach you about data struts
22:27jeremyheilerbrehaut: i know what you mean, it's been the same here, but it's ok because I plan on getting into it more as clojure takes over my projects.
22:28jeremyheileradadm_: I read his "follow" up article to that book a few weeks ago. good stuff.
22:28jeremyheileradam_: **
22:29jeremyheilerbut, i'll have to put the actual book at the end of my very long book queue
22:29adam_it does a pretty good job explaining how lazy evaulation
22:29adam_yeah, i got it with some christmas money, i've only read the first couple chapter, its been time well spent
22:29adam_the only downside is that it's written in ML and Haskell, so understanding those languages is a must
22:30brehautthats not a downside :P
22:30jeremyheileradam_: nice that's good to hear.
22:30brehautits an opportunity
22:30jeremyheileradam_: any excuse to learn haskell is probably a good one :-P
22:30jeremyheileradam_: because we all know nothing useful can be done with it (jk jk)
22:30philis it considered cleaner style to work with defprocols/records or with just maps of functions when polymorphism isnt needed?
22:30adam_yeah, i went thought Learn You a Haskell for Great Good
22:30adam_its free online
22:31adam_the problem with Haskell is everything is so damn hard to do
22:31RaynesMeh.
22:31RaynesNot really.
22:31RaynesEverything is hard to do until you know the language
22:31adiabaticFor someone who's already fluent in functional style, how different are, say, Clojure, ML, and Haskell? I know the latter two are statically, strongly typed, but how big of a deal is that?
22:31RaynesYou have to understand that everything is input to something.
22:31adam_yeah, and get your phD in functional languages
22:32jeremyheilermeh, it's good to learn to think abstractly anyway. syntax should be moot
22:32jeremyheiler(well, for any reasonable language)
22:32brehautadiabatic: it depends what you are building. if you are just building websites, haskell is going to hurt a lot more than clojure
22:32TimMcphil: Work with maps. You can still get polymorphism with multimethods dispatching on some key in the map.
22:32Raynesadam_: Those are mostly tired jokes.
22:32adiabaticbrehaut: Why?
22:32Raynesadam_: I started learning Haskell at 13-14. I managed better in it than any other language I used at the time.
22:33RaynesI don't buy into the "it's so hard mathy and academic" stuff.
22:33brehautadiabatic: because websites are programs that take some semi-structured goop from DBs, Forms, Ajax briefly mashing them around and push them out as differently semi-structured goop
22:33RaynesNo, it isn't what you're used to. But neither was programming in the first place when you started.
22:33adiabaticRaynes: You're probably very good at hard, mathy things :)
22:33philTimMc: thx
22:33brehautif you have to satisfy a typechecker you have a bunch more work that has very little reward
22:33RaynesYou get more done by doing and much less done by worrying about how hard something might be.
22:34philbradwright: why? you still have to get the "types" right in a dynamic langugage and haskells type checker doesnt get in your way
22:34Raynesadiabatic: Absolutely. I'm a child genius. Chip off of the ol' block. I've had papers written about me, I have.
22:35brehautphil: i presume you misaddressed that?
22:35philbrehaut: yes, sorry
22:36brehautphil: im entirely aware how nice haskells type checker is
22:37philbrehaut: what i mean is that when the type checker complains about something thant its likely a bug (more often than not)
22:37brehautphil: on the other hand, the points where data comes into a web app typically already do the transformations to correct types for you
22:38adam_Raynes, haskell is a really beautiful langauage, but for what I'm trying to accomplish clojure is much better
22:39philRaynes: i think the language itself is not that hard, but one has to rather adjust to the constructs around it, like if you want state you need the state monad and you need to know what monads, applicative functors etc etc are in the first place
22:39Raynesadam_: I'm not trying to argue Haskell vs Clojure.
22:39brehautphil: thats incorrect
22:39philRaynes: in a tradition language you just say a = 4, done
22:39brehautthe state monad is just one approach
22:39RaynesI'm trying to make you look stupid for saying things like "[21:34:31] <adam_> yeah, and get your phD in functional languages"
22:39philbrehaut: i was oversymplyfing
22:39brehautio, ST, STM monads all provide very simple approaches to state
22:39philbrehaut: but you need *some* monad in any case
22:40brehautphil: so?
22:40brehautits only hard if you want it to be
22:40Raynesphil: You just described functional programming.
22:40brehautif you just use IO
22:40adam_yeah, Rich's article on state in clojure is what really got me into it
22:40brehautthen you are writing slightly quirky C code
22:40Raynes$he let x = 1 in x + 1
22:40lazybot⇒ 2
22:40RaynesDone.
22:40brehautRaynes: OMG head asplode. warn me next time and i'll get my PhD ready!
22:41Raynes:)
22:41jeremyheileri always thought haskell's syntax was driven by being somewhat notational.
22:41jeremyheilerand not something so terse it's hard to understand ( although it could get crazy)
22:42RaynesThey have a Perlish fetish of symbols.
22:42brehautjeremyheiler: i think the trickiest thing is grasping how pervasive partial application is
22:42brehautand how operator binding interacts with parenless application
22:42jeremyheilerbrehaut: yeah, i think i'll agree with you on that point
22:42philRaynes: come on... but what happens if you want to manage a widget hiearchy for example? to add a subwidget to a widget you have to first know the path to that widget or use some other construct like a zipper, than replace it, then update some state monad holding the widget hierarchy you have to pass in to the add-subwidget function etc etc etc
22:42philas opposed to just addWidget(widget);
22:43brehautjeremyheiler: i think the hardest thing about typical stateM tutorials is that they brush over that they are using a partially applied type constructor ;)
22:43Raynesphil: Learning to program.
22:44philRaynes: so if you dont use a state monad + tree zipper for managing a widget hierarchy you cant program?
22:44brehautwait. not type constructor, field accessor
22:44RaynesNo, not what I'm saying.
22:44TimMcbrehaut: I got a taste of the partials stuff when I dabbled in OCaml.
22:44brehautTimMc: its pretty addictive eh
22:44TimMcHard to read when you're just coming from a sexp language.
22:45TimMcI had trouble with it, but mostly for visual/syntactic reasons.
22:45RaynesWhen you learn to program, both of those sets of concepts are equally unapproachable. Once you've learned to program in x way, y starts to look insane because you know how to do the same thing in the x way.
22:45brehautphil: why do you keep insisting that state monad is hard to use?
22:46philRaynes: but would you say that approach A may be better suited to some problems while approach B to others, or is one approach always better?
22:46brehautphil: learning how the machinary works can be difficult, but then, its no different than learning how the interpreter for an imperative language works
22:46RaynesMy approach in life has been to learn things as I go. When I need something that I don't understand, I just learn it. I don't waste time comparing it to other things.
22:46RaynesSure.
22:46philbrehaut: im not saying it is "hard" to use, its just a lot of extra work for something very simple in an imperative mutable langugae
22:46RaynesI'll reiterate that I am not arguing Clojure vs Haskell.
22:47RaynesI'm arguing that it is only hard if you compare it to what you already know.
22:47RaynesWhen I first drove a stick, I was terrified and frustrated because it was so easy to drive an automatic.
22:48RaynesAre manual transmissions worse than automatic transmissions because I learned on an automatic?
22:48philRaynes: im not arguing a > b either, im also constantly questioning things... just at the moment i cant say im convinced pure fn programming is the answer to everything
22:48RaynesI can't say I am either.
22:48RaynesOn that we agree.
22:49adam_Raynes, we're just trying to compare languages, and you're making arguments for argument sake
22:50RaynesActually, I've pointed out at least twice that I am not comparing languages and phil still responded to me, indicating to me that he wasn't just comparing languages. *shrug*
22:50RaynesI thought it was a worthwhile discussion. But you're the one who brought it up. :)
22:51RaynesI'd use that monad.
22:51TimMcYou just did, without knowing it!
22:51RaynesBang!
22:51adam_that should be the first monad you learn
22:51phili just wanna hear other points of view, doesnt matter if they are "a > b" or "a != b", they open up new perspectives to think about things
22:52phil:D
22:52philhow would one define >>= on that monad :/
22:55brehautTimMc: jsut as long as you implement an instance of MonadPlus so we can fail in style
22:56adam_is anyone here using monads in their clojure program? and if so, what for?
22:56brehautadam_: i use them for error handling, nondeterminism, and parsing
22:56TimMcadam_: They're just not called monads.
22:57adam_what would you call them then?
22:57RaynesI call them code.
22:57TimMcs I understand it, there are a bunch of common functional programming design patterns that Haskellers instantly recognize as monads. :-)
22:58brehaut(variations of maybe-m, seq-m, seq-m and for, parser-m (aka state-t seq-m))
22:58TimMcI assume brehaut uses formalized versions of them.
22:58adam_yeah, i mean the clojure.contrib.monads library
22:58brehautclojure.algo.monads
22:58TimMcAh, well that's the extent of my knowledge on monads,
22:58brehautTimMc: yes
22:59scottjadam_: the monads library is not used very much in open source clojure code.
22:59brehautTimMc: (i use the formal ones as well as the informal ideas)
22:59TimMcand goddamnit why does the comma have to be next to the period.
22:59brehautTimMc: to increase mistakes
23:00seancorf`i'm looking forward to the next "Monads Made Easy" talk at a Clojure conference ;)
23:00jeremyheilerbrehaut: maybe to minimize more serious errors.
23:00adam_i'll have to go then!
23:00adam_i just started a monad tutorial in clojure
23:00brehautseancorf`: lol
23:01brehautadam_: following or writing?
23:01adam_note taking
23:01philbrehaut: i read about cdelim this morgning
23:01adam_i learn best by taking copious amounts of notes
23:01phildunno what id use it for but ill think of something for sure :D
23:01adam_so i guess following would be the category
23:03brehautadam_: i found doing the reductions by hand made each individual monad make more sense
23:04brehaut(especially complicated ones like state-m)
23:05adam_nice, i'm actually working through state-m right now
23:51clj_newbis the following correct? clojure is so amazingly smart, it forces me to use agents ... then automatically, behind my back, executeds functions went to agents, and watchers sent on agents, in separate threads -- and it can do so safely due to clojure's concurrency constructs?