#clojure logs

2012-05-17

00:04emezeskeJust released lein-cljsbuild 0.1.10, which pulls in clojurescript 0.0-1236 .
00:14wkmanireoin 3refheap
00:14clojurebotamac: So it's a seq of connections? And what do you do with them? I understand what disjoined sets look like, but the representation and iteration is where I run into trouble.
00:14wkmanirewow
00:15wkmaniresuper typorific.
00:32lynaghkibdknox: ping
00:59devnibdknox: you around?
01:15yoklovwoo unreadable clojure code http://codegolf.stackexchange.com/questions/5847/convert-from-postfix-notation-to-infix-notation/
01:16devnyoklov: i found a way more interesting crazy obfuscated clojure fn
01:16devnerr statement
01:16devnerr expression
01:16devnYOU KNOW WHAT I MEAN
01:18yoklovoh?
01:19devnyoklov: hunting for it now
01:19brainproxyfor you cloj devs who work/experiment w/ nodejs: node-clojurescript v0.1.4 is out ... includes "detached" JVM client/server for faster compiles, lein comes bundles (as nlein), and other various improvements :D
01:21amalloyyoklov: (or ({...} x) x) is just ({...} x x)
01:21yoklovoh!
01:22yoklovthank you
01:22devn,(letfn[(!-?>[&$ &!](if(>,&!,1)(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](!-?>,1,5))
01:22devnyoklov: ^ :D
01:22yoklovoh wow
01:22devn&(letfn[(!-?>[&$ &!](if(>,&!,1)(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](!-?>,1,5))
01:22lazybot⇒ 120
01:22yoklovI briefly considered replacing the spaces with commas
01:22devnit makes sense once you start thinking about it
01:23clojurebot120
01:23amalloynice of you to join us, clojurebot
01:23devnyoklov: im not sure how people feel about this, but once upon a time i used to mark "special" symbols by wrapping them in ,'s: ,,,important-thing,,,
01:25devngrrr, cannot figure out how to connect with korma to homebrew postgres
01:27alandipertdevn: (letfn[(!-?>[&$ &!](if(>,&!,1)#(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](trampoline(!-?>,1,10000M))) for extra obfuscation and stack defense
01:29ibdknoxlynaghk: hey
01:29ibdknoxdevn: hey
01:31devnalandipert: ha!
01:33devnibdknox: i was just going to bug you for tech support because my fat fingers cannot figure out how to connect to a psql db on OSX 10.7.4 and "do stuff"
01:34devnibdknox: ibdknox A ResourcePool could not acquire a resource from its primary factory or source.
01:34ibdknoxI dunno lol
01:34ibdknoxnot seen that one
01:34devnlol, this is beta10
01:34devnfwiw
01:37wkmanireIs there an easy way to cast a map to a python dict?
01:37nsxt_any vimclojure users around? my indentation isn't working and it's driving me nuts. i should probably take this to #vim, but they're pretty quiet at this time and maybe someone here has had similar issues.
01:38ibdknoxdevn: not sure without more to go on
01:39devnibdknox: yeah, sorry -- kind of a weak report on my end, basically i removed the Apple-installed postgres and homebrew installed postgresql
01:39devnibdknox: i then followed `brew info postgresql` to initdb
01:43devnibdknox: I then created a database named "foo" via `psql`. I'm not sure what the values for defdb are supposed to be, because it should be accepting local connections with no need for user or password, but ive tried specifying them, not specifying password, etc, and no luck
01:43wkmanireI know maps are unordered, but if I pull the keys and the vals from a map are they gonig to come out in order?
01:43wkmanireAs in the two collections correspond index wise.
01:44devnibdknox: i assume (defdb (postgres {:db "foo"})), (defentity exprs), (insert exprs (values {:a "1", :b "2"})) will work
01:44technomancywkmanire: it's guaranteed
01:44wkmaniretechnomancy: Awesome
01:44wkmanirethanks
01:44ibdknoxdevn: it needs the username and password
01:45devnibdknox: but...there isn't one. create a user?
01:45ibdknoxdevn: there is one
01:45ibdknoxdevn: not sure what it is by default
01:45ibdknoxI'm not a database setup wizard by any means lol
01:45technomancydevn: I couldn't get it working either; it sticks c3p0 in the way and interferes with c.j.jdbc connection parameter parsing
01:45technomancynot sure if that's the same problem, but it sounds related
01:46devntechnomancy: glad to hear im not alone i suppose
01:47xeqidevn: in psql run \du and see what the role names it gives you
01:47technomancyc.j.jdbc connects just fine to passwordless databases
01:47technomancyFWIW
01:48devnxeqi: plato | Superuser, Create role, Create DB, Replication | {}
01:48amalloywkmanire: you're probably better off just calling seq on the map to get a seq of k/v pairs
01:49robertstuttafordok so i'm trying to use ring-serve from within a swank repl. [ring-serve "0.1.2"] is in project.clj under dev-deps, and the jar is in ~/.m2. lein2 deps has no output. when i (require 'ring.utils.serve), i get a classnotfound exception. what should i check?
01:49ibdknoxtechnomancy: devn: I'm happy to take pull requests, it should be a relatively straightforward thing to do, but I don't have time for that at current
01:49robertstuttafordthis is the last piece of the puzzle. with this, i am able to emacs repl browser all in the same repl
01:50robertstuttafordibdknox: congrats on your funding. exciting time ahead for you!
01:50technomancyI'll put something together if I end up sticking with it
01:51robertstuttafordtechnomancy: you are a machine! everywhere i look i see your name popping up. thanks for your myriad awesome contributions to the cause.
01:51robertstuttafordlooking forward to watching your emacs peepcode
01:51technomancyrobertstuttaford: thanks; glad it's been useful =)
01:51robertstuttafordimmensely so.
01:52technomancywow, weird crossover; I visit http://planet.gnome.org and the first post is about VimClojure.
01:52technomancythe stars are aligning or something
01:53ibdknoxrobertstuttaford: thanks! :)
01:54robertstuttafordlooking forward to seeing what you come up with. i know you were working hard on a new video for nowish, how's that going?
01:58robertstuttafordanyone got a clue why i'm struggling with ring-serve?
02:01robertstuttafordor perhaps i can connect to the 'lein2 ring serve-headless' process from swank?
02:02technomancyrobertstuttaford: I sketched out a swank-wrap higher-order task that would start a swank server and then go on to perform another task but I don't think I ever published it
02:07wei_what's the idiomatic way to make an agent repeat an action for a set amount of time? (repeatedly (send-off …)) ?
02:07technomancydoes it have to be an agent? you can use executors.
02:10devntechnomancy: did you have the same problem with mysql?
02:10devntechnomancy: i cant get that to work with korma either
02:11technomancydevn: I don't use mysql
02:11technomancykind of as a matter of principle =)
02:11devntechnomancy: nor do i, but postgres isn't working
02:11devnand i wanna hack on something
02:11devn:)
02:11technomancyjust use clojure.java.jdbc
02:11technomancyit's simple
02:11wei_it doesn't have to be an agent
02:11wei_what's a good example using executors?
02:12technomancywei_: https://github.com/heroku/pulse has some repetitions scheduled with executors
02:12wei_thanks, I'll check it out
02:12xeqidevn: try using (postgres {:db "foo" :user "plato"})
02:12technomancygood ol' util.clj: https://github.com/heroku/pulse/blob/master/src/pulse/util.clj
02:19devnxeqi: no dice :(
02:19devnxeqi: it just hangs when i try to do anything in the db and then says: A ResourcePool could not acquire a resource from its primary factory or source.
02:20michaelr525i remember someone had the same problem here in the channel couple of days ago
02:20xeqihmm
02:22xeqitry (defdb mydb {:subprotocol "postgresql" :subname "foo" :classname "org.postgresql.Driver" :user clojars"}
02:22michaelr525devn: did you specify database on your table entity
02:22michaelr525?
02:22devnmichaelr525: yes and no?
02:22michaelr525what?
02:22clojurebotWhat is meta
02:22xeqioh, and you have something like [postgresql "9.1-901-1.jdbc4"] in you're dependencies right?
02:22devnlol
02:22devnthat's probably it
02:23xeqi*lein dependencies
02:24technomancydevn: even if you don't use c.j.jdbc, ensuring that you can connect using it is a good first debugging step
02:25devntechnomancy: yeah, i think i still may have a problem
02:25devni dont think im connecting
02:25devnbut we'll try it with the driver
02:25michaelr525devn: did you specify the database on your table entity?
02:25devnmichaelr525: what do you mean?
02:25wei_just curious, what's the downside of using agents?
02:25michaelr525(def db (postgress..
02:25devn(defentity :foo (database db) (table :foo))
02:26wei_(technomancy:) I find the easier to think about conceptually
02:26michaelr525yeah
02:26devnyes i did
02:26technomancywei_: agents are reference types designed to hold a value
02:26technomancythey're not a good fit for "just do a bunch of stuff"
02:27technomancythough sometimes they can be convenient for it merely because the Java APIs are slightly more verbose
02:27devnxeqi: thanks. i just didnt have the damned driver
02:27devn*facepalm*
02:27wei_i see
02:27wei_is there a major performance overhead?
02:27xeqiheh
02:28technomancywei_: not really; bit of memory maybe
02:31robertstuttafordis this the right way to force linum 1 for clojure? (add-hook 'clojure-mode-hook (lambda () (linum-mode 1)))
02:31robertstuttafordseat-of-pants coding, here
02:31devnxeqi: new question for you: "relation xyz does not exist"
02:32devnxeqi: (defentity xyz (database db) (entity-fields :a :b)), (insert xyz (values {:a 1, :b 2}))
02:34xeqidevn: have you created an xyz table?
02:34devnxeqi: can i not do that via korma?
02:35xeqinope
02:36xeqitheres some stuff in korma.incubator
02:36robertstuttafordkorma is not an orm :-)
02:36xeqior lobos
02:36xeqifor schema generation
02:36robertstuttafordit's a dsl for writing sql
02:36xeqibut I haven't used them
02:36devnrobertstuttaford: yeah, im coming from orm land
02:36ibdknoxthe korma.incubator stuff is rough
02:36ibdknoxjust a proof of what it might look like
02:37ibdknoxI won't be doing a lot of SQL in the near future :( I'll be making an appeal to the list sometime soon to see if anyone's interested in helping move it forward
02:37robertstuttafordibdknox: mine wouldn't work unless i explicitly placed (database foo) inside each (defentity)
02:37ibdknoxSomeone who can show it more love :)
02:37ibdknoxreally?
02:37ibdknoxthat definitely shouldn't true
02:37robertstuttafordaye. and the defdb is in the same file right above the defentities
02:38ibdknoxor do you mean the incubator stuff?
02:38ibdknoxcan you put up a gist?
02:38robertstuttafordsure
02:39robertstuttafordlet me first verify before i take up your time. i had the issue amongst a whole swath of others
02:42robertstuttafordibdknox: overturned. noob issue.
02:44ibdknoxrighto :)
02:49michaelr525ibdknox: btw, i solved the super-slow lein run issue i had by upgrading noir to beta7 from beta3
02:49ibdknoxah
02:49michaelr525it was getting lost somewhere in the load-view func
02:49michaelr525views
02:49ibdknoxmm, Raynes recently updated that code
02:49ibdknoxglad it got fixed :)
02:49michaelr525me too ;)
02:51michaelr525ibdknox: can i ask you a personal question?
02:51ibdknoxsure lol
02:52hiredman"how much wood would a woodchuck chuck if a woodchuck could chuck wood?"
02:52michaelr525how did you get so deeply involved with clojure after such a serious background in microsfot environments and such?
02:52ibdknoxhiredman: phi logs
02:53ibdknoxmichaelr525: My time at MSFT was really interesting. I came to MS having not used windows in > 5 years. Part of what I brought with me was perspective
02:54ibdknoxmichaelr525: as my time was drawing to an end, I was interested in trying something new. Clojure seemed neat and it was on HN all the time. I figured why not try it
02:54ibdknoxmichaelr525: at the time I was working on a startup where we were using node.js. Node wasn't working for us, so I rewrote the thing in Clojure and it was blazing fast and < 40% of the size. I was sold
02:55robertstuttafordwoooo my ipad 3 is about to arrive -bounce-bounce-
02:55michaelr525i see, very interesting..
02:56ibdknoxClojure's ability to express and manipulate abstraction is just orders of magnitude better than anything else I've ever used... And at the end of the day that's what I think programming is, it's just a matter of utilizing abstraction
02:56robertstuttafordi like how close you get to expressing the problem domain with clojure
02:56robertstuttafordinstead of feeding compilers sugar
02:57robertstuttafordmichaelr525: this is a great read http://www.colinsteele.org/post/23103789647
02:57ibdknoxmessing around with Python again made me realize how much Clojure has spoiled me lol
02:57michaelr525robertstuttaford: thanks, read it yesterday actually :)
02:58michaelr525ibdknox: what slows me most of the time with clojure is the lack of an integrated debugger like in VS
02:59ibdknoxmichaelr525: you need to invert the way you think about your programs. You need a debugger for VB or C#, but once you learn to build small, easily composed functions it becomes much less of an issue
02:59michaelr525i still manage to be very productive, imho but a debugger would give a real productivity boost
03:00ibdknoxthere are definitely times when you need one
03:00ibdknoxbut usually with a REPL it's not so important :)
03:00robertstuttafordworking hard to separate pure vs side-effecting functions also helps
03:00robertstuttafordboth in terms of debugging and in terms of reasoning about your solution
03:00devn* 10
03:01michaelr525i'm used to just press F5 and if the program fails i get the exact point with a browsable stack, locals, watches, immediate window..
03:01devnmichaelr525: better and better debuggers will come
03:01devnbut clojure is still growing. when people really need it, it will come
03:01devnthat's my thinking anyway
03:01ibdknox's true
03:01robertstuttafordmy first foray is a json rest service. aside from reading zip files and sql db, i'm 100% pure, so far
03:02devnrobertstuttaford: dont worry about purity.
03:02devni remember caring about that
03:02devnit's really just about writing good, solid programs. purity be damned.
03:02michaelr525sure, i still _really_ enjoy doing clojure, but maybe a big part of it is the learning experience
03:03robertstuttaforddevn, still very new to it, so i'm enjoying thinking about it
03:03devnrobertstuttaford: fair enough, just suggesting not to marry purity
03:03robertstuttafordclojure is nice in that it makes it hard to program imperatively, so i'm constantly reminded to think things through
03:04devnyeah it's nice, eh?
03:04robertstuttafordvery
03:04devnmichaelr525: sure it is, but you never quit learning with clojure (or at least i havent)
03:04devnso that good feeling never goes away
03:04devnit's great like that. :)
03:04robertstuttafordmakes me cringe when i have to go back into my gclosure javascript
03:05alandipertthat learning feeling, mmm!
03:05michaelr525okay, let's print it on t-shirts ;)
03:05robertstuttafordif you stop learning as a programmer, you stop living!
03:06devnalandipert: Ugg functional programmer. Make lambda with club. Gar not fond of lisp. Gar want make imperative language for boy and for girl.
03:06robertstuttafordok. ipad unboxing time. laterrr
03:06devnalandipert: are you going to euroclojure?
03:06alandipertdevn: naw :-(
03:07devnratzookas
03:07alandipertdevn: next party for me is oscon probly
03:07devnalandipert: whn is that?
03:08alandipertdevn: july, in portland
03:08devnoh...well dont count me out just yet
03:08devni have reason to go to portland at some point this summer
03:09devn</fun-fact>
03:10PeregrinePDXYay, I'm already in portland.
03:10devnalandipert: is the datomic appliance toast now?
03:10devnalandipert: as in i dont download the VM image anymore?
03:10alandipertdevn: yes, the latest dev jar lets you local store
03:11devncool beans.
03:12alandipertdevn: yeah it's money, back with postgres even! not sure that's doc'd tho
03:12devnalandipert: it's sort of kind of doc'd, but it's all moving pretty quick
03:13Vinzentany ideas what does "java.lang.RuntimeException: No such var: leiningen.util.injected/add-hook" mean? I'm getting this after running lein test. add-hook is one of my functions, but it's obviously in different namespace. From withing emacs all works just fine.
03:13Vinzentlein version is 1.7.1, just upgraded it
03:30muhoois there some way to get the lein/maven project.clj version from inside a project?
03:35muhooooh, i got it! projectname.version in (System/getenv)
03:35muhooslick
03:35muhoo(System/getProperties), actually
03:35muhoo&(System/getProperties)
03:35lazybotjava.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
03:35muhooheh
04:00LauJensenMorning gents
04:33TEttingerok, i think i need to actually learn clojure before i try to develop any more in it...
04:34TEttingeris there a good ebook or web tutorial for... (I don't know where i stand, basic, maybe) clojure?
04:34mudphoneHave you seen Joy of Clojure?
04:34VinzentTEttinger, check out this http://java.ociweb.com/mark/clojure/article.html
04:35TEttingerI made http://dl.dropbox.com/u/11914692/Ascendant-Force-GUI-demo-standalone.jar with Seesaw but I just have a mental block getting further with the algorithms
04:35TEttingerok, thanks guys
04:35Vinzentalso, http://learn-clojure.com/ contains a good number of links to other resources
04:35mudphonewhat is it about "recur" that is getting you?
04:35TEttingerok, will check them out
04:35TEttingerthe docs.
04:36TEttingerhttp://clojure.org/special_forms#Special%20Forms--%28recur%20exprs*%29
04:36TEttingerthe passage is just worded in a confusing way
04:36mudphoneI see
04:36mudphone… well, recur allows you to call back to the same function or loop
04:37si14argh. I'm trying to download index from central; it's 2% after an hour
04:37si14is there a way to speed up this process?
04:38mudphoneTEttinger: Clojure doesn't have tail call optimization, so you write recursive functions by calling recur at the end of a function (or loop)
04:38Vinzentsi14, I'm afraid no. It's for lein search, right?
04:40TEttingermudphone, yeah, it looks like the while macro is a better fit for what i am trying to do. The specific task is fairly imperative/procedural, so figuring out how to do it without knowing how loops work in this language... heh
04:41VinzentTEttinger, yeah, recur is actually used not very often in clojure; usually there is a function\macro which does the job better
04:41TEttingerI need to take a position on a grid (the grid is stored internally as a 1-D vector) and draw a line from a corner (chosen by the user) to that point on the grid.
04:42VinzentIf you need to iterate through the vector for side effects, then use doseq
04:42TEttingerthe trick is that while you can always get there in at most one right-angle turn, the corner squares on the grid serve as a barrier of sorts if you try to draw the wrong way (no good way to say it, huh)
04:44mudphoneTEttinger: here's a good example of recur, in fibonacci… in case you still are interested https://groups.google.com/forum/?fromgroups#!topic/clojure/ac8bV9zo1OQ
04:44mudphone(at the bottom, by Paul Barry)
04:44TEttingerVinzent, the way I am writing the line-finding function, it has an empty vector at the start that stores indices in the grid, and it just adds on extra values to the vector with each index it adds being part of the line
04:45si14Vinzent: yeah
04:47TEttingerah, thanks mudphone
04:48mudphonenp
04:48VinzentTEttinger, ah, I thought you're actually drawing something - misunderstood your first message
04:48Vinzentsi14, I remember it took forever to download for me too
05:04TEttingerhm, can you assign to a name that has already been bound by let?
05:06TEttinger,(fn foo [] (let [bar \A] (let [bar \Z] (print bar))))
05:06clojurebot#<sandbox$eval27$foo__28 sandbox$eval27$foo__28@9502d1>
05:06TEttinger,((fn foo [] (let [bar \A] (let [bar \Z] (print bar)))))
05:06clojurebotZ
05:06TEttingerah.
05:08TEttingerI assume letting a let is not something you let off so easily, although i hope you let it slide this time
05:10TEttingercrud, it is still bound to a tighter scope than the rest...
05:11TEttingerso i can't use let inside a while loop to change the condition to exit the loop
05:12TEttingerit is hard not having assignment! or i guess it is there, but transactional or something
05:19thorwilTEttinger: i suspect you would be better of with loop/recur
05:20TEttingerthorwil, I think I will need that, yeah. since I can't have mutable state to exit the while macro unless i use a ref or something
05:21BorkdudeTEttinger: you can also rebind a name within the same let-bindings: ##(let [a 10, a (+ a 10)] a)
05:21lazybot⇒ 20
05:21thorwilTEttinger: but before using loop/recur, are your sure it's not a job for map, reduce or filter?
05:22TEttingeryes.
05:22TEttingersince I need to generate a new list in a sort of odd way
05:23TEttingererr, new vec
05:26bobrydoes anyone have an example app with waltz? https://github.com/ibdknox/waltz
05:35michaelr525what is the use case for waltz?
05:36ejacksonmanaging state in CS
05:36ejacksoni've used it once
05:39ejacksonhmm.. OK, I was using it to manage interaction between some JS components, but then gave up, I recall in some frustration ;)
05:39TEttingeragh. is there any documentation on the case macro other than the function docstring? googling finds lots of uses of the english word "case", not much of the macro...
05:40thorwilTEttinger: http://clojuredocs.org/clojure_core/1.3.0/clojure.core/case
05:41TEttingerwoah, i did not know about that site, thanks thorwil
05:41thorwilnp
05:46muhoohmm weird: https://www.refheap.com/paste/2764 compujure pulls in incubator which pulls in ring.core 1.0.1 ? and then ring 1.0.2 is pulled in by noir?
05:49BorkdudeTEttinger: if you use leiningen2 it has a REPL from which you can also call clojuredocs, like (clojuredocs case) ;;=> examples
05:50TEttingerah, I am still on 1.7, thanks Borkdude
05:50BorkdudeTEttinger: (the REPL also has autocompletion….)
06:22TEttingerhm, how can i use compare with condp ?
06:23TEttingercompare returns an unspecified positive number, negative number, or 0
06:23TEttingerand condp... I don't know how I would get it to use pos? or neg?
06:23Borkdude,(doc condp)
06:23clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, i...
06:24TEttingerhttp://clojuredocs.org/clojure_core/clojure.core/condp
06:24TEttingeri mean, i could do this the dumb way and list every value as a "case," but that won't scale for long
06:25TEttingerand all I need to know is whether the difference is positive, negative, or 0
06:25Borkdude,(let [x 5] (condp < x 1 "< 1" 5 "< 5" 6 "< 6" "other))
06:25clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>
06:26TEttinger,(let [x 5] (condp < x 1 "< 1" 5 "< 5" 6 "< 6" "other"))
06:26clojurebot"< 1"
06:27Borkdudeso because (< 1 5) hols true "< 1" is returned
06:28TEttingeryeah, my problem is that i don't have a boolean result i am looking for
06:28TEttingerso < and >....
06:28Borkdude,(let [x 5] (condp > x 1 "> 1 x" 5 "> x 5" 6 "x > 6" "other"))
06:28clojurebot"x > 6"
06:29TEttingeri don't mean a comparison operator, like < or >
06:29TEttingerI mean, compare
06:29Borkdudewhy not a normal cond?
06:29TEttingerhttp://clojuredocs.org/clojure_core/clojure.core/compare
06:30TEttingerbecause I haven't read the docs for cond yet? :-|
06:30BorkdudeTEttinger: condp is a specialized form of cond
06:30TEttingeryeah, just read cond now, it is what i want... gah...
06:30BorkdudeTEttinger: and cond is just a macro which expands to a nested if statement
06:31Borkdude,(macroexpand '(cond :foo "foo" :else "bar))
06:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>
06:31Borkdude,(macroexpand '(cond :foo "foo" :else "bar"))
06:31clojurebot(if :foo "foo" (clojure.core/cond :else "bar"))
06:31Borkdude,(macroexpand '(cond :else "bar"))
06:31clojurebot(if :else "bar" (clojure.core/cond))
06:32Borkdude,(macroexpand '(cond))
06:32clojurebotnil
06:32Borkdude,(resolve 'clojure.walk/macroexpand-all)
06:32clojurebotnil
06:32Borkdude,(resolve 'macroexpand-all)
06:32clojurebotnil
06:33Borkdude,(clojure.walk/macroexpand-all '(when :foo :bar))
06:33clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk>
06:34Borkdude&(clojure.walk/macroexpand-all '(when :foo :bar))
06:34lazybot⇒ (if :foo (do :bar))
06:34Borkdude&(clojure.walk/macroexpand-all '(cond :foo "foo" :else "bar"))
06:34lazybot⇒ (if :foo "foo" (if :else "bar" nil))
06:35Borkdude&(clojure.walk/macroexpand-all '(condp > x 1 "> 1 x" 5 "> x 5" 6 "x > 6" "other"))
06:35lazybot⇒ (let* [pred__9856 > expr__9857 x] (if (pred__9856 1 expr__9857) "> 1 x" (if (pred__9856 5 expr__9857) "> x 5" (if (pred__9856 6 expr__9857) "x > 6" "other"))))
06:36Borkdude&(source condp)
06:36lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
06:36Borkdude,(source condp)
06:36clojurebotSource not found
06:37Borkdude&(pprint {:a "foo"})
06:37lazybotjava.lang.RuntimeException: Unable to resolve symbol: pprint in this context
06:38Borkdude&(clojure.pprint/pprint {:a "foo"})
06:38lazybot⇒ {:a "foo"} nil
06:38Borkdude&(clojure.pprint/pprint (clojure.walk/macroexpand-all '(condp > x 1 "> 1 x" 5 "> x 5" 6 "x > 6" "other")))
06:38lazybotjava.security.AccessControlException: access denied (java.util.PropertyPermission line.separator read)
06:38Borkdudehm ok
06:44dsabaninhi guys
06:44dsabaninwhat is the syntax to have multiple exceptions listed in try-catch expr?
06:50Borkdudedsabanin: from what I understand here is that you can provide more than one catch clause: http://clojure.org/special_forms#try
06:51dsabaninyeah, looks like there's no other way. Thanks
06:54TEttingerok, i just killed the repl after my laptop started sounding like a jet engine -- thank you, infinite loop...
06:55Borkdude:)
06:58TEttingerBorkdude, could you take a look at my code (don't run it and leave it sitting, obviously)? http://pastebin.com/gTscmyj3
06:59TEttingerthe function is part of a grid-thing, i should probably just link you to the working jar without this -- http://dl.dropbox.com/u/11914692/Ascendant-Force-GUI-demo-standalone.jar
07:01BorkdudeTEttinger: without looking into the detail, a non-terminating recur means the condition in (if (= current-square target)) is apparently never becoming true
07:02TEttingeractually it does
07:02TEttingerin one case
07:02TEttingerthat I know of...
07:02TEttinger(path-to-target 0 6)
07:02Borkdudeit should terminate in all cases ;)
07:02TEttingeryes
07:03BorkdudeTEttinger: you could insert some printlns to see what each recursive call looks like
07:03TEttingerbut I am having a hard time figuring out precisely how all these calls work, and I think i may have misplaced a stinkin' parenthesis
07:03TEttingerok
07:04Borkdudeso above the if: (println confirmed-squares current-square)
07:07raekTEttinger: if you use Emacs, just put the point inside the function, press C-M-h to select the whole function, and then press TAB to reindent it
07:08raekany misplaced parentheses should reveal themselves by markant changes in the indentation
07:08TEttingerah
07:08TEttingerhow do i find the size of a vector?
07:09TEttingersearched for len, length, and size, nothing in the API
07:12serpent213TEttinger: count
07:12TEttingerd'oh...
07:12TEttingerthanks serpent213
07:20BorkdudeTEttinger: try (path-to-target 6 3)...
07:20TEttingerwell it seems to just jump back and forth between the starting value and a midway value
07:21BorkdudeTEttinger: since (path-to-target 3 6) is almost the reverse of (path-to-target 6 3) it should be easy to check
07:22TEttingerno... 3 6 works
07:22TEttingerbut that has, oddly enough, an invalid starting corner (3 is right on the top edge of the grid)
07:24TEttingerd'oh.
07:24TEttingeri had the < and > mixed up in the conditions.
07:25TEttingerreversing them fixes everything
07:26TEttingerthanks a bunch, everyone, especially Borkdude, I really need to take the print-debug advice to heart on simple stuff like this
07:27BorkdudeTEttinger np, in Emacs you have also (swank/break) which you can use for debugging
07:27TEttingerI use lein/eclipse
07:27BorkdudeTEttinger: ok you can then also use the debugger in eclipse
07:27TEttingeryeah
07:28TEttingerthough i don't know how much that would help with an infinite loop
07:28BorkdudeTEttinger: a lot I think, if you put the breakpoint within an iteration
07:29TEttingerthere's the other thing -- this part of the code had no room for extra function calls
07:29TEttingeran if, a recur, and two cond statements
07:30BorkdudeTEttinger: I would try to break up this functions in smaller pieces if possible
07:32BorkdudeTEttinger: for example, this could be a function: (< 0 (- (rem current-square 6) (rem target 6)))
07:35BorkdudeTEttinger: like this: https://gist.github.com/2718301
07:43robertstuttafordcmiles: do you plan to annotate away the reflection warnings in bishop?
07:43robertstuttafordcmiles74: ^^
07:44cmiles74robertstuttaford: Yep, I have to get that done. It's been a busy week over here but that's an easy thing to fix.
07:45robertstuttafordawesome. i was thinking it might be nice to include :keyword shortcuts for the common mimetypes, and also a simpler way to do (= :put (:request-method request)) in the cond blocks
07:45robertstuttafordperhaps (get? request)
07:45robertstuttafordor something
07:46cmiles74robertstuttaford: I'm not entirely happy with the way they request method is handled. It's pretty close to how webmachine does it but it feels clunky to me.
07:47cmiles74I'm thinking about having functions for each request method... I don't know, I don't want to make it too complicated either.
07:48robertstuttafordi just think that the number of http verbs is so low, it seems like it should be easy to code up a cleaner dsl for the verbs
07:48robertstuttafordand, as i said, handy shortcuts for the heavily used mimetypes
07:49cmiles74robertstuttaford: That definitely makes sense, you end up with the cond stanza for every group resource.
07:49cmiles74For the mimetypes, too, it'll help avoid mis-typing mistakes.
07:50robertstuttafordand most item resource, too, if you have get and update
07:50robertstuttafordi love how i can put all the route defs in with each service and compose them up in the app handler
07:51cmiles74robertstuttaford: I didn't even think of that use-case, it's just worked out that way. :D
07:52cmiles74The whole project has garnered more interest than I expected. It'd very encouraging. :)
07:52robertstuttafordkudos. you built something worth using!
07:53cmiles74robertstuttaford: Thank you! :)
07:53robertstuttafordwhy is delete not up in the cond stanza?
07:53robertstuttafordand instead in the function map afterward
07:54cmiles74robertstuttaford: Let me get the chart out...
07:54foxdonutjust came out of the shower?
07:55cmiles74This is a side-effect of how the protocol works, delete requests never make it down to the handler function...
07:55robertstuttafordoh, i see
07:56cmiles74robertstuttaford: I really stuck to the webmachine model as it was tested and people have been using it. Now that there's some code in place, there's room to make changes and experiment.
07:56robertstuttafordgreat
07:57cmiles74robertstuttaford: It's not clear to me that delete needs to be handled this way. It certainly makes it the odd request, that it's not part of the regular handler code.
07:58robertstuttafordit did seem curiously out of place down there
07:58bobryis there a validation library for clojurescript?
08:00foxdonutbobry: if not, you could hook into closure's validation
08:00cmiles74robertstuttagart: Looking at the code for the Ruby implementation, my guess is that there was a concern that the client would request a "delete" and that the handler function might not check the request method (it's not an actual requirement). Moving the code that handles each request method out into something else would let us handle delete in the same place as the rest of the methods, I think.
08:01bobryfoxdonut: sure, can you recommend any particular library?
08:01cmiles74Perhaps another map, with the request methods as keys and the handler functions as values, something like that.
08:01cmiles74tmciver is looking at another way of handling the request methods as well, it'll be interesting to see what he comes up with.
08:02robertstuttafordawesome. keen to see what comes of it
08:03robertstuttafordstuttagart? :)
08:03robertstuttafordnever had that one before
08:04foxdonutbobry: I meant google closure
08:04cmiles74robertstuttaford: Sorry! I was typing too fast. :P
08:05BorkdudeTEttinger: https://www.refheap.com/paste/2767
08:12ro_stthere. no more 16 character nickname
08:12ro_stis anyone using cemerick's friend?
08:13foxdonutro_st: :)
08:13cmiles74ro_st: :D
08:14bobryfoxdonut: ah, i'm not aware of any validation components in google closure, independent of the widget layer
08:16foxdonutbobry: the only other validation I'm aware of is within noir.. not sure how you'd use that on the cljs side of the equation.
08:17foxdonutbut given ibdknox's other clojurescript libraries, one for validation would be a good addition to the lineup
08:36beffbernardGood morning everyone
09:08bhenryis there a way to watch the *noir-session* or a ring session in general for changes?
09:09bhenrye
09:09duck1123bhenry: you could put some middleware right before the session middleware that monitors the :session key, would that work?
09:10devnbhenry: https://github.com/brentonashworth/sandbar
09:10devnsomething like that?
09:10bderooms_is letfn not used anymore in clojure 1.4? What should I use instead?
09:11devnbderooms_: what makes you think it's gone away?
09:11bhenry,(let [f (fn [] "hello")] (f))
09:11bderooms_no syntax coloring and an indication in the docs that I'm seeing version 1.2 of clojure
09:11clojurebot"hello"
09:12raek&(clojure-version)
09:12lazybot⇒ "1.4.0"
09:12devnbderooms_: which docs?
09:12Chousuke(doc letfn)
09:12clojurebot"([fnspecs & body]); fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+) Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body."
09:12raek&(letfn [(foo [] 123)] (foo))
09:12lazybot⇒ 123
09:12bderooms_http://clojuredocs.org/clojure_core/1.4.0/clojure.core/letfn
09:12bderooms_http://clojuredocs.org/clojure_core/1.2.0/clojure.core/letfn
09:13devnclojuredocs doesnt have 1.4 stuff at all i dont think
09:13bhenryclojuredocs doesn't have 1.4 yet
09:13devnso no surprise there
09:13bderooms_ah
09:13devnhttp://clojuredocs.org/clojure_core/clojure.core/letfn
09:13devnit's still in 1.3
09:14devnthere weren't that many big changes from 1.3 to 1.4, so you can still use clojuredocs without worrying too much about breakage between 1.3 and 1.4 FWIW
09:14bderooms_ok, thx
09:14devnnp
09:20ro_stcmiles74: if i wanted to add a header to the ring response returned by bishop, regardless of the route, where's the best place?
09:22ro_stin this case, i need to add a Access-Control-Allow-Origin header origin because the port clojure is serving from is different to the port that my client-side dev web server is using
09:23cmiles74ro_st: if you wait until your handler function is called, you can add your headers there: {:headers {"Bla-ba-bla" "somevalue"} :body "whatever"}
09:23cmiles74gothca'.
09:23cmiles74Well, you could you add your own middleware and have that higher up on the chain from your bishop handlers.
09:24ro_stso, right now my ring hander is: (def handler (-> (bishop/handler (merge {["*"] (bishop/halt-resource 404)} <a list of service/routes definitions>))))
09:25ro_sti've never written ring middleware before. would i prepend or postpend (bishop/handler) in this pipeline with my own handler?
09:25cmiles74I'm thinking what you'd do is insert your middleware that adds these headers before your bishop handler; bishop could then see these new headers (if you needed to check them, etc.)...
09:27cmiles74(def h (-> (rost/header-mw)...))
09:27cmiles74ro_st: Take a look here: https://github.com/mmcgrana/ring/wiki/Concepts
09:27cmiles74Down in the "Middleware" section they show how to add a "Content-Type" header, which sounds similar to what you're trying to do.
09:28cmiles74Code-wise, it looks straightforward. :)
09:29ro_stcool, thanks
09:29cmiles74ro_st: You are welcome :)
09:38RaynosDoes anyone use clojure directly with node ?
09:42brainproxyRaynos: beginning to :)
09:43lucianif it was self-hosted on node, it'd be so much better
09:43luciani so hate jvm start up time
09:43lucianand size
09:44brainproxylucian: in my latest release of node-clojurescript, you can compile cljs against a "detached" JVM
09:44brainproxye.g. you can do ncljsc --server 8000
09:44brainproxyand then compile with ncljsc --client
09:45brainproxythe --client process doesn't spin up its own JVM, so is more snappy
09:45Raynosbrainproxy: any recommended reading material on clojurescript + node is appreciated
09:45lucianbrainproxy: that's nice, things like that and nailgun to help
09:45lucianbut jvm startup is still stupid
09:48brainproxylucian: hadn't heard of nailgun, will take a look
09:50brainproxyRaynos: I'm reading the Clojure book from O'Reilly currently
09:50brainproxyRaynos: not sure of anything clojurescript specific just yet
09:51lucianthat's a nice book
09:51brainproxyRaynos: I do have some short examples in the node-clojurescript README, but nothing special ... next couple of days, I will be rewriting node-clojurescript in clojurescript, was originally in coffee
09:52brainproxyshould teach me a lot, and should serve as more examples of how the two fit together
09:53brainproxythough I imagine it will be awhile before I really code in idiomatic clojure/script
09:53Raynosbrainproxy: http://mmcgrana.github.com/2011/09/clojurescript-nodejs.html :D
09:53brainproxyRaynos: yah, that's good
09:53brainproxyI borrowed from that
09:53brainproxy:D
09:53RaynosI got past the easy stuff
09:53brainproxygotcha
09:54Raynosand then hes like "LISP ALL THE THINGS" and then Im like ._.
09:54brainproxywell, I'm just properly getting into it myself, not that I have most of the nodejs based tooling I want wrapped around the java based compiler
09:55brainproxythough there's still a lot more to do for that tooling ... in time
09:55brainproxy*now that...
09:55Raynosheh
09:57brainproxyRaynos: if you get a chance, try `npm install -g clojure-script`, give it a whirl and let me know how it works for you
09:57brainproxydefinitely looking for feedback
09:59lucianbrainproxy: trying. wants me to define java home. hmm
09:59brainproxyyah
09:59ambrosebsppl might be interested in an interview I gave about Typed Clojure http://t.co/NoNsBW7R
10:00brainproxysee the Prerequisites section
10:00brainproxyof the README
10:03pandeiroanyone else often have the urge to restart projects when they get to a certain size/level of disorganization (as opposed to going in and cleaning up the code)?
10:03lucianpandeiro: yes. resist that urge :)
10:04ro_stambrosebs: i read it earlier. very interesting!
10:05ambrosebsro_st: cool!
10:05pandeirolucian: then a bug on top of it comes in, and i just think, i might spend 1-2 hours tracking this down, why not just start clean?
10:05ambrosebsfwiw, any questions, shoot
10:05ro_stpandeiro: gosh, all the time. i'd never deliver anything if i listened to that urge, though
10:06lucianpandeiro: does it take 1-2h to rewrite? usually not
10:06ro_stambrosebs: it's a little above my head at the moment. i'm about 2 weeks into clojure
10:06ro_stlucian: maybe he maintains a fibionacci generator :)
10:10pandeirolucian: ro_st: yeah it's true but then i am a newbie coder and i typically make a big mess at the start... sometimes the architecture only becomes clearer after i try to write something
10:10lucianthat's normal
10:10lucianjust fix it slowly as you progress
10:11pandeiroyeah, internally i know that... and restarting carries with it the risk of total myopia... but still i am here stalling :)
10:11mtkoanthen restart.. if you have enough time to meet the deadline anyway
10:11mtkoanor if you don't it will be so painful you won't do it again
10:12lucianthere is such a thing as the second system effect
10:12lucianoften your second try will be over-architected
10:12pandeiroha yeah i have fallen into that already as well
10:12ro_stidentify the messiest mess, and break it up
10:13lucianwe have this 45kloc thing at work with tons of mistakes
10:13ro_strename stuff, re-org namespaces so that it's all more consistently named and composed
10:13lucianit's just so ridiculously big, rewriting is not an option
10:14pandeiroyeah actually my current scenario is changing part of an api, not refactoring per se (as in just compartmentalizing things further)
10:14pandeiroguess my real question is how to get better at nailing it the first time
10:14ro_styou don't. if you write it perfectly once, you're working well below your capability
10:14ro_stand you should find something more challenging
10:15pandeirowow, so this is our fate ey
10:15ro_stindeed :) embrace the chaos
10:15pandeirogoes well with caffeine
10:15ro_stincremental, continuous improvement
10:16pandeirodo any of you use mindmapping software?
10:16lucianit's part of why both dynamic languages and haskell are nice
10:16lucianand why so many people get annoyed with java/c++
10:16pandeiroi didn't know that existed until reading about freemind on hn yesterday
10:16lucianoh, and go also goes in the first list
10:16pandeirolucian: all i know is dynamic, maybe i need to do some time in the other group
10:17ro_stdon't do that to yourself :-)
10:17lucianindeed, unless you enjoy pain avoid java/c++
10:17lucianbut haskell is interesting statically, strongly typed, but also reasonable
10:17luciantypes in haskell help you, instead of getting in your way
10:18luciango is a little like that too because of the implicitly implemented interfaces
10:23pandeiroi find what rich says about hammock time to be really true, but once i sit in front of emacs, any clarity is gone within hours
10:24mrb_bkdnolen: sup dude, did the talks last night get recorded?
10:25dnolenmrb_bk: I don't know if anyone did a video recording. Sad good presentations.
10:25mrb_bkdnolen: Word, sad to miss good nerd-outs
10:26mrb_bkdnolen: you should come check out http://dev.paperlesspost.com/blog/2012/05/07/paperless-post-tech-talks-zach-holman/ if you're around next week
10:26dnolenmrb_bk: the paperless post tech talks looks awesome, will try to swing by.
10:26lucianpandeiro: change your editor! :)
10:26mrb_bkthey've been a good time
10:26luciani find it useful to write prototypes for ideas
10:27lucianand then apply to the ball of mud
10:28jweissRaynes: do you think it's straightforward to write a plugin to lazybot that evals expressions in a particular remote repl? (I'm thinking one without any sandbox security, more like a dev environment i share with my co-workers over irc)
10:28pandeirolucian: i am going to try out freemind to use for prototyping, maybe it will help
10:29pandeironot 'prototyping' per se but just organizing thoughts
10:43mmarczykdnolen: thickey: so, can we look forward to a recording of yesterday night?
10:46jsabeaudry_What is the name of the function that will insert x as the second element of every form ?(similar to ->)
10:46Bronsa->>
10:46jsabeaudry_I mean macro
10:47Bronsait will insert x as the last element, not the second though
10:47jsabeaudry_Bronsa, exact, and will then insert the first form in the last position on the second
10:50jamiiSince 'and' is a macro, what do I do instead of (apply and...
10:51pandeiroibdknox: any idea why + would be getting replaced by whitespace in form-post data with noir?
10:53jamiiI guess (every? true? ... works.
10:53duck1123jamii: I'm not sure what you're doing, but would (every? identity coll) do it for you?
10:53jamiiduck1123: Thanks
10:53raekpandeiro: in url-encoded data, + means the same as %20 and space
10:53pandeiroraek: ah thanks, does noir url-encode by default i take it?
10:54raekpandeiro: I don't know, but you shouldn't concatenate url-encoded strings with non-encoded ones, etc
10:56pandeiroraek: gotcha thanks, i'll dig into it
10:58raekpandeiro: if you see a + in the form data and not %2B (where the original had a "+") then the code that generates the form post data has a bug
10:59raek(since it doesn't perform the necessary escaping)
11:00pandeiroraek: all i see is a space actually when i examine the ring request
11:00raek(by "a + in the form data" I meant the actual data in the HTTP TCP stream)
11:00pandeiroraek: how would i inspect that?
11:02raekpandeiro: most browsers have some kind of dev tools that lets you inspect the payload. in Chrome for instance, you press F12 and go to the Network tab
11:02jsabeaudry_What is the proper way to write "this" in clojurescript (I tried "this" and "js/this")
11:03mmarczykjsabeaudry_: use this-as
11:03mmarczykjsabeaudry_: (this-as this ...use this here...) or (this-as self ...) or whatever
11:04jsabeaudry_mmarczyk, thank you very much!
11:04raekpandeiro: what thing contains the "+"? a form field value? a form field name?
11:04mmarczyknp
11:37pandeiroraek: i am trying to use himera's cljs repl service inside a noir app, so for right now i am just testing with curl -X POST ... -d 'expr=(+ 1 2 3)'
11:38pandeiro...and what i notice is that in any POST data to noir, + becomes space
11:47edwAnyone here use comb?
11:59TimMcpandeiro: Oh, so *you* have the bug.
11:59TimMcThat + should be %2B or whatever it is
12:01pandeiroTimMc: is it famous?
12:02pandeiroi am seeing if that's why himera uses wrap-clj-params middleware, b/c i can't find where noir is doing anything compojure doesn't do with post data
12:27pellebJust pushed a tiny demo app showing how to login to a noir app via OAuth2 in this case GitHub http://oauthentic.herokuapp.com/
12:27pandeiroraek: turns out i don't see a + nor a %2B in the form data when I inspect the POST req via chrome's network tab
12:27pandeiro...just a space
12:27pellebIt uses my little oauth2 client library https://github.com/pelle/oauthentic
12:30technomancybrainproxy: how much does your node repl re-use the built-in repl stuff in clojurescript? I haven't taken a good look, but from what I've seen the built-in stuff seems fairly browser-specific.
12:48TimMcpandeiro: {:expr (+ 1 2)} in Firefox
12:52pandeiroTimMc: I have the same problem regardless of client
12:53pandeirobecause noir's routing macro can't deal with unstructured data, my post data looks like 'expr=(list 1 2 3)' ... and it works fine... except w/ chars + and &
12:54pandeiroonly reason i discovered it quickly was b/c i have the (+ 1 2 3) habit every time i see a repl
12:55TimMcpandeiro: OK... I put (+ 1 2) into the console, the Chrome payload is {:expr (+ 1 2)}
12:55pandeiroTimMc: which console? the devtools or himera?
12:55TimMcThe Himera console.
12:56pandeiroyeah himera works fine
12:57pandeirohimera uses a pretty simple compojure handler with ring-clj-params middleware... so i think the problem is somewhere in noir
13:00TimMcNot if the server is receiving an unencoded +...
13:24Na-FiannHi, I'm trying to implement the factorial function for 4clojure, but it always returns 1, and I'm not sure why. Could someone help me? http://pastebin.com/HU2nJ4q5
13:25S11001001Na-Fiann: you have to wrap a function call in parens
13:25langmartinhowdy, I've got an interactive bug where *out* is getting set such that my debugging output is returned as a string rather than printed to the repl. Is there a way to track a dynamic variable to trace when it gets set?
13:25Na-Fiannohhhhh
13:25beffbernardI have a noir app and I'm thinking about putting my connection to the datastore in middleware as a thead-local. At that point, will there only ever be one thread handling the request?
13:25Na-Fiannthanks!
13:26beffbernards/thead/thread/
13:30dnolenso interacting with datomic from core.logic is pretty easy
13:30dnolenhttps://gist.github.com/2719676
13:42wkmanireHow does hash-map work? How does it process N pairs of args into keys and values?
13:44dnolenwkmanire: you could look at the source
13:44wkmanirednolen: Looking now actually.
13:44edwDoes anyone around here use comb? For templating?
13:46edwI have a problem: I'd like to incorporate a call to clojure.data.json/json-str in a template but the symbol isn't available in whatever context the macro is evaluated.
13:48wkmanireI think I see how this works.
13:52wkmanireBut I'm not sure what createWithCheck does.
13:52dnolenwkmanire: did you look at lines 83-94 in PersistentHashMap.java?
13:53wkmanireNot yet. Where is that?
13:54wkmanirenevermind, I found it.
13:55wkmanireBummer, it is literally iterating the sequence of args with a for loop.
13:55rhcdnolen: what does that bit of code do?
13:55dnolenwkmanire: what else should it do?
13:56wkmanireI'm not criticising the implementation.
13:56wkmanireI'm messing with clojure-py and unfortunatley the hash-map implementation is not compatible with the native dict objects.
13:56wkmanireAnd Tkinter takes dicts as args.
13:56wkmanireSo I'm trying to write a dict function which creates a dict with the same syntax as hash-map...
13:57wkmanireI was hoping to see that the hash-map implementation was pure clojure.
13:57dnolenwkmanire: you want to look at ClojureScript
13:57dnolenwkmanire: probably any new Clojure implementation should.
13:59wkmanirednolen: Ok. I'll look there.
13:59wkmanireheh, that's not good. I did a search for clojurescript on github and didn't find anything. I had to actually search the site using google.
14:00dnolenwkmanire: http://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L4995
14:00dnolenoops http://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L4994
14:01wkmanireI see.
14:01wkmanireSo I need to make an empty dict and then assoc the values in.
14:02wkmanirednolen: Thank you for showing me around.
14:02dnolenwkmanire: np
14:17langmartinas a followup, how can I recover the root binding of a dynamic variable?
14:17S11001001wkmanire: I believe there's a group function in itertools, which you can use to generate an arg for the dict ctor
14:18technomancylangmartin: .getRoot IIRC
14:18wkmanireS11001001: That sounds like a good idea.
14:18technomancy.getRawRoot rather
14:19langmartintechnomancy: ah!
14:20langmartinmaybe there's a better way to do this, how can I make sure my logs are printing to the real stdout rather than *out* as captured by with-out-str
14:20langmartinseems like merely doing (def out-handle *out*) keeps the new name dynamic as well
14:21technomancyyou could print to System/out
14:21langmartinah
14:21langmartintechnomancy: much nicer
14:30wkmanireheh, I was trying too hard.
14:31pandeiroraek: TimMc: think i solved the + issue... ring-clj-params binds *read-eval* to false when it processes the req body, and +'s show up... ring's own wrap-params does not, and they don't... could that be the trick?
14:31wkmanireS11001001: (defn dict (py/dict (partition 2 keyvals)))
14:32wkmanireoops
14:32wkmanireforgot the args
14:32TimMcpandeiro: *read-eval* should only affect #=() behavior
14:32wkmanire(defn dict [& keyvals] (py/dict (partition 2 keyvals))) ;; thats better
14:35rudaI've made a search for the Jenkins page which contains the status of Clojure (-Contrib?) builds , but I didn't succeed. Do someone know what is the URL for this?
14:37S11001001cool
14:38pandeiroTimMc: yeah that's not it at all apparently ... huh
14:39S11001001fyi anyone not watching, there's a boston clojure meet tonight at 7 in cambridge
14:39technomancyruda: should be build.clojure.org
14:40technomancystill using hudson =(
14:40rudatechnomancy: yes, that's it. Oh, Hudson yet
14:40rudatechnomancy: but thank you
14:41technomancynp
14:44mheldam I not using recur properly in http://pastie.org/private/3xqasiywietiyuisw1igoq ?
14:46solussdis there a way to "reload" / rescan my class path from the repl? I just 'lein reps' myself some new jars and i'd like to be able to refer to stuff in them from my running repl
14:46solussdusing slime/swank
14:46mfexmheld, you probably want to use s in the recur, this looks like an infinite loop because
14:46mheld /what would be the proper clojure way of turning (make-world 5) into (list 0.2 0.2 0.2 0.2 0.2) (where the length of the list is 5 and each of the values is 1/5)?
14:47mfex.. because the recur is always with the same values
14:47mheldoh, I'm just being silly
14:47metellusyeah, you want (- s 1)
14:47mheldyeah, s
14:47S11001001mheld: try using map over a range instead
14:48mheldthat'd work too
14:48mheld(map (fn [n] (/ 1 4)) (range 4))
14:48mheldbeautiful
14:49mfex(repeat n (double (/ 1 n)))
14:49mheldthere are a lot more neat little helper functions in clojure than in scheme
14:50technomancysolussd: nothing built-in yet, you would have to call pomegranate directly
14:51mheldthanks guys :-)
14:51solussdk thanks
14:55technomancyfeel free to build what you are asking for; it sounds cool =)
15:00johnfnis there anything better than nested for statements to loop through a 2d array? i.e. (magic [[1 2] [3 4]] #(+ % 1)) ; -> [[2 3] [4 5]]
15:01johnfn(or even better, an n-d array)
15:02dnolenjohnfn: I'm assuming you mean vector when you say array
15:02johnfnright
15:02johnfnold habits :)
15:02S11001001johnfn: I'd use a map in a map, but I hate for, so ignore me
15:03dnolenjohnn: and by for statement - you mean list comprehension?
15:03johnfnhm i guess. wasn't aware that calling them for statements was wrong
15:05dnolenjohnfn: they aren't imperative for loops - they are list comprehensions.
15:06johnfnyeah. but they do have the word "for" in them
15:06johnfnfor macro?
15:07dsantiagoHey weavejester, I wrote a tiny wisp of a thing to make HTML into hiccup: http://github.com/davidsantiago/hickory
15:09weavejesterdsantiago: That's interesting. How does JSoup compare to TagSoup? I know there's a clj-tagsoup project that does something similar...
15:09dsantiagoYeah, I used to be using clj-tagsoup, it's kind of a mess. chouser ran across two bugs in it on the very first try, which is why I switched to Jsoup. Seems a lot better.
15:10weavejesterI've been using clj-tagsoup for some projects of my own; I might switch over, as your implementation seems cleaner
15:10weavejesterI'd be tempted to convert to a clojure.xml compatible DOM first, though.
15:13weavejesterBut that's mostly because I'm more interested in parsing HTML using XML zippers.
15:17neotykhello everyone?
15:17dsantiagoYeah, so clj-tagsoup seems to work by extending an implementation class from tagsoup. It drops doctype and it doesn't properly parse text nodes between tags.
15:17dsantiagoJsoup does a lot better.
15:17weavejesterneotyk: Hello
15:18weavejesterdsantiago: I'll think switch to JSoup, then! Though I'll need the output in a clojure.xml data structure, rather than a hiccup data structure.
15:19dsantiagoI was looking at making it go into the clojure.xml thing, but it looked like it was not quite clear to me how to handle some HTML things in the format, like doctype.
15:21dnolenneotyk: about CLJS-204 I think you're not understanding my point.
15:21dnolenneotyk: are or are not those cases already handed by goog/defaultCompare
15:21dnolenhandled
15:21weavejesterdsantiago: Fortunately for me, I don't care about the doctype ;)
15:22neotykdnolen: not sure, decided to perf test it
15:22dnolenneotyk: sure, but I'm pretty sure it will be slower
15:22neotykdnolen: having special cases?
15:22dnolenneotyk: everything has to go through the slower path of protocol dispatch.
15:23dnolenneotyk: if they are already handled by goog/defaultCompare and more efficiently - there's not need for those extend-types
15:23dnolenno need
15:24dnolenneotyk: for example - the whole ns string comparison, what is that for?
15:24neotykdnolen: keywords and symbols
15:25dnolenneotyk: aliased keywords get expanded. why can't that be a normal string equality test.
15:27neotykdnolen: w/o special handling of strings ##(= -1 (compare :c :a/b)) failes
15:27lazybot⇒ true
15:28TimMcS11001001: Will you be at the meetup?
15:29S11001001TimMc: yes
15:29TimMcCool. I don't think I've met you.
15:29S11001001been there before?
15:29TimMcLast two.
15:29S11001001I've been to all :)
15:30jsabeaudry_I have an object whose state is false but cljs.core/truth_ returns true?!
15:30TimMcjsabeaudry_: (Boolean. false)
15:30dnolenneotyk: the patch is doing too much
15:31dnolenneotyk: lets just get the case specified in the ticket working.
15:31dnolenneotyk: comparison of keywords / symbols separate ticket.
15:32dnolenneotyk: compare on arrays in Clojure on the JVM does not work.
15:32neotykdnolen: fair enough
15:33dnolenneotyk: compare on numbers via protocols will be very slow
15:33dnolenneotyk: same for booleans
15:33dnolentake those out.
15:33jsabeaudry_TimMc, close, that object was in fact an atom that I forgot to deref
15:33TimMcAh!
15:42amalloydnolen, neotyk: who cares which direction (compare :c :a/b) goes? all that matters is that it's consistent, and that (compare :a/b :c) goes the opposite direction
15:43pandeiro,(java.net.URLDecoder/decode "(+ 1 2 3)")
15:43clojurebot"( 1 2 3)"
15:43dnolenamalloy: the Clojure order seems natural to me.
15:44amalloy&(compare :c :a/b)
15:44lazybot⇒ -1
15:44TimMc15:41 < pandeiro> ,(java.net.URLDecoder/decode "(+ 1 2 3)")
15:44TimMcargh
15:44halmbert
15:44halmbert/join #haskell
15:44TimMc,(java.net.URLEncoder/encode "(+ 1 2 3)")
15:44clojurebot"%28%2B+1+2+3%29"
15:44amalloyso, :c is "less than" :a/b? i'm not sure what's natural about that - i guess you're saying any non-namespaced keyword is less than any namespaced one?
15:44TimMc&(compare 1 2)
15:44lazybot⇒ -1
15:45neotykamalloy: exactly
15:45amalloypersonally i'd imagine :c being greater than :a/b, because i'd sort first by name and then by namespace, but clojure does it differently and i've never noticed
15:45neotyk$(compare 'a/b 'c/a)
15:45TimMcamalloy: Presumably it is a lexical sort on namespace (possibly empty) and name.
15:46neotyk&(compare 'a/b 'c/a)
15:46lazybot⇒ -2
15:46amalloyand i don't really expect anyone to notice in cljs either, but they will (as dnolen says) notice the perf hit of doing it slow instead of fast
15:46neotyk&(compare ['a 'b] ['c 'a])
15:46lazybot⇒ -2
15:46michaelr525hello
15:49boyscaredquestion: i've created a test project with `lein new'. i want to get a clojure REPL up in emacs that loads the project like `lein repl' does. is this possible?
15:51boyscaredrunning M-x clojure-jack-in just gives the user=> prompt, but i wanted one that loads the entire project
15:51amalloylein repl doesn't "load" the project either
15:52TimMcSure it does. Or, it can.
15:52neotykcompile it
15:52TimMclein repl uses :main or :repl-init to require a ns
15:52boyscaredjust started with clojure, so my verbiage may be off some
15:53wkmanireboyscared: Welcome to my club :)
15:53neotykboyscared: C-c C-k in ns that you want to 'load'
15:56S11001001or C-c C-l, depending on how you want errors to manifest
15:57dsantiagoweavejester, I can take a crack at it in hickory if you give me some feedback about the data structure format.
15:57raekBlackavar: after the C-c C-k (or equivalent) you can use C-c M-p to enter the namespace in the REPL
15:58boyscaredah thanks
15:59raekBlackavar: oh, sorry! wrong nick :)
16:00Blackavar*nod* I gathered after the popup, heh.
16:03a-questionhello, does clojure have nested namespaces?
16:04raeka-question: not really
16:05RaynesOH GOD MAKE IT STOP.
16:05a-questionwhat :)
16:06RaynesNothing in particular.
16:06Raynes:)
16:06raekyou often organize namespace names hierachially, but that only affects their names and their location in the file system
16:06tmciverThe voices in his head
16:06a-questionit would be very helpful
16:06a-questionwhen you have a lot of code
16:06a-questionI think...
16:07RaynesWell, you can have src/foo/bar.clj and src/foo/bar/stuff_related_to_bar.clj, etc.
16:07neotykis a.b nested in a ?
16:07RaynesNope.
16:08RaynesIt's just looks like it is.
16:08neotykRaynes: I know
16:08neotyka-question: is it?
16:09a-questionso it's like nesting acutally
16:10nDuff...
16:11raeka-question: you can still factor out some of the code of a namespace to a separate namespace
16:11neotyknesting would be if some automatic require/use would happen
16:11TimMca-question: You can't ask for a namespaces "children" or "parents", so... nope.
16:12TimMc*namespace's
16:13neotyka-question: namespace is like package
16:14a-questionI see
16:14a-questionI need to test it in repl
16:14pandeiroTimMc: so were you showing me URLEncoder/encode b/c i should encode all request bodies before letting ring-params parse them or...? any suggestions?
16:15TimMcpandeiro: Yes, except it needs to be done on the client side, whether that is curl or a web page.
16:15TimMcMight need to fiddle with jQuery.ajax's parameters, for instance.
16:16a-questionthanks bye
16:16pandeiroTimMc: i think that's kind of more complex than necessary
16:16pandeiroeasier to just eschew ring-params and slurp the body myself
16:16pandeirothat's all ring-clj-params does
16:39Bronsawtf
16:39alex_baranoskywtf?
16:39solussdindeed..
16:39solussdanyone download it? :)
16:40FDFlockSOMEONE BAN THAT IDIOT! He's spamming DCC requests
16:40FDFlockJesus
16:41nickmbaileyaha, was wondering what channel that was coming from
16:42rmunnThe "Received a CTCP dash_is_autistic_join_#calculus_#untwisted from jooohnasOberg (to #clojure)" line in my backlog looks suspicious to me... someone may have just exploited a bug in Freenode's server code
16:42duck1123I had just added another service when those popped up. I assumed they came from there
16:42AimHereYou sure it's a bug, rather than some bot firing off ctcp/dcc requests to troll freenode?
16:42AimHereLots of people appear to have had the same spam
16:42tensorpuddinghmm, ctcp spam to join #calculus, sounds like Tau
16:42FDFlockit sure seems like the latter to m e
16:43FDFlock*me
16:43rmunnNow I wish I *had* downloaded that file, I could have looked inside and seen what it was...
16:43amalloyi tried to accept, but he'd disco'd already
16:43tensorpuddingbut hmm
16:43tensorpuddingtalking about dash, dash doesn't hang here
16:43rmunnNah, you're right, it was just CTCP spam now that I take a closer look at it
16:43tensorpuddingis he staff
16:53gfredericks$google lein jenkins
16:53lazybot[Lein Jenkins | LinkedIn] http://www.linkedin.com/pub/lein-jenkins/43/3aa/3a2
16:53gfredericks^weird
16:53technomancyhaha
16:53aperiodichaha, i thought it was a jenkins plugin for leiningen
16:54technomancysomeone was offering a $300 bounty for lein-jenkins
16:54technomancyI hope they don't hunt this guy down by accident.
16:54aperiodicdead or alive?
16:56gfredericksI had no idea Lein was a given name
16:56gfredericksyet
17:00TimMcgfredericks: I named my first-born after lein.
17:01progolein new, baby. All the way
17:01ibdknoxLight Table officially has a second corporate sponsor: Thought Works :)
17:01duck1123nice
17:02RaynesThought Works is a cool company.
17:02RaynesBut I have a soft spot for Ola Bini.
17:02RaynesIoke was a cool experiment.
17:04gdulusis there anything like official web page for light table?
17:04ibdknoxgdulus: haven't had the time yet
17:04ibdknoxsoon though
17:04ibdknoxI'm 4ish days away from releasing the second demo
17:05ibdknoxAlso I'm happy to announce that I'll be speaking at several places this year about it :) OSCON, Strange Loop, and Oredev are confirmed
17:06gdulusanything near berlin?
17:06brehautor new zealand :P
17:06ibdknoxOredev is in sweden
17:06gfredericksibdknox: I assume if your SL talk is good it will be scheduled alongside the other top 4 talks
17:07TimMcWhere is Strange Loop?
17:07gfredericksbrehaut: alright, it's been long enough. Time to drop the "new"
17:07TimMcMiddle US again?
17:07ibdknoxhahahaha
17:07brehautgfredericks: lol
17:07TimMcNew Sealand
17:07ibdknoxTimMc: St Louis
17:07gfrederickswhich is short for Stree Louis
17:07gfredericksStreet*
17:08TimMcgfredericks: There's a St Stephens St in Boston.
17:08gfredericksTimMc: you mean boSTon
17:09TimMcBotolph's Stone
17:10jsabeaudry_Is a top-level def thread local?
17:11gfredericksits root binding isn't
17:11gfredericksif you make it dynamic you can give it thread local bindings
17:11jsabeaudry_This example is correct not matter how the threads are spawned: http://clojuredocs.org/clojure_core/clojure.core/locking ?
17:32langmartinjust to make certain, can I count on each message sent to an agent only being executed once, so that it's safe to perform a side effect in the agent?
17:33brehautthey get chucked into a queue, so i presume so
17:34raek-erclangmartin: at most once, yes
17:36langmartinraek-erc: is there an at least case where they never fire at all?
17:37langmartinjust validate-fn returning false?
17:37langmartinthat's fine
17:37S11001001langmartin: send in transaction, abort transaction
17:38langmartinI just shouldn't have been buffering a shared network thing with an atom, and I want to make sure I'm not making the same mistake with an agent
17:38raek-ercI was thinking of the case when the agent is in error state
17:38raek-ercbut then sending to it results in an exception, I think
17:39technomancyraek-erc: how's erc treating you?
17:39amalloysend an agent an infinite loop: any future sends will never fire
17:39raek-ercanother case when it doesn't get executed is when a previous action is stuck in an infinite loop
17:39langmartinwell, sure
17:39langmartinok
17:39raek-erctechnomancy: it works prety well, I think
17:40langmartinI think I've got it then. phew. I (stupidly) was using an atom as the buffer, and things worked fine until the first time swap! tried to apply the update multiple times
17:40langmartinwhich turned out to be hard to trigger on purpose
18:45JorgeBwhat's the memcached lib to be using nowadays?
19:45espeedWhen implementing a protocol, can an overloaded method call its overloaded counterpart?
19:45brehautespeed: err… that implies inheritance does it not?
19:46brehautand theres no inheritence with protocols
19:46brehautoh wait. overloaded, not overridden. excuse me
19:46espeedno inheritance -- just overloading on arity
19:47dnolenespeed: yes, protocol methods always take the object as the first arg
19:47dnolenespeed: so just call the other arity on the object
19:50espeeddnolen: I'm getting an "unable to resolve symbol" https://gist.github.com/2722321
19:51dnolenespeed: more context, what's the protocol definition look like.
19:51dnolen?
19:51espeed (create-edge [this outV label inV] [this outV label inV data])
19:52dnolenespeed: also less context, try it on a trivial example and see if that doesn't work.
19:55espeeddnolen: I had it working earlier in SLIME when I compiled it with the first function and then went back and added the second; now I moved the protocol definition into a separate file and tried to re-compile the whole thing, and it throws an error when the second method tries to call the first, presumably because the first method hasn't bee defined yet
19:55espeedjust wondering if it's supposed to work
19:56dnolenespeed: yes
19:58espeedthen I read: " If a method is overloaded in a protocol/interface, multiple independent method definitions must be supplied" (http://clojure-examples.appspot.com/clojure.core/reify) -- these are not *independent* definitions
20:01mebaran151hey #clojure, do defrecord's guarantee that they enumerate in the order that their keys are declared?
20:06dnolenespeed: not sure I follow.
20:18espeeddnolen: I tried to explain it more clearly here: http://stackoverflow.com/questions/10645155/when-implementing-a-clojure-protocol-can-an-overloaded-method-call-its-overload
20:19amalloyespeed: your namespace didn't refer to the protocol function, only the protocl itself
20:21espeed??
20:21lazybotespeed: Uh, no. Why would you even ask?
20:22dnolenespeed: protocol fns are just regular functions - you need to bring create-edge into your namespace.
20:22dnolenwell ... almost regular fns.
20:30jweissanyone know of a solution where two people (remote from each other) can work on the same codebase and have two repls connected to the same process? I think getting a 2nd repl is straightforward enough, but you wouldn't be able to see edits the other person makes to source files.
20:30technomancyjweiss: tmux is absolutely the way to go
20:30technomancysee if you can bribe zkim to finish http://pair.io because it is amazing =)
20:38devnwoohoo! the perennial "I wonder if I can have clojure without parens to enhance adoption..." blog post! :D
20:38devnhttp://lmf-ramblings.blogspot.com/2012/05/clojure-with-python-syntax-part-ii.html
20:38gfredericksif you both have dual monitors, set up two tmux sessions with one emacs server.
20:38jweisstechnomancy: with tmux i assume that everyone sees the same thing all the time?
20:38technomancyjweiss: right
20:39technomancydevn: we were overdue
20:39hiredmanyou can change that
20:39jweissi was hoping for more like a shared filesystem and two repls, where each connected person could do different things, but see the same files
20:39technomancyit's been nearly a year since the last one
20:39technomancyjweiss: you can do that, but it's not very good for pair programming
20:39devntechnomancy: it's cool though. when i see a post like this i just know this guy is going to realize why you can't just drop parens and call it clojure
20:39gfrederickstechnomancy: my idea enables that pretty well
20:39devnand that moment is a major "ah ha"
20:40devnim excited for him honestly
20:40jweisstechnomancy: ok i think tmux will probably work. thanks!
20:40technomancygfredericks: yeah, it depends what you want I guess.
20:40technomancyI'm not sure what that kind of setup would be needed for but I guess it has its uses.
20:40jweisslisp has been around since 1958, people have been trying to get rid of parens, since, what, 1959?
20:41gfrederickstechnomancy: no. all of my ideas apply universally.
20:41devnlol gfredericks
20:41devn(apply ideas universe)
20:41gfredericksdevn: I was trying to express that idea without the parens
20:41technomancyhah
20:46gfredericksdevn: is that last comment yours?
20:47technomancywow, there are some good counter-trolls in that comment thread
20:47technomancy"Also, Python syntax is the reason why interpreter is slow and can't be considerably speed up (the same applies for ruby)"
20:47brehauttechnomancy: O_o
20:48technomancybrehaut: there's more: "The second issue is how it will be quite hard to make Python-like language functional with immutable data without complicating the syntax."
20:48brehauti missed the link
20:48technomancyI can't tell if this commenter is for real or not
20:48technomancyhttp://lmf-ramblings.blogspot.com/2012/05/clojure-with-python-syntax-part-ii.html
20:48brehautthanks
20:50TimMctechnomancy: Whitespace makes Python slow because the compiler has to use computer vision, which is still inefficient.
20:50TimMc*Significatnt whitespace
20:50technomancyhahaha
20:50brehautAlso, python uses a lot more colons than other languages. It's well known that colons take twice as long to process as semi-colons
20:51kkreamerWait... what? You mean someone is *wrong* on the Internet?!
20:51technomancySBCL is fast because parens give the code a more aerodynamic shape.
20:51dnolentechnomancy: haha
20:52technomancydnolen: not as fast as XML though, for obvious reasons.
20:53devnIs anyone familiar with "reduction semantics"? What does that mean?
20:53dnolendevn: you talking about the new reducers stuff?
20:56devndnolen: no, reading backus' turing award lecture
20:57devnchoice quote thus far: "Conventional programming languages are basically high level complex versions of the von Neumann computer."
20:57devnhttp://www.stanford.edu/class/cs242/readings/backus.pdf
20:57hiredmanmost likely means the substitution model
20:57hiredmanhttp://mitpress.mit.edu/sicp/full-text/sicp/book/node10.html
20:58devndnolen: he writes: "Or can a 'program' be successively reduced to simpler 'programs' to yield a final 'normal form program,' which is the result (reduction semantics)?
20:58devnI guess I'm trying to understand what that looks like.
20:58gfrederickshiredman: did you imply earlier that tmux can be more flexible than mirrored screens? I would like to know how.
20:59devnhiredman: thanks, reading now
20:59devnhiredman: oh. beautiful. yeah i think this is the ticket. thank you again.
20:59hiredmangfredericks: wemux is a set of scripts around making pairing with tmux better, but I've never used it
20:59gfrederickshiredman: okay, thx
21:00hiredmanthere is some way to launch tmux so that it starts a new session connected to an existing set of windows or something which lets you share a tmux but look at different things
21:01devnwemux is pretty sweet
21:01devnpair.io is sweeter. zkim needs to finish that.
21:02hiredmansomething like tmux -S /tmp/tmux-1000/pair new-session -t 0 where /tmp/tmux-1000/pair is an existing tmux socket, I think
21:02devnyou just rattled that one off?
21:02gfredericksoh man I've been using -S this whole time when I should have been using -L
21:03hiredmangrepped my .zhistory for tmux
21:03devngfredericks: you may need to make the session world readable/writeable
21:03devn(if you're using separate user accounts (i didnt want my pair having full access to my entire machine))
21:03hiredmanyeah, -L for new sessions -S for attaching to existing
21:04gfrederickshiredman: my impression from the man page is the diff there is just name vs full path
21:04gfredericksyeah I just used -L for creating and for attaching
21:06devndnolen: have you read that backus paper?
21:06dnolendevn: I have not
21:06devnerr the turing award lecture?
21:06devnalan dipert was telling me about what he's discovering in the FP language.
21:07devnbackus died while he was in the middle of his research. he said it is the "haunted house of functional programming"
21:07devnhe defines things like: (comp (juxt f g) h) == (juxt (comp f h) (comp g h))
21:08devnim still way newb on this, but it's really interesting to me so far, thought you might enjoy it
21:08gfredericksso comp is distributive over juxt?
21:09devnhttp://en.wikipedia.org/wiki/FP_(programming_language)
21:09devnit's inspired by APL, so bring your symbol +6 goggles of symbol comprehension
21:10gfrederickswithout having looked at that wikipedia article yet I think I might have seen that in my PL class
21:10gfrederickswith accompanying video
21:10devnvideo!?
21:10clojurebotsicp videos is http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
21:10gfredericksby backus
21:11devni wonder if that's online somwhere...
21:11gfredericksplease excuse me if I'm remembering something else though
21:12devngfredericks: if you can find that video id be interested to see it
21:12gfredericksdevn: I wouldn't know how to find it any better than you, except to put you in contact with the prof
21:13devngfredericks: if you have an email ill ask him, sure
21:13gfredericksk I'll pm
21:13devncool. thanks
21:17espeeddnolen: the problem was that I had the syntax wrong (http://stackoverflow.com/questions/10645155/when-implementing-a-clojure-protocol-can-an-overloaded-method-call-its-overload/10645457#10645457) -- thanks Charles
21:21dnolenespeed: that answer is not correct the second one is.
21:35mebaran151is their a simple way to take a nested hash-map and extract the nested keys into a vector (similar to what would be passed to get-in)?
21:37devntechnomancy: lein2 is acting weird on me. lein2 push is looking for a pom.xml in the target dir but none exists
21:37technomancydevn: upgrade the plugin
21:38technomancyalso: we'll have lein deploy working with clojars shortly
21:39technomancyhopefully soon scp will be a legacy thing
21:39chouserdsantiago: you're awesome
21:39devntechnomancy: cool. thanks.
21:41devntechnomancy: should i quit trying to use both lein and lein2 together?
21:41technomancydevn: is there anything keeping you on lein1?
21:41chouserdsantiago: tinsel 0.4.0 works well
21:41devntechnomancy: that just answered me question. thanks.
21:53devnheh: [midje "1.0.0-COLLECTORS-EDITION"] A TDD library for Clojure, with an emphasis on mocks
21:54devntechnomancy: search in lein2.. maybe im doing it wrong but it didn't find the most recent version
21:54technomancymaybe your indices are out of date
22:06dsantiagochouser: Great! I'm glad that fixed it. Sorry about the initial problems.
22:06technomancyamalloy: holy smokes; just running the numbers on the channel logs and you have nearly twice as many lines as the next two participants combined
22:07amalloytechnomancy: yeah, i came to that realization around the time of last year's conj, when i was seeing if i could get away with calling myself the most active participant on #clojure
22:08amalloyplus
22:08amalloysometimes i inflate it
22:08amalloytalking like this, you know?
22:08technomancyI was wondering about that
22:09devntechnomancy: you run numbers on the logs? any reason why?
22:09devnhttps://gist.github.com/2722720 -- any tips for making process-line less disgusting?
22:09amalloybut i bet you'd find roughly similar numbers if you counted characters. i do plenty of longer messages to make up for the clipped ones
22:09technomancydevn: working on an article on distributed workers
22:09technomancylog analysis is a nice approachable sample problem
22:10technomancyamalloy: sure
22:10technomancyyou
22:10technomancydo
22:13devntechnomancy: for heroku or for your blog?
22:13technomancyfor heroku
22:14devncool. looking forward to seeing it. can i make a request that you post something on using datomic with heroku mebbe?
22:15technomancymost of the devcenter sample apps stick with heroku addons
22:15devnwhich begs the question... :)
22:16fil512how do I flatten a map into a list of vectors? {'a
22:16technomancyI don't really think datomic needs more docs on how to use Clojure with it.
22:16devn&(into '() (seq {:a 1 :b 2}))
22:16lazybot⇒ ([:b 2] [:a 1])
22:16devnerr duh
22:16devn&(seq {:a 1 :b 2})
22:16lazybot⇒ ([:a 1] [:b 2])
22:17fil512sorry i wanted to write the example
22:17fil512it's actually a map of maps
22:17devnfil512: sure, go ahead
22:17fil512the keys i want in the first two columns
22:17devnfil512: give the input and expected output
22:17fil512my syntax might not be right
22:18fil512{:a {:x (1 2) :y (3 4)} :b {:x (1 2) :z (5 6)}}
22:18fil512not sure if I wrote that right
22:19dsantiagochouser: Also, did yo usay you were interested in analyzing the HTML as if it was the data structures from clojure.xml?
22:19fil512for output I want (:a :x 1 2) (:a :y 3 4) (:b :x 1 2) (:b :z 5 6)
22:19devnfil512: im thinking something in clojure.walk is what you want
22:22fil512clojure.walk looks heavy for what I need
22:23fil512i just need to flatten a couple of nested maps
22:24xeqi&(mapcat (fn [[k v]] (for [[k2 v2] v] (concat [k k2] v2))) '{:a {:x (1 2)\ :y (3 4)} :b {:x (1 2) :z (5 6)}})
22:24lazybotjava.lang.RuntimeException: Unsupported character: \ :y
22:24xeqi&(mapcat (fn [[k v]] (for [[k2 v2] v] (concat [k k2] v2))) '{:a {:x (1 2) :y (3 4)} :b {:x (1 2) :z (5 6)}})
22:24lazybot⇒ ((:a :x 1 2) (:a :y 3 4) (:b :x 1 2) (:b :z 5 6))
22:25xeqithough thats limited to a single nesting
22:26devnxeqi: nice.
22:28devnxeqi: stole your solution for clojuredocs :) http://clojuredocs.org/clojure_core/clojure.core/mapcat
22:43fil512um
22:43fil512is it a coincidence
22:43fil512or
22:43fil512how come when I'm reading the example for mapcat
22:43fil512I'm reading my example?
22:44fil512holy crap defn just edited it 16 minutes ago!
22:44fil512you guys are freakin me out
22:44brehautman, using for in a mapcat seems so weird to me
22:45brehautdoubly so to also be using a concat in it
22:46fil512i kinda figured if I'm using "for" in clojure I'm probably doing something wrong
22:47fil512'cause I never know what to put once I'm in the inside of the loop
22:47emezeskefil512: That specific example aside, "for" is a very, very good thing to use in clojure, in general
22:47fil512but often what you're doing is mapping from one collection to another
22:47fil512if you use a for loop
22:47fil512then inside the loop, the natural thing to do is to add your item to the output collection
22:47emezeskeExactly.
22:47fil512but adding items to a collection is an anti-pattern in clojure
22:48emezeskeNatural, maybe, if you come from an imperative background
22:48emezeskeAnyway, "for" is great, get used to using it a lot and you will be happy
22:48fil512I think what I want to do is something like this:
22:49brehautfor is perfectly functional. its not imperative for (thats doseq)
22:50fil512(collect into collectionX using fn (for [ x (...) y (...) (fn (x y stuff))]))
22:50fil512but I don't know how to do that
22:50brehautthere is nothing at all wrong with using for to do a mapping
22:51brehaut,(into {} (for [x (range 3) y [:a :b]] (vector x y)))
22:51clojurebot{0 :b, 1 :b, 2 :b}
22:51fil512yes yes!
22:51fil512that is the kind of thing I am looking for
22:52fil512let me give that a try
22:53brehautthat is incidentally a weird example, because the map keys will overwrite each other
22:53xeqi&(for [[k v] '{:a {:x (1 2) :y (3 4)} :b {:x (1 2) :z (5 6)}} [k2 v2] v] \
22:53lazybotjava.lang.RuntimeException: EOF while reading character
22:53xeqibah
22:54fil512that is exactly what I needed
22:54fil512my code looks like this
22:54fil512(defn get-report [records-bh-bd]
22:54fil512 (into ()
22:54fil512 (for [host (keys records-bh-bd)
22:54fil512 date (keys (records-bh-bd host))]
22:54fil512 (let [uptime (get-uptime ((records-bh-bd host) date))]
22:54fil512 (vector host date uptime)
22:54fil512 ))))
22:54brehautfil512: use refheap.com for multiline code blocks
22:55fil512will do. sorry bout that.
22:55xeqiyou guys are right, that was weird code
22:55xeqia single for on the outside is good enough
22:55fil512so I don't need the "into"?
22:55technomancyfil512: you don't need to pour the result of for into a seq; it's already a seq
22:56fil512sweet
22:56fil512damn I love clojure
22:57fil512for my output, I'm getting a sequence of vectors I call "report"
22:58fil512when i try to print the last vector, it prints all of them
22:58fil512I do (println last report)
22:58fil512shouldn't last report give me the last vector?
22:58fil512oh
22:58fil512stupid me
22:58fil512never mind
22:59foxdonut:D
22:59fil512(println (last report))
22:59foxdonut,(vector "host" "date" "uptime")
22:59clojurebot["host" "date" "uptime"]
22:59foxdonut,["host" "date" "uptime"]
22:59clojurebot["host" "date" "uptime"]
23:00foxdonut,(= (vector "host" "date" "uptime") ["host" "date" "uptime"])
23:00clojurebottrue
23:03fil512do you keep your tests in the same ns as the code under test?
23:07fil512do you write tests?
23:07technomancymost people keep them in separate files
23:07fil512i do too
23:07fil512I was curious if you use a different ns
23:07fil512I'm finding I need to use different names in my test files to avoid collisions
23:08fil512was wondering what most ppl do
23:08fil512in java we usually use same package...
23:08technomancyjust use `lein new myproject` and work from there
23:09fil512that's not going to tell me whether test files use same namespace as code..?
23:09technomancysure it is
23:11PeregrinePDXThe default files created with lein new has a test file and it is in a seperate namespace
23:12fil512thanks pere
23:12fil512I'm pretty happy with eclipse / maven for now
23:13PeregrinePDXlein doesn't replace eclipse.
23:13fil512i know, but it does replace maven and counterclockwise
23:13fil512(counterclockwise is the REPL plugin for eclipse)
23:14technomancycounterclockwise works with Leiningen
23:15fil512but maven plays so nice with the java world
23:15PeregrinePDXBut clojure is not java....
23:15brehautlein is like tasty, lickable icing on top of the not so taste maven cake
23:16PeregrinePDXIt runs on the jvm and is interoperable but it is not java.
23:16brehautalternatively you can think of lein as maven without the burnt scalp
23:17fil512brehaut: lol
23:17brehauttalios would disagree ;)
23:17fil512I anticipate needing to call java from my clojure projects
23:18fil512so managing all the deps in maven feels like it makes sense
23:18brehautfil512: lein uses maven under the hood to handle all its deps. lein dependancies are maven dependancies
23:18taliosNothing wrong with leiningen, and I whole heartedly recommend it for clojure only projects, I still find maven works nicer with multi-language projects tho - but then, you can mix and match
23:20brehautfil512: look at https://github.com/mmcgrana/ring/blob/master/ring-jetty-adapter/project.clj
23:20brehautfil512: thats the project file for the ring jetty adapter. it depends on both clojure code (ring/…) and a java code (org.eclipse.jetty/…)
23:21brehautanything that lets me compile basic with lein is a win in my book
23:21fil512yes but what if I have a large project with java parts and clojure parts and there are parent poms that manage versions across projects etc etc
23:22fil512not to mention our corporate repository...
23:24technomancynothing you've said is specific to maven
23:24technomancyI mean, use what you like, but just so you know.
23:25fil512say i have some java projects with a shared parent pom
23:25fil512and i want to add a clojure project to the mix
23:25fil512and share the same parent pom
23:25fil512to ensure common version numbers of dependencies, repositories etc.
23:25fil512then it feels like using maven for the clojure piece is the way to go
23:26fil512or can a lein project file refer to a maven parent pom...?
23:26taliostechnomancy - can lein use a parent maven pom at all?
23:26taliosprobably not easily I guess, not sure how much "uses maven under the covers" means "uses maven"
23:27xeqifor lein2 it means using aether
23:27fil512why is println printing "nil" in front of all my vectors...?
23:27brehautfil512: in the repl, that isthe return value of println
23:27technomancytalios: I think hugod has a plugin for that
23:27technomancybut it seems like people prefer using middleware
23:28fil512ha
23:28fil512because my for loop is the last line in my file!
23:28gfredericksfil512: it is also the return value of println when you're not in the repl
23:28brehautgfredericks: points for pedanticness
23:28fil512what do u usally put for your last line in a run to avoid this?
23:28gfredericks(inc gfredericks')
23:28lazybot⇒ 1
23:29gfredericks^new naming convention for self-karma
23:29brehautlol
23:30gfredericksfil512: how're you running your code?
23:30fil512hitting ctrl-alt L in eclipse
23:30fil512that throws the file I'm editing into the REPL and runs it
23:31gfrederickssounds like you probably can't avoid it. it'll return something. may as well be nil.
23:31fil512well it's in a for loop, so it's returning a whole lot of nils...
23:32brehautfil512: paste your code somewhere.
23:32brehaut(http://refheap.com for instance)
23:32gfredericksfil512: oh. then write nil at the bottom :)
23:32gfredericksor ::stupid-dummy-value-ignore-this
23:33xeqior doseq?
23:33fil512https://www.refheap.com/paste/2779
23:33brehautyeah, definately doseq there
23:33fil512that's the last line of my run.clj
23:33fil512?
23:34brehautfil512: for returns a sequence
23:34gfredericksleave it to somebody else to improve on my suggestion
23:34fil512my eyes are opened
23:34brehautevery element of your sequence is the result of print
23:34brehautso for ever record in report, a nil is generated
23:34fil512brilliant
23:34fil512i get it now
23:34brehautfil512: simple rule of thumb: dont do side effects in lazy ops. use doseq for strict, side effecting code
23:35brehautfil512: also, no hanging parens
23:35brehautfil512: http://mumble.net/~campbell/scheme/style.txt
23:42fil512i find hanging parens useful in ns functions and deftests where I'm likely to add more lines
23:43brehautwhen you are more comfortable with clojure, learn paredit and stop caring.
23:43brehautstructural editing means never having to count parens again
23:43fil512is there a paredit plugin for eclipse?
23:43brehautCCW
23:43brehautyou are already using it
23:44fil512how will it let me insert a new line and split the parens in the right place?
23:45brehautit makes it trivial to navigate around the s-expression. you stop editing text and start editing structures
23:45fil512are there keystrokes I need to learn?
23:45brehautwell yes
23:45brehautthats why i said wait until you've got a bit more familiar with clojure
23:47fil512i see
23:47fil512ctl-shift p
23:47fil512ctl-alt a
23:47fil512interesting...
23:47fil512question
23:47fil512how do you decide how many functions go into one file?
23:48fil512do you ever have 2 files with the same namespace?
23:48brehautrarely
23:48brehautclojure.core does it, but core is a monster
23:48brehautand not strictly idiomatic
23:48fil512right now I'm following a java convention and I have lots of little files, but I'm not sure that's a good idea...
23:48brehautfile per function is probably wrong yes
23:49fil512i have 2-5 functions per file right now
23:49brehautnamespaces are just logical groupings
23:49brehautso if its logical for the content to be grouped together then its fine.
23:50brehautif you have two groups of stuff in one namespace it might be worth breaking it out into two namespaces
23:51fil512I guess once Light Table is out, it won't matter.
23:51fil512You seen Light Table?
23:51fil512http://www.kickstarter.com/projects/ibdknox/light-table
23:51brehautof course it will matter
23:51fil512not as much...
23:51brehauta namespace is a logical group, not a physical group
23:52fil512fair enough
23:52brehautthe file is merely a conveninent serialisation
23:52fil512but i like how in Light Table you're not editing files any more, your editing related functions
23:52brehautand yes. i think you can safely assume that everyone in #clojure is familiar with light table. probably backed it too
23:52fil512:-)
23:52fil512I backed it
23:53PeregrinePDXI dunno. I doubt ibdknox backed it through kickstarter.
23:56fil512any1 here using clojure commercially?
23:56ibdknoxI am!
23:56ibdknox;)
23:57chouserMe too
23:57PeregrinePDXI almost said that I thought you might be, ibdknox.
23:57fil512must be an inside joke i don't get...
23:57ibdknoxchouser is also a Chris :)
23:57PeregrinePDXUh ibdknox is the creator of light table...
23:57metelluslook at the url to the light table kickstarted a little closer, fil512
23:58metelluskickstarter
23:58fil512how do you find working in clojure with mixed skill teams?
23:58fil512hi ibdknox u rock
23:58fil512we are a developer shop with 120 developers
23:58ibdknoxhaha thanks :)
23:58fil512different skill levels
23:59fil512in java I feel safe
23:59brehautmy solution is to not work with other developers ;)
23:59fil512I know their code will more or less be intelligable to other java developers
23:59fil512but I worry about clojure