#clojure log - Feb 21 2014

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

0:08 chare: is there an ubuntu ppa for leiningen

0:16 jgmize: chare why are you looking for a ppa? are the install instructions on http://leiningen.org/ not working for you?

0:40 jairtrejo: Hello! Does anyone know of a Light Table plugin that enables selection inside parenthesis? I'm used to surround.vim and miss it very much.

0:46 chare: jgmize uh so what do I do after i run the script

0:46 it dumps stuff in .lein

0:47 jgmize: I'd probably start with the tutorial: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md

0:48 chare: jgmize where is the lein binary

0:49 jgmize so there is no lein binary to run after install script????

0:49 jgmize: right, the script itself is what you execute

0:50 you just download it, make it executable, put it on your path

1:00 chare: jgmize lein run went to fetch clojure

1:01 where did it put it

1:07 jgmize: chare: you should be able to play with clojure with just "lein repl" and you can learn more about lein itself with "lein help tutorial".

1:14 xuser: chare: somewhere in ~/.m2

1:47 boltR: Leiningen seems like such a big hassle to set up

1:49 systemfault: What? The way it's show on the main website... even someone mentally challenged could install it without much trouble.

1:50 Cr8: boltR: you put the lein script on your PATH and then..

1:50 well

1:50 you're done

1:50 DomKM: boltR: https://github.com/technomancy/leiningen/wiki/Packaging

1:50 dsrx: it's amazing how weak something like LiveReload feels in retrospect now that I can send code right to my browser from the editor with a cljs repl

1:51 systemfault: dsrx: How do you do it?

1:53 dsrx: Just give me a hint... an editor... a plugin... anything :P

1:55 dsrx: if you're using light table already you can do that... otherwise with a standard editor/nrepl setup (like cider for emacs or vim-fireplace for vim), you can use austin for most cases https://github.com/cemerick/austin

1:55 systemfault: Thank you, what do you use personally?

1:56 dsrx: i have sort of an exotic setup that fills something of a niche need of mine (one of the rare cases where austin won't work)

1:57 systemfault: Ah ok, still.. thanks a lot :)

2:41 djcoin: Allow me to post here the question I posted on stackoverflow 2 days ago :) http://stackoverflow.com/questions/21886982/consistency-atomicity-or-even-acid-properties-in-multiple-sql-nosql-databases ; I think it must be a classic set up but I'm struggling to find in-depth analysis of this set up. I guess pragmatic Clojure programmers commonly deals with various set-up/databases, so well, if anyone has some

2:41 insight on this, I would be really nice.

2:41 * it would be really nice

2:41 Thanks! :)

2:47 chare: djcoin if you're using a database with no acid transactions you're just screwed

2:47 so why are you using a non acid database

2:51 djcoin: chare: I'm using one, but I also want to bring other databases in that have very nice features as ElasticSearch, Redis, etc. My point is that we sregularly see this kind of architecture but rarely content on how to keep it consistent

2:52 You are telling me to _just use_ acid (eg: SQL?) and that's all ? Like you will never use any other db ?

2:52 I need more fun :)

2:53 chare: so you want to turn a nonacid database into a acid database

2:53 and add it too a bunch of other acid databases?

2:53 systemfault: djcoin: Even if you use elasticsearch... your "source of truth" will still be your DB...

2:54 If you're really motivated, you could even take a look at more funky BASE architecture like CQRS

2:54 djcoin: chare: no, i'm looking for advices on what's the best mindset, advices, on maintaining a system like this

2:56 If you tell me "ACID only" well that's fine - but If you could provide more details for example as to what issue I will be facing and why it will be damn complex

2:56 Then I will be really grateful

2:57 chare: djcoin if each individual database supported acid transactions it would be possible to use XA distributed transactions (http://en.wikipedia.org/wiki/X/Open_XA) to keep everything consistent assuming each database supported the XA standard.

2:57 djcoin: But I mean, let's take the hypothesis that I only use "ACID" databases but multiple one like say datomic and a NoSQL db

2:57 And attack this subset if a non-acid database is game over from the start

2:58 chare: djcoin suppose you had a postgresql db and a neo4j db, then you could do a distributed transactions on both since they both support XA.

2:59 djcoin: nice chare !

2:59 chare: neo4j is an acid graph db

2:59 so it doesn't have to be sql

2:59 djcoin: Indeed, I wasn't aware that such a standard existed

2:59 Thanks

3:00 chare: at least I "believe" postgres supports XA, never actually tried it

3:16 devn: "reify Fruit", heh

3:37 muhoo: i just did a project where the "database" was just an atom backed by a file. it was a breath of fresh air.

3:38 assoc-in and update-in ftw.

3:41 clgv: muhoo: yeah that works pretty well for small projects

3:41 djcoin: muhoo: was it a transient db, or could you persist/backup it ?

3:42 muhoo: https://github.com/kenrestivo/utilza/blob/master/src/utilza/memdb.clj if you're curious

3:42 lvh: the only difference between assoc-in and update-in is the (let [new (f old)] ...) right?

3:43 muhoo: lvh: update-in takes a function to transform the value, assoc-in just takes the value

3:44 it's like the difference between swap! and reset!

3:44 lvh: gotcha :)

3:45 djcoin: muhoo: thanks!

3:46 muhoo: clgv: yeah, it was fun doing queries with just (->> @db vals (filter ..)) and map etc, but i'm ready at any time to swap it out with a real db like datomic if the queries get really hairy

3:47 djcoin: np, enjoy

3:47 lvh: It is unfortunate that datomic isn't free. I don't mind them getting monies, but it makes it harder for me to convince free/open source projects to use it

3:47 muhoo: it's beer free

3:48 clgv: muhoo: but you only get the cheap local beer and not the good german export ;)

3:49 muhoo: true :-)

3:49 lvh: clgv: Ahem!

3:49 * lvh is Belgian.

3:50 clgv: :P

3:50 djcoin: yeah in this case the local beer is awesome :)

3:51 ro_st: datomic is free. it isn't open source.

4:13 rurumate: I'm looking for a function f so that (= (f [1 2 3]) [[1] [1 2] [1 2 3]])

4:14 edge-ngram style, so not exactly what partition is doing

4:14 lvh: oh, derp, I thought you meant subsets and then I read properly :)

4:14 ssafejava: :) is this a 4clojure problem?

4:15 lvh: so, for [1 2 3 4] it's [[1] [1 2] [1 2 3] [1 2 3 4]]?

4:15 that's pretty easy to do with a reduce, last and into :)

4:15 rurumate: yes

4:17 lvh: rurumate: I don't think there's a function like that ready to use if that is what you are asking

4:23 elfenlaid__: rurumate, well, may be (loop [xs (reverse [1 2 3]) ys []] (if (seq xs) (recur (rest xs) (conj ys (vec xs))) (reverse ys))) would serve as start point

4:24 djcoin: rurumate: (defn x [coll] (reduce #(conj %1 (vec (conj (or (last %1) []) %2))) [] coll) ;; note: i'm not a clojure expert yet!

4:26 (the vec call can be trashed)

4:33 wink: anyone got a clue how to force a postgres nextval() in korma?

4:34 my problem is that I'm using (insert table (values param)) instead of (insert table (fields) {..map..})

4:44 kohyama: ,(#(mapv (fn [i _] (vec (take i %))) (iterate inc 1) %) [1 2 3 4])

4:44 clojurebot: [[1] [1 2] [1 2 3] [1 2 3 4]]

4:48 rurumate: thx kohyama

4:52 kohyama: rurumate: you're welcome.

4:58 rurumate: ,((fn ngrams [x] (mapv #(vec (take (inc %) x)) (range (count x)))) [1 2 3 4])

4:58 clojurebot: [[1] [1 2] [1 2 3] [1 2 3 4]]

5:08 kohyama: rurumate: I prefer to be lazy.

5:09 ,(#(map (fn [i _] (take i %)) (iterate inc 1) %) [1 2 3 4])

5:09 clojurebot: ((1) (1 2) (1 2 3) (1 2 3 4))

5:09 kohyama: ,(take 4 (#(map (fn [i _] (take i %)) (iterate inc 1) %) (iterate inc 1)))

5:09 clojurebot: ((1) (1 2) (1 2 3) (1 2 3 4))

5:09 kohyama: ,((fn [x] (map #(take (inc %) x) (range (count x)))) [1 2 3 4])

5:09 clojurebot: ((1) (1 2) (1 2 3) (1 2 3 4))

5:10 kohyama: but (take 4 ((fn [x] (map #(take (inc %) x) (range (count x)))) (iterate inc 1))) never ends

5:11 tomjack``: dnolen_: I finally looked at Om :)

5:11 thanks for the tutorials

5:16 clgv: rurumate: ,(reductions (fn [_ n] (take n [1 2 3 4])) nil (range 4))

5:17 ,(reductions (fn [v n] (conj v n)) [] [1 2 3 4])

5:17 clojurebot: ([] [1] [1 2] [1 2 3] [1 2 3 4])

5:18 clgv: rurumate: ^^

5:48 silasdavis: what's a nice way to avoid iterating over the list twice in ((juxt filter remove) f coll) ?

5:50 Anderkent: silasdavis: something like (let [{filtered true removed false} (group-by f coll)])

5:51 ,(let [{ft true rm false} (group-by odd? [1 2 3 4 5 6])] [ft rm])

5:51 clojurebot: [[1 3 5] [2 4 6]]

5:51 silasdavis: Anderkent, f does not return a boolean

5:52 Anderkent: right, so (group-by (comp bool f))

5:52 silasdavis: ah good thanks

6:05 sm0ke: is there something like medium.com with private posts?

6:05 offtopic question

6:07 DerGuteMoritz: org-mode

6:07 sm0ke: DerGuteMoritz: umm i would like to share it with other people

6:07 not using emacs

6:08 DerGuteMoritz: org-mode html export then :-)

6:08 AimHere: Share emacs with other people first, thereby reducing the problem to the previously solved one!

6:08 sm0ke: :P

6:08 umm although word docs have comments but they suck

6:09 DerGuteMoritz: oh i would like other to add comments

6:31 certainty: DerGuteMoritz: o/

6:34 DerGuteMoritz: certainty: JAVA!

6:36 certainty: DerGuteMoritz: :)

6:36 DerGuteMoritz: :-D

7:35 arcatan: google docs have comments, too, if you're into inline commenting

7:49 sm0ke: thanks will look into it, but google is evil

8:18 rurumate: ,((fn [[x & xs]] (reductions conj [x] xs)) [1 2 3 4])

8:18 clojurebot: ([1] [1 2] [1 2 3] [1 2 3 4])

8:42 scape_: ,(map #(bit-and 23 (bit-shift-left 1 %)) (range 8))) ;;byte of 23

8:42 clojurebot: (1 2 4 0 16 ...)

8:42 scape_: that's handy

9:13 fredyr: ,(defmacro L->> [& forms] `(fn [x#] (->> x# ~@forms)))

9:13 clojurebot: #'sandbox/L->>

9:13 fredyr: ,(map (L->> (bit-shift-left 1) (bit-and 23)) (range 8))

9:13 clojurebot: (1 2 4 0 16 ...)

9:15 scape_: ,(map (comp not zero?)(map #(bit-and 23 (bit-shift-left 1 %)) (range 8)))) ;;byte of 23

9:15 clojurebot: (true true true false true ...)

9:20 hyPiRion: in this case, `(comp not zero?)` could be replaced with `pos?`

9:21 scape_: oh that's good, didn't know about that

9:31 rurumate: is there also a shorter way to write (comp not neg?) ?

9:32 hyPiRion: #(<= 0 %) ?

9:33 rob3: hyPiRion: is that your poker face

9:33 hyPiRion: (some-fn pos? zero?)

9:33 rob3: hah, not far off

9:33 rob3: :)

9:44 mdrogalis: Is anyone here using Storm with Clojure > 1.4.0?

10:10 sm0ke: mdrogalis: i think storm needs to be upgraded

10:11 i tried once, didnt work

10:12 i think thats obvious, are you asking if anyone upgraded it?

10:13 storm is like duke nukem forever

10:13 specially the zmq part, its ancient!

10:15 * frphank is watching http://www.infoq.com/presentations/An-Introduction-to-Clojure-Time-Model

10:23 simonh: hi - has anyone got any experience of connecting to a nrepl server running on vagrant with cider on the host machine? I'm forwarding the port but getting a connection error:

10:23 Connecting to nREPL on 127.0.0.1:9898...

10:23 nREPL connection closed: connection broken by remote peer

10:23

10:23 error in process sentinel: if: Wrong type argument: stringp, nil

10:23 error in process sentinel: Wrong type argument: stringp, nil

11:00 wink: anyone using korma with postgres? any clue how I can insert when I'd write nextval() in pure sql?

11:14 mskou72: Being used to Python, the functional way of working with 2-4 leves deep maps and vectors seems tricky. I'm using map/filter/update-in and a lot of small functions. Is there a library making this sort of work easier?

11:15 hyPiRion: mskou72: perhaps flatland's useful

11:15 $google flatland useful github

11:15 lazybot: [thinkpixellab/flatland · GitHub] https://github.com/thinkpixellab/flatland

11:15 hyPiRion: well, that wasn't the right one

11:16 https://github.com/amalloy/useful

11:20 TravisD: why is it called flatland?

11:20 mskou72: not the right one, but funny. Ok thanks for the link, will check it out.

11:20 technomancy: because it's a romance in many dimensions

11:20 TravisD: heh

11:21 devn: (inc technomancy)

11:21 lazybot: ⇒ 98

11:21 devn: lol

11:22 cgriego: If Regular Clojure/West Registration ends today, is there a higher rate or do ticket sales just stop?

11:24 TimMc: technomancy: Holy cow, your number of karma points since lazybot's last karma database purge has almost reached a new number of digits when represented in a base system whose base is equal to the number of fingers on my hands!

11:24 This calls for a celebration.

11:25 technomancy: I'll break out the romulan ale

11:26 for some reason that really sounds like as smbc strip

11:28 famous34627: Please like this video, regarding humanitarian purposes for little girl who need new heart... https://www.youtube.com/watch?v=E2t0HX3hNys

11:40 craigbro: earthlings

11:40 when writing a defrecord, I would like to have my methods call other methods in the same protocol, but I get fail

11:41 can I just declare the symbols in the local namespace?

11:47 pbostrom: craigbro: the defrecord is in a different namespace than the protocol?

11:48 craigbro: yes

11:48 shep-werk: craigbro: Something like this works for me https://gist.github.com/shepmaster/9137965

11:48 oh, multiple ns...

11:49 noprompt: dnolen_: got the basic generic inspection component working. https://github.com/noprompt/ankha

11:49 dnolen_: based some of the code off of work stuartsierra did a couple years ago.

11:52 pbostrom: craigbro: you should be able to refer to the protocol's symbols like any other fn from that namespace: proto-ns/proto-sym, or am I misunderstanding

11:52 noprompt: dnolen_: there's an example of what it looks like `lein with-profile build cljsbuild once a`.

11:52 dnolen_: any feedback would be welcome.

12:07 pbostrom: craigbro: https://gist.github.com/pbostrom/9138456

12:08 craigbro: thanks pbostrom, I think I may have confused myself in REPL hell yesterday. that seems the obvious solution

12:08 shep-werk: pbostrom: I like your example code ^_^

12:08 pbostrom: np, I actually got hung up on that trying to reify a protocol a few weeks ago

12:11 hyPiRion: oh ey, is there a reason why Cons doesn't allow pop and peek, but allows conj?

12:11 craigbro: hmm

12:12 I "use" the namespace with the protocl

12:12 however, just discovered that if I fully name the symbol.. it works

12:12 I think befoe I was doing soething stupid like

12:12 ns.it.is.in.Protocol/method

12:13 query raro

12:13 err.. que raro…

12:13 noprompt: craigbro: fyi avoid :use or (:require [x :refer :all])

12:13 dnolen_: noprompt: sweet! will give it a look!

12:13 craigbro: it won't resolve the short symbol, even tho I "use" the namespace

12:14 noprompt: yah, heard that advice….

12:14 noprompt: what is the rational?

12:14 noprompt: dnolen_: it needs a bit of refactoring/cleaning up.

12:14 craigbro: I control both namespaces in this case

12:14 noprompt: craigbro: you lose sight of where things are coming from.

12:16 craigbro: even if you control the namespaces, it's still a good habit to form. but i suppose if you're just banging around it's not a big deal.

12:16 craigbro: Turns out that in the actual code in question (not my scratch) that I use require refer...

12:20 derptastic — it works exactly as it should, I was just confused by too many hours of hacking yesterday

12:24 jcromartie: why should .lein-classpath be ignored by source control?

12:25 hyPiRion: jcromartie: because it's autogenerated by lein

12:25 jcromartie: oh I see, I have a /.lein-* in my .gitignore

12:26 jarjar_p_: if I have a lazyseq that contains a hash, how do i get the hash out of the lazy seq to find the key?

12:27 dnolen_: noprompt: ankha is a fantastic start!

12:30 noprompt: dnolen_: awesome! thanks! were you able to see the example?

12:30 dnolen_: noprompt: yep

12:31 noprompt: dnolen_: nice, any tips in the code or does it look about right?

12:33 dnolen_: noprompt: skimming it looks pretty good to me, I definitely have some use cases for this in mind so I will get back to you or send you pull requests if I have any good changes in mind.

12:33 heath: would someone upload the video to this talk? http://www.infoq.com/presentations/clojure-core-async

12:33 it was available just a couple of weeks ago

12:33 dnolen_: noprompt: it's already great as a simple EDN viewer

12:34 noprompt: somebody should wire this up into an EDN Chrome Extension :)

12:34 noprompt: dnolen_: next steps. :)

12:37 michaniskin: does anyone know of a list of html meta tags that can't be installed into the document after the html source is parsed by the browser? for example <meta charset="utf-8"> can't be created via clojurescript because the charset has already been set

12:38 noprompt: dnolen_: i think it might be worth exposing a simple protocol as well. with a few lines of code you could create a generic dom inspector.

12:38 dnolen_: noprompt: yes

12:39 noprompt: the first thing I want to hook this up to is an editable

12:39 so you can manipulate an Om component via direct interaction

12:39 TimMc: michaniskin: Any of the http-equiv forms.

12:39 noprompt: dnolen_: oh that would be awesome.

12:40 michaniskin: TimMc: thanks!

12:40 Anderkent: dnolen_: noprompt: link? sounds interesting

12:41 nevermind, found it

12:41 wasn't on google, for some reason!

12:41 TimMc: michaniskin: I would assume any meta tag is irrelevant after the HTML is received. There might be a few exceptions, though.

12:42 michaniskin: TimMc: fwiw http-equiv="Refresh" seems to work okay

12:42 actually let me qualify that: it works in _chrome_

12:43 testing all the permutations in all the browsers is not feasible

12:43 noprompt: Anderkent: https://github.com/noprompt/ankha

12:44 Anderkent: haven't pushed to clojars yet. but you could clone the repo and build the example w/ `lein with-profile build cljsbuild once a`.

12:45 Anderkent: noprompt: cheers.

12:46 TimMc: michaniskin: Fascinating.

12:51 jcromartie: can I easily call another Leiningen task from my custom task?

12:51 wait, of course

12:56 very nice! the result of leiningen.uberjar/uberjar is the path to the created Jarfile

12:57 technomancy: functions: they're what's for dinner

12:58 noprompt: technomancy: i've had that thought man times.

13:01 bmuk: Does anyone have any experience with stevedore? I found this article http://hugoduncan.org/post/shell_scripting_in_clojure_with_pallet/ which seems to suggest you can execute commands like they are native functions, but the documentation makes you wrap all commands in a string.

13:03 arcatan: my very remote recall is that it originally was like native functions, but it was later changed to be strings only

13:04 bmuk: That's too bad. I was really intrigued by it.

13:09 hugod: bmuk: symbols in function position are resolved if they are not strings, so you can write script returning functions

13:10 bmuk: pallet has a library of these in its pallet.script.lib ns

13:40 pczaj: ,(+ 1 2)

13:40 clojurebot: 3

13:44 tomjack: can I use data readers in a test .clj file without data_readers.clj?

13:44 and without putting it in a string in the test file..

14:15 amalloy: tomjack: (binding [*data-readers* x] ...)?

14:16 tomjack: (binding [*data-readers* {'foo #'foo}] #foo 42) ?

14:17 "No reader function for tag foo"

14:18 amalloy: tomjack: no, you can't do that

14:18 tomjack: ah

14:18 (set! *data-readers* {'foo #'foo})

14:18 yes, hence my question :)

14:18 amalloy: (binding [*data-readers* {'foo #'foo}] (read-string "#foo 42"))

14:18 tomjack: didn't I say "without putting it in a string" ?

14:19 amalloy: you did, but i didn't understand what you meant

14:19 tomjack: sorry :)

14:19 hmm, alter-var-root assoc? :/

14:20 amalloy: i don't understand your goal here

14:20 tomjack: hmm

14:20 when I thought about describing it, I realized it's stupid :)

14:21 I was thinking of having many auto-generated data readers

14:21 and I didn't want to put them in data_readers.clj really..

14:21 it would be nice if I could just have one data reader that can be used for all of these cases

14:21 then I can put that in data_readers.clj

14:22 basically my goal is "data readers for protobufs"

14:25 technomancy: erhm; aren't data readers limited to string input?

14:25 tomjack: other way around

14:25 amalloy: you want #my/proto {:x 1} to read as a Protobuf object?

14:26 tomjack: I'm considering it

14:26 anyway

14:26 technomancy: ah

14:26 amalloy: that's like...a disaster. just write (my/proto {:x 1}). there's no reason for the reader to do it

14:26 tomjack: right

14:26 amalloy: the compiler wouldn't know what to do with the resulting form anyway

14:27 tomjack: oh, hmm

14:33 you mean AOT?

14:34 the place I actually wanted them was in .edn files

14:34 stuartsierra: If you're reading EDN files, you can pass a map of data reader functions to edn/read.

14:34 tomjack: right

14:35 then I was like "ooh tests" for no good reason :)

14:35 because I've been writing tests with protobuf in Java

14:35 :(

14:36 sdegutis: I'm trying to get away from running `lein server` in production, but there's a problem with nREPL: once you connect via `lein repl :connect 8181`, you can't kill the web server itself via Ctrl-C.

14:37 Any idea what could be causing that?

14:37 ToBeReplaced: on a type-hinting rampage... is there a way to type-hint the return type of a protocol method?

14:38 jcromartie: sdegutis: you mean 'lein ring serve'?

14:38 sdegutis: "lein ring server-headless"

14:39 Yep.

14:39 jcromartie: why are you trying to get away from it?

14:39 amalloy: ToBeReplaced: you could try using alter-meta! on the var that the protocol method produces, but i think that var gets mangled when new implementations are added

14:39 jcromartie: (I can think of a few reasons)

14:39 sdegutis: jcromartie: ideally we'd compile the uberjar locally and then deploy just the jar to production and run that by itself

14:39 jcromartie: yes

14:39 a -main function will do nicely there

14:40 tomjack: when I read the tagged literals I was actually thinking of, I actually can't return a protobuf message

14:40 sdegutis: First of all we don't want source code in production. Secondly it uses less memory and we don't have to worry about lein trampoline.

14:40 jcromartie: yes

14:40 tomjack: because there can be a symbols in any field value

14:40 ptcek: Is it possible to get quoted form from a function (I would like the function to call the form but extract the form during test for comparison and avoid databases, etc...). Does it even make sense?

14:41 jcromartie: sdegutis: so, you should have a "main" namespace that takes care of starting the standalone server

14:41 amalloy: ptcek: not with ordinary functions, but see technomancy/serializable-fn

14:41 tomjack: but with clojure.edn I can bind readers for those tags which accept symbols, performing .proto validation but not returning protobufs

14:41 sdegutis: jcromartie: that's already taken care of with `lein ring uberjar`

14:41 tomjack: hmm..

14:42 jcromartie: OK so, the problem is that if you have ever connected to the remote nREPL, you can't kill the server process?

14:43 sdegutis: Yep.

14:45 technomancy: sdegutis: why don't you want source in production?

14:45 mklappstuhl__: how can I dynamicise the "abc" part of a regex like #"^abc"

14:45 sdegutis: You can try it locally. Spin up a simple lein ring app, do `(defonce nrepl-server (start-server :port 8181))`, connect to it as mentioned earlier, then try killing the server with Ctrl-C.

14:46 jcromartie: sdegutis: checking it out now

14:46 SegFaultAX: mklappstuhl__: What do you mean?

14:46 sdegutis: technomancy: Heh you've got a good sense of humours.

14:46 joegallo: mklappstuhl__: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/re-pattern

14:46 technomancy: sdegutis: phlegmatic humours?

14:46 joegallo: (re-pattern (str "^" abc-like-things))

14:46 sdegutis: The cardinal humors, so maybe.

14:47 mklappstuhl__: joegallo thanks!

14:47 jcromartie: sdegutis: I can quit with Ctrl-D

14:47 sdegutis: That may be cheating sir.

14:47 jcromartie: but that's from starting the nREPL server via "lein repl"

14:47 sdegutis: Oh no, not quit the repl.

14:47 The server process itself, which you run with `lein ring server-headless`

14:47 technomancy: sdegutis: does it happen with other nrepl clients, or just lein's?

14:48 sdegutis: Only tried it with lein. May try it with nrepl.el soon.

14:48 technomancy: something to check

14:48 jcromartie: sdegutis: I can Ctrl-C with "lein run"

14:49 still not your use case though right?

14:49 sdegutis: Let me reproduce it as a repo.

14:51 ptcek: amalloy: do not understand anything from the 26 lines of code but seems it will do the job. Thanks!

14:51 jcromartie: I so very much like the fact that I can run a web server by adding lein-ring and defining a single function, though

14:52 I can kill it with "lein ring server" too

14:52 technomancy: ptcek: it relies on an (I think) undocumented feature of defmacro, the implicit &env argument

14:52 need to search the mailing list for how that works I think

14:52 jcromartie: sdegutis: why are you trying to kill it with Ctrl-C anyway? you should be starting up your headless server, writing the pid, and then killing the pid

14:52 e.g. with an init scrit

14:52 script

14:53 sdegutis: jcromartie: in production we will, but when developing we use sigint

14:53 technomancy: why use an uberjar in dev though?

14:53 sdegutis: we use `lein ring server-headless` in dev

14:53 `lein ring uberjar` for deploying to production

14:54 technomancy: hm... I guess that's a thing you can do

14:54 not sure what the appeal is though

14:54 jcromartie: technomancy: the appeal of a uberjar?

14:54 technomancy: jcromartie: no, the appeal of embedded nrepl during dev

14:54 vs lein repl

14:55 sdegutis: technomancy: oh no, i plan to just use lein repl locally

14:55 jcromartie: ah yes

14:55 sdegutis: but when you start the ubarjar, this happens.

14:55 sorry, theres a lot of variables. its hard to remember which ones are affecting it

14:55 jcromartie: sdegutis: I'm not seeing it in any case

14:56 sdegutis: starting the nrepl server and a ring handler, connecting, and Ctrl-C kills it

14:59 I'm having some real revelations here though… I can use lein-ring and alter my handler var root!?

15:06 sdegutis: Steps: https://github.com/sdegutis/testcase

15:07 Clone that repo and follow the steps to reproduce the bug.

15:07 Haven't figured out who's bug it is yet so I haven't filed an issue yet.

15:07 Trying it in nrepl.el now.

15:08 Confirmed: it does *not* happen with nrepl.el!

15:10 Could be REPLy, trying now.

15:13 borkdude: Is this expected behavior? https://www.refheap.com/44271

15:13 I mean, the dynamic var is bound to the root var inside map?

15:13 root value

15:14 *inside the function executed by map

15:15 argh probably lazyness again

15:16 yup, that's it

15:18 jcromartie: sdegutis: yeah it's definitely something about lein ring uberjar

15:20 But I'm kinda warming up to lein ring

15:21 akurilin: Note to self: don't place authorization middleware outside of compojure route matchers or you'll hit the authz logic on every matching attempt, derp.

15:21 grzm: often clojure projects have foo-project/sub/core.clj, foo-project/sub/bar.clj . Is there a reason to have a core.clj (sub/core.clj) rather than sub.clj?

15:22 amalloy: grzm: single-segment namespaces cause issues

15:23 foo/core.clj is a workaround; you should try to work around it "better", by using a meaningful two+ segment namespace like mylib.server

15:23 sdegutis: jcromartie: I don't think it is about lein ring ubarjar.

15:23 Because the bug doesn't happen with an uberjar when I use nrepl.el to connect. Only when I use lein repl.

15:23 So it's either lein repl, or reply.

15:24 Trying to use REPLy now to reproduce.

15:25 grzm: amalloy: so foo/bar.clj and foo/bar/baz.clj fine, just not foo.clj

15:25 amalloy: yes

15:25 grzm: gotcha.

15:26 jcromartie: sdegutis: but it doesn't happen with "lein ring server", which leads me to believe it's something with the generated main class

15:26 amalloy: and all this is under src/, of course

15:27 grzm: amalloy: right. I don't think I would have tried a single-segment namespace (I specifically was thinking about subdirectories and naming files with the same name), but it's a good piece of info to know.

15:27 sdegutis: Aha, it is REPLy. Just reproduced.

15:33 Updated the repro repo.

15:53 jcromartie: hm

15:53 never mind

15:53 :P

16:08 AeroNotix: What sucks about clojure?

16:09 technomancy: AeroNotix: good question. I've collected a few things here: https://raw.github.com/technomancy/dotfiles/master/.gripes.org

16:09 cemerick also gave a talk on this a year or two ago

16:09 AeroNotix: technomancy: currently loading that talk!

16:09 :)

16:09 arcatan: "nil is everywhere and causes bugs that are difficult to find the source" +1

16:10 AeroNotix: technomancy: this is such an amazing idea for a list, I will start one of these myself.

16:10 technomancy: AeroNotix: I got the idea from twb in #emacs, who is a world-class curmudgeon

16:10 http://www.cyber.com.au/~twb/doc/grumbling.txt

16:10 AeroNotix: :)

16:11 wait a sec, I know twb

16:11 Small world

16:11 technomancy: «Sometimes when I declare "<technology> is shit!" an enquiring mind asks "how so?". Due to my porous memory and appalling command of rhetoric, my answer is rarely articulate, let alone convincing. The purpose of this document is to preserve and refine the rationales behind my hatred, and thereby lend it credibility.»

16:12 scape_: haha

16:12 hyPiRion: I am not going to write such a list. I'll just be depressed over the whole software industry and change profession.

16:12 technomancy: hyPiRion: well, having a list that's actually comprehensive is kind of cathartic

16:12 jcromartie: help me out here folks: what part of speech is "compute"? and how does it end up being used like "compute cloud" or "compute engine"

16:13 AeroNotix: technomancy: in polish you can prefix things with "Sr" to make it kind of like the americanism "Something Schmomthing" to disregard something as bad. At the office when something breaks, we just say "srotfware" in a dejected tone.

16:13 "sroftware"*

16:13 technomancy: hehe; sounds useful

16:13 jcromartie: if compute is a noun like gasoline ("gasoline engine" or "gasoline cloud" make sense) then I should be able to say "I have a lot of compute" or "I need to get some compute"

16:13 because I can say "I have a lot of gasoline"

16:14 AeroNotix: jcromartie: compute is a verb

16:14 dkinzer: nice links

16:15 hyPiRion: jcromartie: "compute engine" is a command to an engine, same for "compute cloud"

16:15 jcromartie: AeroNotix: yes it is defined as a verb, but this is a new use

16:15 hyPiRion: ,(recur) ;; compute clojurebot

16:15 AeroNotix: jcromartie: which use where?

16:15 clojurebot: Execution Timed Out

16:15 hyPiRion: It just lacks a comma, and a period.

16:17 AeroNotix: technomancy: I'm a professional Erlang dev if you ever want to pick a fight

16:17 Reading through your points now

16:17 technomancy: AeroNotix: please show me how I'm wrong =)

16:17 aperiodic: jcromartie: english is weird, basically. english loves verbing nouns, but recently it's started nouning verbs (see "a ride", "a smoke", "a read")

16:17 AeroNotix: re: no automated tool for record upgrades. Records are just kind of like proplists with compiler magic.

16:18 so there's no "type" at runtime which can allow you to properly introspect the records.

16:18 jcromartie: aperiodic: I guess I also see "bake shop" and I've heard "camp trip"

16:18 technomancy: AeroNotix: sure, except you can inspect the definition and describe the change you need in order ot create matches against the old and new tuples

16:18 jcromartie: I find that really unnatural

16:19 AeroNotix: technomancy: Kind of like a diff? Yeah, well in practice the idea is to just have versioned records if this is a problem.

16:19 aperiodic: jcromartie: those are both new on me. "camp trip" sounds very wrong; I would say "camping trip"

16:19 AeroNotix: technomancy: also R17 is bringing real maps, finally.

16:19 also, re: No way to enter a module. This is seriously a problem

16:19 scape_: jcromartie: that might be because people like to shorten things

16:19 AeroNotix: (from the repl)

16:19 technomancy: AeroNotix: yeah, working with anonymous funs only is tedious =\

16:20 AeroNotix: technomancy: also that's fixed in R17

16:20 :)

16:20 you can now name funs in the shell

16:20 technomancy: whaaaaaat!

16:20 AeroNotix: seriously!

16:20 technomancy: oh

16:20 yeah, ok

16:20 but you still can't enter a module

16:20 AeroNotix: No, no you can't.

16:20 technomancy: that's the real problem

16:20 anonymous funs are just a symptom

16:20 AeroNotix: Yeah, it really is. Many times I have to recompile a module with -compile(export_all).

16:20 just to get access to functions

16:21 technomancy: I really like how erlang maps have the notion of distinguishing between updating a field and adding one <3

16:21 AeroNotix: (in-ns 'whatever) is my goto tool for debugging broken stuffs

16:21 technomancy: and having no nil is *awesome*

16:21 hyPiRion: technomancy: yeah, they've been smart

16:21 technomancy: hyPiRion: still no update-in

16:21 it's less tedious to not have update-in when you have pattern matches, but it still bugs me. very little HOF usage in erlang =(

16:22 AeroNotix: dialyzer... ah dialyzer. People say it's helpful but it's really just a masturbatory feel good tool. It catches only the glaringly obvious bugs* and misses extremely obvious cases.

16:22 technomancy: AeroNotix: well I haven't actually got it to successfully run on our codebase yet =(

16:22 our codebase causes it to go into an infinite loop

16:23 AeroNotix: We have a very, very large Erlang code base and I've never seen it catch anything which unit tests wouldn't immediately catch.

16:23 technomancy: really? Never seen that happen

16:23 aperiodic: /part/go dork

16:23 AeroNotix: technomancy: do you have a .plt already built?

16:23 technomancy: AeroNotix: yep, confirmed as a bug with the dializer maintainer

16:23 AeroNotix: some people confuse building a plt with it getting caught in a loop, since it's a very lengthy process

16:23 ohhh ok, very interesting technomancy

16:23 technomancy: no, I let it run overnight =)

16:23 AeroNotix: Ouch!

16:24 technomancy: was it kostis?

16:24 technomancy: I think so

16:24 still, I'd take "misses things" over "won't run on un-annotated code"

16:24 AeroNotix: technomancy: no, it genuinely misses things even on annotated. I'll try to find an example.

16:25 How does typed clojure compare to Dialyzer?

16:25 hyPiRion: AeroNotix: I usually prefer to create property-based tests with PropEr instead of using dialyzer. Mostly because I feel PropEr describes more in less space.

16:25 AeroNotix: hyPiRion: this

16:25 PropEr is seriously good stuff

16:25 and the proper_statem? All over that

16:26 hyPiRion: hehe

16:26 technomancy: AeroNotix: typed clojure won't do anything without annotations iiuc

16:26 AeroNotix: _so_good_

16:26 technomancy: without annotations or without GOOD annotations? Does it work on just the annotations or does it try to figure some additional stuff out?

16:26 Dialyzer does both (starting with annotations and doing some deduction on its own)

16:26 technomancy: AeroNotix: my understanding is it only does inference on locals

16:27 no inference crossing defn boundaries

16:27 AeroNotix: Hmm, I will have to check it out some time

16:27 technomancy: which is why I haven't looked into it much

16:27 apart from not doing a lot of clojure in general

16:27 AeroNotix: technomancy: seriously?

16:27 I thought you were writing Clojure @ heroku

16:28 technomancy: not really; just a bit of lein maintenance here and there

16:28 AeroNotix: I and the rest of the (ex-rebar users!!) are very happy about lein

16:28 xuser: technomancy: mostly java?

16:29 AeroNotix: Lein is a million times better than rebar. It makes rebar look like Fischer Price my first dependency management tool

16:29 technomancy: xuser: haha, no. erlang.

16:29 AeroNotix: technomancy: erlang @ heroku????

16:29 technomancy: there is one small clojure codebase still in production, but I'm not even on that team any more

16:29 AeroNotix: since the beginning

16:29 AeroNotix: technomancy: oh I didn't know that

16:29 technomancy: https://github.com/heroku/logplex and the HTTP router

16:29 (but I don't work on the latter)

16:30 AeroNotix: technomancy: in fact I read that blog. What an incredible write up!

16:30 I'm interested really in what you think moving from clojure->Erlang

16:30 because Erlang->Clojure is like OMFG WOW

16:31 technomancy: ^

16:31 technomancy: AeroNotix: https://news.ycombinator.com/item?id=7278018 <- short thoughts

16:32 sdegutis: I'm surprised to hear that Heroku is using mostly Erlang.

16:32 AeroNotix: Erlang is a bad FP language, it has bad tooling, as a language it's downright awful. But as a system and for people who have the kinds of problems Erlang solves, then it's amazing.

16:32 sdegutis: I'd have guessed Ruby/Rails for front-end and Scala for back-end.

16:32 AeroNotix: sdegutis: seriously

16:32 sdegutis: Not that I think that's a good choice of tools, just that it seems to be pretty popular with large websites.

16:33 Personally I think Ruby, Rails, and Scala are all gross.

16:33 AeroNotix: I guarantee what the company I work for is larger than what they're doing

16:33 technomancy: sdegutis: "mostly"?

16:33 AeroNotix: and we're using primarily Erlang with a small part in Clojure

16:33 technomancy: sdegutis: there are only 6 of us out of ~120

16:34 sdegutis: technomancy: Oh then I misinterpreted that last thing.

16:34 hyPiRion: I though Heroku used a bit of Go

16:34 technomancy: hyPiRion: yeah =\

16:34 hyPiRion: Which I know technomancy loves so dearly.

16:34 * hyPiRion runs away

16:34 xuser: whatsapp is a good example of using of erlang, is there anything they had use? I don't think so

16:34 sdegutis: Oh but Go is great!

16:34 You have first-class functions!

16:34 xuser: *better

16:34 technomancy: still a lot more erlang than go right now

16:34 AeroNotix: xuser: what was your question

16:35 technomancy: AeroNotix: pretty much full ack on your assessment ("bad FP language, but amazing for certain problems")

16:35 xuser: AeroNotix: if there is anything better whatsapp could have used

16:35 AeroNotix: technomancy: 10 4

16:35 technomancy: http://thisotplife.tumblr.com/post/66878750907/when-i-discovered-everything-is-traceable-in-erlang

16:35 sdegutis: Also you have complete compile-time safety with Go!

16:35 And concurrency!

16:36 Not to mention a lack of inheritance, which is a good thing!

16:36 AeroNotix: xuser: well, not really. The goto use-case for Erlang is a distributed chat server.

16:36 xuser: also, my friend works for them. It's just ejabberd really.

16:36 (Obviously a bit more than that, but essentially.)

16:36 hyPiRion: sdegutis: you have inheritance actually

16:37 AeroNotix: hyPiRion: you have composition

16:37 sdegutis: Nope, you have embedding.

16:37 AeroNotix: composition/embedding, same difference

16:37 sdegutis: I was responding to hyPiRion.

16:37 technomancy: we have a lot of fun on the erlang team making fun of google go at work

16:37 sdegutis: !!

16:37 AeroNotix: lol

16:37 sdegutis: What's there to make fn of?

16:37 AeroNotix: Go's a great replacement for Python, though

16:38 equally shitty package management, equally shitty typesystem, but HEY no GIL

16:38 xuser: AeroNotix: how many languages do you know? ;)

16:38 AeroNotix: Dunno

16:38 Well?

16:38 Probably 8 quite well

16:39 sdegutis: AeroNotix: Is C++ in that list?

16:39 AeroNotix: sdegutis: I don't think C++ is in anyone's "Know quite well" list

16:39 sdegutis: Hint: don't answer, it's flamebait.

16:39 :)

16:39 hyPiRion: (inc AeroNotix)

16:39 lazybot: ⇒ 2

16:40 sdegutis: Go is fine, what's wrong with it? It's pretty good for what it aims to do.

16:40 You have a simple but powerful type system, a simple but powerful compiler toolchain, a simple but powerful syntax.

16:41 A simple but powerful standard library, a simple but powerful garbage collector.

16:41 technomancy: the type system might have qualified as powerful in the 70s

16:41 hyPiRion: the GC is not powerful, trust me on that. I've had issues with it for quite some time =/

16:41 sdegutis: A simple but powerful concurrency model.

16:41 xuser: no generics

16:41 sdegutis: Go is very simple but powerful.

16:42 Let me be clear: I'm really just making fun of that empty and overused phrase "simple but powerful".

16:42 xuser: Go is a half implementation of Java but less verbose :D

16:42 sdegutis: Especially when Go users use it. Or Rubyists or Python.

16:42 Or Clojurians!

16:42 hyPiRion: sdegutis: Only Clojurians know the definition of simple though.

16:42 sdegutis: (lol jk, clojurians are the best!)

16:43 xuser: and it starts up faster!

16:43 amalloy: &((promise)) is not a very useful error message at all

16:43 lazybot: java.lang.AbstractMethodError

16:43 sdegutis: See? Simple!

16:43 (but powerful, too)

16:44 xuser: sdegutis: the small java programs I have write start up very faste, clojure on the hand...

16:44 *other

16:44 sdegutis: Yes, Clojure isn't fast, but it's simple, yet powerful.

16:44 aaelony: Hi all, I'm wrapping my head around pulling data from surveymonkey via oauth2. Specifically, I'm looking at https://github.com/ddellacosta/friend-oauth2-examples/tree/master/src/friend_oauth2_examples and seeing how it would work for surveymonkey. Has anyone done this?

16:44 sdegutis: I mean, it is fast, but it doesn't start up fast.

16:45 xuser: is the Clojure team working on startup time or are they waiting for Java 9?

16:45 (project jigsaw)

16:45 sdegutis: Ah, yes, Java 9: simple, yet powerful.

16:45 technomancy: it's funny how the startup time of the JVM improved since it got bought by a company that no longer sells big-iron server hardware

16:47 jonh: i thought it was more related to a company that has money to invest in it

16:48 technomancy: I don't think the size of the team changed drastically

16:48 sdegutis: Now what I want is a language where I can mutate the state of an object just by inspecting it: i.e. heisenstate.

16:48 That would be epic.

16:48 technomancy: sdegutis: but the state has to degrade over time oo

16:49 too

16:49 entropy and all

16:49 sdegutis: Imagine if you could just query a simple property such as "system.isUp();" and if it returns false, it'll also restart the system in the background!

16:49 Then all you'd need to do is ask `system.isUp();` all the time, you'd never need to write such methods as `system.restart()` etc.

16:49 How simple! How powerful!

16:50 xuser: such wow

16:50 technomancy: sdegutis: you need to use interrobang for those names

16:50 destructive predicates

16:50 delluminatus: sdegutis: sounds like something someone would have done at my workplace

16:50 and then never told anybody about the side effect

16:51 sdegutis: Oh! Even better: all you'd have to do is hook up that function call to a web request, so that when you hit https://production:3000/is-system-up, it'll restart it for you if need be! Then all you have to do is bookmark that page and check it every day, which will not only tell you if the system is up, but restart it if it's not!

16:51 Ruby: system.isUp!?

16:52 technomancy: oh come on, don't do it half-assed

16:52 is-up‽

16:52 sdegutis: <<<<3333

16:52 Oh yeah! Go allows UTF8 symbols in the source code, so that would be valid!

16:53 Oh sorry, not symbols, "runes".

16:53 Man, Go is awesome.

16:53 * sdegutis writes chess in Go.

16:53 * delluminatus writes Go in chess.

16:53 delluminatus: wait

16:53 turbofail: it should just be system.is‽

16:54 sdegutis: turbofail: no, the system could be without being up.

16:54 turbofail: well maybe it should have both then

16:54 maybe it can be up, without being

16:54 delluminatus: Now we're talking metaphysics. If the system sin't up, does it still exist as the same system?

16:54 sdegutis: Look, let's just all agree that Go is perfect for this job.

16:55 delluminatus: Yes. It just doesn't work, that's all.

16:55 delluminatus: And yes, we made sure it's plugged in and the power button is on.

16:55 It says Windows ME on the bottom-right of the desktop, so I don't see why it's not working.

16:55 delluminatus: But if you define a system as a complex interaction between processes

16:55 sdegutis: OH MAN THIS IS TOO FN I HAVE TO LEAVE OR ILL NEVER GET WORK DONE

16:55 delluminatus: and the processes aren't running anymore

16:56 sdegutis: s/fun/fn/

16:57 delluminatus: is a refrigerator still a refrigerator when you break the cooling pipe thing?

16:57 delluminatus: It's like, if a server's http daemon is down, is it still a web server?

16:57 sdegutis: Short answer: no. Long answer: yes.

16:57 delluminatus: But you wouldn't call a refridgerator a system, it's an object

16:57 if you are referring to the refrigeration system inside the refrigerator, that's a different story

16:58 antithesis: How can Clojure code run slower than Java code when they're both compiled to Java bytecode?

16:58 delluminatus: its like with the human brain, what matters is the pattern and the interaction, not the physical material

16:58 amalloy: antithesis: i mean...you can compile all sorts of really slow code to java bytecode

16:58 sdegutis: Okay hold on now, let's not get too close to legitimate discussions.

16:59 technomancy: antithesis: how can slow java programs run more slowly than fast java programs?

16:59 they're both compiled to Java bytecode

16:59 amalloy: why is ((fn [x] x) 1) faster than ((fn [x] (recur x)))?

16:59 antithesis: kthx

16:59 sdegutis: Oh no, dangit, I went offtopic again. I forgot this was #clojure and not #clojure-social.

16:59 Sorry yall.

17:00 amalloy: they're the same speed.

17:01 Oh no wait, the latter is slower.

17:01 certainty: -.^

17:01 `szx: has anyone tried using something like github.com/weavejester/reagi for RFP/elm style game programming?

17:02 FRP, sorry

17:10 TravisD: Give some iteration, where you assume each iteration takes the name number of operations, can you actually estimate the number of cycles per iteration by timing many iterations and using your CPU speed?

17:11 Given*

17:11 hyPiRion: TravisD: well, you have cache, memory and I/O destroying that fun for you. You could probably calculate an estimate though

17:11 TravisD: Ah, yeah. And generally would you expect it to be an underestimate or an overestimate?

17:12 ah, obviously an overestimate

17:14 hyPiRion: It depends on the program (surprise!)

17:14 I'm not too good at microbenchmarks, but from what I've understood, you could get fairly accurate if you know enough about the iteration/loop.

17:14 TravisD: Ah, really? It seems like all the things you mentioned would only increase the running time

17:15 hyPiRion: TravisD: Oh, I mean you take a sample of the total run time, and extrapolate based on that

17:16 liflash: hi everybody, i'm trying to create a namespace for development in a directory 'dev', but i can't get it to be loaded on repl startup. it just keeps being unknown

17:16 hyPiRion: I'd assume it's really, really hard to do analytical reasoning on actual time for a program these days. A computer with an OS is just too complex.

17:17 liflash: I added the folder to the :source-paths in my project.clj, but it doesn't seem to be recognized

17:17 TravisD: hyPiRion: Ah, yeah. I was wondering because I'm reading through http://www.learningclojure.com/2010/09/clojure-is-fast.html and with the newer version of clojure. The estimates on the number of operations used (computed by comparing the time taken to the number of iterations and the CPU speed) are very close to the minimum possible number of operations

17:17 Like, some places where his code reports 80 operations, mine is using 9

17:17 (same code, different computer, different version of clojure)

17:20 anyways, not a big deal :) I mostly want to implement numerical algorithms in clojure and I am pretty curious to see how the speed will compare to other languages

17:20 hyPiRion: TravisD: Well, that's benchmarking 1.2. I'm fairly certain a lot of optimisations has been done related to primitives since then

17:21 TravisD: hyPiRion: Yeah, that's great :)

17:21 very exciting

17:22 hyPiRion: yeah, love it

17:24 liflash: can someone give a hint, why the :source-paths config in the project.clj isn't recognized?

17:27 hyPiRion: liflash: first off, what do you mean by "loaded on repl startup"?

17:29 liflash: hyPiRion: I want to be able to call functions declared in files that are in another folder than src

17:30 hyPiRion: right, and (require '[my.namespace.name :as n]) doesn't work in the repl?

17:31 liflash: hmmm, ok, that works

17:32 but why can't i use (tool/some-function) like with everything else within src

17:33 (where tool is ns within the dev folder)

17:35 TravisD: Will Lieningen share copies of dependencies so that they don't need to be downloaded for every project? (Assuming versions match and everything)

17:35 hyPiRion: I'm guessing it's because the namespaces are lazily loaded, i.e. not loaded unless required.

17:35 TravisD: yes, shares them with

17:36 *shares them with maven

17:36 TravisD: Cool, I don't know much about maven

17:36 S11001001: TravisD: don't worry about it

17:36 hyPiRion: yeah, what S11001001 said

17:37 TravisD: Ah, I just wanted to make sure :) It is taking quite a long time to download all of the dependencies of incanter. That would be quite a barrier to creating new projects

17:37 hyPiRion: Essentially, all dependencies are just stored in a directory (usually ~/.m2) and if not found at a specific path there, they are downloaded

17:39 liflash: hmmmm, this is strange... i have a namespace project.repl in the folder src and whenever i start the repl i can call (project.repl/some-fn)

17:39 I expected my own files and ns to work in the same way in the repl

17:39 i'm not exactly sure, but i don't think project.repl is required somewhere

17:41 either

17:44 or is there a possibility to turn off the lazy loading? i got this setup from http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded where the setup is "I create a :dev profile with an extra :source-paths directory: (defproject com.example/my-project "0.1.0-SNAPSHOT".... :profiles {:dev {:source-paths ["dev"]...

17:47 hyPiRion: Wish I knew enough about it to help you, but unfortunately I don't.

17:48 liflash: :-/ too bad

17:48 thanks anyway

18:00 michaniskin: is there a handy example of an immutant+jenkins setup for a ring app?

18:14 dsrx: I was just going over a brief architectural discussion with my boss and it hit me that if we were using datomic, the solution would be stupidly simple

18:14 gtrak: is it possible to get a list of protocol implementations? Seems like the protocol var only has what's in extend-protocol, I don't think that catches reifies and records.

18:14 I guess reflection may work in the other cases.

18:15 qbg: I don't think that's going to be easy

18:16 gtrak: I'd really like file/line info out the other end :-)

18:16 maybe tools.analyzer is the way to do it.

18:21 stuartsierra: JVM reflection can't tell you all the subclasses of a class or interface. It's an open set.

18:36 bbloom: dnolen_: worlds, huh?

18:40 dnolen_: i read that paper a while back, if i recall correctly they memoize on read, so that what changes you see from the parent world is non-deterministic. seems like a weird design to me

18:41 dnolen_: although the general idea of a mutable map w/ snapshotting makes sense to me

18:57 yeoj___: how come i can't pass a even number of bindings into a let form? such as (let [two-forms] () )

18:58 amalloy: yeoj___: that's only one form

18:59 (ie, not an even number)

18:59 gtrak: yeoj___: if you're making a macro, you might want to do unquote-splicing

18:59 yeoj___: amalloy: but two-forms is defined as something like this: (def two-forms [blah "blah?"))

19:00 it's not really a macro, i'm trying to read parts of a text file (configuration) into a let

19:00 gtrak: why?

19:00 clojurebot: http://clojure.org/rationale

19:01 gtrak: XY?

19:01 yeoj___: gtrak: it's an etl program that moves data, and i want to pass params in. the param file needs to be let-ish in that values can reference values previously defined.

19:01 it's all a trusted source (from me, command line program)

19:01 gtrak: sounds like a hashmap

19:02 or you can write an interpreter

19:02 yeoj___: for instance, i didn't think the the third entry in the hash map be defined based on the concat of values 1 and two ?

19:03 `cbp: xy?

19:03 clojurebot: xy is http://mywiki.wooledge.org/XyProblem

19:03 gtrak: I made a little toy interpreter here: https://github.com/gtrak/webbedfeet/blob/master/src/com/garytrakhman/webbedfeet.clj#L79

19:05 if you really want to emit clojure code ('let'), then you're probably writing macros, but sounds like that's the Y part of the XY

19:05 you want to store a value in something, and you want to be able to reference that value

19:05 sounds like something a hash-map and a key can handle

19:09 yeoj___: gtrak: this is what i'm tring to do. i'll try to step back and see the Y. https://www.refheap.com/44306

19:10 i don't see how source-sql can take values from source-base-name and table-name without being eval'd somehow

19:10 gtrak: you can just use a function for that

19:10 yeoj___: (i.e. hashmap)

19:10 gtrak: (fn [table-name source-base-name source-sql] ..)

19:11 not sure I see what's the complicated part.

19:11 what's in config.config?

19:12 ah, nm

19:12 `cbp: yeoj___: if you really need a config file and you control it, you should probably turn it into edn

19:12 gtrak: yea, don't make your own config format.

19:12 yeoj___: `cbp: ok i'll look at that. i was trying to use literal sexp's

19:12 gtrak: why do you need to str it?

19:13 yeoj___: it's more than that... the config file has multiple things

19:13 it could even potentially have source->target transformations

19:13 gtrak: I see, so you're treating it like a massive let binding

19:14 yeoj___: gtrak: yeah, i was trying to

19:14 gtrak: maybe not seeing the Y

19:14 i think i need to read up on edn and potentially how folks make dsl's

19:14 gtrak: if you want to keep the format like it is.. then you can parse out symbols and replace them

19:14 TravisD: I'm really enjoying reading the examples of the XY problem, lol

19:15 gtrak: basically create a 'let interpreter'

19:15 `cbp: yeoj___: it might be more sane to just include in your config file the let and have the let return a map

19:15 gtrak: I would avoid calling eval

19:15 `cbp: yeoj___: and probably just wrap it all in a function and make it an actualy clojure file :-)

19:16 yeoj___: yeah, thats fine if it's a clojure file i guess, i could load-file at runtime?

19:16 `cbp: yeoj___: edn doesnt let you have anything other than constants

19:16 yeoj___: I mean if it's in your classpath you can just require it

19:17 gtrak: you could implement your own eval that uses a hash-map as the environment, just use apply for stuff.

19:17 probably overkill :-)

19:17 yeoj___: it's like in my ~/.bashrc, i setup how i want to use bash, and if i set something on line 1 i can reference it on line 10 type of thing.

19:17 thats the functionality i'm looking for i think (y problem?)

19:18 gtrak: if you limit what you can do in your format, then your life is easier.

19:18 for instance, hadoop uses a configuration format that expands placeholders

19:18 that would handle the str case

19:19 without having to parse sexps

19:20 yeoj___: gtrak: ok. i'll think about that.

19:20 gtrak: like: hadoop.tmp.dir = /tmp/hadoop-${user.name}

19:20 where user.name is another property

19:20 yeoj___: yeah

19:21 would let* let me combine one let into another? like list*?

19:21 gtrak: no

19:22 you could use a macro, but it's probably a bad idea.

19:22 yeoj___: yeah. i've used a product that had a pretty powerful "parameter definition language" built in, and we did some dynamic metaprogramming for data migration. thats what i'm trying to explore/etc.

19:22 gtrak: `(let [~@(read (slurp "config.config))] ...)

19:23 though read probably won't work either

19:23 `cbp: read-string

19:23 gtrak: right, I think read-string might also not work

19:23 unless you wrap the string in a vector or something

19:24 yeoj___: i haven't gotten either to work yet, tried both but i have just read the docs and not used frequently

19:24 string cannot be cast to pushbackreader

19:24 `cbp: yeoj___: read-string

19:24 instead of read

19:24 gtrak: it's just kind of a bad idea, it's just as powerful as code, but not fully code.

19:25 why not just code.

19:25 `cbp: yeoj___: you would also need to wrap your config file in a vector

19:25 yeoj___: well, i didn't really want to have lein on this server, and wanted to just have a jar

19:25 gtrak: saves you an indent, (let [ and a ])

19:26 yeoj___: lein has nothing to do with it

19:26 can dynamically load a file or a classpath-resource in any jvm environment.

19:26 yeoj___: i could just leave a file to be loaded from the classpath and have this function in there, with the let binding (with the cool precedence-var-replacement stuff) and then load-file as it's on the classpath

19:27 `cbp: load-file doesn't need it on the classpath

19:27 yeoj___: it would save me from all the typo's of having "table-name" 15 places throughout the config file, etc.

19:27 `cbp: that would be the simplest and the most dangerous :-D

19:28 or easiest rather than simplest

19:28 yeoj___: i'm not too worried about dangerous, i simply am going to use this program only this weekend

19:28 to move 500+ tables from MSSQL -> another database type

19:28 then it's a throw away

19:28 gtrak: then.. it doesn't even matter. :-) use a clj file.

19:29 yeoj___: ok. i'll call it "config.clj". done.

19:29 thanks everyone.

19:29 `cbp: farewell

19:29 gtrak: lol

20:09 TravisD: Can qualified symbols access anything on my class path? If so, what is the purpose of require?

20:10 alandipert: TravisD, finding and compiling .clj sources

20:10 amalloy: TravisD: qualified symbols can only refer to vars that have been loaded; require loads files

20:10 TravisD: Ah, that makes sense

20:11 I guess clojure.string is loaded by default?

20:11 amalloy: yes

20:11 clojure.core, clojure.string, clojure.set, and i think one other

20:11 TravisD: aha - I guess that was a bad choice to experiment with

20:11 amalloy: require also allows you to use shorthand qualified symbols

20:12 (require '[clojure.string :as s]) (s/join " " [1 2 3])

20:12 TravisD: ah, yeah

20:12 I was mostly wondering about why you needed to load things, since it didn't look like clojure.string needed to be loaded

20:13 amalloy: huh. when i `lein uberjar`, a number of classes with names like null$fn__3133.class are generated

20:14 does someone really have a bunch of lambdas defined in a namespace named "null", or is there some issue giving these the wrong name, i wonder

20:14 TravisD: Actually, http://java.ociweb.com/mark/clojure/article.html#Namespaces should probably not use clojure.string as the example there

20:14 since it is loaded by default

20:14 hiredman: amalloy: *ns* is nil for some reason

20:15 which, I dunno, might happen if you a pop-thread-bindings at the top level

20:16 have and extra

20:16 an

20:23 TravisD: Is there a mapping from file names to namespaces?

20:25 Like, in any file I can switch the default namespace to whatever I want. But when you're requiring a library, how does it know where to look? Does it look for "my.first.namespace" in "my/first/namespace.clj" or something

20:25 alandipert: TravisD, basically, and dashes are underscores

20:26 TravisD: ah okay. So is it important that the namespace used in a file match the files location?

20:26 file's*

20:26 dsrx: aghhh.... spent all that time writing a websocket repl for clojurescript so i could use it in spotify, only to find that the project I was going to use it for is intractable

20:26 :C

20:26 alandipert: TravisD, for require to work, yes

20:27 TravisD: alandipert: cool, thanks

20:27 alandipert: TravisD, np

20:38 dnolen_: ClojureScript 0.0-2173 going out, bunch fixes around library resolution - also you can now provide your own reference types that act like atoms via IReset & ISwap protocols

20:41 mlb-: A few of my coworkers are used to C++ and often fall back on to C++ idioms when writing Clojure. What is an equivilent idiom for C++'s RAII in Clojure?

20:42 qbg: mlb-: are there resources to be closed?

20:43 dnolen_: Sweet!

20:44 mlb-: qbg: For an abstract sense of "resources", yes. I was thinking of something like a try/finally, but that has a hackish feel to me.

20:44 qbg: Check out with-open

20:45 dnolen_: the IAtom stuff is particularly useful I think, it allows you to build custom data types that act like atoms but can maintain internal history

20:45 https://github.com/swannodette/worlds/blob/master/src/worlds/core.cljs

20:45 so you can do VPRI like worlds stuff

20:47 mlb-: qbg: ah, cool. I was referring to cases with more open ended/general initialization/cleanup code.

20:47 qbg: In the more general case, a macro may be best

20:49 alandipert: mlb-, i haven't seen RAII on JVM because of lack of destructors. for clojure though, beyond with-open, there is the neat https://github.com/pjstadig/scopes (i haven't used it yet)

20:54 qbg: For fun, I've written a small parametric filtering library for Clojurescript. Does that sound useful, or is there already a good solution for that?

20:57 mlb-: alandipert: Hmm, interesting, I'll look into that

20:57 clojurebot: It's greek to me.

21:14 TravisD: Does clojure have a built in not equal operator?

21:14 gfredericks: ,not=

21:14 clojurebot: #<core$not_EQ_ clojure.core$not_EQ_@57c24c>

21:14 TravisD: Ah, thanks

21:23 Guest66083: Does anyone know if there's a way (or project) to "scaffold" a CRUD interface from a MySQL DB? So tell clojure a DB name, and get the CRUD operations on the tables.... Anything like that available?

21:24 before I roll my own... It's basically like PHPmyAdmin. anyone ported that?

21:46 ruzu: no idea.. but any time i see the letters "p", "h" and "p" in sequence i am filled with uncrollable hulk-like rage

21:46 s/uncr/uncontr

22:11 tlewis: Hi all. Started learning Clojure recently and had a question about doseq if anyone has a minute.

22:11 dsrx: don't ask to ask, just ask

22:12 tlewis: Basically, I am writing to a file, and I need to make a specific write on the last iteration, as it were.

22:15 pbostrom: tlewis: you can run your doseq on (butlast seq), and then run (last seq) to do your special write

22:24 tlewis: So something like (doseq [running (butlast seq)] (spit file-name running) (spit file-name (last seq)) ?

22:28 pbostrom: yes, if (spit file-name (last seq)) is out side of the doseq, also you need to pass :append true if you don't want to overwrite the file each time

22:40 chare: does anyone have a pdf copy of this book: https://leanpub.com/fp-oo

22:42 tlewis: I have the :append true part down. Most of my problem is coming from the fact that I have triple nested calls to (doseq) and I need to put a special EOF at the end of each file.

22:42 I am parsing xml and generating a file from the xml

22:43 bob2: are you sure you don't want to use an xml generator thing

22:43 chare, it's on that site, for $15

22:44 tlewis: It is quite possible I do. I have only been doing Clojure for about a week.

22:44 I am currently using clojure.xml

22:44 bob2: what's the 'special EOF'?

22:45 tlewis: I am parsing xml and generating Objective-C code, so I need "@end" at the end of each file.

22:46 bob2: ah

22:46 chare: join #dynamo

22:46 ignore that

22:47 pbostrom: tlewis: I thought you were doing something special with the last value of the seq, if that's not the case than you can just write @end outside of the doseq

22:49 tlewis: you also may want to consider building up the entire file as a string and then writing it once

22:49 tlewis: I didn't think if building it as a string, that might be the better way.

23:04 chare: nobody has the book "Functional Programming for the Object-Oriented Programmer"?

23:06 amalloy: brian marick probably has a copy

23:06 chare: amalloy you think you're funny?

23:06 amalloy: but that's not the question you're asking: you're asking "will someone give me a free pdf copy of this book?"

23:06 chare: yes that is true

23:07 amalloy: i surely hope nobody does, and i doubt they will

23:07 chare: ok just let me borrow the book then

23:08 bob2: chare, please buy it or be quiet

23:17 pmonks: Good evening gurus!

23:18 Am I right to assume the following behaviour is a leaky abstraction from Java:

23:18 ruzu: clojurus?

23:18 pmonks: ;-)

23:18 '(= #"foo" #"foo")

23:18 doh - how do I trigger clojurebot?

23:18 qbg: ,(= #"foo" #"foo")

23:18 clojurebot: false

23:18 pmonks: ty

23:19 I assume that result is a Javaism inherited from Pattern or wotnot?

23:19 *Pattern.equals

23:19 (or rather lack thereof)

23:19 Cr8: pmonks: you can check

23:19 ,(.equals #"foo" #"foo")

23:19 clojurebot: false

23:20 pmonks: Yeah I'm pretty certain that's the explanation, but being a n00b wanted to verify.

23:20 Didn't think to call native .equals though - thanks for the reminder! ;-)

23:20 Cr8: pmonks: Object has a .equals, so anything that doesn't define its own will have that one

23:21 which will just be object identity

23:21 pmonks: Yep, which only checks precise object equality (i.e. ==)

23:21 Cr8: ,(let [foo-re #"foo"] [(.equals foo-re foo-re) (= foo-re foo-re)])

23:21 clojurebot: [true true]

23:21 pmonks: Doesn't look like java.util.regex.Pattern overrides the default… ;-(

23:21 Cr8: indeed it does not

23:21 pmonks: #sadpanda

23:21 Cr8: you can str them

23:22 ,(str #"foo")

23:22 clojurebot: "foo"

23:22 Cr8: ,(= (str #"foo") (str #"foo"))

23:22 clojurebot: true

23:22 pmonks: Yeah that's my workaround.

23:22 (str #"\s([Ss]omething [cC]omplicated)")

23:22 Cr8: or maybe .pattern is more correct, i expect they're the same though

23:22 pmonks: ,(str #"\s([Ss]omething [cC]omplicated)")

23:23 clojurebot: "\\s([Ss]omething [cC]omplicated)"

23:23 Cr8: ,(.pattern #"\s([Ss]omething [cC]omplicated)")

23:23 clojurebot: "\\s([Ss]omething [cC]omplicated)"

23:23 Cr8: yep

23:24 dsrx: now make it check that the regexes are equivalent even if their strings aren't equal

23:27 TravisD: is there a non-nested version of update-in?

23:29 pmonks: @dsrx :-D

23:31 Mind blown: http://stackoverflow.com/questions/8961632/how-should-one-proceed-to-prove-or-find-if-two-regular-expressions-are-same-or

23:32 dsrx: that only works with truly regular expressions, not some (useful) abomination like PCRE

23:32 pbostrom: TravisD: just specify a single key

23:33 TravisD: pbostrom: Yeah, it's just that some other functions have both versions, like get and get-in. Seems like if you don't need the nested functionality, it might be easier to understand if the non-nested version is used

23:34 dsrx: pmonks: _understanding computation_ by tom stuart is a great book if you want to learn more about that kind of thing

23:34 pbostrom: TravisD: yeah, there's no update for some reason

23:35 TravisD: Hm, there's probably a good reason

23:48 ambrosebs: this ticket has a patch to support (update-in m [] f) as being equiv to update

23:48 http://dev.clojure.org/jira/browse/CLJ-373

23:51 TravisD: ambrosebs: That seems to be discussing a different issue ,no?

23:51 some inconsistency in the behaviour of get-in and update-in

23:52 We're wondering why there isn't an update function that is equivalent to (update [m k f & args] (apply update-in m [k] f args))

23:53 er, (defn update ...)

23:56 chare: lets talk about cool stuff

23:57 ambrosebs: TravisD: ah yes

23:58 nido`: not actually very cool, but I'm starting to learn clojure and I'm having a hard time getting cider to work for me in emacs

23:59 TravisD: nido`: I installed cider using packege.el. Worked like a charm!

23:59 nido`: Yeah, that's what I did too, but when I try to m-x cider-jack-in it says it fails to connect to a server.

23:59 TravisD: nido`: Are you on Mac OS?

23:59 nido`: I've also been unable to get it to connect to the lein repl

Logging service provided by n01se.net