#clojure log - Feb 17 2013

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:50 abp: Protocol extension to instances isn't implemented in Clojure by now, right?

0:50 Is there some sort of scoped protocol extension?

1:04 callenbot: Raynes: 11pt - Menlo, Monaco, "Ubuntu Mono", monospace;

1:04 Raynes: I hate Ubuntu Mono.

1:04 abp: robert.hooke

1:05 callenbot: Raynes: can we compromise on something that isn't Deja Vu Mono?

1:05 Raynes: it's horrendous. Also the Menlo/Monaco is so it doesn't look awful on my mac.

1:05 Raynes: at least adding Menlo to the front of the list would improve my sanity.

1:05 Raynes: you should considering using a CSS preprocessor to avoid the CSS rule duplication I saw as well.

1:05 Raynes: callenbot: The first two are mac fonts, the one after that is an Ubuntu font, and then you drop to whatever is default.

1:06 And no.

1:06 callenbot: Raynes: Windows users aren't people.

1:06 Raynes: I don't care about Windows users.

1:06 Other Linux distros.

1:06 callenbot: what's wrong with using Menlo specifically? It'll look better.

1:06 clifton: I've spent a decent amount of time with a lot of fixed-width fonts and I got sick of everything except Menlo

1:06 Raynes: I can evaluate Menlo and see if it is pretty to me (I've always been fond of Monaco), but I'm putting Deja Vu before Ubuntu Mono.

1:06 callenbot: clifton: *thank* you.

1:07 Raynes: Can we compromise on that?

1:07 callenbot: Raynes: sounds great to me.

1:07 Raynes: Coolio.

1:07 I'm working on some refheap stuff right now, but I'll put this on my todo list.

1:07 callenbot: Raynes: what about the font size?

1:07 Raynes: I'll play with that too.

1:08 callenbot: Raynes: http://i.imgur.com/v268Sbk.png menlo 11px

1:08 Raynes: with that, I'll get back to my new project. Cheers and thanks for considering it :)

1:08 Raynes: I'll almost certainly do it. I just wanted Deja Vu before Ubuntu Mono.

1:09 callenbot: Raynes: totally cool with me. I know UM is a polarizing font.

1:09 Raynes: I know a ton of people who love Deja Vu too, and most of them are not mac users. So I'm pretty sure it is the best option after mac specific fonts.

1:10 callenbot: they look wide/fat to me.

1:11 clifton: with deja vu, dotted 0 drives me a little nuts

1:11 but i suppose thats more of a personal thing

1:11 it's a decent font

1:15 Raynes: callenbot: FWIW, Deja Vu wasn't the default out of my specific love for it. I asked a bunch of people what they wanted and it turned out to be that.

1:15 callenbot: Raynes: like any good Commissar, I respect the will of the proletariat.

1:15 Raynes: Haha

1:17 callenbot: Everytime I talk to weavejester I learn something new but am also firmer in my belief that we could never review each others' code.

1:18 abp: callenbot: What are you looking at? :D

1:19 callenbot: abp: I'm hacking up code.

1:20 abp: callenbot: Thought you were looking into weavejesters code.

1:21 callenbot: abp: no, I mean literally when I talk to him in IRC.

1:21 abp: I was reflecting on our last conversation.

1:21 so apparently a constructive blog post these days involves writing two lines in a yaml config to change your database connection pool size

1:21 if I'd known that, I could've written 30 posts about my last week of work.

1:21 maybe 90.

1:22 ooooooh Watsi. Right.

1:28 abp: callenbot: Hm, at least his "I tend to prefer to keep data constrained, which is why I prefer a *user* over a more general context map" is great. From the guy who stands in front of many people and tells them how a single map for a whole http-request and -response is excellent. :D

1:29 callenbot: abp: on the one hand, it pleases me greatly that you noticed this too. On the other hand, you are probably nuts and I'm not sure I want to be of like mind as you.

1:29 abp: callenbot: Watch the latest hickey talks, probably he is sane if I'm no more.

1:30 callenbot: Clojure programmers invoke Hickey like Catholics and Protestants invoke thegr God.

1:30 abp: callenbot: That comes from him building things that work.

1:31 callenbot: Hickey is brilliant but everyone assumes he's saying what they're thinking and that they're right because of it.

1:31 perhaps the phrase should be, "to know the mind of Hickey" instead.

1:31 I assert that the mind of Hickey is unknowable to all mortal men.

1:32 abp: Hm, difficult. I agree with the things that I think are really valuable. And such are many.

1:33 callenbot: As do I, but who has the most accurate interpretation of the Hickey's holy words?

1:35 greywolve: is there a way to get an atom to increment before running lein test in such a way that my tests can see this atom? right now when i try do this it creates a different atom before running the tests ;|

1:35 abp: callenbot: Uh, let's call Hickey on that. :D Endless spam floods ahead. "He put my state up my ars* just because I didn't split it up."

1:36 callenbot: greywolve: dafuq

1:37 abp: greywolve: If you are trying to mock global atoms or whatever; don't. http://vimeo.com/46163090

1:37 greywolve: Probably you can even get rid of it. :P

1:37 callenbot: abp: are you making fun of my put-context?

1:37 abp: you're making fun of put-context aren't you?

1:38 greywolve: abp: not trying that ;p trying to do this: http://corfield.org/blog/post.cfm/automated-browser-based-testing-with-clojure

1:38 callenbot: abp: thems fightin' words boy.

1:38 abp: callenbot: Whoat, never!

1:38 callenbot: A fine choice.

1:39 abp: callenbot: Only when I ate your byte :P

1:39 greywolve: but sadly it's not working like it should . due to the tests not seeing the incremented atom

1:40 abp: greywolve: Sorry, haven't done any automated browser testing, callenbot could consult on that. :P

1:40 callenbot: greywolve: you don't want to talk to me about automated browser testing. It drives me to drink and I don't use selenium if I can help it.

1:41 greywolve: I use casperjs usually.

1:41 greywolve: abp: thanks anyway, sigh, it seems overly complicated just to run some code before and after doing lein test that my tests can reference

1:41 greywolve: i can see why!

1:42 callenbot: I'm not you, bro.

1:42 greywolve: callenbot: i can see why!

1:42 haha

1:42 whoops

1:42 callenbot: I need more sake if I'm going to get this app done this weekend.

1:42 lots more sake.

1:43 greywolve: clj-webdriver is great though, i just want to have all the tests run in a single browser session

1:44 callenbot: greywolve: I am githubbing. It looks nice.

1:45 greywolve: https://groups.google.com/forum/#!topic/clj-webdriver/z9hYKR4fOZE

1:45 yogthos: hey chief.

1:46 greywolve: (def ^:private browser-count (atom 0))

1:46 (defn browser-up

1:46 "Start up a browser if it's not already started."

1:46 []

1:46 (when (= 1 (swap! browser-count inc))

1:46 (set-driver! {:browser :firefox})

1:46 (implicit-wait 60000)))

1:46 when i run lein test, the atom gets incremented, then it runs each of the test files, but they see the atom as 0

2:05 is there any way to easily require all the test namespaces into the repl?

2:06 eg if i have testsuite.test1, testsuite.test2 etc and i just want all the testsuite namespaces required?

2:38 seancorfield: does this: http://corfield.org/blog/post.cfm/automated-browser-based-testing-with-clojure work for you in lein 2? selenium opens 2 firefox windows for me

2:55 seancorfield: greywolve: sorry, just noticed your question...

2:55 well, we're using lein 2 now and what we are doing works... so let me double check my blog post

2:56 let me double check our current source code against what's in that blog post

2:56 greywolve: seancorfield: when i run lein test, and println the browser-test atom, i notice the first atom printed is different from the atoms the tests see

2:57 thanks ;)

2:57 seancorfield: i run lein with-browser test

2:57 greywolve: yeah sorry i mean lein with-browser test

2:58 lein with-browser test

2:58 #<Atom@567ba718: 0>

2:58 lein test testsuite.anothertest

2:58 Testing testsuite.anothertest

2:58 #<Atom@7b4da77: 0>

2:59 seancorfield: did you remember to add :eval-in :leiningen to project.clj?

2:59 greywolve: yup

2:59 without that it won't run at all

3:00 seancorfield: the blog post seems to match our current source code

3:00 clj-webdriver 0.6.0-beta2 ?

3:00 greywolve: yeah, and clojure 1.5

3:00 seancorfield: and we have to have :exclusions [org.clojure/core.cache] but that might not affect you

3:00 hmm, let me try clojure 1.5 - we're on 1.4

3:01 greywolve: i just don't understand why two separate atoms are being created in my case ;p

3:02 i think i've tried with 1.4 aswell but perhaps that is the problem

3:03 seancorfield: works just fine with 1.5.0-RC16 here - just tried it

3:03 greywolve: woah, this is strange then

3:04 what os are you running?

3:06 seancorfield: mac os 10.7.5

3:07 and firefox 3.6.12 i believe (had problems with later versions and selenium)

3:07 greywolve: linux mint 14 here (ubuntu 12.10)

3:08 its almost like lein is first running the with-browser code in a separate environment, before loading all the test files

3:08 seancorfield: in your tests, are you reloading the ns?

3:08 greywolve: hence the two different atoms

3:09 each test looks like the example you gave:

3:09 (ns testsuite.test.profile-scripts

3:09 (:require [clj-webdriver.taxi :refer :all]

3:09 [clojure.test :refer :all]

3:09 [testsuite.core :refer :all]))

3:09 (deftest edit-my-profile

3:09 (browser-up)

3:09 (login :eg "testuser" "secret")

3:09 (go-to :eg "/profile/edit")

3:09 (input-text "#aboutme" "I like long walks on the beach and being a snugglebunny.")

3:09 (click "#btnSaveProfile2")

3:09 (is (= "Your profile has been successfully updated." (text ".success p")))

3:09 (is (= "In order for your profile to appear to other members, please fill out the missing fields identified below." (text ".warning p")))

3:09 (browser-down))

3:10 but just with (browser-up) and (to "some url") and (browser-down)

3:10 seancorfield: hmm, dunno... my brain's not exactly in a good debugging state right now (it's midnight and several beers down :) )

3:10 greywolve: hahah thanks for the help anyway, appreciate it ;)

3:11 but yeah, does seem like somewhere the namespace is being reloaded

3:11 seancorfield: that sounds like a problem i ran into early on but fixed before i blogged about it

3:12 i'm sure it was something to do with :eval-in :leiningen

3:12 greywolve: (defproject clj-webdriver-boilerplate "0.1.0-SNAPSHOT"

3:12 :description "clj-web-driver-boilerplate"

3:12 :url "http://www.github.com/greywolve/clj-webdriver-boilerplate"

3:12 :license {:name "MIT License"

3:12 :url ""}

3:12 :dependencies [[org.clojure/clojure "1.5.0-RC16"]

3:12 [clj-webdriver "0.6.0-beta2"]]

3:12 :eval-in :leiningen)

3:12 this is correct?

3:12 seancorfield: yup

3:13 and your testsuite.core has the (dissoc project :eval-in) ?

3:13 greywolve: yeah

3:13 seancorfield: weird

3:14 greywolve: in your blog post, for the require

3:15 (ns leiningen.with-browser

3:15 (:require [webdriver.core :refer [browser-up browser-down]]

3:15 [leiningen.core.main :as main]))

3:15 webdriver.core

3:15 that is a mistake right? ;p

3:15 i replaced it with testsuite.core

3:15 seancorfield: should be testsuite.core, yeah

3:15 greywolve: ah ok, now i really don't know haha

3:16 seancorfield: sorry

3:17 greywolve: what does dissoc project :eval-in do? well i know what it does but what's the reason for it?

3:18 seancorfield: I no longer remember why that was needed...

3:18 something to do with how the tests run...

3:21 greywolve: ah ok , the quirks of lein ;0

3:21 seancorfield: Hmm, just tried it without the dissoc and it still works... so maybe that was a workaround for a bug in a preview of lein2?

3:21 greywolve: hmm yeah could be

3:22 seancorfield: try passing just project instead of (dissoc project :eval-in) and see if that solves it?

3:24 greywolve: nope same thing, but it does still run fine, just opens 2 firefox windows ;p good to know its not needed anymore though!

3:26 Leiningen 2.0.0 on Java 1.7.0_07 OpenJDK 64-Bit Server VM

3:26 this may me some kind of lein bug i guess

3:27 for ubuntu ;p

3:32 ohhhhh wait a minute

3:33 Raynes: dsantiago: Just occurred to me that hickory escaping all text means that it is impossible to run a large piece of stored HTML through hickory-to-html without first parsing the HTML, which can add quite a bit of overhead if done per an http request. Didn't we discuss adding an option at some point? Seems like an option to turn off the automatic escaping of strings would be helpful here. Pretty sure there is no situation where anybody would

3:33 ever want it off for attributes.

3:34 dsantiago: No idea what you're talking about.

3:34 arrdem: Raynes: I'm reading your update path from Noir to Lib-noir, what is the "best practice" for structuring route records? one list per file as you do for refheap?

3:34 Raynes: The reason it occurred to me because refheap uses pygments to generate the highlighted HTML and then stores that highlight html in the db, and it can be fairly large depending on the size of the paste. In order to inject that HTML into a larger document I have to first parse it to hickory nodes.

3:35 greywolve: lein with-browser test testsuite.test.anothertest testsuite.test.sometest

3:35 works

3:35 what's happening is testsuite.core is being loaded again!

3:35 Raynes: It works, but it's slow to do on every request and there is no way to just put the string in there, because hickory-to-html always escapes strings.

3:35 dsantiago: ^ Does any of that make sense?

3:36 arrdem: Dunno what everyone else does. That's just the way I do it.

3:36 dsantiago: Is this because you are using hickory-to-html as the backend for a template system, which I've told you not to do?

3:36 arrdem: Raynes: mmkay. cheers.

3:36 Raynes: Meh.

3:39 seancorfield: greywolve: so are you saying it works if you specify namespaces but if you don't, you get two browsers? or the other way around?

3:39 Raynes: arrdem: 4clojure is also structured similarly.

3:39 But I guess I did that too...

3:39 greywolve: it works if i specify the namespaces ;p

3:39 seancorfield: weird...

3:40 greywolve: lein with-browser test

3:40 #<Atom@51f28023: 0>

3:40 lein test testsuite.core

3:40 Testing testsuite.core

3:40 lein test testsuite.test.anothertest

3:40 Testing testsuite.test.anothertest

3:40 it makes sense, look at that

3:40 its running testsuite.core as a test

3:40 so its reloading the namespace essentially

3:40 seancorfield: oh!!!!!! right!!!

3:40 greywolve: ;p

3:40 seancorfield: i have testsuite.core in src/ not test/

3:40 greywolve: ohhhhhhh

3:40 seancorfield: that's your problem!

3:40 greywolve: haha ;) that solves it then!

3:43 seancorfield: thanks so much! do you mind if i setup a clj-webdriver-boilerplate repo with this?

3:43 seancorfield: sure, knock yourself out!!

3:44 i've updated the blog post to show testsuite.core lives in src/ and also fixed the webdriver.core typo

3:44 thanx for spotting the latter and helping me clarify the former!

3:45 damn, i need to be up in six hours to drive to so. cal. - better go to bed!

3:45 greywolve: pleasure, ill link to your post in the repo ;)

3:45 nn!

3:53 arrdem: Raynes: mmkay makes more sense than the "one file of routings" approach I was considering as an alternative

5:46 samrat: how can I import hiccup templates from outside my project?

5:47 here's my attempt using pushbackreader, but it seems to only bring in the first function: https://www.refheap.com/paste/11383

6:20 borkdude: yogthos|away tnx for the Luminus website

7:12 greywolve: https://github.com/greywolve/clj-webdriver-boilerplate

7:13 if anyone is struggling with acceptance testing that will help, all thanks to seanaway

8:04 michaelr525: hey

8:15 augustl: I have a list of functions and a function. How do I turn that into (fn3-from-list (fn2-from-list (fn1-from-list single-fn)))?

8:15 borkdude: augustl probably with comp

8:16 augustl: looking it up

8:16 borkdude: (apply comp (reverse (cons single-fn function-list)))

8:17 ((apply comp (reverse function-list)) single-fn) <-- o wait.

8:18 since you call fn-1 with the single-fn

8:19 augustl: neat

8:47 hyperboreean: how can I assert that 2 vectors are equal using clojure.test ?

8:50 augustl: hyperboreean: = will do that

8:51 hyPiRion: (is (= vec1 vec2))

9:00 hyperboreean: augustl: hyPiRion: I always get this wrong, I always do (is (= (vec1 vec2))) and clojure fails thinking vec1 is a function call

9:00 thanks

9:02 hyPiRion: You're welcome, fellow Clojurian whose name starts with "hyp".

9:02 hyperboreean: heh :)

10:01 ToxicFrog: Are there any binary (un)packing libraries more versatile than Gloss? Support for 3-byte ints and fixed point and whatnot?

10:08 hyperboreean: shouldn't ((fn [[[x y] p]] x) [1 2]) be the same as (let [[x y] [1 2]] x) ? I get an exception for the first one

10:09 borkdude: hyperboreean I think you have one [ ] too many

10:10 hyperboreean: borkdude: but then it would mean I should pass 2 arguments to that fn, when I actually want only 1 ...

10:10 tmciver: hyperboreean: no, but ((fn [[x y]] x) [1 2]) should be the same.

10:10 borkdude: hyperboreean ((fn [[x y] & p] x) [1 2])

10:11 hyperboreean dunno what p does here

10:11 Chousuke: the structure of a destructuring parameter list matches the call

10:11 so if your data is [x y] and you want to extract x and y, your parameter list must look like [[x y]]

10:12 [[[x y]]] would match a [[x y]] being passed in

10:12 hyperboreean: Chousuke: and the same should be true for defn; is the same form, right ?

10:12 Chousuke: yes

10:13 defn uses fn internally

10:13 borkdude: hyperboreean defn is basically (def name (fn [args] …))

10:14 Chousuke: (fn name [args] ...), but yeah :P

10:14 hyperboreean: so, let's say I want to make the following call (my-func [1 2] [3 4]) and destructure 1 2 3 4 in x y z t ... how would I do this in the arguments list, rather than a let form inside the function's body ?

10:15 Chousuke: [[x y] [z t]]

10:15 borkdude: (fn [[x y] [p q]] (+ x y p q)) for example

10:15 z t instead of p q of course

10:15 Chousuke: hyperboreean: basically, write out the call, put the parameters in a vector, and replace literals with variables

10:16 hyperboreean: huh, ok, that's what I am doing wrong ... I was doing something like [[x y] p1 [z t] p2]

10:16 there's no need for p1 and p2

10:16 borkdude: hyperboreean nope

10:16 hyperboreean: alright, got it, thanks Chousuke and borkdude

10:18 borkdude: hyperboreean for future reference, check this http://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring)

10:20 hyperboreean: borkdude: I went over the let destructuring chapter from "Clojure Programming", but now I wonder why fn destructuring wasn't more obvious since it's the same thing ...

10:21 bawr: hyperboreean: it's always obvious - after it clicks. :)

10:22 antares_: Langohr 1.0.0-beta11 is released: http://blog.clojurewerkz.org/blog/2013/02/17/langohr-1-dot-0-0-beta11-is-released/

10:24 borkdude: hyperboreean this is perhaps what you wanted with the ps: (def f (fn [[a b :as p1] [c d :as p2]] [p1 p2]))

10:25 hyperboreean: borkdude: it might've been a mixture of that and what Chousuke showed me ... though I don't really need to preserve the initial arguments, so :as wasn't really required

10:26 borkdude: hyperboreean still it's nice to have ;)

10:27 hyperboreean: is there any memory overhead in doing [a b :as p]? ideally Clojure would know when to garbage collect p in this form [a b], right ?

10:28 borkdude: hyperboreean I think not

10:28 hyperboreean: well, wrong question ... is the original p still around when destructuring as [a b] without retaining the initial p ?

10:30 borkdude: hyperboreean like this? ((fn [[x y]] x) [(java.util.Date.) (java.util.Date.) (java.util.Date.)])

10:30 hyperboreean the third date isn't even referenced in the destructuring so it could be gc-ed immediately

10:31 hyperboreean the second date isn't used in the body, so it could be gc-ed in the start of the function

10:31 hyperboreean I don't know how clojure deals with this

10:32 hyperboreean: borkdude: might be a JVM thing, though, and you might be right ... what you described should be the correct behaviour, I think

10:35 antares_: Neocons 1.1.0-beta4 is released: http://blog.clojurewerkz.org/blog/2013/02/17/neocons-1-dot-1-0-beta4-is-released/

11:46 ianulus: hi

11:46 anybody awake

11:46 ?

11:49 yedi: hows #clojure doing this fine monrning

11:50 * arrdem 's corner of #clojure is still in init

11:50 pimeys: almost going to sleep, dinner and then down :)

11:51 ianulus: oh, look, activity! ;)

11:52 pimeys: I hope I can finish the sicp before that

11:52 ianulus: can I get some help from you guys?

11:53 arrdem: that'

11:53 s largely what we're here for...

11:53 ianulus: cool!

11:54 I've been trying to get the whole emacs+leiningen deal going

11:55 installed emacs24, starterkit & ran leiningen

11:55 but when I try to fire up a repl, it fails with "Exception in thread "main" java.net.BindException: Cannot assign requested address"

11:55 arrdem: sounds like something else is already running on the standard nrepl port...

11:56 ianulus: what's the quickest way to check for that?

11:56 arrdem: on Linux?

11:57 ianulus: yeah

11:57 (ubuntu 12.04)

11:58 ivan: lsof | grep portnumber

11:58 ianulus: what's the standard port?

11:59 ivan: if no :port in your project.clj, a random available port

12:00 assuming lein 2, don't know if it changed

12:02 ianulus: well, if it's a random port, the chances for it failing with that error twice in a row should be minimal...

12:03 augustl: ephermeral ports ftw :)

12:03 if you bind to port 0, the OS will assign a port for you, and the OS knows what ports that are busy

12:05 ianulus: of course, I don't know how to do that...

12:06 ah, got it: lein :port port#

12:07 I mean: lein repl :port port#

12:08 ...or not

12:13 arrdem: ianulus: add :repl-options {:port 90001} to your project.clj

12:13 or :port 0 based on what augustl said.

12:14 ianulus: sorry, irc app died ... can you repost that last bit please?

12:15 arrdem: ianulus: your project.clj should have :repl-options {:port 0}

12:18 ianulus: no luck - same error

12:19 ivan: maybe all of your ports are bound

12:20 look at the lsof output

12:20 as root, to see everything

12:22 ianulus: that gives a huge output

12:23 ivan: or maybe you lack a address?

12:25 ianulus: ping works fine

12:41 dammit, It sucks having such an obscure error ... google doesn't have much to say either

12:44 ivan: can other programs bind ports?

12:45 e.g. nc -l 1234

12:47 ianulus: seems so, I get this line in netstat:

12:47 tcp 0 0* LISTEN

12:48 ivan: now try nc -l 0

12:50 if your LAN isn't malicious you can try: env LEIN_REPL_HOST= LEIN_REPL_PORT=0 lein repl

12:50 if you still have problems, maybe you can provide enough information to reproduce everything about your environment

12:57 ianulus: well, it's a public server, so I wouldn's exactly call the lan "non-malicious"

13:00 nc -l 0 yields:

13:00 tcp 0 0* LISTEN

13:05 "everything about my environment" sounds a bit broad ... where to start?

13:07 I dist-upgraded to Ubuntu server 12.04 yesterday and followed this tutorial setting everything up:

13:07 http://ianrumford.github.com/blog/2012/06/22/clojure-emacs-slime-and-swank-on-ubuntu-precise-1204/

13:08 except i read somewhere that clojure-jack-in has been replaced by nrepl-jack-in

13:10 so emacs.d/init.el contains:

13:10 (defvar my-packages '(starter-kit starter-kit-lisp starter-kit-bindings starter-kit-eshell clojure-mode clojure-test-mode nrepl)

13:13 ravster: hello all

13:14 gfredericks: ~hello

13:15 clojurebot: you disappoint me.

13:16 ianulus: ivan: can you offer any more suggestions?

13:18 or anybody else?

13:20 ivan: sunday morning will not be a busy time ;)

13:20 do you have weird security products or settings?

13:20 ianulus: I know

13:20 ivan: strace -f lein repl might show things

13:21 ianulus: not that I can remember

13:22 installing ftrace...

13:22 E: Unable to locate package ftrace

13:23 what's ftrace?

13:23 oops

13:23 sorry

13:24 yeah, that shows a whole bunch of things...

13:24 ivan: what does `lein version` say?

13:25 ianulus: Leiningen 2.0.0 on Java 1.7.0_13 OpenJDK 64-Bit Server VM

13:29 ivan: I have no other ideas, but I would guess broken network/security settings somewhere

13:30 try making some other program bind to

13:30 netcat appears to be unable

13:31 I would also make sure that lein is really trying port 0 with LEIN_REPL_PORT

13:31 though it should already be doing that, so I don't know

13:33 ianulus: how do I use LEIN_REPL_PORT?

13:34 borkdude: it would be cool but obviously complicated if you could say during a REPL session: hey grab me clojure.math.combinatorics and put it on the classpath

13:34 I hate trying out things having to make a project especially for this

13:35 ad hoc dependencies

13:35 this would lead to security issues for sure

13:36 wouldn't it?

13:37 ivan: not any more security issues than already exist

13:38 http://www.learningclojure.com/2013/02/runtime-require-downloading-new.html

13:38 ianulus: see above line with "env "

13:39 borkdude: ivan cool

13:43 ianulus: ther's no "env " on that page

13:44 Frozenlock: Could someone point me towards an example of implementing ISeq? (I get "IllegalArgumentException Don't know how to create ISeq from.." when trying 'first')

13:45 gfredericks: Frozenlock: that stuff is usually pretty easy to track down; I'd just check the source of first and go step by step from there

13:49 Frozenlock: implementing Seqable is sufficient for most purposes actually

13:51 Frozenlock: gfredericks: I'll try that, thanks!

13:54 borkdude: ivan cool, I now put pomegranate in my dev dependencies and load a script each time leiningen spins up with some helper functions: (load-math) loads math.combinatorics contrib, etc :-D

13:55 gfredericks: &(take 5 (reify ISeq (first [_] 42) (next [this] this) (rest [this] this)))

13:55 lazybot: java.lang.RuntimeException: Unable to resolve symbol: ISeq in this context

13:55 gfredericks: &(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (rest [this] this)))

13:55 lazybot: java.lang.IllegalArgumentException: Can't define method not in interfaces: rest

13:56 gfredericks: &(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (more [this] this)))

13:56 lazybot: java.lang.AbstractMethodError

13:56 gfredericks: &(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (more [this] this) (seq [this] this)))

13:56 lazybot: ⇒ (42 42 42 42 42)

13:57 gfredericks: Frozenlock: ^ there's something also :)

13:57 a GC-friendly impl of clojure.core/repeat

13:58 clojure-newb: gfredericks: hi, you helped me out with '(#(->> % (group-by :k1) vals (map first)) col)' the other day, grabs a distinct on a sequence of maps with identical value on key :k1.. can you help me figure out how to select the map with :k3 present instead of just grabbing the first ?

14:01 yedi: does compojure have an equivalent to django's reverse?

14:02 gfredericks: clojure-newb: add (map (partial filter :k3)) before the (map first)?

14:03 that'll have issues with falsy values though, so you could do (map (partial filter #(contains? % :k3))), but you can't nest #() so you'd have to verbosify your outer one

14:03 clojure-newb: gfredericks: thanks, I will have a go with some of these

14:04 gfredericks: oh.. its killing my sequence :-)

14:06 I'm hoping to turn : [{:k1 "v1", :k2 "anything"} {:k1 "v1", :k2 "something else"} {:k3 "important", :k1 "v1", :k2 "blurb"} {:k1 "bbb", :k2 "yaa"}]

14:06 into : [{:k3 "important", :k1 "v1", :k2 "blurb"} {:k1 "bbb", :k2 "yaa"}]

14:07 gfredericks: it's killing it?

14:07 oh because sometimes :k3 isn't present?

14:07 clojure-newb: gfredericks: sorry… yes

14:07 gfredericks: in which case you want to fall back on the first thing?

14:07 clojure-newb: gfredericks: so I lost the second map in the above example

14:08 gfredericks: I think I want to pull the candidate with k3 when it exists or fall back to first if not

14:09 gfredericks: clojure-newb: https://www.refheap.com/paste/11391

14:10 clojure-newb: gfredericks: awesome

14:10 just trying to understand that now

14:10 thanks

14:12 gfredericks: np

14:13 yedi: what is the googleable name for ->>

14:13 i know -> is the threading macro

14:14 mpenet: thread first and thread last I think

14:15 gfredericks: super stabby

14:18 ianulus: ivan: I'm giving up for now, but thanks for your help :-)

14:18 borkdude: ivan https://www.evernote.com/shard/s96/sh/00ce724f-2c48-4bf6-b0e9-dc7f61cc8cd0/d7f5c8e8bc886c18240f859b48e13ee2

14:20 Frozenlock: gfredericks: your example leaves me thinking I might have started on the wrong path. To make a story short, I'm playing with technomancy's serializable-fn (https://github.com/technomancy/serializable-fn). I would like the returned function to act like a list. For example, with my-fn = (fn [x] (* x x)), (first my-fn) should return fn.

14:21 gfredericks: Frozenlock: so you're hacking his code?

14:21 Frozenlock: Yup

14:21 gfredericks: does he have a custom type?

14:22 Frozenlock: Not that I can see. He simply add a method.

14:22 gfredericks: oh I see he just hooks into the :type metadata

14:22 Frozenlock: oh wait

14:22 yes

14:22 gfredericks: so you probably have to switch to doing your own type

14:22 and implementing IFn

14:22 Frozenlock: ::serializable-fn is the type

14:22 gfredericks: I mean a deftype

14:22 instead of just the :type metadata

14:23 (deftype SerializableFn [form func] ISeqable (-seq [_] form) IFn ...call func...)

14:24 I don't know what the implications are for not being a clojure.lang.Fn, but I'm not sure you have a choice

14:24 unless you play with inheriting it

14:28 AtKaaZ: hey, if lib A has dynamic var *graph* and my project uses lib A and lib B(where B uses A also) do my project and lib B see the same *graph* or each gets a different one? like it would be private to the project (even though *graph* only exists in A), what if lib B uses a different version of lib A than my project ?

14:30 gfredericks: AtKaaZ: same var

14:30 you'll also be using the same version of lib A, probably the version you specify

14:30 maven handles that

14:30 Chousuke: same var, but remember that var bindings are thread-local

14:30 so they can't conflict

14:30 AtKaaZ: gfredericks: alright thanks for confirming both these

14:30 Chousuke: but assume lib A changes var-root

14:31 Chousuke: AtKaaZ: then you might have trouble :P

14:31 AtKaaZ: ok, that's the case with hermes g/open

14:36 drorbemet: Hi, I have a question concerning the IDE for Clojure development in production environments. I spend some time with Eclipse and some time with Emacs. Well, which limits do I have to expect with Clojure in Emacs with larger projects? Are there some guidelines on how to structure a larger number of files known? Oncle Bob for instance values the refactoring operations in Eclips. Does any body know how he thinks about that concerning Clojure c

14:36 borkdude: drorbemet Uncle Bob prefers IntelliJ

14:37 drorbemet: borkdude Ah ok

14:38 Frozenlock: gfredericks: thank you so much. I'll need some time to understand it, but thanks :)

14:38 seangrove: I have a clojurescript app that I've built that I want to get functional testing in on via webdriver/selenium2 - I've setup compojure to serve all the necessary static assets, and I've written some selenium stuff to go through those assets.

14:38 I'd like to tie this into midje/CI

14:38 I think for that, I'll need to have compojure and webdriver running in the same process

14:38 borkdude: drorbemet lots of people prefer emacs though

14:39 seangrove: Anyone know if this is possible, or know of of any guides for it?

14:39 borkdude: drorbemet I'd say, use them side by side and just see where it ends

14:40 AtKaaZ: is there some way to alter current binding?

14:40 gfredericks: Frozenlock: sure

14:41 AtKaaZ: like (binding [*graph* nil] (var-set #'*graph* 1)) or something

14:41 well that actually works:O

14:42 drorbemet: borkdude Yes that's what I will have to do I think. I just wander how Emacs integrates let's say with a team that uses Eclipse and Java?

14:43 antares_: AtKaaZ: (binding [*graph* …]) alters the current binding.

14:43 borkdude: drorbemet no restrictions there as far as I know - it's just an editor that edits text files

14:43 AtKaaZ: antares_: yes but I mean inside it, var-set I wanted, works as I expected

14:45 drorbemet: borkdude Thanks for your encuragement :-) I will just spend some more time with Emacs to get up to speed and then see how it goes.

14:46 antares_: drorbemet: IDEA's plugin, La Clojure, is pretty good, has Clojure-to-java and Clojure code navigation and basic refactoring operations. And it has been actively developed again recently.

14:48 drorbemet: antares: Ok, I'll try that one too, thanks.

14:51 antares: I remember that Chas Emerick din't like some thing about La Clojure but I did't quite understand it as I was reading it.

14:53 antares: It was some thing about La Clojure beeing a platform or something

14:56 schaefer: hi. i'm thinking of developing a forms based app using core.logic. the forms are pretty complex (think tax form complexity). normally, i'd think of using cells or dataflow for an app like this but i like the crazy idea that core.logic could 'reverse' the form calculations to obtain inputs from specified outputs. does anyone know of similar uses for core.logic? is this a bad idea for...

14:56 ...some reason?

14:56 AtKaaZ: is there an option in (ns ...) to reload the other namespaces only if they changed? as opposed to :reload-all which does it always

14:56 gfredericks: AtKaaZ: don't think so

14:56 AtKaaZ: gfredericks: actually, this would have to be supported by the editor i realize ie. ccw/emacs

14:57 gfredericks: ccw has it, auto load on save

14:59 excellent, works as expected (was disabled by me, before)

15:22 hiredman: clojurebot: ping

16:12 dnolen: ClojureScript has symbol with metadata suppot now! http://github.com/clojure/clojurescript/commit/b87c940629c5789ece42ab757cc85bf491c25c84

16:18 Bodil: dnolen: Ohhh sweet, well done :)

16:19 TimMc: What made y'all choose to make this switch?

16:19 I assume it has been feasible in the past...

16:25 bbloom: TimMc: sorry, i wasn't in the channel -- dnolen and i are sitting in brooklyn hacking on cljs

16:25 TimMc: he said you asked "why not"

16:25 er i mean "why now"

16:25 the answer is that we're trying to do the same for Keywords too

16:25 mpenet: I was about to ask :), nice work

16:25 bbloom: so then we can eliminate modifications to String.prototype

16:26 keywords are tricker because of interning, so symbols first!

16:26 TimMc: So, why not earlier for symbols?

16:27 Not enough people complaining about lack of metadata support?

16:27 Anyway, I'm glad to hear that String will soon be unburdened. :-)

16:27 bbloom: pretty much

16:52 clojure-newb: hey guys… whats the best/safest way to check if a field is a number… seems number? needs a lot of guards to stop things exploding… like (number? 12a)

16:54 TimMc: I don't understand the 12a example.

16:54 clojure-newb: TimMc: just assuming somebody could put just about anything in an input...

16:54 amalloy: clojure-newb: yes, they can pass in any thing, but 12a is not a thing

16:54 clojure-newb: and 12a causes LispReader.readNumber to throw a NumberFormatException

16:56 amalloy: so how would you recommend I check for sane input from a text input in a web page for example ?

16:56 amalloy: text input is strings. "12a" is a string

16:56 you can successfully call number? on that

16:57 12a is not a thing, it is garbage in your source code

16:57 clojure-newb: amalloy: I see what you mean, thanks for spotting that

16:59 TimMc: clojure-newb: number? does not parse strings.

17:01 AtKaaZ: ,(Integer/parseInt "12")

17:01 clojurebot: 12

17:01 AtKaaZ: is it like that ? or a better way?

17:05 TimMc: Long/parseLong is probably better :-)

17:05 Raynes: &(Long. "12")

17:05 lazybot: ⇒ 12

17:05 AtKaaZ: yeah but isn't there some clojure way?

17:05 TimMc: However, that doesn't tell you if a string *can* be successfully parsed as a number.

17:05 Raynes: weee

17:05 TimMc: Clojure is a JVM language. That is the Clojure way.

17:06 Raynes: Sometimes Java stuff is the Clojure way.

17:06 AtKaaZ: makes sense

17:06 Raynes: Try to not think of Java interop as a side language. It's a core part of Clojure.

17:06 AtKaaZ: ,(Long/decode "12")

17:06 clojurebot: 12

17:06 AtKaaZ: ,(Long/decode "12a")

17:06 clojurebot: #<NumberFormatException java.lang.NumberFormatException: For input string: "12a">

17:07 AtKaaZ: TimMc, actually parselong works too, telling me if it can be parsed as number

17:08 ,(Long/parseLong "12a")

17:08 clojurebot: #<NumberFormatException java.lang.NumberFormatException: For input string: "12a">

17:08 AtKaaZ: and the constructor Raynes showed

17:09 TimMc: in other words, I don't understand what you meant

17:10 TimMc: AtKaaZ: Well, Long is better than Integer, since it has a larger domain.

17:11 Oh, my next comment, I see.

17:11 AtKaaZ: yep, got it

17:11 TimMc: Well, it's nice to not have to catch exceptions.

17:12 It seemed as if clojure-newb wanted something that would report whether a string *could* be parsed as an integer, as opposed to actually parsing it.

17:13 clojure-newb: TimMc: yes

17:13 and agreed about the exceptions

17:13 AtKaaZ: how else could you tell, without parsing it somehow

17:13 TimMc: And what sorts of number formats do you want to detect?

17:14 clojure-newb: TimMc: a sequence of digits, including padded with leading zero

17:14 TimMc: AtKaaZ: Well, re-matches #"[0-9]+" does a mighty fine job of telling you if something can be parsed as a certain type of number.

17:14 amalloy: i definitely recommend Long/parseLong over the Long constructor

17:15 TimMc: &(Long. "010")

17:15 lazybot: ⇒ 10

17:15 AtKaaZ: timmc: by parsing you mean attemtpting to convert it to number then? cause it seems that re-matches does parsing also by my definition of parsing

17:17 my definition of parse seems wrong i guess, i equate it with scanning over it :)

17:17 TimMc: Depends on context.

17:19 Anyway, there are two questions you can ask: "Does this represent a number?" and "This is a number, what is it?"

17:21 The second has a precondition, and if that precondition is violated, it throws.

17:21 (You could make one that returns nil, of course.)

17:23 AtKaaZ: but I'm guessing parseLong would be faster than the regex thingy?

17:23 TimMc: I don't see why.

17:23 AtKaaZ: i guess because regex is like more generic

17:26 amalloy: TimMc: you could also ask: if this is a number, what is it?

17:26 if there were a function like String -> Maybe Number

17:26 TimMc: That would be my hypothetical nil-defaulting version.

17:30 AtKaaZ: ,((fn isnum? [num] (try (Long/parseLong num) true (catch java.lang.NumberFormatException _ false))) "12a")

17:31 did it die?

17:31 TimMc: From a comment in OpenJDK's Double parsing code: "we saw NO DIGITS AT ALL, not even a crummy 0! this is not allowed."

17:32 AtKaaZ: btw, do I need a (do ...) there after try ?

17:32 i can't tell from the doc

17:32 TimMc: nope

17:32 ToxicFrog: I think I just found a bug in lein droid

17:32 AtKaaZ: sweet

17:33 ToxicFrog: I have a project named emufun-rc which crashes instantly when run with ClassNotFoundException: ca.ancilla.emufun_rc.Application

17:33 Looking at the generated class files, everything is in ca/ancilla/emufun_rc/, except Application.class and MainActivity.class, which ended up in ca/ancilla/emufun-rc/

17:40 ravster: hello all

17:42 TimMc: I think I'm missing something about labelled breaks and try-catch blocks in Java.

17:46 Never mind, confusing indentation.

17:49 ppppaul: hey guys. i need help in figuring out how to preserve reader macros when doing pretty printing

17:49 https://gist.github.com/boxxxie/4973902

17:51 ToxicFrog: Oh, user error - apparently - isn't a legal character in package names

17:52 TimMc: Oh yeah, I should have noticed that.

17:53 ToxicFrog: Now I've fixed that and the Dalvik verifier is "arbitrarily rejecting large method" clojure/core__init.load

17:53 Which is kind of important

17:55 * ToxicFrog rummages

17:55 TimMc: Ouch.

17:56 ToxicFrog: Aha

17:56 Ok, so, versions of clojure 1.3+ contain methods too large for android-8, which is what I'm targeting

17:57 The README for neko mentions this and says that the answer is to use clojure 1.2 on old android versions

17:57 But there don't appear to be any versions of android/clojure earlier than 1.4

17:58 TimMc: Totally not surprised that clojure.core upsets Dalvik.

17:59 AtKaaZ: 6924 lines

18:00 &`'`'`'`'`'()

18:00 Invalid method Code length 68774 in class file

18:01 ToxicFrog: TimMc: apparently later versions of android are more permissive and 1.4 works fine on Honeycomb (api 11) and ICS (api 14)

18:01 The problem is, targeting that means it'll no longer work on my wife's phone.

18:01 nightfly: ToxicFrog: Get her a new phone :)

18:02 * nightfly knows that's not always an option though

18:04 ppppaul: hey guys, help me print things so i can be pretty

18:09 pgmcgee`: i'm trying to write a lazy sequence of vectors to a file per vector, but i keep getting "IOException Stream closed java.io.BufferedReader.ensureOpen (BufferedReader.java:97)"

18:09 callenbot: TimMc: does that say more about Dalvik or c.c?

18:09 pgmcgee`: here's the code: https://gist.github.com/pgmcgee/9a35b0be39ba1e45d36b#file-core-clj

18:10 callenbot: pgmcgee`: have you considered using sqlite instead of writing to raw files?

18:10 ToxicFrog: callenbot: well, the limit is - as the message says - arbitrary

18:10 pgmcgee`: im guessing im missing something... i think the different threads that map creates are all trying to use the same writer, but im not sure how to prevent that

18:10 AtKaaZ: pgmcgee: is map returning a lazy seq within the with-open ?

18:10 ToxicFrog: Basically, (register count) * (instruction count) needs to be less than 2^21

18:10 callenbot: lol, k

18:10 pgmcgee`: callenbot: certainly considered it, id love to get this working, though

18:11 callenbot: pgmcgee`: fair, I'm just saying, I've done some work in embedded/mobile data and if you have the resources available you should avoid raw files.

18:11 amalloy: pgmcgee`: read-population is the problem. map is lazy, and with-open has dynamic scope

18:11 pgmcgee`: AtKaaZ: no, the with-open is inside the map...

18:11 AtKaaZ: pgmcgee: https://gist.github.com/pgmcgee/9a35b0be39ba1e45d36b#file-core-clj-L32

18:12 pgmcgee`: AtKaaZ: ah, good call

18:17 gfredericks: AtKaaZ: also ##``````````foo

18:18 dangit lazybot

18:18 ,```````````foo

18:18 AtKaaZ: that gives stack overflow

18:18 gfredericks: yes

18:18 AtKaaZ: 3 less and it gives 335835

18:19 gfredericks: yeah it's exponential

18:19 AtKaaZ: but if you replace one with a ' gives like 610047 ``````'`foo

18:19 gfredericks: hm

18:20 AtKaaZ: ##``````'`foo

18:20 the bots are dead right?

18:20 gfredericks: it must be a bot holiday

18:20 AtKaaZ: rofl

18:20 gfredericks: what do bots celebrate on Feb 17?

18:20 or 3rd sunday in february?

18:21 AtKaaZ: 884259 ``````'''foo

18:21 fix-a-bug day

18:25 lol 3112673 '`''`''`''```'''''a

18:26 callenbot: ,````````````````````````foo

18:27 AtKaaZ: ''`'''`''''`''''`'`'`'''''a looks like this is like the max i could get on my: 3250516

18:27 &''`'''`''''`''''`'`'`'''''a

18:28 gfredericks: I bet there is some number theory behind this

18:28 what're those numbers? (comp count flatten)?

18:29 AtKaaZ: i dno but you can fine tune it by inserting ' betwen `-es

18:29 gfredericks: you don't know where you're getting the numbers from?

18:29 AtKaaZ: the code generated?

18:30 gfredericks: it's a giant s-expression, not a number

18:31 TimMc: &(map (comp count flatten) [''() '`() `'() ``()])

18:31 lazybot: ⇒ (1 1 1 1)

18:31 AtKaaZ: ah you were asking

18:31 TimMc: &(map (comp count flatten) [`''() `'`() ``'() ```()])

18:31 lazybot: ⇒ (2 2 7 5)

18:31 AtKaaZ: CompilerException java.lang.ClassFormatError: Invalid method Code length 3250410 in class file proof/of/concept/caveats/macros$eval1521, compiling:(NO_SOURCE_PATH:1:1)

18:32 gfredericks: &(map (comp count flatten) [`a ``a ```a ````a `````a ``````a ```````a])

18:32 TimMc: $ping

18:32 lazybot: TimMc: Ping completed in 0 seconds.

18:32 gfredericks: AtKaaZ: ooh I see

18:33 &((apply comp (repeat 5000 inc)) 42)

18:33 lazybot: ⇒ 5042

18:33 gfredericks: &(map (comp count flatten) [`a ``a ```a ````a `````a ``````a])

18:33 lazybot: java.lang.ClassFormatError: Invalid method Code length 75500 in class file sandbox20321$eval24059

18:33 pgmcgee`: thanks for all your help, guys! i appreciate it grealy!

18:33 AtKaaZ: i think over 64k won't let you

18:33 gfredericks: &(map (comp count flatten) [`a ``a ```a ````a `````a])

18:33 lazybot: ⇒ (0 2 8 41 221)

18:33 gfredericks: finally

18:33 AtKaaZ: ie. '`'`'`'`'''a Invalid method Code length 68974 in class file

18:35 &(map (comp count flatten) '`''''`'''`'''''`''a)

18:35 lazybot: ⇒ (0 3205)

18:36 AtKaaZ: it's capped at 64k the method Code length

18:37 &(println ''`'''`''''`''''`'`'`'''''a)

18:38 ravster: can I do (ring.util.response/response {:status 201 :body "foo"}), or do I have to do (status (ring.util.response/response "foo") 201)?

18:39 amalloy: ravster: try it and see

18:39 weavejester: ravster: (-> (response "foo") (status 201))

18:39 ravster: Or {:status 201 :headers {} :body "foo"}

18:40 ravster: weavejester: oh cool. just the map directly. Nice.

18:40 gfredericks: that why ring cool

18:40 ravster: sweeeeett. thanks weavejester

18:45 bbloom: lol, dnolen and i are optimizing... http://jsperf.com/push-array-map-entry fucking javascript....

18:46 ppppaul: can someone help me figure out how to pretty print without evaluating reader macros (specifically datomic reader macros)?

18:46 https://gist.github.com/boxxxie/4973902

18:47 gfredericks: mapcat identity is apply concat btw

18:47 Sgeo_: ,[+ 1 2]

18:47 :(

18:47 gfredericks: ppppaul: you want to prevent "evaluating" reader macros? do you mean you don't want the data literal tags to be printed?

18:47 Sgeo_: &[+ 1 2]

18:47 lazybot: ⇒ [#<core$_PLUS_ clojure.core$_PLUS_@1284047> 1 2]

18:48 ppppaul: my gist sorta explains what i want gfredericks

18:48 gfredericks: I saw it

18:48 but not the description :)

18:48 ppppaul: i want to print out #db/id

18:49 prn gives me what i want, but i want to pprint for the output

18:49 gfredericks: I'm not familiar with what pprint uses underneath

18:49 it might be a lot of special cases

18:50 ppppaul: it seems to have a lot of reader macro code in it

18:51 well, in my case, i want to have some control over newlines... so i guess i can do my own hacky pprint

18:52 * gfredericks started reading the pprint code and then stopped

18:52 ppppaul: pprint code is a bit complicated

18:52 schaefer: hi. i'm thinking of developing a forms based app using core.logic. the forms are pretty complex (think tax form complexity). normally, i'd think of using cells or dataflow for an app like this but i like the crazy idea that core.logic could 'reverse' the form calculations to obtain inputs from specified outputs. does anyone know of similar uses for core.logic? is this a bad idea for...

18:52 ...some reason?

18:53 gfredericks: schaefer: might be hard to give specific feedback when the forms are filled out inconsistently?

18:54 schaefer: not sure... at this point, it's really just an idea i've been toying with. what do you mean, inconsistently?

18:55 gfredericks: __1__ + __2__ = __7__

18:56 schaefer: ah. yes, the forms are used for a lot of "what-if" sorts of analyses

18:56 gfredericks: in the above case core.logic would simply fail and tell you nothing about what's wrong

18:59 schaefer: good point. i'm thinking that the UI could designate certain fields as "output-mostly" where an input to those cells would trigger a backwards calculation... not sure how well that would work

18:59 gfredericks: core.logic has no concept of backwards and forewards

19:03 schaefer: but it does have a concept of the cells for which the UI would need a calculation... what if the core.logic program described all the relations and computed a new core.logic program that asked for answers for the particular "output" ?

19:10 * gfredericks goes to check if flatland/useful has fork

19:10 amalloy: gfredericks: fork?

19:11 gfredericks: I don't know if that's what it's normally called

19:11 (defn fork [f g h] (comp (partial apply f) (juxt g h)))

19:11 maybe different args order dunno

19:12 I was about to want it for (fork hash-map key-fn val-fn)

19:12 amalloy: gfredericks: i think it's close to knit

19:13 gfredericks: knit seems to want different inputs

19:13 just one input in this case

19:13 amalloy: ((knit f g) [a b]) => [(f a) (g b)]

19:14 gfredericks: (defn fork [f g h] (fn [x] (f (g x) (h x)))) ;; simpler version

19:14 callenbot: Korma is starting to worry me. Is there a SQL library somebody would recommend as an alternate?

19:14 gfredericks: come on guys let's build our sql interface thing

19:14 can we call it rung?

19:14 amalloy: gfredericks: call it Wrong

19:14 * callenbot frowns

19:15 gfredericks: the readme will explain that the name is in recognition of SQL being yesterday's news

19:15 "Wrong: for when you can't use mongo for whatever reason."

19:15 * callenbot rubs forehead and sighs

19:15 amalloy: "why are you even on this page? clojure is cool, use a cool data layer"

19:16 callenbot: Seriously - what's the alternative to Korma?

19:16 gfredericks: c.c.jdbc

19:16 TimMc: TCP

19:16 gfredericks: I enjoyed clojureQL but nobody else did

19:26 alternatives to korma: clutch, congomongo

19:27 datomic

19:27 fs

19:27 clojure.core/atom

19:30 callenbot: gfredericks: :|

19:32 warz: couchdb ftw

19:35 TimMc: I need to get straightened out with c.c.jdbc and transactions.

19:35 It looks like some commands open transactions, but I don't get to decide what kind of transaction it is?

19:35 (isolation level, etc.)

19:38 pocho: I'm having difficulty solving problems the clojure way.

19:38 I want a function that does this: (defn nest_f [f x, coll] (f (f (f x (get coll 0)) (get coll 1)) (get coll 2)))

19:38 but works for collections with size not equal to 3.

19:38 Is there something like that in clojure.core? If not how would I write it?

19:38 gfredericks: is that reduce?

19:39 the parens look funny

19:39 pocho: each f is called on what the other one returned

19:39 gfredericks: at this point I'd bet at least $5 that's reduce

19:40 same argument order and everything

19:40 pocho: ok

19:40 thanks

19:41 yeah you were right

19:41 * gfredericks collections his five bucks

19:42 * gfredericks nouns his verbs

19:42 callenbot: gfredericks: you verbed your noun.

19:42 gfredericks: so you got it backwards.

19:43 gfredericks: noun: (verb) to use a noun as a verb

19:43 wait

19:43 I have no idea what I meant anymore

19:43 brehaut: dude, thats gerund

19:43 gfredericks: that's madding

19:43 callenbot: brehaut: particularly participled.

19:45 brehaut: wait, its not a gerund, thats the other way round

19:59 warz: im looking at how to get to keys in nested maps. im looking at the some of ways mentioned in this blog post: http://www.learningclojure.com/2009/09/nested-def-me-name-firstname-john.html

19:59 is there one that i should prefer?

20:06 tmciver: warz: I prefer get-in when nested or just (:key my-map) when not.

20:27 warz: hm ok

21:00 dnolen: optimizing ClojureScript is always an interesting exercise

21:05 hiredman: ~ping

21:05 clojurebot: PONG!

21:05 hiredman: ,*clojure-version*

21:05 clojurebot: {:major 1, :minor 5, :incremental 0, :qualifier "RC6"}

21:06 TimMc: sweet

21:06 ,(read-edn "(+ 1 2)")

21:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-edn in this context, compiling:(NO_SOURCE_PATH:0:0)>

21:06 TimMc: Oh, too old.

21:07 gfredericks: clojurebot: upgrade

21:07 clojurebot: Excuse me?

21:08 gfredericks: clojurebot: upgrade is <reply> successfully upgraded to clojure 1.7.0

21:08 clojurebot: Roger.

21:08 dnolen: PersistentArrayMap in CLJS are starting to trounce ObjMap under V8

21:09 good sign for real keywords & symbols

21:09 gfredericks: ObjMap is the naive impl?

21:09 * gfredericks has no idea what he's talking about

21:09 dnolen: gfredericks: ObjMap was written under the assumption that dealing w/ JS objects would be faster for access

21:10 PAMs looks just as good as OMs for lookup now on V8

21:10 and 10X faster for assoc w/ 1,2,3 unseen keys (small maps)

21:11 gfredericks: that is wild. I'm jealous.

21:11 dnolen: https://github.com/clojure/clojurescript/commit/6a26f157d7b678415aa1f610e570adb7af9bdfb7

21:12 took forever to find the right set of changes that v8 likes

21:12 and these chanes look good in JavaScriptCore too

21:16 bbloom: dnolen: did the equiv-pred ultimately help?

21:16 hiredman: I replaced clojurebot's in process evaluator with a little web service, so now I can upgrade it and tinker with it without having to take clojurebot offline, same for the factoids stuff

21:18 gfredericks: clojurebot is so big that the monolithic app has been replaced with SOA

21:18 hiredman: pretty much

21:19 I really need to rip the irc bit out as a service, so then the bot will never leave the channel

21:19 gfredericks: it's the only way to satiate the hoi polloi

21:20 six nines or something

21:20 hiredman: then run multiple instances of the evaluator behind an lb

21:20 put them in an autoscale group

21:22 gfredericks: the product people want this done by next week I assume

21:36 * gfredericks finds a use for unquoting w/o syntax-quote

21:36 Frozenlock: do tell

21:36 gfredericks: generating readable code to be eval'd later

21:37 it's probably terrible

21:39 $google github misquote

21:39 lazybot: [fredericksgary/misquote · GitHub] https://github.com/fredericksgary/misquote

21:40 bbloom: gfredericks: i had no idea that existed

21:40 compare https://github.com/fredericksgary/misquote/blob/master/src/misquote/core.clj and https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj

21:41 Raynes: Fancy gfredericks.

21:41 This is why we market our libraries, guys.

21:41 gfredericks: I did it because hiredman told me it was impossible

21:41 Raynes: Speaking of which, have you given your heart to Laser lately? hurrhurr

21:41 gfredericks: which I assume means I didn't properly communicate what I was talking about

21:43 cemerick: gfredericks: hah, I wrote just this a few weeks ago

21:43 gfredericks: I'm bad at marketing :(

21:43 cemerick: gfredericks: hopefully you don't mind me using yours so I can have you fix bugs as they come up ;-P

21:43 gfredericks: please do

21:43 bbloom: lol ok if three of us all wrote the same thing maybe it belongs in core lol

21:44 gfredericks: that is the standard criteria

21:44 bbloom: let me do some marketing then: backquote also provides a macro for defining macros that have a pluggable symbol resolver! also, it won't choke on records

21:45 it's an almost 1:1 port of the java code from clojure itself

21:45 cemerick: I'll let you two fight it out and see who's standing in the morning.

21:45 gfredericks: ah ha, so `template` is like misquote

21:45 but the mechanism is more general

21:45 bbloom: yup :-)

21:46 gfredericks: presumably it comes with gensym built in as well but that doesn't get in your way if you don't want it

21:46 well I hereby declare yours better than mine

21:46 * gfredericks really sucks at marketing

21:46 bbloom: heh, i'd have helped you if i knew :-)

21:46 cemerick: fights over, no need to wait for the morning :-P

21:46 gfredericks: that wouldn't be good because your project name is better

21:47 bbloom: lol! haha thanks

21:47 gfredericks: it took a lot of effort for me not to use ##(format "lib-%04d" (rand-int 10000))

21:47 lazybot: ⇒ "lib-4124"

21:54 werbitt: Hi, quick question, when I write a wrapper function for a function with optional args I end up having to conditionally dispatch based on whether the optional args were provided to the wrapper. Here's an example: https://www.refheap.com/paste/11400 . I feel like there must be a better way to do this, any ideas?

21:57 bbloom: werbitt: you can create functions with multiple arities

21:57 (fn ([x] 1) ([x y] 2))

21:57 ,((fn ([x] 1) ([x y] 2)) :a)

21:57 clojurebot: 1

21:57 bbloom: ,((fn ([x] 1) ([x y] 2)) :a :b)

21:57 clojurebot: 2

21:57 bbloom: same syntax works for defn

21:58 werbitt: hi bbloom, thanks, but I feel like that still has a lot of duplication

21:58 for a wrapper

21:59 bbloom: werbitt: duplication? repeating argument names is not the bad kind of duplication

21:59 the repeated information is physically colocated and semanatically irrelevant

21:59 zero-duplication is a silly goal

22:00 * nightfly still likes common lisps argument handling better

22:00 werbitt: its just very verbose, i guess there isn't another way to do it.

22:00 Frozenlock: nightfly: link?

22:03 werbitt: also, if the wrapped function is in a let, i think i'm stuck with the conditional

22:03 bbloom: werbitt: no, you're not, multiple arities work with fn forms

22:03 nightfly: Frozenlock: http://www.gigamonkeys.com/book/functions.html

22:03 bbloom: defn expands to fn

22:05 the problem with optional arguments as done in common lisp is that it doesn't allow for elision from the middle

22:06 for example if you want (fn ([x z] ...) ([x y z] ...)))

22:06 if you want to support every possible way you can do that, it's actually impossible to do without a grammar. consider:

22:06 (fn ([y] ...) ([x z] ...))

22:07 the way clojure does it is 1) easy to understand 2) unambiguous and 3) matches the underlying dispatch-by-arity semantics

22:07 if you need something more complex than that, use [& args] and parse that however you choose

22:08 and if you're OK with the optional arg just being nil, you can do (fn [x & optional] ...) but you don't get arity checking

22:09 or rather i mean (fn [x & [optional]] ...)

22:09 which means 4) consistency with destructuring throughout clojure, not just in function signatures

22:09 much nicer than common lisp's design, IMO

22:10 TimMc: Hmm, I wonder what havoc we could wreak if Clojure exposed the returnAddress JVM primitive.

22:24 callenbot: Korma doesn't support PGSQL arrays does it?

22:27 brehaut: callenbot: java.jdbc has kinda quirky support for them at best current. i understand that improving support for them is coming in a future version

22:28 clifton: anyone know what '\1' would mean in the context of an anonymous function, e.g. #({\1 %2} % 0)

22:28 * callenbot curses loudly

22:29 clifton: oh i guess that is just the character 1

22:29 brehaut: yes

22:29 hiredman: TimMc: pretty sure that is not exposed out side of the jvm

22:30 and the jsr (subroutine inside a method stuff) has been deprecated since java 5

22:30 callenbot: brehaut: looks like I'm doing more JOINs. Thanks for the warning.

22:31 TimMc: hiredman: This article I'm reading was discussing it as a primitive that bytecode had access to.

22:31 hiredman: http://cliffhacks.blogspot.com/2008/02/java-6-tryfinally-compilation-without.html

22:31 TimMc: Oh heh, the article is about Java 2.

22:32 brehaut: callenbot: i've been using java.jdbc directly recently. basically i've had to preprocess all my psql array's to ensure the content is actually requested, otherwise you get a handle to a dead 'query' back

22:32 TimMc: Welp, that answers that.

22:32 brehaut: callenbot: you might be able to hook into korma's db->clj transform to do that automatically

22:33 callenbot: brehaut: As much as I want to find an excuse to abuse robert.hooke, I'm trying to avoid unnecessary complexity in this project.

22:33 hiredman: one of the example bytecode rewriters thatcomes with asm rewrites code that uses jsr to not use them

22:34 callenbot: brehaut: it's already turning into a database schema that makes me uneasy and makes me think a doc-store would be better if suited if I didn't need a real DB.

22:34 TimMc: "tail duplication"

22:34 So you're saying I *shouldn't* put 5000 lines in a finally block?

22:34 brehaut: callenbot: i just ported my site from couch to psql; i spent most of my time going ott with table constraints and views. totally worth it

22:35 callenbot: brehaut: I need to avoid things that will over-burden inserts.

22:35 brehaut: I'm not using any constraints, FKs, references, etc.

22:36 brehaut: yikes

22:36 callenbot: brehaut: it's a simple schema, it doesn't need them mate.

22:36 I'm just using indexes on $(rel-name)_id to JOIN

22:37 brehaut: YANGI

22:37 hrm. YAGNI*

22:39 Frozenlock: What does the dash mean in a deftype? https://gist.github.com/swannodette/1674971 "-invoke"

22:39 (instead of "invoke")

22:45 brainproxy: thoughts on this code: https://gist.github.com/mchampine/868342

22:45 callenbot: brainproxy: don't be an asshole. use bcrypt.

22:45 or scrypt. or pbkdf2.

22:46 brehaut: to short; want more details? http://codahale.com/how-to-safely-store-a-password/

22:46 callenbot: too*

22:46 brainproxy: callenbot: well.. definitely not trying to be an asshoole :p

22:46 callenbot: brainproxy: you don't understand cryptography and your fumbling in the unknown and dangerous is like that of two clumsy teenagers in the back of mom's station wagon.

22:46 brainproxy: callenbot: ummm, hello, that's why I asked

22:47 brehaut: brainproxy: first rule of crypto: dont write crypto

22:47 clojurebot: rule one is if your answer to "how should I represent X" is "something that doesn't implement clojure.lang.IFn" then you are probably wrong.

22:47 brainproxy: also, I understand the basic premise of salts and so on, and googling around for clojure, salt, password turned up that gist

22:47 callenbot: brainproxy: you have no idea what you're doing

22:47 brainproxy: read the codahale blog post.

22:48 brainproxy: use bcrypt, scrypt, or pbkdf2.

22:50 brehaut: brainproxy: for clojure imps of stuff, have a look at what is happening around friend (https://github.com/cemerick/friend/) and ask on clojure-sec (https://groups.google.com/forum/?fromgroups#!forum/clojure-sec)

22:50 brainproxy: alright well i appreciate the tip on the blog post, good info

22:50 brehaut: top post of which is weavejester releasing the first cut of a password lib (using bcrype, scrypt and pbkdf2)

22:51 https://github.com/weavejester/crypto-password/

22:51 brainproxy: yep, looking at that now

22:51 callenbot: I just use the bcrypt fn in lib-noir.

22:54 brainproxy: callenbot: blog post was good, got your point

22:56 * callenbot puts sledgehammer back down and glares

22:58 brainproxy: i have a small site (small in scope and number of visitors) I'll be building w/ clojure, compojure/liberator, hiccup, et al

22:59 looking for some direction on how to make it production ready in the context of running it on my own vps

22:59 is tuning the settings in project.clj, jetty adapter, and then putting varnish in front of it a decent plan?

23:01 brehaut: brainproxy: jetty is a great little server, and nginx or varnish is great front end to it

23:01 brainproxy: persistence will be handled using the free edition of datomic, yay

23:01 brehaut: what I'm wishing for is a TODO list related to moving from dev to production

23:02 with respect to jetty, leiningen, etc.

23:02 brehaut: brainproxy: i've only deployed really lightwight stuff with clojure web; blogs, irc bots

23:03 brainproxy: just i just uberjar from git repo on the server, and run from that

23:03 brainproxy: the only difference between my production and dev enviroments is a settings.edn file (with DB settings), and nginx acting as the gateway on teh production

23:04 you really dont need to do much more for a small site

23:05 brainproxy: i've never actually worked with uberjar, guess I should read up on that

23:05 well maybe it was touched on in the O'Reilly book

23:13 brehaut: brainproxy: a lot of people just use lein ring; my code bases predate its existance and i never felt like changing

23:14 brainproxy: brehaut: ah, yeah I'm a lein-ring user and fan :)

23:14 brehaut: just roll with that then :)

23:14 bbloom: Frozenlock: sorry i missed your question. the - is just a convention... a little confusing though

23:15 Frozenlock: in short, (.-foo x) means to access a property, but that's the only special case handling of -

23:15 in -invoke et al, it's more similar to defn-

23:15 it's to symbolize private

23:16 the convention is to do (IFooable (-foo [x])) and then (defn foo [x] (... (-foo ...)))

23:16 so you always have a non dash prefixed free function

23:16 make sense?

23:19 dnolen: bbloom: thanks for the review on GitHub

23:19 Frozenlock: bbloom: I will probably make sense once I wrap my head around interfaces and types. I do understand the (.-some-stuff, I've used it quite often in cljs, but never only (-some-other-stuff

23:20 *it

23:24 Toying again with my early afternoon project... is there a way to have some kind of inheritance with deftype? For example, (deftype my-seq clojure.lang.ISeq (everthing-method-from-vectors))

23:25 Wow the keyboard skills tonight!

23:25 alex_baranosky: if you have a join on two tables using clojure.java.jdbc, and you want to return a column whose name appears in both tables as part of your result set, is there some way for clojure.java.jdbc to handle this?

23:26 currently what I'm seeing is that the first column name's value gets lost, and only the second one is kept

23:27 clj_newb_2345: "Suppose I'm determined to shoot myself in the feet, what is the best way to do so?" I really want something like OCaml/Haskell/Scala's types in Clojure. I want to be able to look at a Var and know what type it is. From this, I want to know what fields it has. I also want to be able to pattern match based on Constructors. Question: what is the best way to approximate this in clojure?

23:28 No, I don't want to code vs protocols; I want to code vs Types.

23:28 amalloy: clj_newb_2345: write a scala interpreter in clojure

23:28 alex_baranosky: clj_newb_2345: don't use Clojure

23:28 amalloy: good idea

23:28 clj_newb_2345: I like Clojure's macros and sexp.

23:28 There's typed-racket. Why has it never taken off in the clojure world?

23:29 alex_baranosky: clj_newb_2345: look at Shen maybe

23:29 amalloy: use another lisp then, if you want macros and twenty things that clojure hates

23:30 clj_newb_2345: alex_baranosky: Shengn does claim to have everything I want.

23:31 brehaut: clj_newb_2345: re:static clojure, because it's a lot of work and ambrose is only one person

23:31 amalloy: even multiplied by the power of lisp he's only like eight people

23:31 clj_newb_2345: brehaut: so your view is "It's hard" not "it's impossible" ?

23:32 brehaut: clj_newb_2345: seems like it

23:33 clj_newb_2345: there are of course questions about the practical usefulness of opt in type checkers integrating with unannotated coded, and the value if the annotations needed to handle the semantics established in clojure end up being monsters

23:34 clj_newb_2345: brehaut: yeah, I am getting the imprssion that typing is great if you're building a langauge on top of not; but not so nice as a library when many of the language's builtins don't have annotations

23:34 brehaut: meh. typing is always a trade off

23:34 alex_baranosky: any clojure.java.jdbc experts around?

23:35 brehaut: in the case of core.typed (i think thats its name) the plan is for the majority of clojure.core to be annotated

23:35 alex_baranosky: wondering if there is a way to alias or namespace keys in result sets so that columns from two tables with the same name don't squash each other in the result set

23:37 brainproxy: clj_newb_2345: or maybe write some kind of bridge so you can develop in Clojure and Frege side by side

23:37 clj_newb_2345: brainproxy: I've decided to learn Shen.

23:38 brainproxy: clj_newb_2345: cool :)

23:40 dnolen: clj_newb_2345: you do know that core.typed borrows heavily from Typed Racket right?

23:40 clj_newb_2345: dnolen: no, I thought it started as someone's type-checking master's thesis project, then became part of core.typed

23:40 dnolen: hey, btw, thanks for help with clojurescript bugs months back

23:41 dnolen: clj_newb_2345: nope. Directly built on the Typed Racket research and pushing it in new directions.

23:41 clj_newb_2345: dnolen: there was some project you wanted to pull off earlier (was it for foo camp or some langauge conference?) for clojure -- did it endup working? [I think it had something to do with clojurescript, generated javascript code, and chrome debugger being able to see the lines of clojurescript code]

23:42 dnolen: clj_newb_2345: source maps, we're still working on it

23:42 clj_newb_2345: dnolen: ah

23:42 dnolen: Shen looks too cool, I have to understand it. The book (which I dont have acces sto yet) even has a short proof assistant tutorial.

23:42 The guy's clearly a genius.

23:43 dnolen: clj_newb_2345: it's pretty cool, tho there are plenty of things for a Clojurist to not like.

23:43 clj_newb_2345: dnolen: how did you learn shen?

23:44 dnolen: clj_newb_2345: I don't know shen, only played around with it, enough to know it doesn't have enough for me to want to use it.

23:44 clj_newb_2345: dnolen: what did it miss for you?

23:45 dnolen: clj_newb_2345: protocols, concurrency primitives, predictable performance for a specific subset of the language, persistent data structures, etc, et

23:45 c

23:47 mye: where are the docs on how to translate maven central package info into leiningen dep. info?

23:47 The tutorial just says "we'll skip this" :-(

23:54 Oh I see, it's package specific. Got it working :-)

23:56 squiggly: How do I "live edit" code using Clojure + Leiningen? Apologies if this is a newbie question, but I can't find a simple how-to guide in Google. (I am using Quil as well, if that helps.)

23:59 smnirven: squiggly: are you using emacs?

23:59 squiggly: smnirven: Yes

Logging service provided by n01se.net