#clojure logs

2013-02-17

00:50abpProtocol extension to instances isn't implemented in Clojure by now, right?
00:50abpIs there some sort of scoped protocol extension?
01:04callenbotRaynes: 11pt - Menlo, Monaco, "Ubuntu Mono", monospace;
01:04RaynesI hate Ubuntu Mono.
01:04abprobert.hooke
01:05callenbotRaynes: can we compromise on something that isn't Deja Vu Mono?
01:05callenbotRaynes: it's horrendous. Also the Menlo/Monaco is so it doesn't look awful on my mac.
01:05callenbotRaynes: at least adding Menlo to the front of the list would improve my sanity.
01:05callenbotRaynes: you should considering using a CSS preprocessor to avoid the CSS rule duplication I saw as well.
01:05Raynescallenbot: The first two are mac fonts, the one after that is an Ubuntu font, and then you drop to whatever is default.
01:06RaynesAnd no.
01:06callenbotRaynes: Windows users aren't people.
01:06RaynesI don't care about Windows users.
01:06RaynesOther Linux distros.
01:06callenbotwhat's wrong with using Menlo specifically? It'll look better.
01:06cliftonI've spent a decent amount of time with a lot of fixed-width fonts and I got sick of everything except Menlo
01:06RaynesI 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.
01:06callenbotclifton: *thank* you.
01:07RaynesCan we compromise on that?
01:07callenbotRaynes: sounds great to me.
01:07RaynesCoolio.
01:07RaynesI'm working on some refheap stuff right now, but I'll put this on my todo list.
01:07callenbotRaynes: what about the font size?
01:07RaynesI'll play with that too.
01:08callenbotRaynes: http://i.imgur.com/v268Sbk.png menlo 11px
01:08callenbotRaynes: with that, I'll get back to my new project. Cheers and thanks for considering it :)
01:08RaynesI'll almost certainly do it. I just wanted Deja Vu before Ubuntu Mono.
01:09callenbotRaynes: totally cool with me. I know UM is a polarizing font.
01:09RaynesI 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.
01:10callenbotthey look wide/fat to me.
01:11cliftonwith deja vu, dotted 0 drives me a little nuts
01:11cliftonbut i suppose thats more of a personal thing
01:11cliftonit's a decent font
01:15Raynescallenbot: 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.
01:15callenbotRaynes: like any good Commissar, I respect the will of the proletariat.
01:15RaynesHaha
01:17callenbotEverytime I talk to weavejester I learn something new but am also firmer in my belief that we could never review each others' code.
01:18abpcallenbot: What are you looking at? :D
01:19callenbotabp: I'm hacking up code.
01:20abpcallenbot: Thought you were looking into weavejesters code.
01:21callenbotabp: no, I mean literally when I talk to him in IRC.
01:21callenbotabp: I was reflecting on our last conversation.
01:21callenbotso apparently a constructive blog post these days involves writing two lines in a yaml config to change your database connection pool size
01:21callenbotif I'd known that, I could've written 30 posts about my last week of work.
01:21callenbotmaybe 90.
01:22callenbotooooooh Watsi. Right.
01:28abpcallenbot: 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
01:29callenbotabp: 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.
01:29abpcallenbot: Watch the latest hickey talks, probably he is sane if I'm no more.
01:30callenbotClojure programmers invoke Hickey like Catholics and Protestants invoke thegr God.
01:30abpcallenbot: That comes from him building things that work.
01:31callenbotHickey is brilliant but everyone assumes he's saying what they're thinking and that they're right because of it.
01:31callenbotperhaps the phrase should be, "to know the mind of Hickey" instead.
01:31callenbotI assert that the mind of Hickey is unknowable to all mortal men.
01:32abpHm, difficult. I agree with the things that I think are really valuable. And such are many.
01:33callenbotAs do I, but who has the most accurate interpretation of the Hickey's holy words?
01:35greywolveis 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 ;|
01:35abpcallenbot: 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."
01:36callenbotgreywolve: dafuq
01:37abpgreywolve: If you are trying to mock global atoms or whatever; don't. http://vimeo.com/46163090
01:37abpgreywolve: Probably you can even get rid of it. :P
01:37callenbotabp: are you making fun of my put-context?
01:37callenbotabp: you're making fun of put-context aren't you?
01:38greywolveabp: not trying that ;p trying to do this: http://corfield.org/blog/post.cfm/automated-browser-based-testing-with-clojure
01:38callenbotabp: thems fightin' words boy.
01:38abpcallenbot: Whoat, never!
01:38callenbotA fine choice.
01:39abpcallenbot: Only when I ate your byte :P
01:39greywolvebut sadly it's not working like it should . due to the tests not seeing the incremented atom
01:40abpgreywolve: Sorry, haven't done any automated browser testing, callenbot could consult on that. :P
01:40callenbotgreywolve: 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.
01:41callenbotgreywolve: I use casperjs usually.
01:41greywolveabp: thanks anyway, sigh, it seems overly complicated just to run some code before and after doing lein test that my tests can reference
01:41greywolvegreywolve: i can see why!
01:42callenbotI'm not you, bro.
01:42greywolvecallenbot: i can see why!
01:42greywolvehaha
01:42greywolvewhoops
01:42callenbotI need more sake if I'm going to get this app done this weekend.
01:42callenbotlots more sake.
01:43greywolveclj-webdriver is great though, i just want to have all the tests run in a single browser session
01:44callenbotgreywolve: I am githubbing. It looks nice.
01:45callenbotgreywolve: https://groups.google.com/forum/#!topic/clj-webdriver/z9hYKR4fOZE
01:45callenbotyogthos: hey chief.
01:46greywolve(def ^:private browser-count (atom 0))
01:46greywolve(defn browser-up
01:46greywolve "Start up a browser if it's not already started."
01:46greywolve []
01:46greywolve (when (= 1 (swap! browser-count inc))
01:46greywolve (set-driver! {:browser :firefox})
01:46greywolve (implicit-wait 60000)))
01:46greywolvewhen i run lein test, the atom gets incremented, then it runs each of the test files, but they see the atom as 0
02:05greywolveis there any way to easily require all the test namespaces into the repl?
02:06greywolveeg if i have testsuite.test1, testsuite.test2 etc and i just want all the testsuite namespaces required?
02:38greywolveseancorfield: 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
02:55seancorfieldgreywolve: sorry, just noticed your question...
02:55seancorfieldwell, we're using lein 2 now and what we are doing works... so let me double check my blog post
02:56seancorfieldlet me double check our current source code against what's in that blog post
02:56greywolveseancorfield: 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
02:57greywolvethanks ;)
02:57seancorfieldi run lein with-browser test
02:57greywolveyeah sorry i mean lein with-browser test
02:58greywolvelein with-browser test
02:58greywolve#<Atom@567ba718: 0>
02:58greywolvelein test testsuite.anothertest
02:58greywolveTesting testsuite.anothertest
02:58greywolve#<Atom@7b4da77: 0>
02:59seancorfielddid you remember to add :eval-in :leiningen to project.clj?
02:59greywolveyup
02:59greywolvewithout that it won't run at all
03:00seancorfieldthe blog post seems to match our current source code
03:00seancorfieldclj-webdriver 0.6.0-beta2 ?
03:00greywolveyeah, and clojure 1.5
03:00seancorfieldand we have to have :exclusions [org.clojure/core.cache] but that might not affect you
03:00seancorfieldhmm, let me try clojure 1.5 - we're on 1.4
03:01greywolvei just don't understand why two separate atoms are being created in my case ;p
03:02greywolvei think i've tried with 1.4 aswell but perhaps that is the problem
03:03seancorfieldworks just fine with 1.5.0-RC16 here - just tried it
03:03greywolvewoah, this is strange then
03:04greywolvewhat os are you running?
03:06seancorfieldmac os 10.7.5
03:07seancorfieldand firefox 3.6.12 i believe (had problems with later versions and selenium)
03:07greywolvelinux mint 14 here (ubuntu 12.10)
03:08greywolveits almost like lein is first running the with-browser code in a separate environment, before loading all the test files
03:08seancorfieldin your tests, are you reloading the ns?
03:08greywolvehence the two different atoms
03:09greywolveeach test looks like the example you gave:
03:09greywolve(ns testsuite.test.profile-scripts
03:09greywolve (:require [clj-webdriver.taxi :refer :all]
03:09greywolve [clojure.test :refer :all]
03:09greywolve [testsuite.core :refer :all]))
03:09greywolve(deftest edit-my-profile
03:09greywolve (browser-up)
03:09greywolve (login :eg "testuser" "secret")
03:09greywolve (go-to :eg "/profile/edit")
03:09greywolve (input-text "#aboutme" "I like long walks on the beach and being a snugglebunny.")
03:09greywolve (click "#btnSaveProfile2")
03:09greywolve (is (= "Your profile has been successfully updated." (text ".success p")))
03:09greywolve (is (= "In order for your profile to appear to other members, please fill out the missing fields identified below." (text ".warning p")))
03:09greywolve (browser-down))
03:10greywolvebut just with (browser-up) and (to "some url") and (browser-down)
03:10seancorfieldhmm, dunno... my brain's not exactly in a good debugging state right now (it's midnight and several beers down :) )
03:10greywolvehahah thanks for the help anyway, appreciate it ;)
03:11greywolvebut yeah, does seem like somewhere the namespace is being reloaded
03:11seancorfieldthat sounds like a problem i ran into early on but fixed before i blogged about it
03:12seancorfieldi'm sure it was something to do with :eval-in :leiningen
03:12greywolve(defproject clj-webdriver-boilerplate "0.1.0-SNAPSHOT"
03:12greywolve :description "clj-web-driver-boilerplate"
03:12greywolve :url "http://www.github.com/greywolve/clj-webdriver-boilerplate&quot;
03:12greywolve :license {:name "MIT License"
03:12greywolve :url ""}
03:12greywolve :dependencies [[org.clojure/clojure "1.5.0-RC16"]
03:12greywolve [clj-webdriver "0.6.0-beta2"]]
03:12greywolve :eval-in :leiningen)
03:12greywolvethis is correct?
03:12seancorfieldyup
03:13seancorfieldand your testsuite.core has the (dissoc project :eval-in) ?
03:13greywolveyeah
03:13seancorfieldweird
03:14greywolvein your blog post, for the require
03:15greywolve(ns leiningen.with-browser
03:15greywolve (:require [webdriver.core :refer [browser-up browser-down]]
03:15greywolve [leiningen.core.main :as main]))
03:15greywolvewebdriver.core
03:15greywolvethat is a mistake right? ;p
03:15greywolvei replaced it with testsuite.core
03:15seancorfieldshould be testsuite.core, yeah
03:15greywolveah ok, now i really don't know haha
03:16seancorfieldsorry
03:17greywolvewhat does dissoc project :eval-in do? well i know what it does but what's the reason for it?
03:18seancorfieldI no longer remember why that was needed...
03:18seancorfieldsomething to do with how the tests run...
03:21greywolveah ok , the quirks of lein ;0
03:21seancorfieldHmm, just tried it without the dissoc and it still works... so maybe that was a workaround for a bug in a preview of lein2?
03:21greywolvehmm yeah could be
03:22seancorfieldtry passing just project instead of (dissoc project :eval-in) and see if that solves it?
03:24greywolvenope same thing, but it does still run fine, just opens 2 firefox windows ;p good to know its not needed anymore though!
03:26greywolveLeiningen 2.0.0 on Java 1.7.0_07 OpenJDK 64-Bit Server VM
03:26greywolvethis may me some kind of lein bug i guess
03:27greywolvefor ubuntu ;p
03:32greywolveohhhhh wait a minute
03:33Raynesdsantiago: 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
03:33Raynes ever want it off for attributes.
03:34dsantiagoNo idea what you're talking about.
03:34arrdemRaynes: 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?
03:34RaynesThe 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.
03:35greywolvelein with-browser test testsuite.test.anothertest testsuite.test.sometest
03:35greywolveworks
03:35greywolvewhat's happening is testsuite.core is being loaded again!
03:35RaynesIt 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.
03:35Raynesdsantiago: ^ Does any of that make sense?
03:36Raynesarrdem: Dunno what everyone else does. That's just the way I do it.
03:36dsantiagoIs this because you are using hickory-to-html as the backend for a template system, which I've told you not to do?
03:36arrdemRaynes: mmkay. cheers.
03:36RaynesMeh.
03:39seancorfieldgreywolve: so are you saying it works if you specify namespaces but if you don't, you get two browsers? or the other way around?
03:39Raynesarrdem: 4clojure is also structured similarly.
03:39RaynesBut I guess I did that too...
03:39greywolveit works if i specify the namespaces ;p
03:39seancorfieldweird...
03:40greywolve lein with-browser test
03:40greywolve#<Atom@51f28023: 0>
03:40greywolvelein test testsuite.core
03:40greywolveTesting testsuite.core
03:40greywolvelein test testsuite.test.anothertest
03:40greywolveTesting testsuite.test.anothertest
03:40greywolveit makes sense, look at that
03:40greywolveits running testsuite.core as a test
03:40greywolveso its reloading the namespace essentially
03:40seancorfieldoh!!!!!! right!!!
03:40greywolve;p
03:40seancorfieldi have testsuite.core in src/ not test/
03:40greywolveohhhhhhh
03:40seancorfieldthat's your problem!
03:40greywolvehaha ;) that solves it then!
03:43greywolveseancorfield: thanks so much! do you mind if i setup a clj-webdriver-boilerplate repo with this?
03:43seancorfieldsure, knock yourself out!!
03:44seancorfieldi've updated the blog post to show testsuite.core lives in src/ and also fixed the webdriver.core typo
03:44seancorfieldthanx for spotting the latter and helping me clarify the former!
03:45seancorfielddamn, i need to be up in six hours to drive to so. cal. - better go to bed!
03:45greywolvepleasure, ill link to your post in the repo ;)
03:45greywolvenn!
03:53arrdemRaynes: mmkay makes more sense than the "one file of routings" approach I was considering as an alternative
05:46samrathow can I import hiccup templates from outside my project?
05:47samrathere's my attempt using pushbackreader, but it seems to only bring in the first function: https://www.refheap.com/paste/11383
06:20borkdudeyogthos|away tnx for the Luminus website
07:12greywolvehttps://github.com/greywolve/clj-webdriver-boilerplate
07:13greywolveif anyone is struggling with acceptance testing that will help, all thanks to seanaway
08:04michaelr525hey
08:15augustlI 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)))?
08:15borkdudeaugustl probably with comp
08:16augustllooking it up
08:16borkdude(apply comp (reverse (cons single-fn function-list)))
08:17borkdude((apply comp (reverse function-list)) single-fn) <-- o wait.
08:18borkdudesince you call fn-1 with the single-fn
08:19augustlneat
08:47hyperboreeanhow can I assert that 2 vectors are equal using clojure.test ?
08:50augustlhyperboreean: = will do that
08:51hyPiRion(is (= vec1 vec2))
09:00hyperboreeanaugustl: hyPiRion: I always get this wrong, I always do (is (= (vec1 vec2))) and clojure fails thinking vec1 is a function call
09:00hyperboreeanthanks
09:02hyPiRionYou're welcome, fellow Clojurian whose name starts with "hyp".
09:02hyperboreeanheh :)
10:01ToxicFrogAre there any binary (un)packing libraries more versatile than Gloss? Support for 3-byte ints and fixed point and whatnot?
10:08hyperboreeanshouldn'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:09borkdudehyperboreean I think you have one [ ] too many
10:10hyperboreeanborkdude: but then it would mean I should pass 2 arguments to that fn, when I actually want only 1 ...
10:10tmciverhyperboreean: no, but ((fn [[x y]] x) [1 2]) should be the same.
10:10borkdudehyperboreean ((fn [[x y] & p] x) [1 2])
10:11borkdudehyperboreean dunno what p does here
10:11Chousukethe structure of a destructuring parameter list matches the call
10:11Chousukeso if your data is [x y] and you want to extract x and y, your parameter list must look like [[x y]]
10:12Chousuke[[[x y]]] would match a [[x y]] being passed in
10:12hyperboreeanChousuke: and the same should be true for defn; is the same form, right ?
10:12Chousukeyes
10:13Chousukedefn uses fn internally
10:13borkdudehyperboreean defn is basically (def name (fn [args] …))
10:14Chousuke(fn name [args] ...), but yeah :P
10:14hyperboreeanso, 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:15Chousuke[[x y] [z t]]
10:15borkdude(fn [[x y] [p q]] (+ x y p q)) for example
10:15borkdudez t instead of p q of course
10:15Chousukehyperboreean: basically, write out the call, put the parameters in a vector, and replace literals with variables
10:16hyperboreeanhuh, ok, that's what I am doing wrong ... I was doing something like [[x y] p1 [z t] p2]
10:16hyperboreeanthere's no need for p1 and p2
10:16borkdudehyperboreean nope
10:16hyperboreeanalright, got it, thanks Chousuke and borkdude
10:18borkdudehyperboreean for future reference, check this http://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring)
10:20hyperboreeanborkdude: 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:21bawrhyperboreean: it's always obvious - after it clicks. :)
10:22antares_Langohr 1.0.0-beta11 is released: http://blog.clojurewerkz.org/blog/2013/02/17/langohr-1-dot-0-0-beta11-is-released/
10:24borkdudehyperboreean this is perhaps what you wanted with the ps: (def f (fn [[a b :as p1] [c d :as p2]] [p1 p2]))
10:25hyperboreeanborkdude: 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:26borkdudehyperboreean still it's nice to have ;)
10:27hyperboreeanis 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:28borkdudehyperboreean I think not
10:28hyperboreeanwell, wrong question ... is the original p still around when destructuring as [a b] without retaining the initial p ?
10:30borkdudehyperboreean like this? ((fn [[x y]] x) [(java.util.Date.) (java.util.Date.) (java.util.Date.)])
10:30borkdudehyperboreean the third date isn't even referenced in the destructuring so it could be gc-ed immediately
10:31borkdudehyperboreean the second date isn't used in the body, so it could be gc-ed in the start of the function
10:31borkdudehyperboreean I don't know how clojure deals with this
10:32hyperboreeanborkdude: might be a JVM thing, though, and you might be right ... what you described should be the correct behaviour, I think
10:35antares_Neocons 1.1.0-beta4 is released: http://blog.clojurewerkz.org/blog/2013/02/17/neocons-1-dot-1-0-beta4-is-released/
11:46ianulushi
11:46ianulusanybody awake
11:46ianulus?
11:49yedihows #clojure doing this fine monrning
11:50pimeysalmost going to sleep, dinner and then down :)
11:51ianulusoh, look, activity! ;)
11:52pimeysI hope I can finish the sicp before that
11:52ianuluscan I get some help from you guys?
11:53arrdemthat'
11:53arrdems largely what we're here for...
11:53ianuluscool!
11:54ianulusI've been trying to get the whole emacs+leiningen deal going
11:55ianulusinstalled emacs24, starterkit & ran leiningen
11:55ianulusbut when I try to fire up a repl, it fails with "Exception in thread "main" java.net.BindException: Cannot assign requested address"
11:55arrdemsounds like something else is already running on the standard nrepl port...
11:56ianuluswhat's the quickest way to check for that?
11:56arrdemon Linux?
11:57ianulusyeah
11:57ianulus(ubuntu 12.04)
11:58ivanlsof | grep portnumber
11:58ianuluswhat's the standard port?
11:59ivanif no :port in your project.clj, a random available port
12:00ivanassuming lein 2, don't know if it changed
12:02ianuluswell, if it's a random port, the chances for it failing with that error twice in a row should be minimal...
12:03augustlephermeral ports ftw :)
12:03augustlif you bind to port 0, the OS will assign a port for you, and the OS knows what ports that are busy
12:05ianulusof course, I don't know how to do that...
12:06ianulusah, got it: lein :port port#
12:07ianulusI mean: lein repl :port port#
12:08ianulus...or not
12:13arrdemianulus: add :repl-options {:port 90001} to your project.clj
12:13arrdemor :port 0 based on what augustl said.
12:14ianulussorry, irc app died ... can you repost that last bit please?
12:15arrdemianulus: your project.clj should have :repl-options {:port 0}
12:18ianulusno luck - same error
12:19ivanmaybe all of your ports are bound
12:20ivanlook at the lsof output
12:20ivanas root, to see everything
12:22ianulusthat gives a huge output
12:23ivanor maybe you lack a 127.0.0.1 address?
12:25ianulusping 127.0.0.1 works fine
12:41ianulusdammit, It sucks having such an obscure error ... google doesn't have much to say either
12:44ivancan other programs bind ports?
12:45ivane.g. nc -l 1234
12:47ianulusseems so, I get this line in netstat:
12:47ianulustcp 0 0 0.0.0.0:1234 0.0.0.0:* LISTEN
12:48ivannow try nc -l 0
12:50ivanif your LAN isn't malicious you can try: env LEIN_REPL_HOST=0.0.0.0 LEIN_REPL_PORT=0 lein repl
12:50ivanif you still have problems, maybe you can provide enough information to reproduce everything about your environment
12:57ianuluswell, it's a public server, so I wouldn's exactly call the lan "non-malicious"
13:00ianulusnc -l 0 yields:
13:00ianulustcp 0 0 0.0.0.0:45444 0.0.0.0:* LISTEN
13:05ianulus"everything about my environment" sounds a bit broad ... where to start?
13:07ianulusI dist-upgraded to Ubuntu server 12.04 yesterday and followed this tutorial setting everything up:
13:07ianulushttp://ianrumford.github.com/blog/2012/06/22/clojure-emacs-slime-and-swank-on-ubuntu-precise-1204/
13:08ianulusexcept i read somewhere that clojure-jack-in has been replaced by nrepl-jack-in
13:10ianulusso emacs.d/init.el contains:
13:10ianulus(defvar my-packages '(starter-kit starter-kit-lisp starter-kit-bindings starter-kit-eshell clojure-mode clojure-test-mode nrepl)
13:13ravsterhello all
13:14gfredericks~hello
13:15gfredericksclojurebot: you disappoint me.
13:16ianulusivan: can you offer any more suggestions?
13:18ianulusor anybody else?
13:20ivansunday morning will not be a busy time ;)
13:20ivando you have weird security products or settings?
13:20ianulusI know
13:20ivanstrace -f lein repl might show things
13:21ianulusnot that I can remember
13:22ianulusinstalling ftrace...
13:22ianulusE: Unable to locate package ftrace
13:23ianuluswhat's ftrace?
13:23ianulusoops
13:23ianulussorry
13:24ianulusyeah, that shows a whole bunch of things...
13:24ivanwhat does `lein version` say?
13:25ianulusLeiningen 2.0.0 on Java 1.7.0_13 OpenJDK 64-Bit Server VM
13:29ivanI have no other ideas, but I would guess broken network/security settings somewhere
13:30ivantry making some other program bind to 127.0.0.1:0
13:30ivannetcat appears to be unable
13:31ivanI would also make sure that lein is really trying port 0 with LEIN_REPL_PORT
13:31ivanthough it should already be doing that, so I don't know
13:33ianulushow do I use LEIN_REPL_PORT?
13:34borkdudeit 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:34borkdudeI hate trying out things having to make a project especially for this
13:35borkdudead hoc dependencies
13:35borkdudethis would lead to security issues for sure
13:36borkdudewouldn't it?
13:37ivannot any more security issues than already exist
13:38ivanhttp://www.learningclojure.com/2013/02/runtime-require-downloading-new.html
13:38ivanianulus: see above line with "env "
13:39borkdudeivan cool
13:43ianulusther's no "env " on that page
13:44FrozenlockCould someone point me towards an example of implementing ISeq? (I get "IllegalArgumentException Don't know how to create ISeq from.." when trying 'first')
13:45gfredericksFrozenlock: 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:49gfredericksFrozenlock: implementing Seqable is sufficient for most purposes actually
13:51Frozenlockgfredericks: I'll try that, thanks!
13:54borkdudeivan 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:55gfredericks&(take 5 (reify ISeq (first [_] 42) (next [this] this) (rest [this] this)))
13:55lazybotjava.lang.RuntimeException: Unable to resolve symbol: ISeq in this context
13:55gfredericks&(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (rest [this] this)))
13:55lazybotjava.lang.IllegalArgumentException: Can't define method not in interfaces: rest
13:56gfredericks&(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (more [this] this)))
13:56lazybotjava.lang.AbstractMethodError
13:56gfredericks&(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (more [this] this) (seq [this] this)))
13:56lazybot⇒ (42 42 42 42 42)
13:57gfredericksFrozenlock: ^ there's something also :)
13:57gfredericksa GC-friendly impl of clojure.core/repeat
13:58clojure-newbgfredericks: 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:01yedidoes compojure have an equivalent to django's reverse?
14:02gfredericksclojure-newb: add (map (partial filter :k3)) before the (map first)?
14:03gfredericksthat'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:03clojure-newbgfredericks: thanks, I will have a go with some of these
14:04clojure-newbgfredericks: oh.. its killing my sequence :-)
14:06clojure-newbI'm hoping to turn : [{:k1 "v1", :k2 "anything"} {:k1 "v1", :k2 "something else"} {:k3 "important", :k1 "v1", :k2 "blurb"} {:k1 "bbb", :k2 "yaa"}]
14:06clojure-newbinto : [{:k3 "important", :k1 "v1", :k2 "blurb"} {:k1 "bbb", :k2 "yaa"}]
14:07gfredericksit's killing it?
14:07gfredericksoh because sometimes :k3 isn't present?
14:07clojure-newbgfredericks: sorry… yes
14:07gfredericksin which case you want to fall back on the first thing?
14:07clojure-newbgfredericks: so I lost the second map in the above example
14:08clojure-newbgfredericks: I think I want to pull the candidate with k3 when it exists or fall back to first if not
14:09gfredericksclojure-newb: https://www.refheap.com/paste/11391
14:10clojure-newbgfredericks: awesome
14:10clojure-newbjust trying to understand that now
14:10clojure-newbthanks
14:12gfredericksnp
14:13yediwhat is the googleable name for ->>
14:13yedii know -> is the threading macro
14:14mpenetthread first and thread last I think
14:15gfrederickssuper stabby
14:18ianulusivan: I'm giving up for now, but thanks for your help :-)
14:18borkdudeivan https://www.evernote.com/shard/s96/sh/00ce724f-2c48-4bf6-b0e9-dc7f61cc8cd0/d7f5c8e8bc886c18240f859b48e13ee2
14:20Frozenlockgfredericks: 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:21gfredericksFrozenlock: so you're hacking his code?
14:21FrozenlockYup
14:21gfredericksdoes he have a custom type?
14:22FrozenlockNot that I can see. He simply add a method.
14:22gfredericksoh I see he just hooks into the :type metadata
14:22Frozenlockoh wait
14:22Frozenlockyes
14:22gfredericksso you probably have to switch to doing your own type
14:22gfredericksand implementing IFn
14:22Frozenlock::serializable-fn is the type
14:22gfredericksI mean a deftype
14:22gfredericksinstead of just the :type metadata
14:23gfredericks(deftype SerializableFn [form func] ISeqable (-seq [_] form) IFn ...call func...)
14:24gfredericksI don't know what the implications are for not being a clojure.lang.Fn, but I'm not sure you have a choice
14:24gfredericksunless you play with inheriting it
14:28AtKaaZhey, 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:30gfredericksAtKaaZ: same var
14:30gfredericksyou'll also be using the same version of lib A, probably the version you specify
14:30gfredericksmaven handles that
14:30Chousukesame var, but remember that var bindings are thread-local
14:30Chousukeso they can't conflict
14:30AtKaaZgfredericks: alright thanks for confirming both these
14:30AtKaaZChousuke: but assume lib A changes var-root
14:31ChousukeAtKaaZ: then you might have trouble :P
14:31AtKaaZok, that's the case with hermes g/open
14:36drorbemetHi, 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:36borkdudedrorbemet Uncle Bob prefers IntelliJ
14:37drorbemetborkdude Ah ok
14:38Frozenlockgfredericks: thank you so much. I'll need some time to understand it, but thanks :)
14:38seangroveI 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:38seangroveI'd like to tie this into midje/CI
14:38seangroveI think for that, I'll need to have compojure and webdriver running in the same process
14:38borkdudedrorbemet lots of people prefer emacs though
14:39seangroveAnyone know if this is possible, or know of of any guides for it?
14:39borkdudedrorbemet I'd say, use them side by side and just see where it ends
14:40AtKaaZis there some way to alter current binding?
14:40gfredericksFrozenlock: sure
14:41AtKaaZlike (binding [*graph* nil] (var-set #'*graph* 1)) or something
14:41AtKaaZwell that actually works:O
14:42drorbemetborkdude 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:43antares_AtKaaZ: (binding [*graph* …]) alters the current binding.
14:43borkdudedrorbemet no restrictions there as far as I know - it's just an editor that edits text files
14:43AtKaaZantares_: yes but I mean inside it, var-set I wanted, works as I expected
14:45drorbemetborkdude 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:46antares_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:48drorbemetantares: Ok, I'll try that one too, thanks.
14:51drorbemetantares: 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:53drorbemetantares: It was some thing about La Clojure beeing a platform or something
14:56schaeferhi. 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:56schaefer...some reason?
14:56AtKaaZis there an option in (ns ...) to reload the other namespaces only if they changed? as opposed to :reload-all which does it always
14:56gfredericksAtKaaZ: don't think so
14:56AtKaaZgfredericks: actually, this would have to be supported by the editor i realize ie. ccw/emacs
14:57AtKaaZgfredericks: ccw has it, auto load on save
14:59AtKaaZexcellent, works as expected (was disabled by me, before)
15:22hiredmanclojurebot: ping
16:12dnolenClojureScript has symbol with metadata suppot now! http://github.com/clojure/clojurescript/commit/b87c940629c5789ece42ab757cc85bf491c25c84
16:18Bodildnolen: Ohhh sweet, well done :)
16:19TimMcWhat made y'all choose to make this switch?
16:19TimMcI assume it has been feasible in the past...
16:25bbloomTimMc: sorry, i wasn't in the channel -- dnolen and i are sitting in brooklyn hacking on cljs
16:25bbloomTimMc: he said you asked "why not"
16:25bbloomer i mean "why now"
16:25bbloomthe answer is that we're trying to do the same for Keywords too
16:25mpenetI was about to ask :), nice work
16:25bbloomso then we can eliminate modifications to String.prototype
16:26bbloomkeywords are tricker because of interning, so symbols first!
16:26TimMcSo, why not earlier for symbols?
16:27TimMcNot enough people complaining about lack of metadata support?
16:27TimMcAnyway, I'm glad to hear that String will soon be unburdened. :-)
16:27bbloompretty much
16:52clojure-newbhey 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:54TimMcI don't understand the 12a example.
16:54clojure-newbTimMc: just assuming somebody could put just about anything in an input...
16:54amalloyclojure-newb: yes, they can pass in any thing, but 12a is not a thing
16:54clojure-newband 12a causes LispReader.readNumber to throw a NumberFormatException
16:56clojure-newbamalloy: so how would you recommend I check for sane input from a text input in a web page for example ?
16:56amalloytext input is strings. "12a" is a string
16:56amalloyyou can successfully call number? on that
16:57amalloy12a is not a thing, it is garbage in your source code
16:57clojure-newbamalloy: I see what you mean, thanks for spotting that
16:59TimMcclojure-newb: number? does not parse strings.
17:01AtKaaZ,(Integer/parseInt "12")
17:01clojurebot12
17:01AtKaaZis it like that ? or a better way?
17:05TimMcLong/parseLong is probably better :-)
17:05Raynes&(Long. "12")
17:05lazybot⇒ 12
17:05AtKaaZyeah but isn't there some clojure way?
17:05TimMcHowever, that doesn't tell you if a string *can* be successfully parsed as a number.
17:05Raynesweee
17:05TimMcClojure is a JVM language. That is the Clojure way.
17:06RaynesSometimes Java stuff is the Clojure way.
17:06AtKaaZmakes sense
17:06RaynesTry to not think of Java interop as a side language. It's a core part of Clojure.
17:06AtKaaZ,(Long/decode "12")
17:06clojurebot12
17:06AtKaaZ,(Long/decode "12a")
17:06clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "12a">
17:07AtKaaZTimMc, actually parselong works too, telling me if it can be parsed as number
17:08AtKaaZ,(Long/parseLong "12a")
17:08clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "12a">
17:08AtKaaZand the constructor Raynes showed
17:09AtKaaZTimMc: in other words, I don't understand what you meant
17:10TimMcAtKaaZ: Well, Long is better than Integer, since it has a larger domain.
17:11TimMcOh, my next comment, I see.
17:11AtKaaZyep, got it
17:11TimMcWell, it's nice to not have to catch exceptions.
17:12TimMcIt 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:13clojure-newbTimMc: yes
17:13clojure-newband agreed about the exceptions
17:13AtKaaZhow else could you tell, without parsing it somehow
17:13TimMcAnd what sorts of number formats do you want to detect?
17:14clojure-newbTimMc: a sequence of digits, including padded with leading zero
17:14TimMcAtKaaZ: 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:14amalloyi definitely recommend Long/parseLong over the Long constructor
17:15TimMc&(Long. "010")
17:15lazybot⇒ 10
17:15AtKaaZtimmc: 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:17AtKaaZmy definition of parse seems wrong i guess, i equate it with scanning over it :)
17:17TimMcDepends on context.
17:19TimMcAnyway, there are two questions you can ask: "Does this represent a number?" and "This is a number, what is it?"
17:21TimMcThe second has a precondition, and if that precondition is violated, it throws.
17:21TimMc(You could make one that returns nil, of course.)
17:23AtKaaZbut I'm guessing parseLong would be faster than the regex thingy?
17:23TimMcI don't see why.
17:23AtKaaZi guess because regex is like more generic
17:26amalloyTimMc: you could also ask: if this is a number, what is it?
17:26amalloyif there were a function like String -> Maybe Number
17:26TimMcThat would be my hypothetical nil-defaulting version.
17:30AtKaaZ,((fn isnum? [num] (try (Long/parseLong num) true (catch java.lang.NumberFormatException _ false))) "12a")
17:31AtKaaZdid it die?
17:31TimMcFrom a comment in OpenJDK's Double parsing code: "we saw NO DIGITS AT ALL, not even a crummy 0! this is not allowed."
17:32AtKaaZbtw, do I need a (do ...) there after try ?
17:32AtKaaZi can't tell from the doc
17:32TimMcnope
17:32ToxicFrogI think I just found a bug in lein droid
17:32AtKaaZsweet
17:33ToxicFrogI have a project named emufun-rc which crashes instantly when run with ClassNotFoundException: ca.ancilla.emufun_rc.Application
17:33ToxicFrogLooking 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:40ravsterhello all
17:42TimMcI think I'm missing something about labelled breaks and try-catch blocks in Java.
17:46TimMcNever mind, confusing indentation.
17:49ppppaulhey guys. i need help in figuring out how to preserve reader macros when doing pretty printing
17:49ppppaulhttps://gist.github.com/boxxxie/4973902
17:51ToxicFrogOh, user error - apparently - isn't a legal character in package names
17:52TimMcOh yeah, I should have noticed that.
17:53ToxicFrogNow I've fixed that and the Dalvik verifier is "arbitrarily rejecting large method" clojure/core__init.load
17:53ToxicFrogWhich is kind of important
17:55TimMcOuch.
17:56ToxicFrogAha
17:56ToxicFrogOk, so, versions of clojure 1.3+ contain methods too large for android-8, which is what I'm targeting
17:57ToxicFrogThe README for neko mentions this and says that the answer is to use clojure 1.2 on old android versions
17:57ToxicFrogBut there don't appear to be any versions of android/clojure earlier than 1.4
17:58TimMcTotally not surprised that clojure.core upsets Dalvik.
17:59AtKaaZ6924 lines
18:00AtKaaZ&`'`'`'`'`'()
18:00AtKaaZInvalid method Code length 68774 in class file
18:01ToxicFrogTimMc: apparently later versions of android are more permissive and 1.4 works fine on Honeycomb (api 11) and ICS (api 14)
18:01ToxicFrogThe problem is, targeting that means it'll no longer work on my wife's phone.
18:01nightflyToxicFrog: Get her a new phone :)
18:04ppppaulhey guys, help me print things so i can be pretty
18:09pgmcgee`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:09callenbotTimMc: does that say more about Dalvik or c.c?
18:09pgmcgee`here's the code: https://gist.github.com/pgmcgee/9a35b0be39ba1e45d36b#file-core-clj
18:10callenbotpgmcgee`: have you considered using sqlite instead of writing to raw files?
18:10ToxicFrogcallenbot: well, the limit is - as the message says - arbitrary
18:10pgmcgee`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:10AtKaaZpgmcgee: is map returning a lazy seq within the with-open ?
18:10ToxicFrogBasically, (register count) * (instruction count) needs to be less than 2^21
18:10callenbotlol, k
18:10pgmcgee`callenbot: certainly considered it, id love to get this working, though
18:11callenbotpgmcgee`: 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:11amalloypgmcgee`: read-population is the problem. map is lazy, and with-open has dynamic scope
18:11pgmcgee`AtKaaZ: no, the with-open is inside the map...
18:11AtKaaZpgmcgee: https://gist.github.com/pgmcgee/9a35b0be39ba1e45d36b#file-core-clj-L32
18:12pgmcgee`AtKaaZ: ah, good call
18:17gfredericksAtKaaZ: also ##``````````foo
18:18gfredericksdangit lazybot
18:18gfredericks,```````````foo
18:18AtKaaZthat gives stack overflow
18:18gfredericksyes
18:18AtKaaZ3 less and it gives 335835
18:19gfredericksyeah it's exponential
18:19AtKaaZbut if you replace one with a ' gives like 610047 ``````'`foo
18:19gfrederickshm
18:20AtKaaZ##``````'`foo
18:20AtKaaZthe bots are dead right?
18:20gfredericksit must be a bot holiday
18:20AtKaaZrofl
18:20gfrederickswhat do bots celebrate on Feb 17?
18:20gfredericksor 3rd sunday in february?
18:21AtKaaZ884259 ``````'''foo
18:21AtKaaZfix-a-bug day
18:25AtKaaZlol 3112673 '`''`''`''```'''''a
18:26callenbot,````````````````````````foo
18:27AtKaaZ''`'''`''''`''''`'`'`'''''a looks like this is like the max i could get on my: 3250516
18:27AtKaaZ&''`'''`''''`''''`'`'`'''''a
18:28gfredericksI bet there is some number theory behind this
18:28gfrederickswhat're those numbers? (comp count flatten)?
18:29AtKaaZi dno but you can fine tune it by inserting ' betwen `-es
18:29gfredericksyou don't know where you're getting the numbers from?
18:29AtKaaZthe code generated?
18:30gfredericksit's a giant s-expression, not a number
18:31TimMc&(map (comp count flatten) [''() '`() `'() ``()])
18:31lazybot⇒ (1 1 1 1)
18:31AtKaaZah you were asking
18:31TimMc&(map (comp count flatten) [`''() `'`() ``'() ```()])
18:31lazybot⇒ (2 2 7 5)
18:31AtKaaZCompilerException java.lang.ClassFormatError: Invalid method Code length 3250410 in class file proof/of/concept/caveats/macros$eval1521, compiling:(NO_SOURCE_PATH:1:1)
18:32gfredericks&(map (comp count flatten) [`a ``a ```a ````a `````a ``````a ```````a])
18:32TimMc$ping
18:32lazybotTimMc: Ping completed in 0 seconds.
18:32gfredericksAtKaaZ: ooh I see
18:33gfredericks&((apply comp (repeat 5000 inc)) 42)
18:33lazybot⇒ 5042
18:33gfredericks&(map (comp count flatten) [`a ``a ```a ````a `````a ``````a])
18:33lazybotjava.lang.ClassFormatError: Invalid method Code length 75500 in class file sandbox20321$eval24059
18:33pgmcgee`thanks for all your help, guys! i appreciate it grealy!
18:33AtKaaZi think over 64k won't let you
18:33gfredericks&(map (comp count flatten) [`a ``a ```a ````a `````a])
18:33lazybot⇒ (0 2 8 41 221)
18:33gfredericksfinally
18:33AtKaaZie. '`'`'`'`'''a Invalid method Code length 68974 in class file
18:35AtKaaZ&(map (comp count flatten) '`''''`'''`'''''`''a)
18:35lazybot⇒ (0 3205)
18:36AtKaaZit's capped at 64k the method Code length
18:37AtKaaZ&(println ''`'''`''''`''''`'`'`'''''a)
18:38ravstercan I do (ring.util.response/response {:status 201 :body "foo"}), or do I have to do (status (ring.util.response/response "foo") 201)?
18:39amalloyravster: try it and see
18:39weavejesterravster: (-> (response "foo") (status 201))
18:39weavejesterravster: Or {:status 201 :headers {} :body "foo"}
18:40ravsterweavejester: oh cool. just the map directly. Nice.
18:40gfredericksthat why ring cool
18:40ravstersweeeeett. thanks weavejester
18:45bbloomlol, dnolen and i are optimizing... http://jsperf.com/push-array-map-entry fucking javascript....
18:46ppppaulcan someone help me figure out how to pretty print without evaluating reader macros (specifically datomic reader macros)?
18:46ppppaulhttps://gist.github.com/boxxxie/4973902
18:47gfredericksmapcat identity is apply concat btw
18:47Sgeo_,[+ 1 2]
18:47Sgeo_:(
18:47gfredericksppppaul: you want to prevent "evaluating" reader macros? do you mean you don't want the data literal tags to be printed?
18:47Sgeo_&[+ 1 2]
18:47lazybot⇒ [#<core$_PLUS_ clojure.core$_PLUS_@1284047> 1 2]
18:48ppppaulmy gist sorta explains what i want gfredericks
18:48gfredericksI saw it
18:48gfredericksbut not the description :)
18:48ppppauli want to print out #db/id
18:49ppppaulprn gives me what i want, but i want to pprint for the output
18:49gfredericksI'm not familiar with what pprint uses underneath
18:49gfredericksit might be a lot of special cases
18:50ppppaulit seems to have a lot of reader macro code in it
18:51ppppaulwell, in my case, i want to have some control over newlines... so i guess i can do my own hacky pprint
18:52ppppaulpprint code is a bit complicated
18:52schaeferhi. 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:52schaefer...some reason?
18:53gfredericksschaefer: might be hard to give specific feedback when the forms are filled out inconsistently?
18:54schaefernot sure... at this point, it's really just an idea i've been toying with. what do you mean, inconsistently?
18:55gfredericks__1__ + __2__ = __7__
18:56schaeferah. yes, the forms are used for a lot of "what-if" sorts of analyses
18:56gfredericksin the above case core.logic would simply fail and tell you nothing about what's wrong
18:59schaefergood 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:59gfrederickscore.logic has no concept of backwards and forewards
19:03schaeferbut 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:10amalloygfredericks: fork?
19:11gfredericksI don't know if that's what it's normally called
19:11gfredericks(defn fork [f g h] (comp (partial apply f) (juxt g h)))
19:11gfredericksmaybe different args order dunno
19:12gfredericksI was about to want it for (fork hash-map key-fn val-fn)
19:12amalloygfredericks: i think it's close to knit
19:13gfredericksknit seems to want different inputs
19:13gfredericksjust one input in this case
19:13amalloy((knit f g) [a b]) => [(f a) (g b)]
19:14gfredericks(defn fork [f g h] (fn [x] (f (g x) (h x)))) ;; simpler version
19:14callenbotKorma is starting to worry me. Is there a SQL library somebody would recommend as an alternate?
19:14gfrederickscome on guys let's build our sql interface thing
19:14gfrederickscan we call it rung?
19:14amalloygfredericks: call it Wrong
19:15gfredericksthe readme will explain that the name is in recognition of SQL being yesterday's news
19:15gfredericks"Wrong: for when you can't use mongo for whatever reason."
19:15amalloy"why are you even on this page? clojure is cool, use a cool data layer"
19:16callenbotSeriously - what's the alternative to Korma?
19:16gfredericksc.c.jdbc
19:16TimMcTCP
19:16gfredericksI enjoyed clojureQL but nobody else did
19:26gfredericksalternatives to korma: clutch, congomongo
19:27gfredericksdatomic
19:27gfredericksfs
19:27gfredericksclojure.core/atom
19:30callenbotgfredericks: :|
19:32warzcouchdb ftw
19:35TimMcI need to get straightened out with c.c.jdbc and transactions.
19:35TimMcIt looks like some commands open transactions, but I don't get to decide what kind of transaction it is?
19:35TimMc(isolation level, etc.)
19:38pochoI'm having difficulty solving problems the clojure way.
19:38pochoI 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:38pochobut works for collections with size not equal to 3.
19:38pochoIs there something like that in clojure.core? If not how would I write it?
19:38gfredericksis that reduce?
19:39gfredericksthe parens look funny
19:39pochoeach f is called on what the other one returned
19:39gfredericksat this point I'd bet at least $5 that's reduce
19:40gfrederickssame argument order and everything
19:40pochook
19:40pochothanks
19:41pochoyeah you were right
19:42callenbotgfredericks: you verbed your noun.
19:42callenbotgfredericks: so you got it backwards.
19:43gfredericksnoun: (verb) to use a noun as a verb
19:43gfrederickswait
19:43gfredericksI have no idea what I meant anymore
19:43brehautdude, thats gerund
19:43gfredericksthat's madding
19:43callenbotbrehaut: particularly participled.
19:45brehautwait, its not a gerund, thats the other way round
19:59warzim 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:59warzis there one that i should prefer?
20:06tmciverwarz: I prefer get-in when nested or just (:key my-map) when not.
20:27warzhm ok
21:00dnolenoptimizing ClojureScript is always an interesting exercise
21:05hiredman~ping
21:05clojurebotPONG!
21:05hiredman,*clojure-version*
21:05clojurebot{:major 1, :minor 5, :incremental 0, :qualifier "RC6"}
21:06TimMcsweet
21:06TimMc,(read-edn "(+ 1 2)")
21:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-edn in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:06TimMcOh, too old.
21:07gfredericksclojurebot: upgrade
21:07clojurebotExcuse me?
21:08gfredericksclojurebot: upgrade is <reply> successfully upgraded to clojure 1.7.0
21:08clojurebotRoger.
21:08dnolenPersistentArrayMap in CLJS are starting to trounce ObjMap under V8
21:09dnolengood sign for real keywords & symbols
21:09gfredericksObjMap is the naive impl?
21:09dnolengfredericks: ObjMap was written under the assumption that dealing w/ JS objects would be faster for access
21:10dnolenPAMs looks just as good as OMs for lookup now on V8
21:10dnolenand 10X faster for assoc w/ 1,2,3 unseen keys (small maps)
21:11gfredericksthat is wild. I'm jealous.
21:11dnolenhttps://github.com/clojure/clojurescript/commit/6a26f157d7b678415aa1f610e570adb7af9bdfb7
21:12dnolentook forever to find the right set of changes that v8 likes
21:12dnolenand these chanes look good in JavaScriptCore too
21:16bbloomdnolen: did the equiv-pred ultimately help?
21:16hiredmanI 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:18gfredericksclojurebot is so big that the monolithic app has been replaced with SOA
21:18hiredmanpretty much
21:19hiredmanI really need to rip the irc bit out as a service, so then the bot will never leave the channel
21:19gfredericksit's the only way to satiate the hoi polloi
21:20gfrederickssix nines or something
21:20hiredmanthen run multiple instances of the evaluator behind an lb
21:20hiredmanput them in an autoscale group
21:22gfredericksthe product people want this done by next week I assume
21:36Frozenlockdo tell
21:36gfredericksgenerating readable code to be eval'd later
21:37gfredericksit's probably terrible
21:39gfredericks$google github misquote
21:39lazybot[fredericksgary/misquote · GitHub] https://github.com/fredericksgary/misquote
21:40bbloomgfredericks: i had no idea that existed
21:40bbloomcompare https://github.com/fredericksgary/misquote/blob/master/src/misquote/core.clj and https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj
21:41RaynesFancy gfredericks.
21:41RaynesThis is why we market our libraries, guys.
21:41gfredericksI did it because hiredman told me it was impossible
21:41RaynesSpeaking of which, have you given your heart to Laser lately? hurrhurr
21:41gfrederickswhich I assume means I didn't properly communicate what I was talking about
21:43cemerickgfredericks: hah, I wrote just this a few weeks ago
21:43gfredericksI'm bad at marketing :(
21:43cemerickgfredericks: hopefully you don't mind me using yours so I can have you fix bugs as they come up ;-P
21:43gfredericksplease do
21:43bbloomlol ok if three of us all wrote the same thing maybe it belongs in core lol
21:44gfredericksthat is the standard criteria
21:44bbloomlet 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:45bbloomit's an almost 1:1 port of the java code from clojure itself
21:45cemerickI'll let you two fight it out and see who's standing in the morning.
21:45gfredericksah ha, so `template` is like misquote
21:45gfredericksbut the mechanism is more general
21:45bbloomyup :-)
21:46gfrederickspresumably it comes with gensym built in as well but that doesn't get in your way if you don't want it
21:46gfrederickswell I hereby declare yours better than mine
21:46bbloomheh, i'd have helped you if i knew :-)
21:46bbloomcemerick: fights over, no need to wait for the morning :-P
21:46gfredericksthat wouldn't be good because your project name is better
21:47bbloomlol! haha thanks
21:47gfredericksit took a lot of effort for me not to use ##(format "lib-%04d" (rand-int 10000))
21:47lazybot⇒ "lib-4124"
21:54werbittHi, 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:57bbloomwerbitt: you can create functions with multiple arities
21:57bbloom(fn ([x] 1) ([x y] 2))
21:57bbloom,((fn ([x] 1) ([x y] 2)) :a)
21:57clojurebot1
21:57bbloom,((fn ([x] 1) ([x y] 2)) :a :b)
21:57clojurebot2
21:57bbloomsame syntax works for defn
21:58werbitthi bbloom, thanks, but I feel like that still has a lot of duplication
21:58werbittfor a wrapper
21:59bbloomwerbitt: duplication? repeating argument names is not the bad kind of duplication
21:59bbloomthe repeated information is physically colocated and semanatically irrelevant
21:59bbloomzero-duplication is a silly goal
22:00werbittits just very verbose, i guess there isn't another way to do it.
22:00Frozenlocknightfly: link?
22:03werbittalso, if the wrapped function is in a let, i think i'm stuck with the conditional
22:03bbloomwerbitt: no, you're not, multiple arities work with fn forms
22:03nightflyFrozenlock: http://www.gigamonkeys.com/book/functions.html
22:03bbloomdefn expands to fn
22:05bbloomthe problem with optional arguments as done in common lisp is that it doesn't allow for elision from the middle
22:06bbloomfor example if you want (fn ([x z] ...) ([x y z] ...)))
22:06bbloomif you want to support every possible way you can do that, it's actually impossible to do without a grammar. consider:
22:06bbloom(fn ([y] ...) ([x z] ...))
22:07bbloomthe way clojure does it is 1) easy to understand 2) unambiguous and 3) matches the underlying dispatch-by-arity semantics
22:07bbloomif you need something more complex than that, use [& args] and parse that however you choose
22:08bbloomand 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:09bbloomor rather i mean (fn [x & [optional]] ...)
22:09bbloomwhich means 4) consistency with destructuring throughout clojure, not just in function signatures
22:09bbloommuch nicer than common lisp's design, IMO
22:10TimMcHmm, I wonder what havoc we could wreak if Clojure exposed the returnAddress JVM primitive.
22:24callenbotKorma doesn't support PGSQL arrays does it?
22:27brehautcallenbot: 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:28cliftonanyone know what '\1' would mean in the context of an anonymous function, e.g. #({\1 %2} % 0)
22:29cliftonoh i guess that is just the character 1
22:29brehautyes
22:29hiredmanTimMc: pretty sure that is not exposed out side of the jvm
22:30hiredmanand the jsr (subroutine inside a method stuff) has been deprecated since java 5
22:30callenbotbrehaut: looks like I'm doing more JOINs. Thanks for the warning.
22:31TimMchiredman: This article I'm reading was discussing it as a primitive that bytecode had access to.
22:31hiredmanhttp://cliffhacks.blogspot.com/2008/02/java-6-tryfinally-compilation-without.html
22:31TimMcOh heh, the article is about Java 2.
22:32brehautcallenbot: 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:32TimMcWelp, that answers that.
22:32brehautcallenbot: you might be able to hook into korma's db->clj transform to do that automatically
22:33callenbotbrehaut: As much as I want to find an excuse to abuse robert.hooke, I'm trying to avoid unnecessary complexity in this project.
22:33hiredmanone of the example bytecode rewriters thatcomes with asm rewrites code that uses jsr to not use them
22:34callenbotbrehaut: 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:34TimMc"tail duplication"
22:34TimMcSo you're saying I *shouldn't* put 5000 lines in a finally block?
22:34brehautcallenbot: 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:35callenbotbrehaut: I need to avoid things that will over-burden inserts.
22:35callenbotbrehaut: I'm not using any constraints, FKs, references, etc.
22:36brehautyikes
22:36callenbotbrehaut: it's a simple schema, it doesn't need them mate.
22:36callenbotI'm just using indexes on $(rel-name)_id to JOIN
22:37callenbotbrehaut: YANGI
22:37callenbothrm. YAGNI*
22:39FrozenlockWhat does the dash mean in a deftype? https://gist.github.com/swannodette/1674971 "-invoke"
22:39Frozenlock(instead of "invoke")
22:45brainproxythoughts on this code: https://gist.github.com/mchampine/868342
22:45callenbotbrainproxy: don't be an asshole. use bcrypt.
22:45callenbotor scrypt. or pbkdf2.
22:46brehautto short; want more details? http://codahale.com/how-to-safely-store-a-password/
22:46callenbottoo*
22:46brainproxycallenbot: well.. definitely not trying to be an asshoole :p
22:46callenbotbrainproxy: 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:46brainproxycallenbot: ummm, hello, that's why I asked
22:47brehautbrainproxy: first rule of crypto: dont write crypto
22:47clojurebotrule 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:47brainproxyalso, I understand the basic premise of salts and so on, and googling around for clojure, salt, password turned up that gist
22:47callenbotbrainproxy: you have no idea what you're doing
22:47callenbotbrainproxy: read the codahale blog post.
22:48callenbotbrainproxy: use bcrypt, scrypt, or pbkdf2.
22:50brehautbrainproxy: 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:50brainproxyalright well i appreciate the tip on the blog post, good info
22:50brehauttop post of which is weavejester releasing the first cut of a password lib (using bcrype, scrypt and pbkdf2)
22:51brehauthttps://github.com/weavejester/crypto-password/
22:51brainproxyyep, looking at that now
22:51callenbotI just use the bcrypt fn in lib-noir.
22:54brainproxycallenbot: blog post was good, got your point
22:58brainproxyi have a small site (small in scope and number of visitors) I'll be building w/ clojure, compojure/liberator, hiccup, et al
22:59brainproxylooking for some direction on how to make it production ready in the context of running it on my own vps
22:59brainproxyis tuning the settings in project.clj, jetty adapter, and then putting varnish in front of it a decent plan?
23:01brehautbrainproxy: jetty is a great little server, and nginx or varnish is great front end to it
23:01brainproxypersistence will be handled using the free edition of datomic, yay
23:01brainproxybrehaut: what I'm wishing for is a TODO list related to moving from dev to production
23:02brainproxywith respect to jetty, leiningen, etc.
23:02brehautbrainproxy: i've only deployed really lightwight stuff with clojure web; blogs, irc bots
23:03brehautbrainproxy: just i just uberjar from git repo on the server, and run from that
23:03brehautbrainproxy: 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:04brehautyou really dont need to do much more for a small site
23:05brainproxyi've never actually worked with uberjar, guess I should read up on that
23:05brainproxywell maybe it was touched on in the O'Reilly book
23:13brehautbrainproxy: a lot of people just use lein ring; my code bases predate its existance and i never felt like changing
23:14brainproxybrehaut: ah, yeah I'm a lein-ring user and fan :)
23:14brehautjust roll with that then :)
23:14bbloomFrozenlock: sorry i missed your question. the - is just a convention... a little confusing though
23:15bbloomFrozenlock: in short, (.-foo x) means to access a property, but that's the only special case handling of -
23:15bbloomin -invoke et al, it's more similar to defn-
23:15bbloomit's to symbolize private
23:16bbloomthe convention is to do (IFooable (-foo [x])) and then (defn foo [x] (... (-foo ...)))
23:16bbloomso you always have a non dash prefixed free function
23:16bbloommake sense?
23:19dnolenbbloom: thanks for the review on GitHub
23:19Frozenlockbbloom: 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:20Frozenlock*it
23:24FrozenlockToying 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:25FrozenlockWow the keyboard skills tonight!
23:25alex_baranoskyif 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:26alex_baranoskycurrently what I'm seeing is that the first column name's value gets lost, and only the second one is kept
23:27clj_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:28clj_newb_2345No, I don't want to code vs protocols; I want to code vs Types.
23:28amalloyclj_newb_2345: write a scala interpreter in clojure
23:28alex_baranoskyclj_newb_2345: don't use Clojure
23:28alex_baranoskyamalloy: good idea
23:28clj_newb_2345I like Clojure's macros and sexp.
23:28clj_newb_2345There's typed-racket. Why has it never taken off in the clojure world?
23:29alex_baranoskyclj_newb_2345: look at Shen maybe
23:29amalloyuse another lisp then, if you want macros and twenty things that clojure hates
23:30clj_newb_2345alex_baranosky: Shengn does claim to have everything I want.
23:31brehautclj_newb_2345: re:static clojure, because it's a lot of work and ambrose is only one person
23:31amalloyeven multiplied by the power of lisp he's only like eight people
23:31clj_newb_2345brehaut: so your view is "It's hard" not "it's impossible" ?
23:32brehautclj_newb_2345: seems like it
23:33brehautclj_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:34clj_newb_2345brehaut: 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:34brehautmeh. typing is always a trade off
23:34alex_baranoskyany clojure.java.jdbc experts around?
23:35brehautin the case of core.typed (i think thats its name) the plan is for the majority of clojure.core to be annotated
23:35alex_baranoskywondering 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:37brainproxyclj_newb_2345: or maybe write some kind of bridge so you can develop in Clojure and Frege side by side
23:37clj_newb_2345brainproxy: I've decided to learn Shen.
23:38brainproxyclj_newb_2345: cool :)
23:40dnolenclj_newb_2345: you do know that core.typed borrows heavily from Typed Racket right?
23:40clj_newb_2345dnolen: no, I thought it started as someone's type-checking master's thesis project, then became part of core.typed
23:40clj_newb_2345dnolen: hey, btw, thanks for help with clojurescript bugs months back
23:41dnolenclj_newb_2345: nope. Directly built on the Typed Racket research and pushing it in new directions.
23:41clj_newb_2345dnolen: 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:42dnolenclj_newb_2345: source maps, we're still working on it
23:42clj_newb_2345dnolen: ah
23:42clj_newb_2345dnolen: 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:42clj_newb_2345The guy's clearly a genius.
23:43dnolenclj_newb_2345: it's pretty cool, tho there are plenty of things for a Clojurist to not like.
23:43clj_newb_2345dnolen: how did you learn shen?
23:44dnolenclj_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:44clj_newb_2345dnolen: what did it miss for you?
23:45dnolenclj_newb_2345: protocols, concurrency primitives, predictable performance for a specific subset of the language, persistent data structures, etc, et
23:45dnolenc
23:47myewhere are the docs on how to translate maven central package info into leiningen dep. info?
23:47myeThe tutorial just says "we'll skip this" :-(
23:54myeOh I see, it's package specific. Got it working :-)
23:56squigglyHow 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:59smnirvensquiggly: are you using emacs?
23:59squigglysmnirven: Yes