#clojure logs

2012-05-01

00:00LuminousMonkeyEditors tend to be a religious choice as well.
00:00ibdknoxyep
00:00wmealingi want the good tools, not a religious choice.
00:00wmealingi'm sure i'm not the only one
00:01muhooreligions tend to arise out of ignorance and limited technology.
00:01LuminousMonkeywmealing: Clojure is the reason I went to Emacs, SLIME.
00:01wmealingLuminousMonkey, me too.. vim did everything i needed till clojure
00:02wmealingand it wasn't a "religion" for me, just the first thing i knew
00:02wmealingchange when i need to
00:02ibdknoxvim does fine for Clojure for me
00:02wmealingi had issues with nailgun
00:02wmealingie, not being able to find the server
00:02ibdknoxhuh, never had any issues there
00:03wmealingthe authors link on his webpage simply doesn't exist
00:03LuminousMonkeyI had a problem running nailgun under Solaris, had to submit a patch.
00:03muhooibdknox: anyway, sorry for bothering you with iwbyp. i hadn't seen latest lighttable status, looks like you're going to be very busy, very soon. good luck!
00:04LuminousMonkeyBut, at the end of the day, it was just my own personal feeling of programming Clojure in Emacs vs Vim.
00:04ibdknoxmuhoo: already am, haha. Thanks :)
00:04wmealingtbh, editor doesn't really matter with midje lazytest
00:04LuminousMonkeyAnd that's what's important, I guess that's why no matter what editor you use, as long as you can make it how you want it to be, that's the important thing.
00:04wmealingspend most of my time thinking, not coding.
00:05ibdknoxyeah far more of my time is spent not at the keyboard
00:05LuminousMonkeyDefinitely true.
00:06LuminousMonkeyAnd having a REPL to get quick feedback is useful. :)
00:33creeseI have java function that returns an enum but when I print the result I get some stuff enclosed in brackets ('< >') and a hash ('#") out front.
00:33creeseIs there an easy way to get rid of those?
00:41kovasbcreese: that is how the clojure repl prints java objects
00:41kovasbcreese: so if you want to get rid of those, you need to convert it into a pure clojure datastructure
00:41kovasbcreese: try calling seq on it?
00:42creeseit's a string
00:43kovasbon the original enum
00:43creeseI guess the enum isn't a string
00:43creeseit says "don't know how to create"
00:44kovasbok
00:44kovasbi guess that isn't one of the collections that has seq implemented on it
00:44creesebut str works
00:44creesethanks
00:44kovasbi'd look at the clojure api docs, maybe there is something to convert it
00:45kovasbotherwise you need to look up the keys yourself
00:45kovasband turn it into a map or something
00:45creesestr works
00:45kovasbcool
00:45kovasbi wonder how it does it :)
00:52muhoo&(seq "foobar")
00:52lazybot⇒ (\f \o \o \b \a \r)
00:52muhoo&(str (seq "foobar"))
00:52lazybot⇒ "(\\f \\o \\o \\b \\a \\r)"
00:52muhooack
00:52muhoo&(apply str (seq "foobar"))
00:52lazybot⇒ "foobar"
00:56muhoo&(apply str (map #(char (+ 1 (int %))) (seq "foobar")))
00:56lazybot⇒ "gppcbs"
00:56wkmanirehowdy folks.
00:57muhooevenin
00:57kovasbwhat up
00:57wkmanireOh not too much.
00:57wkmanireJust trying to reinvent the wheel again. again.
00:57wkmanire:/
00:57kovasbme too
00:58kovasbwhich one?
00:58muhoothe round one? cool!
00:58kovasblol
00:58wkmanireI have to build a dynamic flyout menu in javascript.
00:58wkmanireWith lots of great requirements.
00:58kovasbnice, custom menus
00:58creesewhat do the backslashes in (\f \o \o) mean?
00:59muhoocreese: chars
00:59wkmanirecreese: Character literals.
00:59wmealingits a char
00:59creeseso like a string but without \n
00:59muhoo&(map #(class %) (seq "foobar"))
00:59lazybot⇒ (java.lang.Character java.lang.Character java.lang.Character java.lang.Character java.lang.Character java.lang.Character)
00:59muhoothis is weird, i feel more comfortable answering questions in clojure code than in english
01:00wkmaniremuhoo: English is overrated.
01:00muhoo&true
01:00lazybot⇒ true
01:03muhoo&("wkmanire is right" true)
01:03lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
01:03muhoo&(do "wkmanire is right" true)
01:03lazybot⇒ true
01:03muhoosee, lazybot agrees with you :-)
01:28creesehow do I interrupt the repl without killing it?
01:30_tcacreese: I don't know what you mean by interrupt, but I'd guess you want "Ctrl-z"
01:30creeseI had a runaway process like (while true)
01:31ivancreese: (clojure.repl/set-break-handler!)
01:31creesearight
01:32wkmanireweird.
01:32wkmanireI think someone just tried to PM me but erc bugged out.
01:33wkmanire&(make ('sammich))
01:33lazybotjava.lang.RuntimeException: Unable to resolve symbol: make in this context
01:33wkmanireDon't think he's gonna do it.
01:35muhoosudo?
01:39wkmanireVeeeird
01:39wkmanireERC pretended that I had received a PM then died a horrible death.
01:42wkmanireTired programmer is hungry.
02:20zanesIs parsley the parsing library du jour, or is there something better?
02:27creesecan you create a hash where you only store keys?
02:28amalloyyou mean...a set?
02:28creeseis the lookup as fast as a hash?
02:35ivancreese: yes
02:35creeseok
02:42kovasbanyone willing to test this web repl i just made?
02:43Rayneskovasb: No way dude, what if it haz viruz!!?!?!1!!1!
02:43kovasbit is very viral. it contains the clojure har
02:43kovasbjar
02:44kovasbshit is spreading everywhere
02:45kovasbhttps://github.com/kovasb/session
02:45kovasbi wouldn't recommend looking at the source unless u want ur eyes to blee
02:45kovasbd
02:45kovasbI'm just curious if this works at all
02:45kovasbthough i suppose i can try more rigorous testing myself :)
02:46Rayneskovasb: Please don't put closing parens on their own lines.
02:46RaynesKittens die when you do that.
02:46kovasblol
02:47kovasbi told u not to look at the source ;)
02:47LuminousMonkeyI like to punch kittens in the face.
02:47LuminousMonkeyThat's like telling someone on a ledge not to look down...
02:47kovasbalright, looks like it definitely doest work in safari..
02:47RaynesTwo kittens die at once when you find it difficult to type out all three letters of 'you'.
02:47kovasbwtf
02:47RaynesNothing works in Safari except for apple.com.
02:48RaynesThat's how they corner the market.
02:49creeseCan someone tell me what's wrong with this?
02:49creesehttps://refheap.com/paste/2484
02:50kovasbcreese: false is not a function
02:51kovasbbut you are invoking it as a function
02:51creesehow do I return false then?
02:51RaynesJust... 'false'
02:51kovasbunwrap it from its parens
02:51creesebut it's in a do
02:51RaynesIt doesn't matter.
02:51creeseoh
02:51RaynesThe last thing in a do is returned.
02:51kovasbdo evaluates each of its arguments in order
02:51Raynescreese: Also, is @mem a map?
02:51creeseset
02:52creese(def mem (atom #{}))
02:52Raynes(if (@mem letter) ..)
02:52Raynescontains? is unnecessary here, since sets are functions that do the same thing (for all intents and purposes in this case).
02:53Raynes&(#{:foo :bar :baz} :bar)
02:53lazybot⇒ :bar
02:53Raynes&(if (#{:foo :bar :baz} :bar) "yea" "nea")
02:53lazybot⇒ "yea"
02:53Raynes&(if (#{:foo :bar :baz} :quux) "yea" "nea")
02:53lazybot⇒ "nea"
02:54RaynesNot that you're hurting anything by using contains?. Just not doing it saves a bit of space. :)
02:54Chousukecode golf: (or (@mem letter) (swap! mem conj letter)) :p
02:54Chousukethe if form may be clearer though
02:54creesegot it
02:54Chousukeand hm, I guess you'd need a not around the swap
02:55creesenot around the swap?
02:55Chousukein my example
02:55creeseoh
02:55Chousukejust to negate the return value of swap!
02:55creesewould I need contains? if it was a hash?
02:56RaynesNope.
02:56Chousukeyou'd need contains? for java sets
02:56RaynesOr if you really needed the exact true/false values for some reason.
02:57Chousukewell you could have a map containing :key false.
02:57Chousukein that case you'd need contains? to check whether :key is there
02:58creeseheh
02:58creesemy keys are all going to be letters
03:06RaynesSure, you say that now. Eventually numbers are going to start looking real nice and you're not going to be able to maintain your composure.
03:08wmealingwhy did i read that in a pirate voice.
03:10LuminousMonkeySure purty numbers.
03:10LuminousMonkeyReally purty.
03:25zblut_Hello I have a simple question
03:25zblut_regarding addition
03:27zblut_OK never mind sorry
03:27LuminousMonkeyI like those kinds of questions, I'm good at those.
03:28AimHereSimplest. Question. Ever.
03:34Raynes"Excuse me, I have a problem. One moment while I fix it myself, please."
03:34LuminousMonkeyDo we get credit for the answer?
03:34LuminousMonkeyI need that warm fuzzy feeling.
05:46angermanwhy would clojure (via lein run) print "????" instead of "äöüß"?
05:50raekangerman: are you running this on Mac OS X?
05:50angermanyes
05:50angermanreak I can type those characters into the terminal though.
05:50raekthe "default encoding" is broken in the java distributed with mac os x
05:51angermanreak how to rectify?
05:51raekI think you can set an environment variable
05:51raekwait a minute
05:51angermanok.
05:52raekthe java option is -Dfile.encoding=UTF-8
05:52angermanok. that way I can run the jar. but how can I tell leinignen?
05:53raekI think you can set it via the JAVA_OPTS environment variable
05:53angermani did try the :jvm-opts
05:53angermanbut that didn't work.
05:53angermanok. let's see
05:54raekcould perhaps be related to this: https://github.com/technomancy/leiningen/issues/326
05:55raekangerman: which version of lein do you use?
05:55angermanLeiningen 1.7.1 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM
05:56raekah, sorry. it should be JVM_OPTS
05:56angermanhmm. no JAVA_OPTS seems right.
05:56clojurebotExcuse me?
05:56raekhm, ok.
05:56angermanit's working now.
05:57raekangerman: you should set this option globally on your system (I don't have a mac, so I don't know how to do that)
05:57TEttinger,(str :hello :bruce)
05:57clojurebot":hello:bruce"
05:57angermanreak: that's what I'm trying. JAVA_OPTS is what lein picks up. java -jar seems not to.
06:00goodieboycould someone explain to me how the Clojure delay class works?
06:00goodieboyChecking out the source here, there's not much: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Delay.java
06:01goodieboyIf I do a google search for clojure.lang.IDeref there's even less code to look at
06:02raekgoodieboy: if 'fn' is non-null and 'val' is null, then the delayed computation has not been forced yet and the function to compute the value is in 'fn'
06:03raekgoodieboy: if 'fn' is null, then he value has been forced and is stored in val
06:03goodieboyraek: OK makes sense so far
06:03goodieboyraek: How does it "block" other threads while the computation is running for the first time?
06:03raekgoodieboy: the "synchronized" keyword takes care of that
06:04goodieboyraek: ahh!
06:04goodieboyexcellent, so simple. i get it now.
06:04goodieboythanks for pointing that out
06:04laurusWhat are the numeric types for Clojurescript based on? JavaScript ones?
06:06brucewhat IDE do most people use - I am new to clojure
06:06TEttingerbruce: as far as I know, emacs is very popular, but most of them are fairly good
06:07bruceAnybody use eclipse? I am mixing Java a lot and like the debugger
06:07TEttingerbruce: http://timpner.com/computing/clojure-importing-a-leiningen-project-into-eclipse/ is useful for eclipse integration with leiningen. leiningen is a work of art; a project manager that auto-handles dependencies
06:08TEttinger(also, you use clojure instead of XML)
06:08bruceeverybody tells me it is sweet :-)
06:08TEttingerthe important thing with that example is to make the leiningen project first. you will rely on your project.clj primarily, and only use the eclipse .project file locally
06:10TEttingerby changing the dependencies in project.clj, you can update with `lein deps`
06:10TEttingerlein also has the wonderful `lein uberjar` for distribution, which is an uncommon feature that bundles everything in one jar -- no dependencies scattered around or in necessary adjacent folders
06:11TEttingerlein can be found at https://github.com/technomancy/leiningen/
06:12TEttingeryou probably don't want lein 2.0 yet, I know of a few libs that aren't updated yet
06:12wmealinguncommon feature, i thought it was _the_ feature for leiningen
06:12wmealingit is awesome
06:13TEttingerwmealing, yeah, that's what I mean. it is rare in the JVM ecosystem
06:13TEttingerbut easy to use in leiningen
06:14TEttingeruberjar is great
06:15angermanhow do I use clojure 1.4 date parsing function?
06:15angermanraek: thanks. it does work nicely now :)
06:16angermanso I have a date that looks like: 2012-04-30T19:18:00-07:00
06:16angermanand I want to get a DateTime Object from it.
06:16bradwrightThat's ISO8601 format
06:17bradwrightNo idea what the latest good way of parsing that is though, sorry
06:17angermanI thought clojure 1.4 was able to deal with those natively, no?
06:19progowell, 'natively' (just a reader macro that expands to code as native as the old way). Try #inst
06:20TEttingerhttp://snipplr.com/view/62060/ ?
06:24raekangerman: joda-time (or the clj-time wrapper) is THE library you should use for date handling
06:25angermanhmm. alright. I just though stuff like this would get magically easier with clojure 1.4
06:25raektwo iterations of date handling libraries are included in the java standard library, but both have serious defects
06:26raekI think the difference is that you can write #datetime "2012-04-30T19:18:00-07:00" instead of (DateTime/parse "2012-04-30T19:18:00-07:00"), or something like that
06:26raekwhich can be useful for serialization
06:26raeksince the conversion to a DateTime is done at read-time
06:27angermanwell, now It's with Joda Time :)
06:28raekyeah, the design of joda time fits very well with clojure
06:28raekimmutable values, etc
06:29raekit also treats instants differently from datetimes, which I like
06:52goodieboyis it considered bad practice to call code other than def and defn in a namespace, for example... *executing* functions that change the state of vars in that namespace?
06:58raekgoodieboy: there are some legitimate uses. multimethods and derive, for example, mutate global things
06:59raekyou should consider what happens if you run "lein uberjar" and have AOT compilation activated for that ns
07:00raeka bad thing would be to start a web server and block indefinitely
07:00raekbut executing alter-var-root to register a plugin, or something like that, would be perfectly fine, IMHO
07:09goodieboyraek: ok thanks!
07:35casperchello
07:37caspercIs there any way to sort a map by more than one than one key with each key having it's own function to compare by?
07:39caspercit seems easy when the values are numeric, but how do I do it if they are not numeric and needs a custom sorting?
07:41sattvikcasperc: Well, a map can only have one key for each value, but it can be anything you want.
07:41sattvikYou can set the method to sort the map by building it using (sorted-map-by)
07:41caspercsattvik: sorry, i meant a list of maps :)
07:42sattvikAh, well then you can use sort-by, and provide a comparator.
07:43casperclike this [{:foo "x" :baa "a"} {:foo "y" :bar "b"}], where foo and bar has their own function to sort by (where foo is primary and bar is secondary to sort by)
07:43sattvikAn easy way to create a comparator is to use the comparator function and pass it a function that will do the comparison
07:44caspercsattvik: ah, didn't know that one. That is probably what i need, thanks :)
07:45sattvikNo problem.
08:09raekcasperc: juxt is very useful here: ##(sort-by (juxt :foo :bar) [{:foo "x" :baa "a"} {:foo "y" :bar "b"}])
08:09lazybot⇒ ({:foo "x", :baa "a"} {:foo "y", :bar "b"})
08:09raekyou can of course replace :foo and :bar with other functions
08:14caspercraek: cool, this just extracts the right keys to sort by though, right? How do I then write the comparator for each key?
08:16raekcasperc: first, sort-by takes a "key-fn", i.e. a function that takes a value and produces another value used for comparison. this is a little bit different than a comparator function, which takes to values and returns an integer
08:16raekyou can sort using a comparator too
08:17raekto make a key-fn for foo that sorts by the string reversed, do something like this
08:17raek(juxt (comp reverse :foo) :bar)
08:18raek(comp reverse :foo) extracts the :foo value from the map and then reverses it (assuming it's a string)
08:18raekjuxt will evaluate some functions "in parallel" with the same arguments, and then make a vector of the results
08:19raekand vectors compare the way you want here, i.e. lexicographically
08:19raek&(< [1 1 0] [1 2 0])
08:19lazybotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number
08:19raek&(compare [1 1 0] [1 2 0])
08:19lazybot⇒ -1
08:23caspercraek: sry, didn't see your messages. Let me just show the solution i arrived at. It works but is not idiomatic probably
08:23casperci have a vector of maps which i need sorted according to two predified orders:
08:23casperc(def handling-order ["OPRET", "SKIFT", "OPSIG", "ANNULLER", "GENAABEN", "PROVISIONER", "FLYT", "OVERDRAG", "SKIFT_MODEMAKTIVERINGSKODE", "SKIFT_ANUMMER", "FORTRYD_SKIFT_ANUMMER"])
08:23casperc(def fo-ordering ["clear" "dtv" "bb" "mobb" "tlf"])
08:24caspercthen i wrote a comparator: (defn handling-comparator [x y] (let [x-handling [(.indexOf handling-order (:handling x)) (.indexOf fo-ordering (:fo x))] y-handling [(.indexOf handling-order (:handling y)) (.indexOf fo-ordering (:fo y))]] (compare x-handling y-handling)))
08:24caspercthen i can sort like this: (sort handling-comparator [{:handling "SKIFT" :fo "clear"} {:handling "OPRET" :fo "dtv"} {:handling "ANNULLER" :fo "tlf"}])
08:27raekI would do something like (def handling-order (zipmap ["OPRET" ...] (range))) (def fo-ordering (zipmap ["clear" ...] (range)))
08:27raekthose vars will then contain maps from strings to integers
08:27raekand handling-order can be used as a key-fn
08:28raek(sort-by (juxt handling-order fo-ordering) [...])
08:29raekcasperc: I usually find it easier to work with key-fns instead of comparators
08:29raekthey are easier to compose
08:29caspercraek: yeah, I agree my solution is not very composable :)
08:30caspercI'll just give yours a spin
08:30raeksorry, the last example is incorrect. it should be: (sort-by (juxt (comp handling-order :handling) (comp fo-ordering :fo)) [...])
08:31raekand it's probably wise to split out that key-fn into its own def
08:31madsyWhat's considered best in general? A lot of repeated expressions, or a big let form?
08:32raekcode duplication should be avoided
08:32raekcasperc: what language is this? Danish?
08:32caspercyeah :)
08:33achinThis is weird. When I run "lein ring war" now, lein throws an NPE in leiningen.core.main. I'm having trouble debugging this. Any ideas?
08:33madsyraek: Yeah, I agree. It's just that all my books emphasize to avoid state. I guess let is okay.
08:33raekmadsy: what does let has to do with state?
08:34madsyraek: Even though the data is immutable, you do store it somewhere as opposed to using functions only.
08:36raekI wouldn't consider assign-once variables to be mutation
08:37raekmadsy: then function parameters would be bad for the same reason
08:38achinAh. Looks like updating to 0.6.6 fixes things.
08:38raekmadsy: if clojure books say that you should avoid state in calculations, they probably mean that you shouldn't use things like atoms or refs
08:40madsyyep
08:46solussd_does clojurescript's 'ns' support :use now?
09:18jroesso I heard all the cool kids are using clojure
09:18jroesthought I would join in
09:23devnjroes: welcome!
09:24fdaoudjroes: indeed clojure is very cool, hope you like it too.
09:25jroesthanks for the welcome :)
09:25jroesanything neat you guys are working on?
09:26michaelr525hey
09:27fdaoudjroes: I'm using it to run a hockey playoff pool at http://www.fdaoud.com/hockey
09:31jroesfdaoud: cool. Jimbo is killing it!
09:32fdaoudjroes: indeed, and he finished 1st and 2nd in the last two years, too
09:32jroesnot bad
09:32fdaoudjroes: in case you're interested: http://oreillynet.com/pub/e/2273
09:33jroeshey, that's pretty cool! I think I might check that out
09:33fdaoudyeah, I'm looking forward to it. cemerick is a cool cookie.
09:34fdaoudjroes: at the bottom of the pool, Nadia, that's my wife :) She got every single team wrong in the first round, which is just as "difficult" as getting them all right, when you think about it..
09:34jroeshahahaha, that's awesome
09:34jroesshe must be picking all dogs
09:35fdaoudwell, there were some surprises and some non-surprises.. she really got unlucky
09:35caspercraek: sry, just had to leave for a while. Thanks for the help, i'll go with your solution now that I had time to understand it a bit better :)
09:36jcromartiethis is weird… when I have an org.mozilla.javascript.NativeArray object, Clojure throws lots of "No matching field found" errors when I try to call methods
09:36jcromartiethis class http://www.docjar.org/docs/api/org/mozilla/javascript/NativeArray.html
09:36jcromartiebut (.get a 0) says "No matching method found: get for class org.mozilla.javascript.NativeArray"
09:36jcromartiethat's obviously a real method
09:36michaelr525anyone knows how to pprint into a string instead of stdout?
09:36jcromartiebut Clojure doesn't think so
09:38joegallomichaelr525: well, print-str takes whatever you print, and turns it into a string. and pprint prints things prettily...
09:38joegalloso, you could (print-str (pprint whatevs))
09:38joegallo,(print-str (clojure.pprint/pprint "whatevs"))
09:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.pprint>
09:39joegallolies!
09:40michaelr525'(user 'clojure.pprint)
09:40michaelr525'(use 'clojure.pprint)
09:40joegalloitym (use 'clojure.pprint), but i dunno if that works here with the bots.
09:40joegallo,(use 'clojure.pprint)
09:40clojurebotnil
09:41joegallo,(print-str (clojure.pprint/pprint "whatevs"))
09:41clojurebot"whatevs"
09:41clojurebot"nil"
09:41joegalloso it does.
09:41fdaoudjoegallo: score!
09:41Bronsamichaelr525: use with-out-str
09:41joegalloheh, yeah, good call Bronsa.
09:41Bronsa,(with-out-str (print "derp"))
09:41clojurebot"derp"
09:41Bronsajoegallo: :)
09:41joegallohaven't had any coffee yet today.
09:41fdaoudI'm surprised that worked, I thought the bot would have sent you packing joegallo
09:41Bronsahah, another coffee addicted
09:42michaelr525thanks with-out-str works great :)
09:46achinDoes lein support subprojects or modules or something similar?
09:48fdaoudBronsa: mmmm coffeeee
09:50xeqiachin: look at checkouts
09:50achinxeqi: Thanks.
10:03michaelr525what would be a good way to retrieve an element at a specified path from clojure/xml structure?
10:03michaelr525something like xpath for clojure i guess
10:04ambrosebsdoes anyone have a Clojure project that could especially benefit from static typing?
10:04devnmichaelr525: i wrote something really simple that frankly isn't very good
10:04ambrosebslooking for examples
10:05devnambrosebs: i dont personally, but my guess is the list would provide a number of answers
10:05jsabeaudryHow can I go a document.getElementById in clojurescript? (I tried (js/getElementById js/document "myid") and (js/document.getElementById "myid")
10:05halgariambrosebs: I would suggest looking at graphics processing...there's dozens of simple algorithms that work with 2d bitmaps
10:06halgariambrosebs: most of these algorithms will perform horribly if done with boxing, but run quite well when used with static typing.
10:07devnmichaelr525: https://github.com/devn/yokogiri
10:07devnit's really...really nothing fancy, but it works
10:09jsabeaudryAh, (.getElementById js/document "myid") of course!
10:10ambrosebshalgari: so using static typing to prove that certain code doesn't get boxed? I hadn't really considered that
10:10ambrosebsdoes the compiler help you write such code atm?
10:12halgariambrosebs: currently the compiler should generate optimal code if you throw the right tags at it.
10:12halgari What might be interesting though is that there are two ways to refer to colors. if you use bytes for each pixel then then each element will be 0-255 if you use floats then it's 0-1
10:13fliebelambrosebs: Is typed clojure typed in the sense that java is typed, or just to prove things about your fns?
10:13halgariso static typing might be able to help there, you wouldn't be able to throw the wrong pixel info at the wrong algorithm until the type is converted
10:13ambrosebsoh right, I'm not looking to affect compilation
10:14ambrosebsno it's basically a static type checking phase performed a la carte
10:15ambrosebsthe plan is to build something as a separate phase, then consider how it might fit in with compilation
10:15fliebelambrosebs: That is, it's for security, not for speed?
10:16Chousukecorrectness, rather, I guess.
10:16ambrosebsfliebel: Basically yes. you could possibly also avoid some runtime assertions
10:16halgariambrosebs: ah! I see, well them my suggestion isn't as broad as you're looking for then.
10:16Chousukefrom what I can tell, it would be a library for compile time assertions about code. That can be useful for many things
10:16jimdueyambrosebs: Re: Conduit. It could use static type checking because you often end up passing around hash-maps.
10:17jimdueyAnd if you have missing keys, the errors can be tough to track down
10:17jimdueySo I was pretty psyched about your efforts. Looking forward to seeing what comes of them.
10:17ambrosebsjimduey: would it be possible to convert the hash-maps to Records?
10:18jimdueyYep
10:18ambrosebsheterogeneous maps are tougher
10:18ambrosebsI'm expecting a few style rules:
10:18ambrosebsuse records over maps
10:18Chousukeyou could statically check literals at least.
10:18jimdueyYou can actually pass anything you want. Hash maps are just very convenient. Records would be totally doable.
10:19ambrosebsonly use heterogenous maps over short distnaces (destructuring)
10:19ambrosebsChousuke: yes, that's essential for destructuring and keyword args
10:19ambrosebsbut in general, it gets really tough
10:26devasiawhois beepboop
10:38ambrosebsfliebel: two of the main goals are to prevent runtime arity exceptions and to eliminate null pointer exceptions
10:38ambrosebsit will interesting how far I get with the latter goal.
10:39madsyUh.. has anyone experienced leinigen crashing for no apparent reason?
10:40madsyI did a lein search tools.trace and suddenly even starting it with "lein help" crashes.
10:42bhenryping ibdknox
10:43michaelr525devn: it should work with xml documents as well?
10:44bhenrycan i access $this with jayq?
10:46bhenryin a click event
10:46jcromartieso someone help me understand this: IllegalArgumentException No matching method found: get for class org.mozilla.javascript.NativeArray clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:52)
10:46jcromartiefor (.get a 0)
10:47jcromartiea is a NativeArray, and "get" is definitely a method of NativeArray taking an integer as its only argument
10:47jcromartieas indicated by http://www.docjar.org/docs/api/org/mozilla/javascript/NativeArray.html
10:48jcromartieerr, these docs are better http://marianoguerra.com.ar/docs/rhino-1-7R3/org/mozilla/javascript/NativeArray.html
10:48jcromartieit's supposed to implement java.util.List but Clojure doesn't believe it
10:48jcromartiehttp://marianoguerra.com.ar/docs/rhino-1-7R3/org/mozilla/javascript/NativeArray.html#get(int)
10:49jtoyis it ok to do nested lets ?
10:49madsyjtoy: sure
10:50madsyjtoy: But if your function grows so big as to need more than one scope, maybe consider splitting it up.
10:51jcromartieand every time I use a method like .get it yields a reflection warning, too
10:53jcromartiehm, so (.get a 0 a), which is get(int index, Scriptable start), seems to work, but not just get(int index)
10:53raekjcromartie: it looks like the get method takes two parameters (in addition to the instance)
10:53raek(.get array index start)
10:54jcromartieraek: yeah, I just discovered that works, but it's supposed to implement other interfaces
10:54jcromartiei.e. java.util.List
10:54jcromartiebut (isa? a java.util.List) is false… hmm
10:55raekjcromartie: use instance? here
10:55jcromartiehm
10:55raekisa? checks the relationship of two types
10:55jcromartiefalse
10:56jcromartiehowever, the source code clearly says it implements List https://github.com/mozilla/rhino/blob/master/src/org/mozilla/javascript/NativeArray.java
10:56raekin the first javadoc you linked it doesn't implement java.uti.List
10:56raekmaybe that interface was implemented in a later version
10:58jcromartiemaybe
10:59jcromartieit was added 2 years ago in source
10:59madsyHm. So leiningen crashed due to a non-working jar. Doesn't org.clojure/tools.trace 0.7.3 work with Clojure 1.3?
11:02jcromartiedamn yeah, it's the main Maven repos
11:02jcromartiethey only have a release from 2009
11:02jcromartieand nobody has ever added the latest from 2011!
11:02jcromartielazy bastards
11:03jcromartieand the package name changed
11:04jcromartieGoogling "maven rhino" yields this artifact, which is outdated: http://mvnrepository.com/artifact/rhino/js while the new one is here http://mvnrepository.com/artifact/org.mozilla/rhino and doesn't really show up in my Googlings
11:05devnwhat's the old name for the io portion of contrib? duck...
11:07dakronedevn: duck-streams I believe
11:07redingerdefinitely duck-streams
11:08devnah right, thanks
11:14raekdevn: at one point there were two: clojure.contrib.duck-streams and clojure.contrib.io
11:16S11001001duck-streams sounds cooler than io
11:16antares_madsy: see https://github.com/clojure/tools.trace
11:18madsyantares_: I did. It says it should work with Clojure 1.3. No idea what the issue is then.
11:19madsyLeiningen tries to download it from maven, then crashed with a zip archive exception
11:19antares_madsy: can you gist stack trace?
11:20S11001001madsy: rm -rf ~/.m2/repository/org/clojure/tools.trace
11:21madsyS11001001: I already deleted the jar. Redownloading it made no difference.
11:23jtoycan someone help me with this logic : http://pastebin.ca/2142919 I'm not quite sure what I'm doing wrong
11:27joegallojtoy: ((.close (:body resp))
11:27madsyantares_: https://gist.github.com/2568726
11:28joegallothat looks an awful lot like you're invoking the result of a java method as if the result were a clojure function.
11:28joegalloa double opening paren is a rarish thing in clojure, typically.
11:28joegallomight not be the problem at hand, of course.
11:29RaynesYeah, no way that can actually work.
11:29antares_madsy: looks like one of the .jar files is broken (is empty)
11:29madsyyep
11:29jtoyjoegallo: oh, i had a do in there, got lost somehow
11:29antares_madsy: but it happens to be at leiningen.plugin$install$fn__3241.invoke(plugin.clj:63)
11:29antares_madsy: can it be one of your plugins? is this with lein2?
11:30madsyNo, lein 1.7.1
11:30madsyAnd I only have swank-clojure installed, nothing else
11:44madsyantares_: Sorry, I was being an idiot
11:50wkmanireGooooooooooooood mrning.
11:59fmnCan I limit the stack, let's say during unit tests to assert that it won't blow up after refactoring?
12:00wkmanirefmn: You want to set an artificial stack size limit?
12:00fmnYes
12:00wkmanireThat's an interesting idea.
12:00wkmanireSo you can assert that you've achieved tail-call optimization?
12:01fmnPrecisely
12:01wkmanireI have no idea how you would do that.
12:01clojurebotGabh mo leithscéal?
12:01S11001001give it unbounded input and fail if your program ever finishes
12:01S11001001I think there's an algorithm you can use to tell that
12:02TimMchaha
12:05robnikanyone here working with clojurescript? I'm about to port a GWT app and wondering if it works the same way as far as having some .clj files that are compiled to both JVM and JS. ?
12:06robnikIn GWT you have 3 kinds of java code: server, client, shared.
12:06creesehas anyone posted the link to the webcast already?
12:06fdaoudcreese: http://oreillynet.com/pub/e/2273
12:07creeseI'm already signed up. Just wanted to make sure it had been mentioned in the channel.
12:08fdaoudcreese: I mentioned it earlier to someone..
12:08creeseI just ordered his book. Haven't got it yet.
12:08fdaoudI got fed up of delays and got the ebook instead
12:09creesehttp://clojure.org/cheatsheet
12:09creeseby far the best resource I have found yet
12:09fdaoudnice!
12:12ibdknoxbhenry: you use (this-as me ... (css me ..))
12:15bhenryibdknox: is this-as in core?
12:16ibdknoxbhenry: yeah, it's a macro
12:16ibdknoxbhenry: and by core you mean cljs.core, right?
12:16bhenrysweet. yeah
12:16bhenrythanks. i'll give it a shot.
12:18madsyYay, found my bug thanks to tools.trace
12:20bhenryibdknox: thanks again. it's just what i needed.
12:20ibdknoxbhenry: np
12:20jsabeaudryHow to transform 3 in :3 ?
12:21jsabeaudryI cant remember the bot command to ask this
12:21dnolen,(keyword (str 3))
12:21clojurebot:3
12:21jsabeaudrydnolen, thank you good sir
12:22fliebelBut what is the command to ask lazybot to return a function that does what you want?
12:23fliebel$findfn 1 1 2
12:23lazybot[clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int clojure.core/bit-shift-left]
12:23fliebelthat one
12:23mdeboard&(keyword 3)
12:23lazybot⇒ nil
12:23mdeboardhuh
12:23mdeboardwhy is it thus, dnolen
12:23fliebel$doc +'
12:24mdeboardI guess keyword just requires a string type arg
12:24dnolen,(doc keyword)
12:24clojurebot"([name] [ns name]); Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically."
12:24dnolenmdeboard: yes, keyword expects strings.
12:24fliebelwhat is +' ?
12:24dnolenfliebel: autopromoting +
12:25fliebel&(doc +')
12:25lazybot⇒ "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +"
12:25fliebel(doc +")
12:25clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>
12:25mdeboardI appreciate the dearth of type coercion in Clojure.
12:25fliebel(doc +'')
12:25clojurebotTitim gan éirí ort.
12:27fliebeldnolen: To BigInt? Because + already promotes ints to long, right? At least, I thought unsafe-add did *not* do that.
12:28dnolenfliebel: + isn't about promotion.
12:28mdeboardIs there a command for the repl to output the source of a fn?
12:29dnolenmdeboard: there is, but it's easier to just use lein2
12:29fdaoud,(source +)
12:29clojurebotSource not found
12:29fliebeldnolen: What is it about then?
12:30dnolenfliebel: checked arithmetic on 64 bit primitives.
12:32fliebelchecked, promoting... *confused* So... checked math does what when something overflows? I thought it promoted in that case, but maybe it just raises an exception?
12:32dnolenfliebel: exception
12:32fliebelaha
12:33fliebelnot sure why I would want an exception, as opposed to just promoting or overflowing.
12:34dnolenfliebel: this is a 2 year old conversation perf
12:36mdeboarddnolen: Before I tell someone wrong, are you the author of core.logic
12:36fliebeldnolen: ?
12:36dnolenmdeboard: yes, though to be clear it's an implementation of an existing system for Scheme - miniKanren.
12:37dnolenfliebel: performance
12:39ibdknoxwoah
12:39ibdknoxdid you guys see this: http://int3.github.com/doppio/about.html
12:39fdaouddnolen: as in The Reasoned Schemer?
12:39dnolenfdaoud: yes.
12:42ibdknoxno one has something to say about the JVM implemented in CoffeeScript? :p
12:42dnolenibdknox: seemed wacky and not useful?
12:42ibdknoxneat, nonetheless
12:42fdaoudJava 4?
12:42technomancyibdknox: we're all just trying to avoid the yo dawg jokes
12:42ibdknoxtechnomancy: haha
12:42fdaoudthat's so 1999
12:49TimMcfdaoud: nope
12:50TimMcThat would be... Java v1.2, I think?
12:50TimMcI remember because that's when I learned Java. :-)
12:51fdaoudTimMc: whatever :) That's so 2002.
12:57Raynesibdknox: This is me berating you about lein-noir for metajack.
12:57RaynesGo write things and do stuff.
13:00hcumberdaledamn!
13:00hcumberdalecomputer defect
13:05jroeseveryone here checking out this clojure intro webcast? :)
13:07MordusIs anyone using Vaadin from Clojure?
13:07solussd_jayq question: how do I kick off an 'anim' animation when some event happens to some element, e.g. can I bind a function that kicks off an animation? What would that look like? '
13:07creesejroes: yes
13:08creeselooking forward to seeing the tools setup
13:09Raynes~anyone
13:09clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
13:10MordusLooking for opinions on the use of Vaadin from Clojure, and stories based on people's experience with it. Thinking of trying it out for a project.
13:16fliebelMordus: I think the usual Java XML inheritance boilerplate will leak trough, but otherwise it looks nice.
14:11scottj_Mordus: looks cool so long as heavy server resources per user and latency aren't a problem (enterprise apps).
14:27hcumberdaleanyone know what small noiseless computer to buy?
14:27qu1j0t3for what
14:27robertstuttafordhello, are there any clojurescript adepts here?
14:28austinh~anyone
14:28clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
14:29robertstuttafordok. can i have clojurescript generate an externs for all the exported symbols in the source?
14:29robertstuttafordi want to load in a cljs js binary as a module into an existing gclosure codebase
14:30dnolenrobertstuttaford: that would be a nice feature to add to the Closure bit of CLJS. :emit-externs flag or something like that.
14:30robertstuttafordad to do that i need to extern it so that the gcl base knows not to minify the bridging symbols
14:31ibdknoxit's a problem I'll need to solve eventually
14:31robertstuttafordi figure since the exports are metadata, there must be some niftacular way of adding em all up?
14:31robertstuttafordaside: i'm a clojure newb. haven't written a damn thing yet. still reading the new Programming Clojure book.
14:33robertstuttafordvery excited by ClojureScript One, although the module i would like to write is the backend + client-side api for same, which'll probably only use bits and pieces found in One
14:34cemerickWell, that was hell.
14:34robertstuttafordhas anyone produced cljs apps that are broken up in this manner? using symbol exports + externs
14:34scottj_hcumberdale: macbook air
14:35dnolenrobertstuttaford: a simple way would be to regex out goog.exportSymbol(...) after basic compilation.
14:35ibdknoxscottj_: totally not silent
14:35dmi3ycemerick: thanks for the webcast, well done
14:35cemerickSo, if you were in the O'Reilly webcast just now, I apologize for me stuffing the thing.
14:35dnolenrobertstuttaford: a better way would be to augment the compiler - patch welcome.
14:35robertstuttaforddnolen: sure thing. lemme just get 3-6 months of clojure under my belt, first
14:36scottj_ibdknox: oh my bad, I thought Linus had one in large part because it was quiet.
14:37robertstuttafordi asked this on the ggroup as well, but since you're here :-) any plans for the compiler to instrument the interim js with jsdoc annotations? those really help with producing a faster, tighter advanced-mode js binary
14:37samaaroncemerick: you didn't stuff it - it rocked
14:37ibdknoxscottj_: it's got a fan, so if you do anything hefty with it, it'll take flight ;)
14:37dnolenrobertstuttaford: ;) you probably don't need that much time. CLJS compiler is not nearly as scary as it sounds still only ~3000 lines of code.
14:37samaaronalthough i think you threw a couple of people with the ref
14:37JustinCampbell@cemerick figured it out, problem was ab sucks ;)
14:37JustinCampbellsiege worked great
14:37samaaronand your weird pronunciation of leiningen
14:37samaaron:-)
14:37cemerickJustinCampbell: oh, apachebench :-)
14:37cemerickcool
14:37JustinCampbellya
14:38dnolenrobertstuttaford: no one's working on that at the moment.
14:38fdaoudcemerick: nice presentation and I admire your courage of doing it unrehearsed!
14:38cemericksamaaron: gah, it was super when I did my dry run, and then I decided to swap out a couple of things and confused myself all to hell. Bad move.
14:38scottj_hcumberdale: raspberry pi maybe, I don't see a fan on wikipedia. doesn't get much smaller than that.
14:38cemerickfdaoud: I did a dry run, but stupidly changed things for the real deal.
14:38samaaroncemerick: it's all part of the learning process
14:38robertstuttafordi'm so unhappy i was unable to watch that 'cast, cemerick. i'm so totally the target market
14:38robertstuttafordwas it recorded?
14:39samaaroncemerick: you motivated your ref with arguments that also apply to atoms
14:39cemerickrobertstuttaford: should be
14:39fdaoudcemerick: that's ok, I have respect for people who don't pretend like everything always works perfectly.
14:39samaaronstill, i think it was a drop in the ocean
14:39samaaronit was a great presentation overall
14:40scottj_first keynote of railsconf is up, so maybe rich's is close behind.
14:40cemerickwell, lesson #1 is: just copy/paste the code, and focus on the explanation
14:40fdaoudI was just wondering why eclipse was giving you that one red X at the top, throughout
14:40robertstuttafordcemerick: i don't see anything about it on the page. will you tweet about it when you find out?
14:40cemerickrobertstuttaford: certainly
14:41robertstuttafordwicked. btw, LOVING your book. first FP book i can actually read
14:41robertstuttafordkudos. seriously.
14:42qu1j0t3robertstuttaford: which book is this?
14:42robertstuttafordright-hand side of http://cemerick.com/
14:42robertstuttafordhttp://www.clojurebook.com/
14:43qu1j0t3robertstuttaford: which books did you find opaque?
14:43robertstuttafordcemerick: your decision to include the practicums was a wise one. i've plenty web experience with all the languages, bad and good. it's nice to be able to read some theory and then switch over to see that theory in practice in a space i'm comfy with
14:44scottj_cemerick: one thing I like about the pricing of your book on amazon is that it's just enough to get free shipping. it's always annoying when books end up at $24 and you have to either pay $5 shipping or find another item to get over the bump.
14:45cemerickfdaoud: because I had the Clojure builder on while there was an error, but turned it off before I fixed it.
14:45robertstuttafordqu1j0t3: i've tried to read online tuts for haskell and erlang and those just left me wondering just how stupid i actually am. i got about half way through The Little Schemer, which i actually quite enjoy, and will attack again soon
14:45cemerickscottj_: tragically, we have no control at all over the book's pricing. :-)
14:45qu1j0t3robertstuttaford: TLS has a good rep. Did you try SICP, btw?
14:45creesecemerick: great talk
14:46cemerickcreese: you are too kind :-)
14:46robertstuttafordi think i was also finally ready for it. um, i have SICP. haven't tried it, yet
14:46cemerickrobertstuttaford: I'm glad you're liking it. :-)
14:46ibdknoxcemerick: it's a very hard medium, I hated doing screencasts
14:47robertstuttafordit's a little frustrating because i'm only at chapter 4 and i'm having to accept that i don't know how atoms or refs or multimethods or macros work yet and still puzzle out what's going on in the code i'm reading everywhere
14:47qu1j0t3robertstuttaford: there are some non-lisp books that are pretty approachable, too. I like ML For the Working Programmer, Applicative High Order Programming, and Henderson's Functional Programming Application and Implementation. -- though I have finished none of them yet, they cover a lot of ground.
14:47robertstuttafordbut i'll get there. having fun
14:47qu1j0t3robertstuttaford: SICP is very rewarding, but I am only in Ch.2.
14:48robertstuttafordthanks for the recommends, qu. i'll add them to the list
14:50cemerickibdknox: My screencasts rarely involve me coding, and even those I do multiple takes on. Programming and talking at the same time is clearly not a good idea. :-P
14:51cemerickI should have talked while I did my (very clean) dry run last night, so I could see just how rough it was going to be.
14:51technomancyif anyone is looking for an easy way to contribute to Leiningen we've got a bunch of issues tagged "newbie" that should be pretty accessible: https://github.com/technomancy/leiningen/issues?direction=desc&amp;labels=&amp;milestone=4&amp;sort=created&amp;state=open
14:52ibdknoxcemerick: I'm sure you did fine. :) But yeah, I learned that the hard way a couple of times. Never code in front of people unless you're willing to practice the hell out of it. Most of the time it's better to just make the code magically appear :)
14:52robertstuttafordi quite like watching folks code. you learn a whole bunch, generally speaking
14:52ibdknoxcemerick: the only way it works is if you have don't have to think about the code at all
14:53ibdknoxrobertstuttaford: absolutely, it's just very hard to give a coherent presentation at the same time
14:53robertstuttafordtrue :)
14:53ibdknoxyou literally have to make it automatic
14:53cemerickibdknox: my biggest problem is that my dry run included compojure the whole way through, but I decided at the last minute to talk in detail about ring. Of course, what happens when you return a string from an unadorned ring hander? :-x
14:54ibdknoxcemerick: haha
14:54cemerickI was pretty thrown from there on out.
14:54creeseI thought the talk was very useful. I've seen enough power points.
14:54robertstuttaford+++ OUT OF CHEESE ERROR +++ ?
14:54cemerickFigured it out, but…sheesh.
14:54cemerickrobertstuttaford: *exactly* that.
14:54cemerick:-)
14:54robertstuttaford-chuckle-
14:54ibdknoxcemerick: yeah.. that happened to me in a keynote once
14:54ibdknoxfucking VB
14:54ibdknoxlol
14:54cemerickThen I look over and three people in the chat room are yelling DUDE YOU NEED A RESPONSE MAP!
14:56robertstuttafordgood luck with lighttable, ibdknox. looking forward to seeing where you end up
14:56ibdknoxrobertstuttaford: thanks :)
14:56shadowh511ibdknox: areyou the lighttable dev?
14:56ibdknoxyep
14:56shadowh511:D
14:56madsyibdknox: I wonder, how are you going to make the instant-feedback work with other languages than clojure? (and maybe javascript)
14:57shadowh511I'm really excited for it
14:57ibdknoxmadsy: live evaling code is pretty straightforward
14:57shadowh511hell, I should donate
14:57ibdknoxmadsy: given a dynamic runtime
14:57shadowh511how far are you from the goal?
14:57ibdknox76% of the way there
14:57robertstuttafordi kinda blame you for tipping the balance on my decision to go clojure. that video was really interesting, it got me curious. then i discovered cljs and its relation to gclosure (i'm around 8kloc into a gclosure base now .. yick), and then the HackerNews post about the new Programming Clojure book landed like a day later
14:58cemerickrobertstuttaford: which video?
14:58ibdknoxI have a couple of very neat things I'm working on to show before it closes, so I think I shouldn't have too much issue pushing it over
14:58robertstuttafordthe lighttable one
14:58madsyibdknox: Care to explain? It sounds a bit scary if you use it on accident on some code that writes to network/files or something else.
14:58cemerickah
14:58madsyby*
14:58cemerickrobertstuttaford: well, when things go pear-shaped, you need to talk to ibdknox then. ;-)
14:58madsyI thought maybe you could read clojures metadata for that, but what do I know.
14:59robertstuttafordi guess seeing the live values moving through the clojure code in the vid turned a light on somewhere
14:59ibdknoxmadsy: it won't be on for everything, you'll have to opt in - just like you would for executing code in a repl
14:59robertstuttafordcemerick: noted :)
14:59ibdknoxmadsy: that particular notion isn't perfect for everything, that's for sure
14:59madsyibdknox: So you could for example opt-in by setting a metadata variable?
14:59madsyBecause that was my first impression
14:59madsyMark code as safe/unsafe
14:59technomancyyeah, I was thinking about implementing it using metadata to provide seed values
14:59ibdknoxmadsy: there are a whole host of potential solutions there
14:59madsyok
14:59ibdknoxtechnomancy: yeah
15:00robertstuttafordhow does ClojureOne get the live page changes right if cljs doesn't support eval?
15:00ibdknoxtechnomancy: I was thinking of annotating something so that you could say "instead of executing provide this value"
15:00technomancyannotating defns?
15:00ibdknoxtechnomancy: yep
15:01technomancylike a pre-memoization?
15:01emezeskecemerick: Hey, did you happen to see my pull request for friend? I'm curious if you have any thoughts.
15:01ibdknoxmore like a mock I think
15:01shadowh511ibdknox: lighttable will have a linux binary, yes?
15:01ibdknoxyeah
15:01technomancyibdknox: oh sure; I've done that
15:01cemerickemezeske: I did; it's in a browser tab, so it shouldn't be long now ;-)
15:01ibdknoxtechnomancy: that up somewhere? :)
15:01technomancyibdknox: http://technomancy.us/141
15:01shadowh511ibdknox: as soon as I get home, I will donate
15:02emezeskecemerick: Haha, so I'm not the only one that has a bunch of tabs as my todo list? :)
15:02cemerickemezeske: oh, actually: those "unused" bindings in authenticate are there for documentation, as workflows and such are expected to use them :-)
15:02ibdknoxtechnomancy: cool
15:02ibdknoxalright, gotta run
15:02technomancyI don't think I ever used it though
15:02ibdknoxGoing to go talk to David Pollack :)
15:03ibdknoxminus the c
15:03emezeskecemerick: Oh? I can undo that. They never get passed into the workflow function, though, or do they?
15:03shadowh511be back later guys
15:03cemerickemezeske: the entire authentication config is added as a key to request maps
15:04emezeskecemerick: Ahh, gotcha, makes sense, I will just amend that commit
15:04cemerickthanks
15:05emezeskecemerick: One other question I had -- in workflows.clj, is it right to refer to e.g. ::friend/workflow instead of :friend/workflow?
15:05emezeskecemerick: I'm trying to figure out how they differ.
15:05cemerickyes
15:05fdaoudcemerick: just to add to the fun, and totally not your fault but still distracting, when you showed your screen the first time, a ton of people started screaming that it wasn't working, and then it was mentioned that IE and FF (but not chrome) were supported, and it was using flash, and... I braced myself for the whole thing to go to <...> !
15:06cemerick,(require '[clojure.set :as set])
15:06clojurebotnil
15:06cemerickheh, cook
15:06cemerick,(namespace ::set/foo)
15:06clojurebot"clojure.set"
15:06cemerick,(namespace :set/foo)
15:06clojurebot"set"
15:06cemerickemezeske: ^^
15:06emezeskecemerick: Ahh, so it makes sure the namespace is fully qualified
15:06cemerickyes
15:06emezeskecemerick: Thank you, easy explanation
15:07emezeskecemerick: I need to file bug reports with kibit and eastwood, which blow up upon seeing those
15:07cemerickfdaoud: heh, you should see what the speaker side of things looks like :-O
15:08fdaoudcemerick: eek!
15:08fdaouddoesn't sound, er, stress-free
15:10emezeskecemerick: I amended the commit.
15:10cemerickfdaoud: FF only AFAICT, flash, and translucent applets for screen sharing. :-P
15:11emezeskecemerick: FYI, I've built a very nice login system on top of friend, with login throttling and password recovery. It was pretty easy to do!
15:11fdaoudcemerick: was your CPU usage through the roof?
15:11samaaroncemerick: does the speaker side of things look different???
15:11lazybotsamaaron: Oh, absolutely.
15:12cemericklazybot: botsnack
15:12lazybotcemerick: Thanks! Om nom nom!!
15:12cemerickThat was the best lazybot response I've ever seen.
15:12samaaronhaha
15:12samaaronlazybot: botsnack
15:12lazybotsamaaron: Thanks! Om nom nom!!
15:12cemerickfdaoud: No; it was smooth enough, just lots of knobs, pipes, and widgets.
15:12cemerickI think the main console accidentally wafted into the screen sharing near the end.
15:13fdaoudcemerick: yes it did
15:13amalloyemezeske: there's not much eastwood and kibit can do about ::foo/bar
15:14amalloyit's a token that the reader will only process if you're actually compiling/executing the namespace - it's meaningful only in context of a namespace. if you just read the source-code forms it doesn't work
15:15amalloyhaha cemerick, i'm glad you like the ??? plugin. i added it because questions that end with ?? usually get answered with a "no", but i added the positive ???-endings for symmetry
15:15jonasenamalloy: I think ::foo/bar will work in eastwood
15:15jonasenbut not in kibit
15:15amalloyjonasen: i don't remember, do you (or rather analyze) actually execute the forms as you read them, or just read?
15:15cemerickIs amalloy awesome???
15:15lazybotcemerick: Yes, 100% for sure.
15:16jonasenanalyze requires the namespace
15:16samaaronamalloy is awesome except for the part of his life where he ate a whole pint of bacon
15:17amalloyyes, a more superlative word than awesome is necessary for that
15:17emezeskeamalloy: I see, interesting.
15:17fdaoudI thought he shared some of that bacon.
15:17amalloyi did!
15:17samaaronfdaoud: perhaps he pretended to..
15:17amalloywould it be at all polite to eat the WHOLE thing in front of such a crowd of nice guys??
15:17lazybotamalloy: Definitely not.
15:18amalloyclojurebot: bacon is <reply> Thanks! Om nom -- error: emotion overload
15:18clojurebotc'est bon!
15:18lynaghkdnolen: ping.
15:18dnolenlynaghk: pong
15:19lynaghkdnolen: do you have any experience with FRTime?
15:19dnolenhmm not really why?
15:19lynaghkdnolen: it's a reactive dataflow evaluator for scheme
15:19dnolenyeah
15:19lynaghkdnolen: I'm considering porting it to Clojure/ClojureScript. To show up those meteor folks =P
15:19dnolencool!
15:20lynaghkdnolen: except I'm in no way qualified or familiar with any of that stuff, so I was hoping I could mention it and you'd pull it out of your hat some evening
15:21lynaghkdnolen: in all seriousness though, I'm worried that performance would be really hard to nail down on something like that
15:22dnolenlynaghk: why, isn't that mostly chaining functions together?
15:23dnolenlynaghk: porting FrTime would be cool, but you probably want to look at RxJS too.
15:23lynaghkdnolen: there is a lot of lifting (converting regular immutable objects into behaviors), so I'd be worried about GC churn
15:23lynaghkdnolen: yeah, I looked into that a bit too (though not the implementation details yet)
15:24dnolenlynaghk: I don't see why you would create anymore GC events than RxJS if done properly.
15:25lynaghkdevil is in that last part.
15:25halgarilynaghk: have you seen the talk Stuart Sierra gave on Rx in Clojure? (http://vimeo.com/18970727)
15:25dnolenlynaghk: yes, it's informative building a CLJS library with an eye for perf, it requires just a little bit more consideration up front.
15:26lynaghkhalgari: I haven't, thanks!
15:26shadowh511umm, would clojure be affected by the oracle "copyrights" on the java API?
15:26shadowh511kuz jython and jruby might be affected by it
15:26shadowh511http://yro.slashdot.org/story/12/05/01/1828247/oracle-and-the-end-of-programming-as-we-know-it
15:27Chousukehmm, that would be weird
15:27dnolenlynaghk: often it just means being a little more careful about critical fns, for example https://github.com/clojure/core.logic/blob/master/src/main/clojure/cljs/core/logic.cljs#L111
15:27Chousukeif it were the case, then every java library would be affected as well
15:27dnolenlynaghk: notice that I avoid higher level functions, I use direct property access, and I make liberal use of identical?
15:27robertstuttafordok so i'm probably going to start with building a simple json rest service in clojure. i'm thinking i should use compojure for routing and friend for auth, monger for database access and i believe json is natively supported?
15:28shadowh511wouldn't that effectively kill Java and make the IP worthless?
15:28dnolenlynaghk: I remember correctly all those things added up to a 10X boost, assq gets called all the time.
15:28qu1j0t3shadowh511: that appears to be Oracle's intention in most things.
15:28shadowh511qu1j0t3: they want to make their IP worthless?
15:29qu1j0t3that's what i conclude from their actions since buying Sun, yes.
15:29qu1j0t3but ymmv
15:29shadowh511ymmv?
15:29qu1j0t3your mileage may vary
15:29shadowh511ah
15:30kovasblynaghk: ping
15:30lynaghkdnolen: good tip. The perf of such a library depends on two orthogonal parts: the DOM manipulation/traversal (the actual DOM and its representation in cljs) and the dataflow graph traversal to see when things need to get updated.
15:30lynaghkkovasb: pong.
15:31dnolenlynaghk: yes, don't be afraid of custom data structures for the critical parts. CLJS abstractions are nice, but they aren't free.
15:32kovasblynaghk: i think I'm ready to rock some c2 in my project
15:33kovasblynaghk: got a bare bones thing working, https://github.com/kovasb/session
15:33lynaghkdnolen: yeah, thats what this really comes down to---do I want to get a general, FRTime like thing that automatically lifts and does dataflow calculations, or should I come up with yet-another-DSL/framework that covers 90% of use cases in a performant way.
15:34michaelr525what's the best way to go from {:a 1 :b 2} into {:a :some1 :b :some2}?
15:34lynaghkkovasb: "class not found session.server" I'm on lein2
15:35kovasblynaghk: ok, haven't tested it with lein2.. will take a look
15:35michaelr525map?
15:35clojurebotmap and the other sequence functions used to be lazy, but with the advent of chunked sequences, may or may not be lazy, consult your local ouija board
15:35michaelr525or maybe something else?
15:35lynaghkkovasb: okay, it's just a source path thing then. lein1 works fine.
15:35kovasblynaghk dnolen: my conclusion with frp stuff is that data flow isn't enough. you need to know the deltas
15:36kovasblynaghk dnolen: esp since dealing with collection updates is maybe the most common perf bottleneck
15:36lynaghkkovasb: doesn't that just mean you are relying on mutable state outside of your dataflow system?
15:36emezeskemichaelr525: A decent way: (into {} (for [[k v] m] [k (f v)]))
15:36lynaghkkovasb: oh, if it's for performance that's understandable.
15:37dnolenlynaghk: btw, did you see rhickey's reduce lib changes?
15:37dnolenlynaghk: that should be a big win for CLJS too.
15:37michaelr525emezeske: thanks!
15:37kovasblynaghk: yes. i think thats gonna happen anyway (your models are mutable state, even if wrapped in a atom or whatever)
15:38lynaghkdnolen: I saw him in the channel yesterday but I didn't exactly grok what was going on. It will provide perf benefits for anything that uses reduce?
15:38kovasblynaghk: updating graphics is a great thought experiment. much of the time you are updating color, position rather than creating new objects
15:38dnolenlynaghk: map/filter become reduce combinators.
15:39dnolenlynaghk: basically allocation free pipelines - less GC churn and likely a very a big performance boost.
15:39dnolen(reduce + some-vector) - allocation free.
15:39lynaghkdnolen: okay. boss =) Does someone need to port the reduce lib to cljs.core?
15:39dnolenlynaghk: mmarczyk working on it.
15:39lynaghkdnolen: he's a machine.
15:39dnolenman totally!
15:40lynaghkkovasb: have you seen ymacs?
15:40kovasblynaghk: yeah, but i thought it was left for dead until that recent update
15:41LauJensenEvening gents
15:41kovasblynaghk: i'm not gonna try to solve the code editor problem, other people are on that :)
15:41lynaghkkovasb: oh man, I didn't even know there was a recent update. That is the only in-browser code editor I'd consider using
15:41lynaghksince I am addicted to emacs.
15:42lynaghkkovasb: yeah, but isn't that going to be a blocking problem for anyone to use something like session?
15:42kovasblynaghk: haha yeah. IMHO a repl is a radically different beast than a code editor
15:42kovasblynaghk: its about producing artifacts, not producing code
15:42lynaghkI'm not sure what you mean
15:42kovasblynaghk: different use case, different goals
15:42kovasblynaghk: for instance, collaborating on a data analysis problem in realtime
15:43kovasblynaghk: can happen in session, not gonna happen in a code editor
15:43kijLauJensen: Hey
15:43kovasblynaghk: producing artifacts means, you create the thing at the repl and hit the publish button, it goes live
15:44kovasblynaghk: writing code means you create some text, and deal with deployment etc in some other set of tools
15:45lynaghkkovasb: so it is like a napkin? It's there, you can write little things on it and use it to explain ideas to others?
15:46kovasblynaghk: yeah, I think that is a good analogy
15:46kovasblynaghk: or, like evernote for clojure repl sessions
15:47kovasblynaghk: often i run some sequence of steps, want to save that sequence and come back to it
15:48lynaghkkovasb: somehow I'm not surprised to hear that coming from a guy with Mathematica background =)
15:49kovasblynaghk: yeah, it was eye opening to get work done without writing "programs" per se
15:49kovasblynaghk: the idea that you have to write a totally repeatable, general program to get anything done is constricting
15:50kovasblynaghk: sometimes you just want to do some computations with specific data, rather than deal with the general case upfront
15:51lynaghkkovasb: yeah, I'm sold on the idea of the REPL.
15:51kovasblynaghk: yeah.. so i just want to make a much more awesome repl then what we have now :)
15:52lynaghkkovasb: ping me if c2 gives you any trouble. I'm tidying up the API and cutting an official 0.1.0 release this upcoming Monday
15:54kovasblynaghk: i think i just need to read the source closely to understand the return values and how they get updated
15:54lynaghkkovasb: return values of what?
15:55kovasblynaghk: like, how is the final output inserted into the dom?
15:55kovasblynaghk: since I might need to intercept that point
15:55lynaghkif you are using the CLJS unify! fn, it calls dom/append!
15:56kovasblynaghk: ideally, I want a hiccup structure
15:56kovasblynaghk: which I then insert myself
15:56lynaghkyou can pass :enter :update and :exit fns to unify! to examine the DOM nodes and mutate them yourself if necessary (return false to cancel c2's default behavior)
15:56lynaghkkovasb: why do you want to insert yourself?
15:56lynaghk(also, fyi, all of c2's dom methods take hiccup structures)
15:57kovasblynaghk: they need to go into a specific place (the loop "output")
15:57lynaghkUsing the unify! fn might not be your best bet. If you just want a clojurescript hiccup compiler though, you can use that.
15:58kovasblynaghk: yea, i have my own hiccup implementation
15:59lynaghkthe contract of unify! is "I want this seq of data to be mapped to elements that match this CSS selector, according to this fn that transforms each datum to a hiccup structure"
15:59lynaghkkovasb: heh, I think we all do now =P
15:59kovasblynaghk: hehe
16:00kovasbso I'm looking at the pie.clj example
16:01kovasblynaghk: is all i need to do is take whatever is inside [:svg …] and stuff it into my hiccup function?
16:01lynaghkon clj "unify" (no bang) is just "map" with the args reordered. You need to pass the resulting output to hiccup to get an HTML string.
16:01lynaghkyeah, there's nothing really to do on the server since there isn't a DOM or interaction.
16:02kovasblynaghk: are there examples in there that have interaction?
16:03lynaghkno, there are no cljs examples at the moment
16:03kovasbone question on unify! ..
16:03lynaghkbut if you want updates, just pass unify! an atom containing data, and it will update the DOM whenever the atom changes.
16:04kovasbwhen do the things that match the selector need to exist? presumably at the time it is executed right?
16:04dnolenibdknox: http://www.quora.com/Computer-Programming/Does-Light-Table-the-IDE-proposed-by-Chris-Granger-in-a-current-Kickstarter-project-offer-important-new-advances-for-programmers
16:04kovasblynaghk: ok
16:05lynaghkkovasb: the first arg selector is the container. the :selector kwarg arg is optional, and specifies what elements within the container you want to manipulate (defaults to all container children)
16:06kovasblynaghk: cool. will see how far I can get
16:06lynaghkkovasb: rad. I'm going to grab some lunch, talk to you later.
16:06kovasblynaghk: later!
16:42MordusHow is Vaadin through Clojure? I'm looking for a sanity check on that kind of development before I start a project using it.
16:56chief_chalI could not find a #moustache channel, so I'll post my question here, it thats ok.
16:56chief_chalHow can I pass a url argument to a handler function? For example, in (app ["foo" id] my-handler) how can I get "id" inside "my-handler"?
16:57raekchief_chal: you can pass it as an additional parameter: (app ["foo" id] #(my-handler % id))
16:57chief_chalRight now I'm ripping :params open and parsing ":uri", but that doesnt seem right
16:58mmarczykdnolen: http://dev.clojure.org/jira/browse/CLJS-224 -- support for terminating reduce
16:58raekanother approach is to make my-handler work in two stages
16:58chief_chalraek, Oh I should wrap it in an anon funtion with the handler and argument?
16:58raek(defn my-handler [id] (fn [request] ...))
16:58raek(app ["foo" id] (my-handler id))
16:59chief_chalthank you, raek. The moustache docs doc were not clear and I keep forgetting this is just Ring after all =)
16:59raekit's just ordinary clojure functions... :-)
17:00raekthe important thing is that the place (app ["foo" id] <here>) evaluates to a function that takes one argument - the request
17:00dnolenmmarczyk: excellent
17:01chief_chalraek: right, so I've gotta have two additional handler layers to deal with "id", correct?
17:02mmarczyk:-)
17:03jcromartiewhy is "lein repl" less snappy than java -jar clojure.jar
17:03chief_chalraek: I'll use the first suggestion, thanks for the help!
17:03jcromartieeven "rlwrap java -jar ..."
17:03TimMcjcromartie: It has to start a second JVM for your 1.3 Clojure.
17:04technomancyjcromartie: because it's more complicated to work with your project
17:04technomancydependencies, configuration, etc
17:04jcromartietechnomancy: not just startup… let me clarify
17:04jcromartiewhen I run a repl from "lein repl", command processing is slower and adds some "flicker" to the line in the terminal
17:04technomancyjcromartie: also because in lein 1.x I wrote the repl but didn't use it day to day. in lein 2.x, the repl task is totally rewritten and way better.
17:05technomancyjcromartie: but the slowness is caused to some degree by the fact that two processes are involved instead of one
17:05jcromartietechnomancy: ah, so it's hosting its own repl
17:05technomancyjcromartie: anyway if you are a heavy repl user you should definitely try lein 2; it's much better
17:06jcromartieoh OK!
17:06jcromartieI though I was up to date
17:06jcromartieafter "lein upgrade"
17:06technomancywell lein2 is still in a preview state, so `lein upgrade` doesn't pull it in yet
17:06technomancybut it's quite usable
17:06jcromartieany tips for updating?
17:07technomancyclojurebot: lein upgrade guide?
17:07TimMcI've never seen lein1's repl to be anything but snappy.
17:07clojurebotlein2 is still in a preview release, but see the upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading
17:07technomancyjcromartie: there ya go
17:07TimMcjcromartie: What operating system?
17:09jcromartieOS X 10.7
17:09jweissis there a clone detection tool for clojure source (to detect copy/pasted code)? trying to show my code has very little compared to another competing codebase in python, but i can only find a tool for python.
17:10jcromartiehmm, lein2 repl fails: IllegalArgumentException No enum const class jline.console.Operation.DABBREV_EXPAND
17:10jcromartiejline… *shudder*
17:10TimMcjweiss: You want to compare Python and Clojure code?
17:10technomancyjcromartie: jline1 is horrible; jline2 is pretty badass
17:11jcromartieoh?
17:11jcromartieok
17:11technomancyjcromartie: are you running from source or preview3?
17:11jweissTimMc: no, just compare the amount of cloning in one codebase vs the other.
17:11jcromartietechnomancy: preview3… I think
17:11jweissTimMc: for instance, the other codebase has 45% of it's lines cloned from elsewhere in the code
17:11jweissi want a number for my codebase.
17:12TimMcI see!
17:12technomancyjcromartie: very strange; same thing if you run it from outside a project?
17:12jcromartieyeah I'm outside a project
17:12technomancyhow about inside?
17:13jcromartienow it downloads tools.nrepl
17:13jcromartiedownloading..
17:15ibdknoxdnolen: lol thanks for the pointer
17:15jcromartiehm, weird
17:15jcromartieno luck there
17:15TimMcjweiss: How is clone detection defined in Python? Multiple non-empty equal blocks where whitespace has been normalized? What about variable renaming?
17:16hiredmanalso, lines cloned is dumb
17:16jweissTimMc: there's various options to set the minimum block size, minimum difference within the block, etc
17:17jweisshiredman: well, in python it makes more sense than in clojure
17:17hiredmanhttp://www.infoq.com/presentations/Decisions-Decisions is a good talk about trade offs, one of them mentioned is DRY and copy and pasted code
17:17jweissi suppose in clojure it could be sexps of a certain # of items
17:18jweissTimMc: i used http://clonedigger.sourceforge.net/ on the python side
17:20jcromartiethere's also gzip as a crude metric
17:21jcromartietar+gzip your code
17:22hcumberdaledoes anyone know software to push a application server log to a website
17:22hcumberdalelike "tail -f"
17:22TimMcjcromartie: That doesn't help when comparing across languages!
17:22jcromartieTimMc: you can compare ratios
17:22jcromartieentropy of Python vs entropy of Clojure
17:22TimMcOr does it? I don't know, have to think about this...
17:23jweissi don't know i think jcromartie is onto something there
17:24snamellithp
17:24jcromartiehttps://gist.github.com/2571452
17:24snamellithcumberdale: checkout logstash
17:24clj_newbIs there a standard way to read a properties file and store into a data-structure?
17:25jweissclj_newb: a java properties file?
17:25technomancyclj_newb: (into {} (java.util.Properties.)) works
17:25technomancyyou'd want to call .load on it first though
17:25jcromartiethat gist is a shell script to calculate entropy
17:26jcromartiefind . -name "*.py" | xargs cat | entropy.sh
17:26jweissjcromartie: /me tries
17:26clj_newbwell I meant if there was a standard. As the properties file with extension .clj and format :key value or {key {value1 value2}}
17:26technomancyclojurebot: properties |are| easy to load into maps: (into {} (doto (java.util.Properties.) (.load (clojure.java.io/reader "stuff.properties"))))
17:26clojurebotAlles klar
17:27clj_newbthanks technomancy
17:27technomancyclj_newb: oh, you mean clojure format? sure; load-file
17:27technomancythe above works with java .properties files, but if you can use whatever format you might as well use clojure
17:27jweissjcromartie: what is this entropy command your script refers to? i don't have that
17:29jcromartiejweiss: oh it's just itself
17:29jweissjcromartie: ah ok
17:29jcromartieyeah sorry, the .sh was for gist language detection
17:30jweissjcromartie: hm, 'mktemp: too few X's in template `entropy''
17:30RoxxiPop quiz! clojure/reduce : scheme/fold :: clojure/??? : scheme/fold-right
17:31jweissjcromartie: oh i see
17:31weavejesterRoxxi: I don't believe Clojure has a fold-right inbuilt.
17:32RoxxiDrat.
17:32TimMcRoxxi: Are you reducing over a vector by any chance?
17:33RoxxiIndeed. But I need the evaluation to be executed semantically from right to left
17:33TimMcRoxxi: rseq
17:33RoxxiAh, clever
17:33Roxxithings
17:33Roxxierr thanks*
17:33weavejesterCorrect me if I'm wrong, but without TCO doesn't a foldr result in a new item on the stack for each iteration?
17:34TimMcweavejester: Even with TCO, yes.
17:34TimMcif you're foldring over a linked-list
17:34weavejesterTimMc: Oh, yes, obviously because it has to be combined each time.
17:34hiredmanand it would hold on to the head of a lazy-seq
17:35technomancythis is why we can't have nice things
17:35weavejesterSo is a foldr ever useful?
17:35TimMcNo, this is hy we have nice data structures.
17:35weavejesterCompared to a (comp reduce rseq)
17:35TimMcweavejester: When you don't have vector.
17:35technomancyweavejester: that'd need to be something like rcomp anyway
17:35technomancywhich I've often wished for
17:36mrakanIs there a way to clear all definitions within a namespace? For instance, if I defined (def a-var 5) and others, I want a-var and the others to no longer exist.
17:36creesecan someone explain to me why running my code with C-c C-k doesn't result in the repl to see what's been run? Is this a ns problem?
17:36jweissjcromartie: i can't get it to run, mktemp fails and it then forks too many time
17:37jcromartiemktemp huh
17:37jcromartieI'd add a set -x
17:37jcromartiebut not sure why mktemp fails… what OS?
17:37technomancycreese: that's not how slime works unfortunately
17:37jweissjcromartie: fedora 16. mktemp: too few X's in template `entropy'
17:38technomancycreese: but it's best not to keep side-effects in the top-level anyway; better to put it in a defn and run the defn in the repl
17:38jweissapparently the -t option is deprecated, but i get the same error without -t
17:38creesethat's what I meant. the functions weren't seen
17:38technomancycreese: oh, probably in the wrong namespace? C-c M-p
17:38jcromartieah OK
17:38jcromartiegot it
17:39jcromartiejweiss: check the gist now
17:39jcromartiehttps://gist.github.com/2571452
17:40creeseI think that's what I was missing.
17:41jweissjcromartie: sweet, got 0.14 /me looks up what that means.
17:41jweissthat's on the other codebase btw :)
17:44mrakanApparently I can remove a namespace and all of its definitions with 'remove-ns, so that answers my question.
17:55iwohey all, sorry i know this question must get asked *daily* but can anyone give me a link to some truly up-to-date advice on setting up a clojure development environment?
17:55shadowh511iwo: windows or *NIX?
17:55iwolinux
17:56shadowh511install leinigen
17:56technomancyiwo: the getting started wiki on dev.clojure.org isn't bad, but what do you currently use?
17:56iwoi'm looking for lein & emacs... plus slime/swank(?)
17:56iwotechnomancy: i currently use counterclockwise :|
17:56technomancyiwo: the main thing to know about setting up emacs and swank is to only trust the swank-clojure readme rather than stuff you find via google
17:56mefestoiwo: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
17:56technomancygoogle WILL lead you astray
17:57iwomefesto: cheers!
17:57jcromartiejweiss: /dev/random should yield an entropy of 1.0, while /dev/zero should be 0, meaning (in a nutshell) the higher the ratio, the more important each piece of info is
17:57iwotechnomancy: yeah, i've tried following a couple of guides in the past, but i always get into 'out-of-date' territory
17:57jcromartiejweiss: information entropy is something I will not attempt to explain here, because I'll probably get it wrong :)
17:58jcromartiejweiss: but the shortest best explanation from Wikipedia is "a measure of disorder, or more precisely unpredictability"
17:58iwoi know things are moving on very fast, always better ways of doing things
17:59iwobut i'm still a bit confused about e.g. should i use lein to install _everything_, do i need to use marmalade? etc
18:00technomancyyou don't really need marmalade anymore if you'd rather install clojure-mode by hand
18:01technomancyit doesn't hurt, but it's more complicated
18:01iwoi assume if i use clojure-mode, i don't need paredit?
18:01technomancyactually you do
18:01technomancythere's lots of good stuff in marmalade, but it's not needed for just swank
18:02amalloyjcromartie: isn't the mktemp/cat/entropy/rm dance just a complicated way to write: entropy <(cat) ?
18:03jcromartieamalloy: is it? I don't know :)
18:03jcromartieyou're right
18:04creeseI am trying to use map. (count (first (first x))) does what I want to the first element of the list x. What do put for f in (map f x) to do it to all of them?
18:04jcromartiewait, does <(cat) write to a file?
18:04amalloyit creates a file, writes the output of cat to it, and then expands to the file's name
18:04amalloyprobably opened in read-only mode, i'm not sure
18:05jcromartienever seen it before, neat
18:05amalloyyeah, read-only
18:05raekcreese: so you want to do (count (first y)) for each y in the list x?
18:05jcromartieamalloy: hm, not working on OS X
18:05creeseI think so
18:05amalloyand i guess technically it opens a pipe, not a file
18:06raek(map #(count (first %)) the-list)
18:06raekor
18:06raek(for [y the-list] (count (first y)))
18:06creesewhat are the # and % doing?
18:06raekit is a shorthand for an anonymous function literal
18:06amalloyjcromartie: works for me on OS X afaict. does the following not work? cat <(echo text goes here)
18:07raekthe same as (map (fn [y] (count (first y))) the-list)
18:07raekcreese: map will apply that function on each element and make a sequence of the return values
18:07creesethat's what I want
18:08creeseI didn't know I needed an anonymous function
18:08creesethat's what I wanted. thanks
18:09raekwell, the function does not have to be anonymous. but you can't just put the unwrapped expression there.
18:09creesewhich is what I was trying to do
18:10raekmap is an ordinary function, so its arguments are evaluated before the function is called
18:11raekand it doesn't make sense to evaluate (count (first y)) "out of context"
18:11raekso you parameterize the expression and encapsulate it in a function object
18:13mmarczykdnolen: just fixed a bug in TransientVector (the one Brian Taylor reported in CLJS-208), fix @ CLJS-226
18:13creesethanks
18:17iwois using the thread macro a lot considered bad form in the clojure community?
18:18technomancyiwo: no, it's quite nice
18:19iwoe.g. would you rather see this: (first (reverse '(1 2 3))) or this: (-> '(1 2 3) reverse first)
18:19technomancywith only two short calls it's a toss up; the more calls (or arguments) you add the more valuable -> becomes
18:21S11001001though, -?> from core.incubator can be quite valuable with only 1 call
18:21technomancyeh; might as well use and for that
18:21S11001001huh?
18:22hiredman(and x (f x))
18:22technomancyit's one line shorter since you don't need to refer it
18:22S11001001not having a variable, often
18:22S11001001/binding/what-have-you
18:23technomancytrue; it's point-free
18:24S11001001if you're willing to introduce temporaries willynilly, ->'s value also goes away
18:34amalloypersonally i don't like -> much for things like (-> x foo bar baz) - it's much more useful for (-> x (foo a) (bar b) (baz z)) where otherwise the "focus" on x would get lost
18:39solussd_where can I find instructions on using the clojurescript repl form a project created with the noir cljs-template ?
18:41emezeskesolussd_: Here: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/REPL.md
18:41emezeskesolussd_: cljs-template uses the lein-cljsbuild plugin for that AFAIK
18:41pandeirosolussd_: add :repl-init noir.cljs.repl to your project.clj, do `lein repl`, and call (browser)
18:42pandeirothat's just one way to do it... or just call browser from that ns however you decide to launch the repl
18:42solussd_thanks
18:43pandeiroyou will have to refresh the browser after all of that to establish the connection
18:44mmarczykthe new reduce goodies in CLJS: http://dev.clojure.org/jira/browse/CLJS-227
18:44mmarczykturns out this is copy and paste with CLJS-224 in place
19:28FrozenlockI've defined a function with some arguments ---> [& {:keys [arg1 arg2....]}]. Now when I call this function, I would like to be able to send it a map directly, such as {:arg1 value :arg2 value...}. I've used (apply my-function (flatten (into [] arg-maps))), but surely there's a more elegant way?
19:30mebaran151Frozenlock: for a start, you could probably drop the call to into
19:31mebaran151, (flatten (seq {:a 1 :b 2}))
19:31S11001001Frozenlock: rest-args are always seqs, never maps
19:31clojurebot(:a 1 :b 2)
19:31mebaran151,(flatten {:a 1 :b 2})
19:31clojurebot()
19:31mmarczykS11001001: but can be destructured in a map-like fashion
19:32S11001001mmarczyk: which is implemented as building a new map
19:32mmarczykS11001001: indeed it is
19:33FrozenlockIndeed, that's better
19:33jonaskoelkerI got a question for (mildly?) seasoned clojurers: I'm implementing a toyish language, using s-exprs as my AST. I want to basically (eval ..) it, but only allow for execution of a particular (closed) set of functions. What's the idiomatic way of doing that?
19:33mmarczykS11001001: nothing wrong with Frozenlock's definition though
19:33Frozenlock"for a start" means there's more? :)
19:33mebaran151Frozenlock: just my first thought was to just use seq directly
19:34mmarczykflatten is dangerous, though, as it will flatten all the way
19:34mmarczykthat is, :foo [[1 2 3]] will get flattened to (:foo 1 2 3)
19:35FrozenlockLuckily in my case everything is at the same level
19:36brehaut(apply concat … or (mapcat identity …
19:36hiredmanor use for
19:37mebaran151,(apply concat {:a 1 b 2})
19:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0)>
19:37S11001001mmarczyk: unless Frozenlock truly wishes to pass a map "directly"
19:37mebaran151,(apply concat {:a 1 :b 2})
19:37clojurebot(:a 1 :b 2)
19:38FrozenlockNo, simply my arguments are in a map and I don't want to extract each of them.
19:38mmarczykS11001001: explaining the nature of rest args is a roundabout way of making that suggestion :-)
19:38mmarczykS11001001: anyway, wasn't sure what you meant is all
19:39S11001001I prefer giving hints over handing out answers
19:39S11001001quite often I err on the side of obscurity :)
19:39S11001001anyway, concat is a great choice then
19:39S11001001but if you ever wish to pass a map "directly", consider that you can exploit the fact that there is no way to confuse a seq meant to be destructured as a map, with a single map
19:40mmarczykFrozenlock: you could of course say (.invoke your-function the-map)
19:41S11001001that is, (fn me ([x] (me x nil)) ([x {:keys [...]}] impl-here) ([x k1 k2 & args] (me (apply hash-map k1 k2 args))))
19:41mmarczykFrozenlock: ah, wait, wrong method
19:41S11001001will still [likely] rebuild
19:42FrozenlockHmm concat is lazy: No value supplied for key: clojure.lang.LazySeq@6bfd3bcf
19:42S11001001apply is lazy :)
19:42FrozenlockOh? It doesn't say so in its doc.
19:43S11001001it's a consequence of the language
19:43S11001001(apply concat inft-list) is therefore legal, and many others
19:44S11001001so glad rhickey didn't try to be java there
19:46emezeskeHere's my non-lazy, super-ghetto solution:
19:46emezeske(defmacro mapply [f & args] `(~f ~@(butlast args) ~@(apply concat (into [] (last args)))))
19:48amalloyemezeske: it's not just non-lazy, it doesn't work in any interesting cases
19:48emezeskeMy solution has the advantage of having a name that can be confused with monad stuff
19:48emezeskeamalloy: For example?
19:48amalloy(let [argmap {:a 1 :b 2}] (mapply whatever argmap))
19:49powrtochow can you connect to an external swank process with slime? Now that clojure-mode packages it I can't call slime-connect, and clojure-jack-in starts a swank server inside emacs
19:49emezeskeamalloy: What about that does not work?
19:49emezeskeOh
19:49emezeskeDerp
19:49amalloy~mapply
19:49clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
19:49mmarczykS11001001: you could also reverse that approach -- (fn me ([x opts] (let [{:keys [...]} opts] ...)) ([x k v & more] (me x (apply hash-map k v more))))
19:50emezeskeamalloy: This question comes up enough that clojurebot knows about it?
19:50mmarczykS11001001: wait, got totally mixed up
19:50amalloywell, i don't totally approve of having mapply exist, but TimMc (i think?) decided to teach clojurebot
19:50technomancypowrtoc: you have to either prime your emacs instance with a "dummy" jack-in or install slime via marmalade
19:51mmarczykdon't mind me, pulling together my split attention atm :-P
19:51technomancyslime-repl, that is
19:51emezeskeamalloy: What do you not approve of?
19:51amalloyyour internal functions should just take maps, and you pass maps around. having to create and rip apart maps from kwarg seqs all over the place is a pain and pointless
19:51amalloyat the outermost level, for the user: fine, use kwargs
19:51emezeskeThat's a good point.
19:52amalloy(and also slow)
19:52emezeskeI generally just pass a map even in my outermost functions, the "{" and "}" are not that hard to type.
19:54cduffyHmm. I'm advised to avoid dealing with Matchers directly (being mutable objects)... but is there a way to retrieve groups without them?
19:55amalloyre-seq
19:55amalloyor re-find probably works too, i dunno
19:56amalloy&(re-seq #"f(o+)" "a bad variable name, such as foo, should be avoided")
19:56lazybot⇒ (["foo" "oo"])
19:56amalloy&(re-find #"f(o+)" "a bad variable name, such as foo, should be avoided")
19:56lazybot⇒ ["foo" "oo"]
19:59amalloycduffy: ^
20:03powrtoctechnomancy, thanks slime-repl works a trea
20:03powrtoct
20:04technomancycool
20:11TimMcamalloy: It was you who taught clojurebot.
20:12TimMc(OK, technically, you clarified my factoid.)
21:03FrozenlockIs there a way to send something from an output stream directly to an input stream?
21:03scottj_video of Rich's railsconf keynote http://news.ycombinator.com/item?id=3917104
21:28leo2007is the jvm controlled by oracle?
21:31Roxxi`That's quite the loaded question you have there... :)
21:33leo2007sorry
21:36leimyHowdy. Was looking at the clojurescript sample for twitter. It doesn't seem to work for me. Is this a known issue, something about ICounter not being implemented. I'd like to show this to coworkers and see if I can't seduce them into clojure.
21:38mebaran151what's the best profiler for clojure?
21:40scottj_mebaran151: yourkit
21:41riddochcmebaran151: You could give criterium a try.
21:42mebaran151riddochc: criterium looks pretty cool
21:42riddochchttps://github.com/hugoduncan/criterium
21:42riddochcI haven't done much with it, though. But anything that profiles stuff running on the JVM should do. I've heard good things about yourkit, but haven't used it.
21:42riddochcDoesn't have to be clojure-specific.
21:42mebaran151does it do sub-functional statistics (ie your function spent x amount of call keyword n times?)
21:43alex_baranoskynever used YourKit with Clojure, but it works fine for JAva
21:43riddochcGood question, I don't know.
21:44alex_baranoskyyourkit will tell me how much time is spent in different methods on Java classes
21:45mebaran151I was just looking for a way to test if this method was slow because of IO (fine) or because I'm spending all my time recursively munging keywords (less fine)
21:46alex_baranoskymebaran151, I can't say for sure, but I think you could look at what methods are being called by Clojure and look for an explosion of a particular method call
21:46leo2007is the #_ reader macro new in 1.4?
21:46riddochcMaybe visualvm might help too?
21:46alex_baranoskyleo2007, nope!
21:46leimynathanmarz: Just bought your MEAP book...
21:47mmarczykleimy: you mean TwitterBuzz?
21:47mmarczykleimy: which version of ClojureScript?
21:48leimymmarczyk: Yes
21:48leimymmarczyk: I pulled from github today. Master I think. Not in front of my computer at this point.
21:49mmarczykleimy: ok, I'll go and compile it now
21:49leo2007alex_baranosky: thanks
21:49leimymmarczyk: Was using safari on Lion, I could see it pulling twitter data for sure.
21:50alex_baranoskyleo2007, not sure which version it arrived... old I think
21:50leimyAlso clojurescript seems awfully nice. Very impressed so far. I just started today though.
21:51leo2007alex_baranosky: no problem. I was just surprised that clojure-mode doesn't put the form following #_ in comment face.
21:52mmarczykleimy: ok, I'm hitting the same bug -- let's see about a fix
21:52mmarczykleimy: glad you're liking it :-)
21:52alex_baranoskyleo2007, that's kind of sad
21:53amalloyleo2007: i think the syntax highlighting in emacs is dumber than that - regexes, not full parse trees
21:53leo2007its clojure-mode's fault and can be fixed.
21:53leo2007amalloy: sure, but it can do a lot actually.
22:01leimyEmacs does the best job with Perl I've ever seen...
22:01leimyBut then I avoid Perl
22:01alex_baranosky... and if it can handle Perl... you know it can handle anything :)
22:02mmarczykleo2007: I wouldn't want #_ to be "commentified" at all
22:02mmarczykleo2007: because I find the highlighted syntax in #_'d forms very useful
22:03mmarczyksame goes for (comment ...).
22:05brehautive gone both ways on highlighting of #_ and (comment forms
22:06brehautideally i think i'd like it to be highlighted as both some how
22:07brehautbut i havent worked out a good 'somehow'
22:07alex_baranoskybrehaut, what would be slickest, would be it being commentified, and at the same time syntax highlighted in greyscale (or shades of whichever color is appropriate for comments in your given color scheme)
22:07mmarczykfade out / change background colour ?
22:07brehautsomething like that could work yeah
22:08dgrnbrgAfter the GSOC project to port clojure to luajit, that'll pave the way for porting clojure to vim script and elisp. It will be awesome when one editor plugin works on all the important IDEs
22:08leo2007mmarczyk: yeah, that could be useful too.
22:08dgrnbrgEspecially to share functionality like the parser/syntax highlighter
22:08brehautive mostly only thought about it in terms of the javascript syntax highlighter brush,
22:08mmarczykdgrnbrg: oh yeah :-D
22:08brehautwhich has some annoying limitations, and would require CSS rules for everything
22:09leimyI have an aversion to IDEs. I feel like they make me do things their way.
22:12leimyBe back soon. Getting daughter home from dance
22:14mmarczykleimy: see you later; I think I've pinpointed the source of that bug, btw
22:21leimyAwesome
22:24mmarczykoh man, I've been thinking about why my fix doesn't work for 5 minutes only to discover that I've been running the repl in another checkout :-(
22:27leimymmarczyk: Hehe. I do that stuff a lot
22:28leimyHome now btw... I can test things
22:28wei_is there a Clojure socket.io client library?
22:29mmarczykleimy: got it working! will post a fix on JIRA in a sec
22:29leimyAwesome
22:42mmarczykleimy: http://dev.clojure.org/jira/browse/CLJS-229
22:43leimymmarczyk: Thank you
22:45mmarczyknp
22:45jayunit100Why does " (for [x (lazy-seq (range 1 100011111110000)) :when (= x 1)] x) " take a long time to return ???
22:45lazybotjayunit100: Oh, absolutely.
22:46jayunit100,(for [x (lazy-seq (range 1 10)) :when (= x 1)] x)
22:46clojurebot(1)
22:46leimymmarczyk: I have no idea how to apply this patch. :-)
22:46tmciverjayunit100: for has to check all the elements to see which are 1.
22:46mmarczykleimy: cat ....patch | git am
22:46mmarczykleimy: in a checkout of CLJS master
22:47leimyI see I wanted to use straight patch.
22:47mmarczykleimy: see also the earlier ticket linked to from CLJS-229 -- should provide a speed boost
22:48mmarczykleimy: then again probably not easily noticeable in TwitterBuzz, so maybe not worth your time
22:48mmarczykleimy: on second thought.
22:48FrozenlockAny advice on how I could make this function send the output stream directly to an input stream? I want to avoid the 'write-to-disk' step. http://pastebin.com/nn6CTc0N
22:49leimyIs swp some archival/compression? I suddenly feel I've been in a coma or something.
22:51jayunit100tmciver: I thought it would, lazily emit them though...
22:55tmciverjayunit100: yes, at the repl it will take a long time because the repl is realizing it; if you def it, it returns immediately.
22:57jayunit100hm ok i always tend to make that mistake . I guess the repl doesnt lazily stream results back.
22:57mmarczykleimy: swp?
22:58leimymmarczyk: did you post the vim swapfile instead of the patch?
22:58mmarczykleimy: ...argh
22:58leimyhaha.
22:59mmarczykleimy: fixed, thanks for the heads up
23:00mmarczykother recent patches happily appear to be the actual patches :-P
23:03leimymmarczyk: that fixed it. thanks!
23:04mmarczykleimy: great, thanks for the report!
23:04leimymmarczyk: sorry did not know how to patch it myself
23:05mmarczykleimy: not at all
23:05mmarczykleimy: the reason for the breakage was kind of unexpected -- in count -- basically some chaos around removing some default implementations of things for perf reasons
23:06mmarczykleimy: CLJS will be the better for it, but I guess running the bundled demo apps from time to time to discover breakage wouldn't be a bad idea
23:07leimymmarczyk: ah. yeah. :-). well i saw the rich hickey demo online and decided i wanted to do that.
23:07mmarczykleimy: you mean the unveiling video? that was *awesome*
23:07leimymmarczyk: yes
23:13mmarczykFrozenlock: http://ostermiller.org/convert_java_outputstream_inputstream.html
23:14mmarczykFrozenlock: method 2, I guess
23:15FrozenlockThanks, I stumbled uppon the same solution on stack overflow.
23:15FrozenlockStill can't figure out how to make it work :(
23:18Frozenlockjava.io.PrintWriter would behave the same in a pipedstream, correct?
23:19mmarczykivan: hah, that's a cool link :-)
23:19mmarczykFrozenlock: I would hope so, but don't know for sure
23:25mmarczykFrozenlock: I guess you'd wrap the PipedOutputStream in the ZipOutputStream
23:26mmarczykFrozenlock: pass the other end of the pipe -- the PipedInputStream -- to the consumer
23:26mmarczykFrozenlock: then just .putNextEntry as many times as you want
23:26mmarczykFrozenlock: no writes, printlns etc.
23:27FrozenlockHmm... what about the content?
23:27FrozenlockIf I understand correctly, the content is inserted with the .println
23:29mmarczykFrozenlock: ah, right
23:29mmarczyksorry, I think I need to get some sleep
23:29FrozenlockSo do I, but thanks :)
23:29mmarczyk:-)
23:30mmarczykbut still, I think you should just do the same thing except w/ ZOS wrapping a PipedOutputStream
23:30mmarczykand hope the PIS will be pleasant to work with on the consumer side :-)
23:30FrozenlockYes, it is somehow working... I have a .zip file, but it's corrupted
23:34mmarczykhm, yeah, tried to get this working here, but not sure about the details
23:34mmarczyk:-(
23:36FrozenlockI succeeded in making a spit-to-zip function, but can't for the life of me understand how to just send it to an input stream. Life's a bitch.
23:36mmarczykheh
23:36mmarczykoh wow, need to dash now or I'll miss my train
23:37FrozenlockHave a nice ride
23:37leimymmarczyk: thanks again
23:37mmarczykthanks!
23:38devnI'm moving a library from 1.2 (with contrib deps) to 1.4 -- what is the preferred fn to use in place of duck-streams/read-lines?
23:39devndoes clojure.java.io handle automatically closing like read-lines used to?
23:59arohner_devn: yes, it does