#clojure log - Sep 16 2013

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

0:27 muhoo: i'm trying to understand the use of instaparse. it seems like it doesn't do tokens, only strings.

0:27 sorry , only characters, not even string tokens

0:28 callen: muhoo: https://github.com/chameco/Hitman/blob/master/src/hitman/core.clj ?

0:28 you tokenise anything regex can match.

0:28 Instaparse is a GLL, it handles CFGs and CSGs

0:32 muhoo: ah, i was confusing instaparse wiht parsatron

1:33 wei_: is there a way to selectively disable compojure route definitions based on the value of an atom? defroute is a macro so the usual control structures don't work

1:41 amalloy: wei_: a ring handler is just a function. just write a function that takes a route and some sort of `include?` function that selectively decides whether or not to allow that sub-route to run

1:42 (routes a b (only-sometimes (fn [] @enable?) (routes c d e))), where only-sometimes is that thing i said you should write

1:47 wei_: i got it, thanks! my fn returns simply (routes) if the routes are disabled. is that what you would have done?

1:47 (defn only-in-dev [handler] (if-not @prod? handler (routes)))

1:48 callen: wei_: https://github.com/weavejester/environ

1:49 wei_: I'm using it: (defonce prod? (atom (env :lein-no-dev)))

1:50 muhoo: there's no need to have an atom, just check env

1:51 wei_: oh good point

1:54 coventry`: If it's constant throughout the life of the application, you could wrap the dev defroutes in if statements.

1:57 wei_: my problem with that was if I included nils in the final app-routes, I'd get a NullPointerException

2:02 H4ns: i'm using clojure.test and some of my tests depend on files that i'd like into the test's source directory. is there an idiomatic way to determine the directory where a test's source is located?

2:05 SegFaultAX: Variadic relational operators are so handy.

2:06 noidi: H4ns, add a resource directory that's only available during development and put the files there

2:07 put something like `:profiles {:dev {:resource-paths ["test-resources"]}}`

2:07 into your project.clj

2:09 you can then get a resource URL with (clojure.java.io/resource "my-test-file")

2:12 H4ns: noidi: ah, nice! thank you!

2:49 sontek: Any of you guys doing the clojurecup thing?

2:59 muhoo: clojure.... cup?

3:04 sontek: http://clojurecup.com/

3:19 callen: sontek: I am, I have a project in mind.

3:19 I'm looking for backend, frontend, and designers. I can do backend and frontend but not design.

3:21 muhoo: I'm looking forward to it :)

3:25 lgs32a: where can i find the source code of special forms?

3:25 in the clojure code

3:26 callen: lgs32a: in the repo

3:26 lgs32a: callen: yes i expected it there but couldn't find it

3:27 callen: where is if for example

3:29 amalloy: lgs32a: "special form" means something unimlementable (or unimplemented) in the language itself; it's baked into the compiler or something similar. in clojure, that's Compiler.java

3:30 sontek: callen: I'm hoping to find some people in bay area I can join to hack on something

3:30 callen: lgs32a: you'll see a bunch of things like static final Symbol DEF = Symbol.intern("def");

3:30 lgs32a: special forms are anything reified to the compiler that can't be done in macros or functions.

3:30 sontek: well you know I'm in SF.

3:30 lgs32a: amalloy: ty

3:33 callen: sontek: query me?

3:40 quazimodo: I've started fiddling with clojure. Feels good

3:40 that is all

3:41 callen: quazimodo: good :)

3:41 quazimodo: it was hard not to go the common lisp route. I want to sbcl but no one else does :(

3:42 callen: quazimodo: I came to Clojure from Python and sbcl, you're in good company :)

3:42 quazimodo: i ruby a lot

3:42 not even sure why I'm learning clojure tbh

3:42 i guess it's a pain in the ass to gui with ruby

3:48 clj_newb_2345: if I do (.start (Thread. (fn [] ... ))) and the function throws an uncaught exception, is the Thread garbage colected?

3:48 or does it lie around ?

3:51 amalloy: $google java thread uncaught exception

3:51 lazybot: [Thread.UncaughtExceptionHandler (Java Platform SE 7 )] http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.UncaughtExceptionHandler.html

3:52 clj_newb_2345: this says nothing about garage colelction :-)

3:52 so running threads are gc roots

3:52 amalloy: that may or may not be the most useful link, clj_newb_2345, but my point is that this is not a clojure question at all

3:52 clj_newb_2345: but what about terminated thraeds?

3:53 I disagree with you; JVM issues shoudl be as on topic as clojure libraries

3:57 hyPiRion: The thread is considered a root while it is running. Once it stops, it's not considered a root anymore. Does that answer your question?

4:07 clj_newb_2345: http://reference.clojuremongodb.info/monger.core.html#var-get-db

4:07 where is create db?

4:08 ucb: clj_newb_2345: without knowing much, it's possible that get-db actually means get-or-create-db

4:08 amalloy: clj_newb_2345: i don't mean it's off-topic, so much as that you'll get better answers in a java context

4:09 clj_newb_2345: Get database reference by name. EXAMPLES (monger.core/get-db "myapp_production") (monger.core/get-db connection "myapp_production")

4:09 the documentation doesn't mention anythign about that

4:10 ucb: but testing it, you're right :-)

4:10 amalloy: ah, noted, thanks for clarifying :-)

4:12 lgs32a: something is very strang

4:12 i just looked at the source code of the meta reader macro

4:13 for the ^token

4:13 ddellacosta: #postgresql

4:13 lgs32a: and whenever i enter ^:x 'a

4:13 ddellacosta: whoops, sorry!

4:13 lgs32a: i get a symbol without meta-data

4:13 but it should have them

4:13 clj_newb_2345: in what context can (refresh) (fromclojure.tools.namepace) be called -- I'm trying to call it on every ring request ... but am getting into errors

4:14 ddellacosta: clj_newb_2345: I usually use it in a repl session when I've added a lot of random crap to a namespace I'm working in. I wouldn't generally use it to reload after every ring request, why do you think you need to do that? There may be another way to get what you want.

4:15 clj_newb_2345: https://gist.github.com/anonymous/9f8248bbcd4ddb196d13

4:15 well, my current work flow is:

4:15 edit clojure file; go to repl,type in (refresh); click "reload" button on browser

4:15 I'm using websockets, so ring requests are very infrequent

4:15 in fact, only when I hit thre reload button

4:16 (yeah, I mean I'm not doing it on every static file load -- only on new websocket creation

4:16 and I'm getting the error of https://gist.github.com/anonymous/9f8248bbcd4ddb196d13

4:16 ddellacosta: clj_newb_2345: hmm, you shouldn't need to do that--just use ring-wrap-reload: http://ring-clojure.github.io/ring/ring.middleware.reload.html

4:16 clj_newb_2345: that'll make sure you're picking up changes to namespaces in ring handlers.

4:16 clj_newb_2345: oh shit :-)

4:17 how do I link this with compojure?

4:17 ddellacosta: clj_newb_2345: haha…yeah, don't quote me on this, but I thought c.t.n.r was more for repl-based workflows.

4:17 clj_newb_2345: what's ctnr ?

4:17 clojure tools namespace repl

4:17 ah

4:18 ddellacosta: clj_newb_2345: sorry, abbreviating it: clojure.tools.namespace.reload. yah

4:18 ro_st: clojure.tools.namespace/resfresh

4:18 ddellacosta: er, refresh, sorry

4:18 what ro_st said.

4:19 lgs32a: so, again

4:20 ddellacosta: lgs32a: sorry, I wasn't quite sure what your issue was.

4:20 lgs32a: well

4:20 ro_st: clj_newb_2345: check out https://github.com/juxt/jig

4:20 lgs32a: ,^:test-kw 'x

4:20 clojurebot: x

4:20 lgs32a: ,(meta *1)

4:20 clojurebot: nil

4:20 lgs32a: why?

4:20 clojurebot: http://clojure.org/rationale

4:21 ddellacosta: ro_st: that looks awesome!

4:21 lgs32a: i looked at the source-code of the meta-reader and it returns

4:21 ((IObj) o).withMeta((IPersistentMap) ometa);

4:22 which should be equal to

4:22 ,(.withMeta 'x {:test-kw true})

4:22 clojurebot: x

4:22 lgs32a: ,(meta *1)

4:22 clojurebot: nil

4:22 lgs32a: well in my repl there are meta-data

4:22 if using this syntax

4:23 ,(meta (.withMeta 'x {:test-kw true}))

4:23 clojurebot: {:test-kw true}

4:23 ro_st: ddellacosta, clj_newb_2345: jig is put together by @malcolmsparks on twitter. i'm sure he'd love any feedback you might have

4:23 lgs32a: ,(meta ^:test-kw 'x)

4:23 clojurebot: nil

4:23 lgs32a: so there you have it

4:23 clj_newb_2345: ro_st: will look into it next; thanks :-)

4:23 I am a far is staur sierra's "reloaded" workflow

4:24 had some hacked up solution of my own, but not nearly as formalized / well defined

4:24 ro_st: jig is a progression of SS's reloaded

4:24 even if you never use jig, its documentation is a great unpacking of the concepts

4:24 clj_newb_2345: I'm afraid

4:24 i won' get any work done tonight :-)

4:24 if I keep on studying new libraries

4:25 ro_st: there's always another yak to shave

4:25 lgs32a: now i wonder if the ^: tag is ignored if I evaluate a simple form

4:26 ddellacosta: lgs32a: looking into it

4:26 lgs32a: i think i have it

4:26 haha

4:26 hyPiRion: lgs32a: you're attaching the metadata to the list (quote x), not the symbol x

4:26 lgs32a: this is not easy

4:26 exactly i realized it this moment

4:32 clj_newb_2345: (ring.middleware.reload/wrap-reload chat-handler :dirs ["clj"]) <-- is this the right way to use wrap-reload ?

4:32 in particular, for passing the :dirs option

4:34 quazimodo: it's painful that java and jvm are discussed in a lispy place :(

4:34 hard to come to grips with it

4:35 ro_st: clj_newb_2345: yes, but you must include all the paths. so if you have src and clj, you must include both

4:35 clj_newb_2345: I only have clj/**/*.clj

4:36 but it's not working :-(

4:37 clgv: clj_newb_2345: do you have problems to set up source paths in project.clj?

4:38 ro_st: you need to restart your webserver after altering that line

4:39 clj_newb_2345: testing

4:39 I had to tell project.clj to look in clj too

4:39 I like clj in clj/ and cljs in cljs/

4:40 fuck this

4:41 i'll just have eamcs tell repl to execute (refresh) on every save

5:23 jave: Is there an existing method for calling lein from maven?

5:33 glosoli: Hey, anyone using enlive ? I have a template which I transform to show form errors in, but then I fix issues and submit form again, which works just fine, i want to go back, and I still see all the errors transformed, any ideas how could I fix this ?

5:34 cgrand: @glosoll: seems like page with errors got cached by the browser, not sêcific to enlive

5:34 ro_st: glosoli: first replicate the behaviour in a repl by banging on the function that does the trans directly

5:35 borkdude: could it be that `lein with-profile test cloverage` is messing my jvm-opts up?

5:36 glosoli: thanks

5:55 zapu: what's the state of clojureclr and vsclojure plugin?

5:57 clj_novice_2345: what are good clojurescript bindings for something mark-down like?

5:57 ddellacosta: is there an official edn mime-type?

5:58 clj_novice_2345: in particular, I want something where where there is a "textural" representation of the page

5:58 ddellacosta: lots of questions all of a sudden, heh

5:58 clj_novice_2345: but it can also be rendered nicely into HTML

5:58 ddellacosta: clj_novice_2345: are you asking for a library that can do markdown/something like markdown?

5:59 clj_novice_2345: i wnat to design a webpage

5:59 where there's a left pane and a right pane, where the user edits text in the left pane

5:59 and it's real time rendered in the right pane

5:59 and I'd like to do this clojurescript

5:59 I'm okay with using javascript libraries

5:59 ro_st: like mouapp.com does

5:59 clj_novice_2345: https://github.com/evilstreak/markdown-js

6:00 clj_novice_2345: ro_st: you're ike future me

6:00 in terms of clojure libraries

6:00 ddellacosta: clj_novice_2345: huh, interesting, I did something very similar, only using a top/bottom view

6:00 ro_st: mouapp is an osx app. nothing to do with clj/s :-)

6:01 clj_novice_2345: mouapp.com -- that's a desktop app, not a webpage, no?

6:01 ddellacosta: I used https://github.com/chjj/marked, as it's quite fast, although haven't compared to anything else in a while.

6:02 ro_st: yes

6:04 borkdude: how can I print the jvm-opts that lein cloverage uses

6:05 ddellacosta: so, no answers on edn mime-type? I'll use text/edn for now, but wasn't sure if there was anything official. Having trouble googling for it.

6:06 ro_st: ddellacosta: application/edn

6:07 ddellacosta: ro_st: ah, yeah, just started finding that poking around. Thanks!

6:07 makes sense since json is application/json.

6:07 ro_st: yes

6:22 H4ns: is there a way to validate an edn file? i have a large edn file that is rejected with "Map literal must contain an even number of forms" by clojure.edn/read, but i don't know where the problem is located in the file.

6:23 ro_st: try a normal read-string with clojure 1.5+ ? it might report the line/column numbers

6:24 otherwise load the file into emacs/vim with paredit and use next-form to jump through the file until it shouts at you

6:24 tedious to do that though if your data is biggish

6:24 H4ns: right. that's why i'm looking for a better error message. i'll try read-string, thanks.

6:25 same message :(

6:25 ro_st: try using tools.reader

6:25 http://clojure.github.io/tools.reader/

6:26 if you find a way to get line/col reports, please let us know :-)

6:26 H4ns: thanks, i'll try that

6:36 Bronsa: ro_st: H4ns the edn reader does not annotate any line/column info

6:38 ro_st: Bronsa : is there a reader which does?

6:38 H4ns: LineNumberingPushbackReader seems to be, but i'm not sure.

6:42 Bronsa: ro_st: H4ns I meant read-string

6:42 if you use read+clojure.tools.reader.reader-types/indexing-push-back-reader you get line/column info in the ex-data

6:43 ro_st: aha. is there a sample of that somewhere?

6:43 this smells like a cookbook recipe

6:43 we use edn as a data format and having this info when reporting an error would be tres useful

6:44 Bronsa: ro_st: H4ns user=> (use 'clojure.tools.reader.edn)

6:44 WARNING: read-string already refers to: #'clojure.core/read-string in namespace: user, being replaced by: #'clojure.tools.reader.edn/read-string

6:44 WARNING: read already refers to: #'clojure.core/read in namespace: user, being replaced by: #'clojure.tools.reader.edn/read

6:44 nil

6:44 user=> (use 'clojure.tools.reader.reader-types)

6:44 WARNING: read-line already refers to: #'clojure.core/read-line in namespace: user, being replaced by: #'clojure.tools.reader.reader-types/read-line

6:44 nil

6:44 user=> (read (indexing-push-back-reader "{:a}"))

6:44 ExceptionInfo Map literal must contain an even number of forms clojure.core/ex-info (core.clj:4343)

6:44 user=> (ex-data *e)

6:44 {:column 5, :line 1, :type :reader-exception}

6:44 derp.

6:44 I'm sorry, here's nopasted http://sprunge.us/XgAX

6:45 H4ns: Bronsa: thanks! let me try that.

6:45 supersym: nice..a creative friend just passed me https://medium.com/about/9e53ca408c48

6:45 from the dudes that made twitter

6:49 ro_st: Bronsa: you rock star!

6:53 sm0ke: Hello i have (def a (SomeJavaClass.)) ..this class has a public var o which i want to reassign,,, how do i do that?

6:54 ro_st: (set! a (.-var) <new-val>)

6:55 -shoots from the hip-

6:57 sm0ke: so i would do (set! a (.-o) <new-val>)

6:57 hmm...weird synta

6:57 clgv: looks like cljs syntax

6:57 ro_st: it is cljs syntax. might be different for java. probably is different

6:58 Bronsa: it's actually (set! (.field instance) val)

6:59 .field or .-field are essentially the same in clojure

6:59 clgv: Bronsa: ah right. that was added sometime after 1.3 right?

7:00 ro_st: thanks for the correction, Bronsa

7:00 glosoli: I have two maps and I would like to compare only the values which rely to the common keywords between those maps, any ideas ?

7:00 clgv: glosoli: keys + set + select-key + =

7:00 ro_st: glosoli: use ((set (keys map1) (set (keys map2))

7:01 wait, that's probably wrong, too

7:01 ,(#{:a :b} #{:a :c})

7:01 clojurebot: nil

7:01 ro_st: ,(clojure.set/intersection #{:a :b} irc://irc.freenode.org:6667/#%7B:a :c})

7:01 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: }>

7:01 ro_st: gah

7:01 clgv: glosoli: determine the common keys by creating a keyset each and itnersect those. then use select-keys with the prev result

7:02 ro_st: ,(clojure.set/intersection #{1 2 3} #{2 3 4})

7:02 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>

7:02 ro_st: you get the idea

7:03 glosoli: yeah thank you both

7:05 Bronsa: clgv: it wasn't in 1.3, i don't remember if it was added on 1.4 or 1.5 though

7:07 H4ns: (keyword "hello[123]") => :hello[123] - that's kind of sad :( - is there some syntax for quoted symbols?

7:08 Bronsa: '(keyword "foo bar")

7:08 clgv: H4ns: what do you want to do?

7:08 Bronsa: ,(keyword "foo bar")

7:08 clojurebot: :foo bar

7:08 clgv: ,'bla

7:08 clojurebot: bla

7:08 clgv: ,(type 'bla)

7:08 clojurebot: clojure.lang.Symbol

7:08 Bronsa: H4ns: symbol/keyword don't do any validation for performance reasons

7:09 H4ns: clgv: i have some json data which uses "foo[bla]" as keys. when i turn that data into clojure maps with keywords as keys, i end up with unreadable data

7:09 Bronsa: H4ns: you'll have to make those keys strings

7:10 neither symbols nor keywords can handle that

7:10 clojure doesn't have the #|symbol with special chars|# syntax that e.g. common lisp has

7:10 sm0ke: ,(rep 1)

7:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: rep in this context, compiling:(NO_SOURCE_PATH:0:0)>

7:11 H4ns: Bronsa: that was what i was after.

7:11 sm0ke: ,(repeat 1)

7:11 clojurebot: (1 1 1 1 1 ...)

7:11 sm0ke: ,(doall (repeat 1)) ;hahaha

7:11 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

7:11 H4ns: Bronsa: thanks, i'll find my way through cheshire to see whether i can make it do trt for me.

7:11 Bronsa: (err, just |symbol with spaces|)

7:12 * Bronsa can't common lisp

7:14 clgv: ,(println "sm0ke: Bad boy!")

7:14 clojurebot: sm0ke: Bad boy!\n

8:18 Janiczek: Hi, I'm using Enlive to transform RSS file. I see something relevant on github wiki: https://github.com/cgrand/enlive/wiki#resources - but I'm not sure how to specify I want xml-resource in the deftemplate...

8:19 cgrand: just use (xml-resource (java.netURI. "….")) as the source of the deftemplate (e.g. before the args vec)

8:20 Janiczek: tried (xml-resource "filepath"), helped with some problems (<link></link>http://) but stripped the <?xml thing at the beginning. will try the (java.netURI. ...)

8:23 hm, that probably amounts to the same thing. cgrand, would you know what to do with disappearing <?xml version="1.0" encoding="UTF-8" ?> ?

8:25 glosoli: hmm I have set like this, which I got returned by intersection on two sets, hmm I can to seem find if there is some shorthand for retrieving keys out of this? #{[:last-name "somelastname"] [:id "somenumberid"]} I was considering to use (keys (into {} thisset))

8:26 cgrand: @janiczek fill a bug, in the mean time, cons the missing <?xml ….?> on the output of the template call

8:26 Janiczek: cgrand: ok

8:26 thanks :)

8:28 TEttinger: glosoli, get-in ?

8:28 squidz: does anybody have an idea how I can run php in my clojure project(with jetty)?

8:29 TEttinger: hm crud, nvm gleag

8:29 glosoli

8:29 gleag: Have I been summoned?

8:29 glosoli: TEttinger hmm ?

8:30 TEttinger: glosoli, the problem is each element of the set is a vector, so to use get-in you would need to pass... hm are sets even associative

8:30 sorry gleag, typo on name completion

8:30 * gleag retreats into his bottle...

8:31 TEttinger: glosoli, basically you want things like :last-name and not "somelastname" ?

8:31 glosoli: TEttinger: yeah, I have one set of keys and that kind of set full of vectors, and I want to find which keys from the set are in the later set with inside vectors

8:31 TEttinger: if they're all structured like that, ##(map first #{[:last-name "somelastname"] [:id "somenumberid"]})

8:31 lazybot: ⇒ (:last-name :id)

8:32 squidz: I want to be able to access php files served by ring? is that possible?

8:33 glosoli: TEttinger: thanks! :)

8:34 TEttinger: glosoli, be advised, if the vectors have multiple keys it won't do what you want

8:34 ##(map first #{[:last-name "somelastname" :first-name "Jim"] [:id "somenumberid"]})

8:34 lazybot: ⇒ (:last-name :id)

8:35 glosoli: understood

8:35 TEttinger: but I do love how simple these things can be in clojure with the right combinations. it's like a puzzle with well-documented pieces

8:35 Janiczek: cgrand: does this suffice? https://github.com/cgrand/enlive/issues/78

8:36 cgrand: janiczek: perfect

8:37 thank you

8:37 Janiczek: ok great :) gonna go cons that thing in. thanks for help!

8:43 AimHere: cons ? This is #clojure, we conj stuff in!

8:45 sm0ke: ,(cons 1 [2 3])

8:46 clojurebot: (1 2 3)

8:47 AimHere: ,(conj '(2 3) -1 0 1)

8:47 clojurebot: (1 0 -1 2 3)

8:48 AimHere: More flexible and by extension more idiomatic!

8:49 H4ns: is there an equivalent to (rest (butlast x)) (i.e. return the "middle" elements of a list or nil for a two-element list?

8:50 surprise! it is (rest (butlast x))

8:50 :D

8:50 sm0ke: ,(conj '(2 3) 1 0 -1) ; i think you meant

8:50 clojurebot: (-1 0 1 2 3)

8:51 AimHere: Yeah, well that's the thing with conj. You have some cognitive overhead with all the extra arguments and extra collection types!

8:51 sm0ke: :)

8:53 AimHere: H4ns, (butlast (rest x)) gives you an actual nil nil, where (rest (butlast x)) only gives you an empty collection. This might (but probably doesn't) make a difference to you

8:53 In the two-items-or-less case anyways

8:54 H4ns: AimHere: right. it does not matter, i was just thinking in common lisp, assuming that it would be different in clojure.

8:54 AimHere: thanks anyway :)

9:18 stuartsierra: freiksenet: Re conversation about seqs on Java arrays (August 21) see updated language on http://clojure.org/sequences

9:46 yury: hi everybody

9:47 how to translate list ("a" "b" "c") to hash-map ({:97 "a"} {:98 "b"} {:99 "c"}) ?

9:47 mpenet: ,(zipmap [97 98 99] ["a" "b" "c"])

9:47 clojurebot: {99 "c", 98 "b", 97 "a"}

9:48 mpenet: ah well not exactly

9:48 AimHere: ,(map hash-map [:97 :98 :99] ["a" "b" "c"])

9:48 clojurebot: ({:97 "a"} {:98 "b"} {:99 "c"})

9:48 yury: where 97 98 and 99 is (hash of respective "a" "b" and "c")

9:48 mpenet: or yes, your question is can be misinterpreted, you want a list of hashmaps of a single map?

9:48 yury: single map

9:49 to be able to use (get hash_list some_key)

9:49 mpenet: so yes, my first answer works

9:50 AimHere: Well doesn't quite work - your first argument to zipmap will be created by something like (map hashify ["a" "b" "c"])

9:51 hyPiRion: ,(into {} (map (juxt hash identity) ["a" "b" "c"]))

9:51 clojurebot: {97 "a", 98 "b", 99 "c"}

9:52 hyPiRion: If you want that thing as a keyword

9:52 ,(into {} (map (juxt (comp keyword hash) identity) ["a" "b" "c"]))

9:52 clojurebot: {nil "c"}

9:52 mdrogalis: ,(map hash ["a" "b" "c"])

9:52 clojurebot: (97 98 99)

9:52 hyPiRion: well, kind of

9:52 mdrogalis: Hm

9:52 hyPiRion: ,(into {} (map (juxt (comp keyword str hash) identity) ["a" "b" "c"]))

9:52 clojurebot: {:97 "a", :98 "b", :99 "c"}

9:52 hyPiRion: but may as well do it with pure ints

9:56 mdrogalis: Also not a good idea to have integer keywords.

9:56 ,(keyword 11)

9:56 clojurebot: nil

9:58 AimHere: ,(int :11)

9:58 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Character>

10:03 rurumate: G'day folks, I'se got a clojurescript question. When typing script/test, the system responds that neither V8_HOME, SPIDERMONKEY_HOME or JSC_HOME are set; now which of these package is the easiest to install, and where to point the HOME var?

10:04 cmajor7: is there a reason why a depreciated "resultset-seq" is used in "with-query-results*": https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L992 ? #https://github.com/clojure/java.jdbc

10:14 yury: hyPiRion, thanks a lot, (comp keyword str hash) works like a charm

10:16 squidz: has anybody got the source-maps working for clojurescript? My file cljs file structure is correct in the browser, but when I try to open one of the cljs files, they are not found. Anybody try it out yet?

10:16 tbaldridge: squidz: yeah, it's not working for me either yet. I haven't spent the time to figure it out yet. I'm sure it's something with my cljsbuild config

10:17 squidz: i figured it is also something with my project.clj, but haven't been able to figure it out yet

10:19 rurumate: ok found it, https://github.com/clojure/clojurescript/wiki/Running-the-tests

10:21 R_Macy: anyone using cemerick's `friend` library?

10:22 I've included `[ring "1.2.0"]` in my deps, but I'm getting the following exception `Exception in thread "main" java.io.FileNotFoundException: Could not locate ring/util/request__init.class or ring/util/request.clj on classpath` from this file https://github.com/cemerick/friend/blob/master/src/cemerick/friend/workflows.clj#L4

10:22 stuartsierra: Relevance and Metadata Partners (owner of Datomic) have merged to form Cognitect: http://www.cognitect.com/

10:22 hyPiRion: Hmm, interesting changes for Relevance and Rich.. Hopefully for the better of the community.

10:23 ah, zing

10:23 stuartsierra: heh, perfect timing. :)

10:23 hyPiRion: I would assume it doesn't change anything dramatically though, I feel like you guys have been working close for a very long time already.

10:25 stuartsierra: In the short term, yes, there won't be any dramatic changes.

10:25 seangrove: I wasn't aware that Metadata Partners were the owners of Datomic, somehow I thought it was relevance

10:26 stuartsierra: In the long term, this should mean more and better commercial support for Clojure, ClojureScript, and Datomic,

10:26 seangrove: squidz: You need to have the the source files available to the browser

10:26 If you right-click on the source file inside the chrome source viewer and open in a new tab, you can see the path it's using to open

10:27 likely you'll need to cp your src/ files and subdirs to resources/public

10:27 stuartsierra: seangrove: The relationship was always close, but Metadata Partners used to be a separate company in which Relevance owned a large stake. Now both Metadata Partners and Relevance are parts of Cognitect.

10:28 squidz: seangrove: it is just pointing the file path on my file system: /home/squidz/programing/clojure/file.cljs

10:29 seangrove: squidz: Yeah, the browser won't be able to open that

10:29 wakeup: How do I check *in* for EOF?

10:29 (in Clojure)+

10:29 hyPiRion: ,(read)

10:30 clojurebot: Execution Timed Out

10:30 wakeup: (without modyfing *in*)

10:30 hyPiRion: &(read)

10:30 lazybot: Execution Timed Out!

10:30 squidz: seangrove: all the files I need are stuffed in the :output-dir specified in project.clj right?

10:30 hyPiRion: I thought one of them had *in* closed. Seems like I'm wrong on that.

10:30 wakeup: hyPiRion: read will consume input.

10:30 tbaldridge: wakeup: you can't you have to use a pushbackreader, http://docs.oracle.com/javase/7/docs/api/java/io/PushbackReader.html

10:31 wakeup: at least I don't know of a way

10:31 wakeup: -.-

10:31 this is seriously shameful

10:31 tbaldridge: wakeup: that's kindof tied to the OS though, I'm not aware of any OS socket/stream that allows peek.

10:31 hyPiRion: wakeup: Just read from System/in

10:32 seangrove: squidz: I don't think that matters, your cljs files won't get spit out there

10:32 wakeup: tbaldridge: err no, EOF-P is a completely standard function in a programming language

10:33 tbaldridge: wakeup: but not at the OS level. Notice how Unix read simply returns -1 on EOF. http://linux.about.com/od/commands/l/blcmdl2_read.htm

10:33 squidz: seangrove: ah okay, so we still have to manually cp all of our clojurescript files to a directory accesable by the browser?

10:33 tbaldridge: wakeup: also, http://stackoverflow.com/questions/2082743/c-equivalent-to-fstreams-peek

10:33 seangrove: squidz: I *believe* so, I didn't see any code that indicated otherwsire

10:34 But maybe dnolen can confirm how he's doing it in his example

10:34 wakeup: tbaldridge: by the OS level you seem to mean ANSI C, well C has unread...

10:34 squidz: yeah not sure if he is reachable right now. If not maybe i'll ask him later

10:34 tbaldridge: wakeup: yep, and pushbackreader has unread

10:35 wakeup: tbaldridge: which is a java class?

10:35 tbaldridge: wakeup: yes

10:35 wakeup: it's what Clojure's internal lisp reader uses.

10:35 dnolen: squidz: I changed the REPL web server to resolve the full paths in the source map file. Up for discussion what the best thing for tools is.

10:36 wakeup: tbaldridge: so Clojure does have neither unread nor eof-p

10:36 dnolen: squidz: so you may have to copy the files if you're using a custom webserver, but you could probably do I what I do w/ dev-only middleware or something like that.

10:37 squidz: dnolen: is it in the cljsbuild project?

10:37 tbaldridge: wakeup: nope, the JVM classes are considered sufficient and adding other layers would just add overhead.

10:37 dnolen: squidz: no, all the changes were to the browser REPL server

10:37 squidz: it's more or less a hack so that people can try it out and figure out what they need and what they want tools to do.

10:38 squidz: dnolen; where is that at? It is kind of confusing as there seems to be lots of pages out there on different ways to get browser repls up.

10:38 dnolen: squidz: I'm not planning on putting any more thought into, what tools needs will guide what happens next.

10:38 squidz: I don't know anything about external browser REPLs

10:39 squidz: only the one that ships with ClojureScript. Can be used with `lein trampoline cljsbuild repl-listen`

10:40 squidz: http://swannodette.github.io/2013/09/15/source-maps/, you shouldn't need any more information than this to try it out

10:41 squidz: dnolen: I meant projects like piggieback, austin, and other documenation from modern clojurescript. I couldn't seem to get lein trampoline cljsbuild repl-listen working. After going to the address, it says it can't find index.html

10:41 dnolen: squidz: I don't know anything about that stuff.

10:42 squidz: I say in the post you need to make an index.html and include your output js file.

10:42 seangrove: dnolen: I've never used the built-in browser repl. I like how your trick about resolving source code, wonder if we can work with cemerick to get something similar in piggieback and friends

10:43 dnolen: seangrove: probably! I look forward to hearing feedback from these tools about what they need to integrate source map functionality best.

10:44 squidz: dnolen: okay, but from where is the server looking for resources? I'm guessing this is separate from ring/compojure configuration in a project

10:45 dnolen: squidz: it's a hack best understood by looking at the source http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl/browser.clj#L74

10:45 squidz: like I said I can't give any guidance on how to make it work with your setup

10:45 squidz: okay thanks, I think that is the last piece missing to get it going

10:47 ive never used the built in browser repl from lein

10:48 so I see I just put the index.html at the root of my clojurescript project. Thanks

10:52 dnolen: seangrove yeah, after getting the built-in browser repl going, the source-maps work

10:53 arkh: how would one assign a method to a javascript object instance via clojurescript?

10:53 I'm trying to override the default behavior of goog.fx.Dragger

10:53 ro_st: you can't register an event handler for it?

10:53 xeqi: stuartsierra: is lein considered part of the clojure platform with regards to support?

10:54 stuartsierra: xeqi: No, Leiningen is maintained by Phil Hagelberg and volunteers.

10:54 arkh: ro_st: I'm trying to assign a function to defaultAction

10:55 ro_st: (set! (.-defaultAction thing) #(println "does this work?"))

10:55 how about that?

10:56 arkh: ro_st: ohhh

10:56 ro_st: that's probably what I need - sorry for the silly question : /

10:56 ro_st: (aset thing "defaultAction" #(println "woo"))

10:56 that'll probably do it

10:57 arkh: ro_st: I'll check those out - thank you

10:57 rurumate: ok, I installed v8 according to clojuresript "Runnning the tests" wiki. Now script/test says "Error: Could not find or load main class clojure.main"

10:58 ro_st: arkh: the only silly question is the one you don't ask :-)

10:58 * gfredericks benchmarks swapping an atom versus sending an agent

10:59 rurumate: has anyone had this problem when running clojurescript's script/test ?

10:59 AimHere: ro_st, I'm just glad he didn't ask it!

10:59 tbaldridge: gfredericks: atom will be much faster, it's basically the cost of locking a CPU cache line

11:00 gfredericks: for even more performance you can always drop to Java's AtomicReference

11:02 stuartsierra: or AtomicLong if you're only storing an integer.

11:02 tbaldridge: (inc stuartsierra)

11:02 lazybot: ⇒ 4

11:02 tbaldridge: wow, so low? Let's do that a few times more

11:02 (inc stuartsierra)

11:02 lazybot: ⇒ 5

11:02 stuartsierra: heh.

11:03 dnolen: rurumate: did you run the boostrap script?

11:03 rurumate: dnolen: no

11:04 dnolen: rurumate: you need to do that first

11:04 squidz: cool

11:05 gfredericks: tbaldridge: I thought that might be the case; my naive gut though was to go with agent due to not having to contend

11:05 tbaldridge: gfredericks: the sad thing is, you still have to contend for the agent's queue. So agents use AtomicReferences.

11:05 gfredericks: tbaldridge: yeah that was my less naive fear

11:06 eventually I concluded I should just measure the dang things :)

11:06 5 microseconds for the agent, 200 nanoseconds for the atom

11:06 tbaldridge: nah, I prefer to measure last. Always assume, it's more exciting when you do benchmark that way. :-P

11:07 Kalimar: Good morning

11:07 mmoriarity: Good morning!

11:09 hhenkel: Hi all, what is the best way to do simulate nested for loops in clojure? I used postwalk before, but how would I recognize if I'm in an explicit subtree?

11:11 opqdonut: nested for loops? why not just:

11:11 ,(for [a [[1 2 3] [4 5]] b a] {:value b})

11:11 clojurebot: ({:value 1} {:value 2} {:value 3} {:value 4} {:value 5})

11:11 opqdonut: or did you mean something else?

11:13 hhenkel: opqdonut: I got a tree structure containing multiple levels. I want to walk a part of it and substitute some values if I'm underneath a certain tree.

11:14 Something like, if I find ":type" and I walked, domain, and servers before I want to substitude it.

11:14 opqdonut: I'd start by writing out the straightforward recursive implementation

11:15 but maybe that's just me

11:16 jstew: Same here. When I see the word tree, my brain automatically says "recursion".

11:19 hhenkel: opqdonut: jstew: That's the same with me, but I'm currently not able to develop that in clojure as this it to new to me...

11:20 I guess I should loop and recur for that, right?

11:20 ro_st: hhenkel you might find that clojure.zip is more suited to what you're after

11:20 gleag: That's not just you, it's the same thing that makes people who see a crystal immediately think "symmetry groups".

11:20 Generally, it's called "factual relevance" :)

11:21 jstew: hhenkel: Yes, loop/recur is best if your tree size is not very small, or if it's of an unknown length.

11:21 AimHere: hhenkel, that's one way. Often a recursive function with a 'reduce' in it is a good fit too, depending on what exactly you're up to

11:23 jstew: clojure.zip looks very nice as well. I didn't know about it until just now. Thanks, ro_st.

11:24 hhenkel: ro_st: jstew: AimHere: okay, thanks for your input. I'll check if I get a step forward.w

11:25 ro_st: happy hunting :-)

11:28 ddellacosta: hhenkel: yeah, I was going to say what jstew said, check out clojure.zip and Huet's zipper data structure (http://en.wikipedia.org/wiki/Zipper_(data_structure))

11:28 oh, and what ro_st said too...haha

11:31 TimMc: Hmm, how come I see all these #<Var: --unnamed--> in (get-thread-bindings)?

11:34 ,(remove #(.ns (key %)) (get-thread-bindings))

11:34 clojurebot: ([#<Var: --unnamed--> #<DynamicClassLoader clojure.lang.DynamicClassLoader@12be529>] [#<Var: --unnamed--> 0] [#<Var: --unnamed--> 0])

11:35 TimMc: ,(map (comp meta key) (remove #(.ns (key %)) (get-thread-bindings)))

11:35 clojurebot: ({:ns nil, :name nil} {:ns nil, :name nil} {:ns nil, :name nil})

11:38 kanja: I'm looking at building a webapp in clojure as a first project - does anyone have an opinion on compojure or pedestal?

11:38 ro_st: start with ring and compojure and enlive or hiccup

11:38 rkneufeld: kanja: For simple web apps Compojure or luminous is probably your best bet (saying this as one of the team members on pedestal)

11:39 ro_st: pedestal is aimed at 'in the large' apps

11:39 kanja: ah ok

11:39 so start with compojure to skill up and then make an informed decision to use pedestal

11:39 jstew: kanja: I like compojure. It's simple. Pedestal seems like a really huge learning curve. Might pay off for a very large system.

11:39 endou: the client side of Pedestal look really interesting, I loved the documentation it's really sensible

11:40 rkneufeld: yeah, it is important to consider pedestal-app and pedestal-service separately

11:40 ro_st: kanja: you could start with pedestal services and ignore pedestal app for now, especially if you want to muck around with stuff like HTTP SSE

11:41 kanja: ro_st: that would probably get me up to speed quicker

11:43 enlive and hiccup are both for html templating?

11:43 TimMc: nDuff: Here's a pastebin you might like: http://code.solusipse.net/

11:44 ro_st: kanja they have different approaches

11:44 nDuff: TimMc: Hmm. I'm already pretty happy with sprunge.us and ix.io in the "easy to feed to from CLI" category.

11:44 ro_st: hiccup turns clojure data into html. enlive transforms html files from disk

11:45 kanja: ro_st: That is an excellent way to explain it, thank you. It sounds like enlive might be better for me to look into as it fits the style I'm used to working in

11:45 ro_st: cool :-) enlive also supports simple bits of hiccup in its transforms, so using both is perfectly an option

11:46 kanja: oh sweet

11:46 ro_st: perfectly acceptable as an option*

11:47 jstew: I am really digging angular-js on the frontend, and using ring/compojure for JSON. It's making web dev fun again for me.

11:55 tangrammer: Hi folks! Does anyone know where to find a clojure tele-work/telecommute job?

11:57 mgaare_: tangrammer: hook up with a recruiter that specializes in jvm languages and then wait :D

11:58 nDuff: tangrammer: ...having a corpus of publicly-visible work isn't a bad place to start either.

11:59 mgaare_: what's the preferred solution for handling situations where you're using ->, but there's one form where you need to move the argument to the end in just one of the forms?

11:59 tangrammer: mgaare_: thanks! but... any clues to find that recruiter?

11:59 mdrogalis: mgaare_: Maybe not thread then.

12:00 tangrammer: nDuff: thanks nDuff, but can you help me a little more? I don't know how scape from js

12:01 mgaare_: tangrammer: depends on your location

12:01 tangrammer: mgaare_: I live in spain

12:02 mgaare_: but currently i'm working for a NY company

12:02 mgaare_: telecommute js developer

12:04 nDuff: tangrammer: ...well, find some OSS projects you can contribute to on your own time; if you can find an open niche to fill, all the better. Since you're working with JS now, CLJS might be a good place to focus.

12:04 pbostrom: mgaare_: it's kinda ugly but you can wrap the form in a 1-arg anonymous function

12:05 nDuff: tangrammer: ...maintain a well-known library, and that's a very big foot in the door anywhere that uses it.

12:07 mgaare_: tangrammer: some of your coworkers might know of recuirters in the area

12:08 pbostrom: yeah, was hoping someone had a prettier solution :D

12:09 tangrammer: mgaare_: good advise! thanks you are very kind!

12:09 nDuff: good advise! thanks you are very kind!

12:17 jstew: IMO, clojure is a wide open frontier. Lots of things in other languages exist that have no clojure equivalent yet.

12:18 endou: and the other way around too

12:18 hyPiRion: yeah. core.logic is one example

12:21 gfredericks: how does one run a single test from nrepl.el?

12:21 ditto for a single namespace

12:21 borkdude: gfredericks call the test like a function?

12:23 jstew: gfredericks: in nrepl.el C-M-n will switch to the current namespace, then you just call whatever function you want.

12:25 borkdude: C-M-n doesn't work in my setup, I use C-c M-n

12:26 I don't understand why I need to do an nrepl-eval-buffer before I can use any of the functions of the namespace I switch to though

12:26 cmajor7: stuartsierra: will Congnitect be a "Typesafe" for Clojure?

12:26 borkdude: gfredericks (run-tests) will then just run the tests from the current namespace

12:27 tbaldridge: cmajor7: how would you define "be a Typesafe"?

12:27 borkdude: gfredericks or you can run one test by just calling it like a function

12:27 leifw: tbaldridge: I think the question is "does 'scala : typesafe :: clojure : cognitect' hold"

12:28 cmajor7: tbaldridge: scala roof

12:28 tbaldridge: leifw: if you define that as "offers commercial support" then yes: http://www.cognitect.com/support#clojure-support

12:29 borkdude: maybe some companies are willing to use clojure if they know there is support and commercial backup for it

12:29 some = more

12:29 tbaldridge: (inc borkdude)

12:29 lazybot: ⇒ 1

12:30 gfredericks: borkdude: I need the fixtures to run

12:30 cmajor7: tbaldridge: well, more of a "who owns it, who can "they" trust their dollars, is that thing (Clojure/Script/Tomic) for real, going to be marketed as a Clojure homeland, etc…"

12:31 borkdude: gfredericks I haven't used those yet, did most things manually with the test-ns-hook

12:32 gfredericks: borkdude: the (run-tests) call looks good though; wasn't aware of that

12:32 borkdude: thx

12:32 borkdude: gfredericks I guess I need to read up on those :)

12:32 gfredericks you can also pass it a namespace symbol to run a different namespace

12:32 gfredericks lein test :only … also accepts a namespace

12:33 stuartsierra: cmajor7: I don't think we know the answer to that yet.

12:33 gfredericks: borkdude: yeah, I knew how to do it from the command line; I'm exploring the low-latency options

12:34 borkdude: type and safe are both a bit boring words, cognitect will may be more exciting than just type safety ;)

12:34 technomancy: gfredericks: grench!

12:34 cmajor7: stuartsierra: makes sense. in any case, good to centralize the forces and answering the question "where does Rich work" :)

12:34 * gfredericks watches technomancy swoop away having contributed his single syllable

12:34 technomancy: gfredericks: with such gusto tho

12:35 gfredericks: $google clojure grench

12:35 lazybot: [Raw clojure.main repl hangs · Issue #6 · technomancy/grenchman ...] https://github.com/technomancy/grenchman/issues/6

12:35 technomancy: oh nice; link straight to a closed bug as the first hit lazybot

12:35 hyPiRion: why not

12:35 gfredericks: technomancy: I googled it privately first and assumed that link was irrelevant and was just trying to publically demonstrate that

12:36 technomancy: this is your old idea of a CLI nrepl client to a persistent leiningen process?

12:36 technomancy: it is

12:36 mgaare: gfredericks: you can also use clojure-test-mode, go to the buffer with the tests and C-c M-, on the test you want

12:36 gfredericks: this would still mean launching a project jvm every time

12:36 I'm trying to satiate the TDD masses here

12:36 technomancy: gfredericks: not necessarily

12:36 gfredericks: also "learn a whole new build tool" is a bit prohibitive

12:37 technomancy: it should be a drop-in replacement, like drip

12:37 and you can keep your project JVM warm

12:37 that said it's really new and only has a handful of people using it regularly

12:38 also it's named after a metafictional nazi skinhead high-school band; not sure if that matters to you personally

12:38 hyPiRion: Only the bleeding edge pros

12:39 gfredericks: metafictional means doubly fictional?

12:39 technomancy: gfredericks: in this case yes. it might have other connotations elsewhere.

12:39 mtp: metafictional means 'fiction about fiction'

12:39 hyPiRion: fiction in fiction at least

12:46 rurumate: dnolen: Ok, script/bootstrap helped with that. Now script/test produces a compile error "Invalid token: ::other/foo"; see http://pastebin.com/X8VL00fp Any ideas?

12:47 danielszmulewi-1: technomancy: how does grenchman fit with working in emacs (nrepl)?

12:48 technomancy: if at all

12:48 technomancy: danielszmulewi-1: they're pretty much orthogonal

12:48 grenchman is basically (among other things) a reimplementation of reply

12:48 dnolen: rurumate: looks like there still something wrong w/ your setup. It's using Clojure's reader instead of tools.reader

12:48 technomancy: which nrepl.el is also a replacement for

12:49 danielszmulewi-1: technomancy: can you launch a nrepl connected with grenchman, or am I out of line?

12:50 technomancy: I know I might be missing the point

12:50 technomancy: danielszmulewi-1: right now you manage the nrepl processes out of band; that's currently outside the scope of grenchman

12:50 because it's difficult to create a flow that manages process state implicitly without hiding too much (see cake)

12:51 danielszmulewi-1: technomancy: so you issue commands from the cli with grenchman?

12:51 technomancy: right

12:51 rurumate: dnolen: all I did was clone, then script/bootstrap && script/test

12:51 technomancy: you start a lein server, then you can s/lein/grench/ for all commands

12:52 dnolen: rurumate: sorry can't help you trouble shoot atm, perhaps someone else can.

12:52 danielszmulewi-1: technomancy: OK, I should try it out. Most of the time, I'm busy in my project, concerned with reloading code or reevaluating functions. Not much a use case here, iight?

12:52 right?

12:52 technomancy: danielszmulewi-1: no, you can also keep a project JVM hot for an even greater boost

12:53 danielszmulewi-1: technomancy: oh, so there is a use case. Definitely I should look into it.

12:53 technomancy: so if you want to run a lein task (like doing a test across multiple namespaces, which nrepl.el doesn't attempt) you could do it quickly with grench

12:53 danielszmulewi-1: technomancy: yes, true that.

12:54 technomancy: but for quick "does this change I made still work with this function call I'm running in the repl" it doesn't make sense for emacs users

12:55 danielszmulewi-1: technomancy: OK, cool. Sounds intriguing. At least I already installed OCaml. :-)

12:55 technomancy: nice

12:56 eric_normand: has core.async been updated to work with the new keywords in clojurescript?

12:56 tbaldridge: eric_normand: yes, but the latest release has not been cut yet from what I know. So I'm currently using the latest ClojureScript with 0.1.0-SNAPSHOT

12:56 eric_normand: tbaldridge: thanks!

13:00 jstew: Slightly OT: What color theme are you emacs users using? Zenburn is starting to zenburn my eyeballs.

13:01 technomancy: jstew: monokai is a nice change of pace

13:01 it's not as mellow as zenburn though

13:01 xeqi: monokai here

13:01 mbarbieri: Hi, advice please: I have a pretty big data structure (a map of maps of vectors of maps) with fixed keys and values, don't need to change them, no need of Java interoperability. At the beginning I had all keys-values hand written, now I'm starting using function to generate pieces of this structure and avoid repetition, would it be better to use records?

13:02 jstew: monokai. I'll try that one. Thanks.

13:03 Raynes: jstew: I'm a fan of base16

13:03 https://github.com/chriskempson/base16

13:04 jstew: Pretty.

13:04 jkkramer: mbarbieri: maps are probably fine. prismatic's schema might help you document and validate the shape of your data - https://github.com/Prismatic/schema

13:04 eric_normand: anybody going to be at Strange Loop this week?

13:05 technomancy: eric_normand: yesss

13:06 mbarbieri: jkkramer: thanks, will look at that

13:06 Raynes: No, eric_normand, not a single person is going to strangeloop.

13:06 eric_normand: Raynes: well, it was worth a shot :)

13:06 Raynes: I thought it might interest people in this chatroom

13:08 callen: JStoker: I use a custom one. github.com/bitemyapp/dotfiles/

13:09 eric_normand: technomancy: looking forward to any sessions in particular?

13:10 callen: mbarbieri: definitely just use maps.

13:10 mdrogalis: eric_normand: Couldn't get there this year, hopefully next.

13:10 The talk list looks awesome.

13:10 eric_normand: I agree

13:10 mdrogalis: just trying to narrow it down

13:11 muhoo: heh, t-mobile templating fail: $ {{plan.price}} per month

13:12 someone's using moustache.

13:12 callen: mustache*

13:12 muhoo: (or some javascript thing on the client side, i have noscript)

13:12 callen: wonder how the template flew past unrendered.

13:13 muhoo: mustache is a client-side lib too. Could be handlebars.

13:13 mdrogalis: Closing song from Cognitect's podcast is excellent.

13:14 bja: could be django/jinja2 too

13:14 and something escaped from the backend

13:14 {{ }} is pretty common

13:16 callen: bja: I don't think it was Django/Jinja, that's not how the templates render.

13:16 you can't have a raw template slip past like that unless you're doing something wrong.

13:16 more likely it was mustache/handlebars/some derivative of Jinja, and it's probably a frontend template.

13:20 muhoo: huh, i didn't know pedestal was a relevance thing

13:22 supersym: yup... btw, anyone done some device detection in ring yet?

13:23 callen: supersym: that doesn't really compute. Device detection?

13:23 Ring is just an HTTP abstraction.

13:23 supersym: well... server-side user-agent I guess

13:23 yeah.. well what I wanted to know if there is anything more to it then just fetching that out of the header

13:23 callen: you shouldn't really do things with the user-agent server-side or frontend.

13:24 supersym: I guess my formulation was off, callen... :)

13:24 callen: you just fetch it out of the headers.

13:24 darrickw: Just tried adding :source-map to a small clojurescript project I'm working on, formerly complied fine but now I get an NPE.

13:24 supersym: see I see all these folks on the web talking about server side device API and db etc... I don't get what they are talking about

13:24 the 'why' since I thought there wouldn't be much more to it then, indeed, like you just said

13:26 darrickw: My deps are core.async, core.match, and crate. Are any of those incompatible with the latest CS snapshot?

13:26 muhoo: supersym: the trendy thing now is responsive design with css on the client side instead of trying to guess on the server side based on user-agent

13:26 mdrogalis: darrickw: Almost definitely not.

13:27 supersym: muhoo: well.... yes and no :)

13:27 dnolen: darrickw: source map functionality is not heavily tested, assume things will not work at all with incremental compilation

13:27 supersym: trendy thing: yes, thats true

13:27 dnolen: darrickw: you need to always lein cljsbuild clean as far I can tell currently (patches / detailed bug reports welcome of course)

13:28 darrickw: Thanks dnolen, that was all it took

13:30 supersym: muhoo: I was thinking more in the line of something I see is now called RESS, btw Twitter also changed back to server-side rendering

13:31 callen: supersym: that doesn't change what muhoo said, he's correct that you should just design your CSS responsively and not change content based on user-agents. Ever.

13:31 changing content based on user-agents is some 1998 bullshit man. I thought people learned their lesson there.

13:31 supersym: oh ok... I didn't say I wanted to do that right

13:32 haha

13:32 tupi: hello, a license related quiz: can I attach a GPL v3+ to my clojure source code?

13:32 muhoo: callen: i didn't say it so dogmatically or emphatically though :-)

13:32 AimHere: tupi > You can attach it to your own code

13:32 tupi: AimHere: ok, thanks

13:32 AimHere: The source code of clojure proper is available under the EPL

13:32 muhoo: i just said it's trendy. whether it's good or not, i'm fine with letting others decide based on their needs.

13:32 tupi: that is what I wantd to know

13:32 technomancy: tupi: some people claim it's OK if clojure itself is your only EPL'd dependency

13:33 tupi: but it would be difficult to write a clojure program and not pull in other EPL'd code

13:33 supersym: muhoo: I know ;) thanks for your input

13:35 muhoo: and, speaking of t-mobile, and user-agent checking, they inspect and proxy traffic on port 80 and block it based on user-agent. if you have chrome on linux, you're golden. use firefox, and you get blocked. use anything on windows, and you get blocked. any ssh or imap or other protocols sail through.

13:35 callen: muhoo: there are subjects that merit wriggle-room. That ain't one of them.

13:35 muhoo: o_O

13:36 you mean tethering?

13:36 tupi: technomancy: i need to check with imagej 'people/license', but right now i am not pulling any other code then imagej

13:36 muhoo: i guess that's to stop people tethering, yeah.

13:36 it's along the lines of using rot13 as an encryption algorithm

13:36 callen: aha! Relevance and the Datomic people merged

13:36 supersym: hehe

13:36 technomancy: muhoo: https://addons.mozilla.org/en-US/firefox/addon/firesomething/

13:36 callen: there's going to be one uber-company in Clojure X_X

13:37 muhoo: technomancy: fun, thanks.

13:38 technomancy: and since you're here.... what is the magick lein invocation to inject a form to execute when doing repl :conect ?

13:38 i.e. i want to connect to a repl, change to a ns, and execute some code, before i get a repl prompt.

13:38 callen: http://exercism.io/

13:39 technomancy: muhoo: I guess :repl-options :init

13:39 borkdude: H4ns you can include a directory like test-resources explicity using the :resources option in leiningen (reacting to something you said 12 hours ago or so)

13:39 muhoo: technomancy: bare on the comand line? or as update-in [:repl-options :init] ?

13:40 borkdude: is there a service that allows you to view the parts from an irc channel you missed, and I don't mean leave your machine on all night or look up log files… something more smoothly, a bit like hipchat maybe?

13:40 technomancy: muhoo: oh, huh. probably put it in a profile and do `lein with-profile +repl-init repl :connect ...`

13:40 muhoo: i was trying to do it without having to create a profile just for that

13:41 technomancy: unless you need to specify it as a cli arg; then update-in would be needed

13:41 muhoo: right, on the cli would be most convenient.

13:41 technomancy: probably an update-in alias

13:41 TimMc: callen: I'm just surprised to learn Datomic had any pretension of being separate from Relevance...

13:41 callen: TimMc: I figured it was going to happen eventually.

13:41 So, I gave paredit and ac-nrepl the old college try again. I'm faster without both of them.

13:42 I've been editing parens in Emacs too long to find paredit helpful - interferes more than anything.

13:42 borkdude: callen paredit crashed my emacs when I pasted a big datomic schema file

13:42 it was reproducible

13:43 darrickw: dnolen: apologies, actually that didn't fix it -- I had the source map option commented when I tried earlier. Still getting the same NPE

13:43 borkdude: able

13:43 callen: borkdude: lol

13:43 borkdude: ac-nrepl made my REPL sessions really slow too.

13:43 AimHere: I find paredit the same way. I'm so used to editing s-expressions in my own order that I have to do all sorts of jiggery-pokery to make the closing parens in the right place

13:44 borkdude: I use paredit, but sometimes I turn it off when I am in an invalid state due to copy pasting ;)

13:45 technomancy: merge conflicts are an easy way to make it mad at you

13:45 borkdude: technomancy oh yes, happened to me today

13:48 H4ns: borkdude: thanks! that was suggested to me earlier and it works very well

13:49 borkdude: TIL you should never use the Github app and press sync

13:49 callen: borkdude: definitely not.

13:49 Git was not made for muggle-mode.

13:49 TimMc: What does sync do?

13:50 borkdude: TimMc I think push and pull but I don't know in what order

13:50 callen: but against which remotes and branches? nobody knows!

13:50 :P

13:50 technomancy: callen: GitHub is a lot less hostile than git, in general

13:51 but one button for push+pull sounds like an awful idea

13:51 borkdude: I rebased my branch onto a master branch

13:51 and then pressed sync and weird shit happened

13:52 callen: technomancy: I like some parts of github, but the desktop app + sync thing is really bad.

13:53 technomancy: speaking of github and bad ideas, does anyone have a user stylesheet to disable their stupid language breakdown bar?

13:53 borkdude: I like the visual overview of the current changes it gives, but probably I shouldn't use anything other than the shell to do stuff

13:55 darrickw: dnolen: FYI, solved my clojurescript source-map issue. The problem was that I had :optimizations :whitespace. In :advanced mode, it builds fine.

14:05 borkdude: is cognitect also going to deliver support for clojureclr? ;)

14:11 eric_normand: dnolen: got source maps working. looks good.

14:11 callen: I can't get consumer tag based consumer cancellation working with Langohr "Unknown consumerTag" - anybody else encounter this?

14:12 eric_normand: dnolen: one problem is that it puts the whole path of the output file in the file, even though they are in the dir

14:12 dnolen: I'm thinking about how I would patch it

14:20 After warming up, new cljs compiler takes 6.5s to compile with advanced optimizations

14:27 dnolen: darrickw: it should work w/ whitespace optimizations too

14:27 darrickw: I tried it myself yesterday and it seemed to work - there may be other issues at play

14:28 darrickw: if you can construct a minimal case please open a ticket with details

14:29 eric_normand: thoughts welcome, I don't have any great ideas there.

14:33 mdrogalis: 12:25 http://www.infoq.com/presentations/Design-Composition-Performance Is he talking about tools like Cucumber and FitNesse?

14:33 I could have sworn I heard him say in another talk that he didn't like testing frameworks like that.

14:34 eric_normand: dnolen: getting weird behavior from PersistentArrayMap

14:35 dnolen: eric_normand: I assume this unrelated to source maps?

14:35 eric_normand: yes

14:35 turned off source maps

14:35 and optimizations

14:35 dnolen: that is, default optimizations

14:36 dnolen: eric_normand: you mean :optimizations :none?

14:36 eric_normand: dnolen: no, no key in the cljsbuild map

14:36 dnolen: let me try with :optimizations :none

14:38 dnolen: ha! doesn't work at all. forgot about that.

14:38 dnolen: Need to include all of goof.*

14:38 goog.*

14:38 sorry, automcomplete!

14:40 bja: dnolen: have you encountered any issues with Closure Compiler's CommandLineRunner.getDefaultExterns() not finding the externs.zip?

14:40 eric_normand: dnolen: ok, it's working.

14:40 dnolen: I just had to delete all the prior output

14:41 dnolen: and recompile

14:41 dnolen: bja: nope

14:41 eric_normand: k, this happens if you upgrade ClojureScript and don't clean

14:41 bja: I found a way through cljs's compiler that takes an alternate path (specifying the compiler option :use-only-custom-externs), but I was hoping this is a known issue and just not something with my setup

14:42 eric_normand: dnolen: yeah, that's what happened

14:42 dnolen: sorry to bother you

14:44 callen: technomancy: I was thinking the same thing.

14:49 dnolen: bja: I'm not aware of it, feel free to open a ticket with an explanation if you think it's a problem, higher likelihood of resolution if you attach a patch ;)

14:49 jweiss: .printStackTrace can take a printwriter or outputstream arg, isn't there some straightforward clojure way to get the string representation?

14:49 i looked at clojure.java.io but didn't see an obvious way

14:49 bja: jweiss: have you checked out how pp does it?

14:50 err, pst

14:50 jweiss: bja: i know how to manually create a stringwriter, printwriter, etc

14:52 bja: it does everything itself :)

14:52 i just want to do .printStackTrace but have the result go to a string instead of stdout. i don't want to use with-out-str (i am not sure if other threads writing to stdout would get mixed in there)

14:53 coventry`: jweiss: with-out-str uses the binding macro on *out*. I think that's thread-local.

14:54 jweiss: coventry`: wouldn't other threads writing to stdout also end up being written there?

14:56 coventry`: jweiss: I'm basing this on "The dynamic var system, exposed through def, binding, et al, supports isolating changing state within threads." <http://clojure.org/concurrent_programming>. Should be easy enough to test.

14:57 jweiss: coventry`: my point is that the jvm's stdout knows nothing about clojure var system

14:57 it's just a stream

14:57 eric_normand: jweiss: you are right

14:58 jweiss: *out* is for clojure functions

14:58 coventry`: Oh, I see.

14:58 eric_normand: jweiss: the standard way to do it is to create a printwriter

14:59 jweiss: then slurp it in as a string

14:59 jweiss: yeah, i figured something in clojure.java.io would do that for me

14:59 but i'm not seeing it

15:00 eric_normand: jweiss: or maybe try clojure.repl/pst

15:00 jweiss: it may print to *out*

15:00 jweiss: I'm not sure

15:01 jweiss: right, same issue there and it uses its own format anyway

15:01 eric_normand: jweiss: I see

15:02 jweiss: ,(let [e (doto (Exception. "Fooey") (.fillInStackTrace)) sw (java.io.StringWriter.)] (.printStackTrace e (java.io.PrintWriter. sw)) (println (.toString sw)))

15:02 clojurebot: #<SecurityException java.lang.SecurityException: denied>

15:02 jweiss: ,(let [e (doto (Exception. "Fooey") (.fillInStackTrace)) sw (java.io.StringWriter.)] (.printStackTrace e (java.io.PrintWriter. sw)) (.toString sw))

15:02 clojurebot: #<SecurityException java.lang.SecurityException: denied>

15:02 jweiss: bah

15:08 eric_normand: jweiss: looks like it works though

15:12 (defn st-str [e] (with-open [sw (java.io.StringWriter.) pw (java.io.PrintWriter. sw)] (.printStackTrace e pw) (.toString sw)))

15:12 ,(defn st-str [e] (with-open [sw (java.io.StringWriter.) pw (java.io.PrintWriter. sw)] (.printStackTrace e pw) (.toString sw)))

15:12 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

15:15 eric_normand: ,(let [st-str (fn [e] (with-open [sw (java.io.StringWriter.) pw (java.io.PrintWriter. sw)] (.printStackTrace e pw) (str sw)))] (try (/ 0 0) (catch Exception e (st-str e))))

15:15 clojurebot: eric_normand: excusez-moi

15:15 eric_normand: ,(let [st-str (fn [e] (with-open [sw (java.io.StringWriter.) pw (java.io.PrintWriter. sw)] (.printStackTrace e pw) (str sw)))] (try (/ 0 0) (catch Exception e (st-str e))))

15:15 clojurebot: eric_normand: It's greek to me.

15:15 eric_normand: come on!

15:15 jweiss: anyway, that works on my machine

16:33 dnolen: how does one test the cljs compiler?

16:34 dnolen: eric_normand: there's no good way to test the compiler currently.

16:38 eric_normand: dnolen: ok, I'll figure it out

16:38 dnolen: eric_normand: what's the problem?

16:38 eric_normand: dnolen: writing a patch for the source map relativizing files

16:39 dnolen: just wanted to make sure I didn't break anything

16:39 dnolen: eric_normand: nice, what about JARs and files served http:// (I don't remember if these get cached locally) ?

16:40 darrickw: dnolen: I just got a chance to try to put together a minimal case for my :whitespace problem. It fails in even the very simplest case, so there's not much to report. (:advanced still works fine)

16:40 dnolen: darrickw: yes but I got it to work just fine :)

16:40 eric_normand: dnolen: I am not sure how those work

16:40 dnolen: darrickw: so a minimal project and the minimal steps still needed.

16:40 eric_normand: patch will need to address those cases.

16:41 darrickw: I even used the defproject from your blogpost… ok. I'll put up a gist of the whole project for you :)

16:41 dnolen: eric_normand: otherwise I'm unlikely to look at it.

16:41 eric_normand: dnolen: ok, I'll have to come up with a test case

16:41 dnolen: darrickw: with the precise steps on the command line to recreate error, thanks!

16:41 darrickw: ok

16:42 eric_normand: dnolen: but this does generate a relative path to the source map

16:42 appendonly: i want to understand clojure's implementation better, specifically where the boundary between host (jvm/clr/v8) and runtimes lies. is reading 'clojure in small pieces' the best way to approach this?

16:43 dnolen: eric_normand: maybe I'm missed something, is the "files" v3 source map entry relativized? or are you working on something else?

16:45 eric_normand: dnolen: the URL in this string is a relativized path: //@ sourceMappingURL=cs2.js.map

16:45 dnolen: it was //@ sourceMappingURL=extension/cs2.js.map

16:45 dnolen: but in the file extension/cs2.js

16:45 dnolen: eric_normand: k sorry I was confused :) what is the relativization based on?

16:46 eric_normand: dnolen: based on output-to option

16:46 dnolen: eric_normand: k this sounds good.

16:47 eric_normand: dnolen: and a slightly modified cljs.closure/path-relative-to

16:47 dnolen: I assume the browser can figure it out if it is relative

16:48 dnolen: but I am testing on another project right now that serves up files over http

16:51 mtm: darrickw: just caught the tail end of your thread: are you having a problem with an NPE when trying to use :source-map with :optimaztions :whitespace?

16:51 darrickw: yeah

16:52 mtm: it looks like "var CLOSURE_NO_DEPS = true" is being cons'ed into 'sources' in cljs.closure/optimize; I'm not sure why, but it seems wrong to add a string there

16:55 later the code tries to get either :url or :source-url from that string (which, of course, returns 'nil') and then call .getPath on it, thus NPE

16:57 this "var CLOSURE_NO_DEPS = true" is only added to 'source' when :optimizations is :whitespace, which is why things work in :simple and :advanced

16:57 /s/sources/source

16:58 dnolen: mtm: http://dev.clojure.org/jira/browse/CLJS-373

16:59 callen: ClojureWerkz: We don’t have a new company to record podcasts about but we have 3 new libraries to announce this year.

16:59 mtm: interesting, but is 'sources' the right place to add this?

17:02 dnolen: mtm: this capability is intended as far as I know

17:03 mtm: but in this case I guess that could be added later the same way we handle the output-wrapper and stuff like that.

17:04 mtm: okay, but the code at closure.clj:726 is going to blow up when it gets to that string (source == "var CLOSURE_NO_DEPS = true")

17:04 yeah, sounds right

17:06 dnolen: mtm: hrm, but really we should probably just filter out things that don't have :source-url or :url ...

17:06 mtm: yup

17:10 dnolen: mtm: http://dev.clojure.org/jira/browse/CLJS-590

17:10 darrickw: ^

17:11 mtm: thanks David

17:13 eric_normand: dnolen: ok, works when served from http

17:14 dnolen: eric_normand: cool

17:14 eric_normand: dnolen: I assume you would like a jira issue + patch?

17:14 darrickw: Thanks to both of you! :)

17:15 dnolen: eric_normand: yep

17:15 eric_normand: dnolen: ok, doing it now

17:23 mgaare: is it not possible to add a docstring to a defrecord?

17:24 eric_normand: dnolen: ok, the patch is there; 5 line change

17:29 dnolen: eric_normand: thanks will take a look!

17:38 dobry-den: im so glad lein has that "enable ironic name" switch. my first 5 clojure apps were named "*jure".

17:38 technomancy: hm; I should probably add a rate limiter to that

17:38 5 is too many

17:40 dobry-den: sometimes you just need to hit rock bottom before you can improve as a person

17:41 5th one did it

17:41 eric_normand: now all of your projects are clj-* ?

17:42 xeqi: or literary characters?

17:42 eric_normand: or s/s/j/

17:45 dobry-den: yeah, that's the thing. Python has it easy with it's "Py" prefix.

17:45 noonian: is it possible to pass aggregate values as parameters to lein run? for example: 'lein run -m foo/bar {:baz "zap"}', the argument parsing is breaking it for me I think

17:45 dobry-den: Clojure has Clo* puns and *jure puns. Both of which are hard

17:45 and clj is just an ugly combination of characters

17:46 look at it

17:46 clj

17:46 technomancy: I'm glad we don't see a lot of foo4j-isms

17:47 what language your library is implemented in is really not something I care about seeing in clojars search results

17:48 dobry-den: how about an oauth clojure library named Cloth

17:48 how cute is that

17:48 technomancy: it is, in the vernacular, totes adorbs.

17:49 callen: dobry-den: that's pretty cute.

17:50 eric_normand: I prefer the name "Rhododendron"

17:50 dobry-den: but that's the thing - how are you going to remind the world that you reinvented the java.net.oauth wheel in Clojure just because it's Clojure this time?

17:50 the only option is to name it Clothjure.

17:50 callen: nooooo

17:50 Cloth was perfect :(

17:50 eric_normand: maybe clojAuth

17:50 dobry-den: i don't make the rules

17:51 the world's gotta know

17:51 eric_normand: I'd *buy* a library called Clothjure

17:51 dobry-den: i can serve that dish

17:51 eric_normand: lein buy clothjure

17:53 callen: I still think the best *-jure name was stolen by Seajure.

17:53 dobry-den: is that french?

17:53 no, it's my clojure oauth library

18:04 mtp: Seajure is pretty good

18:29 pandeiro: i'm getting java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.limit(Ljava/io/InputStream;J)Ljava/io/InputStream; when trying to cljsbuild with cljs 0.0-1889 -- do i need to manually fetch the compiler somewhere?

18:34 supersym: pandeiro: you're using lein-cljsbuild?

18:35 pandeiro: yes

18:38 quick scan of m2 shows no com.google.common.* so i assume that is the problem but i can't see how to do an update

18:38 supersym: Im not sure on that cljs version number, 0.3.2 mentions 1806, but its at 0.3.3 now not sure if they bumped to that upstream number

18:39 amalloy: pandeiro: that's an exception you only get if you AOT against version x of google commons, and then run against another one

18:40 pandeiro: i tried with both 0.3.3 and 0.3.4-SNAPSHOT

18:40 amalloy: so i gotta clean something somewhere?

18:40 target?

18:40 amalloy: *shrug* the cljs build process is a complete mystery to me

18:41 supersym: amalloy: glad to hear I'm not the only one

18:42 pandeiro: all this is my latest desperate attempt to make the cljs/js divide invisible

18:43 dnolen: pandeiro: your problem sounds unrelated to CLJS or lein-cljsbuild to me

18:43 supersym: pandeiro: yeah it's probably in .m2 somewhere, stuff runs fine here... how about a `lein deps :tree`

18:44 see if/where conflicts might be

18:45 pandeiro: it doesn't happen when i do not specify a clojurescript dependency specifically

18:46 (it = http://sprunge.us/OBAB)

18:47 supersym: ok... I get the warning, then specify 1889 - works fine here too

18:47 pandeiro: k must be on my end then... i'll keep investigating

18:48 thanks for checking

18:48 supersym: ah guava, I had problems with that too

18:48 earlier

18:49 not sure what the cause was though, just that I couldn't get them to play nicely, and I didn't need it so bad that I probed for long

18:49 pandeiro: yeah lein cljsbuild 0.3.2 will compile my code fine if a cljs dep is not specified...

18:50 supersym: yeah...thats a bit odd

18:51 gcganley: hey I've been googling around for a tutorial of clojure for someone that has alot of experience with C++. I havnt been able to find any its bummed me out. there is the Java screencast from Hickey but i did'nt pull much actual coding from that, just alot of philosophical discussion about the design.

18:53 mlb-: I want to create an Erlang-like event manager in Clojure. Would I want to start with a kind of singleton?

18:54 supersym: mlb-: https://github.com/MichaelDrogalis/dire is based on erlang style supervisor, would that be something you could use?

18:56 mlb-: supersym: not quite, but thanks for pointing that out to me!

18:59 In different words, I want a central pubsub object to receive all events, and then route the subset for which subscribers have registered

18:59 appendonly: one 'soft' attribute i'm finding hard with clojure is that the top-level namespace has many tokens. i'm having trouble holding the whole thing in my head, like i would with c or scheme. in the lisp world, i know common lisp also has many top-level tokens in the standard language, often with hungarian notation. are there any clojure-specific tools for vim that would help me here?

19:00 TimMc: appendonly: By "top-level namespace", do you mean clojure.core?

19:01 There's nothing top-level about it, it's just another namespace.

19:01 technomancy: appendonly: one side-effect of learning clojure is that you will undoubtedly re-implement 3-4 functions in clojure.core; it's pretty inevitable.

19:01 noonian: gcganley: I would just look for examples of doing specific things in clojure that you know how to do in C

19:02 appendonly: technomancy :-)

19:02 TimMc: so i could import core with a prefix, and reference everything as core.blah? that would help me in the short run,a nd ic ould do away with it later

19:02 akurilin2: Can a solid case be made for NOT using the destructuring :or to provide default values?

19:02 hyPiRion: appendonly: there are no hungarian functions in Clojure afaik

19:02 noonian: gcganley: and also try to write everything completely functionally without figuring out how to modify anything but instead returning new values

19:02 hyPiRion: appendonly: I found http://clojure.org/cheatsheet to be handy when I started with Clojure

19:03 appendonly: hyPiRion: cheers

19:03 noonian: akurilin2: :or and :as don't play well together, so if you want defaults for some but also want a handle on all the keys you have to do the or's yourself

19:04 TimMc: appendonly: You *could*, using :refer-clojure, but that's gonna look pretty ugly and mess with your editor's ability to indent things appropriately.

19:06 noonian: appendonly: you should only run into problems if you redefine things in your own code and then try to use the core implementation, you should also get a warning in those situations. If you bind a symbol to the same name in a let binding or something you just have to be careful not to call the original one expecting the default behavior

19:11 akurilin2: noonian, hm ok, I'm goign to have to look into that

19:11 thanks!

19:11 bbl

19:11 dnolen: gcganley: what kind of tutorial are you looking for? this is a quick intro http://adambard.com/blog/clojure-in-15-minutes/

19:15 gfredericks: I'm trying to convince myself that I know how to use primitives, but it's not going well

19:15 ,(loop [^long x 0] x)

19:15 clojurebot: #<CompilerException java.lang.UnsupportedOperationException: Can't type hint a local with a primitive initializer, compiling:(NO_SOURCE_PATH:0:0)>

19:16 gfredericks: that error message communicates to me "you can't do the thing you're trying to do"

19:17 amalloy: gfredericks: [x (long 0)], although really 0 is already a long, so...?

19:18 gfredericks: amalloy: so primitives get used by default?

19:18 amalloy: the compiler can tell the type of literal values, and doesn't need any prompting from you to generate efficient code; hints are for when it can't already know

19:19 gfredericks: okay. so if my loop body just has = and + then I should be good

19:20 maybe I should learn how to examine bytecode :)

19:20 amalloy: gfredericks: have you tried nodisassemble?

19:20 it makes it way easier to find bytecode

19:23 gfredericks: amalloy: never heard of it

19:23 amalloy: (println (no.disassemble/disassemble #(loop [x 1, y 2] (= x y))))

19:25 eg, that uses primitive locals, but calls clojure.lang.Util/equiv(long, long), whereas if you use == instead of =, it calls clojure.lang.Numbers.equiv(long, long)

19:26 dunno why, really, since those both just return (x == y)

19:28 gfredericks: amalloy: cool, I'll check that out, thx

19:41 Hari`: hi

19:41 callen: Hari`: hi

19:41 hashcat: Hi

19:42 Hari`: :)

19:42 callen: Hari`: FB?

19:42 Hari`: huh?

19:42 callen: Hari`: checking to see if you were somebody I knew that works at FB

19:42 Hari`: ah

19:42 nope

19:43 i work at a finance startup..

19:44 california

19:44 we use haskell..

19:44 hashcat: good lang!

19:44 Hari`: i joined this clojure irc chat for kicks..

19:44 clojure seems nice too.. i'm new to functional programming etc.

19:45 hi hashcat, are you in the haskell channel? :)

19:46 lol

19:46 hashcat: I've learned Haskell for three years

19:48 but I think it's useless now

19:49 Hari`: hmm

19:49 you didn't use haskell for anything? (or, for any production code...?)

19:50 callen: Haskell is fine, but I don't really want to make production systems with it.

19:50 hashcat: Hari`, I wrote a genetic programming

19:51 just for hobby

19:51 no one use it for production here

19:53 hashcat_: Hari`, what's your company?

19:55 Hari`: FastPay

19:56 hashcat: it sounds fun

19:56 callen: My test runner of late: <up-arrow> (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (run-tests)

19:56 too lazy to fix prism or quickie to work properly.

20:18 coventry: Is there already a function which will invert a map? I.e., #(into {} (for [[k v] %] [v k]))?

20:20 brehaut: coventry: clojure.set/map-invert i believe

20:20 callen: "Clojure: the function already exists"

20:20 technomancy: (comp (partial apply zipmap) (juxt vals keys))

20:20 callen: uh oh, people are pseudo-golfing now.

20:20 technomancy: ~juxt

20:20 clojurebot: juxt is a little hard to grok but it's the best thing ever

20:21 callen: is the juxtaposition of applying the functions that hard to understand?

20:21 brehaut: callen: based on evidence: apparently so

20:21 scottj: callen: no, not that hard, it's a little hard.

20:23 gfredericks: (defn mjuxt [m] (fn [& args] (zipmap (keys m) (map #(apply % args) (vals m)))))

20:23 coventry: brehaut: Thanks.

20:23 clojurebot: No entiendo

20:24 callen: Should start a juxt jihad.

20:24 hashcat: I'm amazed that people in here is more than scala channel

20:24 callen: hashcat: I'm not at all. Clojue is nicer to use.

20:25 hashcat: callen: why not scala?

20:25 gfredericks: it's because scala is so easy that nobody needs to ask for help

20:25 noonian: and easier to look at imo

20:26 brehaut: its because nobody needs help if they have static types

20:26 noonian: clojure is I mean

20:26 coventry: Maybe scala people socialize on twitter. :-)

20:26 gfredericks: brehaut: the compiler tells you exactly what you did wrong and how to fix it

20:26 hashcat: I'm trying to choose one for next project

20:26 scala or clojure

20:26 callen: gfredericks: every single time. Without failure.

20:27 gfredericks: it never once fails to solve the halting problem and tell you exactly what's wrong.

20:27 brehaut: gfredericks: kind mismatch, you might need some phantom types

20:27 callen: "It looks like you're using an if statement, I think you meant to use a monad here?" - Scala Clippy

20:28 then you use a monad, and your type signature is 4 times longer.

20:28 amalloy: (inc brehaut)

20:28 lazybot: ⇒ 18

20:28 gws: "now you have two problems"

20:28 callen: actually, n problems, depending on whether or not you've stepped into the undecidable part of Scala's type system or not.

20:30 gws: s/two/#REF!/

20:30 callen: this is why I prefer stuff like what ambrose is doing. Because I can make the type checker shut the fuck up when I want it to.

20:31 hashcat: well, I have a good idea. how can I mix scala and clojure?

20:31 gfredericks: put some parens around the scala

20:31 brehaut: hashcat: with more difficulty than youwould in using core.typed ;)

20:31 callen: hashcat: don't. just use Clojure and core.typed if you really want types.

20:32 realistically you should just learn Clojure and wait to use core.typed until you understand everything.

20:32 Raynes: hashcat: You said "good idea" and I thought you actually had one for a second there. :(

20:32 Apage43: this is like when folks wanted an available database and a consistent database so we put them in a bowl and mashed them up with a mortar and pestle and now we just have garbage data

20:32 callen: I think you'll find types matter less than usual in Clojure than in other dyn langs.

20:32 you think less about specific types or reifications and more about "shape" and categories of things.

20:33 Apage43: (didn't bother to use the mortar and pestle properly, just used them both as mashing implements, because yes.)

20:33 callen: Apage43: "We defeated CAP theorem! We are Conan the Data Manglers!"

20:33 hashcat: I still would like to try mix them

20:33 callen: "We knew something everybody else didn't bWAHAHAHAHAHA GIVE US MONEY NOW PLZ"

20:33 casperc: wierd question: what is the reason that reading a namespaced keyword like ::reload/error results in an invalid token error?

20:33 callen: hashcat: don't.

20:33 Apage43: "So our database is P?"

20:33 casperc: (read ::reload/error)

20:34 hashcat: callen: type is not the only one I want

20:34 callen: partition tolerant as you don't care about the data being correct or getting an answer.

20:34 hashcat: doesn't matter. don't do it.

20:34 hashcat: dsl in scala looks pretty

20:34 callen: Apage43: sounds solid to me.

20:34 casperc: it happens both using clojure build in reader and tools.reader

20:34 callen: hashcat: learn Clojure alone anyway.

20:34 DSLs in Scala are horrific monsters, lol.

20:34 hashcat: callen: what's the problem??

20:34 lazybot: hashcat: What are you, crazy? Of course not!

20:35 hashcat: callen: Monster?

20:35 bbloom: hashcat: DSLs in scala rely heavily on the type system for implicit conversion and operator overload resolution

20:35 hashcat: is lazybot actually a bot?

20:35 brehaut: &(inc 1)

20:36 lazybot: ⇒ 2

20:36 Apage43: casperc: ::blah resolves to :current-namespace/blah

20:36 so ::foo/bar tries to become :some-ns/foo/bar

20:36 ,:a/b/b

20:36 clojurebot: :a/b/b

20:36 bbloom: hashcat: if you like that sort of thing, then scala's DSLs are neat. But if you're a Clojure person, it seems like a really round about approach: just use data.

20:36 Apage43: which.. should work it looks like =P

20:36 ,::a/b

20:36 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: ::a/b>

20:36 Apage43: or maybenot

20:36 casperc: Apage43: hehe

20:36 Apage43: it's not obvious which ns that should wind up in, at any rate

20:36 casperc: Apage43: it seems to want the symbol to exist in the other namespace

20:36 hashcat: bbloom, you've convinced me

20:37 Apage43: casperc: well

20:37 hashcat: a lot of bots lol

20:37 Apage43: ,::fun-error

20:37 clojurebot: :sandbox/fun-error

20:37 Apage43: is fine

20:37 amalloy: Apage43: ::foo/bar will never resolve to :some-ns/foo/bar

20:37 casperc: Apage43: but to me that is wierd since I am just reading not evaluating

20:38 amalloy: it looks in the current namespace to see what foo is a namespace-alias for (say it's clojure.string), and then expands to a keyword in that namespace, such as :clojure.string/bar

20:38 Apage43: casperc: reading a keyword instantiates the thing though, since they are values

20:38 srruby: * (* 3/2 4/3)

20:39 Apage43: amalloy: ah.. so..

20:39 ,::io/funsies

20:39 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: ::io/funsies>

20:39 casperc: amalloy: yeah, but it means that when I try to read a file with that kind of keyword it will fail

20:39 amalloy: casperc: yes

20:39 Apage43: would resolve to clojure.java.io/funsies if I require clojure.java.io as io?

20:39 amalloy: Apage43: try it and see?

20:39 casperc: I am basicly looking for a way around it :)

20:40 amalloy: for this reason (and also data_readers.clj), you can't really just-read a clojure program without evaluating it, i believe

20:40 Apage43: yup

20:40 https://www.refheap.com/18731

20:41 srruby: Why does the repl give 2N when I input (* 3/2 4/3)

20:41 Apage43: :: is craftier than I thought

20:42 casperc: I am trying to read a bunch of clojure files without having to eval them or load dependencies, and this gets in the way

20:42 Apage43: looks like you're in trouble then, since you can't properly read ::'s without evaling at least the ns form

20:43 casperc: and I can eval the ns form without first eval'ing its dependencies (i would think)

20:43 *can't

20:43 Apage43: pretty much

20:44 casperc: hmm

20:44 Apage43: this makes writing tools to manipulate clojure code a bit tricky

20:44 since you'll wind up.. running parts of the program

20:44 coventry: You can't get by with just the ns form. Type metadata will burn you. https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj#L34

20:45 Apage43: look at https://github.com/xsc/rewrite-clj

20:46 which is not quite all the way to a reader. Conveniently stops a bit before you hit a lot of this. However, this also limits the how much knowledge you have about the code you've read

20:47 coventry: casperc: What do you want to do with it once you've read it in?

20:47 casperc: Apage43: that might be an option. I am basicly looking to extract things like docstrings and function names, so it might be enough

20:48 amalloy: srruby: 2N is a bigint, and clojure stores its rationals as a numerator/denominator pair of bigints

20:49 casperc: coventry: to expand a bit: crawl the code for metadata basicly and pop it into a database for searching etc and make a webapp out of it

20:49 callen: quick, somebody ask a question touches on Clojure internals that amalloy cannot answer.

20:49 casperc: which I have basicly done, but this one is tripping me up, annoyingly

20:50 callen: coventry: haven't you been doing a much of stuff with reading and mangling namespaces?

20:50 coventry: Why does "(ns a.b.c) (definterface d) (deftype e [^a.b.c.d f])" work, but "(in-ns a.b.c) (definterface d) (deftype e [^a.b.c.d f])" complain that it can't find the class a.b.c?

20:51 casperc: coventry: i think ns creates the ns if it is not present and in-ns does not

20:51 coventry: callen: Yes, I have. It was a trail of woe I have abandoned, but I have gotten far enough to get a tree casperc could use for his purposes.

20:51 callen: coventry: whyyyyyyy were you doing?

20:51 *that

20:52 coventry: casperc: It was a response to callen's challenge to stump amalloy. I don't expect an answer. I think it is a bug.

20:52 casperc: ah :)

20:52 coventry: callen: My judgement was bad. :-)

20:53 callen: coventry: isn't it because a.b.c wasn't required before the in-ns?

20:53 coventry: callen: Don't think so. The in-ns version fails at the repl after the ns version has run.

20:56 amalloy: coventry: because in-ns isn't a macro, and ns is

20:56 it wants a symbol, iirc

20:56 callen: fuck I think he's right

20:56 amalloy: like, the definterface/deftype is a total red herring; your in-ns call fails immediately

20:56 coventry: Oh, duh. Thanks, amalloy. :-)

20:56 SegFaultAX: You know what else is a red herring?

20:56 Communism.

20:57 callen: Apparently getting engaged makes people less funny.

20:57 Unless you're Bill Cosby.

20:57 SegFaultAX: callen: Go watch Clue... then get one.

20:57 * SegFaultAX ohhhhhh snap!

20:57 coventry: Anyway, casperc, if you want to read in a file, you can eval it into its expected namespace form by form with (binding [*ns* ns] (eval form)). Try to do it into a different ns, and you need to edit the form before you evaluate it, changing any references to the ns.

20:58 * SegFaultAX lets himself out

20:58 callen: WRRRRRYYYYYYYYYYYYYYYY - channel error; reason: {#method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1

20:59 SegFaultAX: True story, the progfun class most definitely does require working knowledge of Scala in particular.

20:59 Which is fine, but it's marketed as... not that.

20:59 casperc: coventry: thanks, i'll give it a go.

21:00 callen: if RabbitMQ were something I could wrap my hands around, I would be strangling it.

21:00 my pain ratio for RabbitMQ and Datomic for the last 2 weeks is 10,000:1

21:02 casperc: coventry: I am thinking of maybe faking it by require'ing a core namespace with that alias. I don't really need the result, just things like the docstring and args

21:02 , (require '[clojure.set :as a]) (read-string "::a/asdf")

21:02 clojurebot: nil

21:02 casperc: crappy hack but it avoids me having to eval

21:03 coventry: Oh, yeah, if you just want functions and docstrings, that is actually a much less hacky way to do it. Just crawl (ns-map 'ns) for the vars with :arglists and :macro in their metadata.

21:05 casperc: thanks for the input. I am off to bed :)

21:06 coventry: The directory-crawling tools in tools.namespace will be useful, too.

21:13 And if you do edit the namespace references, you will run into fun things like the fact that dashes need to be turned into undescores in type metadata. E.g. "(ns a-b.c) (definterface d) (fn [^a_b.c.d am] 1)", not "^a-b.c.d". (Which gives the same exception as (in-ns a-b.c), which is why I was stumped by that silly question. Argh.)

21:50 AimHere: Sigh. I'm grappling with some Java library that wants a method annotated with something of the form @Foo(id="wibble"). which I want to emulate in a class made by gen-class

21:52 So far, after hunting for documentation (best I've found is a couple pages in Chas Emerick's book), the syntax looks like I put something like ^{Foo {:id "wibble"}} before the method name in the ':methods' section of gen-class

21:52 But no matter what I do, it's not working. What's the actual syntax I need?

21:53 It happily accepts ^{Foo {"id" "wibble"}} or ^{Foo {:id wibble}} or many, many variations without so much as a comment

21:59 callen: deftype ^{java.lang.Deprecated true} MyClass

21:59 gen-class :name ^{java.lang.Deprecated true} MyClass

22:00 AimHere: Yeah, but that's for the annotation @Deprecated

22:00 callen: so find the annotation class and set it accordingly.

22:00 if that doesn't work for you, we can discuss my contract rate.

22:01 also if AOT doesn't suit your needs, you're boned. aphyr was complaining about the lack of annotation support in proxy awhile back.

22:02 AimHere: Well in your example, if I was to annotate @Deprecated(baz="wibble"), that 'true' would be replaced by a map containing 'baz' and 'wibble'

22:02 So it would look like ^{java.lang.Deprecated {baz wibble}}

22:02 Trouble is, that I don't know if baz should be keyworded, or if wibble should be in a string, or if they should all be bareworded or what

22:02 callen: if you keep using the word wibble, I'll be giggling too much to help you.

22:02 AimHere: use strings.

22:03 AimHere: Well I think if I have them both stringed, it fails to call the damn function, though I've lost track of which permutations I've tried

22:04 Chas Emerick's book, or at least the two pages of it that google search gives me, seems to show that the 'id' should be a keyword

22:04 callen: well listen to him, not me.

22:05 ddellacosta: AimHere: are you trying to figure out how to add methods to a gen-class?

22:06 AimHere: I've added the method. I'm trying to annotate one

22:06 ddellacosta: AimHere: ah, okay, apologies.

22:08 callen: I love it when people post a second shorter version of example code and it could be shortened even further

22:08 today it's select-keys and keys that people forget exist.

22:09 ,(let [orig {:a 1} new {:a 2 :b 3}] (select-keys (merge orig new) (keys orig)))

22:09 clojurebot: {:a 2}

22:09 callen: is there some reason to do the same with filter and into {} ?

22:17 amalloy: callen: were you reading http://stackoverflow.com/questions/18808048/clojure-merge-with-remove-keys-that-are-not-common/18811538#18811538 recently, or what?

22:18 i mean, i guess it's not actually the same function, but it's closely related

22:24 callen: amalloy: no, some blog post.

22:25 my version above actually matches the semantics of the version of their code. It's not slightly different or anything.

22:34 ddellacosta: any way to get nrepl.el not to scroll to the bottom every time I execute something? I'm constantly hitting ctrl-l in the buffer.

22:58 clj_newb_2345: anyone have a good exmaple of using clojure as a "markup" language

22:58 I want to output a rather complicated text document, and I want things like (str "...") to be a raw string

22:58 but to also have other clojure expressions compile to strings to be intot the document

22:59 i.e. think: TeX, but with clojure instead of TeX's macro langauge

23:39 coventry: Is there a way to assert the length of a list in destructuring of bindings? Something like (let [[rc] '(1 2)] rc), except that just returns 1 instead of throwing an error because the list is too long.

23:41 bbloom: coventry: sadly, destructuring doesn't have a well defined behavior for non-matches against sequences (at least in my opinion)

23:41 coventry: the best you can do is [rc & more] and then (assert (nil? more))

23:42 dnolen: coventry: or you can use core.match

23:42 bbloom: dnolen: heh, right that too

23:43 coventry: Checking & more is good enough for now. Thanks.

23:48 amalloy: bbloom: fwiw i think (assert (not more)) reads better

23:49 bbloom: amalloy: i don't think it reads any better or worse, but I do think it's less precise: It suggests that false might be an interesting value

23:50 amalloy: i also have a function somewhere (assert-length N coll), so you could (let [[rc] (assert-length 2 '(1 2))])

23:50 coventry: Yeah, I thought about doing that.

Logging service provided by n01se.net