#clojure log - Feb 25 2013

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

2:17 marianoguerra: actions are run on agents in the order they are sent right?

4:11 nicholasf: hi. I'm trying to decide whether to use clojure to hack on a prototype for a startup Im thinking about

4:11 this isnt trolling - just wondering about the clojure is slow problem

4:12 is anyone really hitting this in production level apps? Is it biting anyone?

4:13 vijaykiran: how did you get the impression taht clojure is slow :) ?

4:13 nicholasf: just from googling on it

4:13 pwned: I wish I used clojure for this one

4:13 nicholasf: there's a benchmark site which compares a lot of operations

4:13 clojure doesn't do well

4:13 altho, that doesnt quite make sense given the existence of things like storm, etc.

4:14 pwned: nicholasf: what is it compared to ?

4:14 clojurebot: Titim gan éirí ort.

4:14 nicholasf: hrm, I'm taking it no one has been bitten by this problem

4:14 that's the easiest way to resolve this

4:14 pwned: I'll try to dig up the URL

4:14 TheBusby: nicholasf: for many bits clojure is fairly slow compared to C/C++

4:14 but clojure allows you to use more available cores more easily, so it balances out depending on what you're doing

4:14 it makes distributed computing *MUCH* easier too

4:15 nicholasf: TheBusby: yeh that's cool

4:15 I want to use the JVM as I'm building an app that sells security

4:16 TheBusby: I think the only way to be sure it suites your needs is to prototype something at test it yourself

4:16 nicholasf: TheBusby: Ive made a simple noir app before

4:16 vijaykiran: nicholasf: performance depends on various factors, so the you may need to try out and find the bottlenecks

4:16 no7hing: nicholasf: you probably mean this one? http://benchmarksgame.alioth.debian.org/

4:16 nicholasf: if people arent hitting major problems with slowness issues it seems like a decent pathway for me

4:16 TheBusby: if you're doing web apps, then I don't think performance will be an issue

4:16 nicholasf: no7hing: yup

4:17 TheBusby: Im doing web apps with a lot of encryption

4:17 TheBusby: if you can separate out the encryption bit, that shouldn't pose a problem

4:17 either call it via JNI, or proxy through NGINX

4:19 clgv: nicholasf: in my code a solution to a N=100 customer vehicle routing problem is constructed in 6ms the whole optimization runs 6seconds. I'd say that's pretty much usable ;)

4:20 though the solution representation is not completely mutable

4:20 *not completely immutable

4:25 kanzure: hi there. i have a class file (Gb.class) that i want to import. i have put it into a directory that is in $CLASSPATH and i call (:import Gb) but get "CompilerException java.lang.RuntimeException: Unable to resolve symbol: Gb in this context, compiling:(NO_SOURCE_PATH:6)". what am i doing wrong?

4:43 clgv: kanzure: what is the package of `Gb`?

4:44 kanzure: clgv: its com.aurellem.gb (so com.aurellem.gb.Gb)

4:44 clgv: i have Gb.class and a gb-drivers.jar file (which contains com/aurellem.gb/Gb.class)

4:46 oh oops. i was adding the folder to my $CLASSPATH instead of the path to the jar itself.

4:57 clgv: kanzure: well your class file needs to be in the folder hierarchy your package declares

4:57 so dir-on-classpath/com/aurellem/gb/Gb.class

5:11 kanzure: clgv: and then call (:import com.aurellem.gb.Gb) ?

5:12 clgv: kanzure: exactly

5:13 kanzure: it is the same procedure as it is in java except the import statement has lisp-flavor and does not support ".*"

6:56 michaelr525: hello

7:26 ciphergoth: My macro fu isn't up to this job, but wondering if someone's already done it: I had this idea that I could maybe write a macro such that I could replace a given "defn" with eg "defn-pprint", and the result would be that every time that function was called, its params and result would get pretty-printed

7:26 Does that sound very hard?

7:28 hugod: ciphergoth: https://github.com/clojure/tools.trace

7:28 ciphergoth: a-ha! thank you!

8:16 yedi: is clj-stripe the only clojure library for stripe?

9:45 znDuff: Can I get some feedback on Marick's "Functional Programing for the Object Oriented Programmer"? Is it useful for someone who's actually been doing Clojure in production for a few years, or more strictly beginner-centric?

10:12 frenchyp: znDuff: The book is for FP beginners. It uses a clojure but only what you would learn in a 10 minutes tutorial, so it is really not a book to learn advanced clojure

10:14 as for FP, it explains concepts clearly and consisely, starting from nothing and reaching monads

10:14 florianover: @frenchyp which book are you talking about?

10:15 frenchyp: it also presents OO concepts starting from scratch and ending in a complete system

10:15 Functional Programing for the OO Programmer, responding to znDuff question

10:15 florianover: k thx

10:17 frenchyp: florianover: np

10:18 so, book is 50% OO, 50% FP, both presuming no knowledge. I am happy I bought it

10:26 aroemers: ~logs

10:26 clojurebot: logs is http://clojure-log.n01se.net/

10:38 daviddpark: I have been tasked with creating a hypermedia API in a shop that is very python centric, but I am trying to introduce the team to Clojure. To that end, I really like what I am reading about the liberator project, but am having some difficulty in getting the examples to work properly. If there are any folks who have worked with Liberator out there. I have recently cloned the clojure-liberator project and simply run "l

10:38 ein examples" from the top level directory. I can get some of the examples to work, such as hello-world and hello-george, but when I attempt to do anything with olympic athletes, I am seeing "UnsupportedOperationException: nth not supported on this type: Character (representation.clj:58) Anyone have a couple of minutes to help me troubleshoot and get the examples working properly?

10:45 a|i: what's the up to date setup for starting clojure with emacs?

10:45 googlng brings up many out of date stuff.

10:46 eg, is clojure-mode dead now?

10:46 frozenlock: a|i: use nrepl.el and clojure-mode.el. That's about it.

10:46 jeremyheiler: a|i, clojure-mode and nrepl.el

10:47 a|i: what's swank then?

10:47 jeremyheiler: nrepl.el replaced it

10:47 for clojure

10:47 florianover: see http://clojure-doc.org/articles/tutorials/emacs.html

10:48 nilbert: nrepl also plays quite nicely with leiningen, just user M-x nrepl-jack-in

10:48 a|i: ok, what's slime then?

10:49 nilbert: I think both swank and slime are being phased out, nrepl replaces them

10:49 I also personally use rainbow-parens and paredit-mode, but YMMV

10:49 frozenlock: a|i: swank and slime are being replaced by nrepl and nrepl.el :p

10:49 znDuff: a|i: personally, I tend to use emacs-live

10:49 a|i: ...that way you have a single package to download that tracks all the current/modern bits.

10:49 florianover: slime is the emacs mode for common-lisp

10:50 a|i: so, nrepl = the new slime+swank?

10:50 frozenlock: yup

10:50 nilbert: if you want to have autocomplete, then ac-nrepl is worth checking out

10:51 znDuff: a|i: ...well, nrepl+nrepl.el ~= new slime+swank

10:51 a|i: znDuff: emacs-live is a like a package manager that keeps nrepl up-to-date?

10:51 znDuff: a|i: rather, it's a bundle that includes everything you need to be productive working with Clojure in Emacs.

10:51 frozenlock: nilbert: wait... doesn't nrepl already auto complete?

10:51 znDuff: a|i: ...including paredit, nrepl.el, clojure-mode, and much much else.

10:52 a|i: See https://github.com/overtone/emacs-live (and, optionally, videos linked from same).

10:52 nilbert: not sure if it does nowadays, but when I started using it it didn't

10:52 a|i: znDuff: is that nice and light 'much much more', or bloated 'much much more'? :)

10:52 znDuff: a|i: That's a matter of personal taste, isn't it?

10:52 a|i: It makes me happy, though.

10:53 a|i: znDuff: I'll give it a try now :)

10:53 ah one more thing, how is light table compared with emacs?

10:53 I know it's not mature yet..

10:53 znDuff: a|i: Light Table is very nifty/promising, but not ready to be a day-to-day editor yet.

10:53 frozenlock: nilbert: nvm, it's not the same thing.

10:54 a|i: znDuff: what sort of target does light table aim for?

10:54 znDuff: a|i: What it aims for is a larger discussion. What it is right now is a decent platform for experimentation -- if I were teaching someone Clojure who didn't know the language, for instance, it's what I'd start them on.

10:55 ...but when they started doing real work, it'd be over to Emacs.

10:55 a|i: znDuff: makes sense.

10:56 hashbang1: a|i: the instarepl in lighttable is a great way to learn about clojure, but gets annoying when you want to write something non-trivial. its also still very new, new minor releases are coming out all the time for it

10:57 a|i: hashbang1: I guess light table would be functional maybe a year from now.

11:18 johnmn3: g'day

11:41 ipostelnik: anyone using lein with Jenkins/Hudson? If so, how do you make dependent projects build in right order?

11:42 no7hing: ipostelnik: don't you configure that in jenkins itself?

11:45 znDuff: Hmm; automating the Jenkins setup to sync from the dependency tree might be fun.

11:46 ...actually, I have an internal bug that would be fixed by modeling a flattened topological sort of our dependency order into Jenkins. *ponders*.

11:46 ipostelnik: ...btw, how's life treating you these days? It's been a while.

11:47 ipostelnik: znDuff, maven3 plugin does that

11:47 znDuff: ipostelnik: Ahh. We're an Ivy shop, so it's not so handy locally.

11:47 ...but looking at the implementation might be worthwhile.

12:20 bordatoue: hello could anyone tell which is the widely used library to deal with SQL in clojure

12:22 znDuff: bordatoue: well, everything uses clojure.java.jdbc, since that's what the available mapping layers backend into.

12:22 bordatoue: of those mapping layers, Korma has some popularity, but IMHO it's pretty awful.

12:23 bordatoue: znDuff: which one would you prefer?

12:23 znDuff: I built my own mapping layer on clojure.java.jdbc. Not released, and probably shouldn't be, since it's just good enough for my own usage and nothing more.

12:24 ...but it's a lot less awful that korma (which, owing to overuse of macros, is very hard to compose with)

12:24 s/that/than/

12:24 frozenlock: Interesting... a government services that has a < 16 characters password limit. Be afraid, be very afraid.

12:24 TimMc: Banks do that *all the time*.

12:24 akhudek: frozenlock: be happy it's not 4 digits

12:25 frozenlock: Doesn't that tell you that they don't hash the password?

12:26 bordatoue: znDuff: what do you think about clojurql , i got some error while loading it

12:28 znDuff: bordatoue: Haven't looked at it in enough detail to have a strong opinion.

12:28 bordatoue: znDuff: okay thanks

12:41 arrdem: is there an equivlaent to cl-yacc for Clojure? I'm just looking for a way to hook a token stream together into an AST.

12:42 znDuff: arrdem: How does what you're looking for differ from clojure.tools.reader?

12:45 arrdem: znDuff: haven't used that tools lib before.. I'm writing a Pascal lexer/parser for a class and need a way to build ASTs from a tokenizer I already wrote.

12:46 znDuff: looks like that's just an EDN/Sexpr reader for CLJ.

12:46 znDuff: Ahh.

12:46 arrdem: believe me, if I could just use an existing reader I would XP

12:46 znDuff: Hmm; I've looked at available parser generators before, but wasn't looking for yacc compatibility.

12:47 arrdem: I mean I'm writing mine in clisp (I know I'm a trator burn me later) and a buddy of mine is doing the same thing in Clojure.

12:48 I know I can use their cl-yacc library to define tokens and build ASTs from them, but all I've ever done in CLJ is use fnparse or equivalent to do the AST and lexer in one go

12:51 TimMc: frozenlock: It's a fairly strong indicator, yes.

12:52 frozenlock: I'm annoyed that my email provider doesn't let you go beyond 12 characters. They say it's because they got tired of people losing their passwords...

12:54 * znDuff eyes clj-peg, and vaguely suspects that he evaluated it before and found that it didn't deal with left-recursive grammars.

12:54 preyalone: What's the Clojure equivalent of Haskell's replicateM ?

12:54 E.g., Generate N random numbers and return them in a sequence.

12:54 * arrdem has a burning hatred for left-recursive grammars

12:55 znDuff: preyalone: the typical way to do that is something like (take N (infinite-random-sequence))

12:55 preyalone: ,(infinite-random-sequence)

12:55 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: infinite-random-sequence in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:55 znDuff: ...well, yes, assuming that you have such a thing. :)

12:56 preyalone: That begs the question, since I'm trying to IMPLEMENT such a thing.

12:56 arrdem: ,(doc random)

12:56 clojurebot: Gabh mo leithscéal?

12:56 znDuff: Do you have a call that gives you a single random number?

12:56 mpenet: ,(take 4 (repeatedly (rand-int 100)))

12:56 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn>

12:56 znDuff: preyalone: http://clojuredocs.org/clojure_core/clojure.core/repeatedly

12:56 preyalone: ,(rand)

12:56 clojurebot: 0.9065726517372994

12:56 znDuff: ,(take 5 (repeatedly #(rand-int 11)))

12:56 clojurebot: (4 8 8 1 0)

12:56 preyalone: Thanks znDuff!

12:56 arrdem: ,(doc repeatedly)

12:56 clojurebot: "([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"

12:57 mpenet: ,(take 4 (repeatedly rand-int 100))

12:57 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.core$rand_int cannot be cast to java.lang.Number>

12:57 mpenet: gni

12:57 preyalone: ,(repeatedly 3 (rand))

12:57 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Double cannot be cast to clojure.lang.IFn>

12:57 arrdem: #clojure just turned into a repl again..

12:57 mpenet: ,(take 4 (repeatedly #(rand-int 100)))

12:57 clojurebot: (19 11 75 82)

12:57 mpenet: there!

12:57 preyalone: ,(repeatedly 4 (rand-int 100))

12:57 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn>

12:58 preyalone: ,(repeatedly 4 #(rand-int 100))

12:58 clojurebot: (50 99 54 19)

12:58 preyalone: Oooooh no. It's almost like a LISP-2 here.

12:58 Why do I need to prefix the rand-int call with a pound?

12:59 znDuff: preyalone: ...replicateM doesn't have anything to do with random numbers, does it? Hence, I took the "random numbers" part of the question to be a stand-in for some other function.

12:59 Bronsa: it's a shortrand for an anonymous function

12:59 mknoszlig: preyalone: because repeatedly takes a function as an argument

12:59 arrdem: (inc Bronsa )

12:59 lazybot: ⇒ 1

12:59 preyalone: znDuff: Correct. random numbers are just a particular application.

12:59 mknoszlig: But I thought Clojure was a LISP-1.

13:00 znDuff: preyalone: Where does it look like a LISP-2 to you? I don't see anything about those examples that make it look like there are separate namespaces.

13:00 preyalone: #(...) constructs a lambda, right?

13:00 arrdem: yes...

13:00 TimMc: preyalone: #(foo %) is (fn [x] (foo x))

13:00 mknoszlig: preyalone: what does that have to do with it? (rand-int 100) will evaluate to a random number

13:00 preyalone: !

13:00 Bronsa: preyalone: you're doing (repeatedly 4 (fn [x] (rand-int 100)))

13:00 arrdem: # is just a reader macro

13:00 yedi: is clj-stripe the only clojure library for stripe?

13:00 TimMc: Bronsa: Not quite, (fn [] ...)

13:01 mknoszlig: preyalone: and repeatedly expects a fn as 2nd arg

13:01 Bronsa: yeah, brainfart

13:01 S11001001: ,'#(list 1 % 3)

13:01 clojurebot: (fn* [p1__412#] (list 1 p1__412# 3))

13:02 znDuff: yedi: http://www.clojuresphere.com/?query=Stripe doesn't find anything that isn't a fork or branch of it, so probably.

13:02 yedi: You can of course use Java libraries if it's totally unsuitable for some reason.

13:03 yedi: i could have sworn i read about a clojure library that wraps java's lib instead of clj-stripes approach of wrapping the rest api

13:06 technomancy: does anyone use clojurescript-mode.el? I think there is no longer any reason to keep it around, but thought I should check first.

13:11 preyalone: I see how doseq is good for replacing (doall (map...)) boilerplate, but I think (doall (map...)) is much easier for us to read.

13:12 mknoszlig: preyalone: you also get argument destructuring with doseq

13:14 preyalone: Can I use arbitrary types as keys in hashmaps, or can I only use label-like keywords?

13:15 dnolen: preyalone: arbitrary

13:15 preyalone: dnolen: Would :[1 2 3] be a valid key?

13:16 dnolen: ,:[1 2 3]

13:16 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :>

13:16 dnolen: preyalone: ^

13:17 preyalone: keys can be anything, preferably immutable - leading `:` is only for keywords

13:25 TimMc: preyalone: You can use [1 2 3] as a key, yes. However, beware of numbers as keys -- the JVM hashes numbers weirdly.

13:25 preyalone: TimMc: Such as Integers vs BigIntegers?

13:25 TimMc: Long and Integer, I think.

13:26 &(assoc {[1 2] "val"} :a-keyword 'some-symbol)

13:26 lazybot: ⇒ {:a-keyword some-symbol, [1 2] "val"}

13:26 preyalone: Thanks for the warning

13:26 TimMc: It's rare to see anything but keywords, symbols, and strings as keys.

13:27 And keywords vastly outnumber the others. It's one of the things they're intended for, really.

13:29 preyalone: If you want keys whose values are not known at compile time, just use strings. You *can* convert arbitrary strings into keywords, but those keywords may not be able to survive a print-read round-trip.

13:29 &(read-string

13:29 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

13:29 TimMc: &(keyword "white space")

13:29 lazybot: ⇒ :white space

13:30 TimMc: &(read-string (pr-str (keyword "white space")))

13:30 lazybot: ⇒ :white

13:30 TimMc: Some JSON and DB libraries are fond of keyword-izing strings, but it can bite you during debugging (or make debugging a mess.)

13:39 lynaghk: cemerick: ping

13:54 Raynes: cemerick: Man. Drop support for 1.2.0 in friend. Anybody using 1.2.0 doesn't deserve to use friend.

13:55 ;)

13:55 cemerick: Raynes: I try to help the meek and downtrodden.

13:56 Raynes: Such a good samaritan.

13:57 technomancy: I think I convinced marick to drop 1.3.0 from midje

13:57 but he's doing this crazy thing where leiningen-core is brought into the project JVM itself that I think I don't even want to understand

14:00 Raynes: cemerick: I guess a browserid whateveryoucallitinfriend should be a separate project? I guess I need to write it soon (finally) so I can use that fancy rate limiting middleware properly.

14:01 cemerick: Raynes: Yes. I'm in the middle of factoring out openid right now, actually.

14:01 Raynes: I don't understand friend at all, so that should be exciting.

14:01 Because I've got so much time.

14:01 cemerick: It's so absurdly straightforward, you'll cry with joy.

14:02 Raynes: s/ly straightforward//

14:02 s/with joy//

14:03 cemerick: maybe that, too

14:03 Perhaps I should have named the project 'kafka'.

14:05 Raynes: cemerick: Is it a coincidence that you just said that?

14:05 cemerick: we'll never know, now

14:05 dgrnbrg: Is anyone using the lein-groovyc plugin to mix groovy and clojure?

14:05 Raynes: cemerick: I'm currently working on a Clojure implementation of the Kafka file format for work.

14:06 cemerick: Someone named a file format 'kafka'? Perfect.

14:07 Raynes: cemerick: http://kafka.apache.org/

14:08 It's a messaging system in Scala.

14:08 Which does a lot of what we want but is mighty complex for our purposes.

14:08 So we're just stealing the format and idea.

14:09 cemerick: hrm, I think I heard about this briefly

14:15 Raynes: cemerick: It's my third week at work and I'm writing a database. Send help.

14:25 cemerick: Raynes: sounds like a good job :-)

14:25 Raynes: cemerick: "Writing a custom codec in gloss is easy. Just reify some shit."

14:25 <3

14:36 frozenlock: Is https://github.com/overtone/at-at still the goto library when one needs to do things at regular intervals?

14:38 Raynes: frozenlock: I've been using it. Pretty nice, I thinks.

14:38 It's simpler than stuff like quartzite.

14:38 And no cron crap.

14:42 frozenlock: Yeah I like very much also;I was wondering if there was any newcomers that stole the spotlight. Apparently there isn't. :)

14:42 Thank you for your input!

14:43 devinus: if you guys were doing an algebra library and wanted to represent points on a cartesian plane, would you use e.g. [x y] in a vector or create a point defstruct or something else?

14:45 frozenlock: I would probably settle for a vector.

14:45 * frozenlock waits to learn how misguided that would be...

14:46 devinus: frozenlock: my only worry is that a vector is too heavy duty

14:47 antares_: devinus: I'd start with a vector. I assume points won't be mutated anyway?

14:47 devinus: antares_: negative

14:47 antares_: devinus: then why not use an immutable pair that vector gives you

14:48 devinus: antares_: what do you mean?

14:48 right now i'm using [x y]

14:48 is there some other immutable pair I'm unaware of?

14:48 antares_: devinus: no, that's it

14:48 devinus: ah right

14:48 antares_: vectors only really have overhead over mutable objects if you mutate them

14:48 if not, it's perfect

14:49 devinus: antares_: am i mistaken in believing that the vector won't become a full logn32 or whatever vector if it's just two elements?

14:51 hugod: is anyone using true, false and nil for three-value logic?

14:51 antares_: devinus: log32 (n) with 2 elements probably won't be different from O(1) in any real world scenario

14:51 Raynes: $google three value logic

14:51 lazybot: [Three-valued logic - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Three-valued_logic

14:52 hyPiRion: except for like the obvious overhead

14:52 devinus: antares_: right, but i think i read somewhere that it doesn't go log32 until the vector reaches a certain size

14:52 Raynes: Interesting. I guess this is what I get for not going to college.

14:52 devinus: maybe I'm wrong

14:52 Raynes: theres still time

14:52 antares_: devinus: since it's a tree, it should be proportional to the height of the tree http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/

14:53 Raynes: devinus: But what's the point when I have wikipedia?

14:53 devinus: Raynes: not the same :(

14:53 antares_: Raynes: it's OK, I barely remembered what it is anyway

14:53 devinus: <- 26 year old college student

14:53 antares_: nice thank you

14:53 arkh: why can't a person take x from line-seq? - (defn foo [filename] (with-open [rdr (clojure.java.io/reader filename)] (take 3 (line-seq rdr))))

14:54 Raynes: devinus: I also have amalloy_ (when he isn't in Colorado) to teach me these things. He is an excellent teacher.

14:54 hyPiRion: arkh: because you're reading those lines lazily. Try to wrap the (take 3 ..) within a doall

14:54 Raynes: I really enjoy learning about computer sciencey things in a work environment.

14:54 devinus: i want a personal amalloy_

14:54 Raynes: Everybody should be entitled to one, imo.

14:54 I'm really lucky.

14:55 * hyPiRion is selling cloning technology.

14:55 arkh: hyPiRion: still seems strange 'take' can't just realize 3 of them as in other lazy sequences

14:55 hugod: I'm wondering if nil or :undefined would be a better third value

14:55 jballanc: style question -- best way to conditionally add key/value pairs to a map? i.e. (let [my-map {:foo "bar"} my-map (if baz (assoc my-map :baz "qux") my-map)])

14:55 antares_: arkh: take is also lazy

14:55 Raynes: hyPiRion: I've read books where this did not end well.

14:55 hyPiRion: Me too.

14:55 antares_: Raynes: honestly, I don't think any college CS education is worth what it costs in the US

14:56 Raynes: hyPiRion: Actually, it was a movie: http://en.wikipedia.org/wiki/Multiplicity_(film)

14:56 * znDuff had about two classes that covered computer-sciency stuff that he probably wouldn't have picked up in a work environment alone

14:56 Raynes: antares_: Well, I'm certainly not going to college when I have a great full time job right now and unlimited resources for learning without college.

14:56 arkh: antares_: I did not know that : / Thank you

14:57 antares_: Raynes: doing it right

14:57 hyPiRion: znDuff: I've had a bajillion I think.

14:57 Raynes: hyPiRion: Man, I'm wrong all around. This movie *did* end well.

14:57 znDuff: ...one of those being systems engineering (starting with carnaugh maps and ending with "what data lines do we need to add to this chip before we can implement this new instruction?"), and the other being formal database design.

14:57 antares_: Raynes: http://media.tumblr.com/tumblr_lqfw3oPpTW1qd0g1t.gif

14:58 alv-r-: only problem is that companies don't wanna pay you much if you don't have a degree (at least in my country, dunno how it is in the US)

14:58 hyPiRion: Raynes: Well, you better by my cloning technology then!

14:58 *buy

14:58 Raynes: antares_: http://media.tumblr.com/tumblr_m4m05vgNYO1qk7x97.gif

14:59 znDuff: alv-r-: Having a degree doesn't make a big difference w/ CS in the US after you've had substantial, verifiable work experience.

14:59 ...there are shops that differ, but that's the general rule.

15:00 Raynes: alv-r-: Most companies I'd actually want to work for don't care much about a college degree and value what I've actually done over it.

15:01 My github page is right over there. I've done lots of stuff. I still do lots of stuff. And now I even have some work experience. Hopefully I won't have much in the way of problems getting jobs later in life.

15:04 frozenlock: School certification is like the cake. It's a lie.

15:04 xeqi: there is something to be said about learning about the field from some of the pioneers

15:08 jcromartie: … clojure.data.zip.xml

15:08 was clownpenis.fart already taken?

15:13 Raynes: xeqi: I met William Byrd and Rich Hickey, dude. :p

15:16 znDuff: ...and going to a school where you're working with people who pioneered the field is, as a rule, bloody expensive. Also, just because someone won a Nobel Prize doesn't make them a competent teacher.

15:17 xeqi: znDuff: true, luckily for me it was a in-state public school

15:17 mpenet: if you want to do research in your field, it's mandatory (there are exceptions but it's rare). Depends on what are your goals

15:17 frozenlock: Not all fields are young enough to have 'pioneers'.

15:17 znDuff: (Fiancee has a lot to say about that subject, having gone to UofC directly out of high school and finishing paying off loans from same at 39).

15:17 technomancy: 4 years is a ton of time to spend learning; you'll have a lot better chances of rubbing shoulders with pioneers if you bootstrap the learning process yourself

15:18 provided you have the discipline to actually focus

15:18 frozenlock: technomancy: I wish someone convinced me of this before doing the usual school road.

15:19 Is that what you're telling your children? :)

15:19 mrb_bk: dnolen: thanks for the RT love

15:19 technomancy: frozenlock: they'll figure it out on their own; we're homeschooling =)

15:20 dnolen: mrb_bk: np, excellent post!

15:20 * frozenlock wants technomancy as a dad

15:20 mrb_bk: i chatted with technomancy about this in person and it in fact seems like he would be an awesome dad

15:21 technomancy: heh; thanks =)

15:21 we are having a blast with Scratch; highly recommended for kids at the early stages: http://scratch.mit.edu/

15:22 mrb_bk: scratch is cool

15:24 jcromartie: Scratch is Squeak!

15:25 not sure how they get it on the web

15:25 I guess because they're MIT

15:27 Apage43: my schoolgoing stopped pretty quick as I was paying for it out of pocket (and therefore working at the time) and I wound up not sleeping enough to do either.

15:31 * znDuff reads through the introductory docs to ztellman/gloss, and is thoroughly impressed

15:34 jcromartie: I'm about to ditch the fancy XML zipper stuff and just use xpath

15:34 would that be wrong

15:35 znDuff: jcromartie: I don't think anyone would be lining up with pitchforks.

15:37 brehaut: jcromartie: do you know about clojure.data.zip.xml/xml-> ?

15:37 jcromartie: brehaut: yes, I'm using that

15:37 it seems to work well

15:37 brehaut: jcromartie: i've been surprised by it a few times; i was just checking you knew about it before throwing in the zipper stuff

15:38 jcromartie: I suppose I'll stick with it for now

15:38 brehaut: jcromartie: i found it reasonable for simple stuff, but i can see it getting annoying for more complex stuff xpath does well

15:38 jcromartie: it's so simple, really, and the fact that it's just been there quiet and mostly unchanged…

15:38 znDuff: Heh.

15:38 * znDuff tends to frequently consider XPath inadequate and move to XQuery.

15:39 jcromartie: hmm

15:39 Xquery....

15:39 well this app is a middle-man for different feeds (RSS, ATOM)

15:39 brehaut: znDuff: i've always been aware of XQuery, but ive never actually used it. ive always thought that if my xml had got that complicated i had made some bad life choices and needed to reevaluate things

15:39 jcromartie: I'm practically done with RSS

15:39 frozenlock: Oh god... what have I done...

15:40 znDuff: brehaut: I'm rarely working only with my own XML.

15:40 frozenlock: "ClassNotFoundException clojure.repl java.net.URLClassLoader$1.run (URLClassLoader.java:366)" when trying C-c C-d in the nrepl buffer :(

15:40 brehaut: znDuff: oh for sure, its other peoples xml decisions that always hurt

15:40 * brehaut glares at scripting.com

15:40 znDuff: brehaut: In the project where I use XQuery most, I'm pulling in documents from 5 different sources -- three of those in 3rd-party XML schemas, one of them SQL, one of them text over HTTP with my own XQuery code both doing the HTTP requests and generating XML from the output.

15:40 Apage43: I did succesfully use clojure.data.xml to do streaming parsing of some multi-gigabyte XML files. Directly from the .ZIP files I downloaded them in too :)

15:41 but I had to bake my own xml-> alike among other things to actually do useful things with it

15:41 brehaut: znDuff: im sorry to hear that ;)

15:41 znDuff: brehaut: ...anyhow, it makes joining between those only-barely-related documents pretty darned straightforward.

15:41 brehaut: znDuff: thats actually quite interesting

15:42 znDuff: In a previous job i had to do some work parsing reuters' financial XML and its a similar sort of monstrosity

15:42 (though less sources, it just looks a lot like a cobol datastructure munged into xml)

15:44 * frozenlock nails down the problem to clojure 1.5.0-RC16

15:46 meegofl: Hi

15:46 dnolen: hrm, the more I think about it more I think extending nil to core prototypes in ClojureScript is a bad idea ...

15:47 meegofl: how can i read input from user in loop and perform function on it until recieves "exit"

15:47 ?

15:48 hyPiRion: meegofl: (doc read)

15:49 use (read stream eof-error? eof-value)

15:50 meegofl: hyPiRion: 10x!

15:51 hyPiRion: anyway i can do it directly from user? like read-line?

15:51 frozenlock: dnolen: Is the explanation of this conclusion graspable for mere mortals? :P

15:51 meegofl: hyPiRion: i can't get read-line to work in loop...

15:52 hyPiRion: read-line should return nil when there's no input to read

15:53 so like (loop [s (read-line)] (when-not (nil? s) (println s))) should probably work

15:53 well, with a recur step of course

15:53 brehaut: dnolen: someone put forth a heuristic that you should only extend protocols to things if you are the owner of one of the thing or the protocol; nil for core protocols would fit that

15:55 (wish i could find a reference)

15:59 dnolen: brehaut: to be a bit more clear - I think it OK for user defined protocols and extending those to nil.

15:59 brehaut: dnolen: right, typically though because you own the user defined protocol even though you dont own nil

15:59 dnolen: frozenlock: it's a performance issue but it's also a semantic thing, (sequential? nil) => true seems a bit odd

16:03 jwr7: so, did the old clojure.contrib.seq-utils/separate make its way into something new?

16:03 brehaut: (conj filter remove) ?

16:03 conj? wtf

16:03 juxt

16:03 always juxt

16:05 TimMc: You're slipping, man.

16:05 brehaut: someone will have to dec me

16:06 Raynes: (dec brehaut)

16:06 lazybot: ⇒ 9

16:06 brehaut: thanks

16:06 * Raynes nods

16:07 jwr7: brehaut: right -- this will basically do the same thing. Neat. I was kinda hoping for a nicer solution that would look at each element exactly once and then place it in one of two output bins.

16:07 gfredericks: what do people do about clj-time not automatically hooking into the #inst data reader?

16:07 should there be a separate lib that does that?

16:07 jwr7: ... and experience taught me to ask before I go write anything in Clojure myself. Because most of the time, it's been done before.

16:08 mpenet: odd, there is no boolean? or bool? fn in core... we have string? number? that would make sense no?

16:08 TimMc: jwr7: I'm sure flatland/useful has something like that...

16:09 Raynes: I doubt it.

16:09 We really like juxt.

16:09 gfredericks: mpenet: yeah, I've hit that a couple times. (partial instance? Boolean)

16:10 hiredman: booleans are a tricky case

16:10 due to boxing as Boolean

16:10 TimMc: Raynes: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L26

16:10 brehaut: jwr7: https://github.com/clojure/clojure-contrib/blob/master/modules/seq/src/main/clojure/clojure/contrib/seq.clj#L33-L37 (juxt filter remove) is actually a more elegant implementation than the one in old contrib

16:10 gfredericks: hiredman: yeah?

16:10 hiredman: better to just call boolean and make it a good boolean

16:10 Raynes: $wiki humor

16:10 lazybot: [Humour - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Humour

16:10 Raynes: TimMc: ^

16:11 mpenet: well boolean and bool? don't do the same thing, and in my case I can't use boolean

16:11 hiredman: gfredericks: the sane way to deal with boolean boxing would be to cache 2 instances of Boolean, one for true and one for false

16:11 but of couse the jvm doesn't do that

16:11 jcromartie: how can I get a java Iterator from a vector or seq

16:11 TimMc: Raynes: Anyway, you'll be happy to know that separate uses decorate, which uses juxt identity.

16:12 hiredman: so you can make multiple different instances of Boolean which can break all kinds of weird things

16:12 Raynes: TimMc: I don't understand half of those bizarre combinator functions in useful. I let amalloy decorate (no pun intended) my code with them when I'm finished if eh wants.

16:12 jcromartie: never mind

16:12 jasonbray: using shoreleave for the first time and getting a 404 on _fetch, the default rpc uri.. any ideas? handlers seem to be working in general

16:13 jwr7: brehaut: you are right, it's more elegant. But I think I'll want to write my own 'separate' function anyway, one that traverses the input sequence only once.

16:13 hiredman: ,(if (Boolean. false) :a :b)

16:13 clojurebot: :a

16:13 ohpauleez: jasonbray: What version?

16:13 brehaut: jwr7: im not sure you could easily do the two seq generation thing in clojure

16:13 jasonbray: ohpauleez: 0.2.2

16:13 TimMc: &(letfn [(decorate [& fs] (apply juxt identity fs))] (map (decorate inc -) (range 5)))

16:13 lazybot: ⇒ ([0 1 0] [1 2 -1] [2 3 -2] [3 4 -3] [4 5 -4])

16:14 TimMc: brehaut: Sure you can, with lazy-seqs sharing state.

16:14 ohpauleez: jasonbray: And you're using the ring middleware?

16:14 jwr7: brehaut: I never intended to, I am resigned to realizing both output sequences. I just hoped to call the predicate only once. But wait -- it seems the version in useful does exactly that. Hmm.

16:14 Raynes: &(require 'flatland.useful.fn)

16:14 lazybot: java.io.FileNotFoundException: Could not locate flatland/useful/fn__init.class or flatland/useful/fn.clj on classpath:

16:14 Raynes: &(require 'flatland.fn)

16:14 lazybot: java.io.FileNotFoundException: Could not locate flatland/fn__init.class or flatland/fn.clj on classpath:

16:14 jasonbray: ohpauleez: yes, shoreleave/shoreleave-remote and com.cemerick/shoreleave-remote-ring

16:14 Raynes: &(require 'useful.fn)

16:14 lazybot: ⇒ nil

16:15 brehaut: TimMc: sorry, yeah that was implicit.

16:15 Raynes: Damn namespace changes.

16:15 TimMc: brehaut: Example: https://github.com/timmc/rand/blob/master/src/rand/core.clj#L26

16:15 ohpauleez: jasonbray: If you're just experimenting with it, I'd give this a try and see if you still have the issue: https://github.com/shoreleave/shoreleave-baseline

16:15 Raynes: &(map (decorate inc -) (range 5))

16:15 lazybot: java.lang.RuntimeException: Unable to resolve symbol: decorate in this context

16:15 ohpauleez: all of the pieces will be released as 0.3.0 soon and will be in Clojars

16:15 Raynes: &(map (useful.fn/decorate inc -) (range 5))

16:15 lazybot: ⇒ ([0 1 0] [1 2 -1] [2 3 -2] [3 4 -3] [4 5 -4])

16:15 ohpauleez: for some definition of "soon"

16:15 jasonbray: yeah, I've based the code largely off of that and modern-cljs - both have been a huge help

16:16 alv-r-: Raynes: (sorry about taking long to reply) a lot of companies here hire without a degree if you're good too, the problem is that the majority wanna pay you way less cause you don't have a degree :\

16:16 brehaut: TimMc: oh right, by creating an interstitial lazy-seq?

16:16 ohpauleez: jasonbray: Awesome! Once I wrap up the "kitchensink" code on baseline, I'm cutting the release - hopefully I'll get to that this week

16:16 alv-r-: anyway, gtg to class lol :P

16:17 cya

16:17 ohpauleez: jasonbray: If you try baseline, and you still see 404's let me know. Also feel free to ping me with pastes

16:17 jasonbray: ohpauleez: thanks, appreciate it

16:18 TimMc: brehaut: Sorry, I thought that link was an example, but I misremembered. You'd let over two lazy-seq-using fns that share two queues under atoms.

16:18 I think.

16:18 brehaut: ah right

16:21 TimMc: At the center, you'd have some loop that spits elements into the opposing queue until an appropriate element is found.

16:21 I guess you could generalize this to n queues.

16:23 I wonder if mutable queues would be more appropriate there, or immutable queues inside atoms.

16:38 brehaut: Kind of a cute fn I wrote, split-atom!: https://github.com/timmc/handy/blob/v1.3.0/src/org/timmc/handy.clj#L86

16:38 It was very satisfying to write deterministic (a test helper) using that.

16:39 ravster: hello all

16:39 brehaut: TimMc: nice :)

16:39 TimMc: I couldn't figure out how to work juxt into it.

17:22 gfredericks: ,(when-let [nums (map #(apply str % (repeat 10000 \c)) (range)] (first (nth nums 1000000)))

17:22 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

17:22 gfredericks: ,(when-let [nums (map #(apply str % (repeat 10000 \c)) (range))] (first (nth nums 1000000)))

17:22 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>

17:23 gfredericks: I'm getting an OOM error and wondering if (when-let [coll ...] (process-huge-lazy-sequence coll)) constitutes holding on to the head

17:26 &(when-let [nums (map #(apply str % (repeat 100000 \c)) (range))] (first (nth nums 10000)))

17:26 lazybot: Execution Timed Out!

17:27 gfredericks: &(when-let [nums (map #(apply str % (repeat 100000 \c)) (range))] (first (nth nums 1000)))

17:27 lazybot: Execution Timed Out!

17:27 gfredericks: &(when-let [nums (map #(apply str % (repeat 10000 \c)) (range))] (first (nth nums 1000)))

17:27 lazybot: ⇒ \1

17:28 TimMc: gfredericks: The let should clear its locals as soon as that fn call is made.

17:28 gfredericks: that's what I figured :/

17:29 hiredman: but the let doesn't clear the locals until process-huge-lazy-sequence returns

17:30 gfredericks: oh?

17:30 that's basically the opposite of what TimMc says, right?

17:30 does this apply to function args as well? (fn [coll] (process-huge-... coll))?

17:31 I can't figure out an interpretation of this that doesn't make lazy seqs awful

17:31 brehaut: ,@(if-let [nums (map #(apply str % (repeat 10000 \c)) (range))] (delay (first (nth nums 1000000))) (delay nil)) ; hmm?

17:31 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>

17:32 brehaut: O_o

17:34 gfredericks: brehaut: I don't understand clojurebot's behavior there

17:34 that's why I switched to lazybot

17:34 "the thinking man's bot"

17:35 TimMc: gfredericks: The way to check empirically would be to use a WeakReference and calls to System/gc.

17:36 Oh, and I guess some threads.

17:38 Hmm, I'm having trouble coming up with a test, actually.

17:40 hiredman: basically if you force a lazy seq lower in the call stack then you create it, you are asking for trouble

17:41 gfredericks: I cannot figure out what that means

17:41 brehaut: hiredman: i may be having a stupid morning, but isnt that every lazy seq generating function ever?

17:41 gfredericks: I don't even know which direction "lower in the call stack" is :(

17:41 hiredman: if you create a lazy-seq in function X, and function X passes that lazy seq to function Y and function Y passed in to function Z and function Z does a doall on it

17:41 gfredericks: shallower or deeper?

17:42 dorun or only doall?

17:42 hiredman: dorun too

17:42 gfredericks: that sounds like the sort of thing you might want to do often

17:43 hiredman: sure, it only ends up as a problem if the seq in question blows the heap

17:43 the head of the seq is basically held by the activation records of the functions

17:44 I've gotten rid of oomes by going through code that did that and replacing the lazy seq creation with (not memoized in anyway) thunk

17:45 ,@(if-let [nums (map #(apply str % (repeat 10000 \c)) (range))] (delay (first (nth nums 1000000))) (delay nil))

17:45 clojurebot: Execution Timed Out

17:48 gfredericks: hiredman: I would think that even when things are smaller so as not to OOM there'd still be perf implications of holding the head

17:48 hiredman: gfredericks: would way to check it would would be to aot compile the function and look at the bytecode to see when the locals get nil'ed out

17:50 gfredericks: I do that by adding the ns to :aot?

17:51 ravster: how do I pass in variables to a future?

17:51 brehaut: ravster: you close over them

17:52 tyler_: im trying to make a simple macro

17:52 https://www.refheap.com/paste/11804

17:52 whats messed up>

17:52 ?

17:52 brehaut: ,(let [x 1] @(future (+ x 2)))

17:52 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

17:52 ravster: I tried a few variation on bound-fn and I'm getting "unable to resolve symbol" errors

17:52 hiredman: gfredericks: sure

17:53 brehaut: ,(apropos 'future)

17:53 clojurebot: (future-done? future future-call future? future-cancel ...)

17:53 brehaut: ,(apropos 'future-fn)

17:53 clojurebot: ()

17:54 brehaut: tyler_: what is that macro supposed to do?

17:55 ravster: (future-call (bound-fn (fn [] …)))

17:56 tyler_: brehaut: send "open http://i.imgur.com/UmpOi.gif" to the shell its for education use only

17:56 i figured out how to do it as a function

17:56 brehaut: tyler_: why on earth are you trying to use an ns form then?

17:56 tyler_: brehaut: because im a noob?

17:56 brehaut: tyler_: are you explicitly wanting to do macro stuff ?

17:57 tyler_: brehaut: nope i just want it to be a macro, i want to learn me how to do it if its possible, if it is possible

17:57 meh last part of that sentence was redundant

17:58 brehaut: http://www.youtube.com/watch?v=zn0JsGKk2k4&feature=youtube_gdata_player

17:59 brehaut: sharing a repl session as a video? bleark

18:00 tyler_: (good? bleark)

18:00 brehaut: tyler_: i _think_ what you mean to be doing is (defmacro asplode [] (do (require 'clojure.java.shell) (clojure.java.shell/sh …

18:00 tyler_: no. the opposite of good

18:00 tyler_: brehaut: how do you share repl sessions?

18:00 brehaut: you sent me a video. text would have been sufficient

18:01 tyler_: brehaut: it was for entertainment value ;)

18:01 ravster: brehaut: that didn't work. I thought bound-fn needed an empty arg-list after it. Going by the one example on clojuredocs

18:02 brehaut: ravster: oh, my bad. it just wants a tail

18:02 tyler_: brehaut: yay it worked, you're the best :)

18:02 brehaut: (future-call (bound-fn [] …) ; ravstar

18:02 ravster: what is a 'fntail'? I don't see an explanation for that.

18:02 brehaut: ravster: everything from the arglist on

18:03 arohner: what is the best Java 7 JVM for OSX?

18:03 ravster: so after the arglist?

18:03 technomancy: arohner: virtualbox =)

18:03 brehaut: ravster: and the arglist

18:04 ravster: oh

18:04 brehaut: tyler_: its still a terrible way to call a function

18:04 tyler_: brehaut: im not using it for anything srs, you can sleep well tonight

18:05 ravster: should I be putting variables in the arglist for bound-fn? and then the body of it will be able to see them?

18:07 weird. that changed something

18:40 cemerick: any chance someone has written a phantomjs ClojureScript REPL env that pipes evaluations over stdin/out instead of using it with browser-REPL?

18:43 I guess the distance between that and https://github.com/bodil/cljs-noderepl is minimal...

18:44 Bodil: cemerick: Challenge accepted. :)

18:47 cemerick: Bodil: I promise I wasn't trying to troll you ;-)

18:48 noprompt: this will probably raise some suspicions, but is it possible to use multi methods with letfn?

18:49 i'm using clojurescript with angularjs and it would help clean up services

18:49 wasn't sure if there was a way to do that

18:49 * bbloom engages shameless self promotion mode

18:50 bbloom: noprompt: probably easy to wire up with https://github.com/brandonbloom/dispatch-map

18:50 unfortunately, no clojurescript support yet

18:50 noprompt: bbloom: yet again to my rescue

18:50 :)

18:51 and this should be usable from cljs?

18:51 hiredman: noprompt: you can also create a multifn and bind it to a local with something like let

18:51 well not in cljs I guess

18:51 noprompt: hiredman: i was trying to work something like this

18:52 bbloom: noprompt: no, it implements clojure.lang Java interfaces, etc. it's not currently possible to write compatible map types between clj and cljs

18:52 noprompt: boy, this state stuff can get a little gross

18:52 bbloom: noprompt: but i'm gonna want to use dispatch-maps on cljs soon, so it's something i plan to tackle.... eventually....

18:54 noprompt: bbloom: that would be awesome. right now i have this gross defmulti bit going on inside of a defn.

18:55 tommo_: #join libgdx

18:55 oops

18:55 noprompt: has there been any work done on cleaning up angular for use with cljs?

18:55 bbloom: noprompt: it should be pretty easy to port to CLJS, but it's not something i need for a while

18:56 noprompt: i'm building something somewhat angular-like with clojure.... but it's gonna be a while :-) stay tuned!

18:56 noprompt: bbloom: i thought it might be fun to have a leiningen style macro that lets you specify controllers, factories, and their dependencies for angular

18:57 (defapp my-app :controllers [[]] ...)

18:57 that sort of thing

18:57 bbloom: i haven't given much thought to wrapping angular b/c it seemed more important to substitute the hierarchical scopes idea with a persistent tree :-)

18:57 noprompt: using the .. macro is fine for now but it looks like shit

18:59 so how would that look?

19:00 * bbloom does magic hand wave gesture and vanishes in a puff of smoke

19:01 noprompt: heh

19:02 so JNI...

19:09 ohpauleez: A general thanks to everyone who helped me with clojail stuff last week - I have my Clojure Endpoint setup

19:09 :)

19:09 pbostrom: ohpauleez: what does it do exactly?

19:10 Bodil: ohpauleez: Grats :)

19:10 ohpauleez: the same thing as lazybot, but over HTTP as a RESTful service

19:10 pbostrom: nice

19:10 ohpauleez: so I can integrate it across a bunch of things

19:10 and I really wanted core.logic in there

19:10 so that's in there

19:11 pbostrom: I have a similar setup, but it's clojail over websockets, I have yet to really abstract it into a real service though

19:12 Bodil: cemerick: PhantomJS 1.8 lacks an API for stdin, do you mind if compiling HEAD is a requirement until 1.9 is released? :)

19:13 noprompt: PhantomJS <3

19:36 airstrike: anyone familiar with using mock data files with clojure testing?

19:37 technomancy: airstrike: those terms are a bit vague; could you be more specific?

19:39 airstrike: of course. I've got a function which reads a periodically updated file on the system living over in /var/projectname, and I'd like to test it with a mock data file

19:39 so I run lein test projectname.test-subnamespace

19:40 it may be a permissions issue, but I've verified that I have permissions to read and write to the directory and test file

19:41 haven't been able to find much about whether lein test operates with only a subset of the user permissions

19:42 technomancy: no, definitely not

19:42 airstrike: hmm

19:43 I've been drawing a blank on searches for anyone using mock data files instead of mock data defined in-line or generated

19:44 technomancy: airstrike: as long as the target dir isn't hard-coded it should be easy to test

19:45 airstrike: in principal just slurp up the target file contents, although I'm trying to swap in the test data for whatever might be there

19:46 if I'm honest with myself it should probably be re-designed to redefine the target rather than fetching and temporarily storing the target data while it puts test data there

19:46 bbloom: airstrike: you can use `binding or, less preferrably, `with-redefs to provide mock values for definitions

19:46 see ##(doc binding) etc

19:46 lazybot: ⇒ "Macro ([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are ... https://www.refheap.com/paste/11808

19:46 airstrike: yeah. I ought to do that. I'd still like to eventually figure out why I'm getting these permissions issues

20:26 cemerick: Bodil: I suppose not...but maybe just piping things into its REPL is sufficient?

20:31 Bodil: cemerick: That would involve trying to guess what kind of type the output might be... sounds a bit fragile.

20:38 preyalone: How would I defined a macro to transform symbols into strings?

20:39 E.g., I want to implement a die roller along the lines of (shake 2d6) => (3 4)

20:39 Raynes: Meh.

20:40 Why not just use strings, pass a quoted symbol, or use a keyword?

20:40 preyalone: Raynes: I have implemented a die roller for strings: (roll "2d6"). I just want to write a macro that takes symbols instead.

20:42 Ah, name!

20:42 ,(name)

20:42 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$name>

20:44 Raynes: preyalone: That isn't a valid symbol though.

20:44 Well, it's a valid symbol, but the reader won't accept it if you pass it in.

20:44 preyalone: Raynes: Aye sir, because 2d6 begins with a number.

20:44 Raynes: Yessir.

20:44 preyalone: Should I alter the reader?

20:49 TimMc: preyalone: Nope.

20:50 Nothing wrong with strings.

20:50 Raynes: preyalone: God no. Why would you do a thing like that? :p

20:51 preyalone: Hehe, I'm a CL novice and and Clojure newbie... I just expected macro trickery would allow for this.

20:51 Strings are cool, I just wanted to use even less syntax for die rolling.

20:51 rabbit_airstrike: use keywords?

20:51 TimMc: You can't really alter the reader in Clojure like you can in CL.

20:51 ,:2d6

20:51 clojurebot: :2d6

20:51 rabbit_airstrike: (roll 2 :d6)

20:52 TimMc: ,'2d6

20:52 clojurebot: #<NumberFormatException java.lang.NumberFormatException: Invalid number: 2d6>

20:52 preyalone: And save one character? Sure!

20:52 What's the function for transforming keywords into strings?

20:52 TimMc: name

20:52 preyalone: If you're using paredit, it's the same number of keystrokes.

20:52 " 2 d 6 results in "2d6"

20:53 preyalone: TimMc: That assumes all end users are operating in Emacs rather than, say, an ordinary clj repl.

20:53 TimMc: sure

20:53 rabbit_airstrike: although I think it looks cleaner to add a little separation between the quantity and die type anyways

20:54 TimMc: (or operating in some Vim nREPL thingy)

20:54 preyalone: rabbit_airstrike: d or D usually serves this purpose in RPG lingo

20:55 rabbit_airstrike: I know, but if you're interacting with the repl anyways, it doesn't seem like a leap to ask users or programmers to enter (roll 2 :d6)

20:55 preyalone: or even 2 :d 6

20:55 rabbit_airstrike: also sensible

20:56 preyalone: Weird. I can do (roll (name :2d6)) in clj, but when I use my (shake) function defined this way, I get ClassCastException java.lang.Character cannot be cast to java.lang.CharSequence

21:01 ,name

21:01 clojurebot: #<core$name clojure.core$name@13136f3>

21:01 majyk: is there a setting for countclockwise that will make it honor my tab key? I know this is silly and it probably knows best what the indention level should be but it's highly annoying to press tab and it eat it.

21:02 preyalone: Does (name) do any qualification trickery? It doesn't seem to work on keywords when called indirectly.

21:02 majyk: ah crap, just found out what setting it was

21:11 preyalone: I've settled on a minimal syntax for the die roller, via the terminal: ./roll.clj 2d6

21:14 Hey Raynes, I had no idea you were such a big contributor to the Clojure community. Keep it up!

21:15 Raynes: <3!

21:15 preyalone: Is there anything like Learn You a Clojure?

21:16 Raynes: Unfortunately now. I was writing a book to serve a similar purpose a while back but I've postponed it due to life for now. Plan to pick that up in the future, but it doesn't help you right now.

21:17 preyalone: Merf. And Harry Potter and the Methods of Rationality has also stalled :(

21:17 gfredericks: (inc Raynes) ;; because I am using fs and conch a lot lately

21:17 lazybot: ⇒ 21

21:17 clojurebot: Excuse me?

21:18 preyalone: Raynes: In your opinion, what's the best introductory Clojure book out there today?

21:19 gfredericks: is it feasible to write a lein plugin that lets you list some ns requires in your project.clj and have `lein foo-repl` launch a repl into the user ns and execute those requires?

21:19 xeqi: insert plug here for clojurebook.com

21:19 bbloom: gfredericks: you can eval arbitrary code on repl startup

21:20 gfredericks: bbloom: with the current `lein repl` you mean?

21:20 (and how?)

21:20 bbloom: gfredericks: https://github.com/technomancy/leiningen/blob/master/sample.project.clj

21:20 xeqi: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L123

21:21 * gfredericks rs tfm

21:21 bbloom: gfredericks: well i didn't mean to say RTFM, i was aiming to be as helpful as xeqi with the line number on there :-P

21:21 gfredericks: oh I didn't see the line number

21:22 oh sweet you can override :main

21:22 I've been wanting that for a while

21:22 bbloom: so in pointing it out, i succeeded in actually being helpful :-)

21:23 gfredericks: (inc bbloom)

21:23 lazybot: ⇒ 4

21:23 bbloom: (inc xeqi)

21:23 lazybot: ⇒ 6

21:23 gfredericks: your first composite number!

21:23 bbloom: dammit. i only want prime karma!

21:23 * gfredericks assumes bbloom hasn't been dec'd a lot

21:24 xeqi: (inc bbloom) ;;fixed

21:24 lazybot: ⇒ 5

21:25 gfredericks: number-theory related karma inflation

21:25 bbloom: xeqi: haha, thanks, i was hoping somebody would do that to help out my joke

21:25 xeqi: you're so helpful, let's keep the karmic circle jerk going:

21:25 (inc xeqi)

21:25 lazybot: ⇒ 7

21:25 bbloom: now we're both prime!

21:25 gfredericks: twin primes!

21:25 noprompt: twin primes!

21:25 lol

21:25 bbloom: haha

21:25 gfredericks: twin irc statements!

21:25 noprompt: it's a sign!

21:29 has anyone here had to convince someone that using clojure for a new application was a good idea?

21:29 gfredericks: yes.

21:30 noprompt: me and a few friends have an idea for a web app and one of them is a hard core python guy.

21:30 everyone's on board with cli, but i gotta convince this guy.

21:30 any tips?

21:31 he thinks let expressions are dumb...

21:31 i'm in tears :P

21:31 gfredericks: tell him you think assignment is dumb and then walk out in a huff

21:31 noprompt: doesn't understand that immutability is a good thing.

21:31 ha!

21:31 brehaut: noprompt: do a brief sell on the improved reasonability, and if it doesnt take hold, then forget it. you arent going to convince a 'hardcore X' user if they dont want or care to be convinced

21:33 noprompt: brehaut: that's true

21:33 gfredericks: compare mutability to OO's public getters/setters and GOTOs

21:33 noprompt: from what i recall, python distinguishes between statements and expressions

21:33 gfredericks: there's a PLT-Life for that

21:33 noprompt: ha!

21:33 oh yeah

21:34 ivan: tie him down and make him watch Rich Hickey videos

21:34 noprompt: ivan: that might be a good idea

21:34 brehaut: noprompt: ps, https://www.refheap.com/paste/11811 thats why let is not dumb ;)

21:34 noprompt: i'll invite him over for beers

21:34 loosen him up so he's receptive of the reasoning

21:34 AdmiralBumbleBee: getting people tipsy always makes logic work better...

21:35 noprompt: can't tell if thats sarcasm or not

21:35 haha

21:35 AdmiralBumbleBee: maybe you're tipsy now? :P

21:35 noprompt: behaut: what… the?

21:36 gfredericks: brehaut: that error looks totes legit

21:36 brehaut: noprompt: pythons scoping is magically broken

21:36 gfredericks: no wait it doesn't

21:36 somehow I convinced myself x was a third variable there

21:37 AdmiralBumbleBee: brehaut: explain?!

21:38 noprompt: wow

21:38 brehaut: AdmiralBumbleBee: the intent is pretty clear: foo should be closing over x, but because python has implicit variable declaration (and weird scoping modifiers) it has to make best guesses at times. sometimes those guesses are really wrong

21:38 noprompt: i updated it btw

21:39 AdmiralBumbleBee: that is so confusing

21:40 brehaut: if javascript (with strict mode) is clearer than your language of choice in some area, you've got a problem

21:40 AdmiralBumbleBee: it's times like this that I have a euphoric wave roll across me in the acknowledgement that I do not, nor ever intend to, use python

21:40 noprompt: man, that hurts my brain

21:40 +1 to that

21:41 brehaut: incidentally if you want to see the other side of the particular scoping tradeoffs with implicit declarations, check out coffeescript

21:42 noprompt: a common python hack is to use a mutable cell such as a 1 item list

21:44 noprompt: i'm surprised that's a thing though

21:45 i mean i think even php can get that one right

21:45 ivan: in Python 3 you use `nonlocal`

21:46 brehaut: ivan: finally

21:49 ivan: Python 3 improves Python by forcing people to maintain code that works in both 2.x and 3.x along with associated compat.py files

21:49 a never-ending polyglot programming challenge to stretch your brain

21:49 AdmiralBumbleBee: why exactly does it force that?

21:51 ivan: because 2.x is here for a while and 2to3 was too slow, from what I heard

21:54 dcolish: its not necessarily slow, it requires too much human intervention to get right

21:55 brehaut: oh, heres my personal favorite python wat

21:55 https://www.refheap.com/paste/11812

21:55 (never been bitten by it, but its still strange)

21:55 ivan: yeah, I do list(x for x in range(10)) instead

21:55 dcolish: i've seen that used intentionally, that was fixed in python 3

21:56 many languages have/had leaky loop invariants

21:56 brehaut: ivan: yeah i prefer that too

21:57 ivan: >>> False == False is True

21:57 False

21:57 brehaut: haha

21:57 thats a good one

21:58 seangrove: Uhg, korma seems to be rocky around the edges

21:58 ivan: I think my favorite Python wat is the collections.namedtuple implementation

21:58 dcolish: heh

21:59 brehaut: ivan: haha fair

21:59 ivan: technomancy's is statments ;)

22:09 seangrove: Anyone had trouble with Korma's (with/) query and the transform function applied to the results? Doesn't work well on a lazy sequence :P

22:12 How can I tell if I have a lazy seq?

22:13 gfredericks: ,(type (range))

22:13 clojurebot: clojure.lang.LazySeq

22:15 seangrove: gfredericks: Thanks, just wondering if there was something convenient like (integer? ...) or (list? ...), e.g. (lazy? ...)

22:15 gfredericks: $findfn (range) true

22:15 lazybot: java.lang.OutOfMemoryError: Java heap space

22:15 brehaut: seangrove: seq? etc dont distinguish between concrete seqs and lazy seq

22:15 gfredericks: lol

22:15 gfredericks: $findfn (range 1 3) true

22:15 lazybot: []

22:16 gfredericks: wat

22:16 brehaut: ,(seq? (range 1 3)

22:16 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

22:16 brehaut: ,(seq? (range 1 3))

22:16 clojurebot: true

22:16 brehaut: i wish lazybot still fixed those errors

22:16 bbloom: $findfn true (range)

22:16 lazybot: java.lang.OutOfMemoryError: Java heap space

22:16 bbloom: $findfn true (range 1 3)

22:16 lazybot: []

22:16 bbloom: thought maybe you had the arg order wrong...

22:17 *shrug*

22:46 zenoli: Hm...(shutdown-agents) also kills nrepl? :/

23:10 noprompt: this is going about as well as a shit sandwhich

23:38 frozenlock: Still bumping my head on how to an extensible application with plugins. I can load .clj files, but that won't help me if the plugin need a new dependency . :(

23:38 *how to make

23:41 technomancy: hoo boy; python and statements

23:42 nothing says "I have not used very many programming languages" like statements

23:44 frozenlock: technomancy: could you be my dad and explain that? :P

23:44 gfredericks: woah wait we can have #clojure dads?

23:44 ChongLi: apparently so

23:44 gfredericks: this seems like an important decision

23:47 rboyd: is there a macro that takes a list of symbols and returns a map of {:symbol1 symbol1 :symbol2 symbol2 …}?

23:50 frozenlock: rboyd: yes, just a sec...

23:50 https://www.refheap.com/paste/11818

23:51 I new I wasn't crazy when I made this :)

23:51 knew even

23:51 ChongLi: no that's not quite what rboyd asked

23:51 frozenlock: Oh he wants the symbol, not the value o_O

23:52 Raynes: He wants the s.

23:52 rboyd: maybe I asked wrong, this is what I wanted

23:52 ivan: banjara: your client is borked

23:52 rboyd: although I was hoping it was in core

23:53 ChongLi: why would it be in core?

23:53 rboyd: cuz I need it all the time

23:54 I tried clojure.core/mapify-for-rboyd but I got a compiler exception

23:54 shot in the dark

23:57 frozenlock: So, none have succeeded in making extensible (with plugins) clojure applications? Something like step 1: drop a jar in an extension folder, step 2: be happy.

23:57 rboyd: frozenlock: not I, but I'd be pretty interested in that pattern. and thanks for the macro

23:58 frozenlock: rboyd: yeah that be, in techno talk, freakin' awesome.

23:58 alandipert: frozenlock: i think leiningen's plugin system is close to that (creative use of vars under the leiningen ns)

23:59 frozenlock: alandipert: yeah I took a look into that, but that's really the dependency issue that bugs me.

Logging service provided by n01se.net