#clojure logs

2013-02-06

00:04tomojso is (let [a 3] #{a}) bad?
00:04tomojit should be (let [a 3] (hash-set a)) ?
00:05xeqi&(let [a 3] #{a 3})
00:05lazybotjava.lang.IllegalArgumentException: Duplicate key: 3
00:05tomojbut for singletons, no problem or bad style?
00:05xeqiseems fine to me
00:06xeqiits part of the idomatic ##(some #{1} [1 2 3])
00:06lazybot⇒ 1
00:06tomojoh right
00:06tomojexcept in the canonical example (and that example) the thing inside is a literal
00:16jyuhello
00:47mattkruse,
00:47clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
00:47mattkruse,(&)
00:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(NO_SOURCE_PATH:0)>
00:48mattkruse,,
00:48clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
00:48nightfly,,2
00:48clojurebot2
00:48nightfly,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2
00:48clojurebot2
00:53xumingmingvanyone familiar with typed-clojure?
00:53xumingmingvwhat's the All comes from in its code base?
00:54xumingmingve.g. (ann test1 (All [x y] [x y -> x]))
00:54xumingmingv
02:11tomojhmm.. leading commas
02:12amalloytomoj: did you see the post about using leading commas to address cond's indentation problem?
02:13tomojno, that's exactly what I was thinking
02:13tomojalso let, maps, ...
02:13tomojunfortunately clojure-mode isn't happy about it
02:13amalloyfogus (i think) mentioned it a few days ago, i forget where. maybe the paren-less lisp thread?
02:13tomojat least with ", ..."
02:14amalloyhuh?
02:19tomojamalloy: https://www.refheap.com/paste/d3f62411813ff046869796bec
02:19amalloythat's a crazy way to do it
02:20amalloywhat are the commas there even saying?
02:20tomoj"a let binding pair starts here"
02:21amalloytomoj: fogus's recommendation was to use ,, to "indent" meaning "this is the second half of a two-part clause"
02:22amalloythus you don't need them most of the time, only to clarify when you actually need to put a confusing newline in
02:22tomojlike this https://www.refheap.com/paste/f38a06c45cc15183ed5dde59b ?
02:22amalloyyes, although i think he was using ,,(transact...)
02:22tomojhmm
02:23tomojis that not just a hack around fixing your editor's indentation of cond?
02:23amalloyyes
02:23amalloythat is, yes it's exactly that
02:23tomojI see
02:24tomojwell, I'll adopt it rather than dig into clojure-mode :)
02:24tomoj",,(" actually fixes the problem with C-i on each line
02:25amalloywhat problem?
02:25tomojthe third example in my last paste
02:26tomojthe line after ",, (" gets indented too much if you C-i it directly
02:26amalloyoh, right. yeah, clojure-mode doesn't like it when two sexps start on the same line and the first is indented but the second "shouldn't be"
02:28tomojsucks cus the reason you end up with confusing newlines is often that you're short on columns, but ,, steals 2 from you
02:29amalloyyou could make do with just one
02:36Phonatacidhello. I've juste "leon clean"'ed my project which contains a "clojure-made" class using :gen-class. I need to compile this class before compiling the rest of the project. I used to do this via the repl using the compile function — unfortunately the repl won't launch because … that specific class is not found, since not compiled. How can i tell leiningen to compile that file ? I tried "lein compile mynamespace.MyClass
02:36Phonatacidto no avail
02:37ChongLiwow juxt is really cool
02:37Phonatacid(for some reason I have autocorrect enabled on my osx, sorry for "typos")
02:39Raynestechnomancy: I'm telling you dude, we need to auto-alias lein to leon.
02:40Phonatacid(that's what happen when you type in keybinding *that do nothing* (fixed))
03:01Phonatacid"lein compile [my.name.space]" seems to be understood as "lein compile". Is that normal ? Or am I missing something ?
03:04FoxboronRaynes: why not auto-alias every wrod starting with "le" just to be sure?
03:05Foxboronword*
03:09Phonatacidhttp://25.media.tumblr.com/tumblr_m9u419VzNW1qen6qlo1_500.gif
04:18OscarZ_I've started experimenting with Clojure... I tried (class 1).. yay, its a long.. then I tried (class (1 2 3)).. fail! ;) I realize that it expects first element to be function.. but on the other hand I read parentheses create a LinkedList type of thing and brackets an ArrayList type of thing
04:20thhellerOscarZ_: (1 2 3) will read to (1 2 3) but also try to eval (1 2 3), so to skip the eval and just get the list either (list 1 2 3) or quote it to prevent interpretation like '(1 2 3)
04:22OscarZ_thanks
04:23marianoguerrahi, which is the most up to date and complete website to search for clojure and related projects APIs?
04:23clojurebotMaster Blaster runs 4Clojure!
04:23ejacksonOscarZ_: also usually for sequential data structures you want to use a vector: [1 2 3]
04:26OscarZ_now I'm confused of the output of "list 1 2 3" in REPL :)
04:27ejackson'(list 1 2 3)
04:27ejackson,(list 1 2 3)
04:27clojurebot(1 2 3)
04:27pimeysthe lisp rule is that the first item in a list is the name of the function you want to apply to the cdr
04:27pimeysquote prevents this
04:27ejacksonso the reader get (list 1 2 3), takes the first element, being list, applies it as a function which returns a list (1 2 3)
04:29OscarZ_ok.. but writing list 1 2 3 in REPL.. is that also a list ? without parentheses?
04:30thhellerits just tokenized
04:30thhellerso it reads 1, evals it to 1
04:31thhellereh first it reads list evals it to the function of list
04:31thhellerand so on
04:31thhellerbasically the same as if you'd enter "list" <enter> "1" <enter> ….
04:31pimeysfirst is returning a list function with no params
04:31pimeysyou can set that to some variable and use the variable with params to do a list
04:32OscarZ_right ok
04:32pimeyscause functions are data
05:11clojure-newbhey guys… I've got my store connection in a def, and several of my lein tasks always hang, I'm trying to figure out a way to do things a little better and enable lein tasks to complete normally, any advice ?
05:13mpenetclojure-newb: you could use delay
05:13mpenet,(doc delay)
05:13clojurebot"([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?"
05:13clojure-newbmpenet: I will take a look into it, thanks
05:15clgvclojure-newb: better do not put it in a def. put it in a function. if you have a standalone application you can call that function from your main
05:16clojure-newbclgv: is the def making it evaluate when just running lein compile for example ?
05:16clojure-newbclgv: it seems that might be what is happening
05:18clgvclojure-newb: yeah I think so
05:19clgvclojure-newb: compiling means loading the namespace with *compile-files* enabled
05:20clojure-newbclgv: hmmm, if its in a defn it is going to create the connection every time unless I guard against it somehow though ?
05:21clgvclojure-newb: I meant to call the function only once and either pass the store as parameter or bind it to a thread-local binding
05:21mpenetclojure-newb: that's what delay is good for imo. (defonce (delay ...))
05:21clojure-newbclgv: I see call function once in top level function, pass result across program afterwards
05:22mpenetwell more like: (defonce conn (delay ...))
05:23clojure-newbmpenet: does the 'delay' part of that mean lein compile will ignore it ?
05:23clgvmpenet: it is still a global value then which is usually not that favorable
05:23mpenetthe body wont be executed until you dereference it so yes, it shouldn't hang
05:26clgvclojure-newb: but you will be tied to that global value which makes testing pretty difficult and using the code for multiple stores impossible
05:27mpenetclgv: true
05:27clgvclojure-newb: with thread-local bindings you could omit that with almost no effort.
05:27clojure-newbclgv: I must admit I don't know much about thread-local, particularly in terms of concrete example of dealing with store connection etc
05:27clojure-newbclgv: any good reference material (examples etc) ?
05:28clgvclojure-newb: most books have a chapter on it
05:28clgvclojure-newb: http://clojure.org/vars
05:29clojure-newbclgv: looking now, thanks
05:29clgvbut there is only minimal info at clojure.org
05:37clojure-newbclgv: are we talking about something like - 'The clojure/java.jdbc library uses a dynamic var *db* so that you don’t have to pass in a database connection to every function call. You can just use the with-connection macro to bind *db* to the database you want to use, and then perform any database queries within the body of the macro.' ?
05:47clojure-newbhmm, wondering about the overhead of closing the connection each time with this method…..
06:04clgvclojure-newb: yeah, that's the idea. you might keep the connection open for your whole program if you want to - you can bind the connection in you main function for example
06:21abpFirst day using emacs-live instead of ccw. Wow.
06:22pimeyshmm, I should play around with emacs again
06:22pimeyswith evil mode
06:23danierouxgarak> pimeys: Evil works very well for me
06:23arkxI ended up discarding evil-mode after a while
06:23pimeysI'm using vim a lot, like the full scale of it's features
06:23pimeysso I'm a bit afraid that will evil mode be enough
06:23arkxCrutches for full transition. ;)
06:24arkxpimeys: evil is very complete.
06:24pimeysI don't like to dismiss my command mode
06:24arkxThere was this Vim book recently
06:24arkxOne of the reviewers went through it with evil-mode and everything worked.
06:24arkxhttp://pragprog.com/book/dnvim/practical-vim
06:28babilenpimeys: I didn't really like evil mode. It was good, but I never felt quite at home. And vim + foreplay + paredit + vim-clojure-static + classpath is working just fine.
06:29arkxbabilen: did you encounter something that didn
06:29arkx't work
06:31babilenarkx: I did, but I can't quite recall what it was :) (I would have mentioned it otherwise) -- I was also missing a bunch of plugins. And I don't see the point of switching to Emacs while trying to make it work exactly like vim while I could use vim in the first place.
06:31arkxbabilen: well, the point is in emacs' extensibility & existing ecosystem
06:33babilenarkx: The same could be said about vim. Granted, people in the Clojure ecosystem might have a slight bias towards emacs, but I am /very/ happy with the tooling on vim right now. (apart from maybe midje mode integration)
06:33arkxIt seems almost unfair to compare elisp and vimscript :) Then again, if you don't need to extend your editor it probably makes no difference
06:33babilenarkx: But in the end: Just use what you feel most comfortable with.
06:33Hodappmeh, the vim tooling didn't work well for me.
06:33babilenarkx: I would just write Python, but meh.
06:33degDoes Clojure arg destructuring support collecting a subset of keywords? Something like the following (illegal) attempt: (defn f [& {:keys [a b] :as a-and-b} {:keys [c]}] (list a b c a-and-b))
06:33babilenHodapp: What was the problem? Did you use vim-foreplay?
06:34Hodappbabilen: No; I don't know what that is.
06:34babilenHodapp: https://github.com/tpope/vim-foreplay
06:35Hodappbabilen: I had been following some instructions for VimClojure and Nailgun, and experienced frequent issues with the sessions just crashing or becoming unresponsive.
06:37babilenHodapp: Yeah, one reason why the syntax, indentation, ... and other static bits of VimClojure have been moved to vim-clojure-static and REPL interaction (just the normal "lein repl" one) is done via vim-foreplay
06:37goraciohi there - how to check if char exists in string ? like if "w" exists in "world" ?
06:37Hodappbabilen: I don't have a whole lot of interest in attempting to switch back.
06:38babilenHodapp: Sure, nobody says that you have to if you are happy with your environment right now :-D
06:39babilenAs I said earlier: Use whatever you are happy with.
06:39Hodappbabilen: It's more that I see no reason to believe that the tooling has improved substantially since several months ago.
06:39babilenIt did
06:39Hodappbabilen: I don't believe you.
06:39goracioany guess ?
06:40aroemersgoracio: (some? #{\w} "world")
06:40babilenHodapp: Fair enough and there is nothing I can do to convince you otherwise short of forcing you to try it. I see no point (nor a way) in doing so anyway ;)
06:40goracioaroemers: thanks
06:40aroemersgoracio: (some #{\w} "world"), sorry
06:40Hodappbabilen: If it's merely things being 'moved' as you told me - I don't see how this would miraculously solve stability issues.
06:40arkxI'm inclined to believe babilen, tpope has a golden touch when it comes to vim-related stuff
06:40aroemersgoracio: whithout the question mark
06:41goracioaroemers: jr
06:41goracioaroemers: ok
06:41babilenHodapp: If you would take a look at foreplay you would realise that the /entire/ non-static bit (nailgun, REPL integration, ...) has changed. You now simply use a "normal" nrepl session and make whatever code you want to available in it.
06:41babilenAnd tpope is IMHO quite gifted vim plugin writer and it shows.
06:42babilen*a
06:43Hodappbabilen: I don't see how this is a substantial departure from what I started with.
06:44arkxHodapp: are you familiar with nREPL?
06:44Hodapparkx: Yes.
06:45babilenHodapp: Why is that? The entire way in which you communicate with the REPL/JVM has changed. I would call that quite a significant departure, but then I wouldn't know what your perception of important changes are.
06:46Hodappbabilen: In what way has this entire method of communication changed?
06:47babilengoracio: I would simply use (.contains "foo" "o")
06:48goracio,(some #{\w} "world")
06:48clojurebot\w
06:49babilenHodapp: Before communication was done via nailgun and the REPL was implemented in vim, now it uses nrepl and communicates directly with the nrepl server
06:49goracio,(.contains "foo" "o")
06:49clojurebottrue
06:49goraciouses java i guess ?
06:49babilenyes
06:50goracioany similar in clojure ?
06:50clgvgoracio: write a clojure wrapper function if you need it often. but it is the fastest method
06:50goraciook
06:52Hodappbabilen: But there were acknowledged stability issues in Nailgun and the prior tooling?
06:53babilengoracio: Java interop is /so/ easy in Clojure that you don't really need to wrap something as trivial as this. (IMHO) Just use whatever is appropriate and in this case it is (.contains STRING CHAR)
06:54goraciobabilen: yea it seams yeasy enough but how this works ? (some #{\w} "world")
06:54goraciobabilen: we use sets
06:54babilenHodapp: Yes, as I said: That was one of the reasons why Meikel decided to endorse vim-foreplay/vim-clojure-static and tpope decided to develop it. But I mentioned that at the very beginning. And it also wasn't /that/ bad, but yeah problems were seen :)
06:55babilengoracio: The idiom (some SET-OF-THINGS COLLECTION) is a common one if you want to test if some elements in one collection are contained in another.
06:56goraciobabilen: ok thanks
06:56babilen,(some #{1 2 3} [0 1)
06:56clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
06:56babilen,(some #{1 2 3} [0 1])
06:56clojurebot1
06:56babilen,(some #{1 2 3} [0])
06:56clojurebotnil
06:56aroemersclgv: indeed! I tested it in a REPL, and is about 4 times faster in this case. Nice, and makes sense.
06:57babilenaroemers: It is just the appropriate thing :)
06:57clgvaroemers: any clojure sequence based function will convert it to a sequence which causes the overhead
06:57Hodappbabilen: It was completely preventing me from working. I would call that quite a significant problem, but then I wouldn't know what your perception of important problems is.
06:58Hodappbabilen: It's the same reason why I gave up on Counterclockwise, though I had better luck there.
06:58babilenHodapp: Yeah, I am happier that these problems have been solved. People are working on nice nrepl integration and a lot of progress is being made.
06:59clgvHodapp: CCW did prevent you from working? I am working with it since more than 2 years.
06:59Hodappclgv: I ran into a repeated set of issues with what appeared to be the plugin itself getting a NullPointerException, from what I remember.
06:59Hodappclgv: I asked quite a bit in the channel and no one had a clue what was going on.
07:00clgvHodapp: approximately when did that happen?
07:00Hodappclgv: 4 or 5 months ago.
07:00Hodappclgv: I will see if I took any notes on the precise symptoms I had.
07:00clgvHodapp: CCW development speed has significantly increased since laurent got the funding
07:01Hodappclgv: When did laurent get the funding?
07:01clgvHodapp: if you are interested in it, just try a current version. CCW was the first to use nrepl
07:01clgvjanuary 2013
07:02clgvcurrently, there is built-in basic leiningen support
07:02Hodappoh yes, here's the other issue I'd run into: just typing in CCW would regularly get it into states where Eclipse was unbearably slow
07:02Hodappopening a quote or a paren would do it
07:03clgvinteresting, I never encountered something similar on the stable releases...
07:03HodappI could reproduce it quite readily in my own configuration months back
07:04clgvwell if you have spare time to play, you can give it a try now.
07:05clgvnow = current version ;)
07:05abpCan I move binding-pairs up and down in a let in emacs?
08:05samratis there a way to stop a server started from ring-server(https://github.com/weavejester/ring-server)?
08:10clgvsamrat: very likely you get a return value from the `serve` function which you can use to stop the server
08:17samratclgv: ok, seems like using defonce works here
08:30SgeoYou know what could make my blog post more convincing?
08:30SgeoWriting some code to go along with it
08:30SgeoBut then I stumble upon one of the hard computer science problems -- naming things
09:04xumingmingvSgeo: how about 'x'?
09:05Sgeoheh
09:20OscarZ_trying to undestand sequences... are they like something like Haskell lists where you can use pattern (x:xs) to break up things so that they can be processed one by one ?
09:25matthavenerOscarZ_: not really
09:26matthavenerOscarZ_: you typically use (first s) and (rest s)
09:26matthavenerwhich would return x and xs equivalent in haskell
09:26arkxWell, doesn't that fall under "something like"?
09:26matthaveneryeah, sorry, its something like lists
09:26matthavenerbut its an abstraction instead of a data structure
09:27OscarZ_ok.. so there are many functions that understand sequences.. and they usually do something with the first and then recursively call themselves for the "rest" part ?
09:27matthavenerafaik, in haskell a list is concrete and not a typeclass
09:27OscarZ_I dont know much Haskell though but that part I remember
09:28matthavenerOscarZ_: yeah or they just use a list comprehension (for ...), or some higher order function
09:28matthavenerOscarZ_: unlike haskell, clojure recursive calls are not tail-recursive, so you have to use 'recur' to avoid stack overflow
09:29matthavenerbut, like haskell, you can produce a lazy sequence. unlike haskell, clojure is not lazy by default
09:29matthavenerOscarZ_: this is a great way to learn clojure, especially some of the core abstractions like seq http://www.4clojure.com/
09:32OscarZ_matthavener: that seems interesting.. thanks!
09:33OscarZ_I remember asking once if there was JVM based Haskell, but there was some tail-recursion related limitation in JVM why it cant be done..
09:33matthavenerOscarZ_: no problem. i'm definitely not an expert, so take what i say with a huge grain of salt :)
09:42ToBeReplacedis there an "interleave-longest" in stdlib somewhere? what is the idiomatic way to split a string and keep the separators? so... (my-partition "foo,bar,baz") => ("foo" "," "bar" "," "baz")
09:44augustlI have a list like [{:id 123 ...} {:id 456 ...} ...]. What's a good way to get the map where :id is 456?
09:45noidi(some #(= (:id %) 456) the-list)
09:46noidioops, that won't work
09:46noidiI forgot that some returns the return value of the predicate
09:47ToBeReplaced(filter (comp (partial = 456) :id) your-maps)
09:49augustlfilter is annoying, I also need to wrap it in "first"
09:50tbaldridgeDoes anyone know how many processor threads Ring will use if I use the Jetty adapter?
09:54alexnixonaugustl: there's (find-first pred coll) in flatland/useful, which reads better than (first (filter pred coll))
09:57augustlalexnixon: I wonder why there isn't a find-first in core
09:57augustlthere's probably a good reason for it that I'm not aware of :)
09:59ToBeReplacedit's too specific; no real pain in (first (filter pred coll)), and if you're doing it all the time, writing it yourself is fine
10:02augustllets say you have an infinite lazy sequence, how do you get the first item matching a pred out of that?
10:02augustlsince (first (some-iteration..)) won't do because it'd go on forever
10:03augustlI can't imagine any cases where you'd actually need something like that though, and in the rare cases that you do a recursive first/rest type thing would do
10:05alexnixonaugustl: (first (filter p c)) still works, with the caveat that if it'll realise the entire lazy seq so if you're holding onto the head elsewhere you'll run out of memory, and if there isn't an element which matches it'll keep searching forever
10:07alexnixons/realise the entire lazy seq/realise the seq until a match is found/
10:08snake-johni'm using live-emacs with nrepl and as soon as I type something in brackets nrepl starts evaluation which causes of cause classnotfound exceptions. anybody experienced this before?
10:09ejacksonsnake-john: i had a similar thing with java objects which I solved by including clojure-complete
10:09augustlhmm, I have a map-indexed that I now need to become a mapcat-indexed, which doesn't exist.. What's a good way to get a i++ type counter for this kind of thing? The use case is to iterate a set of maps and create datomic transactions, whose fact needs to include a "position" attribute to state its, well, position
10:09ejacksonjust put it into your project.clj
10:10snake-johnoh i see that's my problem I not using leiningen I started a nrepl server from my application
10:11ejacksonyeah, that's it... you need clojure-complete if you're going to do that
10:12snake-john@ejackson thank you very much!
10:16ToBeReplacedalexnixon: augustl: why will it realize the entire lazy seq? filter is lazy
10:17augustlToBeReplaced: ah :)
10:18alexnixonToBeReplaced: yeah you're right, I corrected myself afterwards: s/realise the entire lazy seq/realise the seq until a match is found/
10:24abpaugustl: You can use some, as noidi said, but the predicate gets quirky ie ,(some #(when (-> % :id #{456}) %) [{:id 456}])
11:09rboydquiet today
11:09rboydall the codes must be working
11:10ejacksonor not...
11:10ejacksonhence the coders are :)
11:16ToBeReplacedalternative to something like (cond (keyword? s) foo (associative? s) bar) ?
11:16ToBeReplacedit needs to work in both cljs and clojure... so i don't think i can do the protocol dispatch thing... or can i?
11:18nDuffToBeReplaced: protocols are a thing that exist in cljs.
11:22ToBeReplacednDuff: the types don't line up between the two languages though, do they? like if i wanted to have a protocol for a hash-map, in clojure it would be clojure.lang.PersistentArrayMap, in cljs it would be cljs.core/ObjMap
11:23nDuff*nod*; indeed, they don't.
11:24nDuff...not that such macros haven't been written / can't be used.
11:24ToBeReplaceddo you have a link to one in use?
11:27nDuffNot handy.
11:29ToBeReplacedhttps://github.com/lynaghk/cljx
11:30pbostromToBeReplaced: what's your question exactly? is it about whether your 'cond' code snippet will work in both? I believe it would
11:30gfredericks(alter-var-root #'*read-eval* #([true false] (rand-int 2)))
11:31nDuffToBeReplaced: ...by the way, also see also http://dev.clojure.org/display/design/Feature+Expressions and CLJS-27 for the reader approach.
11:31hyPiRiongfredericks: use ##(rand-nth [true false]) instead
11:31lazybot⇒ false
11:31ToBeReplacedpbostrom: cond works... just looks ugly and would be slow(er) on the java side
11:31ToBeReplacednduff: Thanks
11:32gfrederickshyPiRion: man I knew there was an easier way; though both will crash on arity
11:33gfredericks(pos? (rand-int 2)) is maybe the shortest
11:33hyPiRiongfredericks: crash on arity?
11:33pbostromToBeReplaced: but you were asking something about protocols
11:33gfrederickshyPiRion: when using it with alter-var-root, yeah
11:34hyPiRiongfredericks: Oh shoot.
11:34hyPiRionis it unbound by default now, or is it true?
11:35ToBeReplacedpbostrom: right... because an alternative would be to use protocols and extend it to each type. however, that would not work across both platforms because the types are not the same -> instead of using "string?" i'd be using "java.lang.String"
11:35gfrederickshyPiRion: true I thought
11:36gfredericksI think rhickey's latest commit does nothing but add read-edn
11:37hyPiRiongfredericks: #(rand-nth [(not %) %]) ?
11:37hyPiRionThat's probably the safest.
11:37hyPiRionOr, uh, "most random".
11:38gfredericksdoesn't return a boolean though
11:38gfredericks#(rand-nth [(not %) (not (not %))])
11:38hyPiRion(comp rand-nth (juxt not boolean))
11:40hiredman,(take 2 (iterate complement boolean))
11:40clojurebot(#<core$boolean clojure.core$boolean@5373166a> #<core$complement$fn__2348 clojure.core$complement$fn__2348@58bf6255>)
11:41hyPiRion,(rand-nth (iterate complement true))
11:41hyPiRionOh, okay. Just die then
11:41hyPiRionhiredman: you generate functions there. Hmm.
11:42clojurebotExecution Timed Out
11:42hiredman*shrug*
11:49hyPiRionOh, hey
11:49hyPiRion,(->> (range) (map vector) (reductions (comp vec concat)) (map #(% (peek %))))
11:49clojurebot(0 1 2 3 4 ...)
11:52FrozenlockI remember trying a noir example where there was kind of a minimum db wrapper over a map; something to do a quick proof-of-concept without needing a database. Could someone point me towards something similar?
11:52Frozenlock(For noir or compojure, if possible)
11:53hyPiRionhttps://github.com/ibdknox/Noir-blog ?
11:53hyPiRionIt uses simpledb
11:54FrozenlockhyPiRion: Yes exactly that! Thanks :D
11:55hyPiRionFrozenlock: You're welcome :)
11:59hyPiRionWow, silent here now.
11:59FrozenlockhyPiRion: Let me change that.. "Wow, I would really like to have `read' fn that doesn't `eval' at the same time."
11:59TimMc__@~··___@~··_____
11:59TimMc^ tumbleweed
12:00hyPiRionTimMc: I was thinking you got some swearjure up and running
12:00babilenFrozenlock: not again! :)
12:00TimMcFrozenlock: Silly, today's topic is the CA.
12:00FrozenlockTimMc: Didn't receive the memo.
12:01FrozenlockOh wait there it is. I was too busy doing my TPS report.
12:01gfredericksdoes clojure really have to have all those parentheses?
12:01hyPiRionTimMc: I realized that finding the nth prime number should be trivial in Swearjure.
12:01Frozenlock*shameless Office Space reference*
12:01hyPiRionThough I should consider quitting writing those programs. It's not good for my sanity.
12:02gfrederickshyPiRion: prime numbers are not important to mathematics
12:02hyPiRiongfredericks: Aren't the numerical atoms important? :o
12:03craigbroreally we can just have 1,2,infinite and be good
12:03hyPiRionOh right, there was probably some HN thread on it.
12:03craigbroif you wanna do theoretical computr science, add 0
12:04craigbroI wanna find me a language that undertands simplicity, and gets rid of this complexcted numeric range, and number type stack
12:05technomancymaybe a slide rule?
12:05hyPiRioncraigbro: Tried common lisp? Ratios, complex numbers, arbitrary length of floating points, etc.
12:06babilenHow would you go about a variation on with-open in that I can specify additional actions (not just close) to be performed in the finally block? I can surely just write it down, but there might be something a little nicer. Any pointers? (/me is tires and needs inspiration now)
12:06craigbrohyPiRion: yah, years of it. I was being sarcastic above, just in case it wasn't obvious 8)
12:07hyPiRioncraigbro: Oh dangit, I totally didn't read your username. You mentioned that yesterday
12:07cmajor7what is the current way to do observables in clojurescript? (e.g. integrating with angular or knockout is no all that good)
12:07craigbronDuff: they didnd't complect namespaces! symbols can have vars and fn values!
12:07craigbrohehe
12:07technomancybabilen: I think you'd have to reify Closeable and define your own .close
12:07technomancyif you want to use with-open itself
12:08hyPiRioncraigbro: Yeah, it's kind of less complect than Clojure, having separate namespaces for functions and other values.
12:08hyPiRionIt comes at the cost of readability though, I think.
12:08technomancyhyPiRion: not at all, now you have to think about whether a function is a value or not
12:08nDuffcmajor7: I'm not entirely clear on "observables", but the usual way to trigger when values shift is to have atoms with watches on them.
12:09babilentechnomancy: I would be fine /not/ using with-open but reify'ing close /is/ a tempting solution. I am rather looking for a solution that allows me to specify "with-foo" where with-foo is essentially with-open just with additional teardown. I've been hacking for hours and just need an idea as .. well .. too tired. :)
12:10craigbroerr, not sure why just writing (try ...(finally ..)) it too much andneeds a macro?
12:11craigbrorunning that inside the body of a with-open would still work
12:11cmajor7nDuff: I see.. watchers that alter DOM every time the state changes?
12:12hyPiRiontechnomancy: Valid argument. I still don't really know the difference between (mapcar (lambda (x) .. and (mapcar #'(lambda (x) ..
12:12nDuffcmajor7: ...so, when I've done it in the past, I've used atoms on both sides -- one to represent the state of the UI, one to represent the state of the model, and watches to display model's outputs in the UI and represent changes the user makes in the UI to the model's inputs.
12:12technomancyhyPiRion: it's analogous to the distinction between statements and expressions. more to think about, but no actual benefits.
12:12craigbroas schemer and CLer, gotta agree there
12:13nDuffcmajor7: that said, I'm not a JavaScript person, so I may not be the ideal person to be talking here.
12:13craigbroit means that you can use more obvious names sometimes without shadowing your fns
12:13craigbrobut that is not that big of a win, considering a little imagination gets you around that
12:14hyPiRionSpeaking of #', that's actually complect in Clojure. When is #'fn the var, and when is it the value it refers to?
12:15hiredmanit is always the var
12:15hiredmanbut vars implement ifn by calling through to their value
12:16hyPiRionWell, my knowledge about #' in Clojure is thus revealed.
12:17hyPiRion(inc hiredman)
12:17lazybot⇒ 15
12:21hyPiRionQuestion: Do you consider conditionals (i.e. that only parts of a function is evaluated) as a critical component for a language to be turing complete?
12:21technomancyhyPiRion: you can make an if function which takes fns for its branches
12:22pbostromcmajor7: you might want to check out https://github.com/drcode/webfui, it's a framework that lets you declare something similar to what nDuff described
12:22hyPiRiontechnomancy: Yeah, that's what I was gonna tell you after you got that one wrong :(
12:22technomancyheh
12:23technomancybesides, for turing completeness you can get away with something like JNZ
12:23technomancy(jump not zero)
12:25hyPiRionAlong with some other small subset of machine instructions, I suppose.
12:25goraciohow to replace all chars in string- say "world" with "_" ?
12:27Hodappwhether a language is Turing complete is more a theoretical matter than a practical one
12:28nDuffgoracio: that's not a very well-specified problem. I mean, you could construct a new string with the exact same length and only "_" characters, and it would meet your spec.
12:28goraciook that's replace function )
12:28nDuffgoracio: ...but I suspect that it's not what you actually want.
12:29goracio,(clojure.string/replace "red" #"\w" "_")
12:29clojurebot"___"
12:29Hodappthe bar is fairly low for Turing-completeness, really.
12:29goracio,(clojure.string/replace "red" #"\w" "_ ")
12:29clojurebot"_ _ _ "
12:29hyPiRion,(clojure.string/replace "There are 2 apples" #"\w" "_")
12:30clojurebot"_____ ___ _ ______"
12:30hyPiRionJust so you know that it eats digits as well.
12:30rasmustogoracio: building a hangman game?
12:30goraciorasmusto: not really ) guess a word actually )
12:31hyPiRionIf you keep a set of guessed characters, you can do (comp not the-set)
12:31hyPiRionSay for instance you've guessed a and b, then the set contains #{\a \b}.
12:31goraciowell it appears not functional
12:31goracioi use while for example
12:32goracioand atoms
12:32nDuffgoracio: I mean, this meets your spec as well: (apply str (take (.length "red") (cycle "_")))
12:32goracionDuff: huuge
12:33nDuff(?)
12:33goracioreplace better
12:33nDuffgoracio: Point wasn't to argue that it was a good implementation. Point was to demonstrate that there's no need for an implementation to "replace" anything at all.
12:33goraciook
12:33nDuffgoracio: I objected (and do object) to posing the question in a way that suggested an implementation as a conclusion.
12:35OscarZ_I'm already stuck with this: http://www.4clojure.com/problem/19#prob-title, I tried something like (fn me [x] (if (rest x) (me (rest x)) (first x)))
12:35OscarZ_getting StackOverflow... dont understand why
12:36hyPiRionOscarZ_: replace rest with next. Also take a look at recur
12:37hyPiRion,[(rest ()) (next ())]
12:37clojurebot[() nil]
12:37hyPiRion,(if () true false)
12:37clojurebottrue
12:37hyPiRion(therein lies your problem)
12:39OscarZ_thanks I'll read up on those
12:39dnolenthheller: did you submit a CLJS patch yesterday?
12:40tomojwebfui looks rather interesting
12:42OscarZ_hyPiRion: I suspected it may not evaluate to false when rest x is empty list and I tried (= (seq ()) true) and it evaluates to false
12:43OscarZ_so I got confused
12:44FrozenlockHow does one start a ring/compojure server from within the repl? (in noir I used to just do server/start)
12:45hyPiRionOscarZ_: Yes. rest returns the empty list, and seq converts empty lists into nil.
12:45technomancyFrozenlock: here's what I use: https://github.com/ato/clojars-web/blob/master/src/clojars/main.clj#L31
12:45Frozenlocktechnomancy: Ah thanks! I would have forgotten the :join? false for sure.
12:46OscarZ_hyPiRion: I read from docs on seq rest that: Returns a sequence of the items after the first. Calls seq on its argument. If there are no more items, returns a logical sequence for which seq returns nil.
12:46hyPiRion(next x) can be thought of as (seq (rest x)), I may suspect that it's actually implemented as such.
12:46OscarZ_ok I think I got it... that "calls seq on its argument" got me off track
12:46craigbrowell, trying to track down a memory leak
12:46hyPiRionOscarZ_: Hmm, yeah, that sounds a bit messy.
12:46craigbroit only really shows up after tens of thousands of runs of our core.logic system
12:47hyPiRionWell, ##(seq? nil) should be false.
12:47lazybot⇒ false
12:47hiredmanhyPiRion: nope
12:48hiredmannil accepted everywhere a "seq" is, it is a seq
12:48TimMc,(seq? nil)
12:48clojurebotfalse
12:48TimMcOh, I'm being an echo again.
12:49TimMchiredman: nil is not a seq, but it participates in the sequence abstraction.
12:49TimMcOr rather, code that participates in the seq abstraction may use nil as a seq.
12:50hiredman,(seq ())
12:50clojurebotnil
12:50hiredman,(seq nil)
12:50clojurebotnil
12:50TimMc&(assoc nil :a :b)
12:50lazybot⇒ {:a :b}
12:50TimMcI guess nil is also a map?
12:52OscarZ_why is rest calling seq on its argument? isnt it already a seq ?
12:52rasmustoOscarZ_: to get that nil case if its empty
12:53tomoj&[(rest [1 2 3]) (seq? [1 2 3])]
12:53lazybot⇒ [(2 3) false]
12:53rasmustoOscarZ_: and it doesn't have to be a seq already
12:53TimMc&(rest "abcdef")
12:53lazybot⇒ (\b \c \d \e \f)
12:53rasmusto&(rest {:1 1 :2 2 :3 3})
12:53lazybot⇒ ([:3 3] [:2 2])
12:54hiredmanTimMc: nil was for a long time the only representation of an empty seq
12:55TimMcI understand, but I think it's crazy to call it a seq.
12:55TimMcIf seq were a protocol, that protocol would be extended to nil... but that's different than saying nil-the-value is a seq.
12:56hyPiRionOscarZ_: It's a bit complicated, as you see.
12:56clojurebotforget chouser: it's tougher with guards (arbitrary tests), where grouping is less clear. I need to work that out still.
12:56hiredmanseq produces seqs, seq can produce nil
12:56TimMcseq's output participates in the seq abstraction
12:56TimMcThat's as low as I'll go, I'm cutting my own hand off here.
12:57dnolenhiredman: TimMc: in Typed Clojure I believe nil doesn't really belong to types but is unioned with the types that fns accept.
12:57dnolenthe story is a bit different in CLJS where nil is extend-type'd to many abstractions
12:57tomojand (satisfies? ISeq nil) is true?
12:57dnolenI played around with removing that - but it does mean you have to explicitly handle lit everywhere.
12:57dnolentomoj: it should
12:57OscarZ_you can call seq on certain types that implements ISeqable interface?
12:58dnolen"explicitly handle nil everywhere" I mean
12:58dnolentomoj: and I mean it should based on the current implementation in CLJS - not that it always should.
12:58TimMcDisclosure: I'm a bit biased here; I don't think nil *should* participate.
12:59TimMcnil-punning is an attractive nuisance
12:59zackzackzackAny bright ideas about how to get bash output streaming into clojure?
12:59TimMczackzackzack: Pipe it into your Clojure program and read from System/in?
12:59dnolenTimMc: from a performance perspective, handling nil explicitly in CLJS would be better, same way RT.Java explicitly handle null
12:59craigbroclojure.java.shell/sh?
13:00clojurebotclojure is the best
13:00craigbrozackzackzack: clojure.java.shell ?
13:00zackzackzackcraigbro: clojure.java.shell/sh is what I'm using now.
13:00hyPiRionzackzackzack: I use "#! /bin/env clojure" in files, make them executable and pipe around
13:00TimMczackzackzack: Are you trying to shell out and read the output, or have a Clojure program participate in a bash pipeline?
13:00hyPiRionNot sure if that works for you of course.
13:01zackzackzackI'm trying to use `git log` to read in the entire history of the linux kernel
13:01zackzackzackI've gotten something that works with clojure.java.shell/sh
13:01TimMczackzackzack: https://github.com/Raynes/conch might work better for you?
13:02zackzackzackBut I'm trying to figure out if there is a better way than waiting on git to finish reading the entire thing into memory
13:02craigbrozackzackzack: but you want streams and not strings...
13:02TimMczackzackzack: conch's proc fn is probably what you want.
13:02tomojdnolen: right
13:02magnarsWhen I reload a file in the repl, I'd like for this atom not to be reset to nil: (def adventure (atom nil)) ... any ideas?
13:03Sgeo,(doc defonce)
13:03craigbromagnars: defonce
13:03clojurebot"([name expr]); defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated"
13:03magnarsexcellent, thanks
13:03Sgeoyw
13:03zackzackzackTimMc: that sounds about right
13:03zackzackzackThanks!
13:06tomojI see webfui sort of wants maps with no nil values too
13:07tomojwill except you need Maybe too :)
13:07tomojor just (= (assoc m k nil) (dissoc m k)) ?
13:08hyPiRiontomoj: (assoc m k nil) != (dissoc m k), except if you're only using the two-arity get
13:09hyPiRionI'd do dissoc for safety.
13:09hyPiRionOr well, durr, it depends on the use case.
13:09tomojI'm considering a hypothetical m
13:10tomoj(= (get m) (get m nil))
13:11hyPiRion,(= (assoc {:a :b} :a nil} (dissoc {:a :b} :a))
13:11clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>
13:11tomojer
13:11tomojyou know
13:11hyPiRion,(= (assoc {:a :b} :a nil) (dissoc {:a :b} :a))
13:11clojurebotfalse
13:11OscarZ_ok.. so seq is actually using Java Iterator (which is stateful) on the collections but is hiding the state from user?
13:11tomojthat m is not hypothetical :)
13:13dnolenOscarZ_: no
13:13OscarZ_:D
13:18SgeoCan I make protocol names and type names private?
13:18SgeoThey're an implementation detail
13:18SgeoMaybe I should just use a different namespace
13:23tomojshould (fn not= ... ([x y & more] (not (apply = x y more))))
13:23tomojI guess what I expected would be weird
13:24tomojI expected (false? (not= 1 2 1))
13:25cbpOH! is (System/exit 0) how you're supposed to exit nrepl?
13:27technomancycbp: it's how you exit the JVM in general
13:28cbpwell I know I just hoped it would do that on its own
13:32callenbotI need a faster feedback cycle, does anyone here use jrebe;?
13:33callenbotjrebel*
13:35callenbotjrebel users, anybody?
13:41callenbottechnomancy: do you anybody that uses jrebel with Clojure?
13:41technomancycallenbot: I have a vague understanding of what jrebel is but no idea of how it would be useful to clojure users
13:42jweissi think there is a bug in lazybot's karma system (at least on my server)
13:42jweiss(inc lazybot 500)
13:42lazybot⇒ 1
13:42jweisskarma is reset to 1 ^
13:44callenbottechnomancy: ring reloads/restarts are slow and annoying.
13:44jweiss(inc lazybot)
13:44lazybot⇒ 13
13:44jweiss(inc lazybot 1)
13:44lazybot⇒ 1
13:44jweiss(inc lazybot)
13:44lazybot⇒ 14
13:44jweissoh maybe not
13:45callenbottechnomancy: the built-in re-eval functionality is buggy and doesn't always work.
13:45hiredmancallenbot: just start a repl inside ring and reload via the repl
13:46technomancycallenbot: you mean the reload stuff in ring?
13:46technomancyyeah, I'm not a fan. use a repl.
13:46hiredmanfiring up jetty, then editing text files and having ring reload is dumb, what is this php? use the repl
13:47callenbothiredman: technomancy - okay okay, you guys are right. Thanks.
13:49callenbothttps://github.com/cemerick/drawbridge this is fucking cool.
13:49technomancyinc
13:50nDuffAren't there issues with nrepl.el not knowing how to route messages correctly when using drawbridge to communicate to both clj and cljs runtimes?
13:52technomancynDuff: probably; never used cljs
13:58calisAnyone know why my Emacs Live doesn't show documentation with autocomplete?
13:59rasmustois target-path something I should set for non-jar files that my clojure code creates? I'd like to use `lein clean` to clean up everything in the project
14:00technomancyrasmusto: yeah, placing artifacts inside :target-path would let you do that.
14:00technomancynot sure what you mean by setting it
14:01rasmustotechnomancy: can't you put :target-path "something" in project.clj? oh... That would affect where jar files go too.
14:01rasmustotechnomancy: I guess that putting everything into target/ is my solution, and is probably the cleanest
14:02technomancyright
14:09gfredericksjweiss: it's just incing a name with whitespace in it
14:26cmajor7nDuff: "atoms on both sides -- one to represent the state of the UI, one to represent the state of the model, and watches to display model's outputs in the UI and represent changes the user makes in the UI to the model's inputs" => you mean save UI atoms periodically to sync them with the backend atoms?
14:26nDuffcmajor7: ...err. No.
14:27AtKaaZ&"\@all"
14:27lazybotjava.lang.RuntimeException: Unsupported escape character: \@
14:27nDuffcmajor7: DOM event -> call into clojurescript -> immediate update of UI-tracking atom -> immediate trigger of watchers on that atom -> immediate backend code invocation -> ...
14:28nDuffcmajor7: nothing periodic about it.
14:29yediis there a d.get('key', default) equivalent for lists?
14:29AtKaaZ&"\@1"
14:29lazybotjava.lang.RuntimeException: Unsupported escape character: \@
14:29yediwrong channgel, y b
14:29AtKaaZwhat am I missing here
14:30cmajor7nDuff: thank you. "immediate backend code invocation" I am trying to avoid that, that is why I was thinking on a some kind of periodic sync. Otherwise it creates quite a load on the backend (there are also cases the data does not yet need to be persisted)
14:30AtKaaZ&\~\@all
14:30lazybot⇒ \~
14:31nDuffcmajor7: *nod*. Sounds like you'll want to do something yourself with timers, then.
14:31nDuffcmajor7: Might have your watchers set flags or maintain a changelist for the timed events.
14:32nDuffcmajor7: ...also, the library pbostrom_ pointed at _does_ look interesting.
14:32cmajor7nDuff: I see, thx. yea, that's the current approach, keeping the dirty on and a change list.
14:33gfrederickshmm
14:33cmajor7yep, I am looking at webfui, just wanted to see there is nothing I can use cleanly directly provided by the language.. all the libs are deps, and deps are relying on something.. (e.g. like noir that can be depricated :) )
14:33gfredericksso if I (require 'clj-time.core) in my user.clj, then a compiled uberjar crashes saying it can't find the "class" for a clj-time protocol
14:33gfredericksif I don't require it, it's fine
14:34hiredmandon't use a user.clj
14:34hiredmanit will undermine the repeatability of your builds
14:34gfrederickswhy not?
14:34cmajor7nDuff: "immediate trigger of watchers on that atom". do you mean that you would update corresponding DOM elemens within these watchers as well? e.g. an user changed something in one place and the other place that displays a summary of that also changes
14:35gfredericksso if I want to use data readers in source files I'll have to require not-directly-used namespaces to make sure they work?
14:35nDuffcmajor7: well -- the way I did that was to abstract things coming from the model to the view through a second atom.
14:35hiredmangfredericks: yes
14:35gfrederickshiredman: that is not a giant ball of happy-times.
14:36hiredmangfredericks: user.clj is not a "project" scale feature
14:36nDuffcmajor7: so, user triggers DOM change -> js callback -> set input-atom -> model change -> logic happens -> set output-atom -> listener does a DOM update -> displays output to the user
14:36FrozenlockCompojure question: I'm trying to load some files (css, js) using the hiccup functions as I would in Noir, but it doesn't seem to point my public directory. Am I missing a step?
14:36gfrederickshiredman: what sort of feature is it?
14:36hiredmanfor example if you have multiple user.clj files on the classpath only one is loaded
14:36nDuffcmajor7: the advantage of that is that your application logic is completely isolated from the view code
14:36nDuffcmajor7: so you can unit-test it in complete isolation.
14:36hiredmangfredericks: it is a little hack that you can use for customizing your personal environment
14:37gfredericksthere certainly aren't multiple user.clj files involved... :/
14:37hiredmangfredericks: if you start using it in projects and then want to mix and match projects
14:38gfrederickssure; but I'm having issues with it now and that's not the cause
14:38gfredericksjust wondering what is
14:38cmajor7nDuff: yep, I use "fetch" that relies on "defremotes" (just routes over "host/_fetch/whatever"), so my model is also isolated. as to the output it comes back from the "remote call" async and also picked up by the listener then..
14:39hiredmangfredericks: depending on how you are using user.clj it may be on the classpath for compilation, but then not for the uberjar
14:39gfrederickshiredman: that also wouldn't explain it; I've wittled the project down so that it's no longer dependent on the user.clj
14:39gfredericksthere's one namespace (main) and it has the same require (clj-time.core) as in the user.clj
14:39cmajor7nDuff: where I am still unsure is: 1. Syncing "other"/"all related" DOM elements on a change (without necessary going over the wire). 2. Periodic sync with the backend to spare the load
14:40hiredmangfredericks: could be lein cleaning out non-project class files
14:40hiredmangfredericks: first thing is open the jar and see if the class is in there or not
14:40gfrederickshiredman: yeah I was just trying that; it's not in the case when it fails
14:40gfredericksand it is otherwise
14:40gfredericksso somehow it corrupts the build :/
14:41nDuffcmajor7: so, when I've been saying "backend", I didn't mean over-the-wire
14:41nDuffcmajor7: I meant the clojurescript bits that didn't directly deal with the DOM.
14:41hiredmanwhat corrupts what?
14:41gfrederickshiredman: the existence of the user.clj apparently causes the .class file to not get included
14:41hiredmanyeah
14:41gfrederickswell, the existence of user.clj and it calling require
14:42hiredmanwell the user.clj file is loaded before the compilation happens
14:42gfredericksif it's commented then it's okay
14:42hiredmanso stuff loaded due to user.clj will not end up being transitively aot compiler
14:42hiredmanaot compiled
14:42hiredmanso class files assumed to be there will not be there
14:42nDuffcmajor7: ...anyhow -- I mostly don't do much frontend work, so as you're getting towards more interesting/advanced questions, I should probably bow out.
14:42hiredman"don't use user.clj"
14:43gfredericksyeah :( I just hate all the silly requires for data readers
14:44ppppauli am stumped on a xml-> problem
14:44ppppaulanyone interested in helping me?
14:44gfrederickshiredman: thanks
14:44ppppauli want to extract multiple values from an xml zipper in 1 go. i am able to do so using (juxt (attr :Id) (attr :Source))
14:45ppppaulhowever i want to go deeper into my object and pull out some more info
14:45FrozenlockEh... turns out I just needed to use the route/resources function.
14:45matthavenerppppaul: maybe get-in ?
14:45cmajor7nDuff: thx for the perspective anyway. will keep looking.
14:45ppppauldoing (xml-> some-path (juxt (attr :Id) (attr :Source) (seq-test [:Size (attr :Width)) throws errors
14:47ppppaulmatthavener, in all the examples i've seen with zippers, get-in hasn't been used...
14:47ppppauli'll see what i can get out of it
14:47matthavenerppppaul: i think i'm wrong
14:48ppppaulzippers are arrays of objects of arrays...
14:48ppppaulnot simply a nested map
14:49kalizga,(+ 40 2)
14:49clojurebot42
14:49kalizga,(with-local-vars [lv 0] (let [a (atom 0)] (time (dotimes [i 10000000] (var-get lv))) (time (dotimes [i 1000000] @a))))
14:49clojurebot"Elapsed time: 696.485357 msecs"\n"Elapsed time: 17.247703 msecs"\n
14:49kalizgaodd how w-l-v is way slower?
14:50kalizgai thought it'd be faster
14:50kalizgawait .. i missed a 0 i think .. jeeez
14:50tomoj(xml-> some-path (juxt (attr :Id) (attr :Source) #(xml1-> % :Size (attr :Width)))) ?
14:51kalizgabut still:
14:51Bronsawith-local-vars and var-get? I've never heard of those before
14:51kalizga,(with-local-vars [lv 0] (let [a (atom 0) n 10000000] (time (dotimes [i n] (var-get lv))) (time (dotimes [i n] @a))))
14:51clojurebot"Elapsed time: 746.52648 msecs"\n"Elapsed time: 55.51752 msecs"\n
14:52Bronsahow is var-get any different than deref?
14:53technomancyBronsa: deref is polymorphic
14:53kalizgavar-get is to with-local-vars as deref is to atoms (and others)
14:53technomancyderef on vars is var-get
14:53kalizgaah, it works for those too
14:53Bronsatechnomancy: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L200-L211
14:53Bronsaactually var-get is .get, deref is .deref
14:54BronsaI'm missing how they would behave differently
14:54technomancythey don't
14:54Bronsaright.
14:55hiredmana deref of a var is a locking operation, deref of an atom is not
14:55tomojso why are they different?
14:55kalizgahiredman: that would explain the difference in performance .. hmm
14:55hiredmanatoms use CAS for setting the value, vars are just lock and set
14:55kalizgai guess
14:56kalizgamakes me wonder what the point of w-l-v is then .. it has, seemingly, zero benefits
14:56hiredmanyep
14:56Bronsatechnomancy: so the double implementation is just historic rubbish or.. ?
14:56technomancykalizga: I asked rich that at the last conj
14:56technomancyor two conjes ago?
14:56technomancykalizga: his answer was ... opaque
14:56gfredericksmany many conjes ago
14:56hiredmanvestigial
14:56technomancyBronsa: yeah, implementation detail I'd say
14:56gfrederickstechnomancy: the fact that you asked him indicates that you obviously don't understand the purpose of vars and shouldn't be suggesting changes.
14:57Bronsaheh
14:57technomancyI shall not question further
14:57kalizgaopaque? .. like, it illustrates intent? .. self-documenting code? .. or am i reading too much into this .
14:58kalizga(i'm not a native english speaker, either)
14:58gfredericksman this would be a good time for @fakerichhickey to say something
14:58technomancykalizga: I just mean unclear
14:58gfrederickskalizga: rich's answer to technomancy was not clear
14:58hiredmanunamed vars (like you get with with-local-vars) predate the existence of atoms as mutable cells
14:58kalizgaok, technomancy
14:59hiredmanbut vars are not exactly the same, because you still kind the nested stack of bindings for unamed vars which you do not get for atoms
14:59TimMcFor a data reader to be available, can it simply be on the classpath some place?
14:59technomancyhiredman: right but if you actually write code that way everyone will hate you
14:59hiredmanno
14:59TimMcI'm guessing from gfredericks' complaints that there's more to it than that.
15:00gfredericksTimMc: yeah somebody has to require the code
15:00hiredmanyou need an entry in the data-readers map and you need the code to be loaded
15:00TimMcSomebody, but not necessarily the current ns.
15:00gfredericksTimMc: which is fine if you're reading data at runtime, but lame if you want literals in your code
15:01TimMcAha.
15:01TimMcAnd wow, that's a lot of opportunity for breakage during refactoring.
15:01gfrederickshow so?
15:02gfredericksit'd break slamhound I bet :)
15:02TimMcns A requires ns B which loads data reader C; A sometimes reads data using C; program is refactored to remove A->B dependency; A sometimes breaks
15:02hiredmanthe alternative is data_readers.clj causes arbitrary code to run
15:02TimMcRight, and no one wants that. :-/
15:04gfredericksI was hoping wrapping user.clj with (when-not *compile-files*) would help but it's apparently not set at that point
15:04hiredman"don't use user.clj"
15:04gfredericks:)
15:04hiredmanspeaking of data literals https://github.com/hiredman/bytes
15:04gfredericksyeah I was thinking of using that
15:04gfredericksalso it caused me to view thelastcitadel.com
15:05hiredmanD:
15:06gfredericksI mostly left confused
15:08hiredmanI can see how that might happen
15:21Sgeohttps://gist.github.com/Sgeo/de8180f895ff7aed15ea
15:22SgeoWhy can't I seem to access the safer-trampoline.private.TrampolineDone class?
15:26technomancyhello folks; just deployed a new clojars with fixes to the index; search is now lucene-backed and tweaked to show the latest version properly
15:28craigbrooh so much fun
15:28craigbrojhat on 4g heap
15:28craigbropegging 43 cores
15:28gfrederickstechnomancy: hello.
15:29craigbroi want instant answers!
15:32callenbottechnomancy: "search is now precariously stored in manually managed lucene indices on the filesystem" fixt.
15:33callenbot ;)
15:34Frozenlocktechnomancy: it's weird to see you write "hello", as you never enter or leave the channel :P
15:37winkhey language fans, find any errors? any suggestions? http://stuff.art-core.org/Languages3.png
15:38Sgeowink, uh, what does arrow mean?
15:38gfredericksSgeo: "points to"
15:38SgeoBecause you have C going to Chicken Scheme and Racket
15:38winkimplementation language of the compilers :)
15:39gfredericksalso box means "box" and triangles mean "are triangle with regard to"
15:39SgeoAh
15:39hiredmanthe javac is written in java
15:39winkok, thanks.
15:39SgeoWhere's Pharo and Squeak Smalltalk?
15:40SgeoThey're written in Smalltalk and a subset of Smalltalk which gets compiled to C
15:40hiredmanand them jvm spec does not require a jvm to be written in any particular language
15:40Sgeoiiuc
15:40winkok, smalltalk left out for now, noted
15:41hiredmanand most jvm langs run on other jvms besides openjdk and oracle's
15:41SgeoAlso where's Factor? And Forth? And Ada? And COBOL? And ...
15:41winkhiredman: are there so many more?
15:41hiredmanjikes, ibm's
15:41hiredmanjam
15:42winkit's 1h old
15:42hiredmancacaojvm?
15:42hiredmanapache harmony
15:42winkok..
15:42SgeoI don't see Common Lisp on there
15:42SgeoSBCL is in CL I think?
15:43TimMcwink: You might want separate relationships for "compiles to" and "is implemented in".
15:43hiredmandunno what kind of jvm is on blackberry phones, but it is some kind of stripped down pre 1.5 jvm so I don't think any langs target it
15:43FrozenlockEmacs-lisp?
15:43winkTimMc: yeah, true
15:43TimMcAlso, I'm offended that you didn't include Piet.
15:43SgeoWhere's BancSTAR?
15:43TimMcAbsolutely offended.
15:43winkthe thing is...
15:43winknot sure if trolling :P
15:43hiredmanthe whole point of a vm is to break that chart
15:43TimMc:-P
15:44SgeoYou have not a chance of including every language of interest
15:44SgeoIf you're listing specific implementations, you have even less of a non-chance. How about all the Scheme implementations?
15:45ljosTimMc: https://github.com/ljos/clj-piet
15:45SgeoI need to get some sleep
15:48winkhiredman: we got to the idea when reading about topaz, ruby in rpython
15:49wink.net is also missing completely
15:51gfrederickswhat hath turing completeness wrought
15:51callenbotljos: that's pretty awesome
15:54ljoscallenbot: :) I made it a while ago over two weeks. Some funky code in there. Still want to do a proper interface for it tough.
15:54callenbotljos: positively obscene :D
15:54amalloywe should put together a list of esolangs implemented in clojure
15:55callenbotljos: I'd like a bi-directional interface that generates bit arrays for peit to interpet.
15:55callenbotinterpret*
15:55callenbotthen I could write my code in clojure, generate the image, then only execute from that
15:56callenbotobfuscation from hell :)
15:56ljoscallenbot: that would be awsome!
15:57ppppauli'm using compojure and i want to match the "13" on "13_files" in this route "documents/510de753-d1fa-4998-bf9e-f52e999f284a/13_files" is this possible?
15:58callenbotppppaul: Not to be an asshole but: https://github.com/weavejester/compojure/wiki/Routes-In-Detail
15:58ppppaulthank you callahad
15:58callenbotI'm not an Authurian night.
15:58callenbotknight*
15:58ppppaulthings just got crazy
15:58callenbotppppaul: I'm a bot, don't talk to me.
15:59TimMcljos: Nice. So now I can run my Brainfuck in a Piet interpreter written in Clojure, which is compiled by Java which is implemented in C or whatever.
16:00ppppauli should have been directed to https://github.com/weavejester/clout
16:01callenbotppppaul: clout is fine too
16:03ljosTimMc: It is my goal to offer the maximum amount of language indirection.
16:04TimMcAnd then implement llvm in bf...
16:05ljosDon't you just need to implement a llvm backend that compiles to bf and then compile llvm to that backend to do that?
16:11TimMcWell, I was just adding more to the top of the stack.
16:12gmanikaj #riemann
16:14gfredericksI have a friend who kept talking about using datomic backed by cassandra backed by datomic
16:15winkdat inception
16:18TimMcgfredericks: Datomic should cut out the middleman and provide a datomic backing for datomic.
16:18TimMcIt's ridiculous that we'd have to interpose Cassandra.
16:19matthavenerTimMc: isn't that because you only need a backup of the datastore?
16:19matthavenernot really a need to get the transcation/query system involved with data storage
16:29TimMcOooh, the next time I have to interview someone, maybe I'll make them discuss various solutions to the *read-eval* problem.
16:29TimMc...or maybe they'll just run away screaming.
16:30amalloyTimMc: you deserve to find someone who solves it by using a language with no reader
16:33TimMc:-P
16:35shaunxcodeat the repl - how can I pretty print a dict containing a tagged literal e.g. I want to pprint {:db/id #db/id [:db/part.db]} w/o the reader trying to actually interp #db/id
16:35matthavenerit'd be cool to see a read that could ensure only purely functional code with some kind of cpu/memory bound on reading
16:35matthavenerso you could have a very flexible reader, bound it with resources, and then accept any user input
16:35matthaveneroverkill and probably overcomplicated for 99% of use cases, but i agree its a cool interview question TimMc :)
16:38FrozenlockTimMc: I would just answer make a function 'read', and a function 'eval'. :p
16:39FrozenlockCould anyone give me a link to an example using `with-goup' in the hiccup library?
16:41amalloy$google hiccup with-group
16:41lazybot[Grouping fields in Hiccup - Weavejester's Blog] http://weavejester.com/grouping-fields-in-hiccup
16:42Frozenlockouch
16:43Frozenlock$duckduckgo hiccup with-group
16:44amalloynote that google even gets it right if you try with-goup
16:45amalloyi was actually rather hopeful weavejester had come up with something clever named goup
16:45amalloygrossly offensive user principle?
16:45borkdudethis style guide got mentioned a lot lately: https://github.com/bbatsov/clojure-style-guide
16:45borkdudeis there a leiningen plugin which could check conformance to this style in a project?
16:46kencauseyHi. I've been using guile lately for some system scripting stuff as an anodyne to bash. I was wondering if we were anywhere near using clojurescript, say with node, for something near the immediacy of shebang scripts.
16:46borkdudeand would it be useful to have?
16:46technomancyborkdude: closest thing is kibit, but it gives some bad advice too
16:46amalloykencausey: well, i learned a new word today
16:47kencauseySorry for my archaisms. ;)
16:47tmciverme too!
16:47amalloykencausey: drip can often get you reasonable startup time for jvm-clojure programs, without having to use cljs/node instead
16:47TimMcI learned that one from the Superior Person's Book of Words. :-P
16:48borkdudetechnomancy is there anything like this at all? java has several, like checkstyle, pmd etc?
16:48kencauseyWell, there is still that annoying compile/build step
16:48kencauseyIt's not uncommon with hackish scripting to modify the script for some slight variation of a task.
16:48borkdudetechnomancy I'm asking, because maybe it would be a nice assignment for a student
16:48technomancykencausey: I have reached for ocaml when I need that
16:49kencauseyOK, I'm too addicted to s-exps maybe
16:49Frozenlock"Do not place blank lines in the middle of a function or macro definition." I'm guilty on this one. I like to space out things.
16:49technomancyborkdude: oh, there is also https://github.com/dakrone/lein-bikeshed
16:49TimMcFrozenlock: In cond forms, yeah?
16:49technomancyFrozenlock: IMO that only applies when not using cond
16:49technomancywhich is part of why I don't use cond very much
16:50kencauseyIf I need vertical whitespace in a proper language I now consider that a smell that suggest refactoring.
16:50borkdudea blank line in cond, why?
16:50kencauseyClear separations of cases
16:51TimMcborkdude: Consider what happens when predicate and consequent add up to more than a line.
16:51borkdudeI'm still hoping for org-table format cond
16:51borkdudeTimMc ok, yes got it
16:51Frozenlocktechnomancy: a recent example. Really long function https://www.refheap.com/paste/9563
16:52FrozenlockDamnit refheap.el, y u no set clojure as a language!
16:52technomancyFrozenlock: needs to become multiple functions
16:53borkdudehmm, refheap.el, got to check that out
16:54Frozenlocktechnomancy: Yeah I do to, in this case I just translated a js function. I'll look at how I could divide it.
16:55abptechnomancy: mm then you sure love these: https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj#L351
16:55FrozenlockStill, no blank lines?
16:55borkdudeyeah, it works, https://www.refheap.com/paste/9565 :-)
16:55technomancyabp: my eyes
16:56Frozenlockborkdude: a real time-saver
16:57borkdudeFrozenlock yeh, and it set clojure as a language https://www.refheap.com/paste/9567
16:57FrozenlockHmm I need to look at my .emacs then.
16:58borkdudeFrozenlock I just installed refheap.el from marmalade
16:58borkdudeFrozenlock and didn't customize anything
16:59borkdudeFrozenlock I did set the buffer to clojure-mode
16:59FrozenlockAhhh I see, it was a clojurescript buffer.
17:01FrozenlockThere we go: (add-to-list 'refheap-supported-modes '(clojurescript-mode . "Clojure"))
17:02Frozenlock"Use not= instead of (not (= ...))." Wow this is nice, I'm learning new functions.
17:02borkdudeI wonder if you can also post non-anonymous posts from emacs?
17:02FrozenlockSure
17:03Frozenlock(setq refheap-user "Bob Moran")
17:03Frozenlock(setq refheap-token "zzzzz-xxxxx-xxxx-xxxx-xxxxxx")
17:05borkdudeFrozenlock yeah! :)https://www.refheap.com/paste/9571
17:09borkdudeit would be cool to have smth like http://tryclj.com/ and refheap interact
17:10borkdudeor being able to make a clojure snippet a link which posts it to tryclj.com so people could use that in blogs
17:10Frozenlockborkdude: Might want to look at `session'
17:10borkdudeFrozenlock what's that?
17:10Frozenlockhttps://www.youtube.com/watch?v=sSQ1dqqINrQ
17:11borkdudeFrozenlock is this in public production somewhere?
17:12FrozenlockDon't know...
17:12nDuffahh, ideone.com
17:12matthavenerthere's also codepad.org
17:13nDuffmatthavener: Doesn't look like it supports Clojure
17:13matthavenerah yeah, ideone.com has much better lang support
17:14Frozenlockhow does ideone support clojure?
17:14FrozenlockI don't see any result...
17:14borkdudedoes ideone also support posting clojure code a query string?
17:14borkdude+as
17:15nDuffFrozenlock: You selected "Clojure" from the list, entered your code, clicked "Submit", and don't have output?
17:16FrozenlockYeah... "(+ 1 2)
17:16nDuffFrozenlock: http://ideone.com/Sr8jar
17:16nDuffFrozenlock: well, you should have your code print something.
17:16nDuffFrozenlock: Just doing math doesn't emit output.
17:17borkdudenDuff I see a style guide thing there ;)
17:17FrozenlockI've been spoiled by my repl...
17:24callenbottechnomancy: sometimes the best way to clean up a large function is to read code that isn't the large function.
17:24octagonhi! is there a comprehensive list of clj special forms? i saw the docs page, but i noticed that fn* is missing
17:25dnolenoctagon: fn* is an implementation detail really.
17:26octagondnolen: i'm writing a macro that is rewriting expressions, and it needs to know to leave special forms alone. fn* may be an implementation detail, but when you do macroexpand-all it shows up
17:26Frozenlockoctagon: You saw the documentation page? Then you're good to master the language. Godspeed my friend!
17:26FrozenlockNiak niak niak
17:27octagonlike is there a clj file in the clojure source where the special forms at the lowest level are defined?
17:29llasramoctagon: clojure.tools.macro does some of exactly that. Check it out for an existing approach: https://github.com/clojure/tools.macro/blob/master/src/main/clojure/clojure/tools/macro.clj#L31
17:30llasram(where "exactly-that" -> rewriting expressions, leaving special forms alone)
17:30octagonllasram: thanks! that looks very promising
17:30octagoni knew it must be in there somewhere, and clojure.lang.Compiler/specials certainly makes sense
17:50FrozenlockIs there a clojure function to get the current time?
17:50Frozenlock(other than the java interop java.util.Date.)
17:51callenbotFrozenlock: use clj-time.
17:51callenbotFrozenlock: clojure doesn't have a built-in for this just in case it gets ported to a cross-dimensional quantum computer
17:52Frozenlock:)
17:52FrozenlockI would have prefered to not add a dependency just for having time, but thanks!
17:53callenbotFrozenlock: just use clj-time.
17:54callenbotFrozenlock: I had a similar thought once. It fucked me with a rake. Just do it.
17:57llasram+1, alas
18:01technomancyFrozenlock: java.util.Date is mind-blowingly bad
18:01technomancythere is also (System/currentTimeInMillis) or something if you just need a number
18:01patchworkCan I set a jvm system property on my system as a whole? I see I can put it in my project.clj (using lein), but I need to set it in a way that won't get pushed into my git repo.
18:01patchworkAny ideas?
18:01FrozenlockDon't worry, I do use clj-time for any serious app. This time however I just needed a timestamp.
18:02Frozenlocktechnomancy: Ah! Thanks
18:03hyPiRionpatchwork: You can put it in $LEIN/profiles.clj
18:03nDuffI thought the aspect of java.util.Date that spawned the question was that it was Java interop, no? (System/currentTimeInMillis also being a Java thing, after all...)
18:03hyPiRion"echo '{:user {:jvm-opts [...]}}' > ~/.lein/profiles.clj"
18:05patchworkhyPiRion: Thanks!
18:05patchworkI've only ever used my profiles.clj for plugins
18:05patchworkDid not know it had other functions
18:05patchworkSo are all options available in a project.clj settable system-wide in profiles.clj?
18:05patchworkThis is the first I've put that together
18:06technomancyyup
18:06technomancywell, not system-wide
18:06technomancyuser-wide
18:12hyPiRionpatchwork: Within projects, yes. Outside of projects, unfortunately not
18:12hyPiRionI'll try and patch that for 2.1.0, though no promises.
18:16callenbotoh yes, I am suddenly reminded why I don't use SQL databases.
18:17durka421hey, I'm running into this bug, anyone have ideas? https://groups.google.com/forum/?fromgroups=#!topic/clojuredev-users/eh1pjfI_iHQ
18:17durka42(cemerick perhaps?)
18:18hiredmandon't try to read *in* in nrepl or swank, they suck at it
18:19durka42yeah, apparently :)
18:19durka42okay, is there a less stupid way to do this, then
18:19durka42I have a really long loop
18:19durka42and I want to press enter between each iteration
18:19durka42I was just using (read-line) but as discussed that's a bad idea :P
18:20hiredmandon't loop?
18:20hiredmanhave a singel step as a function f, and just type (f) for each step
18:21durka42maybe...
18:21durka42it's a fairly complicated loop/recur
18:21durka42could maybe be refactored that way
18:30cemerickdurka42: yeah, there's an nREPL issue for it
18:31Raynescemerick: I have no idea how nrepl works, but how does it send error messages to clients?
18:31cemerick*in* isn't used much in general, even less given swank/nREPL and the limitations of tools like SLIME, ccw, etc.
18:33hyPiRionREPL-y is also funny to work with when it comes to input.
18:33cemerickRaynes: The contents of *err* are always streamed in responses; when an error occurs evaluating an expression, a separate response message with a status of :eval-error is sent, containing the classname of the exception and the root exception
18:33cemerickRaynes: grep interruptible_eval.clj for :eval-error
18:34cemerickpushing clj-stacktrace-style data back would be interesting
18:34Raynescemerick: I've noticed in both `lein repl` which is an nREPL backed REPLy and in nrepl.el which is… an nREPL backed… repl, sometimes if I make the same exception happen 3 or more times, I start getting useless exceptions that have no trace.
18:34RaynesI assume this is an nREPL bug, but I don't know where to begin to reliably reproduce it.
18:35cemerickNothing comes to mind as to what would produce that.
18:35RaynesIt has happened over the past 4 months or so on at least 5 separate occasions in two different projects with random exceptions.
18:36Raynescemerick: Mostly just telling you so that if anyone else has similar issues you know I did too.
18:36cemerickIf you can come up with a set of steps to repeat (via `lein repl` ideally), do let me know
18:36cemericksure :-)
18:36durka42I've been getting exceptions with no trace, but I assumed it was a problem with the library...
18:36RaynesAnd will do.
18:36cemerickdurka42: the REPL won't dump a trace without you asking for it
18:37durka42I know
18:37durka42but occasionally the exception says [no trace] and (e) throws a NPE
18:38cemerickthere are deranged cases where exceptions won't have traces
18:38technomancysome of those could be due to an old clj-stacktrace bug
18:38cemerickbut, *e should always be bound; if it's not, something bad has definitely happened
18:39cemerickOutOfMemoryErrors can lead to all sorts of nastiness, also
18:39cemerickesp if the OOME is caused in the process of building up a totally unrelated root exception :-P
18:40durka42yeah, OOME's are bad...
18:40durka42I've only gotten it with ClassCastExceptions I think
18:40durka42anyway, need to relocate
19:22pppaulhey guys
19:23pppauli'm having issues with cheshire again. getting 'add-encoder' does not exist errors again
19:23pppaulupdated my gist from last time
19:23pppaulhttps://gist.github.com/boxxxie/4687633
19:23pppaulon and mac + on ubuntu via vagrant
19:25hiredmanthe first is a lein error, means it cannot find your dependencies, do you have internet?
19:26pppauli do have internets
19:26pppauli deleted and redownloaded my deps
19:26technomancycheck the label; they may have sold you arpanets by accident
19:27pppauli posted my lein deps :tree in the gist too
19:28pppaulmy internet is fully working
19:29hiredmanremove dependencies until "lein deps" runs successfully
19:29hiredmantake the offending dep out back and shoot it
19:29pppaulhmm
19:29pppaulbut i need my json
19:30hiredmanyou have multiple problems
19:30hiredmansolve one at a time
19:30hiredmanfirst get your build in order, then get your code in order
19:31hiredmanif your build is not in order you unable to reproduce code problems reliably and unable to distinguish problems with the build and problems with the code
19:32technomancyit's too late to make a joke about PPP and dialup, right?
19:33hiredman+++ATH0
19:33pppaulhmmm
19:33pppaulug
19:33pppauli have this code working on 2 ubuntu 12.10 systems
19:33matt_dtechnomancy: go for it.
19:34pppauli am able to reproduce this error i have on 3 systesms
19:34technomancymatt_d: I feel like the moment has passed.
19:34matt_dtechnomancy: yeah, i agree
19:36FrozenlockRaynes: So, Firefly?
19:40pppauli updated my gist, i don't have the DEBUG=y lein deps errors anymore, all other snippets are up to date
19:40rasmustotechnomancy: do you intend for `lein clean` to follow symlinks?
19:40technomancyrasmusto: no choice really on JDK6
19:41technomancythat JDK is literally incapable of telling the difference
19:41rasmustotechnomancy: is that an issue with .isDirectory?
19:41technomancyI don't think so
19:41technomancywell, I don't know. been a while since I looked into it.
19:41technomancyI'd take a patch to be more careful if we're running under JDK7, but it didn't exist at the time that was written
19:42technomancyfeel free to open an issue
19:42rasmustogotcha. I might have to find another solution/make an issue, I just blew away a few directories :)
19:43xeqipppaul: are you sure that `lein :deps tree` belongs to that project.clj? I don't see chesire in the :dependencies, but its top level in the tree
19:43technomancyrasmusto: yeah, it's not ideal
19:46pppaullet me check
19:47xeqipppaul: yeah, when I use that project.clj I get libnoir -> chesire 0.4.0
19:47TimMctechnomancy: So java.nio is the bit that Java 7 adds?
19:48amalloyTimMc: java.nio is from java 4
19:48amalloybut i haven't been watching the whole conversation so this may not be relevant
19:48pppaulcheshire was in my project deps, but not in the one posted on gist, i updated the gist
19:48TimMcamalloy: Ah, it's java.nio.file then.
19:48pppaulsorry, posting the project.clj is harder than the other snippets
19:49technomancyTimMc: nio2 maybe?
19:49amalloyTimMc: yes. at least, some of the stuff there is certainly new, and as far as i know all of it is new
19:49technomancyTimMc: only reason I know is that delete-file-recursively didn't get promoted from contrib along with delete-file for this reason
19:49pppaulthe lein deps :tree is accurate
19:50amalloylord, nio2? whose awful idea of a name was that
19:50xeqinew-nio
19:50TimMcI don't see a nio2.
19:50TimMcAt least, not in the JDK.
19:50pppaullein classpath | tr : \n | grep cheshire -> 5.0.1
19:51TimMcpppaul: Dammit, I completely forgot about tr. That would have been useful about 100 times recently.
19:51pppaul:)
19:52amalloyyeah, i usually use a hacky-looking perl script when i know i should really learn awk, sed, and tr
19:52technomancyhttp://www.baptiste-wicht.com/2010/03/nio-2-path-api-java-7/
19:52loliveirawhat am I doing wrong? https://www.refheap.com/paste/9576
19:53hiredmanTimMc: there is no nio2, nio2 refers to things added under java.nio.
19:53pppaultr is simple
19:53pppauli find it works better in fish than in bash
19:53pppauli don't think bash understands \n
19:53TimMcpppaul: Yeah, there's some escape character you have to use first...
19:54amalloy$'\n' works, iirc
19:54TimMcyeah, that's the one
19:54rasmustotechnomancy: is it possible to have clojure code with that kind of java interop work with both java 6 and 7? I'm curious how you would make it backwards compatible
19:56xeqi&(->> [(true) (false true false false false false true false false)] (group-by identity) (map vals)))
19:56lazybotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn
19:56xeqi&(->> [true false true false false false false true false false] (group-by identity) (map vals)))
19:56lazybotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.Map$Entry
19:56xeqiblah
19:57pppauli think i found my cheshire issue… :use / :refer :all isn't working with the lib
19:57pppaulwhen i namespace via :require :as things seem to work
19:57pppaulwtf?
19:58xeqiloliveira: ##(->> [true false true false false false false true false false] (group-by identity) vals)
19:58lazybot⇒ ([true true true] [false false false false false false false])
19:58xeqior you could just (sort) first
19:58brehautpppaul: checked that you are using clojure 1.4? i had a lib pull in 1.3 overriding hte projects dep, resulting in confusing :refer related errors
19:58pppauli was wrong, namespace/add-encoder doesn't exist either
19:59pppaulbrehaut how do i check? clojure --version?
19:59brehaut,*clojure-version*
19:59clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
19:59technomancyrasmusto: you can check (System/getProperty "java.specification.version")
20:00loliveiraxeqi: i couldn't sort because the seq returned by foo is very *big*, it wont fit in memory. =(
20:01pppaulclojure version {:major 1, :minor 4, :incremental 0, :qualifier nil}
20:01pppaulseems ok
20:01loliveiraxeqi: or group
20:02rasmustotechnomancy: are you saying that .isDirectory will return false for symlinks on 1.7? My version is 1.6 now
20:03technomancyrasmusto: I think you have to use the Path API to detect symlinks: http://www.baptiste-wicht.com/2010/03/nio-2-path-api-java-7/
20:04rasmustotechnomancy: ah, okay. So I probably shouldn't use 'lein clean' for the time being
20:08technomancyyeah, perhaps a warning in the docstring of lein clean in the mean time?
20:09rasmustotechnomancy: yes, that would be a good idea. I'm wondering if .isFile could be used with .isDirectory to detect a symlink? maybe not
20:11hyPiRion$google java detect symlink
20:11lazybot[Java 1.6 - determine symbolic links - Stack Overflow] http://stackoverflow.com/questions/813710/java-1-6-determine-symbolic-links
20:13hyPiRionDoesn't sound like the worst thing to implement.
20:15rasmustohyPiRion: ah, that looks like it could work.
20:18hyPiRionBut well, working on top of a platform-agnostic virtual machine isn't as easy as we would hope it were sometimes.
20:19technomancyhyPiRion: the embarrassing side of Java's Smalltalk roots show through
20:22pppauli think my issue was that i was using the ring namespace
20:24hyPiRionOh, someone has named a library after me. How generous of them.
20:24pppaulwould that cause dep clashes?
20:25hyPiRionhttps://github.com/8thlight/hyperion
20:27pppauli hope that one day someone will name their library after me
20:27Raynesamalloy: Pretend that https://github.com/Raynes/lein-pdo's p stands for pppaul.
20:28amalloywhy are you telling me?
20:29RaynesI have no idea.
20:29hyPiRionYou were clearly interested.
20:29Raynespppaul: ^
20:29pppaul:D
20:29amalloyi have a job if anyone's interested: highlight me to let me know that Raynes's highlights are relevant
20:29RaynesMy fingers automatically type your name because I do it so often.
20:30RaynesI've woken up with your name written all over the walls.
20:30hyPiRionI hate when that happens.
20:30amalloy/part /abort /quit
20:30amalloy/help
20:40pppaulin what ways is it possible for a lib a dep requires clash with the same lib, but diff version, that my project depends on?
20:41RaynesIn every ways.
20:41pppaulwoah
20:41RaynesYou can't have two versions at once.
20:41pppauli don't want them
20:41RaynesOne will be preferred over the other.
20:41pppaulhmmm
20:41pppaulhow does that work?
20:41pppauland does that make sense?
20:41RaynesMaven should resolve to the newest version, I think.
20:41pppaulwhat if a lib i use needs an older version?
20:42RaynesThen you can exclude the newer version from whatever depends on it and the older version will be pulled in. Whether or not it will work for the thing that wanted the newer version is another thing entirely.
20:43pppaulmy situation is that my project wants v5 of a lib, and a dep wants v4. my project is getting v4, even thought v5 is on the classpath
20:43pppaulat least that's what i believe is happening
20:44amalloyif you are getting v4, then v5 is not on the classpath
20:44amalloyor at any rate v4 is on there first
20:45RaynesBut either way, this is a bad situation.
20:45pppauli only see v5 on the classpath
20:45pppauli understand that this is a bad situation
20:46Raynes`lein deps tree`
20:46RaynesThat's a good way to see how things are being resolved.
20:46pppauli have used it
20:46pppaulbeen on this problem for a day now
20:47RaynesSo you did `lein classpath` and v4 isn't on there?
20:47pppaulein deps :tree | grep chesh
20:47pppaul [cheshire "5.0.1"]
20:47devnRaynes: do you do "TDD"?
20:48pppaulwhen i attempt to use symbols from it's namespace they are not found. when i add my own to the jar they are not found either
20:48Raynesdevn: No.
20:48devnRaynes: i thought that would be the answer, and I am pleased.
20:48Raynesdevn: What made you ask that?
20:49devnRaynes: i was ranting in another channel about how i took testing methodologies to their logical extreme once upon a time and ultimately felt like it was like SEO, an industry invented to sell books.
20:50RaynesHeh.
20:50devnthe dogmatic: "stub this! mock that!" people who always have a book for sale
20:50devn"oh! let's do a kata! you know! like we're japanese!"
20:52pppaultaking anything to the extreme is usually not practical
20:52devnpppaul: taking anything to the extreme is how you figure out how far to take it
20:54devnthere is value in trying to overdo testing, I just loathe the industry of self-helpish folks who make a living off of telling other people that all they need to be better at programming is a ridiculous amount of verification.
20:54devnnot trying to parrot rich here at all, but the whole "guard rails" programming thing is apt
20:54technomancydevn: luckily it's often easy to smell when people are selling something
20:54devnhey! you're 12! just write tests for it!
20:55devntechnomancy: maybe im doing a bit of that right now
20:55devn:\
20:55devnthe unsell is still a sales technique, yknow?
20:55pppauli just started doing lots of tests for the program i'm writing… it forces complexity down
20:56pppaulit's a bit hard to write tests for complex code
20:57brehauti struggle to understand the reasoning behind being AR about tests, but using a language without expressive static types
20:57devnbrehaut: it seems pretty reasonable, no?
20:57pppaulAR?
20:58clojurebotstuartsierra is awesome
20:58devnyou threw away some verification, so you seek verification elsewhere
20:58amalloy(inc clojurebot)
20:58lazybot⇒ 18
20:58devnlol
20:58devn(inc amalloy)
20:58lazybot⇒ 43
20:58brehautAnal Retentive
20:58devncrap, sorry
20:58devndidn't mean to push you over the meaning of the universe
20:59devnbrehaut: don't you think it makes sense to seek verification if your background is in a statically typed language?
20:59devni feel like that's where most of the testing mavens and "classic" testing books came from
21:00devna lot of the "must read" books were written by guys and girls who spent their first 20 years programming in static languages
21:01brehautdevn: if their static langauges were C++ and Java, then they dont count
21:01devnC? fortran?
21:01devnwhat qualifies?
21:01devnand why don't you think that counts?
21:01brehautHaskell, ML, AGDA
21:01brehautbecause those langauges dont prove much about your code
21:01devnthe big push for "test fucking everything" seems to mostly come from java programmers
21:02brehautdevn: right. so the first sensible step would be: move to scala
21:02devnmaybe because you can get away with wasting a lot of time in big companies
21:02devn"i'm writing tests..."
21:02devnmanager: "oh, yes, i've read about that on usenet. carry on."
21:03devn"tests aren't finished" is the new "code is compiling"
21:04devnblech, whatever, it's too easy to bash on this stuff in this channel
21:16marty_mcflydevn let me know which channel you end up, id like to read the discussion :]
21:22xeqiI <3 my guard rails
21:23ivangenerative guard rails
21:23xeqieven better
21:24xeqiI just lack the skills to apply it to web dev
21:29amalloyecho "echo Prevented you from compiling a buggy program" > /usr/bin/cc
21:29lazybot"echo Prevented you from compiling a buggy program" > /usr/bin/cc
23:08tmciverHey McFly... I thought I told you never to come in here.
23:19technomancydoes he know doc_brown is looking for him?