#clojure logs

2013-09-16

00:27muhooi'm trying to understand the use of instaparse. it seems like it doesn't do tokens, only strings.
00:27muhoosorry , only characters, not even string tokens
00:28callenmuhoo: https://github.com/chameco/Hitman/blob/master/src/hitman/core.clj ?
00:28callenyou tokenise anything regex can match.
00:28callenInstaparse is a GLL, it handles CFGs and CSGs
00:32muhooah, i was confusing instaparse wiht parsatron
01:33wei_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
01:41amalloywei_: 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
01:42amalloy(routes a b (only-sometimes (fn [] @enable?) (routes c d e))), where only-sometimes is that thing i said you should write
01:47wei_i got it, thanks! my fn returns simply (routes) if the routes are disabled. is that what you would have done?
01:47wei_(defn only-in-dev [handler] (if-not @prod? handler (routes)))
01:48callenwei_: https://github.com/weavejester/environ
01:49wei_I'm using it: (defonce prod? (atom (env :lein-no-dev)))
01:50muhoothere's no need to have an atom, just check env
01:51wei_oh good point
01:54coventry`If it's constant throughout the life of the application, you could wrap the dev defroutes in if statements.
01:57wei_my problem with that was if I included nils in the final app-routes, I'd get a NullPointerException
02:02H4nsi'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?
02:05SegFaultAXVariadic relational operators are so handy.
02:06noidiH4ns, add a resource directory that's only available during development and put the files there
02:07noidiput something like `:profiles {:dev {:resource-paths ["test-resources"]}}`
02:07noidiinto your project.clj
02:09noidiyou can then get a resource URL with (clojure.java.io/resource "my-test-file")
02:12H4nsnoidi: ah, nice! thank you!
02:49sontekAny of you guys doing the clojurecup thing?
02:59muhooclojure.... cup?
03:04sontekhttp://clojurecup.com/
03:19callensontek: I am, I have a project in mind.
03:19callenI'm looking for backend, frontend, and designers. I can do backend and frontend but not design.
03:21callenmuhoo: I'm looking forward to it :)
03:25lgs32awhere can i find the source code of special forms?
03:25lgs32ain the clojure code
03:26callenlgs32a: in the repo
03:26lgs32acallen: yes i expected it there but couldn't find it
03:27lgs32acallen: where is if for example
03:29amalloylgs32a: "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
03:30sontekcallen: I'm hoping to find some people in bay area I can join to hack on something
03:30callenlgs32a: you'll see a bunch of things like static final Symbol DEF = Symbol.intern("def");
03:30callenlgs32a: special forms are anything reified to the compiler that can't be done in macros or functions.
03:30callensontek: well you know I'm in SF.
03:30lgs32aamalloy: ty
03:33callensontek: query me?
03:40quazimodoI've started fiddling with clojure. Feels good
03:40quazimodothat is all
03:41callenquazimodo: good :)
03:41quazimodoit was hard not to go the common lisp route. I want to sbcl but no one else does :(
03:42callenquazimodo: I came to Clojure from Python and sbcl, you're in good company :)
03:42quazimodoi ruby a lot
03:42quazimodonot even sure why I'm learning clojure tbh
03:42quazimodoi guess it's a pain in the ass to gui with ruby
03:48clj_newb_2345if I do (.start (Thread. (fn [] ... ))) and the function throws an uncaught exception, is the Thread garbage colected?
03:48clj_newb_2345or does it lie around ?
03:51amalloy$google java thread uncaught exception
03:51lazybot[Thread.UncaughtExceptionHandler (Java Platform SE 7 )] http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.UncaughtExceptionHandler.html
03:52clj_newb_2345this says nothing about garage colelction :-)
03:52clj_newb_2345so running threads are gc roots
03:52amalloythat 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
03:52clj_newb_2345but what about terminated thraeds?
03:53clj_newb_2345I disagree with you; JVM issues shoudl be as on topic as clojure libraries
03:57hyPiRionThe thread is considered a root while it is running. Once it stops, it's not considered a root anymore. Does that answer your question?
04:07clj_newb_2345http://reference.clojuremongodb.info/monger.core.html#var-get-db
04:07clj_newb_2345where is create db?
04:08ucbclj_newb_2345: without knowing much, it's possible that get-db actually means get-or-create-db
04:08amalloyclj_newb_2345: i don't mean it's off-topic, so much as that you'll get better answers in a java context
04:09clj_newb_2345Get database reference by name. EXAMPLES (monger.core/get-db "myapp_production") (monger.core/get-db connection "myapp_production")
04:09clj_newb_2345the documentation doesn't mention anythign about that
04:10clj_newb_2345ucb: but testing it, you're right :-)
04:10clj_newb_2345amalloy: ah, noted, thanks for clarifying :-)
04:12lgs32asomething is very strang
04:12lgs32ai just looked at the source code of the meta reader macro
04:13lgs32afor the ^token
04:13ddellacosta#postgresql
04:13lgs32aand whenever i enter ^:x 'a
04:13ddellacostawhoops, sorry!
04:13lgs32ai get a symbol without meta-data
04:13lgs32abut it should have them
04:13clj_newb_2345in what context can (refresh) (fromclojure.tools.namepace) be called -- I'm trying to call it on every ring request ... but am getting into errors
04:14ddellacostaclj_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.
04:15clj_newb_2345https://gist.github.com/anonymous/9f8248bbcd4ddb196d13
04:15clj_newb_2345well, my current work flow is:
04:15clj_newb_2345edit clojure file; go to repl,type in (refresh); click "reload" button on browser
04:15clj_newb_2345I'm using websockets, so ring requests are very infrequent
04:15clj_newb_2345in fact, only when I hit thre reload button
04:16clj_newb_2345(yeah, I mean I'm not doing it on every static file load -- only on new websocket creation
04:16clj_newb_2345and I'm getting the error of https://gist.github.com/anonymous/9f8248bbcd4ddb196d13
04:16ddellacostaclj_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
04:16ddellacostaclj_newb_2345: that'll make sure you're picking up changes to namespaces in ring handlers.
04:16clj_newb_2345oh shit :-)
04:17clj_newb_2345how do I link this with compojure?
04:17ddellacostaclj_newb_2345: haha…yeah, don't quote me on this, but I thought c.t.n.r was more for repl-based workflows.
04:17clj_newb_2345what's ctnr ?
04:17clj_newb_2345clojure tools namespace repl
04:17clj_newb_2345ah
04:18ddellacostaclj_newb_2345: sorry, abbreviating it: clojure.tools.namespace.reload. yah
04:18ro_stclojure.tools.namespace/resfresh
04:18ddellacostaer, refresh, sorry
04:18ddellacostawhat ro_st said.
04:19lgs32aso, again
04:20ddellacostalgs32a: sorry, I wasn't quite sure what your issue was.
04:20lgs32awell
04:20ro_stclj_newb_2345: check out https://github.com/juxt/jig
04:20lgs32a,^:test-kw 'x
04:20clojurebotx
04:20lgs32a,(meta *1)
04:20clojurebotnil
04:20lgs32awhy?
04:20clojurebothttp://clojure.org/rationale
04:21ddellacostaro_st: that looks awesome!
04:21lgs32ai looked at the source-code of the meta-reader and it returns
04:21lgs32a((IObj) o).withMeta((IPersistentMap) ometa);
04:22lgs32awhich should be equal to
04:22lgs32a,(.withMeta 'x {:test-kw true})
04:22clojurebotx
04:22lgs32a,(meta *1)
04:22clojurebotnil
04:22lgs32awell in my repl there are meta-data
04:22lgs32aif using this syntax
04:23lgs32a,(meta (.withMeta 'x {:test-kw true}))
04:23clojurebot{:test-kw true}
04:23ro_stddellacosta, clj_newb_2345: jig is put together by @malcolmsparks on twitter. i'm sure he'd love any feedback you might have
04:23lgs32a,(meta ^:test-kw 'x)
04:23clojurebotnil
04:23lgs32aso there you have it
04:23clj_newb_2345ro_st: will look into it next; thanks :-)
04:23clj_newb_2345I am a far is staur sierra's "reloaded" workflow
04:24clj_newb_2345had some hacked up solution of my own, but not nearly as formalized / well defined
04:24ro_stjig is a progression of SS's reloaded
04:24ro_steven if you never use jig, its documentation is a great unpacking of the concepts
04:24clj_newb_2345I'm afraid
04:24clj_newb_2345i won' get any work done tonight :-)
04:24clj_newb_2345if I keep on studying new libraries
04:25ro_stthere's always another yak to shave
04:25lgs32anow i wonder if the ^: tag is ignored if I evaluate a simple form
04:26ddellacostalgs32a: looking into it
04:26lgs32ai think i have it
04:26lgs32ahaha
04:26hyPiRionlgs32a: you're attaching the metadata to the list (quote x), not the symbol x
04:26lgs32athis is not easy
04:26lgs32aexactly i realized it this moment
04:32clj_newb_2345(ring.middleware.reload/wrap-reload chat-handler :dirs ["clj"]) <-- is this the right way to use wrap-reload ?
04:32clj_newb_2345in particular, for passing the :dirs option
04:34quazimodoit's painful that java and jvm are discussed in a lispy place :(
04:34quazimodohard to come to grips with it
04:35ro_stclj_newb_2345: yes, but you must include all the paths. so if you have src and clj, you must include both
04:35clj_newb_2345I only have clj/**/*.clj
04:36clj_newb_2345but it's not working :-(
04:37clgvclj_newb_2345: do you have problems to set up source paths in project.clj?
04:38ro_styou need to restart your webserver after altering that line
04:39clj_newb_2345testing
04:39clj_newb_2345I had to tell project.clj to look in clj too
04:39clj_newb_2345I like clj in clj/ and cljs in cljs/
04:40clj_newb_2345fuck this
04:41clj_newb_2345i'll just have eamcs tell repl to execute (refresh) on every save
05:23javeIs there an existing method for calling lein from maven?
05:33glosoliHey, 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 ?
05:34cgrand@glosoll: seems like page with errors got cached by the browser, not sêcific to enlive
05:34ro_stglosoli: first replicate the behaviour in a repl by banging on the function that does the trans directly
05:35borkdudecould it be that `lein with-profile test cloverage` is messing my jvm-opts up?
05:36glosolithanks
05:55zapuwhat's the state of clojureclr and vsclojure plugin?
05:57clj_novice_2345what are good clojurescript bindings for something mark-down like?
05:57ddellacostais there an official edn mime-type?
05:58clj_novice_2345in particular, I want something where where there is a "textural" representation of the page
05:58ddellacostalots of questions all of a sudden, heh
05:58clj_novice_2345but it can also be rendered nicely into HTML
05:58ddellacostaclj_novice_2345: are you asking for a library that can do markdown/something like markdown?
05:59clj_novice_2345i wnat to design a webpage
05:59clj_novice_2345where there's a left pane and a right pane, where the user edits text in the left pane
05:59clj_novice_2345and it's real time rendered in the right pane
05:59clj_novice_2345and I'd like to do this clojurescript
05:59clj_novice_2345I'm okay with using javascript libraries
05:59ro_stlike mouapp.com does
05:59ro_stclj_novice_2345: https://github.com/evilstreak/markdown-js
06:00clj_novice_2345ro_st: you're ike future me
06:00clj_novice_2345in terms of clojure libraries
06:00ddellacostaclj_novice_2345: huh, interesting, I did something very similar, only using a top/bottom view
06:00ro_stmouapp is an osx app. nothing to do with clj/s :-)
06:01clj_novice_2345mouapp.com -- that's a desktop app, not a webpage, no?
06:01ddellacostaI used https://github.com/chjj/marked, as it's quite fast, although haven't compared to anything else in a while.
06:02ro_styes
06:04borkdudehow can I print the jvm-opts that lein cloverage uses
06:05ddellacostaso, 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.
06:06ro_stddellacosta: application/edn
06:07ddellacostaro_st: ah, yeah, just started finding that poking around. Thanks!
06:07ddellacostamakes sense since json is application/json.
06:07ro_styes
06:22H4nsis 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.
06:23ro_sttry a normal read-string with clojure 1.5+ ? it might report the line/column numbers
06:24ro_stotherwise load the file into emacs/vim with paredit and use next-form to jump through the file until it shouts at you
06:24ro_sttedious to do that though if your data is biggish
06:24H4nsright. that's why i'm looking for a better error message. i'll try read-string, thanks.
06:25H4nssame message :(
06:25ro_sttry using tools.reader
06:25ro_sthttp://clojure.github.io/tools.reader/
06:26ro_stif you find a way to get line/col reports, please let us know :-)
06:26H4nsthanks, i'll try that
06:36Bronsaro_st: H4ns the edn reader does not annotate any line/column info
06:38ro_stBronsa : is there a reader which does?
06:38H4nsLineNumberingPushbackReader seems to be, but i'm not sure.
06:42Bronsaro_st: H4ns I meant read-string
06:42Bronsaif you use read+clojure.tools.reader.reader-types/indexing-push-back-reader you get line/column info in the ex-data
06:43ro_staha. is there a sample of that somewhere?
06:43ro_stthis smells like a cookbook recipe
06:43ro_stwe use edn as a data format and having this info when reporting an error would be tres useful
06:44Bronsaro_st: H4ns user=> (use 'clojure.tools.reader.edn)
06:44BronsaWARNING: read-string already refers to: #'clojure.core/read-string in namespace: user, being replaced by: #'clojure.tools.reader.edn/read-string
06:44BronsaWARNING: read already refers to: #'clojure.core/read in namespace: user, being replaced by: #'clojure.tools.reader.edn/read
06:44Bronsanil
06:44Bronsauser=> (use 'clojure.tools.reader.reader-types)
06:44BronsaWARNING: read-line already refers to: #'clojure.core/read-line in namespace: user, being replaced by: #'clojure.tools.reader.reader-types/read-line
06:44Bronsanil
06:44Bronsauser=> (read (indexing-push-back-reader "{:a}"))
06:44BronsaExceptionInfo Map literal must contain an even number of forms clojure.core/ex-info (core.clj:4343)
06:44Bronsauser=> (ex-data *e)
06:44Bronsa{:column 5, :line 1, :type :reader-exception}
06:44Bronsaderp.
06:44BronsaI'm sorry, here's nopasted http://sprunge.us/XgAX
06:45H4nsBronsa: thanks! let me try that.
06:45supersymnice..a creative friend just passed me https://medium.com/about/9e53ca408c48
06:45supersymfrom the dudes that made twitter
06:49ro_stBronsa: you rock star!
06:53sm0keHello i have (def a (SomeJavaClass.)) ..this class has a public var o which i want to reassign,,, how do i do that?
06:54ro_st(set! a (.-var) <new-val>)
06:55ro_st-shoots from the hip-
06:57sm0keso i would do (set! a (.-o) <new-val>)
06:57sm0kehmm...weird synta
06:57clgvlooks like cljs syntax
06:57ro_stit is cljs syntax. might be different for java. probably is different
06:58Bronsait's actually (set! (.field instance) val)
06:59Bronsa.field or .-field are essentially the same in clojure
06:59clgvBronsa: ah right. that was added sometime after 1.3 right?
07:00ro_stthanks for the correction, Bronsa
07:00glosoliI have two maps and I would like to compare only the values which rely to the common keywords between those maps, any ideas ?
07:00clgvglosoli: keys + set + select-key + =
07:00ro_stglosoli: use ((set (keys map1) (set (keys map2))
07:01ro_stwait, that's probably wrong, too
07:01ro_st,(#{:a :b} #{:a :c})
07:01clojurebotnil
07:01ro_st,(clojure.set/intersection #{:a :b} irc://irc.freenode.org:6667/#%7B:a :c})
07:01clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: }>
07:01ro_stgah
07:01clgvglosoli: determine the common keys by creating a keyset each and itnersect those. then use select-keys with the prev result
07:02ro_st,(clojure.set/intersection #{1 2 3} #{2 3 4})
07:02clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>
07:02ro_styou get the idea
07:03glosoliyeah thank you both
07:05Bronsaclgv: it wasn't in 1.3, i don't remember if it was added on 1.4 or 1.5 though
07:07H4ns(keyword "hello[123]") => :hello[123] - that's kind of sad :( - is there some syntax for quoted symbols?
07:08Bronsa'(keyword "foo bar")
07:08clgvH4ns: what do you want to do?
07:08Bronsa,(keyword "foo bar")
07:08clojurebot:foo bar
07:08clgv,'bla
07:08clojurebotbla
07:08clgv,(type 'bla)
07:08clojurebotclojure.lang.Symbol
07:08BronsaH4ns: symbol/keyword don't do any validation for performance reasons
07:09H4nsclgv: 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
07:09BronsaH4ns: you'll have to make those keys strings
07:10Bronsaneither symbols nor keywords can handle that
07:10Bronsaclojure doesn't have the #|symbol with special chars|# syntax that e.g. common lisp has
07:10sm0ke,(rep 1)
07:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: rep in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:11H4nsBronsa: that was what i was after.
07:11sm0ke,(repeat 1)
07:11clojurebot(1 1 1 1 1 ...)
07:11sm0ke,(doall (repeat 1)) ;hahaha
07:11clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
07:11H4nsBronsa: thanks, i'll find my way through cheshire to see whether i can make it do trt for me.
07:11Bronsa(err, just |symbol with spaces|)
07:14clgv,(println "sm0ke: Bad boy!")
07:14clojurebotsm0ke: Bad boy!\n
08:18JaniczekHi, 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...
08:19cgrandjust use (xml-resource (java.netURI. "….")) as the source of the deftemplate (e.g. before the args vec)
08:20Janiczektried (xml-resource "filepath"), helped with some problems (<link></link>http://) but stripped the <?xml thing at the beginning. will try the (java.netURI. ...)
08:23Janiczekhm, that probably amounts to the same thing. cgrand, would you know what to do with disappearing <?xml version="1.0" encoding="UTF-8" ?> ?
08:25glosolihmm 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))
08:26cgrand@janiczek fill a bug, in the mean time, cons the missing <?xml ….?> on the output of the template call
08:26Janiczekcgrand: ok
08:26Janiczekthanks :)
08:28TEttingerglosoli, get-in ?
08:28squidzdoes anybody have an idea how I can run php in my clojure project(with jetty)?
08:29TEttingerhm crud, nvm gleag
08:29TEttingerglosoli
08:29gleagHave I been summoned?
08:29glosoliTEttinger hmm ?
08:30TEttingerglosoli, 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
08:30TEttingersorry gleag, typo on name completion
08:31TEttingerglosoli, basically you want things like :last-name and not "somelastname" ?
08:31glosoliTEttinger: 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
08:31TEttingerif they're all structured like that, ##(map first #{[:last-name "somelastname"] [:id "somenumberid"]})
08:31lazybot⇒ (:last-name :id)
08:32squidzI want to be able to access php files served by ring? is that possible?
08:33glosoliTEttinger: thanks! :)
08:34TEttingerglosoli, be advised, if the vectors have multiple keys it won't do what you want
08:34TEttinger##(map first #{[:last-name "somelastname" :first-name "Jim"] [:id "somenumberid"]})
08:34lazybot⇒ (:last-name :id)
08:35glosoliunderstood
08:35TEttingerbut I do love how simple these things can be in clojure with the right combinations. it's like a puzzle with well-documented pieces
08:35Janiczekcgrand: does this suffice? https://github.com/cgrand/enlive/issues/78
08:36cgrandjaniczek: perfect
08:37cgrandthank you
08:37Janiczekok great :) gonna go cons that thing in. thanks for help!
08:43AimHerecons ? This is #clojure, we conj stuff in!
08:45sm0ke,(cons 1 [2 3])
08:46clojurebot(1 2 3)
08:47AimHere,(conj '(2 3) -1 0 1)
08:47clojurebot(1 0 -1 2 3)
08:48AimHereMore flexible and by extension more idiomatic!
08:49H4nsis there an equivalent to (rest (butlast x)) (i.e. return the "middle" elements of a list or nil for a two-element list?
08:50H4nssurprise! it is (rest (butlast x))
08:50H4ns:D
08:50sm0ke,(conj '(2 3) 1 0 -1) ; i think you meant
08:50clojurebot(-1 0 1 2 3)
08:51AimHereYeah, well that's the thing with conj. You have some cognitive overhead with all the extra arguments and extra collection types!
08:51sm0ke:)
08:53AimHereH4ns, (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
08:53AimHereIn the two-items-or-less case anyways
08:54H4nsAimHere: right. it does not matter, i was just thinking in common lisp, assuming that it would be different in clojure.
08:54H4nsAimHere: thanks anyway :)
09:18stuartsierrafreiksenet: Re conversation about seqs on Java arrays (August 21) see updated language on http://clojure.org/sequences
09:46yuryhi everybody
09:47yuryhow to translate list ("a" "b" "c") to hash-map ({:97 "a"} {:98 "b"} {:99 "c"}) ?
09:47mpenet,(zipmap [97 98 99] ["a" "b" "c"])
09:47clojurebot{99 "c", 98 "b", 97 "a"}
09:48mpenetah well not exactly
09:48AimHere,(map hash-map [:97 :98 :99] ["a" "b" "c"])
09:48clojurebot({:97 "a"} {:98 "b"} {:99 "c"})
09:48yurywhere 97 98 and 99 is (hash of respective "a" "b" and "c")
09:48mpenetor yes, your question is can be misinterpreted, you want a list of hashmaps of a single map?
09:48yurysingle map
09:49yuryto be able to use (get hash_list some_key)
09:49mpenetso yes, my first answer works
09:50AimHereWell doesn't quite work - your first argument to zipmap will be created by something like (map hashify ["a" "b" "c"])
09:51hyPiRion,(into {} (map (juxt hash identity) ["a" "b" "c"]))
09:51clojurebot{97 "a", 98 "b", 99 "c"}
09:52hyPiRionIf you want that thing as a keyword
09:52hyPiRion,(into {} (map (juxt (comp keyword hash) identity) ["a" "b" "c"]))
09:52clojurebot{nil "c"}
09:52mdrogalis,(map hash ["a" "b" "c"])
09:52clojurebot(97 98 99)
09:52hyPiRionwell, kind of
09:52mdrogalisHm
09:52hyPiRion,(into {} (map (juxt (comp keyword str hash) identity) ["a" "b" "c"]))
09:52clojurebot{:97 "a", :98 "b", :99 "c"}
09:52hyPiRionbut may as well do it with pure ints
09:56mdrogalisAlso not a good idea to have integer keywords.
09:56mdrogalis,(keyword 11)
09:56clojurebotnil
09:58AimHere,(int :11)
09:58clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Character>
10:03rurumateG'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:04cmajor7is 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:14yuryhyPiRion, thanks a lot, (comp keyword str hash) works like a charm
10:16squidzhas 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:16tbaldridgesquidz: 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:17squidzi figured it is also something with my project.clj, but haven't been able to figure it out yet
10:19rurumateok found it, https://github.com/clojure/clojurescript/wiki/Running-the-tests
10:21R_Macyanyone using cemerick's `friend` library?
10:22R_MacyI'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:22stuartsierraRelevance and Metadata Partners (owner of Datomic) have merged to form Cognitect: http://www.cognitect.com/
10:22hyPiRionHmm, interesting changes for Relevance and Rich.. Hopefully for the better of the community.
10:23hyPiRionah, zing
10:23stuartsierraheh, perfect timing. :)
10:23hyPiRionI 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:25stuartsierraIn the short term, yes, there won't be any dramatic changes.
10:25seangroveI wasn't aware that Metadata Partners were the owners of Datomic, somehow I thought it was relevance
10:26stuartsierraIn the long term, this should mean more and better commercial support for Clojure, ClojureScript, and Datomic,
10:26seangrovesquidz: You need to have the the source files available to the browser
10:26seangroveIf 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:27seangrovelikely you'll need to cp your src/ files and subdirs to resources/public
10:27stuartsierraseangrove: 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:28squidzseangrove: it is just pointing the file path on my file system: /home/squidz/programing/clojure/file.cljs
10:29seangrovesquidz: Yeah, the browser won't be able to open that
10:29wakeup How do I check *in* for EOF?
10:29wakeup(in Clojure)+
10:29hyPiRion,(read)
10:30clojurebotExecution Timed Out
10:30wakeup(without modyfing *in*)
10:30hyPiRion&(read)
10:30lazybotExecution Timed Out!
10:30squidzseangrove: all the files I need are stuffed in the :output-dir specified in project.clj right?
10:30hyPiRionI thought one of them had *in* closed. Seems like I'm wrong on that.
10:30wakeuphyPiRion: read will consume input.
10:30tbaldridgewakeup: you can't you have to use a pushbackreader, http://docs.oracle.com/javase/7/docs/api/java/io/PushbackReader.html
10:31tbaldridgewakeup: at least I don't know of a way
10:31wakeup-.-
10:31wakeupthis is seriously shameful
10:31tbaldridgewakeup: that's kindof tied to the OS though, I'm not aware of any OS socket/stream that allows peek.
10:31hyPiRionwakeup: Just read from System/in
10:32seangrovesquidz: I don't think that matters, your cljs files won't get spit out there
10:32wakeuptbaldridge: err no, EOF-P is a completely standard function in a programming language
10:33tbaldridgewakeup: 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:33squidzseangrove: ah okay, so we still have to manually cp all of our clojurescript files to a directory accesable by the browser?
10:33tbaldridgewakeup: also, http://stackoverflow.com/questions/2082743/c-equivalent-to-fstreams-peek
10:33seangrovesquidz: I *believe* so, I didn't see any code that indicated otherwsire
10:34seangroveBut maybe dnolen can confirm how he's doing it in his example
10:34wakeuptbaldridge: by the OS level you seem to mean ANSI C, well C has unread...
10:34squidzyeah not sure if he is reachable right now. If not maybe i'll ask him later
10:34tbaldridgewakeup: yep, and pushbackreader has unread
10:35wakeuptbaldridge: which is a java class?
10:35tbaldridgewakeup: yes
10:35tbaldridgewakeup: it's what Clojure's internal lisp reader uses.
10:35dnolensquidz: 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:36wakeuptbaldridge: so Clojure does have neither unread nor eof-p
10:36dnolensquidz: 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:37squidzdnolen: is it in the cljsbuild project?
10:37tbaldridgewakeup: nope, the JVM classes are considered sufficient and adding other layers would just add overhead.
10:37dnolensquidz: no, all the changes were to the browser REPL server
10:37dnolensquidz: 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:38squidzdnolen; 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:38dnolensquidz: I'm not planning on putting any more thought into, what tools needs will guide what happens next.
10:38dnolensquidz: I don't know anything about external browser REPLs
10:39dnolensquidz: only the one that ships with ClojureScript. Can be used with `lein trampoline cljsbuild repl-listen`
10:40dnolensquidz: http://swannodette.github.io/2013/09/15/source-maps/, you shouldn't need any more information than this to try it out
10:41squidzdnolen: 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:41dnolensquidz: I don't know anything about that stuff.
10:42dnolensquidz: I say in the post you need to make an index.html and include your output js file.
10:42seangrovednolen: 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:43dnolenseangrove: probably! I look forward to hearing feedback from these tools about what they need to integrate source map functionality best.
10:44squidzdnolen: okay, but from where is the server looking for resources? I'm guessing this is separate from ring/compojure configuration in a project
10:45dnolensquidz: 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:45dnolensquidz: like I said I can't give any guidance on how to make it work with your setup
10:45squidzokay thanks, I think that is the last piece missing to get it going
10:47squidzive never used the built in browser repl from lein
10:48squidz so I see I just put the index.html at the root of my clojurescript project. Thanks
10:52squidzdnolen: seangrove yeah, after getting the built-in browser repl going, the source-maps work
10:53arkhhow would one assign a method to a javascript object instance via clojurescript?
10:53arkhI'm trying to override the default behavior of goog.fx.Dragger
10:53ro_styou can't register an event handler for it?
10:53xeqistuartsierra: is lein considered part of the clojure platform with regards to support?
10:54stuartsierraxeqi: No, Leiningen is maintained by Phil Hagelberg and volunteers.
10:54arkhro_st: I'm trying to assign a function to defaultAction
10:55ro_st(set! (.-defaultAction thing) #(println "does this work?"))
10:55ro_sthow about that?
10:56arkhro_st: ohhh
10:56arkhro_st: that's probably what I need - sorry for the silly question : /
10:56ro_st(aset thing "defaultAction" #(println "woo"))
10:56ro_stthat'll probably do it
10:57arkhro_st: I'll check those out - thank you
10:57rurumateok, 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:58ro_starkh: the only silly question is the one you don't ask :-)
10:59rurumatehas anyone had this problem when running clojurescript's script/test ?
10:59AimHerero_st, I'm just glad he didn't ask it!
10:59tbaldridgegfredericks: atom will be much faster, it's basically the cost of locking a CPU cache line
11:00tbaldridgegfredericks: for even more performance you can always drop to Java's AtomicReference
11:02stuartsierraor AtomicLong if you're only storing an integer.
11:02tbaldridge(inc stuartsierra)
11:02lazybot⇒ 4
11:02tbaldridgewow, so low? Let's do that a few times more
11:02tbaldridge(inc stuartsierra)
11:02lazybot⇒ 5
11:02stuartsierraheh.
11:03dnolenrurumate: did you run the boostrap script?
11:03rurumatednolen: no
11:04dnolenrurumate: you need to do that first
11:04dnolensquidz: cool
11:05gfrederickstbaldridge: I thought that might be the case; my naive gut though was to go with agent due to not having to contend
11:05tbaldridgegfredericks: the sad thing is, you still have to contend for the agent's queue. So agents use AtomicReferences.
11:05gfrederickstbaldridge: yeah that was my less naive fear
11:06gfrederickseventually I concluded I should just measure the dang things :)
11:06gfredericks5 microseconds for the agent, 200 nanoseconds for the atom
11:06tbaldridgenah, I prefer to measure last. Always assume, it's more exciting when you do benchmark that way. :-P
11:07KalimarGood morning
11:07mmoriarityGood morning!
11:09hhenkelHi 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:11opqdonutnested for loops? why not just:
11:11opqdonut,(for [a [[1 2 3] [4 5]] b a] {:value b})
11:11clojurebot({:value 1} {:value 2} {:value 3} {:value 4} {:value 5})
11:11opqdonutor did you mean something else?
11:13hhenkelopqdonut: 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:14hhenkelSomething like, if I find ":type" and I walked, domain, and servers before I want to substitude it.
11:14opqdonutI'd start by writing out the straightforward recursive implementation
11:15opqdonutbut maybe that's just me
11:16jstewSame here. When I see the word tree, my brain automatically says "recursion".
11:19hhenkelopqdonut: 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:20hhenkelI guess I should loop and recur for that, right?
11:20ro_sthhenkel you might find that clojure.zip is more suited to what you're after
11:20gleagThat's not just you, it's the same thing that makes people who see a crystal immediately think "symmetry groups".
11:20gleagGenerally, it's called "factual relevance" :)
11:21jstewhhenkel: Yes, loop/recur is best if your tree size is not very small, or if it's of an unknown length.
11:21AimHerehhenkel, 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:23jstewclojure.zip looks very nice as well. I didn't know about it until just now. Thanks, ro_st.
11:24hhenkelro_st: jstew: AimHere: okay, thanks for your input. I'll check if I get a step forward.w
11:25ro_sthappy hunting :-)
11:28ddellacostahhenkel: 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:28ddellacostaoh, and what ro_st said too...haha
11:31TimMcHmm, how come I see all these #<Var: --unnamed--> in (get-thread-bindings)?
11:34TimMc,(remove #(.ns (key %)) (get-thread-bindings))
11:34clojurebot([#<Var: --unnamed--> #<DynamicClassLoader clojure.lang.DynamicClassLoader@12be529>] [#<Var: --unnamed--> 0] [#<Var: --unnamed--> 0])
11:35TimMc,(map (comp meta key) (remove #(.ns (key %)) (get-thread-bindings)))
11:35clojurebot({:ns nil, :name nil} {:ns nil, :name nil} {:ns nil, :name nil})
11:38kanjaI'm looking at building a webapp in clojure as a first project - does anyone have an opinion on compojure or pedestal?
11:38ro_ststart with ring and compojure and enlive or hiccup
11:38rkneufeldkanja: For simple web apps Compojure or luminous is probably your best bet (saying this as one of the team members on pedestal)
11:39ro_stpedestal is aimed at 'in the large' apps
11:39kanjaah ok
11:39kanjaso start with compojure to skill up and then make an informed decision to use pedestal
11:39jstewkanja: I like compojure. It's simple. Pedestal seems like a really huge learning curve. Might pay off for a very large system.
11:39endouthe client side of Pedestal look really interesting, I loved the documentation it's really sensible
11:40rkneufeldyeah, it is important to consider pedestal-app and pedestal-service separately
11:40ro_stkanja: 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:41kanjaro_st: that would probably get me up to speed quicker
11:43kanjaenlive and hiccup are both for html templating?
11:43TimMcnDuff: Here's a pastebin you might like: http://code.solusipse.net/
11:44ro_stkanja they have different approaches
11:44nDuffTimMc: Hmm. I'm already pretty happy with sprunge.us and ix.io in the "easy to feed to from CLI" category.
11:44ro_sthiccup turns clojure data into html. enlive transforms html files from disk
11:45kanja 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:45ro_stcool :-) enlive also supports simple bits of hiccup in its transforms, so using both is perfectly an option
11:46kanjaoh sweet
11:46ro_stperfectly acceptable as an option*
11:47jstewI am really digging angular-js on the frontend, and using ring/compojure for JSON. It's making web dev fun again for me.
11:55tangrammerHi folks! Does anyone know where to find a clojure tele-work/telecommute job?
11:57mgaare_tangrammer: hook up with a recruiter that specializes in jvm languages and then wait :D
11:58nDufftangrammer: ...having a corpus of publicly-visible work isn't a bad place to start either.
11:59mgaare_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:59tangrammermgaare_: thanks! but... any clues to find that recruiter?
11:59mdrogalismgaare_: Maybe not thread then.
12:00tangrammernDuff: thanks nDuff, but can you help me a little more? I don't know how scape from js
12:01mgaare_tangrammer: depends on your location
12:01tangrammermgaare_: I live in spain
12:02tangrammermgaare_: but currently i'm working for a NY company
12:02tangrammermgaare_: telecommute js developer
12:04nDufftangrammer: ...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:04pbostrommgaare_: it's kinda ugly but you can wrap the form in a 1-arg anonymous function
12:05nDufftangrammer: ...maintain a well-known library, and that's a very big foot in the door anywhere that uses it.
12:07mgaare_tangrammer: some of your coworkers might know of recuirters in the area
12:08mgaare_pbostrom: yeah, was hoping someone had a prettier solution :D
12:09tangrammermgaare_: good advise! thanks you are very kind!
12:09tangrammernDuff: good advise! thanks you are very kind!
12:17jstewIMO, clojure is a wide open frontier. Lots of things in other languages exist that have no clojure equivalent yet.
12:18endouand the other way around too
12:18hyPiRionyeah. core.logic is one example
12:21gfrederickshow does one run a single test from nrepl.el?
12:21gfredericksditto for a single namespace
12:21borkdudegfredericks call the test like a function?
12:23jstewgfredericks: in nrepl.el C-M-n will switch to the current namespace, then you just call whatever function you want.
12:25borkdudeC-M-n doesn't work in my setup, I use C-c M-n
12:26borkdudeI 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:26cmajor7stuartsierra: will Congnitect be a "Typesafe" for Clojure?
12:26borkdudegfredericks (run-tests) will then just run the tests from the current namespace
12:27tbaldridgecmajor7: how would you define "be a Typesafe"?
12:27borkdudegfredericks or you can run one test by just calling it like a function
12:27leifwtbaldridge: I think the question is "does 'scala : typesafe :: clojure : cognitect' hold"
12:28cmajor7tbaldridge: scala roof
12:28tbaldridgeleifw: if you define that as "offers commercial support" then yes: http://www.cognitect.com/support#clojure-support
12:29borkdudemaybe some companies are willing to use clojure if they know there is support and commercial backup for it
12:29borkdudesome = more
12:29tbaldridge(inc borkdude)
12:29lazybot⇒ 1
12:30gfredericksborkdude: I need the fixtures to run
12:30cmajor7tbaldridge: 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:31borkdudegfredericks I haven't used those yet, did most things manually with the test-ns-hook
12:32gfredericksborkdude: the (run-tests) call looks good though; wasn't aware of that
12:32gfredericksborkdude: thx
12:32borkdudegfredericks I guess I need to read up on those :)
12:32borkdudegfredericks you can also pass it a namespace symbol to run a different namespace
12:32borkdudegfredericks lein test :only … also accepts a namespace
12:33stuartsierracmajor7: I don't think we know the answer to that yet.
12:33gfredericksborkdude: yeah, I knew how to do it from the command line; I'm exploring the low-latency options
12:34borkdudetype and safe are both a bit boring words, cognitect will may be more exciting than just type safety ;)
12:34technomancygfredericks: grench!
12:34cmajor7stuartsierra: makes sense. in any case, good to centralize the forces and answering the question "where does Rich work" :)
12:34technomancygfredericks: with such gusto tho
12:35gfredericks$google clojure grench
12:35lazybot[Raw clojure.main repl hangs · Issue #6 · technomancy/grenchman ...] https://github.com/technomancy/grenchman/issues/6
12:35technomancyoh nice; link straight to a closed bug as the first hit lazybot
12:35hyPiRionwhy not
12:35gfrederickstechnomancy: I googled it privately first and assumed that link was irrelevant and was just trying to publically demonstrate that
12:36gfrederickstechnomancy: this is your old idea of a CLI nrepl client to a persistent leiningen process?
12:36technomancyit is
12:36mgaaregfredericks: you can also use clojure-test-mode, go to the buffer with the tests and C-c M-, on the test you want
12:36gfredericksthis would still mean launching a project jvm every time
12:36gfredericksI'm trying to satiate the TDD masses here
12:36technomancygfredericks: not necessarily
12:36gfredericksalso "learn a whole new build tool" is a bit prohibitive
12:37technomancyit should be a drop-in replacement, like drip
12:37technomancyand you can keep your project JVM warm
12:37technomancythat said it's really new and only has a handful of people using it regularly
12:38technomancyalso it's named after a metafictional nazi skinhead high-school band; not sure if that matters to you personally
12:38hyPiRionOnly the bleeding edge pros
12:39gfredericksmetafictional means doubly fictional?
12:39technomancygfredericks: in this case yes. it might have other connotations elsewhere.
12:39mtpmetafictional means 'fiction about fiction'
12:39hyPiRionfiction in fiction at least
12:46rurumatednolen: 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:47danielszmulewi-1technomancy: how does grenchman fit with working in emacs (nrepl)?
12:48danielszmulewi-1technomancy: if at all
12:48technomancydanielszmulewi-1: they're pretty much orthogonal
12:48technomancygrenchman is basically (among other things) a reimplementation of reply
12:48dnolenrurumate: looks like there still something wrong w/ your setup. It's using Clojure's reader instead of tools.reader
12:48technomancywhich nrepl.el is also a replacement for
12:49danielszmulewi-1technomancy: can you launch a nrepl connected with grenchman, or am I out of line?
12:50danielszmulewi-1technomancy: I know I might be missing the point
12:50technomancydanielszmulewi-1: right now you manage the nrepl processes out of band; that's currently outside the scope of grenchman
12:50technomancybecause it's difficult to create a flow that manages process state implicitly without hiding too much (see cake)
12:51danielszmulewi-1technomancy: so you issue commands from the cli with grenchman?
12:51technomancyright
12:51rurumatednolen: all I did was clone, then script/bootstrap && script/test
12:51technomancyyou start a lein server, then you can s/lein/grench/ for all commands
12:52dnolenrurumate: sorry can't help you trouble shoot atm, perhaps someone else can.
12:52danielszmulewi-1technomancy: 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:52danielszmulewi-1right?
12:52technomancydanielszmulewi-1: no, you can also keep a project JVM hot for an even greater boost
12:53danielszmulewi-1technomancy: oh, so there is a use case. Definitely I should look into it.
12:53technomancyso 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:53danielszmulewi-1technomancy: yes, true that.
12:54technomancybut 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:55danielszmulewi-1technomancy: OK, cool. Sounds intriguing. At least I already installed OCaml. :-)
12:55technomancynice
12:56eric_normandhas core.async been updated to work with the new keywords in clojurescript?
12:56tbaldridgeeric_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:56eric_normandtbaldridge: thanks!
13:00jstewSlightly OT: What color theme are you emacs users using? Zenburn is starting to zenburn my eyeballs.
13:01technomancyjstew: monokai is a nice change of pace
13:01technomancyit's not as mellow as zenburn though
13:01xeqimonokai here
13:01mbarbieriHi, 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:02jstewmonokai. I'll try that one. Thanks.
13:03Raynesjstew: I'm a fan of base16
13:03Rayneshttps://github.com/chriskempson/base16
13:04jstewPretty.
13:04jkkramermbarbieri: maps are probably fine. prismatic's schema might help you document and validate the shape of your data - https://github.com/Prismatic/schema
13:04eric_normandanybody going to be at Strange Loop this week?
13:05technomancyeric_normand: yesss
13:06mbarbierijkkramer: thanks, will look at that
13:06RaynesNo, eric_normand, not a single person is going to strangeloop.
13:06eric_normandRaynes: well, it was worth a shot :)
13:06eric_normandRaynes: I thought it might interest people in this chatroom
13:08callenJStoker: I use a custom one. github.com/bitemyapp/dotfiles/
13:09eric_normandtechnomancy: looking forward to any sessions in particular?
13:10callenmbarbieri: definitely just use maps.
13:10mdrogaliseric_normand: Couldn't get there this year, hopefully next.
13:10mdrogalisThe talk list looks awesome.
13:10eric_normandI agree
13:10eric_normandmdrogalis: just trying to narrow it down
13:11muhooheh, t-mobile templating fail: $ {{plan.price}} per month
13:12muhoosomeone's using moustache.
13:12callenmustache*
13:12muhoo(or some javascript thing on the client side, i have noscript)
13:12callenwonder how the template flew past unrendered.
13:13callenmuhoo: mustache is a client-side lib too. Could be handlebars.
13:13mdrogalisClosing song from Cognitect's podcast is excellent.
13:14bjacould be django/jinja2 too
13:14bjaand something escaped from the backend
13:14bja{{ }} is pretty common
13:16callenbja: I don't think it was Django/Jinja, that's not how the templates render.
13:16callenyou can't have a raw template slip past like that unless you're doing something wrong.
13:16callenmore likely it was mustache/handlebars/some derivative of Jinja, and it's probably a frontend template.
13:20muhoohuh, i didn't know pedestal was a relevance thing
13:22supersymyup... btw, anyone done some device detection in ring yet?
13:23callensupersym: that doesn't really compute. Device detection?
13:23callenRing is just an HTTP abstraction.
13:23supersymwell... server-side user-agent I guess
13:23supersymyeah.. well what I wanted to know if there is anything more to it then just fetching that out of the header
13:23callenyou shouldn't really do things with the user-agent server-side or frontend.
13:24supersymI guess my formulation was off, callen... :)
13:24callenyou just fetch it out of the headers.
13:24darrickwJust tried adding :source-map to a small clojurescript project I'm working on, formerly complied fine but now I get an NPE.
13:24supersymsee 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:24supersymthe 'why' since I thought there wouldn't be much more to it then, indeed, like you just said
13:26darrickwMy deps are core.async, core.match, and crate. Are any of those incompatible with the latest CS snapshot?
13:26muhoosupersym: 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:26mdrogalisdarrickw: Almost definitely not.
13:27supersymmuhoo: well.... yes and no :)
13:27dnolendarrickw: source map functionality is not heavily tested, assume things will not work at all with incremental compilation
13:27supersymtrendy thing: yes, thats true
13:27dnolendarrickw: you need to always lein cljsbuild clean as far I can tell currently (patches / detailed bug reports welcome of course)
13:28darrickwThanks dnolen, that was all it took
13:30supersymmuhoo: 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:31callensupersym: 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:31callenchanging content based on user-agents is some 1998 bullshit man. I thought people learned their lesson there.
13:31supersymoh ok... I didn't say I wanted to do that right
13:32supersymhaha
13:32tupihello, a license related quiz: can I attach a GPL v3+ to my clojure source code?
13:32muhoocallen: i didn't say it so dogmatically or emphatically though :-)
13:32AimHeretupi > You can attach it to your own code
13:32tupiAimHere: ok, thanks
13:32AimHereThe source code of clojure proper is available under the EPL
13:32muhooi just said it's trendy. whether it's good or not, i'm fine with letting others decide based on their needs.
13:32tupithat is what I wantd to know
13:32technomancytupi: some people claim it's OK if clojure itself is your only EPL'd dependency
13:33technomancytupi: but it would be difficult to write a clojure program and not pull in other EPL'd code
13:33supersymmuhoo: I know ;) thanks for your input
13:35muhooand, 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:35callenmuhoo: there are subjects that merit wriggle-room. That ain't one of them.
13:35callenmuhoo: o_O
13:36callenyou mean tethering?
13:36tupitechnomancy: i need to check with imagej 'people/license', but right now i am not pulling any other code then imagej
13:36muhooi guess that's to stop people tethering, yeah.
13:36muhooit's along the lines of using rot13 as an encryption algorithm
13:36callenaha! Relevance and the Datomic people merged
13:36supersymhehe
13:36technomancymuhoo: https://addons.mozilla.org/en-US/firefox/addon/firesomething/
13:36callenthere's going to be one uber-company in Clojure X_X
13:37muhootechnomancy: fun, thanks.
13:38muhootechnomancy: and since you're here.... what is the magick lein invocation to inject a form to execute when doing repl :conect ?
13:38muhooi.e. i want to connect to a repl, change to a ns, and execute some code, before i get a repl prompt.
13:38callenhttp://exercism.io/
13:39technomancymuhoo: I guess :repl-options :init
13:39borkdudeH4ns 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:39muhootechnomancy: bare on the comand line? or as update-in [:repl-options :init] ?
13:40borkdudeis 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:40technomancymuhoo: oh, huh. probably put it in a profile and do `lein with-profile +repl-init repl :connect ...`
13:40muhooi was trying to do it without having to create a profile just for that
13:41technomancyunless you need to specify it as a cli arg; then update-in would be needed
13:41muhooright, on the cli would be most convenient.
13:41technomancyprobably an update-in alias
13:41TimMccallen: I'm just surprised to learn Datomic had any pretension of being separate from Relevance...
13:41callenTimMc: I figured it was going to happen eventually.
13:41callenSo, I gave paredit and ac-nrepl the old college try again. I'm faster without both of them.
13:42callenI've been editing parens in Emacs too long to find paredit helpful - interferes more than anything.
13:42borkdudecallen paredit crashed my emacs when I pasted a big datomic schema file
13:42borkdudeit was reproducible
13:43darrickwdnolen: apologies, actually that didn't fix it -- I had the source map option commented when I tried earlier. Still getting the same NPE
13:43borkdudeable
13:43callenborkdude: lol
13:43callenborkdude: ac-nrepl made my REPL sessions really slow too.
13:43AimHereI 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:44borkdudeI use paredit, but sometimes I turn it off when I am in an invalid state due to copy pasting ;)
13:45technomancymerge conflicts are an easy way to make it mad at you
13:45borkdudetechnomancy oh yes, happened to me today
13:48H4nsborkdude: thanks! that was suggested to me earlier and it works very well
13:49borkdudeTIL you should never use the Github app and press sync
13:49callenborkdude: definitely not.
13:49callenGit was not made for muggle-mode.
13:49TimMcWhat does sync do?
13:50borkdudeTimMc I think push and pull but I don't know in what order
13:50callenbut against which remotes and branches? nobody knows!
13:50callen :P
13:50technomancycallen: GitHub is a lot less hostile than git, in general
13:51technomancybut one button for push+pull sounds like an awful idea
13:51borkdudeI rebased my branch onto a master branch
13:51borkdudeand then pressed sync and weird shit happened
13:52callentechnomancy: I like some parts of github, but the desktop app + sync thing is really bad.
13:53technomancyspeaking of github and bad ideas, does anyone have a user stylesheet to disable their stupid language breakdown bar?
13:53borkdudeI 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:55darrickwdnolen: FYI, solved my clojurescript source-map issue. The problem was that I had :optimizations :whitespace. In :advanced mode, it builds fine.
14:05borkdudeis cognitect also going to deliver support for clojureclr? ;)
14:11eric_normanddnolen: got source maps working. looks good.
14:11callenI can't get consumer tag based consumer cancellation working with Langohr "Unknown consumerTag" - anybody else encounter this?
14:12eric_normanddnolen: one problem is that it puts the whole path of the output file in the file, even though they are in the dir
14:12eric_normanddnolen: I'm thinking about how I would patch it
14:20eric_normandAfter warming up, new cljs compiler takes 6.5s to compile with advanced optimizations
14:27dnolendarrickw: it should work w/ whitespace optimizations too
14:27dnolendarrickw: I tried it myself yesterday and it seemed to work - there may be other issues at play
14:28dnolendarrickw: if you can construct a minimal case please open a ticket with details
14:29dnoleneric_normand: thoughts welcome, I don't have any great ideas there.
14:33mdrogalis12:25 http://www.infoq.com/presentations/Design-Composition-Performance Is he talking about tools like Cucumber and FitNesse?
14:33mdrogalisI could have sworn I heard him say in another talk that he didn't like testing frameworks like that.
14:34eric_normanddnolen: getting weird behavior from PersistentArrayMap
14:35dnoleneric_normand: I assume this unrelated to source maps?
14:35eric_normandyes
14:35eric_normandturned off source maps
14:35eric_normandand optimizations
14:35eric_normanddnolen: that is, default optimizations
14:36dnoleneric_normand: you mean :optimizations :none?
14:36eric_normanddnolen: no, no key in the cljsbuild map
14:36eric_normanddnolen: let me try with :optimizations :none
14:38eric_normanddnolen: ha! doesn't work at all. forgot about that.
14:38eric_normanddnolen: Need to include all of goof.*
14:38eric_normandgoog.*
14:38eric_normandsorry, automcomplete!
14:40bjadnolen: have you encountered any issues with Closure Compiler's CommandLineRunner.getDefaultExterns() not finding the externs.zip?
14:40eric_normanddnolen: ok, it's working.
14:40eric_normanddnolen: I just had to delete all the prior output
14:41eric_normanddnolen: and recompile
14:41dnolenbja: nope
14:41dnoleneric_normand: k, this happens if you upgrade ClojureScript and don't clean
14:41bjaI 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:42eric_normanddnolen: yeah, that's what happened
14:42eric_normanddnolen: sorry to bother you
14:44callentechnomancy: I was thinking the same thing.
14:49dnolenbja: 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:49jweiss .printStackTrace can take a printwriter or outputstream arg, isn't there some straightforward clojure way to get the string representation?
14:49jweissi looked at clojure.java.io but didn't see an obvious way
14:49bjajweiss: have you checked out how pp does it?
14:50bjaerr, pst
14:50jweissbja: i know how to manually create a stringwriter, printwriter, etc
14:52jweissbja: it does everything itself :)
14:52jweissi 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:53coventry`jweiss: with-out-str uses the binding macro on *out*. I think that's thread-local.
14:54jweisscoventry`: wouldn't other threads writing to stdout also end up being written there?
14:56coventry`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&gt;. Should be easy enough to test.
14:57jweisscoventry`: my point is that the jvm's stdout knows nothing about clojure var system
14:57jweissit's just a stream
14:57eric_normandjweiss: you are right
14:58eric_normandjweiss: *out* is for clojure functions
14:58coventry`Oh, I see.
14:58eric_normandjweiss: the standard way to do it is to create a printwriter
14:59eric_normandjweiss: then slurp it in as a string
14:59jweissyeah, i figured something in clojure.java.io would do that for me
14:59jweissbut i'm not seeing it
15:00eric_normandjweiss: or maybe try clojure.repl/pst
15:00eric_normandjweiss: it may print to *out*
15:00eric_normandjweiss: I'm not sure
15:01jweissright, same issue there and it uses its own format anyway
15:01eric_normandjweiss: I see
15:02jweiss,(let [e (doto (Exception. "Fooey") (.fillInStackTrace)) sw (java.io.StringWriter.)] (.printStackTrace e (java.io.PrintWriter. sw)) (println (.toString sw)))
15:02clojurebot#<SecurityException java.lang.SecurityException: denied>
15:02jweiss,(let [e (doto (Exception. "Fooey") (.fillInStackTrace)) sw (java.io.StringWriter.)] (.printStackTrace e (java.io.PrintWriter. sw)) (.toString sw))
15:02clojurebot#<SecurityException java.lang.SecurityException: denied>
15:02jweissbah
15:08eric_normandjweiss: looks like it works though
15:12eric_normand(defn st-str [e] (with-open [sw (java.io.StringWriter.) pw (java.io.PrintWriter. sw)] (.printStackTrace e pw) (.toString sw)))
15:12eric_normand,(defn st-str [e] (with-open [sw (java.io.StringWriter.) pw (java.io.PrintWriter. sw)] (.printStackTrace e pw) (.toString sw)))
15:12clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
15:15eric_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:15clojureboteric_normand: excusez-moi
15:15eric_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:15clojureboteric_normand: It's greek to me.
15:15eric_normandcome on!
15:15eric_normandjweiss: anyway, that works on my machine
16:33eric_normanddnolen: how does one test the cljs compiler?
16:34dnoleneric_normand: there's no good way to test the compiler currently.
16:38eric_normanddnolen: ok, I'll figure it out
16:38dnoleneric_normand: what's the problem?
16:38eric_normanddnolen: writing a patch for the source map relativizing files
16:39eric_normanddnolen: just wanted to make sure I didn't break anything
16:39dnoleneric_normand: nice, what about JARs and files served http:// (I don't remember if these get cached locally) ?
16:40darrickwdnolen: 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:40dnolendarrickw: yes but I got it to work just fine :)
16:40eric_normanddnolen: I am not sure how those work
16:40dnolendarrickw: so a minimal project and the minimal steps still needed.
16:40dnoleneric_normand: patch will need to address those cases.
16:41darrickwI even used the defproject from your blogpost… ok. I'll put up a gist of the whole project for you :)
16:41dnoleneric_normand: otherwise I'm unlikely to look at it.
16:41eric_normanddnolen: ok, I'll have to come up with a test case
16:41dnolendarrickw: with the precise steps on the command line to recreate error, thanks!
16:41darrickwok
16:42eric_normanddnolen: but this does generate a relative path to the source map
16:42appendonlyi 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:43dnoleneric_normand: maybe I'm missed something, is the "files" v3 source map entry relativized? or are you working on something else?
16:45eric_normanddnolen: the URL in this string is a relativized path: //@ sourceMappingURL=cs2.js.map
16:45eric_normanddnolen: it was //@ sourceMappingURL=extension/cs2.js.map
16:45eric_normanddnolen: but in the file extension/cs2.js
16:45dnoleneric_normand: k sorry I was confused :) what is the relativization based on?
16:46eric_normanddnolen: based on output-to option
16:46dnoleneric_normand: k this sounds good.
16:47eric_normanddnolen: and a slightly modified cljs.closure/path-relative-to
16:47eric_normanddnolen: I assume the browser can figure it out if it is relative
16:48eric_normanddnolen: but I am testing on another project right now that serves up files over http
16:51mtmdarrickw: 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:51darrickwyeah
16:52mtmit 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:55mtmlater 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:57mtmthis "var CLOSURE_NO_DEPS = true" is only added to 'source' when :optimizations is :whitespace, which is why things work in :simple and :advanced
16:57mtm /s/sources/source
16:58dnolenmtm: http://dev.clojure.org/jira/browse/CLJS-373
16:59callenClojureWerkz: We don’t have a new company to record podcasts about but we have 3 new libraries to announce this year.
16:59mtminteresting, but is 'sources' the right place to add this?
17:02dnolenmtm: this capability is intended as far as I know
17:03dnolenmtm: but in this case I guess that could be added later the same way we handle the output-wrapper and stuff like that.
17:04mtmokay, 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:04mtmyeah, sounds right
17:06dnolenmtm: hrm, but really we should probably just filter out things that don't have :source-url or :url ...
17:06mtmyup
17:10dnolenmtm: http://dev.clojure.org/jira/browse/CLJS-590
17:10dnolendarrickw: ^
17:11mtmthanks David
17:13eric_normanddnolen: ok, works when served from http
17:14dnoleneric_normand: cool
17:14eric_normanddnolen: I assume you would like a jira issue + patch?
17:14darrickwThanks to both of you! :)
17:15dnoleneric_normand: yep
17:15eric_normanddnolen: ok, doing it now
17:23mgaareis it not possible to add a docstring to a defrecord?
17:24eric_normanddnolen: ok, the patch is there; 5 line change
17:29dnoleneric_normand: thanks will take a look!
17:38dobry-denim so glad lein has that "enable ironic name" switch. my first 5 clojure apps were named "*jure".
17:38technomancyhm; I should probably add a rate limiter to that
17:38technomancy5 is too many
17:40dobry-densometimes you just need to hit rock bottom before you can improve as a person
17:41dobry-den5th one did it
17:41eric_normandnow all of your projects are clj-* ?
17:42xeqior literary characters?
17:42eric_normandor s/s/j/
17:45dobry-denyeah, that's the thing. Python has it easy with it's "Py" prefix.
17:45noonianis 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:45dobry-denClojure has Clo* puns and *jure puns. Both of which are hard
17:45dobry-denand clj is just an ugly combination of characters
17:46dobry-denlook at it
17:46dobry-denclj
17:46technomancyI'm glad we don't see a lot of foo4j-isms
17:47technomancywhat language your library is implemented in is really not something I care about seeing in clojars search results
17:48dobry-denhow about an oauth clojure library named Cloth
17:48dobry-denhow cute is that
17:48technomancyit is, in the vernacular, totes adorbs.
17:49callendobry-den: that's pretty cute.
17:50eric_normandI prefer the name "Rhododendron"
17:50dobry-denbut 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:50dobry-denthe only option is to name it Clothjure.
17:50callennooooo
17:50callenCloth was perfect :(
17:50eric_normandmaybe clojAuth
17:50dobry-deni don't make the rules
17:51dobry-denthe world's gotta know
17:51eric_normandI'd *buy* a library called Clothjure
17:51dobry-deni can serve that dish
17:51eric_normandlein buy clothjure
17:53callenI still think the best *-jure name was stolen by Seajure.
17:53dobry-denis that french?
17:53dobry-denno, it's my clojure oauth library
18:04mtpSeajure is pretty good
18:29pandeiroi'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:34supersympandeiro: you're using lein-cljsbuild?
18:35pandeiroyes
18:38pandeiroquick 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:38supersymIm 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:39amalloypandeiro: that's an exception you only get if you AOT against version x of google commons, and then run against another one
18:40pandeiroi tried with both 0.3.3 and 0.3.4-SNAPSHOT
18:40pandeiroamalloy: so i gotta clean something somewhere?
18:40pandeirotarget?
18:40amalloy*shrug* the cljs build process is a complete mystery to me
18:41supersymamalloy: glad to hear I'm not the only one
18:42pandeiroall this is my latest desperate attempt to make the cljs/js divide invisible
18:43dnolenpandeiro: your problem sounds unrelated to CLJS or lein-cljsbuild to me
18:43supersympandeiro: yeah it's probably in .m2 somewhere, stuff runs fine here... how about a `lein deps :tree`
18:44supersymsee if/where conflicts might be
18:45pandeiroit doesn't happen when i do not specify a clojurescript dependency specifically
18:46pandeiro(it = http://sprunge.us/OBAB)
18:47supersymok... I get the warning, then specify 1889 - works fine here too
18:47pandeirok must be on my end then... i'll keep investigating
18:48pandeirothanks for checking
18:48supersymah guava, I had problems with that too
18:48supersymearlier
18:49supersymnot 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:49pandeiroyeah lein cljsbuild 0.3.2 will compile my code fine if a cljs dep is not specified...
18:50supersymyeah...thats a bit odd
18:51gcganleyhey 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:53mlb-I want to create an Erlang-like event manager in Clojure. Would I want to start with a kind of singleton?
18:54supersymmlb-: https://github.com/MichaelDrogalis/dire is based on erlang style supervisor, would that be something you could use?
18:56mlb-supersym: not quite, but thanks for pointing that out to me!
18:59mlb-In different words, I want a central pubsub object to receive all events, and then route the subset for which subscribers have registered
18:59appendonlyone '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:00TimMcappendonly: By "top-level namespace", do you mean clojure.core?
19:01TimMcThere's nothing top-level about it, it's just another namespace.
19:01technomancyappendonly: one side-effect of learning clojure is that you will undoubtedly re-implement 3-4 functions in clojure.core; it's pretty inevitable.
19:01nooniangcganley: I would just look for examples of doing specific things in clojure that you know how to do in C
19:02appendonlytechnomancy :-)
19:02appendonlyTimMc: 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:02akurilin2 Can a solid case be made for NOT using the destructuring :or to provide default values?
19:02hyPiRionappendonly: there are no hungarian functions in Clojure afaik
19:02nooniangcganley: and also try to write everything completely functionally without figuring out how to modify anything but instead returning new values
19:02hyPiRionappendonly: I found http://clojure.org/cheatsheet to be handy when I started with Clojure
19:03appendonlyhyPiRion: cheers
19:03noonianakurilin2: :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:04TimMcappendonly: You *could*, using :refer-clojure, but that's gonna look pretty ugly and mess with your editor's ability to indent things appropriately.
19:06noonianappendonly: 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:11akurilin2noonian, hm ok, I'm goign to have to look into that
19:11akurilin2thanks!
19:11akurilin2bbl
19:11dnolengcganley: what kind of tutorial are you looking for? this is a quick intro http://adambard.com/blog/clojure-in-15-minutes/
19:15gfredericksI'm trying to convince myself that I know how to use primitives, but it's not going well
19:15gfredericks,(loop [^long x 0] x)
19:15clojurebot#<CompilerException java.lang.UnsupportedOperationException: Can't type hint a local with a primitive initializer, compiling:(NO_SOURCE_PATH:0:0)>
19:16gfredericksthat error message communicates to me "you can't do the thing you're trying to do"
19:17amalloygfredericks: [x (long 0)], although really 0 is already a long, so...?
19:18gfredericksamalloy: so primitives get used by default?
19:18amalloythe 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:19gfredericksokay. so if my loop body just has = and + then I should be good
19:20gfredericksmaybe I should learn how to examine bytecode :)
19:20amalloygfredericks: have you tried nodisassemble?
19:20amalloyit makes it way easier to find bytecode
19:23gfredericksamalloy: never heard of it
19:23amalloy(println (no.disassemble/disassemble #(loop [x 1, y 2] (= x y))))
19:25amalloyeg, 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:26amalloydunno why, really, since those both just return (x == y)
19:28gfredericksamalloy: cool, I'll check that out, thx
19:41Hari`hi
19:41callenHari`: hi
19:41hashcatHi
19:42Hari`:)
19:42callenHari`: FB?
19:42Hari`huh?
19:42callenHari`: checking to see if you were somebody I knew that works at FB
19:42Hari`ah
19:42Hari`nope
19:43Hari`i work at a finance startup..
19:44Hari`california
19:44Hari`we use haskell..
19:44hashcatgood lang!
19:44Hari`i joined this clojure irc chat for kicks..
19:44Hari`clojure seems nice too.. i'm new to functional programming etc.
19:45Hari`hi hashcat, are you in the haskell channel? :)
19:46Hari`lol
19:46hashcatI've learned Haskell for three years
19:48hashcatbut I think it's useless now
19:49Hari`hmm
19:49Hari`you didn't use haskell for anything? (or, for any production code...?)
19:50callenHaskell is fine, but I don't really want to make production systems with it.
19:50hashcatHari`, I wrote a genetic programming
19:51hashcatjust for hobby
19:51hashcatno one use it for production here
19:53hashcat_Hari`, what's your company?
19:55Hari`FastPay
19:56hashcatit sounds fun
19:56callenMy test runner of late: <up-arrow> (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (run-tests)
19:56callentoo lazy to fix prism or quickie to work properly.
20:18coventryIs there already a function which will invert a map? I.e., #(into {} (for [[k v] %] [v k]))?
20:20brehautcoventry: clojure.set/map-invert i believe
20:20callen"Clojure: the function already exists"
20:20technomancy(comp (partial apply zipmap) (juxt vals keys))
20:20callenuh oh, people are pseudo-golfing now.
20:20technomancy~juxt
20:20clojurebotjuxt is a little hard to grok but it's the best thing ever
20:21callenis the juxtaposition of applying the functions that hard to understand?
20:21brehautcallen: based on evidence: apparently so
20:21scottjcallen: no, not that hard, it's a little hard.
20:23gfredericks(defn mjuxt [m] (fn [& args] (zipmap (keys m) (map #(apply % args) (vals m)))))
20:23coventrybrehaut: Thanks.
20:23clojurebotNo entiendo
20:24callenShould start a juxt jihad.
20:24hashcatI'm amazed that people in here is more than scala channel
20:24callenhashcat: I'm not at all. Clojue is nicer to use.
20:25hashcatcallen: why not scala?
20:25gfredericksit's because scala is so easy that nobody needs to ask for help
20:25noonianand easier to look at imo
20:26brehautits because nobody needs help if they have static types
20:26noonianclojure is I mean
20:26coventryMaybe scala people socialize on twitter. :-)
20:26gfredericksbrehaut: the compiler tells you exactly what you did wrong and how to fix it
20:26hashcatI'm trying to choose one for next project
20:26hashcatscala or clojure
20:26callengfredericks: every single time. Without failure.
20:27callengfredericks: it never once fails to solve the halting problem and tell you exactly what's wrong.
20:27brehautgfredericks: kind mismatch, you might need some phantom types
20:27callen"It looks like you're using an if statement, I think you meant to use a monad here?" - Scala Clippy
20:28callenthen you use a monad, and your type signature is 4 times longer.
20:28amalloy(inc brehaut)
20:28lazybot⇒ 18
20:28gws"now you have two problems"
20:28callenactually, n problems, depending on whether or not you've stepped into the undecidable part of Scala's type system or not.
20:30gwss/two/#REF!/
20:30callenthis 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:31hashcatwell, I have a good idea. how can I mix scala and clojure?
20:31gfredericksput some parens around the scala
20:31brehauthashcat: with more difficulty than youwould in using core.typed ;)
20:31callenhashcat: don't. just use Clojure and core.typed if you really want types.
20:32callenrealistically you should just learn Clojure and wait to use core.typed until you understand everything.
20:32Rayneshashcat: You said "good idea" and I thought you actually had one for a second there. :(
20:32Apage43this 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:32callenI think you'll find types matter less than usual in Clojure than in other dyn langs.
20:32callenyou think less about specific types or reifications and more about "shape" and categories of things.
20:33Apage43(didn't bother to use the mortar and pestle properly, just used them both as mashing implements, because yes.)
20:33callenApage43: "We defeated CAP theorem! We are Conan the Data Manglers!"
20:33hashcatI still would like to try mix them
20:33callen"We knew something everybody else didn't bWAHAHAHAHAHA GIVE US MONEY NOW PLZ"
20:33caspercwierd question: what is the reason that reading a namespaced keyword like ::reload/error results in an invalid token error?
20:33callenhashcat: don't.
20:33Apage43"So our database is P?"
20:33casperc(read ::reload/error)
20:34hashcatcallen: type is not the only one I want
20:34callenpartition tolerant as you don't care about the data being correct or getting an answer.
20:34callenhashcat: doesn't matter. don't do it.
20:34hashcatdsl in scala looks pretty
20:34callenApage43: sounds solid to me.
20:34caspercit happens both using clojure build in reader and tools.reader
20:34callenhashcat: learn Clojure alone anyway.
20:34callenDSLs in Scala are horrific monsters, lol.
20:34hashcatcallen: what's the problem??
20:34lazybothashcat: What are you, crazy? Of course not!
20:35hashcatcallen: Monster?
20:35bbloomhashcat: DSLs in scala rely heavily on the type system for implicit conversion and operator overload resolution
20:35hashcatis lazybot actually a bot?
20:35brehaut&(inc 1)
20:36lazybot⇒ 2
20:36Apage43casperc: ::blah resolves to :current-namespace/blah
20:36Apage43so ::foo/bar tries to become :some-ns/foo/bar
20:36Apage43,:a/b/b
20:36clojurebot:a/b/b
20:36bbloomhashcat: 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:36Apage43which.. should work it looks like =P
20:36Apage43,::a/b
20:36clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::a/b>
20:36Apage43or maybenot
20:36caspercApage43: hehe
20:36Apage43it's not obvious which ns that should wind up in, at any rate
20:36caspercApage43: it seems to want the symbol to exist in the other namespace
20:36hashcatbbloom, you've convinced me
20:37Apage43casperc: well
20:37hashcata lot of bots lol
20:37Apage43,::fun-error
20:37clojurebot:sandbox/fun-error
20:37Apage43is fine
20:37amalloyApage43: ::foo/bar will never resolve to :some-ns/foo/bar
20:37caspercApage43: but to me that is wierd since I am just reading not evaluating
20:38amalloyit 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:38Apage43casperc: reading a keyword instantiates the thing though, since they are values
20:38srruby* (* 3/2 4/3)
20:39Apage43amalloy: ah.. so..
20:39Apage43,::io/funsies
20:39clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::io/funsies>
20:39caspercamalloy: yeah, but it means that when I try to read a file with that kind of keyword it will fail
20:39amalloycasperc: yes
20:39Apage43would resolve to clojure.java.io/funsies if I require clojure.java.io as io?
20:39amalloyApage43: try it and see?
20:39caspercI am basicly looking for a way around it :)
20:40amalloyfor this reason (and also data_readers.clj), you can't really just-read a clojure program without evaluating it, i believe
20:40Apage43yup
20:40Apage43https://www.refheap.com/18731
20:41srrubyWhy does the repl give 2N when I input (* 3/2 4/3)
20:41Apage43:: is craftier than I thought
20:42caspercI am trying to read a bunch of clojure files without having to eval them or load dependencies, and this gets in the way
20:42Apage43looks like you're in trouble then, since you can't properly read ::'s without evaling at least the ns form
20:43caspercand I can eval the ns form without first eval'ing its dependencies (i would think)
20:43casperc*can't
20:43Apage43pretty much
20:44casperchmm
20:44Apage43this makes writing tools to manipulate clojure code a bit tricky
20:44Apage43since you'll wind up.. running parts of the program
20:44coventryYou 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:45Apage43look at https://github.com/xsc/rewrite-clj
20:46Apage43which 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:47coventrycasperc: What do you want to do with it once you've read it in?
20:47caspercApage43: that might be an option. I am basicly looking to extract things like docstrings and function names, so it might be enough
20:48amalloysrruby: 2N is a bigint, and clojure stores its rationals as a numerator/denominator pair of bigints
20:49casperccoventry: 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:49callenquick, somebody ask a question touches on Clojure internals that amalloy cannot answer.
20:49caspercwhich I have basicly done, but this one is tripping me up, annoyingly
20:50callencoventry: haven't you been doing a much of stuff with reading and mangling namespaces?
20:50coventryWhy 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:51casperccoventry: i think ns creates the ns if it is not present and in-ns does not
20:51coventrycallen: 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:51callencoventry: whyyyyyyy were you doing?
20:51callen*that
20:52coventrycasperc: It was a response to callen's challenge to stump amalloy. I don't expect an answer. I think it is a bug.
20:52caspercah :)
20:52coventrycallen: My judgement was bad. :-)
20:53callencoventry: isn't it because a.b.c wasn't required before the in-ns?
20:53coventrycallen: Don't think so. The in-ns version fails at the repl after the ns version has run.
20:56amalloycoventry: because in-ns isn't a macro, and ns is
20:56amalloyit wants a symbol, iirc
20:56callenfuck I think he's right
20:56amalloylike, the definterface/deftype is a total red herring; your in-ns call fails immediately
20:56coventryOh, duh. Thanks, amalloy. :-)
20:56SegFaultAXYou know what else is a red herring?
20:56SegFaultAXCommunism.
20:57callenApparently getting engaged makes people less funny.
20:57callenUnless you're Bill Cosby.
20:57SegFaultAXcallen: Go watch Clue... then get one.
20:57coventryAnyway, 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:58callenWRRRRRYYYYYYYYYYYYYYYY - channel error; reason: {#method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1
20:59SegFaultAXTrue story, the progfun class most definitely does require working knowledge of Scala in particular.
20:59SegFaultAXWhich is fine, but it's marketed as... not that.
20:59casperccoventry: thanks, i'll give it a go.
21:00callenif RabbitMQ were something I could wrap my hands around, I would be strangling it.
21:00callenmy pain ratio for RabbitMQ and Datomic for the last 2 weeks is 10,000:1
21:02casperccoventry: 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:02casperc, (require '[clojure.set :as a]) (read-string "::a/asdf")
21:02clojurebotnil
21:02casperccrappy hack but it avoids me having to eval
21:03coventryOh, 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:05caspercthanks for the input. I am off to bed :)
21:06coventryThe directory-crawling tools in tools.namespace will be useful, too.
21:13coventryAnd 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:50AimHereSigh. 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:52AimHereSo 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:52AimHereBut no matter what I do, it's not working. What's the actual syntax I need?
21:53AimHereIt happily accepts ^{Foo {"id" "wibble"}} or ^{Foo {:id wibble}} or many, many variations without so much as a comment
21:59callendeftype ^{java.lang.Deprecated true} MyClass
21:59callengen-class :name ^{java.lang.Deprecated true} MyClass
22:00AimHereYeah, but that's for the annotation @Deprecated
22:00callenso find the annotation class and set it accordingly.
22:00callenif that doesn't work for you, we can discuss my contract rate.
22:01callenalso if AOT doesn't suit your needs, you're boned. aphyr was complaining about the lack of annotation support in proxy awhile back.
22:02AimHereWell in your example, if I was to annotate @Deprecated(baz="wibble"), that 'true' would be replaced by a map containing 'baz' and 'wibble'
22:02AimHereSo it would look like ^{java.lang.Deprecated {baz wibble}}
22:02AimHereTrouble 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:02callenif you keep using the word wibble, I'll be giggling too much to help you.
22:02callenAimHere: use strings.
22:03AimHereWell 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:04AimHereChas 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:04callenwell listen to him, not me.
22:05ddellacostaAimHere: are you trying to figure out how to add methods to a gen-class?
22:06AimHereI've added the method. I'm trying to annotate one
22:06ddellacostaAimHere: ah, okay, apologies.
22:08callenI love it when people post a second shorter version of example code and it could be shortened even further
22:08callentoday it's select-keys and keys that people forget exist.
22:09callen,(let [orig {:a 1} new {:a 2 :b 3}] (select-keys (merge orig new) (keys orig)))
22:09clojurebot{:a 2}
22:09callenis there some reason to do the same with filter and into {} ?
22:17amalloycallen: were you reading http://stackoverflow.com/questions/18808048/clojure-merge-with-remove-keys-that-are-not-common/18811538#18811538 recently, or what?
22:18amalloyi mean, i guess it's not actually the same function, but it's closely related
22:24callenamalloy: no, some blog post.
22:25callenmy version above actually matches the semantics of the version of their code. It's not slightly different or anything.
22:34ddellacostaany 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:58clj_newb_2345anyone have a good exmaple of using clojure as a "markup" language
22:58clj_newb_2345I want to output a rather complicated text document, and I want things like (str "...") to be a raw string
22:58clj_newb_2345but to also have other clojure expressions compile to strings to be intot the document
22:59clj_newb_2345i.e. think: TeX, but with clojure instead of TeX's macro langauge
23:39coventryIs 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:41bbloomcoventry: sadly, destructuring doesn't have a well defined behavior for non-matches against sequences (at least in my opinion)
23:41bbloomcoventry: the best you can do is [rc & more] and then (assert (nil? more))
23:42dnolencoventry: or you can use core.match
23:42bbloomdnolen: heh, right that too
23:43coventryChecking & more is good enough for now. Thanks.
23:48amalloybbloom: fwiw i think (assert (not more)) reads better
23:49bbloomamalloy: 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:50amalloyi also have a function somewhere (assert-length N coll), so you could (let [[rc] (assert-length 2 '(1 2))])
23:50coventryYeah, I thought about doing that.