2012-05-17
| 00:04 | emezeske | Just released lein-cljsbuild 0.1.10, which pulls in clojurescript 0.0-1236 . |
| 00:14 | wkmanire | oin 3refheap |
| 00:14 | clojurebot | amac: 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:14 | wkmanire | wow |
| 00:15 | wkmanire | super typorific. |
| 00:32 | lynaghk | ibdknox: ping |
| 00:59 | devn | ibdknox: you around? |
| 01:15 | yoklov | woo unreadable clojure code http://codegolf.stackexchange.com/questions/5847/convert-from-postfix-notation-to-infix-notation/ |
| 01:16 | devn | yoklov: i found a way more interesting crazy obfuscated clojure fn |
| 01:16 | devn | err statement |
| 01:16 | devn | err expression |
| 01:16 | devn | YOU KNOW WHAT I MEAN |
| 01:18 | yoklov | oh? |
| 01:19 | devn | yoklov: hunting for it now |
| 01:19 | brainproxy | for 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:21 | amalloy | yoklov: (or ({...} x) x) is just ({...} x x) |
| 01:21 | yoklov | oh! |
| 01:22 | yoklov | thank you |
| 01:22 | devn | ,(letfn[(!-?>[&$ &!](if(>,&!,1)(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](!-?>,1,5)) |
| 01:22 | devn | yoklov: ^ :D |
| 01:22 | yoklov | oh wow |
| 01:22 | devn | &(letfn[(!-?>[&$ &!](if(>,&!,1)(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](!-?>,1,5)) |
| 01:22 | lazybot | ⇒ 120 |
| 01:22 | yoklov | I briefly considered replacing the spaces with commas |
| 01:22 | devn | it makes sense once you start thinking about it |
| 01:23 | clojurebot | 120 |
| 01:23 | amalloy | nice of you to join us, clojurebot |
| 01:23 | devn | yoklov: 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:25 | devn | grrr, cannot figure out how to connect with korma to homebrew postgres |
| 01:27 | alandipert | devn: (letfn[(!-?>[&$ &!](if(>,&!,1)#(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](trampoline(!-?>,1,10000M))) for extra obfuscation and stack defense |
| 01:29 | ibdknox | lynaghk: hey |
| 01:29 | ibdknox | devn: hey |
| 01:31 | devn | alandipert: ha! |
| 01:33 | devn | ibdknox: 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:34 | devn | ibdknox: ibdknox A ResourcePool could not acquire a resource from its primary factory or source. |
| 01:34 | ibdknox | I dunno lol |
| 01:34 | ibdknox | not seen that one |
| 01:34 | devn | lol, this is beta10 |
| 01:34 | devn | fwiw |
| 01:37 | wkmanire | Is there an easy way to cast a map to a python dict? |
| 01:37 | nsxt_ | 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:38 | ibdknox | devn: not sure without more to go on |
| 01:39 | devn | ibdknox: yeah, sorry -- kind of a weak report on my end, basically i removed the Apple-installed postgres and homebrew installed postgresql |
| 01:39 | devn | ibdknox: i then followed `brew info postgresql` to initdb |
| 01:43 | devn | ibdknox: 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:43 | wkmanire | I 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:43 | wkmanire | As in the two collections correspond index wise. |
| 01:44 | devn | ibdknox: i assume (defdb (postgres {:db "foo"})), (defentity exprs), (insert exprs (values {:a "1", :b "2"})) will work |
| 01:44 | technomancy | wkmanire: it's guaranteed |
| 01:44 | wkmanire | technomancy: Awesome |
| 01:44 | wkmanire | thanks |
| 01:44 | ibdknox | devn: it needs the username and password |
| 01:45 | devn | ibdknox: but...there isn't one. create a user? |
| 01:45 | ibdknox | devn: there is one |
| 01:45 | ibdknox | devn: not sure what it is by default |
| 01:45 | ibdknox | I'm not a database setup wizard by any means lol |
| 01:45 | technomancy | devn: I couldn't get it working either; it sticks c3p0 in the way and interferes with c.j.jdbc connection parameter parsing |
| 01:45 | technomancy | not sure if that's the same problem, but it sounds related |
| 01:46 | devn | technomancy: glad to hear im not alone i suppose |
| 01:47 | xeqi | devn: in psql run \du and see what the role names it gives you |
| 01:47 | technomancy | c.j.jdbc connects just fine to passwordless databases |
| 01:47 | technomancy | FWIW |
| 01:48 | devn | xeqi: plato | Superuser, Create role, Create DB, Replication | {} |
| 01:48 | amalloy | wkmanire: you're probably better off just calling seq on the map to get a seq of k/v pairs |
| 01:49 | robertstuttaford | ok 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:49 | ibdknox | technomancy: 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:49 | robertstuttaford | this is the last piece of the puzzle. with this, i am able to emacs repl browser all in the same repl |
| 01:50 | robertstuttaford | ibdknox: congrats on your funding. exciting time ahead for you! |
| 01:50 | technomancy | I'll put something together if I end up sticking with it |
| 01:51 | robertstuttaford | technomancy: you are a machine! everywhere i look i see your name popping up. thanks for your myriad awesome contributions to the cause. |
| 01:51 | robertstuttaford | looking forward to watching your emacs peepcode |
| 01:51 | technomancy | robertstuttaford: thanks; glad it's been useful =) |
| 01:51 | robertstuttaford | immensely so. |
| 01:52 | technomancy | wow, weird crossover; I visit http://planet.gnome.org and the first post is about VimClojure. |
| 01:52 | technomancy | the stars are aligning or something |
| 01:53 | ibdknox | robertstuttaford: thanks! :) |
| 01:54 | robertstuttaford | looking 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:58 | robertstuttaford | anyone got a clue why i'm struggling with ring-serve? |
| 02:01 | robertstuttaford | or perhaps i can connect to the 'lein2 ring serve-headless' process from swank? |
| 02:02 | technomancy | robertstuttaford: 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:07 | wei_ | what's the idiomatic way to make an agent repeat an action for a set amount of time? (repeatedly (send-off …)) ? |
| 02:07 | technomancy | does it have to be an agent? you can use executors. |
| 02:10 | devn | technomancy: did you have the same problem with mysql? |
| 02:10 | devn | technomancy: i cant get that to work with korma either |
| 02:11 | technomancy | devn: I don't use mysql |
| 02:11 | technomancy | kind of as a matter of principle =) |
| 02:11 | devn | technomancy: nor do i, but postgres isn't working |
| 02:11 | devn | and i wanna hack on something |
| 02:11 | devn | :) |
| 02:11 | technomancy | just use clojure.java.jdbc |
| 02:11 | technomancy | it's simple |
| 02:11 | wei_ | it doesn't have to be an agent |
| 02:11 | wei_ | what's a good example using executors? |
| 02:12 | technomancy | wei_: https://github.com/heroku/pulse has some repetitions scheduled with executors |
| 02:12 | wei_ | thanks, I'll check it out |
| 02:12 | xeqi | devn: try using (postgres {:db "foo" :user "plato"}) |
| 02:12 | technomancy | good ol' util.clj: https://github.com/heroku/pulse/blob/master/src/pulse/util.clj |
| 02:19 | devn | xeqi: no dice :( |
| 02:19 | devn | xeqi: 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:20 | michaelr525 | i remember someone had the same problem here in the channel couple of days ago |
| 02:20 | xeqi | hmm |
| 02:22 | xeqi | try (defdb mydb {:subprotocol "postgresql" :subname "foo" :classname "org.postgresql.Driver" :user clojars"} |
| 02:22 | michaelr525 | devn: did you specify database on your table entity |
| 02:22 | michaelr525 | ? |
| 02:22 | devn | michaelr525: yes and no? |
| 02:22 | michaelr525 | what? |
| 02:22 | clojurebot | What is meta |
| 02:22 | xeqi | oh, and you have something like [postgresql "9.1-901-1.jdbc4"] in you're dependencies right? |
| 02:22 | devn | lol |
| 02:22 | devn | that's probably it |
| 02:23 | xeqi | *lein dependencies |
| 02:24 | technomancy | devn: even if you don't use c.j.jdbc, ensuring that you can connect using it is a good first debugging step |
| 02:25 | devn | technomancy: yeah, i think i still may have a problem |
| 02:25 | devn | i dont think im connecting |
| 02:25 | devn | but we'll try it with the driver |
| 02:25 | michaelr525 | devn: did you specify the database on your table entity? |
| 02:25 | devn | michaelr525: what do you mean? |
| 02:25 | wei_ | just curious, what's the downside of using agents? |
| 02:25 | michaelr525 | (def db (postgress.. |
| 02:25 | devn | (defentity :foo (database db) (table :foo)) |
| 02:26 | wei_ | (technomancy:) I find the easier to think about conceptually |
| 02:26 | michaelr525 | yeah |
| 02:26 | devn | yes i did |
| 02:26 | technomancy | wei_: agents are reference types designed to hold a value |
| 02:26 | technomancy | they're not a good fit for "just do a bunch of stuff" |
| 02:27 | technomancy | though sometimes they can be convenient for it merely because the Java APIs are slightly more verbose |
| 02:27 | devn | xeqi: thanks. i just didnt have the damned driver |
| 02:27 | devn | *facepalm* |
| 02:27 | wei_ | i see |
| 02:27 | wei_ | is there a major performance overhead? |
| 02:27 | xeqi | heh |
| 02:28 | technomancy | wei_: not really; bit of memory maybe |
| 02:31 | robertstuttaford | is this the right way to force linum 1 for clojure? (add-hook 'clojure-mode-hook (lambda () (linum-mode 1))) |
| 02:31 | robertstuttaford | seat-of-pants coding, here |
| 02:31 | devn | xeqi: new question for you: "relation xyz does not exist" |
| 02:32 | devn | xeqi: (defentity xyz (database db) (entity-fields :a :b)), (insert xyz (values {:a 1, :b 2})) |
| 02:34 | xeqi | devn: have you created an xyz table? |
| 02:34 | devn | xeqi: can i not do that via korma? |
| 02:35 | xeqi | nope |
| 02:36 | xeqi | theres some stuff in korma.incubator |
| 02:36 | robertstuttaford | korma is not an orm :-) |
| 02:36 | xeqi | or lobos |
| 02:36 | xeqi | for schema generation |
| 02:36 | robertstuttaford | it's a dsl for writing sql |
| 02:36 | xeqi | but I haven't used them |
| 02:36 | devn | robertstuttaford: yeah, im coming from orm land |
| 02:36 | ibdknox | the korma.incubator stuff is rough |
| 02:36 | ibdknox | just a proof of what it might look like |
| 02:37 | ibdknox | I 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:37 | robertstuttaford | ibdknox: mine wouldn't work unless i explicitly placed (database foo) inside each (defentity) |
| 02:37 | ibdknox | Someone who can show it more love :) |
| 02:37 | ibdknox | really? |
| 02:37 | ibdknox | that definitely shouldn't true |
| 02:37 | robertstuttaford | aye. and the defdb is in the same file right above the defentities |
| 02:38 | ibdknox | or do you mean the incubator stuff? |
| 02:38 | ibdknox | can you put up a gist? |
| 02:38 | robertstuttaford | sure |
| 02:39 | robertstuttaford | let me first verify before i take up your time. i had the issue amongst a whole swath of others |
| 02:42 | robertstuttaford | ibdknox: overturned. noob issue. |
| 02:44 | ibdknox | righto :) |
| 02:49 | michaelr525 | ibdknox: btw, i solved the super-slow lein run issue i had by upgrading noir to beta7 from beta3 |
| 02:49 | ibdknox | ah |
| 02:49 | michaelr525 | it was getting lost somewhere in the load-view func |
| 02:49 | michaelr525 | views |
| 02:49 | ibdknox | mm, Raynes recently updated that code |
| 02:49 | ibdknox | glad it got fixed :) |
| 02:49 | michaelr525 | me too ;) |
| 02:51 | michaelr525 | ibdknox: can i ask you a personal question? |
| 02:51 | ibdknox | sure lol |
| 02:52 | hiredman | "how much wood would a woodchuck chuck if a woodchuck could chuck wood?" |
| 02:52 | michaelr525 | how did you get so deeply involved with clojure after such a serious background in microsfot environments and such? |
| 02:52 | ibdknox | hiredman: phi logs |
| 02:53 | ibdknox | michaelr525: 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:54 | ibdknox | michaelr525: 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:54 | ibdknox | michaelr525: 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:55 | robertstuttaford | woooo my ipad 3 is about to arrive -bounce-bounce- |
| 02:55 | michaelr525 | i see, very interesting.. |
| 02:56 | ibdknox | Clojure'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:56 | robertstuttaford | i like how close you get to expressing the problem domain with clojure |
| 02:56 | robertstuttaford | instead of feeding compilers sugar |
| 02:57 | robertstuttaford | michaelr525: this is a great read http://www.colinsteele.org/post/23103789647 |
| 02:57 | ibdknox | messing around with Python again made me realize how much Clojure has spoiled me lol |
| 02:57 | michaelr525 | robertstuttaford: thanks, read it yesterday actually :) |
| 02:58 | michaelr525 | ibdknox: what slows me most of the time with clojure is the lack of an integrated debugger like in VS |
| 02:59 | ibdknox | michaelr525: 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:59 | michaelr525 | i still manage to be very productive, imho but a debugger would give a real productivity boost |
| 03:00 | ibdknox | there are definitely times when you need one |
| 03:00 | ibdknox | but usually with a REPL it's not so important :) |
| 03:00 | robertstuttaford | working hard to separate pure vs side-effecting functions also helps |
| 03:00 | robertstuttaford | both in terms of debugging and in terms of reasoning about your solution |
| 03:00 | devn | * 10 |
| 03:01 | michaelr525 | i'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:01 | devn | michaelr525: better and better debuggers will come |
| 03:01 | devn | but clojure is still growing. when people really need it, it will come |
| 03:01 | devn | that's my thinking anyway |
| 03:01 | ibdknox | 's true |
| 03:01 | robertstuttaford | my first foray is a json rest service. aside from reading zip files and sql db, i'm 100% pure, so far |
| 03:02 | devn | robertstuttaford: dont worry about purity. |
| 03:02 | devn | i remember caring about that |
| 03:02 | devn | it's really just about writing good, solid programs. purity be damned. |
| 03:02 | michaelr525 | sure, i still _really_ enjoy doing clojure, but maybe a big part of it is the learning experience |
| 03:03 | robertstuttaford | devn, still very new to it, so i'm enjoying thinking about it |
| 03:03 | devn | robertstuttaford: fair enough, just suggesting not to marry purity |
| 03:03 | robertstuttaford | clojure is nice in that it makes it hard to program imperatively, so i'm constantly reminded to think things through |
| 03:04 | devn | yeah it's nice, eh? |
| 03:04 | robertstuttaford | very |
| 03:04 | devn | michaelr525: sure it is, but you never quit learning with clojure (or at least i havent) |
| 03:04 | devn | so that good feeling never goes away |
| 03:04 | devn | it's great like that. :) |
| 03:04 | robertstuttaford | makes me cringe when i have to go back into my gclosure javascript |
| 03:05 | alandipert | that learning feeling, mmm! |
| 03:05 | michaelr525 | okay, let's print it on t-shirts ;) |
| 03:05 | robertstuttaford | if you stop learning as a programmer, you stop living! |
| 03:06 | devn | alandipert: Ugg functional programmer. Make lambda with club. Gar not fond of lisp. Gar want make imperative language for boy and for girl. |
| 03:06 | robertstuttaford | ok. ipad unboxing time. laterrr |
| 03:06 | devn | alandipert: are you going to euroclojure? |
| 03:06 | alandipert | devn: naw :-( |
| 03:07 | devn | ratzookas |
| 03:07 | alandipert | devn: next party for me is oscon probly |
| 03:07 | devn | alandipert: whn is that? |
| 03:08 | alandipert | devn: july, in portland |
| 03:08 | devn | oh...well dont count me out just yet |
| 03:08 | devn | i have reason to go to portland at some point this summer |
| 03:09 | devn | </fun-fact> |
| 03:10 | PeregrinePDX | Yay, I'm already in portland. |
| 03:10 | devn | alandipert: is the datomic appliance toast now? |
| 03:10 | devn | alandipert: as in i dont download the VM image anymore? |
| 03:10 | alandipert | devn: yes, the latest dev jar lets you local store |
| 03:11 | devn | cool beans. |
| 03:12 | alandipert | devn: yeah it's money, back with postgres even! not sure that's doc'd tho |
| 03:12 | devn | alandipert: it's sort of kind of doc'd, but it's all moving pretty quick |
| 03:13 | Vinzent | any 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:13 | Vinzent | lein version is 1.7.1, just upgraded it |
| 03:30 | muhoo | is there some way to get the lein/maven project.clj version from inside a project? |
| 03:35 | muhoo | ooh, i got it! projectname.version in (System/getenv) |
| 03:35 | muhoo | slick |
| 03:35 | muhoo | (System/getProperties), actually |
| 03:35 | muhoo | &(System/getProperties) |
| 03:35 | lazybot | java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write) |
| 03:35 | muhoo | heh |
| 04:00 | LauJensen | Morning gents |
| 04:33 | TEttinger | ok, i think i need to actually learn clojure before i try to develop any more in it... |
| 04:34 | TEttinger | is there a good ebook or web tutorial for... (I don't know where i stand, basic, maybe) clojure? |
| 04:34 | mudphone | Have you seen Joy of Clojure? |
| 04:34 | Vinzent | TEttinger, check out this http://java.ociweb.com/mark/clojure/article.html |
| 04:35 | TEttinger | I 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:35 | TEttinger | ok, thanks guys |
| 04:35 | Vinzent | also, http://learn-clojure.com/ contains a good number of links to other resources |
| 04:35 | mudphone | what is it about "recur" that is getting you? |
| 04:35 | TEttinger | ok, will check them out |
| 04:35 | TEttinger | the docs. |
| 04:36 | TEttinger | http://clojure.org/special_forms#Special%20Forms--%28recur%20exprs*%29 |
| 04:36 | TEttinger | the passage is just worded in a confusing way |
| 04:36 | mudphone | I see |
| 04:36 | mudphone | … well, recur allows you to call back to the same function or loop |
| 04:37 | si14 | argh. I'm trying to download index from central; it's 2% after an hour |
| 04:37 | si14 | is there a way to speed up this process? |
| 04:38 | mudphone | TEttinger: Clojure doesn't have tail call optimization, so you write recursive functions by calling recur at the end of a function (or loop) |
| 04:38 | Vinzent | si14, I'm afraid no. It's for lein search, right? |
| 04:40 | TEttinger | mudphone, 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:41 | Vinzent | TEttinger, yeah, recur is actually used not very often in clojure; usually there is a function\macro which does the job better |
| 04:41 | TEttinger | I 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:42 | Vinzent | If you need to iterate through the vector for side effects, then use doseq |
| 04:42 | TEttinger | the 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:44 | mudphone | TEttinger: 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:44 | mudphone | (at the bottom, by Paul Barry) |
| 04:44 | TEttinger | Vinzent, 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:45 | si14 | Vinzent: yeah |
| 04:47 | TEttinger | ah, thanks mudphone |
| 04:48 | mudphone | np |
| 04:48 | Vinzent | TEttinger, ah, I thought you're actually drawing something - misunderstood your first message |
| 04:48 | Vinzent | si14, I remember it took forever to download for me too |
| 05:04 | TEttinger | hm, can you assign to a name that has already been bound by let? |
| 05:06 | TEttinger | ,(fn foo [] (let [bar \A] (let [bar \Z] (print bar)))) |
| 05:06 | clojurebot | #<sandbox$eval27$foo__28 sandbox$eval27$foo__28@9502d1> |
| 05:06 | TEttinger | ,((fn foo [] (let [bar \A] (let [bar \Z] (print bar))))) |
| 05:06 | clojurebot | Z |
| 05:06 | TEttinger | ah. |
| 05:08 | TEttinger | I assume letting a let is not something you let off so easily, although i hope you let it slide this time |
| 05:10 | TEttinger | crud, it is still bound to a tighter scope than the rest... |
| 05:11 | TEttinger | so i can't use let inside a while loop to change the condition to exit the loop |
| 05:12 | TEttinger | it is hard not having assignment! or i guess it is there, but transactional or something |
| 05:19 | thorwil | TEttinger: i suspect you would be better of with loop/recur |
| 05:20 | TEttinger | thorwil, 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:21 | Borkdude | TEttinger: you can also rebind a name within the same let-bindings: ##(let [a 10, a (+ a 10)] a) |
| 05:21 | lazybot | ⇒ 20 |
| 05:21 | thorwil | TEttinger: but before using loop/recur, are your sure it's not a job for map, reduce or filter? |
| 05:22 | TEttinger | yes. |
| 05:22 | TEttinger | since I need to generate a new list in a sort of odd way |
| 05:23 | TEttinger | err, new vec |
| 05:26 | bobry | does anyone have an example app with waltz? https://github.com/ibdknox/waltz |
| 05:35 | michaelr525 | what is the use case for waltz? |
| 05:36 | ejackson | managing state in CS |
| 05:36 | ejackson | i've used it once |
| 05:39 | ejackson | hmm.. OK, I was using it to manage interaction between some JS components, but then gave up, I recall in some frustration ;) |
| 05:39 | TEttinger | agh. 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:40 | thorwil | TEttinger: http://clojuredocs.org/clojure_core/1.3.0/clojure.core/case |
| 05:41 | TEttinger | woah, i did not know about that site, thanks thorwil |
| 05:41 | thorwil | np |
| 05:46 | muhoo | hmm 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:49 | Borkdude | TEttinger: if you use leiningen2 it has a REPL from which you can also call clojuredocs, like (clojuredocs case) ;;=> examples |
| 05:50 | TEttinger | ah, I am still on 1.7, thanks Borkdude |
| 05:50 | Borkdude | TEttinger: (the REPL also has autocompletion….) |
| 06:22 | TEttinger | hm, how can i use compare with condp ? |
| 06:23 | TEttinger | compare returns an unspecified positive number, negative number, or 0 |
| 06:23 | TEttinger | and condp... I don't know how I would get it to use pos? or neg? |
| 06:23 | Borkdude | ,(doc condp) |
| 06:23 | clojurebot | "([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:24 | TEttinger | http://clojuredocs.org/clojure_core/clojure.core/condp |
| 06:24 | TEttinger | i mean, i could do this the dumb way and list every value as a "case," but that won't scale for long |
| 06:25 | TEttinger | and all I need to know is whether the difference is positive, negative, or 0 |
| 06:25 | Borkdude | ,(let [x 5] (condp < x 1 "< 1" 5 "< 5" 6 "< 6" "other)) |
| 06:25 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string> |
| 06:26 | TEttinger | ,(let [x 5] (condp < x 1 "< 1" 5 "< 5" 6 "< 6" "other")) |
| 06:26 | clojurebot | "< 1" |
| 06:27 | Borkdude | so because (< 1 5) hols true "< 1" is returned |
| 06:28 | TEttinger | yeah, my problem is that i don't have a boolean result i am looking for |
| 06:28 | TEttinger | so < and >.... |
| 06:28 | Borkdude | ,(let [x 5] (condp > x 1 "> 1 x" 5 "> x 5" 6 "x > 6" "other")) |
| 06:28 | clojurebot | "x > 6" |
| 06:29 | TEttinger | i don't mean a comparison operator, like < or > |
| 06:29 | TEttinger | I mean, compare |
| 06:29 | Borkdude | why not a normal cond? |
| 06:29 | TEttinger | http://clojuredocs.org/clojure_core/clojure.core/compare |
| 06:30 | TEttinger | because I haven't read the docs for cond yet? :-| |
| 06:30 | Borkdude | TEttinger: condp is a specialized form of cond |
| 06:30 | TEttinger | yeah, just read cond now, it is what i want... gah... |
| 06:30 | Borkdude | TEttinger: and cond is just a macro which expands to a nested if statement |
| 06:31 | Borkdude | ,(macroexpand '(cond :foo "foo" :else "bar)) |
| 06:31 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string> |
| 06:31 | Borkdude | ,(macroexpand '(cond :foo "foo" :else "bar")) |
| 06:31 | clojurebot | (if :foo "foo" (clojure.core/cond :else "bar")) |
| 06:31 | Borkdude | ,(macroexpand '(cond :else "bar")) |
| 06:31 | clojurebot | (if :else "bar" (clojure.core/cond)) |
| 06:32 | Borkdude | ,(macroexpand '(cond)) |
| 06:32 | clojurebot | nil |
| 06:32 | Borkdude | ,(resolve 'clojure.walk/macroexpand-all) |
| 06:32 | clojurebot | nil |
| 06:32 | Borkdude | ,(resolve 'macroexpand-all) |
| 06:32 | clojurebot | nil |
| 06:33 | Borkdude | ,(clojure.walk/macroexpand-all '(when :foo :bar)) |
| 06:33 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk> |
| 06:34 | Borkdude | &(clojure.walk/macroexpand-all '(when :foo :bar)) |
| 06:34 | lazybot | ⇒ (if :foo (do :bar)) |
| 06:34 | Borkdude | &(clojure.walk/macroexpand-all '(cond :foo "foo" :else "bar")) |
| 06:34 | lazybot | ⇒ (if :foo "foo" (if :else "bar" nil)) |
| 06:35 | Borkdude | &(clojure.walk/macroexpand-all '(condp > x 1 "> 1 x" 5 "> x 5" 6 "x > 6" "other")) |
| 06:35 | lazybot | ⇒ (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:36 | Borkdude | &(source condp) |
| 06:36 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: source in this context |
| 06:36 | Borkdude | ,(source condp) |
| 06:36 | clojurebot | Source not found |
| 06:37 | Borkdude | &(pprint {:a "foo"}) |
| 06:37 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: pprint in this context |
| 06:38 | Borkdude | &(clojure.pprint/pprint {:a "foo"}) |
| 06:38 | lazybot | ⇒ {:a "foo"} nil |
| 06:38 | Borkdude | &(clojure.pprint/pprint (clojure.walk/macroexpand-all '(condp > x 1 "> 1 x" 5 "> x 5" 6 "x > 6" "other"))) |
| 06:38 | lazybot | java.security.AccessControlException: access denied (java.util.PropertyPermission line.separator read) |
| 06:38 | Borkdude | hm ok |
| 06:44 | dsabanin | hi guys |
| 06:44 | dsabanin | what is the syntax to have multiple exceptions listed in try-catch expr? |
| 06:50 | Borkdude | dsabanin: from what I understand here is that you can provide more than one catch clause: http://clojure.org/special_forms#try |
| 06:51 | dsabanin | yeah, looks like there's no other way. Thanks |
| 06:54 | TEttinger | ok, i just killed the repl after my laptop started sounding like a jet engine -- thank you, infinite loop... |
| 06:55 | Borkdude | :) |
| 06:58 | TEttinger | Borkdude, could you take a look at my code (don't run it and leave it sitting, obviously)? http://pastebin.com/gTscmyj3 |
| 06:59 | TEttinger | the 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:01 | Borkdude | TEttinger: without looking into the detail, a non-terminating recur means the condition in (if (= current-square target)) is apparently never becoming true |
| 07:02 | TEttinger | actually it does |
| 07:02 | TEttinger | in one case |
| 07:02 | TEttinger | that I know of... |
| 07:02 | TEttinger | (path-to-target 0 6) |
| 07:02 | Borkdude | it should terminate in all cases ;) |
| 07:02 | TEttinger | yes |
| 07:03 | Borkdude | TEttinger: you could insert some printlns to see what each recursive call looks like |
| 07:03 | TEttinger | but 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:03 | TEttinger | ok |
| 07:04 | Borkdude | so above the if: (println confirmed-squares current-square) |
| 07:07 | raek | TEttinger: 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:08 | raek | any misplaced parentheses should reveal themselves by markant changes in the indentation |
| 07:08 | TEttinger | ah |
| 07:08 | TEttinger | how do i find the size of a vector? |
| 07:09 | TEttinger | searched for len, length, and size, nothing in the API |
| 07:12 | serpent213 | TEttinger: count |
| 07:12 | TEttinger | d'oh... |
| 07:12 | TEttinger | thanks serpent213 |
| 07:20 | Borkdude | TEttinger: try (path-to-target 6 3)... |
| 07:20 | TEttinger | well it seems to just jump back and forth between the starting value and a midway value |
| 07:21 | Borkdude | TEttinger: since (path-to-target 3 6) is almost the reverse of (path-to-target 6 3) it should be easy to check |
| 07:22 | TEttinger | no... 3 6 works |
| 07:22 | TEttinger | but that has, oddly enough, an invalid starting corner (3 is right on the top edge of the grid) |
| 07:24 | TEttinger | d'oh. |
| 07:24 | TEttinger | i had the < and > mixed up in the conditions. |
| 07:25 | TEttinger | reversing them fixes everything |
| 07:26 | TEttinger | thanks a bunch, everyone, especially Borkdude, I really need to take the print-debug advice to heart on simple stuff like this |
| 07:27 | Borkdude | TEttinger np, in Emacs you have also (swank/break) which you can use for debugging |
| 07:27 | TEttinger | I use lein/eclipse |
| 07:27 | Borkdude | TEttinger: ok you can then also use the debugger in eclipse |
| 07:27 | TEttinger | yeah |
| 07:28 | TEttinger | though i don't know how much that would help with an infinite loop |
| 07:28 | Borkdude | TEttinger: a lot I think, if you put the breakpoint within an iteration |
| 07:29 | TEttinger | there's the other thing -- this part of the code had no room for extra function calls |
| 07:29 | TEttinger | an if, a recur, and two cond statements |
| 07:30 | Borkdude | TEttinger: I would try to break up this functions in smaller pieces if possible |
| 07:32 | Borkdude | TEttinger: for example, this could be a function: (< 0 (- (rem current-square 6) (rem target 6))) |
| 07:35 | Borkdude | TEttinger: like this: https://gist.github.com/2718301 |
| 07:43 | robertstuttaford | cmiles: do you plan to annotate away the reflection warnings in bishop? |
| 07:43 | robertstuttaford | cmiles74: ^^ |
| 07:44 | cmiles74 | robertstuttaford: Yep, I have to get that done. It's been a busy week over here but that's an easy thing to fix. |
| 07:45 | robertstuttaford | awesome. 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:45 | robertstuttaford | perhaps (get? request) |
| 07:45 | robertstuttaford | or something |
| 07:46 | cmiles74 | robertstuttaford: 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:47 | cmiles74 | I'm thinking about having functions for each request method... I don't know, I don't want to make it too complicated either. |
| 07:48 | robertstuttaford | i 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:48 | robertstuttaford | and, as i said, handy shortcuts for the heavily used mimetypes |
| 07:49 | cmiles74 | robertstuttaford: That definitely makes sense, you end up with the cond stanza for every group resource. |
| 07:49 | cmiles74 | For the mimetypes, too, it'll help avoid mis-typing mistakes. |
| 07:50 | robertstuttaford | and most item resource, too, if you have get and update |
| 07:50 | robertstuttaford | i love how i can put all the route defs in with each service and compose them up in the app handler |
| 07:51 | cmiles74 | robertstuttaford: I didn't even think of that use-case, it's just worked out that way. :D |
| 07:52 | cmiles74 | The whole project has garnered more interest than I expected. It'd very encouraging. :) |
| 07:52 | robertstuttaford | kudos. you built something worth using! |
| 07:53 | cmiles74 | robertstuttaford: Thank you! :) |
| 07:53 | robertstuttaford | why is delete not up in the cond stanza? |
| 07:53 | robertstuttaford | and instead in the function map afterward |
| 07:54 | cmiles74 | robertstuttaford: Let me get the chart out... |
| 07:54 | foxdonut | just came out of the shower? |
| 07:55 | cmiles74 | This is a side-effect of how the protocol works, delete requests never make it down to the handler function... |
| 07:55 | robertstuttaford | oh, i see |
| 07:56 | cmiles74 | robertstuttaford: 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:56 | robertstuttaford | great |
| 07:57 | cmiles74 | robertstuttaford: 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:58 | robertstuttaford | it did seem curiously out of place down there |
| 07:58 | bobry | is there a validation library for clojurescript? |
| 08:00 | foxdonut | bobry: if not, you could hook into closure's validation |
| 08:00 | cmiles74 | robertstuttagart: 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:01 | bobry | foxdonut: sure, can you recommend any particular library? |
| 08:01 | cmiles74 | Perhaps another map, with the request methods as keys and the handler functions as values, something like that. |
| 08:01 | cmiles74 | tmciver is looking at another way of handling the request methods as well, it'll be interesting to see what he comes up with. |
| 08:02 | robertstuttaford | awesome. keen to see what comes of it |
| 08:03 | robertstuttaford | stuttagart? :) |
| 08:03 | robertstuttaford | never had that one before |
| 08:04 | foxdonut | bobry: I meant google closure |
| 08:04 | cmiles74 | robertstuttaford: Sorry! I was typing too fast. :P |
| 08:05 | Borkdude | TEttinger: https://www.refheap.com/paste/2767 |
| 08:12 | ro_st | there. no more 16 character nickname |
| 08:12 | ro_st | is anyone using cemerick's friend? |
| 08:13 | foxdonut | ro_st: :) |
| 08:13 | cmiles74 | ro_st: :D |
| 08:14 | bobry | foxdonut: ah, i'm not aware of any validation components in google closure, independent of the widget layer |
| 08:16 | foxdonut | bobry: 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:17 | foxdonut | but given ibdknox's other clojurescript libraries, one for validation would be a good addition to the lineup |
| 08:36 | beffbernard | Good morning everyone |
| 09:08 | bhenry | is there a way to watch the *noir-session* or a ring session in general for changes? |
| 09:09 | bhenry | e |
| 09:09 | duck1123 | bhenry: you could put some middleware right before the session middleware that monitors the :session key, would that work? |
| 09:10 | devn | bhenry: https://github.com/brentonashworth/sandbar |
| 09:10 | devn | something like that? |
| 09:10 | bderooms_ | is letfn not used anymore in clojure 1.4? What should I use instead? |
| 09:11 | devn | bderooms_: what makes you think it's gone away? |
| 09:11 | bhenry | ,(let [f (fn [] "hello")] (f)) |
| 09:11 | bderooms_ | no syntax coloring and an indication in the docs that I'm seeing version 1.2 of clojure |
| 09:11 | clojurebot | "hello" |
| 09:12 | raek | &(clojure-version) |
| 09:12 | lazybot | ⇒ "1.4.0" |
| 09:12 | devn | bderooms_: which docs? |
| 09:12 | Chousuke | (doc letfn) |
| 09:12 | clojurebot | "([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:12 | raek | &(letfn [(foo [] 123)] (foo)) |
| 09:12 | lazybot | ⇒ 123 |
| 09:12 | bderooms_ | http://clojuredocs.org/clojure_core/1.4.0/clojure.core/letfn |
| 09:12 | bderooms_ | http://clojuredocs.org/clojure_core/1.2.0/clojure.core/letfn |
| 09:13 | devn | clojuredocs doesnt have 1.4 stuff at all i dont think |
| 09:13 | bhenry | clojuredocs doesn't have 1.4 yet |
| 09:13 | devn | so no surprise there |
| 09:13 | bderooms_ | ah |
| 09:13 | devn | http://clojuredocs.org/clojure_core/clojure.core/letfn |
| 09:13 | devn | it's still in 1.3 |
| 09:14 | devn | there 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:14 | bderooms_ | ok, thx |
| 09:14 | devn | np |
| 09:20 | ro_st | cmiles74: if i wanted to add a header to the ring response returned by bishop, regardless of the route, where's the best place? |
| 09:22 | ro_st | in 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:23 | cmiles74 | ro_st: if you wait until your handler function is called, you can add your headers there: {:headers {"Bla-ba-bla" "somevalue"} :body "whatever"} |
| 09:23 | cmiles74 | gothca'. |
| 09:23 | cmiles74 | Well, you could you add your own middleware and have that higher up on the chain from your bishop handlers. |
| 09:24 | ro_st | so, right now my ring hander is: (def handler (-> (bishop/handler (merge {["*"] (bishop/halt-resource 404)} <a list of service/routes definitions>)))) |
| 09:25 | ro_st | i've never written ring middleware before. would i prepend or postpend (bishop/handler) in this pipeline with my own handler? |
| 09:25 | cmiles74 | I'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:27 | cmiles74 | (def h (-> (rost/header-mw)...)) |
| 09:27 | cmiles74 | ro_st: Take a look here: https://github.com/mmcgrana/ring/wiki/Concepts |
| 09:27 | cmiles74 | Down in the "Middleware" section they show how to add a "Content-Type" header, which sounds similar to what you're trying to do. |
| 09:28 | cmiles74 | Code-wise, it looks straightforward. :) |
| 09:29 | ro_st | cool, thanks |
| 09:29 | cmiles74 | ro_st: You are welcome :) |
| 09:38 | Raynos | Does anyone use clojure directly with node ? |
| 09:42 | brainproxy | Raynos: beginning to :) |
| 09:43 | lucian | if it was self-hosted on node, it'd be so much better |
| 09:43 | lucian | i so hate jvm start up time |
| 09:43 | lucian | and size |
| 09:44 | brainproxy | lucian: in my latest release of node-clojurescript, you can compile cljs against a "detached" JVM |
| 09:44 | brainproxy | e.g. you can do ncljsc --server 8000 |
| 09:44 | brainproxy | and then compile with ncljsc --client |
| 09:45 | brainproxy | the --client process doesn't spin up its own JVM, so is more snappy |
| 09:45 | Raynos | brainproxy: any recommended reading material on clojurescript + node is appreciated |
| 09:45 | lucian | brainproxy: that's nice, things like that and nailgun to help |
| 09:45 | lucian | but jvm startup is still stupid |
| 09:48 | brainproxy | lucian: hadn't heard of nailgun, will take a look |
| 09:50 | brainproxy | Raynos: I'm reading the Clojure book from O'Reilly currently |
| 09:50 | brainproxy | Raynos: not sure of anything clojurescript specific just yet |
| 09:51 | lucian | that's a nice book |
| 09:51 | brainproxy | Raynos: 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:52 | brainproxy | should teach me a lot, and should serve as more examples of how the two fit together |
| 09:53 | brainproxy | though I imagine it will be awhile before I really code in idiomatic clojure/script |
| 09:53 | Raynos | brainproxy: http://mmcgrana.github.com/2011/09/clojurescript-nodejs.html :D |
| 09:53 | brainproxy | Raynos: yah, that's good |
| 09:53 | brainproxy | I borrowed from that |
| 09:53 | brainproxy | :D |
| 09:53 | Raynos | I got past the easy stuff |
| 09:53 | brainproxy | gotcha |
| 09:54 | Raynos | and then hes like "LISP ALL THE THINGS" and then Im like ._. |
| 09:54 | brainproxy | well, 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:55 | brainproxy | though there's still a lot more to do for that tooling ... in time |
| 09:55 | brainproxy | *now that... |
| 09:55 | Raynos | heh |
| 09:57 | brainproxy | Raynos: 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:57 | brainproxy | definitely looking for feedback |
| 09:59 | lucian | brainproxy: trying. wants me to define java home. hmm |
| 09:59 | brainproxy | yah |
| 09:59 | ambrosebs | ppl might be interested in an interview I gave about Typed Clojure http://t.co/NoNsBW7R |
| 10:00 | brainproxy | see the Prerequisites section |
| 10:00 | brainproxy | of the README |
| 10:03 | pandeiro | anyone 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:03 | lucian | pandeiro: yes. resist that urge :) |
| 10:04 | ro_st | ambrosebs: i read it earlier. very interesting! |
| 10:05 | ambrosebs | ro_st: cool! |
| 10:05 | pandeiro | lucian: 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:05 | ambrosebs | fwiw, any questions, shoot |
| 10:05 | ro_st | pandeiro: gosh, all the time. i'd never deliver anything if i listened to that urge, though |
| 10:06 | lucian | pandeiro: does it take 1-2h to rewrite? usually not |
| 10:06 | ro_st | ambrosebs: it's a little above my head at the moment. i'm about 2 weeks into clojure |
| 10:06 | ro_st | lucian: maybe he maintains a fibionacci generator :) |
| 10:10 | pandeiro | lucian: 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:10 | lucian | that's normal |
| 10:10 | lucian | just fix it slowly as you progress |
| 10:11 | pandeiro | yeah, internally i know that... and restarting carries with it the risk of total myopia... but still i am here stalling :) |
| 10:11 | mtkoan | then restart.. if you have enough time to meet the deadline anyway |
| 10:11 | mtkoan | or if you don't it will be so painful you won't do it again |
| 10:12 | lucian | there is such a thing as the second system effect |
| 10:12 | lucian | often your second try will be over-architected |
| 10:12 | pandeiro | ha yeah i have fallen into that already as well |
| 10:12 | ro_st | identify the messiest mess, and break it up |
| 10:13 | lucian | we have this 45kloc thing at work with tons of mistakes |
| 10:13 | ro_st | rename stuff, re-org namespaces so that it's all more consistently named and composed |
| 10:13 | lucian | it's just so ridiculously big, rewriting is not an option |
| 10:14 | pandeiro | yeah actually my current scenario is changing part of an api, not refactoring per se (as in just compartmentalizing things further) |
| 10:14 | pandeiro | guess my real question is how to get better at nailing it the first time |
| 10:14 | ro_st | you don't. if you write it perfectly once, you're working well below your capability |
| 10:14 | ro_st | and you should find something more challenging |
| 10:15 | pandeiro | wow, so this is our fate ey |
| 10:15 | ro_st | indeed :) embrace the chaos |
| 10:15 | pandeiro | goes well with caffeine |
| 10:15 | ro_st | incremental, continuous improvement |
| 10:16 | pandeiro | do any of you use mindmapping software? |
| 10:16 | lucian | it's part of why both dynamic languages and haskell are nice |
| 10:16 | lucian | and why so many people get annoyed with java/c++ |
| 10:16 | pandeiro | i didn't know that existed until reading about freemind on hn yesterday |
| 10:16 | lucian | oh, and go also goes in the first list |
| 10:16 | pandeiro | lucian: all i know is dynamic, maybe i need to do some time in the other group |
| 10:17 | ro_st | don't do that to yourself :-) |
| 10:17 | lucian | indeed, unless you enjoy pain avoid java/c++ |
| 10:17 | lucian | but haskell is interesting statically, strongly typed, but also reasonable |
| 10:17 | lucian | types in haskell help you, instead of getting in your way |
| 10:18 | lucian | go is a little like that too because of the implicitly implemented interfaces |
| 10:23 | pandeiro | i 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:24 | mrb_bk | dnolen: sup dude, did the talks last night get recorded? |
| 10:25 | dnolen | mrb_bk: I don't know if anyone did a video recording. Sad good presentations. |
| 10:25 | mrb_bk | dnolen: Word, sad to miss good nerd-outs |
| 10:26 | mrb_bk | dnolen: 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:26 | dnolen | mrb_bk: the paperless post tech talks looks awesome, will try to swing by. |
| 10:26 | lucian | pandeiro: change your editor! :) |
| 10:26 | mrb_bk | they've been a good time |
| 10:26 | lucian | i find it useful to write prototypes for ideas |
| 10:27 | lucian | and then apply to the ball of mud |
| 10:28 | jweiss | Raynes: 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:28 | pandeiro | lucian: i am going to try out freemind to use for prototyping, maybe it will help |
| 10:29 | pandeiro | not 'prototyping' per se but just organizing thoughts |
| 10:43 | mmarczyk | dnolen: thickey: so, can we look forward to a recording of yesterday night? |
| 10:46 | jsabeaudry_ | What is the name of the function that will insert x as the second element of every form ?(similar to ->) |
| 10:46 | Bronsa | ->> |
| 10:46 | jsabeaudry_ | I mean macro |
| 10:47 | Bronsa | it will insert x as the last element, not the second though |
| 10:47 | jsabeaudry_ | Bronsa, exact, and will then insert the first form in the last position on the second |
| 10:50 | jamii | Since 'and' is a macro, what do I do instead of (apply and... |
| 10:51 | pandeiro | ibdknox: any idea why + would be getting replaced by whitespace in form-post data with noir? |
| 10:53 | jamii | I guess (every? true? ... works. |
| 10:53 | duck1123 | jamii: I'm not sure what you're doing, but would (every? identity coll) do it for you? |
| 10:53 | jamii | duck1123: Thanks |
| 10:53 | raek | pandeiro: in url-encoded data, + means the same as %20 and space |
| 10:53 | pandeiro | raek: ah thanks, does noir url-encode by default i take it? |
| 10:54 | raek | pandeiro: I don't know, but you shouldn't concatenate url-encoded strings with non-encoded ones, etc |
| 10:56 | pandeiro | raek: gotcha thanks, i'll dig into it |
| 10:58 | raek | pandeiro: 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:59 | raek | (since it doesn't perform the necessary escaping) |
| 11:00 | pandeiro | raek: all i see is a space actually when i examine the ring request |
| 11:00 | raek | (by "a + in the form data" I meant the actual data in the HTTP TCP stream) |
| 11:00 | pandeiro | raek: how would i inspect that? |
| 11:02 | raek | pandeiro: 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:02 | jsabeaudry_ | What is the proper way to write "this" in clojurescript (I tried "this" and "js/this") |
| 11:03 | mmarczyk | jsabeaudry_: use this-as |
| 11:03 | mmarczyk | jsabeaudry_: (this-as this ...use this here...) or (this-as self ...) or whatever |
| 11:04 | jsabeaudry_ | mmarczyk, thank you very much! |
| 11:04 | raek | pandeiro: what thing contains the "+"? a form field value? a form field name? |
| 11:04 | mmarczyk | np |
| 11:37 | pandeiro | raek: 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:38 | pandeiro | ...and what i notice is that in any POST data to noir, + becomes space |
| 11:47 | edw | Anyone here use comb? |
| 11:59 | TimMc | pandeiro: Oh, so *you* have the bug. |
| 11:59 | TimMc | That + should be %2B or whatever it is |
| 12:01 | pandeiro | TimMc: is it famous? |
| 12:02 | pandeiro | i 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:27 | pelleb | Just pushed a tiny demo app showing how to login to a noir app via OAuth2 in this case GitHub http://oauthentic.herokuapp.com/ |
| 12:27 | pandeiro | raek: 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:27 | pandeiro | ...just a space |
| 12:27 | pelleb | It uses my little oauth2 client library https://github.com/pelle/oauthentic |
| 12:30 | technomancy | brainproxy: 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:48 | TimMc | pandeiro: {:expr (+ 1 2)} in Firefox |
| 12:52 | pandeiro | TimMc: I have the same problem regardless of client |
| 12:53 | pandeiro | because 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:54 | pandeiro | only reason i discovered it quickly was b/c i have the (+ 1 2 3) habit every time i see a repl |
| 12:55 | TimMc | pandeiro: OK... I put (+ 1 2) into the console, the Chrome payload is {:expr (+ 1 2)} |
| 12:55 | pandeiro | TimMc: which console? the devtools or himera? |
| 12:55 | TimMc | The Himera console. |
| 12:56 | pandeiro | yeah himera works fine |
| 12:57 | pandeiro | himera uses a pretty simple compojure handler with ring-clj-params middleware... so i think the problem is somewhere in noir |
| 13:00 | TimMc | Not if the server is receiving an unencoded +... |
| 13:24 | Na-Fiann | Hi, 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:25 | S11001001 | Na-Fiann: you have to wrap a function call in parens |
| 13:25 | langmartin | howdy, 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:25 | Na-Fiann | ohhhhh |
| 13:25 | beffbernard | I 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:25 | Na-Fiann | thanks! |
| 13:26 | beffbernard | s/thead/thread/ |
| 13:30 | dnolen | so interacting with datomic from core.logic is pretty easy |
| 13:30 | dnolen | https://gist.github.com/2719676 |
| 13:42 | wkmanire | How does hash-map work? How does it process N pairs of args into keys and values? |
| 13:44 | dnolen | wkmanire: you could look at the source |
| 13:44 | wkmanire | dnolen: Looking now actually. |
| 13:44 | edw | Does anyone around here use comb? For templating? |
| 13:46 | edw | I 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:48 | wkmanire | I think I see how this works. |
| 13:52 | wkmanire | But I'm not sure what createWithCheck does. |
| 13:52 | dnolen | wkmanire: did you look at lines 83-94 in PersistentHashMap.java? |
| 13:53 | wkmanire | Not yet. Where is that? |
| 13:54 | wkmanire | nevermind, I found it. |
| 13:55 | wkmanire | Bummer, it is literally iterating the sequence of args with a for loop. |
| 13:55 | rhc | dnolen: what does that bit of code do? |
| 13:55 | dnolen | wkmanire: what else should it do? |
| 13:56 | wkmanire | I'm not criticising the implementation. |
| 13:56 | wkmanire | I'm messing with clojure-py and unfortunatley the hash-map implementation is not compatible with the native dict objects. |
| 13:56 | wkmanire | And Tkinter takes dicts as args. |
| 13:56 | wkmanire | So I'm trying to write a dict function which creates a dict with the same syntax as hash-map... |
| 13:57 | wkmanire | I was hoping to see that the hash-map implementation was pure clojure. |
| 13:57 | dnolen | wkmanire: you want to look at ClojureScript |
| 13:57 | dnolen | wkmanire: probably any new Clojure implementation should. |
| 13:59 | wkmanire | dnolen: Ok. I'll look there. |
| 13:59 | wkmanire | heh, 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:00 | dnolen | wkmanire: http://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L4995 |
| 14:00 | dnolen | oops http://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L4994 |
| 14:01 | wkmanire | I see. |
| 14:01 | wkmanire | So I need to make an empty dict and then assoc the values in. |
| 14:02 | wkmanire | dnolen: Thank you for showing me around. |
| 14:02 | dnolen | wkmanire: np |
| 14:17 | langmartin | as a followup, how can I recover the root binding of a dynamic variable? |
| 14:17 | S11001001 | wkmanire: I believe there's a group function in itertools, which you can use to generate an arg for the dict ctor |
| 14:18 | technomancy | langmartin: .getRoot IIRC |
| 14:18 | wkmanire | S11001001: That sounds like a good idea. |
| 14:18 | technomancy | .getRawRoot rather |
| 14:19 | langmartin | technomancy: ah! |
| 14:20 | langmartin | maybe 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:20 | langmartin | seems like merely doing (def out-handle *out*) keeps the new name dynamic as well |
| 14:21 | technomancy | you could print to System/out |
| 14:21 | langmartin | ah |
| 14:21 | langmartin | technomancy: much nicer |
| 14:30 | wkmanire | heh, I was trying too hard. |
| 14:31 | pandeiro | raek: 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:31 | wkmanire | S11001001: (defn dict (py/dict (partition 2 keyvals))) |
| 14:32 | wkmanire | oops |
| 14:32 | wkmanire | forgot the args |
| 14:32 | TimMc | pandeiro: *read-eval* should only affect #=() behavior |
| 14:32 | wkmanire | (defn dict [& keyvals] (py/dict (partition 2 keyvals))) ;; thats better |
| 14:35 | ruda | I'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:37 | S11001001 | cool |
| 14:38 | pandeiro | TimMc: yeah that's not it at all apparently ... huh |
| 14:39 | S11001001 | fyi anyone not watching, there's a boston clojure meet tonight at 7 in cambridge |
| 14:39 | technomancy | ruda: should be build.clojure.org |
| 14:40 | technomancy | still using hudson =( |
| 14:40 | ruda | technomancy: yes, that's it. Oh, Hudson yet |
| 14:40 | ruda | technomancy: but thank you |
| 14:41 | technomancy | np |
| 14:44 | mheld | am I not using recur properly in http://pastie.org/private/3xqasiywietiyuisw1igoq ? |
| 14:46 | solussd | is 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:46 | solussd | using slime/swank |
| 14:46 | mfex | mheld, you probably want to use s in the recur, this looks like an infinite loop because |
| 14:46 | mheld | /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:47 | mfex | .. because the recur is always with the same values |
| 14:47 | mheld | oh, I'm just being silly |
| 14:47 | metellus | yeah, you want (- s 1) |
| 14:47 | mheld | yeah, s |
| 14:47 | S11001001 | mheld: try using map over a range instead |
| 14:48 | mheld | that'd work too |
| 14:48 | mheld | (map (fn [n] (/ 1 4)) (range 4)) |
| 14:48 | mheld | beautiful |
| 14:49 | mfex | (repeat n (double (/ 1 n))) |
| 14:49 | mheld | there are a lot more neat little helper functions in clojure than in scheme |
| 14:50 | technomancy | solussd: nothing built-in yet, you would have to call pomegranate directly |
| 14:51 | mheld | thanks guys :-) |
| 14:51 | solussd | k thanks |
| 14:55 | technomancy | feel free to build what you are asking for; it sounds cool =) |
| 15:00 | johnfn | is 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:01 | johnfn | (or even better, an n-d array) |
| 15:02 | dnolen | johnfn: I'm assuming you mean vector when you say array |
| 15:02 | johnfn | right |
| 15:02 | johnfn | old habits :) |
| 15:02 | S11001001 | johnfn: I'd use a map in a map, but I hate for, so ignore me |
| 15:03 | dnolen | johnn: and by for statement - you mean list comprehension? |
| 15:03 | johnfn | hm i guess. wasn't aware that calling them for statements was wrong |
| 15:05 | dnolen | johnfn: they aren't imperative for loops - they are list comprehensions. |
| 15:06 | johnfn | yeah. but they do have the word "for" in them |
| 15:06 | johnfn | for macro? |
| 15:07 | dsantiago | Hey weavejester, I wrote a tiny wisp of a thing to make HTML into hiccup: http://github.com/davidsantiago/hickory |
| 15:09 | weavejester | dsantiago: That's interesting. How does JSoup compare to TagSoup? I know there's a clj-tagsoup project that does something similar... |
| 15:09 | dsantiago | Yeah, 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:10 | weavejester | I've been using clj-tagsoup for some projects of my own; I might switch over, as your implementation seems cleaner |
| 15:10 | weavejester | I'd be tempted to convert to a clojure.xml compatible DOM first, though. |
| 15:13 | weavejester | But that's mostly because I'm more interested in parsing HTML using XML zippers. |
| 15:17 | neotyk | hello everyone? |
| 15:17 | dsantiago | Yeah, 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:17 | dsantiago | Jsoup does a lot better. |
| 15:17 | weavejester | neotyk: Hello |
| 15:18 | weavejester | dsantiago: 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:19 | dsantiago | I 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:21 | dnolen | neotyk: about CLJS-204 I think you're not understanding my point. |
| 15:21 | dnolen | neotyk: are or are not those cases already handed by goog/defaultCompare |
| 15:21 | dnolen | handled |
| 15:21 | weavejester | dsantiago: Fortunately for me, I don't care about the doctype ;) |
| 15:22 | neotyk | dnolen: not sure, decided to perf test it |
| 15:22 | dnolen | neotyk: sure, but I'm pretty sure it will be slower |
| 15:22 | neotyk | dnolen: having special cases? |
| 15:22 | dnolen | neotyk: everything has to go through the slower path of protocol dispatch. |
| 15:23 | dnolen | neotyk: if they are already handled by goog/defaultCompare and more efficiently - there's not need for those extend-types |
| 15:23 | dnolen | no need |
| 15:24 | dnolen | neotyk: for example - the whole ns string comparison, what is that for? |
| 15:24 | neotyk | dnolen: keywords and symbols |
| 15:25 | dnolen | neotyk: aliased keywords get expanded. why can't that be a normal string equality test. |
| 15:27 | neotyk | dnolen: w/o special handling of strings ##(= -1 (compare :c :a/b)) failes |
| 15:27 | lazybot | ⇒ true |
| 15:28 | TimMc | S11001001: Will you be at the meetup? |
| 15:29 | S11001001 | TimMc: yes |
| 15:29 | TimMc | Cool. I don't think I've met you. |
| 15:29 | S11001001 | been there before? |
| 15:29 | TimMc | Last two. |
| 15:29 | S11001001 | I've been to all :) |
| 15:30 | jsabeaudry_ | I have an object whose state is false but cljs.core/truth_ returns true?! |
| 15:30 | TimMc | jsabeaudry_: (Boolean. false) |
| 15:30 | dnolen | neotyk: the patch is doing too much |
| 15:31 | dnolen | neotyk: lets just get the case specified in the ticket working. |
| 15:31 | dnolen | neotyk: comparison of keywords / symbols separate ticket. |
| 15:32 | dnolen | neotyk: compare on arrays in Clojure on the JVM does not work. |
| 15:32 | neotyk | dnolen: fair enough |
| 15:33 | dnolen | neotyk: compare on numbers via protocols will be very slow |
| 15:33 | dnolen | neotyk: same for booleans |
| 15:33 | dnolen | take those out. |
| 15:33 | jsabeaudry_ | TimMc, close, that object was in fact an atom that I forgot to deref |
| 15:33 | TimMc | Ah! |
| 15:42 | amalloy | dnolen, 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:43 | pandeiro | ,(java.net.URLDecoder/decode "(+ 1 2 3)") |
| 15:43 | clojurebot | "( 1 2 3)" |
| 15:43 | dnolen | amalloy: the Clojure order seems natural to me. |
| 15:44 | amalloy | &(compare :c :a/b) |
| 15:44 | lazybot | ⇒ -1 |
| 15:44 | TimMc | 15:41 < pandeiro> ,(java.net.URLDecoder/decode "(+ 1 2 3)") |
| 15:44 | TimMc | argh |
| 15:44 | halmbert | |
| 15:44 | halmbert | /join #haskell |
| 15:44 | TimMc | ,(java.net.URLEncoder/encode "(+ 1 2 3)") |
| 15:44 | clojurebot | "%28%2B+1+2+3%29" |
| 15:44 | amalloy | so, :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:44 | TimMc | &(compare 1 2) |
| 15:44 | lazybot | ⇒ -1 |
| 15:45 | neotyk | amalloy: exactly |
| 15:45 | amalloy | personally 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:45 | neotyk | $(compare 'a/b 'c/a) |
| 15:45 | TimMc | amalloy: Presumably it is a lexical sort on namespace (possibly empty) and name. |
| 15:46 | neotyk | &(compare 'a/b 'c/a) |
| 15:46 | lazybot | ⇒ -2 |
| 15:46 | amalloy | and 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:46 | neotyk | &(compare ['a 'b] ['c 'a]) |
| 15:46 | lazybot | ⇒ -2 |
| 15:46 | michaelr525 | hello |
| 15:49 | boyscared | question: 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:51 | boyscared | running M-x clojure-jack-in just gives the user=> prompt, but i wanted one that loads the entire project |
| 15:51 | amalloy | lein repl doesn't "load" the project either |
| 15:52 | TimMc | Sure it does. Or, it can. |
| 15:52 | neotyk | compile it |
| 15:52 | TimMc | lein repl uses :main or :repl-init to require a ns |
| 15:52 | boyscared | just started with clojure, so my verbiage may be off some |
| 15:53 | wkmanire | boyscared: Welcome to my club :) |
| 15:53 | neotyk | boyscared: C-c C-k in ns that you want to 'load' |
| 15:56 | S11001001 | or C-c C-l, depending on how you want errors to manifest |
| 15:57 | dsantiago | weavejester, I can take a crack at it in hickory if you give me some feedback about the data structure format. |
| 15:57 | raek | Blackavar: after the C-c C-k (or equivalent) you can use C-c M-p to enter the namespace in the REPL |
| 15:58 | boyscared | ah thanks |
| 15:59 | raek | Blackavar: oh, sorry! wrong nick :) |
| 16:00 | Blackavar | *nod* I gathered after the popup, heh. |
| 16:03 | a-question | hello, does clojure have nested namespaces? |
| 16:04 | raek | a-question: not really |
| 16:05 | Raynes | OH GOD MAKE IT STOP. |
| 16:05 | a-question | what :) |
| 16:06 | Raynes | Nothing in particular. |
| 16:06 | Raynes | :) |
| 16:06 | raek | you often organize namespace names hierachially, but that only affects their names and their location in the file system |
| 16:06 | tmciver | The voices in his head |
| 16:06 | a-question | it would be very helpful |
| 16:06 | a-question | when you have a lot of code |
| 16:06 | a-question | I think... |
| 16:07 | Raynes | Well, you can have src/foo/bar.clj and src/foo/bar/stuff_related_to_bar.clj, etc. |
| 16:07 | neotyk | is a.b nested in a ? |
| 16:07 | Raynes | Nope. |
| 16:08 | Raynes | It's just looks like it is. |
| 16:08 | neotyk | Raynes: I know |
| 16:08 | neotyk | a-question: is it? |
| 16:09 | a-question | so it's like nesting acutally |
| 16:10 | nDuff | ... |
| 16:11 | raek | a-question: you can still factor out some of the code of a namespace to a separate namespace |
| 16:11 | neotyk | nesting would be if some automatic require/use would happen |
| 16:11 | TimMc | a-question: You can't ask for a namespaces "children" or "parents", so... nope. |
| 16:12 | TimMc | *namespace's |
| 16:13 | neotyk | a-question: namespace is like package |
| 16:14 | a-question | I see |
| 16:14 | a-question | I need to test it in repl |
| 16:14 | pandeiro | TimMc: 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:15 | TimMc | pandeiro: Yes, except it needs to be done on the client side, whether that is curl or a web page. |
| 16:15 | TimMc | Might need to fiddle with jQuery.ajax's parameters, for instance. |
| 16:16 | a-question | thanks bye |
| 16:16 | pandeiro | TimMc: i think that's kind of more complex than necessary |
| 16:16 | pandeiro | easier to just eschew ring-params and slurp the body myself |
| 16:16 | pandeiro | that's all ring-clj-params does |
| 16:39 | Bronsa | wtf |
| 16:39 | alex_baranosky | wtf? |
| 16:39 | solussd | indeed.. |
| 16:39 | solussd | anyone download it? :) |
| 16:40 | FDFlock | SOMEONE BAN THAT IDIOT! He's spamming DCC requests |
| 16:40 | FDFlock | Jesus |
| 16:41 | nickmbailey | aha, was wondering what channel that was coming from |
| 16:42 | rmunn | The "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:42 | duck1123 | I had just added another service when those popped up. I assumed they came from there |
| 16:42 | AimHere | You sure it's a bug, rather than some bot firing off ctcp/dcc requests to troll freenode? |
| 16:42 | AimHere | Lots of people appear to have had the same spam |
| 16:42 | tensorpudding | hmm, ctcp spam to join #calculus, sounds like Tau |
| 16:42 | FDFlock | it sure seems like the latter to m e |
| 16:43 | FDFlock | *me |
| 16:43 | rmunn | Now I wish I *had* downloaded that file, I could have looked inside and seen what it was... |
| 16:43 | amalloy | i tried to accept, but he'd disco'd already |
| 16:43 | tensorpudding | but hmm |
| 16:43 | tensorpudding | talking about dash, dash doesn't hang here |
| 16:43 | rmunn | Nah, you're right, it was just CTCP spam now that I take a closer look at it |
| 16:43 | tensorpudding | is he staff |
| 16:53 | gfredericks | $google lein jenkins |
| 16:53 | lazybot | [Lein Jenkins | LinkedIn] http://www.linkedin.com/pub/lein-jenkins/43/3aa/3a2 |
| 16:53 | gfredericks | ^weird |
| 16:53 | technomancy | haha |
| 16:53 | aperiodic | haha, i thought it was a jenkins plugin for leiningen |
| 16:54 | technomancy | someone was offering a $300 bounty for lein-jenkins |
| 16:54 | technomancy | I hope they don't hunt this guy down by accident. |
| 16:54 | aperiodic | dead or alive? |
| 16:56 | gfredericks | I had no idea Lein was a given name |
| 16:56 | gfredericks | yet |
| 17:00 | TimMc | gfredericks: I named my first-born after lein. |
| 17:01 | progo | lein new, baby. All the way |
| 17:01 | ibdknox | Light Table officially has a second corporate sponsor: Thought Works :) |
| 17:01 | duck1123 | nice |
| 17:02 | Raynes | Thought Works is a cool company. |
| 17:02 | Raynes | But I have a soft spot for Ola Bini. |
| 17:02 | Raynes | Ioke was a cool experiment. |
| 17:04 | gdulus | is there anything like official web page for light table? |
| 17:04 | ibdknox | gdulus: haven't had the time yet |
| 17:04 | ibdknox | soon though |
| 17:04 | ibdknox | I'm 4ish days away from releasing the second demo |
| 17:05 | ibdknox | Also 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:06 | gdulus | anything near berlin? |
| 17:06 | brehaut | or new zealand :P |
| 17:06 | ibdknox | Oredev is in sweden |
| 17:06 | gfredericks | ibdknox: I assume if your SL talk is good it will be scheduled alongside the other top 4 talks |
| 17:07 | TimMc | Where is Strange Loop? |
| 17:07 | gfredericks | brehaut: alright, it's been long enough. Time to drop the "new" |
| 17:07 | TimMc | Middle US again? |
| 17:07 | ibdknox | hahahaha |
| 17:07 | brehaut | gfredericks: lol |
| 17:07 | TimMc | New Sealand |
| 17:07 | ibdknox | TimMc: St Louis |
| 17:07 | gfredericks | which is short for Stree Louis |
| 17:07 | gfredericks | Street* |
| 17:08 | TimMc | gfredericks: There's a St Stephens St in Boston. |
| 17:08 | gfredericks | TimMc: you mean boSTon |
| 17:09 | TimMc | Botolph's Stone |
| 17:10 | jsabeaudry_ | Is a top-level def thread local? |
| 17:11 | gfredericks | its root binding isn't |
| 17:11 | gfredericks | if you make it dynamic you can give it thread local bindings |
| 17:11 | jsabeaudry_ | This example is correct not matter how the threads are spawned: http://clojuredocs.org/clojure_core/clojure.core/locking ? |
| 17:32 | langmartin | just 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:33 | brehaut | they get chucked into a queue, so i presume so |
| 17:34 | raek-erc | langmartin: at most once, yes |
| 17:36 | langmartin | raek-erc: is there an at least case where they never fire at all? |
| 17:37 | langmartin | just validate-fn returning false? |
| 17:37 | langmartin | that's fine |
| 17:37 | S11001001 | langmartin: send in transaction, abort transaction |
| 17:38 | langmartin | I 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:38 | raek-erc | I was thinking of the case when the agent is in error state |
| 17:38 | raek-erc | but then sending to it results in an exception, I think |
| 17:39 | technomancy | raek-erc: how's erc treating you? |
| 17:39 | amalloy | send an agent an infinite loop: any future sends will never fire |
| 17:39 | raek-erc | another case when it doesn't get executed is when a previous action is stuck in an infinite loop |
| 17:39 | langmartin | well, sure |
| 17:39 | langmartin | ok |
| 17:39 | raek-erc | technomancy: it works prety well, I think |
| 17:40 | langmartin | I 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:40 | langmartin | which turned out to be hard to trigger on purpose |
| 18:45 | JorgeB | what's the memcached lib to be using nowadays? |
| 19:45 | espeed | When implementing a protocol, can an overloaded method call its overloaded counterpart? |
| 19:45 | brehaut | espeed: err… that implies inheritance does it not? |
| 19:46 | brehaut | and theres no inheritence with protocols |
| 19:46 | brehaut | oh wait. overloaded, not overridden. excuse me |
| 19:46 | espeed | no inheritance -- just overloading on arity |
| 19:47 | dnolen | espeed: yes, protocol methods always take the object as the first arg |
| 19:47 | dnolen | espeed: so just call the other arity on the object |
| 19:50 | espeed | dnolen: I'm getting an "unable to resolve symbol" https://gist.github.com/2722321 |
| 19:51 | dnolen | espeed: more context, what's the protocol definition look like. |
| 19:51 | dnolen | ? |
| 19:51 | espeed | (create-edge [this outV label inV] [this outV label inV data]) |
| 19:52 | dnolen | espeed: also less context, try it on a trivial example and see if that doesn't work. |
| 19:55 | espeed | dnolen: 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:55 | espeed | just wondering if it's supposed to work |
| 19:56 | dnolen | espeed: yes |
| 19:58 | espeed | then 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:01 | mebaran151 | hey #clojure, do defrecord's guarantee that they enumerate in the order that their keys are declared? |
| 20:06 | dnolen | espeed: not sure I follow. |
| 20:18 | espeed | dnolen: 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:19 | amalloy | espeed: your namespace didn't refer to the protocol function, only the protocl itself |
| 20:21 | espeed | ?? |
| 20:21 | lazybot | espeed: Uh, no. Why would you even ask? |
| 20:22 | dnolen | espeed: protocol fns are just regular functions - you need to bring create-edge into your namespace. |
| 20:22 | dnolen | well ... almost regular fns. |
| 20:30 | jweiss | anyone 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:30 | technomancy | jweiss: tmux is absolutely the way to go |
| 20:30 | technomancy | see if you can bribe zkim to finish http://pair.io because it is amazing =) |
| 20:38 | devn | woohoo! the perennial "I wonder if I can have clojure without parens to enhance adoption..." blog post! :D |
| 20:38 | devn | http://lmf-ramblings.blogspot.com/2012/05/clojure-with-python-syntax-part-ii.html |
| 20:38 | gfredericks | if you both have dual monitors, set up two tmux sessions with one emacs server. |
| 20:38 | jweiss | technomancy: with tmux i assume that everyone sees the same thing all the time? |
| 20:38 | technomancy | jweiss: right |
| 20:39 | technomancy | devn: we were overdue |
| 20:39 | hiredman | you can change that |
| 20:39 | jweiss | i 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:39 | technomancy | it's been nearly a year since the last one |
| 20:39 | technomancy | jweiss: you can do that, but it's not very good for pair programming |
| 20:39 | devn | technomancy: 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:39 | gfredericks | technomancy: my idea enables that pretty well |
| 20:39 | devn | and that moment is a major "ah ha" |
| 20:40 | devn | im excited for him honestly |
| 20:40 | jweiss | technomancy: ok i think tmux will probably work. thanks! |
| 20:40 | technomancy | gfredericks: yeah, it depends what you want I guess. |
| 20:40 | technomancy | I'm not sure what that kind of setup would be needed for but I guess it has its uses. |
| 20:40 | jweiss | lisp has been around since 1958, people have been trying to get rid of parens, since, what, 1959? |
| 20:41 | gfredericks | technomancy: no. all of my ideas apply universally. |
| 20:41 | devn | lol gfredericks |
| 20:41 | devn | (apply ideas universe) |
| 20:41 | gfredericks | devn: I was trying to express that idea without the parens |
| 20:41 | technomancy | hah |
| 20:46 | gfredericks | devn: is that last comment yours? |
| 20:47 | technomancy | wow, there are some good counter-trolls in that comment thread |
| 20:47 | technomancy | "Also, Python syntax is the reason why interpreter is slow and can't be considerably speed up (the same applies for ruby)" |
| 20:47 | brehaut | technomancy: O_o |
| 20:48 | technomancy | brehaut: 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:48 | brehaut | i missed the link |
| 20:48 | technomancy | I can't tell if this commenter is for real or not |
| 20:48 | technomancy | http://lmf-ramblings.blogspot.com/2012/05/clojure-with-python-syntax-part-ii.html |
| 20:48 | brehaut | thanks |
| 20:50 | TimMc | technomancy: Whitespace makes Python slow because the compiler has to use computer vision, which is still inefficient. |
| 20:50 | TimMc | *Significatnt whitespace |
| 20:50 | technomancy | hahaha |
| 20:50 | brehaut | Also, 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:51 | kkreamer | Wait... what? You mean someone is *wrong* on the Internet?! |
| 20:51 | technomancy | SBCL is fast because parens give the code a more aerodynamic shape. |
| 20:51 | dnolen | technomancy: haha |
| 20:52 | technomancy | dnolen: not as fast as XML though, for obvious reasons. |
| 20:53 | devn | Is anyone familiar with "reduction semantics"? What does that mean? |
| 20:53 | dnolen | devn: you talking about the new reducers stuff? |
| 20:56 | devn | dnolen: no, reading backus' turing award lecture |
| 20:57 | devn | choice quote thus far: "Conventional programming languages are basically high level complex versions of the von Neumann computer." |
| 20:57 | devn | http://www.stanford.edu/class/cs242/readings/backus.pdf |
| 20:57 | hiredman | most likely means the substitution model |
| 20:57 | hiredman | http://mitpress.mit.edu/sicp/full-text/sicp/book/node10.html |
| 20:58 | devn | dnolen: 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:58 | devn | I guess I'm trying to understand what that looks like. |
| 20:58 | gfredericks | hiredman: did you imply earlier that tmux can be more flexible than mirrored screens? I would like to know how. |
| 20:59 | devn | hiredman: thanks, reading now |
| 20:59 | devn | hiredman: oh. beautiful. yeah i think this is the ticket. thank you again. |
| 20:59 | hiredman | gfredericks: wemux is a set of scripts around making pairing with tmux better, but I've never used it |
| 20:59 | gfredericks | hiredman: okay, thx |
| 21:00 | hiredman | there 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:01 | devn | wemux is pretty sweet |
| 21:01 | devn | pair.io is sweeter. zkim needs to finish that. |
| 21:02 | hiredman | something like tmux -S /tmp/tmux-1000/pair new-session -t 0 where /tmp/tmux-1000/pair is an existing tmux socket, I think |
| 21:02 | devn | you just rattled that one off? |
| 21:02 | gfredericks | oh man I've been using -S this whole time when I should have been using -L |
| 21:03 | hiredman | grepped my .zhistory for tmux |
| 21:03 | devn | gfredericks: you may need to make the session world readable/writeable |
| 21:03 | devn | (if you're using separate user accounts (i didnt want my pair having full access to my entire machine)) |
| 21:03 | hiredman | yeah, -L for new sessions -S for attaching to existing |
| 21:04 | gfredericks | hiredman: my impression from the man page is the diff there is just name vs full path |
| 21:04 | gfredericks | yeah I just used -L for creating and for attaching |
| 21:06 | devn | dnolen: have you read that backus paper? |
| 21:06 | dnolen | devn: I have not |
| 21:06 | devn | err the turing award lecture? |
| 21:06 | devn | alan dipert was telling me about what he's discovering in the FP language. |
| 21:07 | devn | backus died while he was in the middle of his research. he said it is the "haunted house of functional programming" |
| 21:07 | devn | he defines things like: (comp (juxt f g) h) == (juxt (comp f h) (comp g h)) |
| 21:08 | devn | im still way newb on this, but it's really interesting to me so far, thought you might enjoy it |
| 21:08 | gfredericks | so comp is distributive over juxt? |
| 21:09 | devn | http://en.wikipedia.org/wiki/FP_(programming_language) |
| 21:09 | devn | it's inspired by APL, so bring your symbol +6 goggles of symbol comprehension |
| 21:10 | gfredericks | without having looked at that wikipedia article yet I think I might have seen that in my PL class |
| 21:10 | gfredericks | with accompanying video |
| 21:10 | devn | video!? |
| 21:10 | clojurebot | sicp videos is http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ |
| 21:10 | gfredericks | by backus |
| 21:11 | devn | i wonder if that's online somwhere... |
| 21:11 | gfredericks | please excuse me if I'm remembering something else though |
| 21:12 | devn | gfredericks: if you can find that video id be interested to see it |
| 21:12 | gfredericks | devn: I wouldn't know how to find it any better than you, except to put you in contact with the prof |
| 21:13 | devn | gfredericks: if you have an email ill ask him, sure |
| 21:13 | gfredericks | k I'll pm |
| 21:13 | devn | cool. thanks |
| 21:17 | espeed | dnolen: 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:21 | dnolen | espeed: that answer is not correct the second one is. |
| 21:35 | mebaran151 | is 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:37 | devn | technomancy: lein2 is acting weird on me. lein2 push is looking for a pom.xml in the target dir but none exists |
| 21:37 | technomancy | devn: upgrade the plugin |
| 21:38 | technomancy | also: we'll have lein deploy working with clojars shortly |
| 21:39 | technomancy | hopefully soon scp will be a legacy thing |
| 21:39 | chouser | dsantiago: you're awesome |
| 21:39 | devn | technomancy: cool. thanks. |
| 21:41 | devn | technomancy: should i quit trying to use both lein and lein2 together? |
| 21:41 | technomancy | devn: is there anything keeping you on lein1? |
| 21:41 | chouser | dsantiago: tinsel 0.4.0 works well |
| 21:41 | devn | technomancy: that just answered me question. thanks. |
| 21:53 | devn | heh: [midje "1.0.0-COLLECTORS-EDITION"] A TDD library for Clojure, with an emphasis on mocks |
| 21:54 | devn | technomancy: search in lein2.. maybe im doing it wrong but it didn't find the most recent version |
| 21:54 | technomancy | maybe your indices are out of date |
| 22:06 | dsantiago | chouser: Great! I'm glad that fixed it. Sorry about the initial problems. |
| 22:06 | technomancy | amalloy: 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:07 | amalloy | technomancy: 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:08 | amalloy | plus |
| 22:08 | amalloy | sometimes i inflate it |
| 22:08 | amalloy | talking like this, you know? |
| 22:08 | technomancy | I was wondering about that |
| 22:09 | devn | technomancy: you run numbers on the logs? any reason why? |
| 22:09 | devn | https://gist.github.com/2722720 -- any tips for making process-line less disgusting? |
| 22:09 | amalloy | but 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:09 | technomancy | devn: working on an article on distributed workers |
| 22:09 | technomancy | log analysis is a nice approachable sample problem |
| 22:10 | technomancy | amalloy: sure |
| 22:10 | technomancy | you |
| 22:10 | technomancy | do |
| 22:13 | devn | technomancy: for heroku or for your blog? |
| 22:13 | technomancy | for heroku |
| 22:14 | devn | cool. looking forward to seeing it. can i make a request that you post something on using datomic with heroku mebbe? |
| 22:15 | technomancy | most of the devcenter sample apps stick with heroku addons |
| 22:15 | devn | which begs the question... :) |
| 22:16 | fil512 | how do I flatten a map into a list of vectors? {'a |
| 22:16 | technomancy | I don't really think datomic needs more docs on how to use Clojure with it. |
| 22:16 | devn | &(into '() (seq {:a 1 :b 2})) |
| 22:16 | lazybot | ⇒ ([:b 2] [:a 1]) |
| 22:16 | devn | err duh |
| 22:16 | devn | &(seq {:a 1 :b 2}) |
| 22:16 | lazybot | ⇒ ([:a 1] [:b 2]) |
| 22:17 | fil512 | sorry i wanted to write the example |
| 22:17 | fil512 | it's actually a map of maps |
| 22:17 | devn | fil512: sure, go ahead |
| 22:17 | fil512 | the keys i want in the first two columns |
| 22:17 | devn | fil512: give the input and expected output |
| 22:17 | fil512 | my syntax might not be right |
| 22:18 | fil512 | {:a {:x (1 2) :y (3 4)} :b {:x (1 2) :z (5 6)}} |
| 22:18 | fil512 | not sure if I wrote that right |
| 22:19 | dsantiago | chouser: Also, did yo usay you were interested in analyzing the HTML as if it was the data structures from clojure.xml? |
| 22:19 | fil512 | for output I want (:a :x 1 2) (:a :y 3 4) (:b :x 1 2) (:b :z 5 6) |
| 22:19 | devn | fil512: im thinking something in clojure.walk is what you want |
| 22:22 | fil512 | clojure.walk looks heavy for what I need |
| 22:23 | fil512 | i just need to flatten a couple of nested maps |
| 22:24 | xeqi | &(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:24 | lazybot | java.lang.RuntimeException: Unsupported character: \ :y |
| 22:24 | xeqi | &(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:24 | lazybot | ⇒ ((:a :x 1 2) (:a :y 3 4) (:b :x 1 2) (:b :z 5 6)) |
| 22:25 | xeqi | though thats limited to a single nesting |
| 22:26 | devn | xeqi: nice. |
| 22:28 | devn | xeqi: stole your solution for clojuredocs :) http://clojuredocs.org/clojure_core/clojure.core/mapcat |
| 22:43 | fil512 | um |
| 22:43 | fil512 | is it a coincidence |
| 22:43 | fil512 | or |
| 22:43 | fil512 | how come when I'm reading the example for mapcat |
| 22:43 | fil512 | I'm reading my example? |
| 22:44 | fil512 | holy crap defn just edited it 16 minutes ago! |
| 22:44 | fil512 | you guys are freakin me out |
| 22:44 | brehaut | man, using for in a mapcat seems so weird to me |
| 22:45 | brehaut | doubly so to also be using a concat in it |
| 22:46 | fil512 | i kinda figured if I'm using "for" in clojure I'm probably doing something wrong |
| 22:47 | fil512 | 'cause I never know what to put once I'm in the inside of the loop |
| 22:47 | emezeske | fil512: That specific example aside, "for" is a very, very good thing to use in clojure, in general |
| 22:47 | fil512 | but often what you're doing is mapping from one collection to another |
| 22:47 | fil512 | if you use a for loop |
| 22:47 | fil512 | then inside the loop, the natural thing to do is to add your item to the output collection |
| 22:47 | emezeske | Exactly. |
| 22:47 | fil512 | but adding items to a collection is an anti-pattern in clojure |
| 22:48 | emezeske | Natural, maybe, if you come from an imperative background |
| 22:48 | emezeske | Anyway, "for" is great, get used to using it a lot and you will be happy |
| 22:48 | fil512 | I think what I want to do is something like this: |
| 22:49 | brehaut | for is perfectly functional. its not imperative for (thats doseq) |
| 22:50 | fil512 | (collect into collectionX using fn (for [ x (...) y (...) (fn (x y stuff))])) |
| 22:50 | fil512 | but I don't know how to do that |
| 22:50 | brehaut | there is nothing at all wrong with using for to do a mapping |
| 22:51 | brehaut | ,(into {} (for [x (range 3) y [:a :b]] (vector x y))) |
| 22:51 | clojurebot | {0 :b, 1 :b, 2 :b} |
| 22:51 | fil512 | yes yes! |
| 22:51 | fil512 | that is the kind of thing I am looking for |
| 22:52 | fil512 | let me give that a try |
| 22:53 | brehaut | that is incidentally a weird example, because the map keys will overwrite each other |
| 22:53 | xeqi | &(for [[k v] '{:a {:x (1 2) :y (3 4)} :b {:x (1 2) :z (5 6)}} [k2 v2] v] \ |
| 22:53 | lazybot | java.lang.RuntimeException: EOF while reading character |
| 22:53 | xeqi | bah |
| 22:54 | fil512 | that is exactly what I needed |
| 22:54 | fil512 | my code looks like this |
| 22:54 | fil512 | (defn get-report [records-bh-bd] |
| 22:54 | fil512 | (into () |
| 22:54 | fil512 | (for [host (keys records-bh-bd) |
| 22:54 | fil512 | date (keys (records-bh-bd host))] |
| 22:54 | fil512 | (let [uptime (get-uptime ((records-bh-bd host) date))] |
| 22:54 | fil512 | (vector host date uptime) |
| 22:54 | fil512 | )))) |
| 22:54 | brehaut | fil512: use refheap.com for multiline code blocks |
| 22:55 | fil512 | will do. sorry bout that. |
| 22:55 | xeqi | you guys are right, that was weird code |
| 22:55 | xeqi | a single for on the outside is good enough |
| 22:55 | fil512 | so I don't need the "into"? |
| 22:55 | technomancy | fil512: you don't need to pour the result of for into a seq; it's already a seq |
| 22:56 | fil512 | sweet |
| 22:56 | fil512 | damn I love clojure |
| 22:57 | fil512 | for my output, I'm getting a sequence of vectors I call "report" |
| 22:58 | fil512 | when i try to print the last vector, it prints all of them |
| 22:58 | fil512 | I do (println last report) |
| 22:58 | fil512 | shouldn't last report give me the last vector? |
| 22:58 | fil512 | oh |
| 22:58 | fil512 | stupid me |
| 22:58 | fil512 | never mind |
| 22:59 | foxdonut | :D |
| 22:59 | fil512 | (println (last report)) |
| 22:59 | foxdonut | ,(vector "host" "date" "uptime") |
| 22:59 | clojurebot | ["host" "date" "uptime"] |
| 22:59 | foxdonut | ,["host" "date" "uptime"] |
| 22:59 | clojurebot | ["host" "date" "uptime"] |
| 23:00 | foxdonut | ,(= (vector "host" "date" "uptime") ["host" "date" "uptime"]) |
| 23:00 | clojurebot | true |
| 23:03 | fil512 | do you keep your tests in the same ns as the code under test? |
| 23:07 | fil512 | do you write tests? |
| 23:07 | technomancy | most people keep them in separate files |
| 23:07 | fil512 | i do too |
| 23:07 | fil512 | I was curious if you use a different ns |
| 23:07 | fil512 | I'm finding I need to use different names in my test files to avoid collisions |
| 23:08 | fil512 | was wondering what most ppl do |
| 23:08 | fil512 | in java we usually use same package... |
| 23:08 | technomancy | just use `lein new myproject` and work from there |
| 23:09 | fil512 | that's not going to tell me whether test files use same namespace as code..? |
| 23:09 | technomancy | sure it is |
| 23:11 | PeregrinePDX | The default files created with lein new has a test file and it is in a seperate namespace |
| 23:12 | fil512 | thanks pere |
| 23:12 | fil512 | I'm pretty happy with eclipse / maven for now |
| 23:13 | PeregrinePDX | lein doesn't replace eclipse. |
| 23:13 | fil512 | i know, but it does replace maven and counterclockwise |
| 23:13 | fil512 | (counterclockwise is the REPL plugin for eclipse) |
| 23:14 | technomancy | counterclockwise works with Leiningen |
| 23:15 | fil512 | but maven plays so nice with the java world |
| 23:15 | PeregrinePDX | But clojure is not java.... |
| 23:15 | brehaut | lein is like tasty, lickable icing on top of the not so taste maven cake |
| 23:16 | PeregrinePDX | It runs on the jvm and is interoperable but it is not java. |
| 23:16 | brehaut | alternatively you can think of lein as maven without the burnt scalp |
| 23:17 | fil512 | brehaut: lol |
| 23:17 | brehaut | talios would disagree ;) |
| 23:17 | fil512 | I anticipate needing to call java from my clojure projects |
| 23:18 | fil512 | so managing all the deps in maven feels like it makes sense |
| 23:18 | brehaut | fil512: lein uses maven under the hood to handle all its deps. lein dependancies are maven dependancies |
| 23:18 | talios | Nothing 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:20 | brehaut | fil512: look at https://github.com/mmcgrana/ring/blob/master/ring-jetty-adapter/project.clj |
| 23:20 | brehaut | fil512: thats the project file for the ring jetty adapter. it depends on both clojure code (ring/…) and a java code (org.eclipse.jetty/…) |
| 23:21 | brehaut | anything that lets me compile basic with lein is a win in my book |
| 23:21 | fil512 | yes 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:22 | fil512 | not to mention our corporate repository... |
| 23:24 | technomancy | nothing you've said is specific to maven |
| 23:24 | technomancy | I mean, use what you like, but just so you know. |
| 23:25 | fil512 | say i have some java projects with a shared parent pom |
| 23:25 | fil512 | and i want to add a clojure project to the mix |
| 23:25 | fil512 | and share the same parent pom |
| 23:25 | fil512 | to ensure common version numbers of dependencies, repositories etc. |
| 23:25 | fil512 | then it feels like using maven for the clojure piece is the way to go |
| 23:26 | fil512 | or can a lein project file refer to a maven parent pom...? |
| 23:26 | talios | technomancy - can lein use a parent maven pom at all? |
| 23:26 | talios | probably not easily I guess, not sure how much "uses maven under the covers" means "uses maven" |
| 23:27 | xeqi | for lein2 it means using aether |
| 23:27 | fil512 | why is println printing "nil" in front of all my vectors...? |
| 23:27 | brehaut | fil512: in the repl, that isthe return value of println |
| 23:27 | technomancy | talios: I think hugod has a plugin for that |
| 23:27 | technomancy | but it seems like people prefer using middleware |
| 23:28 | fil512 | ha |
| 23:28 | fil512 | because my for loop is the last line in my file! |
| 23:28 | gfredericks | fil512: it is also the return value of println when you're not in the repl |
| 23:28 | brehaut | gfredericks: points for pedanticness |
| 23:28 | fil512 | what do u usally put for your last line in a run to avoid this? |
| 23:28 | gfredericks | (inc gfredericks') |
| 23:28 | lazybot | ⇒ 1 |
| 23:29 | gfredericks | ^new naming convention for self-karma |
| 23:29 | brehaut | lol |
| 23:30 | gfredericks | fil512: how're you running your code? |
| 23:30 | fil512 | hitting ctrl-alt L in eclipse |
| 23:30 | fil512 | that throws the file I'm editing into the REPL and runs it |
| 23:31 | gfredericks | sounds like you probably can't avoid it. it'll return something. may as well be nil. |
| 23:31 | fil512 | well it's in a for loop, so it's returning a whole lot of nils... |
| 23:32 | brehaut | fil512: paste your code somewhere. |
| 23:32 | brehaut | (http://refheap.com for instance) |
| 23:32 | gfredericks | fil512: oh. then write nil at the bottom :) |
| 23:32 | gfredericks | or ::stupid-dummy-value-ignore-this |
| 23:33 | xeqi | or doseq? |
| 23:33 | fil512 | https://www.refheap.com/paste/2779 |
| 23:33 | brehaut | yeah, definately doseq there |
| 23:33 | fil512 | that's the last line of my run.clj |
| 23:33 | fil512 | ? |
| 23:34 | brehaut | fil512: for returns a sequence |
| 23:34 | gfredericks | leave it to somebody else to improve on my suggestion |
| 23:34 | fil512 | my eyes are opened |
| 23:34 | brehaut | every element of your sequence is the result of print |
| 23:34 | brehaut | so for ever record in report, a nil is generated |
| 23:34 | fil512 | brilliant |
| 23:34 | fil512 | i get it now |
| 23:34 | brehaut | fil512: simple rule of thumb: dont do side effects in lazy ops. use doseq for strict, side effecting code |
| 23:35 | brehaut | fil512: also, no hanging parens |
| 23:35 | brehaut | fil512: http://mumble.net/~campbell/scheme/style.txt |
| 23:42 | fil512 | i find hanging parens useful in ns functions and deftests where I'm likely to add more lines |
| 23:43 | brehaut | when you are more comfortable with clojure, learn paredit and stop caring. |
| 23:43 | brehaut | structural editing means never having to count parens again |
| 23:43 | fil512 | is there a paredit plugin for eclipse? |
| 23:43 | brehaut | CCW |
| 23:43 | brehaut | you are already using it |
| 23:44 | fil512 | how will it let me insert a new line and split the parens in the right place? |
| 23:45 | brehaut | it makes it trivial to navigate around the s-expression. you stop editing text and start editing structures |
| 23:45 | fil512 | are there keystrokes I need to learn? |
| 23:45 | brehaut | well yes |
| 23:45 | brehaut | thats why i said wait until you've got a bit more familiar with clojure |
| 23:47 | fil512 | i see |
| 23:47 | fil512 | ctl-shift p |
| 23:47 | fil512 | ctl-alt a |
| 23:47 | fil512 | interesting... |
| 23:47 | fil512 | question |
| 23:47 | fil512 | how do you decide how many functions go into one file? |
| 23:48 | fil512 | do you ever have 2 files with the same namespace? |
| 23:48 | brehaut | rarely |
| 23:48 | brehaut | clojure.core does it, but core is a monster |
| 23:48 | brehaut | and not strictly idiomatic |
| 23:48 | fil512 | right 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:48 | brehaut | file per function is probably wrong yes |
| 23:49 | fil512 | i have 2-5 functions per file right now |
| 23:49 | brehaut | namespaces are just logical groupings |
| 23:49 | brehaut | so if its logical for the content to be grouped together then its fine. |
| 23:50 | brehaut | if you have two groups of stuff in one namespace it might be worth breaking it out into two namespaces |
| 23:51 | fil512 | I guess once Light Table is out, it won't matter. |
| 23:51 | fil512 | You seen Light Table? |
| 23:51 | fil512 | http://www.kickstarter.com/projects/ibdknox/light-table |
| 23:51 | brehaut | of course it will matter |
| 23:51 | fil512 | not as much... |
| 23:51 | brehaut | a namespace is a logical group, not a physical group |
| 23:52 | fil512 | fair enough |
| 23:52 | brehaut | the file is merely a conveninent serialisation |
| 23:52 | fil512 | but i like how in Light Table you're not editing files any more, your editing related functions |
| 23:52 | brehaut | and yes. i think you can safely assume that everyone in #clojure is familiar with light table. probably backed it too |
| 23:52 | fil512 | :-) |
| 23:52 | fil512 | I backed it |
| 23:53 | PeregrinePDX | I dunno. I doubt ibdknox backed it through kickstarter. |
| 23:56 | fil512 | any1 here using clojure commercially? |
| 23:56 | ibdknox | I am! |
| 23:56 | ibdknox | ;) |
| 23:57 | chouser | Me too |
| 23:57 | PeregrinePDX | I almost said that I thought you might be, ibdknox. |
| 23:57 | fil512 | must be an inside joke i don't get... |
| 23:57 | ibdknox | chouser is also a Chris :) |
| 23:57 | PeregrinePDX | Uh ibdknox is the creator of light table... |
| 23:57 | metellus | look at the url to the light table kickstarted a little closer, fil512 |
| 23:58 | metellus | kickstarter |
| 23:58 | fil512 | how do you find working in clojure with mixed skill teams? |
| 23:58 | fil512 | hi ibdknox u rock |
| 23:58 | fil512 | we are a developer shop with 120 developers |
| 23:58 | ibdknox | haha thanks :) |
| 23:58 | fil512 | different skill levels |
| 23:59 | fil512 | in java I feel safe |
| 23:59 | brehaut | my solution is to not work with other developers ;) |
| 23:59 | fil512 | I know their code will more or less be intelligable to other java developers |
| 23:59 | fil512 | but I worry about clojure |