#clojure logs

2012-08-02

00:05emezeskero_st: I think if you just use the latest clojurescript compiler version it brings in a pretty new version of the google closure library
00:06ro_stso how do i set that? i'm using your advanced-example project.clj almost verbatim
00:06emezeskewell, typically lein-cljsbuild just pulls in the latest tagged release of the compiler
00:06emezeskeSo if your lein-cljsbuild is up-to-date, then so is your compiler
00:07emezeskeIf you want to get something newer than the latest release (e.g. head of git), that is possible too (see the lein-cljsbuild wiki)
00:07ro_sti'm on cljsbuild 0.2.4
00:08ro_sthow do i check which version of cljs i'm using?
00:08ro_sti don't see it in either lib or .lein-plugins
00:09emezeskeThat would be r1443
00:09emezeskeI don't know how to find that out easily, other than looking at the cljsbuild project.clj
00:09ro_stjust by using cljsbuild 024 i have goog-jar 1.0.0 in my deps
00:09emezeskeNot goog-jar
00:10emezeskeYou probably don't want goog-jar, that is old and icky
00:10ro_stcorrect :-)
00:10emezeskeSee this: https://github.com/clojure/clojurescript/blob/master/pom.template.xml
00:10emezeskeIn there is the latest version of the google-closure-library that clojurescript pulls in
00:11emezeskeSo maybe just get rid of goog-jar?
00:11ro_stok i'll try that, thanks
00:47ThatOneGuyare cookie strings supposed to be percent encoded?
00:56amalloy$google http spec rfc cookie
00:56lazybot[RFC 2965 - HTTP State Management Mechanism] http://tools.ietf.org/html/rfc2965
00:58ThatOneGuywhat section?
00:59amalloyi dunno, mate. this isn't #http
00:59emezeskeamalloy: I thought amalloy stood for http bot
01:01dakroneThatOneGuy: they aren't, I just had to do a fix to make sure they aren't
01:01dakroneThatOneGuy: according to the RFC anyway
01:01dakroneThatOneGuy: they can be either encoded, or plain text
01:02ThatOneGuywell in clj-http it percent encodes it
01:02ThatOneGuyand the API im interfacing with seems to be thinking that im not logged in even though I'm sending the session cookie
01:03dakroneThatOneGuy: clj-http should not: https://github.com/dakrone/clj-http/commit/a704e8576cd30647e9b8f526fc0edeb2494e8a6b
01:03dakroneunless you're using an old version
01:14akhudekis clojurescriptone a good example of how to use the google closure library from clojurescript?
01:14akhudekIn particular, how they use extend-type with events and other things
01:14akhudekhttp://clojurescriptone.com/documentation.html
01:15ThatOneGuyI was using 0.5.0
01:16ThatOneGuybut I just updated leinengen to use 0.5.1
01:16ThatOneGuywhen I look at the debug output, its percent encoded
01:16ThatOneGuyits percent encoded in the cookie-store
01:25TheBusbyany tricks for helping to deal with things like cyclic maps with the repl? Everytime one is accidentally output to the screen emacs/slime locks up :(
01:25ThatOneGuycyclic maps?
01:26TheBusbya map within a map that refers to it's "parent"
01:27ThatOneGuyhow does it refer to its parent?
01:28TheBusbyterrible example but: (def a {}) (def b (assoc {} :a a)) (def a (assoc {} :b b)
01:28TheBusbyer, well failed at that
01:28ThatOneGuyoff the top of my head I can't think of a use case for that
01:29TheBusbyA tree where you a leaf can reference it's parent
01:31akhudekTheBusby: that doesn't create a cyclic map
01:31TheBusbyakhudek: no it doesn't, I don't have a simple example do you?
01:32akhudekI may be tired, but I can't see how it's possible.
01:32akhudekYou can generate infinite lazy lists though
01:32TheBusbyis there a trick to prevent printing that from causing problems?
01:32TheBusbylazy-lists I mean
01:33akhudekI think it depends on the repl.
01:33akhudekSome are supposed to truncate long lists.
01:33akhudekWhich would work.
01:33TheBusbywould you happen to know which repls may support this?
01:34akhudekI seem to remember the Netbeans + Enclojure repl did, but that project isn't updated.
01:35TheBusbyakhudek: thanks! Will check out my repl and see if I can impose a max-length or something ;)
01:37amalloy&(doc *print-length*)
01:37lazybot⇒ "; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection... https://www.refheap.com/paste/3980
01:37amalloy&(doc *print-depth*)
01:37lazybotjava.lang.RuntimeException: Unable to resolve var: *print-depth* in this context
01:37amalloywell, there's something depth-based too
01:37TheBusbyamalloy: awesome! thank you!!!
01:38amalloyTheBusby: better advice, which you will probably ignore, is to stop making mutually-referring data structures
01:38TheBusbyamalloy: that's actually the direction I'm headed, but I need to pull apart some working code to make that happen first.
01:39TheBusbywithout the repl, I'm finding that much harder than first appeared (due to this print issue)
02:28francistest for dupes messages in eirc
02:29francis,(println "eric functioning")
02:29clojureboteric functioning
02:33ro_stemezeske: i killed goog-jar, and then 'lein cljsbuild once' redownloaded it
02:34ro_sti haven't explicitly installed clojurescript at all. i'm not even sure where it is on my system
02:35ro_stall i did was grab cljsbuild and start using it
02:37ro_sti'll try the git checkout method
02:38emezeskero_st: Did you remove goog-jar from your project.clj?
02:38emezeskero_st: If not, maybe one of your other dependencies depends on it
02:38ro_sti never had it in my project.clj
02:38emezeskero_st: The git checkout will do you no good
02:39emezeskeSo, goog-jar is not being downloaded due to anything to do with lein-cljsbuild or clojurescript
02:39emezeskeThat much you can be certain of
02:39ro_sti grabbed your advanced-example and started using it
02:39emezeskeLet me look at that
02:39emezeskeone sec
02:39ro_stmight it be enfocus, then?
02:40ro_stit's enfocus :-(
02:40emezeskeOkay, if you know which dep is pulling it in, you can override it with lein
02:40emezeskeThere's no guarantee that enfocus will work with the new google closure library, but you can try
02:41emezeskeSomething vaguely like this should do the trick: [enfocus "x.x.x" :exclusions [goog-jar]]
02:41emezeskeObviously, fix the lib names and version as appropriate
02:41ro_styeah. just did a clean and doing a build now
02:42ro_stok, now i'm getting: required "goog.dom.query" error
02:42ro_stwhich means that it's no longer using goog-jar
02:42ro_stand now some other goog library
02:43emezeskeHmm... I thought goog.dom.query was included in the newer google closure library versions
02:44ro_stit's something that enfocus wants
02:44ro_sti've got closure-library r1978 downloaded and goog.dom.query doesn't appear to be in there
02:44emezeskeSo, historically, there was a "third_party" directory included in the "goog-jar"
02:44emezeskeThat dir contained the query stuff
02:45emezeskeMaybe you need another dep, let's see
02:45emezeskeMaybe try this: [org.clojure/google-closure-library-third-party "0.0-1376"]
02:45ro_stahh that makes sense
02:46emezeskeI wish I could go back in time and kill the goog-jar
02:46emezeskeso badly
02:46emezeskewith fire
02:46ro_sti just searched the svn and i found query in third_part/dojo
02:46ro_stok. cleaned, compiling again...
02:47emezeskeHopefully the new google closure library is fairly backwards-compatible
02:47ro_steven worse. loads of errors now. can i not just give it the svn checkout i have instead?
02:48emezeskeSo, ultimately, your problem is that enfocus is waaaaaaaaaaaaaaaaaaaay out of date
02:48ro_stoh wait, it seems like the thirdparty jar only has the thirdparty stuff, none of the main lib
02:48emezeskeThe clojurescript compiler includes all of the main closure library
02:48emezeskeBy "includes" I mean "depends on"
02:49ro_stlooks like a new enfocus is coming this weekend
02:49ro_stthe reason for all this hopscotch is so that i can use shoreleave-pubsub which needs the html5localstorage stuff
02:50emezeskeYou would be a champion of champions if you pinged the author and mentioned that goog-jar is evil and ancient
02:50ro_sti totally will. can i quote you?
02:50emezeskeAs long as I didn't say anything offensive, sure
02:51emezeskeThis may be of interest: https://groups.google.com/forum/?fromgroups#!topic/clojure/EGmc95gRaH0
02:52ro_st-tries that-
02:54ro_st:whitespace is building ok
02:55emezeskewhoa
02:55ro_stbut for some daft reason :advanced has loads of required "goog.xxx" namespace never provided
02:56ro_stoh. :whitespace is simply not adding any goog.*
02:56ro_stno goog.provide("goog. present in the file
02:56emezeskehuh
02:58ro_stshould i have [org.clojure/google-closure-library + -third-party] in :dependencies?
02:58ro_stor somewhere else?
02:58ro_stbecause i see both those jars in ./lib/.
02:59emezeskeYou don't need the non-third-party one, as the clojurescript compiler depends on that
02:59kralnamaste
02:59emezeskeYou *should* only need the third party one.
02:59ro_sthttps://www.refheap.com/paste/3981
03:00ro_stdoes cljsbuild fetch clojurescript and put it somewhere if it's not present?
03:00ro_stperhaps i need to find and murder cljs and get a fresh install. i just don't know where it is
03:00emezeskeSo lein-cljsbuild depends on a JAR called cljsbuild, which depends on org.clojure/clojurescript
03:00ro_stfound it. killing it
03:01emezeskeYour project.clj looks good to me
03:01ro_stok i deleted cljsbuild and clojuresciprt
03:02ro_stgot cljsbuild 0.2.4 and clojurescript 0.0-1443 after doing a lein deps
03:02emezeskeThat seems appropriate.
03:02emezeskeI'm not sure what deleting them would do, though
03:05ro_sttrying again with no enfocus in play
03:06emezeskeI wish you the best of luck with that. I'm out for the night
03:07ro_stthanks. no joy. still no goog js appearing. weird!!
03:07ro_stwill hunt
03:09ro_stand thanks for your patience and support :-)
03:52ro_stis there a convenient way to get a seq of all the public fns in a namespace?
03:54ro_st… in clojurescript
03:55ro_stlooks like clojurescript doesn't have any of the ns_ fns
04:11aperiodici remember hearing that clojurescript doesn't have first-class namespaces, so... probably not?
04:22ro_styeah. just checked the cljs source. nothing there
04:23augustlwhich JVM are most people using for Clojure dev and prod? I'm currently on openjdk7 on my dev machine.
04:23augustldisclaimer: I've got no prior JVM experience
04:39ro_stis there some way to map over a collection with awareness of the previous item? kinda like reduce, but i dont' want to return a single value
04:40ro_sti need to compare N against N-1 to see if they have a differing value, and if so, inject additional stuff into the returned element for N
04:41liwpro_st: (map #(+ %1 %2) (rest coll) coll)
04:41ro_stoooh
04:42ro_stso %1 will be N+1 and %2 will be N
04:42liwpro_st: yep
04:42ro_stwill it execute all the way to nil, last-item?
04:43Fossi,(doc map)
04:43clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
04:43ro_st,(map irc://irc.freenode.org:6667/#(+ %1 %2) (rest [1 2 3]) [1 2 3])
04:43clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: irc://irc.freenode.org:6667, compiling:(NO_SOURCE_PATH:0)>
04:43ro_stcrap
04:43liwpro_st: it'll stop when one of the two collections ends, so I think you'll miss the last element
04:43ro_st,(map #(+ %1 %2) (rest [1 2 3]) [1 2 3])
04:43clojurebot(3 5)
04:44ro_stok so i'll have to add a spurious nil on
04:44ro_st,(map #(+ %1 %2) (rest [1 2 3 nil]) [1 2 3 nil])
04:44clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NullPointerException>
04:44ro_stdamnit
04:44ro_steasy to sort out
04:44ro_stthanks for that liwp, super handy!
04:44liwp,(map #(+ %1 %2) (concat (rest [1 2 3]) nil) [1 2 3])
04:44clojurebot(3 5)
04:44liwpblah
04:44liwpro_st: np
04:44Fossinil isn't so smart ;)
04:45liwp,(map #(+ %1 %2) (concat (rest [1 2 3]) [0]) [1 2 3])
04:45clojurebot(3 5 3)
04:45liwpthat's better
04:45ro_styeah
04:45liwp,(doc append)
04:45clojurebotPardon?
04:45ro_stin my case the coll is of maps, and i'm producing enlive templates
04:46amalloy&(partition 2 1 [1 2 3])
04:46ro_stso i'll just wrap with a check for nil
04:46lazybot⇒ ((1 2) (2 3))
04:46djcoinmap with multiples list as arg is kinda map with zipped lists ?
04:47broquaint,(doc fnil)
04:47clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
04:48ro_stamalloy: partition - awesome!
04:48ro_stthat's much cleaner
04:53ro_stconj'ing onto a sequence puts the added item at the beginning, right?
04:58Raynes&(conj (seq []) 1)
04:58lazybot⇒ (1)
04:58Raynes&(conj (seq [2]) 1)
04:58lazybot⇒ (1 2)
05:00ro_sttx
05:18Jeonhey guys I have a simple question. how come (#(apply map * %&) [1 2 3]) works but (apply map * [1 2 3]) doesn't?
05:19ro_st,(apply map * [1 2 3])
05:19clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
05:19ro_st,(apply map * [[1 2 3]])
05:19clojurebot(1 2 3)
05:19ro_stbecause apply is tearing the vector apart
05:21Jeonin function literal form then? no tearing?
05:24aperiodicno, because you're implicitly wrapping the arg to apply there in a seq by using the rest-args destructuring for anon functions (%&)
05:25aperiodicso your anonymous function literal there expands to (fn [& x] (apply map * x)), which when invoked on [1 2 3], results in x taking on the value '([1 2 3])
05:26ro_sttook the words right out of my mouth -grin-
05:26aperiodicso the two things you compared aren't actually equivalent, hence it's no surprise they don't both work :)
05:26ro_stmaybe i'm just high on caffeine, but i think clojure is -ing awesome. enjoying it thoroughly
05:29aperiodici love clojure. it's just such a pleasure to think in compared to other languages. so clean.
05:29Jeonthank you, and wow.
05:29aperiodicof course, it's my main language both at work and on the side, so perhaps i've just lost touch ;)
05:29aperiodicyou're welcome
05:30Jeoni'm new to clojure and reading a book called programmin clojure and it is interesting but little confusing so far.
05:30ro_sti still have to spend time in ruby and php codebases, and occasionally actionscript/flex
05:30ro_styou have not lost touch, trust me
05:31ro_stJeon: this one? clojurebook.com
05:31Jeonyes
05:31ro_stgreat book
05:37aperiodicJeon: it's probably very different from what you're used to, but it's so worth sticking it out
05:37ro_st+1
05:38aperiodicJeon: a little confusion is totally natural; I was quite disoriented for my first few weeks
05:43Jeonyeah, i've heard so many great things about lisp. and it is very simple and powerful compared to other languages i've learn so far.
05:46ro_stalmost always you're having to unlearn stuff
05:46ro_stit's like starting with svn and then moving to git
05:46ro_sti know (lucky) guys who never had to use svn, and git feels completely normal for them
05:48ro_stcvs! jeez
05:49broquaintYep, the bad old days.
05:50aperiodicgit is the only source control system i've ever used
05:51ro_sti started with VSS -barf-
05:51broquaintYow.
05:51ro_stc'est horrible
05:53aperiodicso how is using git after svn like using clojure after more 'traditional' (that is, c-style) languages?
05:54ro_stunlearning the inferior ways of doing things. trying to fit git in the svn box as compared to learning git fresh makes git a lot more confusing to understand (at least, it was like this for me)
05:55djcoinro_st: c'est horrible -> are you french ? :)
05:55ro_stso too coming from static typing and OOP to clojure
05:56ro_stdjcoin: nope, but taking french classes
05:56djcoin:) all right
06:00aperiodici do miss static typing a bit. mainly haskell's type system. it lets you refactor without fear in a way i find almost intoxicating.
06:00broquaintaperiodic: Similar in learning experience - understanding new concepts and paradigms then applying them in (initially) novel ways.
06:01aperiodictyped-clojure might provide me some of that, though (or trammel)
06:03djcoinYeah static typing really is a feature.
06:05ro_sti like static typing. i hate the crap OOP makes you do as a result
06:07djcoinYep
06:07djcoinI look(ed) (not very close) at Scala but it seems overcomplicated/bloated
06:07djcoinBut flexible
06:09aperiodicits flexibility makes me a little wary, honestly. i like how clojure has strong opinions, and Scala doesn't really strike me as having any
06:10_nmmngood overview, hehe =]
06:11aperiodici haven't used it, though; that's just my impression from the light research i've done on it (i.e. looking at scala-lang.org for a bit)
06:25leoncamelhey, how can I do a exponetiation with bigint type ? in clojure 1.4
07:12ro_ststruggling with setting an input text's value with enfocus. set-attr :value "foo" shows a change in Chrome's Dev Tools, but the actual html display doesn't update. weird
07:19haspakerClojure Textbooks really lack syntax highlighting
07:19haspaker
07:28ro_sthaha yes
07:28ro_stmy biggest complaint reading it on the ipad
07:28ro_stclojure needs syntax highlighting, especially rainbow parens
07:29depyrainbow parent FTW!!! WOOOO!
07:29depyparens* not parents... Ô_o
07:41meenalHi, is there an equivalent for org.antlr.stringtemplate.StringTemplate in clojure?
07:51ro_stcemerick mentioned something that does string template interpolation the other day. buggered if i can remember what it was
07:51ro_ststich or sew or something like that
07:51ro_sta clj library
07:52hyPiRionSpeaking of which, is there any html highlighter for clojure with rainbow parens?
07:52hyPiRionI know pygments can output Clojure, but not rainbow parens afaik.
07:52cemerickmeenal: StringTemplate is quite usable from Clojure as-is. Alternatives include clojure.core.strint (https://github.com/clojure/core.incubator/) and comb (https://github.com/weavejester/comb).
07:53ro_stcomb!
07:53ro_sthyPiRion: the only place i've seen rainbow-parens is inside of vim and emacs
07:54hyPiRionro_st: I know CCW for Eclipse has it as well.
07:54hyPiRionBut it's not html :(
07:54meenalthanks cemerick and rost! i wil have a look at comb
07:56cemerickhyPiRion: you can produce HTML exports of editor contents in Eclipse, though you'd need to write a plugin for it AFAIK. Maybe one exists already?
07:56cemerick*really* long way around just to get a particular syntax highlighting treatment, though.
07:57hyPiRionyeah, and I don't want to be dependent of Eclipse to format clojure code.
08:07cshellintellij/la clojure has rainbow parens
08:12cshellcemerick: does your book talk anything about best practices with regards to keywords? I use them everywhere and I'm afraid if I change one it will have impact across the program - are we supposed to use a 'keywords' file and all refernce them via var?
08:13ro_styou mean :these ?
08:13cshellright
08:13ro_stthey evaluate to themselves
08:13cshellI know
08:13cshellbut what if you use :these in 20 places
08:13ro_stfunctionally the same as "these"
08:13cshellI know, but refactoring becomes problematic
08:14cshellI'm wondering if (def these :these) is better
08:14ro_stregex search and replace? \b:name\b
08:14cshellbecause you will get compile warnings if you don't change
08:14ro_sti think that'll add too much noise to the code, personally
08:14cshellro_st: that is problematic if any of your other files use :these - so I'd say it's almost better to have ::ns/these than just :these
08:15ro_stregex search and replace in files? :-)
08:15cshellif you use :these in a different context, yes
08:15ro_sti get your point, though
08:15ro_stcan you use namespace/:foo ?
08:16cshellyeah
08:16cshellit's something like :ns/foo
08:16ro_stso that it's clear which :foo you mean (even though all :foo s are the same)
08:16cshell,:foo
08:16clojurebot:foo
08:16cshellyep, exactly
08:16cemerickcshell: No, we don't talk about that. In practice, it's not really a problem.
08:17cshellcemerick: okay, thanks - I didn't know if it would be I just saw the possibility
08:17cemerickThe refactoring issue is shared by nearly every dynamic language (e.g. python, ruby, etc) though.
08:18cemerickcshell: The Typed Clojure effort seems to have gotten a fair ways along in providing some degrees of safety in this area, though I've not used it myself.
08:18cshelland they don't like to use vars for keywords and have everyone use vars?
08:19cshellwouldn't typed clojure be adding complexity? I thought i saw types in the complex list in hickeys simple/vs/easy talk - but that mmight have been objects
08:30cemerickcshell: hardly; most lookups in e.g. python use strings.
08:49somecljguySo what are people's opinions on wrapper libraries? I have seen some people say that they generally don't think they are necessary, but I have a couple libs that use Thrift that would take much less code to use if they had a wrapper lib
08:50meenalI would like to read a properties file and getits contents as a key value pair, just like java.util.properties. is there a way in clojure for the same?
08:51somecljguyanother thing... there are a bunch of java objects/collection types that get created by Thrift, which are what you have to pass around inside of thrift. Is there a common pattern to translating to/from these Java objects from things that are easier to use in Clojure (maps)?
08:54XPheriorHere's my situation. Two projects, A and B. A depends on B. B is proprietary, and can't be put on a public Maven repo. I've seen that you can add the jar for B to a Maven repo within A's project, but I don't want to have jars in the repo. Can B be depended on and built from source?
08:54XPheriorThat might need some clarification, heh.
08:54somecljguymeenal: have you seen this http://stackoverflow.com/questions/7777882/loading-configuration-file-in-clojure-as-data-structure
08:55hyPiRionmeenal: Like a config file? I use clj-config
08:55somecljguymeenal: the top answer just uses the usual java Properties utils to load it into a Clojure map
08:56cshellput B in your local repository
08:56cshellor put B in a private repository
08:56XPheriorcshell: Then A's source tree will get huge. (To your first statement)
08:57XPheriorPrivate repository? Need to explore that. Haven't heard of it.
08:57cshellXPherior: Not source repository
08:57cshellXPherior: Put the B jar in your local maven repository (.m2)
08:57cshellXPherior: Until you put it in a private repository ( cloudbees.com gives you them for free)
08:58XPheriorcshell: Right, can do that. But I don't want to move the B jar into .m2 every time I change it. I want it to be built and updated dynamically
08:58XPheriorcshell: Handy to know!
08:58ro_stXPherior: lein install will install the lib from source into .m2
08:58XPheriorI think what I'm asking for is probably ridiculous
08:58cshellevery time you change B's source, you'll have to do an install to install it to .m2
08:58cshelllein and maven will do it for you with lein install or mvn install
08:58ro_stif you're in B, you lein install to compile and publish it to .m2. then A will use it when compiling next
08:59ro_stcloudbees: awesome!
08:59XPheriorro_st and cshell: Hm.. That sounds like a reasonable solution.
08:59ro_stwas wondering how to do private shared maven repo
08:59cshellro_st: Yep, they'll even give you free jenkins which will build and deploy there if you like
08:59ro_stXPherior: i'm just parroting what people have told me. never done it before -grin-
09:00XPheriorThat's how you learn, ro_st :)
09:00XPheriorIsn't lein install a Lein 1 feature though?
09:00cshellno
09:00XPheriorOr I'm thinking of install plugin?
09:00cshellit's in both
09:00cshellprobably
09:01XPheriorAh. Okay, I think this is a good start.
09:01XPheriorThanks for the thoughts guys. I'll let you know how it goes.
09:01ro_styou'd better :-)
09:01cshellIt's one command, and you're in control of when to rebuild the B artifact, not automatically upon file modification
09:01ro_stit counts on your Permanent Record
09:01XPheriorOh ro_st. Lemme Gist you something..
09:02XPheriorcshell: That does seem more ideal.
09:02XPheriorWouldn't want to always update in case I'm doing a refactoring or something
09:02cshellXPherior: exactly
09:02cshellXPherior: You'll need private remote repository if you are working with a team
09:03XPheriorSure am, cshell.
09:03XPheriorI think they'll like this solution.
09:03XPheriorro_st: This was how I managed to swap out the development DBs (defined with defdb and defentity) for the test DB. https://gist.github.com/351b9e031c8b457ca2ab
09:04cshellChecko out cloudbees, it can even detect source code changes that have been committed and can push your artifacts to the remote repo
09:04XPheriorInside a Midje fact, just use (with-test-db) macro.
09:04XPheriorcshell: It looks like a good solution. Will almost certainly use it. I'm refactoring a PHP project into Clojure web services, some of which depend on each other.
09:04XPheriorSo we're gonna need good deps management.
09:05ro_stthat's awesome, XPherior!
09:05XPheriorThanks ro_st! It took me many hours, but it's a super clean solution.
09:06meenalthanks somecljguy and hyPiRion
09:06ro_stdo you have to wrap all your facts with (with-test-db), or are you able to use (background (around :facts (with-test-db ?form)))
09:06meenalbut i am looking for a clojure-way to do it
09:06ro_stthe latter is way preferrable because then your facts are toplevel and midje-mode can work
09:06XPheriorro_st: I haven't tried that. I didn't know it exists. Hah.
09:06ro_sthttps://github.com/marick/Midje/wiki/Setup%2C-Teardown%2C-and-State
09:06ro_stboom
09:07XPheriorFacts look like: (fact "Explanation" (with-test-db ...) => result)
09:07ro_stah
09:07meenalsomecljguy: just like i found now from cemerickk that comb is an equivalent for StringTemplate in clojure
09:07ro_sttry the background thing. you might be able to dry your facts up quite a bit
09:07XPheriorI definitely will. Thanks for the info!
09:08ro_stbackground works really well. you can specify :contents (whole file), :facts (whole fact) and :checks for individual () => () checker sets
09:08XPheriorHot dang. I like that
09:08ro_stso you can have stuff happening before/after/around at each of those granularities
09:08XPheriorThat fits the bill. We have macros around all facts, so that'll work.
09:09ro_stwhat i love about it is that it's all neatly tucked away at the top
09:09ro_stand your facts are all about the test you're performing
09:09XPheriorCan't beat that. I'll be back in a minute, need to go talk to someone.
09:22cshellIf i have a sequence of maps, how do I extract the maps so that I can pass the maps into merge?
09:24ro_stwith apply, maybe?
09:25ro_streduce over the maps and merge in the reducer
09:26cshellapply worked
09:26cshellthanks ro-st
09:26cshellI've actually never used apply
09:26ro_stit's very handy
09:28jsnikerisIs there an easy way to reconstruct the absolute URL that resulted in a given Ring request?
09:28hxiaothe :uri key in the request object should help you
09:29jsnikerishxiao: That doesn't include the scheme, server, port etc
09:29hxiaoah, apologies
09:30jsnikerishxiao: I can definitely reconstruct it from the request, but I'm wondering if there is an easier way
09:33hxiaoi don't think you're going to be able to just get it from one place
09:33jsnikerishxiao: why not?
09:34hxiaohttp://clojuredocs.org/ring/0.2.3/ring.util.servlet/build-request-map
09:34hxiaomeh, which version of ring you using?
09:34jsnikerisThe most recent
09:35hxiaoa normal HttpServletRequest object allows you to getRequestURL which contains pretty much everything except query string params but ...
09:36hxiaoi'll poke around
09:37jsnikerishxiao: I don't think the HttpServletRequest available though. Ring translates that into a request map
09:37hxiaoyeah that's what i mean, ring pulls stuff out of that so i'm looking through the src to see if it calls that anywhere
09:38jsnikerishxiao: I can just str together the values from the request map I suppose
09:38hxiaoyeah that build request map function doesn't look like it's changed much through the versions
09:39jsnikeris(str (:scheme req) (:host req) ... etc)
09:39hxiaonah, getRequestURL isn't called anywhere in ring's src code, only getRequestURI
09:39hxiaoi'm afraid you'll have to string it together
09:39jsnikerisI'm just surprised that nobody has ever needed the absolute URL of a request
09:39jsnikerisI think I'll write a middleware that adds it to the request
09:40hxiaoor pull request it =)
09:40hxiaoshouldn't be hard
09:40jsnikerishxiao: Thanks for the help
09:41hxiaonp
09:43pjstadigbecause of the conversation with mk yesterday, I have filed a bug http://dev.clojure.org/jira/browse/CLJ-1036
09:57somecljguySo what are people's opinions on wrapper libraries? I have seen some people say that they generally don't think they are necessary, but I have a couple libs that use Thrift that would take much less code to use if they had a wrapper lib
09:57somecljguyanother thing... there are a bunch of java objects/collection types that get created by Thrift, which are what you have to pass around inside of thrift. Is there a common pattern to translating to/from these Java objects from things that are easier to use in Clojure (maps)?
09:58cshellisn't it about building a dsl for your domain? so if you could wrap things to create a valuable abstraction, that speeds development later?
09:58cshellsomecljguy: use teh bean function to create a map from a java object
09:59somecljguyis there a way to reverse the bean function?
09:59somecljguyor will I need to write one
10:00somecljguyI mean I guess it should be straightforward-ish to (reify with the class property of the map
10:00somecljguyor can I somehow use that AND keep a reference to the object itself?
10:01somecljguywithout cluttering things up..
10:01cshellI don't know, I'd make all your java contact points take/return a map
10:01cshellif you start passing around objects in clojure you'll probably get a lot of runtime errors
10:04somecljguycshell: it would definitely be nice to only have to use maps in the clojure code. that is part of why I am doing this
10:05cshellyep, that would be idiomatic
10:05cshellbut remember java idioms are to have immutable
10:05cshelldata structures
10:05cshellso you'd probably just want to take your map and invoke a new constructor
10:06somecljguyyeah, I think I will try that out first. seems like the most straightforward way for now
10:20naegHi. I started learning Common Lisp some time ago, but my actual goal is to learn Clojure. I've read 10/32 chapters of Practical Common Lisp, but I'm unsure whether I should finish the book or start learning Clojure right away?
10:20ro_stclojure++
10:20somecljguynaeg: if your end goal is learning Clojure, you should definitely just start learning Clojure
10:20ro_st(-> 'clojure inc inc)
10:20ro_st:)
10:20mdeboardnaeg: I strongly recommend http://www.clojurebook.com/ ... the best (with respect to authors of other great Clojure books) resource for learning Clojure as a beginning
10:20naegsomecljguy: so the payoff of learning CL first is not worth the time?
10:21ro_stnaeg: i don't think so, because you'd have to unlearn stuff to learn clojure
10:22naegmy uncertainty arised because of this: http://missingfaktor.blogspot.de/2012/07/tour-through-land-of-lisp.html
10:22ro_starose* -duck-
10:23naegin this case I'll start with Clojure right away - thanks
10:23naegro_st: sorry :P
10:23mdeboardnaeg: Have no uncertainty, learning Clojure will give you sufficient grounding in why so many parens, prefix notation and functional concepts. Dive right into Clojure.
10:23somecljguynaeg: I am not really sure what you would gain by learning CL first, given that your goal is Clojure
10:23naegand clojurebook.com is the place to start, as suggested by mdeboard
10:23naeg?
10:24gtraknaeg: Joy Of Clojure is the most serious book
10:24ro_stclojurebook.com is the newest, and aside from that advantage, it's also comprehensive and (i think) it does a great job
10:24somecljguynaeg: Joy of Clojure and clojurebook.com are both good books to use to learn
10:24mdeboardnaeg: In my own personal experience it is the most well-grounded and basic, aimed as it is as people who are coming to Clojure from other high-level languages :) (Disclaimer: I also own Joy of Clojure and Programming Clojure books)
10:30bryanlI'm trying to get randum data out of a csv file. My code mostly works, but isn't very idiomatic (this is my first clojure app™). Right now, this returns a LazySeq, but I just want to return a string. I'm using a for block to cycle through the code, but definitely don't think that is the proper solution. https://gist.github.com/3237459
10:32Wild_Cathow do I tell Leiningen's repl to reload the current project?
10:33ro_stcode reloading isn't built in
10:33cshelllol, good question - I just ctrl-c and then restart lein repl
10:33ro_sti believe noir does its own reloading
10:33pjstadigbryanl: for returns a seq, so you need to call first on it before returning from your fn
10:33mdeboardbryanl: (fir-- ... what pjstadig said
10:33ro_stautomatic reloading via filesystem watcher, i mean
10:34ro_stsurely there's a lein plugin that does this, by now?
10:34pjstadigWild_Cat: you could probably (in the repl) do something like (require ['foo.bar :reload-all])
10:35bryanlpjstadig, mdeboard: thanks!
10:35pjstadigor maybe it's (require 'foo.bar :reload-all)?
10:35drewrbryanl: presumably you want to return hetero/samesex for each line, or is it an aggregate calculation?
10:35bryanldrewr: no, just for one line that matches the argument to the defn
10:36drewrah, yes, I see that now
10:36drewrbryanl: I would pass orientation-data and lookup in as args too
10:37bryanldrewr: that's the plan. i'm stumbling here trying to figure language semantics and core libs at the same time
10:55bryanli showed someone some code yesterday, and they said defrecords were being deprecated. I can't find anything on it, is it true?
10:55drewrbryanl: they will likely never be deprecated; they're too important to the lang at this point
10:55drewrhowever
10:56drewrthey're not always the best thing to use in application code
10:56drewrif you just need dispatch, use multimethods or even a map
10:57drewryou can still use structmaps too
11:14ro_stohpauleez: i was able to compile enfocus and shoreleave-pubsub by using org.clojars.lypanov/google-closure-library-repackaged and org.clojars.lypanov/google-closure-library-third-party-repackaged
11:14ro_stand excluding goog-jar from enfocus
11:15ohpauleezThat would indeed do the trick (it has the LocalStorage wrapper in it) thanks for the heads up!
11:15ohpauleezI was going to hit up the dev mailing list today and ask for a new goog-jar
11:16ro_stit'd be lovely if the clojurescript folks would pay attention to http://dev.clojure.org/jira/browse/CLJS-276?focusedCommentId=29073#comment-29073
11:16ro_stso that the official lib jars work the same way
11:17ro_stand for enfocus to drop goog-jar entirely
11:17ro_stwhich i've asked creighton to consider
11:17cmajor7what is the way to step into jar sources (using lein/VimClosure)?
11:17cmajor7*Clojure (well, that's a bad misspell :) )
11:18ro_stohpauleez: so, it compiles, but i still get the "Cannot set property 'shoreleave$pubsubs$protocols$IPublishable$' of undefined" error when trying to run the gist from the pubsub github issue
11:19ohpauleezro_st: ah, ok. Thanks for the heads up.
11:21ro_stohpauleez: https://www.refheap.com/paste/3991
11:21ro_stso, we're using the same goog lib that the latest stable clojurescript does
11:22ro_stare you using something else/something newer?
11:30naegone more thing: Clojure is not less usable for AI-related tasks than Common Lisp, right?
11:32hyPiRionnaeg: I believe it is more usable, with core.logic.
11:33ohpauleezro_st: I'm just using straight CLJS, but I do hand pack my goog jar, so I'll delete it from my .m2 today
11:33ro_stohpauleez: i have to run now. i really hope you manage to find a gap to sort this issue out. i'm eager to put pubsub solidly to use
11:33ro_stah, awesome :-)
11:34naeghyPiRion: as long as it's not less usable, I'm fine with it :)
11:34hyPiRionI've been using it for some AI-tasks at university, and as of right now I have had no issues with it.
11:34naeghyPiRion: what do others use for this tasks?
11:34ro_stnaeg: https://vimeo.com/46163091 and https://vimeo.com/45128721
11:35hyPiRionnaeg: Python, usually. Or Java, but it's mostly because they know Java well and want to test the waters.
11:35naegro_st: will take a look at them later, thanks
11:35hyPiRion*don't want to test the waters
11:36naeghyPiRion: are your solutions much shorter and simpler than others?
11:37naegor at least tend to be or whatever :P
11:38naeghehe, #clojure is even mentioned in the acknowledgments
11:38hyPiRionnaeg: Probably, but I don't know whether it's because of the language I use.
11:39hyPiRionI usually generate shorter/readable code than others in my subjects.
11:40naegcool. can't wait to start studying at a university myself
11:41hyPiRionnaeg: I really recommend trying out both, and pick the one you prefer to write in.
11:41naegboth = common lisp and clojure?
11:41hyPiRionyeah
11:43naegat some corners CL seemed a bit...cumbersome to me (maybe because I didn't grasp all the details behind it yet), but the actual reason why I wanted to learn clojure is deployment and JVM/CLR
11:47hyPiRionYeah, Clojure is nice in that regard. Just type in "lein uberjar", and you've got a runnable version of your code.
12:04kaoD_https://www.refheap.com/paste/3994 what am I doing wrong?
12:06ThatOneGuyreading...
12:06kaoD_works fine if I implement only Object's toString
12:07kaoD_the problem is IFn
12:07ThatOneGuysorry man I'm not at the level of recods
12:07ThatOneGuyrecords*
12:07ThatOneGuystill learning HOFs
12:08kaoD_HOF?
12:08clojurebotHOF is Higher-Order Function
12:08kaoD_lol
12:08kaoD_(inc clojurebot)
12:08lazybot⇒ 12
12:09kaoD_records are easy actually, check em
12:10kaoD_(there are several typos in that paste, btw)
12:11S11001001kaoD_: record already implements IFn, you can't do it again
12:11S11001001the only exception to the general "you can't reimplement things implied by record" rule is Object
12:13kaoD_well, I just did implement IFn and it worked (it turns out the typos were the problem)
12:14S11001001hmm.
12:14kaoD_https://www.refheap.com/paste/3995
12:15eph3meralis there something simpler/easier than java -cp clojure-1.4.0.jar clojure.main to start up an "interactive clojure" ?
12:15kaoD_eph3meral: leiningen
12:15kaoD_it will bring you joy and pleasure
12:15eph3meralkaoD_, ok cool thanks I'll look in to it
12:16kaoD_eph3meral: it's not just a repl (as easy as "lein repl" under your project's dir) but a whole build tool
12:17kaoD_more like... general automation
12:17ThatOneGuymore like AWESOME
12:19solussd_is it possible to get emacs to indent my macros the same way it indents clojure.core/if-let, let, etc. (i.e., two spaces for args on new lines)?
12:20Frozenlo`Everything is possible in emacs :P
12:20Frozenlo`Although in this case I don't know hoe to do that...
12:20Frozenlo`*how
12:21solussd_I'm not sure why it does it for library macros and not my macros.. :/
12:21clojurebotHoly Crap.
12:21Frozenlo`solussd_: Just checked one of my macros; the indentation seems correct.
12:22Frozenlo`Could you paste yours?
12:22S11001001solussd_: if it's anything like common lisp and emacs lisp approach, you set a property on the similarly-named elisp symbol indicating indent rules
12:22solussd_sure
12:22muhoowhen i add :dev {:dependencies to a project.clj, is it supposed to completely override and wipe out the :dev {:dependencies in ~/.lein/profiles.clj ?
12:22muhooor are they supposed to merge?
12:22technomancymuhoo: yeah, you shouldn't set :dev in ~/.lein/profiles.clj
12:22technomancymuhoo: you want :user in that case
12:23muhoooh, ok, thanks
12:23nickmbaileyk
12:26solussd_ha, ref heap does the same thing. must be exceptions carved out for certain symbols
12:26solussd_Frozenlock: https://www.refheap.com/paste/019541365e34bdafec6564612
12:26muhoothere was some discussion about nohup earlier, i figured something out. "lein2 repl :headless &" does NOT work-- the process stops and refuses to run without stdin-- but "nohup lein2 repl :headless &" DOES work
12:27technomancymuhoo: that's kind of crappy; can you open an issue?
12:27muhoosure
12:27technomancy:headless should work without stdin
12:29kaoD_is it possible to override deftype's constructor?
12:30kaoD_I want to keep a transformed argument along with the type
12:30kaoD_(realized)
12:31kaoD_I don't want to realize it again and again
12:35Frozenlocksolussd_: I just realized that my macros are starting with "with-", which seems to automatically indent them as expected.
12:35technomancysolussd_: in general there's no good way to do it
12:36kaoD_I guess I'll stick with the factory function
12:36technomancybecause you have to eval arbitrary elisp code to change the indentation
12:36technomancyso if you have half the committers using the new indentation rules and half of them not, you're going to have a mess on your hands.
12:37technomancyand allowing eval of arbitrary elisp when you visit a file belonging to a project is a really bad idea
12:37muhoook, so lein2 is ignoring my :user profile completely
12:38solussd_technomancy: makes sense
12:38Frozenlocktechnomancy: Depending on the project, having an org-babel file for this purpose could be interesting
12:38technomancyFrozenlock: I don't follow
12:40muhoowhat am i missing here? do i have to explicitly invoke "with-profile user,dev" ? or does user get implicitly invoked?
12:41muhoo(sorry for the dumb-ass questions, i'm only a day into lein2)
12:42FrozenlockProject.clj, Readme.org, Custom-project-rules.org... Where Custom-project-rules.org (or custom-project-rules.el, whatever float your boat) has the necessary elisp to customize the identation. I don't see this used everywhere, but in specialized project it could be useful.
12:42technomancymuhoo: user gets applied by default for everything except things producing downstream artifacts (like pom, jar, and uberjar)
12:42technomancybecause your personal config is not supposed to affect what others consume
12:42FrozenlockBut in my case I'm too lazy to ever do it. I would just accept the default indent :)
12:43technomancyor you could just eval a single file at the project root if you're going to go to all that trouble =)
12:44FrozenlockSure. But the more I think about it, the more I think it's a bad idea. Please disregard what I've been saying for the last few minutes :)
12:55jsabeaudryIf anyone else is always wondering (about cljsbuild) when did that "Successfully compiled" line was printed? Here is a neat little trick: lein cljsbuild auto | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }'
13:06TimMcDoes that just print the time that the command finished?
13:07nDuffTimMc: Looks like it prints the time of each line of output
13:07nDuffTimMc: ...so one can get an idea of how much time each individual piece of the process is taking.
13:18jsabeaudryTimMc, yes exactly, so when you switch to that window you get a indication of whether or not that last "Successfully compiled" line is from the save you just did or the previous one 5 minutes ago.
13:21TimMcAh! I see.
13:32KirinDaveUgh. Storm's macros in its clojure binding are pretty scary
13:33KirinDaveThe instant you try and use macros to call storm's macros you run into all kinds of problems.
13:34KirinDaveTo get the reader happy about "can't let qualified symbols" I had to quote nearly every symbol.
13:34KirinDavehttps://gist.github.com/05477f0c92eec4f9c4fb
13:35KirinDaveI couldn't find an alternative way to fix that. Anyone have advice when you run into that kind of situation?
13:35raekKirinDave: why can't you use auto-gensym'ed symbols here?
13:35emezeskeKirinDave: I think that's when you normally use gensym
13:35KirinDaveYeah but normally I shouldn't have to.
13:35emezeskeKirinDave: e.g. symbol-name#
13:36raek(at all places except for "name")
13:36KirinDaveSo I dunno if that'd actually do anything other than radically obfuscate the code.
13:36emezeskeKirinDave: You're using syntax-quote, so without using gensym or regular quoting, your macro is writing code like (let [my.namespace/foo ...] ...)
13:36raekgensyms are made for this scenario
13:37KirinDaveI suspect people do not understand the error I am trying to correct here. :\
13:37KirinDaveI'm not introducing these symbol names into the binding because I want to.
13:37emezeskeKirinDave: See my message above -- "cannot let qualified symbols" is exactly what I am talking about
13:37KirinDaveemezeske: Right, but that's not me doing it.
13:37emezeskeKirinDave: I see no less than two lets in your code
13:38emezeskeKirinDave: Plus, I'd assume the defbolt arguments are used as bindings (subject to the same restrictions as let)
13:38KirinDaveemezeske: Yeah
13:38raekhttps://gist.github.com/fd7c827a7502f9222d1f
13:38KirinDaveThat's what the problem is.
13:40raekKirinDave: you can't assume that the defbold macro does not use names like "tuple" or "collection" internally.
13:40emezeskeYou almost never want to use ~' , unless your specific goal is to create an unhygenic macro, which is almost never your goal
13:40KirinDaveraek: Actually the reason it asks for them is that so it uses my binding.
13:40raektherefore you need to make new unique symbols that won't collide
13:40KirinDaveemezeske: I use it to introduce names for anaphoric macros periodically.
13:41emezeskeKirinDave: That's what I meant by unhygenic, your term is more correct
13:41raekKirinDave: do you know about "symbol capture"?
13:41hiredmanKirinDave: "can't let qualified symbols" has nothing to do with the reader
13:41emezeskeKirinDave: Unless you're doing that, you want gensym I think
13:41KirinDaveraek: Yes.
13:42XPheriorlein install is putting my jar in the target folder of the project. How can I make it publish to .m2?
13:42KirinDaveraek: The problem is that the underlying macro is asking for bindings instead of making new ones. My complaint is that the storm macros are hairy in this way. :)
13:43KirinDaveraek: And also the gensym approach breaks in one place which is why I went quote-crazy.
13:43cgagyou could change the storm macros
13:43raekwhere does it break?
13:43KirinDaveraek: let me rever this goofy change back to the normal way and show you, one sec.
13:44raekKirinDave: what do you mean by "asking for bindings"? the same thing as let does (let [<here> foo] ...)?
13:44KirinDaveraek: yeah, defbolt actually creates a few methods and an object definition and it uses this one name in multiple places.
13:45KirinDaveI've been meaning to re-write the bindings and contribute back for awhile now.
13:45KirinDaveI've just been busy actually building topologies.
13:46raekso the actual names of the symbols are meaningful here? (and not only for "name"?)
13:47KirinDaveraek: Not sure actually. I sort of despair at debugging clojure macros when they get too deep.
13:47raekI would at least use foo# for the doseq, let, and catch bindings
13:47KirinDaveYeah
13:48raek(I assumed that the third argument to defbolt worked like fn)
13:48KirinDaveNo actually that's the output name field.
13:49KirinDaveHonestly i sort of wish this macro WOULD just introduce the bindings "tuple" & "collector" and tell you to deal with it.
13:49KirinDaveBecause all it does is clutter up the macro and also if you ever do name them anything other than "tuple" and "collector" you should be taken to the wall and shot.
13:51raekdid you get what the "can't let qualified symbols" problem was about?
13:51KirinDaveNo I do.
13:51KirinDaveIt's just what was breaking was an inner let.
13:51KirinDaveNot mine.
13:51KirinDaveBut yes, I do understand variable capture.
13:52mprenticehappy thursday folks!
13:52mprenticeaquamacs users: i'm using a nightly build (2012-07-17) and when my cursor is after a ), it's not highlighting the matching ( like it used to
13:52mprenticeis anyone else experiencing this?
13:53mprenticewhen i'm on the (, it highlights the matching ) fine
13:53mprenticevery weird bug
13:53mprenticeor i have weird settings, always possible
13:53KirinDaveAh, okay. I can make it work if I just don't use this form of defbolt.
13:53KirinDaveThe non-prep version is too magical.
13:53KirinDaveGood. I felt pretty dirty doing all that quoting and saying, "Good luck with your composition" to future generations.
13:58pepijndevosis there an up to date tutorial about how to set up vimclojure with leiningen?
13:58cgagi just followed this: https://github.com/daveray/vimclojure-easy
14:12tutysra_anyone know what happened to clojure.contrib .java-utils package
14:13tutysra_I am looking for the method - as-properties
14:13xeqi~contrib
14:13clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
14:14xeqidoesn't look like anyone step up to bring it forward and maintain it
14:16tutysra_ok...so if i wanted to use some code that uses them then I have to copy the relevant code from the libs and make them work with 1.3?
14:21xeqitutysra_: as-properties looks like it might work as is - https://github.com/clojure/clojure-contrib/blob/master/modules/java-utils/src/main/clojure/clojure/contrib/java_utils.clj#L85
14:22KirinDavehey just curious
14:22KirinDaveI've got some code I use at work for our internal ring api endpoints
14:23KirinDaveit makes it trivial to add metrics and healthchecks to ring servers
14:23KirinDaveand also lets you automatically add zookeeper registration into the lifecycle of a jetty server.
14:23KirinDaveI'm considering open sourcing it but I dunno if there is already a ring-bootstrapper like that.
14:24KirinDaveIf someone knows of something like that, could they point? Just so I mention it in the readme as I open source.
14:25muhoonow that's interesting. lein2 is definitely picking up my :init and :plugins from my ~/.lein/profiles.clj :user profile, but it's totally ignoring the :dependencies in that profile
14:26muhoosorry, :repl-options and :plugins from :user profile are coming in, but :dependencies are not
14:26muhoodoh, nevermind, i am a moron. misplaced }
14:27antares_KirinDave: I am not aware of anything like that, maybe ask on the mailing list? And thank you and your company for open sourcing good stuff.
14:27muhooyay, lein-pprint :-)
14:28KirinDaveantares_: it is entirely selfish. You can't hire good engineers without a good reputation as a shop that does interesting and/or quality work.
14:28KirinDaveantares_: And we want to hire good engineers. Lost too many to other "sexier" job offers.
14:29antares_KirinDave: sure, that's in part why I started clojurewerkz.org, too
14:29antares_but still :)
14:45muhooemezeske: still grinding along trying to get cljs repl working. even doing it this way https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments (browser/repl) the browser hangs while trying to POST 0 bytes, weird.
14:46muhoohttp://bace.s3.amazonaws.com/weirdbrowse.png
14:46ibdknoxhopefully in the next couple weeks light table might make all of that painless
14:50jbarriosdoes 'lein uberjar' include the JVM options defined in project.clj?
14:50muhooif i switched from emacs to lighttable, in the long term, probably
14:52ynnivit would take a lot to move me from emacs to light table
14:53ynniveasier to make light table vi-like
14:54muhooit's a whole different way of looking at development. very exciting. but, i have projects to complete NOW, and that means emacs, which is muscle-memory for me.
14:57muhooalso, this browser repl communication in cljs with a streaming GET and a bunch of XHR POSTS feels really janky and fragile to me, no matter what is laid on top of it.
15:01pbostrommuhoo: have you already tried repl-listen? https://github.com/emezeske/lein-cljsbuild/blob/0.2.5/doc/REPL.md
15:01muhoopbostrom: i'm trying to do it from within nrepl.el :-)
15:02muhootook me a while to upgrade to an emacs that supports lein2, upgrade to lein2, get regular nrepl.el going, all good now.
15:03muhooso next step was baby steps: try just running the cljs browser repl from within a regular repl session (through nrepl), using this (repl/repl env) method in the cljs docs. and that's hanging.
15:03muhooit's probably something obvious. time for a break. :-)
15:10muhooer, sorry, had to upgrade to emacs24 to support nrepl.el. *defnitely* time for a break
15:18azkeszHi guys(and gals), what IDE are you using for clojure ? does it have find all references or definition? (ie. just like eclipse has for java)
15:18ThatOneGuyim using eclipse with the CC plugins
15:18ThatOneGuyits really great
15:19azkeszcounterclockwise?
15:19clojurebotcounterclockwise is eclipse plugin
15:19ThatOneGuyyup
15:19ThatOneGuy=> (str "a" "b")
15:19ThatOneGuy(str "a" "b")
15:19azkeszalright I'll check that, is there other plugins ?
15:19azkeszare*
15:19ThatOneGuyim guessing clojurebot isn't actually a bot
15:19ThatOneGuyfor eclipse I don't think so
15:20Wild_Cat,(str "a" "b")
15:20clojurebot"ab"
15:20ThatOneGuybut there are plugins for other IDEs
15:20azkeszThatOneGuy what do you do to find all uses of a function in your project, with eclipse+cc ?
15:20ThatOneGuygood old find
15:20ThatOneGuybut it supposedly has symbol look-up
15:20azkeszfrom the Search menu?
15:21ThatOneGuyCtrl-F
15:21azkeszdoes that search in all files?
15:21azkeszsymbol look-up sounds good, I'll keep an eye out for that
15:22ThatOneGuyif you hold CTRL it turns all symbols into links. but I just tried it and it says cannot find declaration for symbol on a use of one of my functions
15:22cemerickccw will navigate to var definitions, but won't find uses
15:22ThatOneGuycan it navigate to function definitions?
15:23azkeszcemerick what do you use to find uses?
15:23cemerickThatOneGuy: Yes, but you need a REPL open for the project and have the source file loaded.
15:24cemerickazkesz: as ThatOneGuy, simple text search
15:24azkeszThatOneGuy the Ctrl+click works for 'range'
15:24azkeszcemerick alright
15:25cmajor7cemerick, glad to see you on irc! I have a question regarding friend: http://bit.ly/N1Hpy9
15:25ThatOneGuyyeah works on core functions
15:26azkeszThatOneGuy how do you make the source code show error when it's an error ie. a typo for a core function that doesn't exist?
15:26azkeszin eclipse
15:26ThatOneGuyumm Ctrl-Alt-S
15:26ThatOneGuythe repl tells me the errors
15:28ThatOneGuytypos are an easy catch as it says cannot find symbol and gives the line number. but usually after that you rarely get line numbers as it has already been parsed by the reader.
15:28azkeszThat works, but I was hoping that eclipse would too, for me it's Ctrl+Alt+L load into repl
15:28ThatOneGuyand for me at least most of my errors happen in incorrect usage of core functions
15:28ThatOneGuyctrl-alt-s switches to the repl also
15:28ThatOneGuyoh you changed from the default?
15:29azkeszyou're right, ctrl+alt+s works also, but I had a desktop shortcut bound to that which would run sync
15:29azkeszI kept the defaults
15:30ThatOneGuysupposedly there are two edit modes
15:30ThatOneGuyi haven't tried the other one yet
15:30azkeszunrestricted and parens?
15:30azkeszstrict/paredit edit mode, i like this one
15:30ThatOneGuyohhh wow..
15:30ThatOneGuyive been typing both parens this whole time
15:31azkeszxD
15:31ThatOneGuyI thought it was kind of wierd why it didn't do it auto like curly braces
15:32cemerickcmajor7: I'm afraid I know nearly nothing about noir.
15:33cemerickHowever, you almost certainly don't want to have the :login-uri and :unauthorized-redirect-uri be the same
15:33cemerickAnd, you don't pass username/password to friend at all, you need to POST them to whatever is configured as the :login-uri
15:34cemerickcmajor7: ^^
15:37ThatOneGuyhttps://gist.github.com/3239978 feedback?
15:38cmajor7cemerick: great, thanks a lot. I do have it working for some time, using a regular POST (no ClojureScript). As far as username/password, they are there in the request, and I could see that Ring combines those params. Do they absolutely need to be in a :query-params of the request?
15:38cmajor7(as to noir, it just takes a ring handler and a current request and passes it over to the server side in this case)
15:45ThatOneGuyhttps://gist.github.com/3239978 feedback?
15:48xeqi&(map boolean [nil false '()])
15:48lazybot⇒ (false false true)
15:48xeqiwhy remove emptys ?
15:49ThatOneGuybecause it corresponds to no useful data at that key
15:50ThatOneGuy&(:important-data {:important-data {}})
15:50lazybot⇒ {}
15:50ThatOneGuy&(:important-data {})
15:50lazybot⇒ nil
15:55xeqido you want to remove keywords and symbols?
15:56cemerickcmajor7: as long as you're using standard compojure site middleware, they'll end up as mapped via keywords in :params (so you can POST with them in the query string or as form params)
15:58cmajor7cemerick: right, so my request already has ":form… params" with username/password
15:59cmajor7cemerick: I am not sure how to debug a "(handler request)" that is called from under friend/authenticate* and throws a StackOverflow..
15:59cmajor7cemerick: could it be something in the request it expects but does not find?
16:02cemerickcmajor7: I'd run without ring.middleware.reload, if that's the last frame prior to the repeating one that overflows.
16:26cmajor7cemerick: looking on how to do that.. it seems that noir has a list of middleware(s) it applies to the handler: http://bit.ly/MfwNHW (under "wrap-noir-middleware"). "wrap-route-updating" is a wrapper around "ring.middleware.reload", what would be a (pure Clojure) way to remove that from a chain.. e.g… "override the method" excluding "(wrap-route-updating)", or there is a different cleaner way? thank you.
16:26RaynesThere isn't a way to remove middleware that is already applied.
16:27cemerickcmajor7: I really have no idea how noir works, sorry.
16:27RaynesIf you're having middleware scenario issues, you're probably better off using Compojure.
16:27cemerickCould you maybe post the full stack trace, however long it is?
16:27cmajor7sure.. one sec
16:28xeqicmajor7: I think changing :mode will stop reload
16:30cmajor7stacktrace: https://www.refheap.com/paste/4005
16:30cmajor7xeqi: let me try that.. changing it to anything but empty or dev, right?
16:30xeqianything but :dev
16:33cemerickcmajor7: There's some bad mojo going on there. What are you calling at auth.clj:60?
16:33xeqithough I don't think it will help judging by the stacktrace
16:39cmajor7cemerick: https://www.refheap.com/paste/4006
16:39cmajor7(it is auth:61 now, I moved it one line, since the last exception)
16:39cmajor7so it is: "61 :workflows [(workflows/interactive-form)] "
16:40cemerickWell, that probably explains the stack overflow.
16:41cemerickor, probably
16:41cemerickfriend/authenticate is middleware; you almost certainly don't want to be wrapping handlers within the course of handling a request (which I assume login is doing?).
16:42cemericklogin is probably part of the `handler` chain itself, which would cause the stack overflow.
16:43cmajor7cemerick: "friend/authenticate" is commented out of myapp's middleware chain, since I wanted to switch to ClojureScript's way of login in.
16:44cemerickI don't think this has anything to do with friend; i.e. what is this `handler` parameter that login is receiving?
16:46cemericktechnomancy: so, debian is a sane distro for a tender don't-know-don't-want-to-know desktop linux noob?
16:47cmajor7cemerick: it is a "gen-handler" from here: http://bit.ly/Ou9bnE
16:47cemerickright, and `login` is presumably rolled into that handler as a mapped route somehow?
16:48cmajor7it should be yes.. via noir's "defpage"
16:48cmajor7good catch, let me try to rename that
16:48cemerickRight; so, you're receiving a handler, that includes login, and calling it again, just with friend/authenticate wrapped around it.
16:49cemerickhandler -> login -> handler
16:49emezeskecemerick: For a linux noob, I would definitely recommend ubuntu over debian
16:50tos9Eh, debian's not that much harder to learn to use to be fair.
16:50cemerickemezeske: I have ubuntu installed in a vm now, but it's instantly irritating. The mystery meat menu bar game is not fun so far.
16:51cemerickworse, I still haven't found out how to get a listing of the apps that are installed, etc.
16:51emezeskeI don't think that will be easier in debian...
16:52emezeskeThe latest Unity GUI for ubuntu is pretty dumb, though. I definitely would use gnome3, but I guess that's another step
16:52pandeiro_cemerick: it's you you're talking about when you say, 'dont know, dont wanna know'??
16:52lazybotpandeiro_: Uh, no. Why would you even ask?
16:53amalloyi found ubuntu 10.04 pretty manageable as a first linux distro. i haven't really liked anything after it, with all the unity nonsense
16:53cemerickemezeske: huh, I thought I *was* using gnome3 :-P
16:53ToxicFrogcemerick: dpgk --get-selections, apt-cache search --installed .*, or aptitude/some other frontend and filter by "installed"
16:53ToxicFrog(note: this is the same as on debian)
16:53cemerickToxicFrog: I mean, click an icon/menu/whatever, get a list of apps installed I can open.
16:53ToxicFrogOh
16:54cemerickmeh, I shouldn't have gone OT here anyway, sorry :-)
16:54ToxicFrogUpper left corner? It's been a while since I used Unity
16:54emezeskecemerick: I think if you switch to using gnome3 you will be happy
16:54cmajor7cemerick: same exception after the rename.. :(
16:54emezeskecemerick: Basically that's what you'd get by switching to debian
16:54ToxicFrogIf you want ubuntu's features/polish with a more traditional UI, you might check out Mint, or one of the Ubuntu respins with a different DE like xubuntu
16:55xeqicmajor7: I have a feeling you're going to need some sort of custom workflow for this
16:55xeqifetch sends everything to uri "/_fetch"
16:55xeqiworking on trying to build a working example atm
16:56cemerickxeqi: the objective here is to be able to log in via an xmlhr?
16:56xeqiyeah
16:56cmajor7cemerick: re: Ubuntu.. I just use Gnome with nothing on the desktop, but an OS/X like dock: http://www.glx-dock.org/
16:57pandeiro_cemerick: arch may seem intimidating, but it's way less crufty than the 'big' distros and i would think it would appeal to a veteran programmer new to linux; very simple architecture, newest software w/o the need for compilation, great package manager
16:57cmajor7xeqi: why would a workflow be different?
16:57cgagi like arch, but it doesn't really seem to fit in with "don't know, don't wanna know"
16:58cemerickxeqi: the equivalent of $.post("/login", {"username" "…" "password" "…"}) will set up the logged-in session, which the browser (and thus cljs) will re-send on each request after that.
16:59emezeskeI've gotta say, "don't know don't wanna know" is in polar opposition to Arch.
16:59ToxicFrogYeah, Arch is very much the "I want to set up every part of my system by hand and know how it all works" distro
16:59ToxicFrogFantastic documentation, though.
17:00cmajor7cemerick: so theoretically, I can leave "friend/authenticate" as a middleware, and just check the session for an identity at the time of a response?
17:00emezeskeOh, I looooooove arch, it's my distro of choice, easily. But it requires constant maintenance.
17:00cemerickcmajor7: friend/authenticate *is* middleware :-)
17:00xeqicemerick: sorry, he's trying to use fetch, not raw xhr
17:01cmajor7cemerick: right, but it needs to be "added" with noir. that is what I meant
17:01cemerickxeqi: Dunno what fetch is…but it boils down to an xhr eventually, and thus sends the session.
17:01cmajor7cemerick: but I am not sure if xhr will hit that middleware, you are saying it will?
17:02cemerickcmajor7: that's a routing and app config question, that I have no business attempting to answer w.r.t. noir. :-)
17:02emezeskecmajor7, cemerick: So the problem with fetch is that you don't have easy access to the routes it creates, to wrap them with your own middleware
17:02emezeskecmajor7, cemerick: I think it's possible, but it's a big hassle
17:03cmajor7emezeske: I don't mind a hassle.. show me the way :)
17:03cemerickemezeske: Oh, is fetch that thing that implements quasi-RMI?
17:03emezeskecmajor7: Well, I don't know the way. When I hit that, I decided I didn't like fetch, and built my own system that exposed the routes directly without using atoms in the background
17:03emezeskecemerick: Yes
17:04cemerickwell, surely it gives you a single top-level handler you can decorate with the middleware you want?
17:04emezeskeIt's all magic behind the scenes
17:05cemerickemezeske: Coming from you, that means there's *too* much magic! ;-)
17:05emezeskecemerick: Haha
17:06emezeskeWith fetch, when you define remote callable methods, it updates an atom behind the scenes, and that atom contains the route handler
17:06emezeskeI believe
17:07cmajor7cemerick: what is the minimal input friend needs to authenticate an account? e.g. I do have a handler and I do have a request with username/password in it, are you saying that my current "handler" is no good?
17:09pandeiro_emezeske: is that system somewhere i can look at it? :)
17:10cemerickcmajor7: for interactive, just username and password in a post to the configured uri. But all bets are off `login` is just a sub-handler within `handler`.
17:10emezeskepandeiro_: which system?
17:10cemerickcmajor7: it's really pretty simple: https://github.com/cemerick/friend/blob/master/test/test_friend/mock_app.clj#L100
17:10pandeiro_what you decided to use instead of fetch?
17:11emezeskepandeiro_: Oh, hehe, it's not open source (yet)
17:11cemerickcmajor7: oh, and I was mistaken about :login-uri and :unauthorized-redirect-uri needing to be different. o.0
17:11emezeskepandeiro_: It's not really hard to write such a thing; basically just wrapping an XHR in pr-str/read-string on both ends
17:12xeqipandeiro_: make sure to bind *read-eval* false for read-string if you build one
17:13pandeiro_emezeske: yeah that's exactly why i decided to use fetch, to avoid that
17:14emezeskepandeiro_: That's why I used fetch too
17:14emezeskepandeiro_: And noir, for that matter
17:14pandeiro_xeqi: right, hit that already
17:14emezeskepandeiro_: But both fetch and noir are less flexible than compojure, and they don't add *that* much
17:14duck1123is fetch still good if you don't use noir?
17:14pandeiro_emezeske: yeah i realize that
17:15duck1123I've kinda avoided it so far
17:15emezeskeduck1123: You can't use fetch without noir
17:15pandeiro_i would like something compojure-like for defining ajax routes
17:15pandeiro_i like the visual layout of compojure routes
17:16emezeskeIt's not just visual -- building up all the routes directly lets you control access very carefully
17:16emezeskeAnd conditionally, etc
17:17pandeiro_sure but it also gives you a site outline for free
17:17pandeiro_or an API outline
17:17cmajor7cemerick: yep that is how I have it working for several days with no XHR, but with XHR, it drops into a StackOverflow dance.. I can't seem to pinpoint the reason though.. :(
17:17emezeskepandeiro_: I agree :)
17:18cmajor7I feel the approach is right, since it does work for non XHR.. and I have all the data needed handy (handler, config, request)
17:20cemerickpandeiro_: I haven't used it personally, but bishop looks promising.
17:24pandeiro_cemerick: thanks, interesting
17:24muhoohehehe, the cljs broowser repl is breaking because firefox is trying to grab robots.txt on port 9000
17:25pandeiro_muhoo: that happened to me once
17:25muhoopandeiro_: how did you fix it?
17:25pandeiro_it was something i was doing
17:25pandeiro_but i cant remember :)
17:26pandeiro_muhoo: maybe i upgraded clojurescript?
17:26pandeiro_or cleaned it out
17:26pandeiro_or something silly like that
17:26pandeiro_ah no
17:26pandeiro_are you forgetting the /repl ?
17:26pandeiro_(portion of the url)
17:27muhooi dunno, i'm not doing any of this (repl/repl env) is
17:27pandeiro_you have to connect to a url though
17:27muhoobut yes, sniffing the wire, it's posting to "/" not "/repl"
17:27pandeiro_that will be in your cljs code
17:27pandeiro_bam
17:27pandeiro_cmon, localhost:9000, that could be _anything_ ;)
17:28muhoooh, DOH, that is me then
17:28muhoopandeiro_: THANKS!
17:29pandeiro_muhoo: btw if you ever play with phantomjs/casperjs, i wrote a wrapper yesterday https://github.com/pandeiro/ghost
17:30pandeiro_still has some issues but just scraped google translate successfully for the first time :)
17:31muhoonice! well, i'm still down in the plumbing here, my objective is a working/reliable cljs repl from inside nrepl.el somehow
17:31muhooi get less specific on the "somehow" the longer it takes :-)
17:32pandeiro_muhoo: ah yeah i remember you mentioning that the other day, very cool
17:32muhooit'll be cool once it works :-P
17:32devthanyone know a nice way to format a time interval (- now start-time) in human readable? trying to calculate `uptime`
17:32pandeiro_would the use case be something similar to himera though?
17:32pandeiro_or are the possibilities truly endless? ;)
17:33duck1123devth: are you trying to get it in the form of "minutes ago"
17:33devthduck1123: no, just the most appropriate unit.
17:34duck1123ok, if so, I'd say ocpsoft-pretty-time
17:34devthI found clj-time with in-minutes, in-hours, etc.
17:34cpineraHi all. Corporate overlords are requiring static code analysis to be run on my Clojure code. Does anyone have any experience with that?
17:34nDuffcpinera: there _is_ a tool that exists for the purpose. Haven't used it.
17:34TimMccpinera: kibit?
17:34nDuff...ahh, yup, that's the one.
17:35cpineraOh cool. I'll give it a try. Thanks!
17:35S11001001cpinera: I think read loop over file, report read errors counts
17:36eggsbyanyone here familiar with clojure.java.jdbc? I'm getting a 'invalid host/bind variable name' error from this: https://www.refheap.com/paste/4009
17:36hiredmancpinera: have they also defined what static analysis they want?
17:36cpineraS11001001: haha nice
17:36hiredmanstatic analysis is or could be a bunch of different things
17:37cpinerahiredman: the requirement comes from the security group, so I guess they are focused on that.
17:37hiredmankibit, at least what I've seen, is about idioms
17:37hiredmancpinera: stil lthat is very vague, like, what are they looking for from static analysis?
17:37S11001001(inc hiredman)
17:37lazybot⇒ 12
17:38hiredmanthe biggest security related static analysis is buffer overflows, but the jvm (and clojure) have bounds checking on arrays
17:39hiredmancpinera: I would definitely go back, and ask what kind analysis they want, what do they want it to look for?
17:39cpinerahiredman: I totally agree with you. I don't know what they're looking for. I'll ask for the specific requirements. If they have none, then kibit will do fine. If they have something specific they perhaps one of the JVM bytecode static analysis tools would work for Clojure code?
17:39S11001001potential nulls? concatting dirty data to sql?
17:39amalloyyou could statically analyze: "yep, still runs on the jvm, should be fine"
17:41S11001001you could compare your dependency tree to the latest releases on clojars/maven-central, complain about out-of-dateness (could be security updates?)
17:43duck1123what about lein check?
17:45cpineraS11001001: dependency check is a good idea!
17:46cpineraduck1123: The poor man version, yes, that's a good starting point. Thanks!
17:57cmajor7cemerick: whenever you have time is it possible to upload friend..-sources.jar side by side with friend jars to https://clojars.org/repo/com/cemerick/friend/ ?
17:59hiredmancmajor7: the jar should include the sources
17:59cmajor7hiredman: oh.. sorry about that. how do I hook these sources with lein, so I can step through the code?
17:59hiredmancmajor7: unless you configure it otherwise, lein always includes the .clj files in the jar
18:00hiredmancmajor7: lein is a build tool
18:00hiredmancmajor7: what do you mean look through the sources?
18:02cmajor7hiredman: I am using VimClojure.. and usually I travel through sources in different files via a shortcut (e.g. \gw). But for friend/xyz, it tells me: "Vim(echoerr):cemerick/friend.clj not found in 'path'"
18:02cmajor7I know it is on a path, since the file does compile
18:04hiredmancmajor7: right, most likely you need to restart vimclojure or whatever
18:05hiredmanfriend wasn't on the classpath when it was started
18:05cmajor7hiredman: I've been restarting it several times a day for various reasons, the error is still the same
18:05cmajor7lein classpath has friend, and so nailgun-server classpath
18:06hiredmancmajor7: *shrug* it is either the classpath issue, or something specific to vimclojure
18:14muhoocmajor7: i usually grab the github sources and browse those in $EDITOR
18:15muhoorather than opening and browsing around in ~/.m2/repository/dig/around/for/thing.jar
18:16muhoopandeiro_: ahahaha! that "hanging" POST in the browser is normal operation.
18:17muhooit POSTs the response to the last command, then hangs, waiting for someone to type something in the repl which is basically the next command for it to eval
18:17cmajor7muhoo: how does it work with navigation between sources? I browse them on github otherwise
18:18muhoocmajor7: depends on the value of "it"
18:18cmajor7vim + your code + lib code
18:19muhooi don't use vim, but i keep a directory /foo/clojure/src, and in there i have a metric shit-tonne of stuff i've git cloned. when i want to read source, i just open those in my editor, and have a look around
18:21muhooactually, correction, i *do* use vim, for sysadmin tasks when i need to edit stuff in sudo as root. i use emacs for development.
18:22cmajor7muhoo: I see. I there is also a github plugin for lein you can use.. not to pull down sources though
18:24pandeiro_muhoo: ah long-polling?
18:28hiredman.win 15
18:29mtkoankorma makes me happy
18:30mtkoanbut I'm no leet developer!
18:32xeqiI like the map -> sql part of korma. not so much the rest
18:38arrdemare local jars in lib/ still supported under lein2?
18:43muhooit's funny how cljs turns java in to an assembly language
18:43muhoosorry javascript
18:44muhooit turns java into a compiler, and js into an assembler, kinda
18:45muhoohttps://www.refheap.com/paste/4012 , it's like reading disassembled .asm
18:49muhoocmajor7: dunno, might be useful tho
18:49cmajor7muhoo: https://github.com/tobyhede/lein-git-deps
18:50muhooarrdem: lein2 seems to not copy stuff into lib/ anymore. it seems to pull them from ~/.m2/repository directly, based on the classpath i'm seeing.
18:53arrdemmuhoo: yeah... I dug through the docs and I didn't see a good way to have a local *.jar library path
18:54arrdemI guess I just need to add them to m2 and require them...
19:11akhudekarrdem: that's correct, you need to install them locally with mvn
19:13arrdemakhudek: raaah.... that's what I'
19:13arrdemd just confirmed.
19:13arrdemoh well.. bash script to add 400 jars...
19:13akhudekthat's a lot of jars!
19:14arrdemthat's why I was really wishing I didn't have to maven them all..
19:14aperiodicor a bash script to merge 400 jars into one jar...
19:14arrdemand yeah. working on an Eclipse plugin which has a personal record for number of dependancies
19:14arrdemaperiodic: ..... yes. or that.
19:15hiredmanarrdem: or find the deps in a maven repo
19:15arrdemhiredman: if I ever meet you IRL I owe you a beer.
19:16arrdemthere does indeed exist a maven repo for the Eclipse SDK.
19:26muhooarrdem: lein local-repo
19:28muhooheh, reading the network sniff back-and-forth between cljs and the repl, is bizarre. it's javascript, wrapped in clojure, wrapped in javascript. syntax highlighting is... challenging
19:28muhooit reminds me of... dare i say it... reading HTML with embedded PHP, JS, and CSS
19:29muhoohttps://www.refheap.com/paste/4013
19:33gerundde`Can I turn off warnOrFailOnReplace with lein + nrepl?
19:34RaynesAwww!
19:34Raynesrefheap's 4000th paste was private. :(
19:34muhooRaynes: are you giving awards?
19:34RaynesNope.
19:34RaynesJust curious.
19:35hiredman no
19:35muhoogerundde`: getting too many popups?
19:36RaynesI could look at it, but that'd be a violation of my ethics.
19:37gerundde`I'm using core.logic, and trying to use nrepl's compile the current buffer.
19:37muhoogerundde`: oh nevermind, i thought you meant nrepl.el. looks like warnonfailorreplace is buried deep in here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Namespace.java
19:37gerundde`Yeah I'm using nrepl.el
19:38hiredmangerundde`: use :exclude like it is used in all the examples
19:38gerundde`I'd have to exclude == and I kinda need that :)
19:39hiredmanyou can still use it
19:39muhooRaynes: what, the "private" pastes aren't stored as a sha1 hash? :-)
19:39RaynesHeh
19:39hiredmaneither by using the fully qualified name, or rename it as documented in the docs for require and use
19:39gerundde`hiredman: Yeah I have :as logic
19:39hiredmanso what is the problem?
19:40Raynesmuhoo: People don't really understand that 'private' only means 'not listed in public pastes and with a not easily guessable url'.
19:40gerundde`:refer-clojure :exclude [==] is working now
19:40hiredmanif you are using :require :as you don't need the exclude
19:40gerundde`hiredman: ah, ok I was using :use
19:41gerundde`hiredman: Actually use + refer-clojure works, require - refer-clojure doesn't.
19:43muhooRaynes: TOS might be a good place for that info. or, call it "Public" and "Non-Public"
19:45hiredmangerundde`: it does, you are just doing it incorrectly
19:46gerundde`hiredman: You sure with nrepl.el and repeatedly compiling the current buffer?
19:47gerundde`hiredman: :require [clojure.core.logic :as logic] What's to get wrong?
19:48hiredmangerundde`: namespaces are stateful things, so depending how you did stuff before you can screw up that state
19:50gerundde`hiredman: Nothing else in the namespace. Restarted nrepl-server, no problems.
19:51gerundde`must have messed up the repl previously
19:52hiredmanby "messed up the repl" you mean "messed up the namespace" the namespace is basically a map which is the compile time environment for code in the namespace
19:52hiredmanthe map is mutable state, and you can get it into a state where things don't work like you want
19:52gerundde`I had compiled that buffer previously
19:53gerundde`with use and without the refer exclude.
20:13holohi
20:15holousing clj-time library, there isn't the "to-sql-date" available in the namespace. where is it? there is a reference to it on github: https://github.com/seancorfield/clj-time
20:17benedikttechnomancy: have you found any solution (or workaround) to the repl issue in emacs?
20:17seanmholo: clj-time.coerce
20:17seanmhttps://github.com/seancorfield/clj-time/blob/master/src/clj_time/coerce.clj#L60
20:19muhoook it's starting to make sense. very strange. it's not a streaming GET, it GETs the iframe with all the clojure repl code that it needs, then it does all the rest via streaming POSTs, or rather POSTS with what appear to be very long timeouts
20:20muhoosend a response as a POST, then wait for the next command as the POST response-- it's exactl backwards
20:23holoseanm, that was fast. how did you find it?
20:23holoseanm -.-' oh, you don't happen to be the developer right?
20:24seanmjust went through the source
20:24seanmha no, different sean
20:25holoseanm, so you skimmed the source by random means and found it? heh.. i'm really curious about the method because i was searching for it some time
20:25amalloyif you have the source checked out it's pretty easy with something like `find -name '*.clj' | xargs grep to-sql-date`
20:25amalloyor in emacs, M-x find-grep will construct that command line for you
20:25seanmholo: I don't have it checked out locally, otherwise I would have done what amalloy mentioned, or used ack
20:25holooffline search i see
20:26hiredmanrgrep!
20:26seanmInstead I went to the webview and used browser find
20:26hiredmanamalloy: what is this find-grep nonsense?
20:26seanmthere's only 4 source files
20:26amalloyhiredman: is rgrep just grep -r? i've had trouble with that when it tries to follow the .git dir
20:27seanmI just end up using 'ack'
20:27duck1123that's why I add | grep -v git
20:27hiredmanamalloy: never seen that happen, (decent in to hidden directories)
20:27seanmso I don't shoot myself in the foot when I forget to exclude massive files/dirs
20:27hiredmanamalloy: you should try rgrep
20:28hiredmanit generates a hyper-linked buffer of grep results for easy jumping to hits
20:28amalloyso does find-grep
20:28holoseanm, which search engine?
20:28hiredmanalso paging through hits via , and .
20:28seanmholo: not a search engine
20:28seanmjust ctrl+f
20:28seanmwent here https://github.com/seancorfield/clj-time/blob/master/src/clj_time/coerce.clj
20:28holohaha
20:28seanmctrl+f
20:29seanm"sql"
20:29hiredmanI've never used anything but rgrep, the emacs manual says "The commands M-x lgrep (local grep) and M-x rgrep (recursive grep) are more user-friendly versions of grep and grep-find"
20:29amalloyhiredman: rgrep looks like a version of find-grep with more prompting and less command-line options
20:30hiredman"Directories listed in the variable grep-find-ignored-directories are automatically skipped by M-x rgrep. The default value includes the data directories used by various version control systems. "
20:30amalloyemacs's rgrep certainly looks smarter than the command-line rgrep
20:30hiredmanhttp://www.gnu.org/software/emacs/manual/html_node/emacs/Grep-Searching.html
20:30holoseanm, i see. i was using just the .core namespace from clj-time. thank you for your patience. i should have suspected
20:30amalloywhich is what i thought you referred to at first
20:30seanmholo: np
20:31gertWe're running into http://dev.clojure.org/jira/browse/JDBC-11 -- java.jdbc committing transactions after errors, because it catches Exception, not Throwable. We're using preconditions in certain functions and want our transaction to roll back if a precondition isn't met - but that throws an AssertionError, not an Exception. How should we handle this?
20:31hiredmangert: don't use preconditions like that
20:32gerthiredman: what's the right use for preconditions?
20:32seanmcould try using something like google's preconditions
20:32hiredmanno idea
20:32seanmdunno if there's a nice clojure wrapper for 'em
20:32muhookorma?
20:33hiredmanwhich is largely why I don't use them
20:33gerthmm.
20:33amalloypreconditions don't really get used much in clojure, but they generate assertions. some general advice for assertions is "they should only catch serious errors in programming, not something that should ever come up at runtime"
20:33hiredmanthey are a neat idea in theory
20:34hiredmanbut not flexible enough in practive (determining the text of errors, the type of errors, how they are handled, etc)
20:34gertbut using preconditions during development is a valid use, right?
20:35hiredman*shrug*
20:35seanmI tend not to, lest I forget to remove them
20:35seanmand I always forget
20:36gertalso, this leaves the issue that you really don't want to *commit* a transaction on an Error - even when in the real world Errors shouldn't happen and all bets are off.
20:37hiredmangert: well, there is an issue open for it, do you want to write a patch to fix it (have you submitted a ca?)
20:37gertthe issue is closed and marked as resolved
20:37hiredmanare you using the latest version of java.jdbc?
20:38gert0.2.3 yes
20:39amalloyhuh? that code surely isn't committing on Error
20:39hiredmangert: are you sure? is 0.2.3 the only java.jdbc jar on your classpath?
20:39devnuse an existing solr client library or just write my own?
20:39amalloy(try (stuff) (commit) (catch Exception (rollback))) is the skeleton, right? an Error in stuff causes neither commit nor rollback to happen
20:40devnSeems like the ones that exist are designed for whatever the author intended and not the general use case...
20:40hiredmanhttps://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L348
20:41devni like using preconditions, fwiw.
20:41gertamalloy: we're seeing commits, with this code. I'm confused now
20:41devnthe lack of flexibility is sort of the reason i use them -- they're anchors
20:41devnit's like rock climbing
20:42hiredmangert: check to make sure the version of jdbc you are loading is the correct one
20:42hiredmanmake sure no other library is stomping on your requirements somehow
20:43gerthiredman: good point. project.clj says 0.2.3 - but we're checking the classpath
20:43devnhiredman: whaddya think about (range 9 3 0), (range 3 9 0), and (range 0 0 0) -- how should 0 step behave?
20:44gerthiredman: classpath says 0.2.3 and only one occurrence of java.jdbc
20:44hiredmandevn: I don't care, a step of 0 is nonsensical, so don't do it
20:45devnhiredman: yeah, but a program could have a function which takes inputs that determine the step of range -- if once in a great while it allows an infinite seq of start, that seems weird
20:45hiredmandevn: validate inputs
20:45devni know you just said you dont care, but do you have any preference for infinite seq of start or would you disallow 0 altogether?
20:46hiredmanno preference
20:47hiredmansomeone might have some super elegent algorithm that relies on generating a infinite seq that way using a recursive call over a counter that decrements to 0 or something, but I don't care one way or the other
20:48gfrederickscan anybody explain to me why cKanren only deals with finite domains? e.g., why would infinite domains of integers be harder?
20:48devnthat's cool, just trying to get some input because of the inconsistency w/r/t 0 step currently
20:50hiredmangfredericks: because the nature of relational program would require you to be able to enumerate all integers
20:50gfrederickshiredman: why is that hard?
20:50hiredmanit is surprisingly easy, it jsut takes forever so nothing else gets done
20:51gfredericksbut (fresh [coll] (membero x coll)) is infinite...
20:51gfredericksso clearly we're not opposed to that
20:51hiredmanyou end up with search trees that are infinitely wide
20:51hiredmangfredericks: how is that infinite?
20:52gfredericks[x . _.0], [_.0 x . _.1], [_.0 _.1 x . _.2], etc
20:53gfredericks(defn naturalo ([x] (naturalo 0 x)) ([n x] (conde ((== x n)) ((naturalo (inc n) x)))))
20:53gfredericks^ I imagine that would be functional
20:53hiredmanah, sure an infinite set of results is fine, but a search tree of infinite width is a problem
20:53hiredmanyeah, but inc is not relational
20:53gfredericksno but I can imagine it being done differently so it is
20:54gfredericks(defn inco ...) wouldn't be hard
20:54gfredericksI guess (naturalo 100000000) would take a while, eh?
20:54gfrederickswell that part could be avoided
20:54amalloygfredericks: what do you mean, defn inco wouldn't be hard?
20:55gfrederickswell if both args are ground, check; if one is, compute the other; if neither, enumerate
20:55xeqipeano arithmetic successor function ?
20:55hiredmanthere is a reason the reasoned schemer guys invented their binary numical representation
20:55gfredericksI'm assuming things can be defined at a lower level where you can check if things are ground or not
20:56gfrederickshiredman: that's why I'm asking. I don't know what that reason is.
20:56arkhis there a common clojure funcation that's similar java's .indexOf? I'm using re's but they seem overkill for something so simple
20:57hiredmanarkh: just use .indexOf
20:57amalloygfredericks: how do you even enumerate? start at 0? only work for non-negative integers?
20:57gfredericksamalloy: anything can be enumerated
20:58xeqigfredericks: not true
20:58gfredericks&(take 10 (interleave (range) (map - (rest (range)))))
20:58lazybot⇒ (0 -1 1 -2 2 -3 3 -4 4 -5)
20:58gfredericksxeqi: anything with a finite representation which is everything we deal with
20:58arkhhiredman: ok, though it'd be nice to have it work across clojure + clojurescript
20:58arkh(sorry, scope creep)
20:58hiredmanarkh: nothing works in clojurescript, so don't worry about it
20:58gfrederickssurely core.logic works fine with (interval 0 100000000), so (interval 0 :infinity) should be performantly equivalent?
20:58arkhhaha
20:59xeqigfredericks: really? cause the reals are an uncountable set
20:59gfredericksxeqi: but most of them have no finite rep
20:59amalloyi think gfredericks is arguing we don't need to work with the reals, because our computers only pretend to anyway
20:59gfredericksyep
21:00gfredericksintegers and rationals I'd be happy with
21:00xeqiah, no PI then
21:00hiredmangfredericks: if you let X being a value in the domain of integers, and Y also being a value in the range of intergers, Z being a set that contains a Y, write me a generic search function that returns all the Xs that are members of Zs
21:00xeqitrig will be hard
21:01aperiodicxeqi: your computer doesn't really use Pi
21:01gfrederickshiredman: that sounds like all integers to me
21:02hiredmanyou can replace Y with any value of an infinite domain
21:02gfredericks\forall X \exists Z (Y \in Z && X \in Z)
21:02hiredmanY could be a member from an inifinite collection
21:03gfredericksyou're saying (fresh [x y z] (is-int x) (is-int y) (everyo is-int z) (membero y z) (membero x z))?
21:03gfredericksthat's what I understood
21:05gfredericksI'm sure that some things will involve infinite search, but that's already a problem in logic programming
21:08hiredmangfredericks: I would suggest trying to write an is-int relation that works forward and backward, and then trying to use it in some queries
21:29gfrederickshiredman: what sort of queries? the basics seem to be working
21:36gfredericksI don't know how to leave things unbound until later, since I'm not very familiar with the core.logic internals, but I imagine there's a similar mechanism in the new fd stuff
21:37gfredericksnot even sure if leaving them unbound would be appropriate
21:37xeqiaperiodic: I was thinking something like a theorem prover, where reasoning about a non-rational might be useful
21:37xeqiwonder if core.logic would make it easier to build one of those
21:38gfredericksxeqi: algebraics are conceivable, as well as algebraic multiples of special transcendentals, but that's about all you can do with finite representations
21:39gfredericksanything else would have to be some higher level of abstraction, which theorem provers probably inhabit
21:54gfrederickshttps://gist.github.com/3243373
22:00RoxxiIs there an analogous statement to scheme's (begin ...) in Clojure, that runs several statements and returns the last?
22:00brehautdo
22:00RoxxiOne that isn't "let" that is :)
22:00RoxxiThanks
22:25devnIs pair.io gone?
22:55amalloy&'#(#_%& %)
22:55lazybot⇒ (fn* [p1__28600# & rest__28599#] (p1__28600#))
22:56gfrederickso_O
22:57gfredericksI bet that would be fun to fix
22:59gfredericks&(#(#_%2 + %1 7) 8)
22:59lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox20922$eval28615$fn
23:00gfredericksamalloy: is there a ticket for it yet?
23:00nDuffDoes kona try to retrieve all select results at once rather than returning them lazily (even chunked)? I'm trying to do a select from a very large table, and I'm running out of memory before even getting the first result back.
23:01nDuffs/kona/korma/
23:02amalloyi wonder what crazy implementation #() has that makes that happen
23:04TimMcnDuff: So that's a yes?
23:04TimMcamalloy: WTF.
23:04nDuffTimMc: ...default behavior is non-lazy, there's a recently merged pull request that allows that to be changed on-demand.
23:05TimMc&(#(#_%)())
23:05lazybot⇒ ()
23:06gfredericks&(#()())
23:06lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox20922$eval28679$fn
23:06nDuff...err, no, _not_ recently merged, still outstanding. *sigh*.
23:07TimMcamalloy: You've just given me a new weapon for my obfuscation arsenal.
23:08amalloyTimMc: i found it in a recent SO answer
23:08TimMcIs this captured in Jira?
23:09amalloyso far jira does not automatically convert SO questions to tickets, no
23:09TimMco\__/o
23:12amalloyah. the % reader macro has the side effect of registering an arg
23:12amalloyso when #_ reads the form prior to discarding it, the arg is still registered
23:15gfredericks#() could be a macro without breaking anything important I would think
23:15gfredericksi.e., just blindly expand #(...) to (reader-fn ...)
23:16gfredericksmaybe that would make it harder to detect nesting
23:16gfredericksor that could still be detected at read-time probably
23:17amalloygfredericks: that's true of most java-based reader stuff
23:17muhoocljs does some strange stuff. like, it returns nil instead of a stacktrace if you give it a var that doesn't exist
23:17amalloyi imagine it's legacy and/or bootstrap related
23:17muhooalso, it will give nil if you give it a function without parens, instead of returning core$extend-type or stuff
23:18gfredericksamalloy: while we're at it, is there any reason it needs to convert to gensyms?
23:18gfredericks&'%
23:18lazybot⇒ %
23:18ThatOneGuy&%
23:18lazybotjava.lang.RuntimeException: Unable to resolve symbol: % in this context
23:19ThatOneGuy&#'%
23:19lazybotjava.lang.RuntimeException: Unable to resolve var: % in this context
23:21amalloygfredericks: the only excuse i can think of is to prevent stuff like (defmacro alter-my-args [& body] `(let [~'% 10] ~@body))
23:22amalloybut perhaps there are others
23:24gfredericksamalloy: man the hackers are always deffing those macros
23:24gfredericksbut yeah that's a good point
23:27amalloyright, symbol capture is pretty hard to do accidentally, but it *can* happen
23:35TimMc&'#(+ #_ #_ (+ #_ %3) %& %)
23:35lazybot⇒ (fn* [p1__28736# p2__28737# p3__28734# & rest__28735#] (+ p1__28736#))
23:39ToxicFrogDocs say it can take "a string naming a URI", but whenever I try to use it as such, it hangs.
23:39ToxicFrogOh wait no
23:39ToxicFrogIt just takes about five minutes to process a small page.
23:39ToxicFrogOuch.
23:44akhudekI take it that when you compile all ClojureScript functions into a single file, you don't need to use goog.require in the html file?
23:46akhudekIt's bit confusing, since the docs for goog.require state that it loads the relevant namespace. However, it seems that all namespaces are loaded regardless of any goog.require in the main html.
23:53nDuffHmm.
23:53nDuffclojure.jdbc's with-query-results* uses resultset-seq, and thus should in theory be lazy regardless.
23:54nDuff...but that's very much not the behavior I'm getting out of korma
23:55technomancyis it chunked?
23:55technomancycould be using a cursor behind the scenes
23:56nDufftechnomancy: I wouldn't mind a little chunking -- but I'm running out of RAM trying to get only the first element.
23:57akhudekare you sure you are on the latest versions of both?
23:57akhudekuntil recently, korma used a fairly old version of jdbc
23:58technomancymaybe try it in raw c.j.jdbc?