#clojure logs

2013-10-11

00:53noonianwhat is the difference (to the code being evaluated) between including deps in project.clj and concating them to the deps in the project map before calling leiningen's eval-in-project for a leiningen plugin?
00:56noonianwhen i inject the deps, they are on the classpath, but pallet behaves slightly differently
01:14nooniannvm, it was just the order they were in
02:11muhoowow, pedestal;s routing seems pretty nifty
03:16muhoough tho, the interceptor stuff seems lifted from the android activity lifecycle.
03:16H4nsi wonder how this http://cljbin.com/paste/52579da5e4b01f853da4737b could be more idiomatic. i need to walk a tree and collect elements out of it. the remember function seems a little iffy
03:18ordnungswidrigH4ns: you could use (update-in results [:sets] (conj item))
03:19ordnungswidrige.g. (if-let [t (cond (seq? item) :seq (vector? item) :vec)] (update-in results [t] conj item) results)
03:20H4nsordnungswidrig: that looks good, thanks
03:20H4nsordnungswidrig: i'll not use seq? and vector? in the real code, i first want to get the tree walking and collecting sorted out in a minimal fashion
03:21ordnungswidrighttp://cljbin.com/paste/52579efae4b01f853da4737c
03:23H4nsordnungswidrig: and in the real code, i don't want the original items in the results, but something that is computed from the original item :) - but thanks, update-in looks cool.
03:23muhooclojure.walk/postwalk too
03:27H4nsmuhoo: if i understand it right, clojure.walk does not allow me to effectively flatten the structure
03:30H4nsmuhoo: what i need, though, is a concise way to walk a tree and build up a differently structured result (in my case, i process a tree and extract various objects residing on different levels into a map type->object). "extract" means that a new object will be created from what is found in the tree
03:51wunkiI often see in .cljs files the `:require [some.Lib :as var]` while the var is never used. Why is that?
03:57ddellacostawunki: are you asking why it's not used, or what the :as syntax means? As to why it's not used, maybe people thought they needed it but didn't…can't think of another reason. It doesn't do anything in and of itself.
03:58wunkiddellacosta: no, I know why it's used. I just thought maybe I'm missing something, that it's required in clojurescript
03:59ddellacostawunki: no, definitely not--you can require stuff in CLJS without using :as, certainly. It doesn't do anything unless you refer to a var with it
03:59ddellacostawunki: again, I'm going to guess whoever loaded it up thought they needed it but didn't, in fact.
04:00ddellacostaI know I've done that a few times
04:00wunkiddellacosta: would this work: `:require [goog.Uri :as goog-uri]` -> `(goog-uri. ...)`?
04:01ddellacostawunki: you know, I've tried that before with stuff in the goog namespace but it doesn't work, consistently, in my experience. I suspect it's something to do with it not being a CLJS namespace originally, but I haven't looked under the hood yet to figure it out
04:02ddellacostawunki: but I do often do stuff like `:require [goog Uri]` and then you can do (Uri. ...)
04:02wunkiddellacosta: ok, clear, thanks for explaining :)
04:02ddellacostawunki: or, [goog.fx.dom :refer [FadeOutAndHide FadeInAndShow]]
04:02ddellacostawunki: sure, glad I could help!
04:03wunkiddellacosta: no I only need to get better at debugging .cljs
04:03ddellacostawunki: what are your pain points with that?
04:03wunkiddellacosta: I'm working with Pedestal and I don't get to see the compilation (not done with cljsbuild cmd)
04:04wunkiddellacosta: so I often do something wrong and the .js is just empty
04:04ddellacostawunki: ah, pedestal…sorry I can't help you there, I don't have much pedestal experience. :-(
04:04wunkiddellacosta: would be great if I could to C-k in Emacs with .cljs as I can with .clj
04:04ddellacostawunki: does pedestal not use lein cljsbuild? Does it wrap it in its own compile command?
04:05wunkiddellacosta: it has it's own function which watches for changes and recompiles it
04:05ddellacostawunki: ah, gotcha.
04:05ddellacostahmm
04:05ddellacostawunki: it's funny you say that, I was just asking xeqi this morning about his cljs/emacs workflow
04:05ddellacostaspecifically in regards to testing
04:05ddellacostahold on
04:06ddellacostawunki: here, maybe this will help re: emacs + cljs
04:06ddellacostawunki: https://www.refheap.com/19658
04:08wunkiddellacosta: certainly, thanks!
04:10wunkiddellacosta: post above made me remember `(cljs-repl)` in Pedestal
04:10wunkiddellacosta: and with that I'm able to compile .cljs and I found my error :)
04:11ddellacostawunki: oh, cool! Glad to hear it. :-)
04:11wunkiddellacosta: hats of to the guys from Pedestal, they have setup an awesome dev environment
04:12ddellacostawunki: very cool, I really gotta dig into it again one of these days.
04:13wunkiddellacosta: it took me quite a while to "get" it. But I'm on my way now. Having the data flow on the whiteboard helps me :)
04:14ddellacostawunki: I bet. Yah, I'm working with a codebase that came out well before Pedestal, so I can't really leverage the tech right now. But really need to look at it again one of these days and see how it works.
04:14ddellacostasounds like it's got a lot of great features.
04:17wunkiddellacosta: certainly has, it's complicated, but with reasons.
04:34ddellacostawhy am I getting "Uncaught Error: No protocol method PushbackReader.read-char defined for type string:" ?
04:34ddellacostain CLJS
04:36ddellacostanever mind, my mistake
04:37ddellacostapretty freaking obvious one looking at the error now…*sigh*
05:08logic_progis there, anyone in this world,
05:08logic_progan implementation of STLC (simply typed lambda calculus) in Clojure?
05:15H4nsi'm using tree-seq and reduce to walk a tree to extract data from it. sometimes, i need data from an outer node in an inner node (i.e. the id of a certain enclosing element when processing a deeply embedded child node). i can think of using a ref to maintain that context, but that somehow does not feel right. any suggestions?
05:27zeroemH4ns: pass a vector containing all nodes in the path from the root to the current child?
05:27zeroem,(doc tree-seq)
05:27clojurebot"([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."
05:27ljosIs it possible to keep a reference to a part of a zip without copying the whole zip? Or rather, I have a n-ary tree and if I find an interesting node I want to store the location and go back to the node in O(1) instead of having to traverse the tree again. Right now I am using a zipper to traverse the tree and storing that zipper location, but it seems to me that when I store the location the whole zipper is copied. Because of the size of my trees t
05:28H4nszeroem: you mean i can pass the context in the result and strip it later on? that could work.
05:28zeroemwell, I was thinking about walking a tree in general
05:28zeroemlooking at the tree-seq docs, it may not be possible with it alone
05:29H4nszeroem: i was thinking about reduce's result argument
05:29zeroemtree-seq doesn't seem like it would be your thing
05:29zeroemgenerally, the "seq" functions (eg doseq) are used to force evaulation of a lazy seq
05:31H4nszeroem: http://cljbin.com/paste/52579da5e4b01f853da4737b is what i basically use to traverse the tree and collect data out of it (except that i'm now using update-in in the remember fn)
05:31zeroemyeah, you could do a depth-first style reduce, just pass the desired context as part of the result
05:32ljosH4ns: if you are doing tree traversals there is both the clojure.walk and clojure.zip (clojure.data.zip).
05:32H4nsmaybe i just need to write a plain recursive function to do it. :)
05:33H4nsljos: clojure.walk does not really allow me to return a differently structured result, as far as i understand. i'll look at clojure.zip, thanks.
05:35ljosH4ans: clojure.walk is mostly for transforming the nodes in place, that is correct. clojure.zip on the other hand can both replace, remove and insert new nodes.
05:37H4nsljos: thanks, i'll have look
06:08tangrammerHi folks
06:08tangrammersomeone knows why is in https://github.com/swannodette/swannodette.github.com
06:09tangrammer(a repo containing a few clojurescript demos)
06:09tangrammerappear in the file blog.utils.node this line (def fs (js/require "fs"))
06:10tangrammerI'm meaning that I don't understand why in a browser-javascript we try to load a nodejs dependency 'fs'
06:21katratxotangrammer: perhaps is not a "browser-javascript" example, but a node one
06:31bordatoueanyone got suggestions on how to implement the following, say if have an argument "= hello world" , then I need to output a function such that (fn [a b] (= a b)); simillary if the argument is "= one two three" ==> (fn [a b c] (= a b c)) ? Any suggestions on this please
06:37TEttingerbordatoue, so you don't want to compare one two three, you want to create a fn with the same number of args?
06:38bordatoueTEttinger, basically one two and three are arguments to a fn
06:39bordatoueTEttinger, so i need to creat a func that takes three arguments based on the input
06:39TEttingercan it be anything, or does it have to be =?
06:40bordatoueTEttinger, say if the string "= a b c" , the first portion of the string the operator
06:41bordatoueTEttinger and the rest is the arguments to the operator , which then output as a func
06:42bordatoueTEttinger, so for example "= a b" ==> (fn [a b] (= a b))
06:42TEttingeryep
06:42TEttingertrying to figure out how to solve it
06:43bordatoueTEttinger, do we need to use macros to solve this
06:49tangrammerkatratxo: sorry for the delay (i went out for a coffee) , the same thing (node example) I was thinking too, but the problem is when you try to use the code in your browser..... anyway thanks a lot for your comments
06:55TEttingerbordatoue:
06:55TEttinger(let [tst "< one two three" sp (clojure.string/split tst #"\s+")] ((fn [& args] (when (= (count args) (dec (count sp))) (eval (read-string (str "(" (first sp) " " (clojure.string/join " " args) ")"))))) 1 2 3))
06:55TEttingerit won't run here, eval is forbidden here
06:55TEttingerso in final form,
06:58TEttinger(defn fn-from-code [code] (let [sp (clojure.string/split code #"\s+")] (fn [& args] (when (= (count args) (dec (count sp))) (eval (read-string (str "(" (first sp) " " (clojure.string/join " " args) ")")))))))
06:58TEttingerit's a cheap hack, eval is frowned upon, but it avoids macros
07:01TEttingerbordatoue, you there?
07:08chillitomanyone here familiar with how to connect LightTable's REPL to a remote service?
07:08clojurebotGabh mo leithscéal?
07:16dublindanHey, does anyone know how I can connect to an nREPL running on amazon ec2? I'm using vim-fireplace and I tried to port forward to ec2 using ssh but vim-fireplace seems to crash when I try to evaluate any code
07:18bordatoueTEttinger, thanks , Sorry for the delay; I'm looking at it
07:18llasramdublindan: Try using the `lein repl` nREPL client
07:18llasram(just for testing, at least)
07:24dublindanllasram: good idea, I'll give it a try
07:26sm0kewhy vectors are not seq, but still have rest/first defined? ##(if (not (seq? [1 2 3])) (rest [1 2 3]))
07:27sm0ke,(print :all-ok?)
07:27clojurebot:all-ok?
07:27bordatoueTEttinger, wow, great. I need to study it. It works with numbers,
07:27sm0ke,(if (not (seq? [1 2 3])) (rest [1 2 3]))
07:27clojurebot(2 3)
07:28sm0kehmm i guesshmm i guess first/rest works on everything
07:29sm0keweird typo
07:30llasramsm0ke: Because those functions work on things which are `Seqable`, not just directly `ISeq`s
07:31llasramWell, really anything on which `seq` can be called, which is broader than just things implementing `Seqable`
07:32sm0kewhats protocol?
07:33llasramThe things defined by `defprotocol`?
07:33sm0keit looks to me a bunch of declarations
07:34sm0kewhats that used for
07:34sm0keaha interfaces of clojure world
07:35sm0keodd though..considering that clojure isnt oo
07:35llasramKind of. The ability to extend them to existing types makes them rather more powerful, while the ability to `reify` anonymous implementations gives them some different use cases from multimethods
07:55sm0kewhy is cons on vector linear time?
07:55llasramsm0ke: What do you mean? `cons` is constant time
07:55sm0kellasram: for lists not vectors
07:56llasramNo -- period
07:56Bronsacons is the same for lists and vectors and every other data structure
07:56TEttingerbordatoue, it will fail on strings due to how it constructs the code for eval -- ((fn-from-code "clojure.string/join a b") " " ["whee" "hooray"]) fails
07:56sm0kewow really
07:57sm0keso clojure vector is a finger tree internally?
07:57TEttingeryou might be thinking of conj
07:57sm0keconj is constant time operation of vectors also right then?
07:58sm0kei can both append and prepend in constant time to a vector?
07:58llasramconj for vectors is O(log32(n))
07:58sm0kellasram: OK i know little that clojure data structures are internally tree.so for some time assume logs are near constant
07:59Bronsasm0ke: cons returns a Cons, not the original data-structure
07:59llasramsm0ke: But `cons` on a vector doesn't return a vector -- it returns a Cons.
07:59llasramBronsa: jinx!
07:59Bronsahah
07:59sm0keso is doing a (vector) on Cons constly?
08:00sm0kecostly*
08:00sm0kelol i coined a new term *constly*
08:00llasramThat actually is linear time
08:01sm0kewhy is that?
08:02sm0kei mean which tree operation take linear time?
08:02sm0kegiven its balanced
08:02sm0kemost probly clojure must be using rb trees
08:02llasramNone. Turning a Cons or general seq into a vector is linear time because Conses and general seqs are essentially singly-linked listeds
08:03llasramSo you need to traverse the entire list in linear time to turn it into a vector
08:04sm0keaha ok cons..a head and a tail..essentially a linked list
08:04llasramExactly
08:05sm0kethanks
08:11nickZuryHow does Shen Compare to Clojure?
08:12nickZuryAnybody used shen?
08:13nickZury?
08:13llasramnickZury: I glanced at it, but the licensing seemed so crazy that I didn't get far
08:14nickZuryhmmm..
08:14sm0kei knew it..i was not the only one..look at Java dislikes https://news.ycombinator.com/item?id=6527104
08:15nickZuryAnd one more question - How about R7RS-large?
08:18nickZury?
08:20TEttingernickZury, clojure is a lot more mature than Shen. it also has an actual development community to answer questions...
08:20TEttingerI don't know about scheme versions
08:21TEttingerclojure can leverage the JVM and all the libs on it, which is a huge benefit
08:26nickZuryTEttinger: It is said that R7RS-large is larger than Common Lisp, targetted for practical programming...
08:27TEttingerclojure's large enough that I haven't explored all the core features in about a year of usage. I wouldn't worry about that.
08:28TEttingerI still can definitely get by without macros...
08:28TEttingerclojure's pretty much become my go-to scripting language when I need to manipulate data
08:28TEttingeror all sorts of things
08:29TEttingerI have a bitmap font maker (takes a TTF, produces a PNG) in clojure, using java's font API
08:30AimHereI was going to say that clojure is annoying to make standalone scripts with, but it'd be less annoying than Java
08:30TEttingerI sometimes use the REPL and just paste in the script
08:31AimHereYeah. Just stay in the repl. Sod the rest of the world.
08:38`cbpnever turn off omacs never have to restart repl :-)
08:57hungryblankhi, I took a tar.gz of /var/lib one of my production nodes and try to restore on my local machine
08:57llasramCool story, bro
08:57hungryblankfeels liek i'm close to done but getting a bunch of not allocating, number_of_allocated_shards_found [1], required_number [2]
08:58llasramhungryblank: You may not be in the channel you think
08:58clojurebotHuh?
08:58hungryblankoh
08:58hungryblanksorry.
08:58llasramnp :-)
08:58llasramHappens to us all
09:07sm0ke,(conjuring)
09:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: conjuring in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:07sm0kehaha now thats some horror
10:04john2xhow would I design an API wrapper function, which takes a session object (in addition to whatever params the API takes). But the session expires after some time, so I made the wrapper function automatically retry the call with a new session. What's an idiomatic way to return the new session? [session response]? {:session session :rest :of :the :response}?
10:05john2xbut then every time the function is used, I'll have to deal with the returned session. Which sounds like a mess. Would a dynamic var for session be ok?
10:06weavejester_Does anyone happen to know of any talks or quotes on reliability in programming?
10:07weavejester_I'm looking for something that relates constraints, like types, immutability, etc, with reliability/correctness.
10:11jcromartie_Is it good practice to name Clojure namespaces after Java package conventions? But it seems kind of unclojurely to have namespaces like org.whatever.division.subproject.api.core
10:11jcromartie_also, "unclojurely" needs to become a thing
10:13jcromartie_drat, it's already been coined http://www.coderanch.com/t/546519/clojure/Exceptions-Clojure
10:14AimHereUnidiomatic tends to be the word that's used anyways
10:14gfredericksSo leiningen merges data_readers.clj now? does that mean it's okay for libs to have them?
10:15llasramI'm never sure why people would have said it wasn't okay for libs to have them, since Clojure will find and merge all instances of it on the classpath
10:16pjstadigllasram: true, but i think the problem is uberjars
10:16llasramWell, in 1.5+ at least -- 1.4 had that bug where duplicates would "conflict" even if they had the same value
10:16llasrampjstadig: Yeah, but you would need to provide you own in that case prior to lein 2.3.3 anyway, which would completely override any libarry-provided ones
10:17echo-areaAdding a directory into class path results in this error: http://pastebin.com/AYqzXy6Q
10:17echo-areaWhat could be the reason?
10:18echo-area(The error is "java.lang.IllegalArgumentException: No matching method: meta")
10:18echo-areaRemoving that directory then java could start run
10:18echo-areaThat directory contains only a single .class file
10:21gfredericksokay I am now pro libs-with-data-readers-file
10:22gfredericksllasram: what is reproducibility wrt user.clj?
10:23stuartsierraLatest commits on nrepl.el (after 0.2.0) break nrepl-jack-in for me.
10:23llasramgfredericks: You might end up with code which only works with particular things in your personal `user.clj`?
10:24gfredericksllasram: I'm not talking about a personal user.clj; in this case it'd be lib-specific
10:24llasramAh
10:24llasramHmm.
10:24gfredericksmy assumption was that pjstadig was using data_readers.clj _just_ for the evaluation, not for an actual data reader
10:24llasramRight.
10:24llasramCan you have multiple user.clj's though?
10:24pjstadigno
10:24gfrederickswell you could merge with file concatenation :P
10:25gfredericksI guess that breaks when _not_ uberjaring
10:25llasramYeah
10:25pjstadigclojure only finds one user.clj on the classpath and evaluates it, so it doesn't compose
10:25pjstadigdata_readers for my purposes at least composes (except for uber jars or lein trying to merge them)
10:25gfredericksso if that were "fixed", would we all switch our signs to be pro libs-with-user-files?
10:26llasramMy personal curmudgeon looks with suspicion upon automatic code-loading
10:26gfredericks(i.e., if clojure eval'd all of them; or alternately evaled all #"user-\d+.clj" in alphabetical order)
10:26llasramI'd need to contemplate the state my own sign :-)
10:27pjstadigi don't think i'd be in favor of such a thing
10:27stuartsierraNo one should ever put user.clj in a library release.
10:27gfredericksstuartsierra: the reasoning behind that statement is what I'm trying to uncover
10:27stuartsierraIt's called "user.clj" for a reason. :P
10:28stuartsierraIf I'm using your library, I do not want you to mess with my development environment.
10:28stuartsierraEver.
10:29gfredericksstuartsierra: well in this case we're talking about a library whose sole purpose is to do that
10:29gfredericksso there shouldn't be any surprises
10:29stuartsierragfredericks: Oh, I missed that bit of the discussion. But why would you ever want to do that?
10:29gfrederickspjstadig: I'm now confused about what this is accomplishing exactly -- you're deffing some vars in what namespace?
10:30pjstadiggfredericks: it drops vars into the clojure.core namespace during the data_reader initialization phase, by the time you come out of that, the vars from the pjstadig.scope namespace are magically available everywhere by virtue of the fact that they have been inserted into clojure.core
10:31pjstadigit's basically a monkey patch of clojure.core
10:31stuartsierraAck!
10:31pjstadighehe
10:31gfredericksah right; not sure how I doubted that.
10:32pjstadigit's optional, you have to depend on the scopes-magic artifact
10:32bordatoueis there a way to use doseq and maintain state , for example i want to iterate over a seq and store it in a vector , then when the iteration is completed return the vector
10:32gfrederickspjstadig: is there some reason I'm missing why people would get tired of requiring the scopes functions/macros but not other libs?
10:32pjstadigotherwise you just require and use pjstadig.scopes like you would anything else
10:32gfredericksi.e., is scopes special in some way?
10:32stuartsierrabordatoue: Use `reduce`
10:33pjstadiggfredericks: erm, not particularly, it's a generalization of with-open which is in clojure.core
10:34pjstadigthe point is it does scopes
10:34gfrederickspjstadig: okay; I think I will erect my sign to be "against" this. The only use I can imagine is an alternative to the ns macro
10:34pjstadigscope-magic is just a distraction
10:35pjstadiggfredericks: that's why its a separate and optional dependency :) don't use it if you're against it
10:37bordatouestuartsierra: thanks, but when using reduce and map is there a way I can be the variables within the fn visible. basically if I have a fn (fn [a] (do something a) (get my-map a)) ; here how can i make my-map visible within the fn, without making it global
10:37gfrederickspjstadig: indeed; I'm curious about scopes proper. I've scanned the readme a couple times and haven't yet wrapped my head around what problem it's solving
10:37pjstadiggfredericks: does this help at all? https://groups.google.com/d/msg/clojure/qPUd3AEVxT8/W2_FaCyjj_wJ
10:38gfredericksbordatoue: the function takes two args
10:39gfrederickspjstadig: these concepts take concentration
10:39mdrogalistbaldridge: I read the Eff paper. Pretty neat stuff.
10:39mdrogalisReally similar to where I landed.
10:41tbaldridgemdrogalis: yeah, it's cool stuff, I'm interested in seeing where it can be taken in more mainstream languages.
10:42bordatouegfredericks: says its a map, with a fn (map (fn[x] (get my-map x)) [1 2 3]) I want to make my-map visible in the annonymous fn with argument x, is it possible ?
10:42mdrogalisI got lost in the second half, but the first half about effects made a lot of sense.
10:43tbaldridgemdrogalis: yeah, it takes awhile to digest. :-)
10:44mdrogalistbaldridge: Still digesting deep walking macros. :P
10:51gfredericksbordatoue: ##(reduce (fn [my-map x] (print x) (assoc my-map x x)) {} [1 2 3])
10:51gfredericks,(reduce (fn [my-map x] (print x) (assoc my-map x x)) {} [1 2 3])
10:51clojurebot123{3 3, 2 2, 1 1}
10:51gfredericksbordatoue: your code examples aren't making much sense to me compared to your original question, but ^ that's an example use of reduce
10:51gfrederickswith side effects
10:52gfredericks,(reduce (fn [v x] (print x) (conj v x)) ["things i printed:"] [4 5 6])
10:52clojurebot456["things i printed:" 4 5 6]
10:55bordatouegfredericks: I wanted to know if I could increase the scope of a variable definied in fn within map or reduce ; (map (fn [x] (get my-map x)) [1 2 3]) ; in this example I want to make the scope of my-map visible in the annonymous function, without passing it as an agrument
10:57pjstadigbordatoue: the function passed to map is a closure so you can do something like (let [my-map {}] (map (fn [x] (get my-map x)) [1 2 3]))
10:58bordatouepjstadig: Thanks very much
11:10gfrederickspjstadig: will this make dealing with streaming database results less callbacky?
11:11pjstadiggfredericks: not sure what you mean by callbacky
11:12gfrederickse.g., with latest java.jdbc I must pass in a :result-set-fn to query
11:12gfredericksall javascripty asyncy style
11:12gfredericksso that it knows when it can close the result set
11:12gfrederickssame as old API (with-query-results) except that was macro-based
11:14CapnLexiiI have a question about interop best practices. It's technically a cljs project, but the question is fundamentally the same for clj or guile or what have you
11:14mdrogalisFire away, CapnLexii
11:15CapnLexiiThe question is: for working with various libraries/APIs that require side-effectful function calls (in this case, WebGL), the way one handles such a situation in the native language (in this case JS) is to create a set of "init" functions that perform these stateful API calls
11:15CapnLexiiit feels very icky to define analogous functions in clj
11:15CapnLexiiBut at the same time, you don't want to have all those api calls sitting around at the top level when they could be hidden away
11:15llasrampjstadig: Would you be open to a PR which made `scopes` work in terms of a protocol which is by default implemented for `Closeable` and `AutoCloseable`-when-available?
11:16mdrogalisCapnLexii: It depends on how you handle this, but you're not going to escape side-effects.
11:16pjstadigllasram: sure
11:16mdrogalisIt's just a reality, regardless of language.
11:16CapnLexiimdrogalis: Certainly not
11:17pjstadiggfredericks: i guess i don't know enough about the latest changes in java.jdbc to comment
11:17mdrogalisCapnLexii: That being said, I try to handle it on a case-by-case basis.
11:17gfrederickspjstadig: same question for the classic version
11:17mdrogalisFor example, I have a Cljs project where I need to open a websocket. I just do it in an init function. *Shrug*
11:18CapnLexiimdrogalis: Aha, I see. I'm trying to make a cljs WebGL library a la Three.js, so I also have to worry about what the user experience is like
11:19llasrampjstadig: Oh, hmm, uses other Java 7 features
11:19mdrogalisCapnLexii: Understandable. What concerns you?
11:19CapnLexiiIt doesn't seem to write to give other clojurians functions to call that don't return anything; but, I wouldn't know where else to put the init code
11:19mdrogalisCapnLexii: println? :)
11:19mdrogalisAlways returns nil.
11:20mdrogalisMake it obvious with an exclamation point. init!
11:20CapnLexiimdrogalis: Haha fair enough. I like the bang idea.
11:20coventry2mdrogalis, tbaldridge: What is the eff paper?
11:21mdrogaliscoventry2: http://math.andrej.com/wp-content/uploads/2012/03/eff.pdf
11:22mdrogalisLanguage around algebraic side effects. It
11:22mdrogalis's interesting*
11:22tbaldridgecoventry2: it's a way of getting all the good parts of monads, without all the bad parts :-)
11:22pjstadiggfredericks: in the case of with-query-results it does three things: create a resource, bind a name in a lexical scope, and manage a resource (i.e. close it when you're "done" where "done" means you exit the dynamic scope of the with-query-results).
11:23coventry2Thanks, guys.
11:23mdrogalisIf a monad had a physical representation, tbaldridge would have a picture of it on a dart board.
11:23pjstadiggfredericks: with scopes you would manage a resource using with-resource-scope and you would register a resource for management using scoped! (within the dynamic extent of a with-resource-scope) and those can be in separate places (lexically speaking)
11:24tbaldridgemdrogalis: I'm not that anti-monad. They're actually pretty cool in languages like haskell.
11:25mdrogalisHeh, alright. I recall some 'rid the world of monads' talk a few weeks ago. :)
11:30pjstadigthere's (i think) an analagous concept in memory management called region based memory management
12:13gfrederickspjstadig: I believe this would help; at least if we patch java.jdbc to allow returning a lazy seq and a close function
12:13gfrederickspjstadig: so if I'm running a ring server, I'd stick with-resource-scope in my middleware and then just register resources willy-nilly?
12:15dnoleneric_normand: btw, your patch, did you actually change the api at all?
12:15jcromartie_defmutli ...
12:15jcromartie_http://upload.wikimedia.org/wikipedia/en/2/21/Muttley-picture.gif
12:15muhoohas anyone gotten pedestal and friend to play togethr nicely?
12:16pjstadiggfredericks: you'd want to create scopes with reasonable extent; one way to do that might be to create a scope for each request if you're building a server type application
12:16pjstadiggfredericks: you could also use scopes (in addition to closing files) to delete temporary files that are created as a part of processing a request
12:16eric_normanddnolen: hmm, I don't think so
12:17eric_normanddnolen: what do you mean by "the api"?
12:17gfrederickspjstadig: "create a scope for each request" is what I was suggesting by middleware I think
12:17pjstadigyeah
12:17dnoleneric_normand: like did you actually change what a function takes and returns?
12:17eric_normanddnolen: yes
12:17gfrederickspjstadig: oh there's still the problem of inputstreams and ring
12:17stuartsierramuhoo: Chas Emerick and Gabriel Horner recently did some work on Friend & Pedestal.
12:17stuartsierraI don't know the details.
12:18dnoleneric_normand: is it possible to get the desired behavior w/o doing that?
12:18mdrogalisstuartsierra: Did you end up hurdling over your Lamina problem?
12:18eric_normanddnolen: yes
12:18muhoostuartsierra: thanks
12:18dnoleneric_normand: lets do that instead and I'll apply it
12:18eric_normanddnolen: give me a few minutes
12:18stuartsierramdrogalis: Yes, by updating to latest version.
12:18dnoleneric_normand: thanks
12:19mdrogalisstuartsierra: Good to know.
12:19gfrederickspjstadig: with some sort of request-closed callback wrt ring this could be super slick
12:29muhooupdate: it looks like friend as of about 4 months ago 0.2.0 supports pedestal
12:36dnolenjonasen: could we add tools.macro to list of cljsfiddle libs?
12:36jonasendnolen: does it support clojurescript? I didn't know that
12:36dnolenjonasen: it's just a macro lib, works great
12:38jonasendnolen: I'll add it then :) I'll test the new cljs release when it reaches maven central and then I'll push a new version
12:38dnolenjonasen: 1934 already landed in maven central
12:38muhooam i the only one who finds the convention of side-effecting function naming so! freakin! alarming! ?
12:38jonasengreat
12:40technomancyside effects are srsbsns
12:44muhoohmm,, i guess making the names annoying to read is one way to discourage their use
12:44Foxboronside effects can burn down your house.
12:44Foxboronor does it? You will never know.
12:47rasmustoprogramming with side effects is fn!
12:51eric_normanddnolen: a little update: I am having trouble compiling source maps using a clean master!
12:51dnoleneric_normand: what's the problem?
12:52eric_normanddnolen: null pointer exception
12:52dnoleneric_normand: file and line number?
12:52eric_normandclosure.clj:729 cljs.closure/optimize[fn]
12:53dnoleneric_normand: I think you have the wrong version of ClojureScript, if you look at closure.clj on master, not possible
12:54eric_normanddnolen: I am starting over from a fresh master again. one sec
12:55dnoleneric_normand: I just tried core.async with 1934, works for me.
12:55eric_normanddnolen: is there a particular level of optimization I have to use?
12:56dnoleneric_normand: whitespace, simple, advanced
12:56dnoleneric_normand: we don't support source maps for any other level yet
12:56dnolenheh, which is just :none
12:56eric_normanddnolen: trying with advanced now
12:56eric_normanddnolen: ok, worked with advanced
12:56eric_normanddnolen: now I will try my patch
12:56dnoleneric_normand: what did you try :simple?
12:57eric_normanddnolen: before I had nothing set for :optimizations
12:57dnoleneric_normand: oh yeah ok, that won't work
13:00eric_normanddnolen: cool, it works!
13:00eric_normanddnolen: shows up in chrome
13:01eric_normanddnolen: I have attached another patch to the issue
13:02eric_normanddnolen: http://dev.clojure.org/jira/browse/CLJS-591
13:03eric_normanddnolen: thanks for the help; let me know if you need anything
13:06dnoleneric_normand: could not apply that patch with git am
13:07dnoleneric_normand: better for the patch to have attribution, and commit message w/ ticket number etc.
13:07dnoleneric_normand: I refer to this http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
13:11eric_normanddnolen: I attached another patch
13:11eric_normanddnolen: using the guidelines from the post you linked to
13:12eric_normanddnolen: source-map2.patch
13:25dnoleneric_normand: applied to master thanks
13:26eric_normanddnolen: you're welcome
13:32bitemyapprkneufeld: haha, CA strikes back!
13:39justin_smithmuhoo: if it has side effects that are more serious, any number of ! tokens should be added to the name, for the super serious, throw in some 1 too: (format-hard-drive!!!11!!11!)
13:39mtphow about some leading underscores while we're at it
13:40justin_smithhmm, _ indicates "this has to be there for implementation reasons" right? so the number of _ before the symbol should indicate how low it is on the implementation stack
13:40mtp_____format-hard-drive!!!!one!
13:42justin_smith(.var ____RT "clojure.core" "___*allow-unresovled-vars*")
13:43justin_smithor maybe that should have been ____RT/var
13:44jonasendnolen: http://cljsfiddle.net/fiddle/jonase.tools-macro-test
14:05rkneufeldbitemyapp: Yeah I was none too pleased about that. The upside is everyone gets a hard-copy of the book
14:08bitemyapprkneufeld: also was filename ".license_assignments/.md" a typo? is my name supposed to come before the .md?
14:08rkneufeldbitemyapp: probably was supposed to be <your-github-handle>.md or the like.
14:09bitemyappgotcha. Thanks.
14:34muhoojustin_smith: what is this, the linux kernel?
14:43gfredericksso if you have a pretty vanilla clojure lib that is not really sensitive to clojure versioning, is it important what's listed in the project.clj? e.g., if it currently says 1.3, is there much accomplished by switching it to 1.5?
14:44technomancygfredericks: I'm tempted to suggest leaving it out entirely
14:44technomancybut I haven't really thought through the implications
14:47gfrederickstechnomancy: that approach would make it a lot easier to use a forked clojure?
14:47technomancyif everyone did it, sure
14:48gfredericksso currently if I want to use [com.gfredericks/clojure "1.5.1-NIFTY"], I can suppress org.clojure/clojure in my project.clj and that's the way to do it?
14:48bitemyapp"1.5.1-GENETICALLY-SUPERIOR-BRO"
14:49technomancypractically speaking you need a top-level exclusion currently
14:49bitemyappgfredericks: ^^ spooky
14:49gfredericks[com.gfredericks/lava "1.5.1"]
14:49technomancybut if only a few libs depend on clojure then you could use scattered targeted exclusions
14:49technomancyheh
14:49technomancy"1.5.1-COLLECTORS-EDITION"
14:50bitemyappI kinda hate that the only message he saw was me being stupid -_-'
14:50hiredmancut a limited edition, delete it from clojars tomorrow
14:50bitemyappif he saw anything
14:52gfrederickshiredman: we all get to run our apps on it for a day just for the thrill of it, then backgrade
14:52mdrogalisbitemyapp: Ahahahah.
14:52bitemyappseangrov1: I'm cutting a Korma release soon, any requests before I do so?
14:52bitemyappseangrov1: the release will include your PR that I merged.
14:52mdrogalisAh, that was a good laugh.
14:52hiredmangfredericks: have it popup a dialog asking for an activation key
14:52bitemyappmdrogalis: I'm glad you enjoy my shame.
14:53mdrogalisbitemyapp: Someone has to. Can't let it go to waste.
14:53bitemyappThe Ecology of Embarrassment
14:55mdrogalisMan, its been raining all week. x.x
14:58bitemyappmdrogalis: 60F and slightly overcast here.
14:58bitemyappIt doesn't really rain much in this area.
14:58mdrogalisSF, IIRC?
14:58bitemyappmdrogalis: yeah
14:58mdrogalisFun place.
14:59bitemyappI don't really experience that side of it. I'd like to some day.
14:59bitemyappI actually really don't like living here and am waiting for my first opportunity to leave.
14:59bitemyappWhich seems a waste, but I don't really know what I'm supposed to enjoy about SF.
15:00bitemyappOther than the career opportunities.
15:00bitemyappAnd cool programmers/startup people.
15:00mdrogalisbitemyapp: Definitely not for everyone, nothing wrong with that.
15:00mdrogalisWhere do you want to be?
15:00coventry_A Dirty Job_ made it *sound* nice.
15:01bitemyappmdrogalis: I miss the nice people back home in Ohio, but I'd rather not live in Ohio. I've heard good things about Austin. I'm going to stay in SF for quite awhile though. Possibly the next decade.
15:01mdrogalisbitemyapp: That's a long time to spend in a city you don't like.
15:02bitemyappmdrogalis: I don't make my decisions in a way that is heavily weighted by comfort or contentment.
15:02mdrogalisTo each his own.
15:02technomancybitemyapp: I thought you were coming up north
15:03bitemyapptechnomancy: I'm considering Portland and Seattle alongside Austin.
15:03technomancynice
15:03bitemyappIf for no other reason than that I don't like heat.
15:03bitemyappand I really like forests.
15:04bitemyappmdrogalis: part of the reason I'm staying in SF for now is that I work at a rather exceptional company and they're bay area only at the moment.
15:05technomancyyeah, I felt like a broken record saying "wow, it's so green" every half hour or so when I first moved up here
15:05mdrogalisbitemyapp: Ping pong table on the roof?
15:05xeqiheat vs rain
15:07bitemyappxeqi: I'm okay with rain.
15:07bitemyappmdrogalis: very self-directed environment. I have no boss.
15:08mercwithamouth,(def foo[22 [747, 1]) (nth (last foo) 1)
15:08clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
15:08mercwithamouth,(def foo[22 [747, 1]) (nth (last foo) 1))
15:08clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
15:08mercwithamouth,(def foo[22 [747, 1]]) (nth (last foo) 1))
15:08clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
15:08mdrogalisbitemyapp: Very easy to stick it to the man then.
15:09mercwithamouthhrmm how do you handle multiple lines/levels with the bot?
15:09yeoj___I have a sequence of dictionaries with one entry.... what's an efficient way to make a sequence with just that one dictionary value? I was looking at seq to make a vector, then taking only even elements... but has to be a better way?
15:10cmajor7need to test several http endpoinds. I'd like to do it with clj-http and clojure.test. the question is about a fixture that needs to start/stop "ring server" around these tests. what is a recommended way of doing that? (in a fixture). everything is read only, so I only need this :once for all the tests.
15:12coventryyeoj___: ,(map #(get % :t) [{:t 1} {:t 2}])
15:12xeqicmajor71: https://github.com/ato/clojars-web/blob/master/test/clojars/test/integration/uploads.clj#L17 or https://github.com/cemerick/friend/blob/master/test/test_friend/functional.clj#L11
15:12clojurebotExcuse me?
15:12coventry,(map #(get % :t) [{:t 1} {:t 2}])
15:12clojurebot(1 2)
15:13yeoj___coventry: thank you
15:13yeoj___clojurebot: thanks little buddy.
15:13clojurebotCool story bro.
15:13xeqimercwithamouth: can you make it a let?
15:13coventryyeoj___: Or ##(map :t [{:t 1} {:t 2}]) if it's a kw.
15:13devthamalloy: i thought flatland/useful had a fn that throttled calls, queuing them and calling at a specified frequency (e.g. to prevent excess floods when sending messages to irc). was i mistaken? i realize rate-limited is not it.
15:13cmajor71xeqi: hit the spot :) thx. looks like it can be a gist/clojure.test macro, since I can't think it is so rare.. ?
15:14dnolenjonasen: awesome thanks
15:14dobry-dencmajor71: testing is common? ;)
15:15cmajor71dobry-den: I'd like to believe it is.. and if this macro is in, it'll enforce faith
15:15amalloyare you thinking of flatland.useful.state/periodic-recompute, devth?
15:16jonasendnolen: I've never used tools.macro so I don't know if the example even makes sense..
15:16amalloywe definitely don't have one that queues up calls
15:17amalloybut i think https://github.com/jkk/rate-gate is that
15:17devthamalloy: ah ok. i haven't used periodic-recompute but looks interesting
15:17devthoh sweet. i'll check that out.
15:17devthamalloy: thanks
15:18devthmy irc bot keeps getting excess flood kicked
15:20dnolenjonasen: heh yeah, I used symbol-macrolet so I can use _ for (var)
15:20dnolenin core.logic
15:21bitemyappdevth: devn?
15:21bitemyappbut with a weird lisp?
15:22devthbitemyapp: nope :)
15:22bitemyappso many dev* *_*
15:32dobry-denNo matter what I do, nrepl-load-current-buffer (C-c C-k) always displays the Exception in the minibuffer: https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/-4cqzq0i.png
15:32dobry-denIsn't (setq nrepl-popup-stacktraces t) supposed to change that behavior?
15:33dobry-denThe minibuffer is the ideal place to show an exception, but it's not very useful since it doesn't show the linenumber in your source
15:50mlb-Is there a Haskell-like "swap" method in clojure?
15:51Raynesmlb-: What does swap do? Are you talking about Data.Tuple.swap?
15:51mlb-yes
15:51RaynesWell, we don't really have tuples.
15:52RaynesSo unless you've somehow got actual tuples, you can just call reverse on a two element sequential data structure.
15:52mlb-hmm, maybe I'm thinking of the wrong method then,
15:53Rayneshttp://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Tuple.html
15:53Raynesmlb-: Swap just swaps the elements of a pair.
15:53mlb-What I want is a function that takes a function(a, b, ...) and returns a function(b, a, ...)
15:54amalloyyou mean "flip", i think
15:54justin_smithflip?
15:54amalloywhich is a haskell function that does that, but has no equivalent built into clojure
15:54RaynesIndeed.
15:55mlb-Ah, yes. Exactly. I'm sorry, it's been a while since I've used Haskell
15:55AimHereYou could roll your own oneliner that did the job though
15:55amalloyi wrote a library called hot-potato many years ago which was basically generalized flip. i don't really recommend using it, partly because i was so new when i wrote it, but it might be fun to study
15:55mlb-that's fine. I was just hoping for a way to compose functions to reduce the amount of anonymous functions =]
16:02seangroveI keep asking this, but can never quite seem to get it right - my compojure app is giving 500 errors, but I don't see any stack traces in the output, or in the *nrepl-server* buffer
16:04seangroveWhenever running a compojure app via nrepl.el, how can I get a stacktrace output in the *nrepl-server* buffer on a 500 error?
16:05bitemyappseangrove: hey sorry to bug you, did you see what I said about Korma?
16:06seangrovebitemyapp: I don't think so no, what was it?
16:06bitemyappseangrove: I'm cutting a release that includes your PR soon, any requests before I do so?
16:06seangroveNothing that comes to mind
16:06justin_smithseangrove: I have wondered about maybe using somthing like timbre to make sure output goes to a reliable place when combining nrepl and threads
16:06seangroveWhat's the state of/plan for korma.incubator?
16:07bitemyappI use timbre and am mostly happy with it but the exception logging breaks with an NPE sometimes.
16:07bitemyappseangrove: I don't have any specific plans for it myself, I'm open to stealing things from incubator into Korma main if somebody's willing to speak up and say they want something and that it works for them.
16:08bitemyappcomponentization is another thing on my mind.
16:08justin_smithbitemyapp: ugh, good to know before I go too far with that route, thanks
16:08bitemyappjustin_smith: you just want to be careful when you use the (t/error ex "blah") thingy
16:09bitemyappI also find timbre's code a bit...disconcerting.
16:09bitemyappthe indirection is not very contribution friendly.
16:09bitemyappI need to submit a PR for that NPE
16:10bitemyappthey're doing something that really upsets clj-stacktrace (I guess clj-stacktrace should technically be considered to be at fault?)
16:11bitemyappI ended up writing my own exception logging middleware that uses clojure.stacktrace instead of clj-stacktrace and it hasn't broken yet.
16:11bitemyappjustin_smith: ^^ if that helps.
16:11justin_smithbitemyapp: interesting, thanks
16:12bitemyapptechnomancy: are you maintaining clj-stacktrace?
16:12justin_smithI think the real fix may just be a more thread-safe output redirection fornrepl, instead of having to use a full fledged logger just to get printouts
16:12technomancybitemyapp: no =(
16:12bitemyappjustin_smith: no doubt. All this stuff is just from my Clojure/Datomic/Ring/Compojure stuff.
16:13bitemyapptechnomancy: what's going on with clj-stacktrace? last commit was you.
16:13bitemyappI need to know if this is damage to route around or if it should be fixed and maintained.
16:13technomancybitemyapp: Chouser gave a talk about a new better stacktrace lib he was going to release, so I quit hacking on it and waited for the release
16:14technomancythis was like 18 months ago?
16:14bitemyapp :|
16:14bitemyappI take it I'm the only one that was fine with clojure.stacktrace? :P
16:15technomancyclj-stacktrace works fine for me; I was just going to add filtering out of compiler gunk and other fine-tuning
16:15technomancybut I started using clj-stacktrace backw when clojure.stacktrace was much worse
16:16bitemyapptechnomancy: I bugged chouser on the twatters.
16:16technomancyI don't remember what it's like now, but having color and justification is really great
16:16bitemyapptechnomancy: well like I said above, with t/error logging in Timbre some Exception instances will make clj-stacktrace throw an NPE and barf.
16:17technomancyhuh.
16:17bitemyappThis is, as you might imagine, unacceptable for something that's supposed to managing my logging.
16:17technomancyoh crap; there's an open PR I missed
16:17technomancybitemyapp: can you see if this fixes your issue? https://github.com/mmcgrana/clj-stacktrace/pull/27
16:17technomancyI can cut a release if so
16:18bitemyappI'll see if I can put a project repro together on the weekend. Have to finish this migration stuff.
16:19coventryThat's a coincidence, I was just watching chouser's longbottom talk today, and wondering where it is.
16:21coventryWhy doesn't clojure.lang.PersistentVector$ChunkedSeq implement IPersistentList (so that (list?) would return true?)
16:23dnolenfun, fun http://cljsfiddle.net/fiddle/swannodette.zebra
16:23technomancycoventry: don't use c.c/list?
16:23technomancyit's Not What You Want
16:23technomancyprobably coll?
16:23seangroveTiny
16:24technomancylist? returns false on many things that are lists
16:24coventrytechnomancy: clojure.test-clojure.compilation uses it, and my walked/transformed clojure.core breaks that test.
16:24bitemyapptechnomancy: what's the URL to that diagram of which collections return what against different types?
16:25coventrytechnomancy: But thanks for the advice, didn't know that.
16:25technomancybitemyapp: the one about defrecords and stuff?
16:25bitemyappurrrrghhh it was some crazy-old looking page but it had examples of what each type would return for sequence?, list? etc.
16:25llasrambitemyapp: It was one of cemerick's
16:25technomancylist? should never have been added =\
16:25bitemyappllasram: link?
16:25llasrambitemyapp: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
16:25llasramThat guy?
16:26llasramOh, no
16:26bitemyappno, not that.
16:26llasramSorry, not paying enough attention
16:26bitemyappsequence?, list? truth tables for different Clojure coll types.
16:26bitemyappt'was a table, was a crazy old looking page
16:27llasramRemember when people used to "bookmark" things?
16:27bitemyapphttp://www.brainonfire.net/files/seqs-and-colls/main.html
16:27bitemyapp^^ that!
16:27bitemyappcoventry: ^^
16:27seangrovetechnomancy: I agree
16:28technomancybitemyapp: quick teach it to clojurebot so we'll be able to find it again
16:28seangrovetechnomancy?
16:28clojurebottechnomancy is always one step ahead of me
16:28coventrybitemyapp: Thanks.
16:28seangroveHeh, prescience
16:28bitemyapptechnomancy: I always forget the syntax.
16:29bitemyappclojurebot: colls is http://www.brainonfire.net/files/seqs-and-colls/main.html
16:29clojurebotIn Ordnung
16:29bitemyapp~colls
16:29clojurebotcolls is http://www.brainonfire.net/files/seqs-and-colls/main.html
16:29jonasendnolen: Cool, the only thing's missing is the cljs port of bblooms fipp so the output would line up nicely :)
16:29jonasenbbloom: ^
16:29dnolenjonasen: heh yes
16:31bbloomjonasen: for what exactly?
16:32jonasenbbloom: http://cljsfiddle.net/fiddle/swannodette.zebra
16:32bbloomah cool
16:32bbloomany idea what the state of the rrb stuff is?
16:34jonasenbbloom: I don't think there has been any changes to the library
16:34jonasenlately
16:34bitemyapp,(type (list* 1 2 3 4 '()))
16:34clojurebotclojure.lang.Cons
16:34bbloombitemyapp: lol yeah, that made me face palm too
16:34bitemyappcoventry: ^^ I take it this is what's draining your sanity lately?
16:35coventrybitemyapp: See the issues lists for riddley and sleight. :-)
16:35dnolenbbloom: last I heard it basically works
16:36bitemyappcoventry: you're contributing to ztellman libraries? You're braver than I thought.
16:36bitemyappbbloom: I don't have a strong opinion about the cons cell / PersistentList dichotomy.
16:36bbloombitemyapp: i didn't for a while. now i have a lot to say about data encapsulation: a topic clojure doesn't tackle too much. but that rant is still brewing
16:36bitemyappthere was no difference in CL unless somebody was doing something strange, but the difference hasn't truly bitten me.
16:36bitemyappYet
16:37bitemyappbbloom: it's a rant I'd like to hear, I'd like to learn more about this and why it was done that way.
16:37bitemyappI wonder how hard it would be to convince rhickey to explain the Cons thing.
16:37bbloomi don't think there is much explaination
16:37bitemyappmaybe he wanted to bootstrap them independently of the persistent data structures?
16:37bbloomit's just legacy, afaict
16:38coventrybitemyapp: I now have code which can evaluate all of clojure.core and test-clojure into distinct namespaces and run the tests. I am trying to decide how hard to look at the test failures at the moment, as opposed to just getting on with using this wrapping code to write the debugger I started out intending to write.
16:38coventryThe failures probably do hide other errors in the wrapping code.
16:38coventrys/hide/expose/
16:39bbloomif i were to have a vote, all the "abstract" types would have a wrapper object that delegates to the underlying concrete type. so a List could contain an ArrayList (PersistentList) or a LinkedList (Cons)
16:39bblooma LinkedList and a PersistentList wouldn't be equal to each other, unless they were wrapped in a Lisp
16:39bbloomList* rather
16:39bbloomsimilarly for maps, vectors, etc
16:39bitemyapptechnomancy: chrishouser: @bitemyapp I'm afraid attempts to reduce clutter in stack traces are doomed to remove critical detail. What should we do instead?
16:39bitemyapptechnomancy: he's punting. We have work to do.
16:39bitemyappclj-stacktrace has to be maintained or replaced.
16:40technomancyyeah, obviously you can't hard-code the stack trace cleanup stuff
16:40bitemyappif it isn't, I have to convince pt-toomanyfuckingvowels-nis to replace clj-stacktrace with clojure.stacktrace in Timbre.
16:41bitemyapptechnomancy: I don't even really care about the clean-up, I just want my logger to not crash my application.
16:43technomancybitemyapp: I bet that pull will fix it tho
16:43technomancywill cut a release once you can confirm
16:44bitemyapptechnomancy: much appreciated. I'll try to get you an answer ASAP.
16:54technomancybitemyapp: the other problem is that "longbottom" (chouser's name) is a lot better than clj-stacktrace
16:57bitemyapptechnomancy: I agree. Uno momento.
17:08yeoj___if i have a function that is the value of a dictionary, how do i call it after i look it up? is that with apply?
17:08coventrybitemyapp, technomancy: Based on what he said in http://downloads.mostlylazy.com/episodes/mostly-lazy-006.mp3 (around minute 39) it sounds like he might be OK with someone taking it over.
17:08coventryyeoj___: ##(({:t inc} :t) 1)
17:09lazybot⇒ 2
17:09technomancycoventry: huh; I got the impression it was in legal limbo
17:09yeoj___ohh, that must be that ## thing i don't know about yet
17:09coventrytechnomancy: Maybe, but it sounds there very much like he just lost interest. I could be wrong.
17:09bitemyappcoventry: I asked him for the name directly.
17:10bitemyapptechnomancy: it sounded on Twitter like he lost interest to me too.
17:10technomancyprobably both
17:10bitemyapptechnomancy: What legal limbo?
17:10coventryyeoj___: No, the ## is syntax to tell lazybot to evaluate it and report the result here. (({:t inc} :t) 1) should work in the relp.
17:10technomancybitemyapp: needing to get approval for the OSSing process =\
17:11coventry,(({:t inc} :t) 1)
17:11clojurebot2
17:11yeoj___coventry: ok, thank you. i'll keep studying that then.
17:11bitemyapptechnomancy: from whom?
17:12technomancybitemyapp: originally lonocloud, now viasat I guess?
17:12technomancyacquisition complications
17:12bitemyappHum. Ick.
17:19sverihi, how can i check if something is a sequence?
17:19rasmusto,(some #{1 2 3} [4 5 6 7 1])
17:19clojurebot1
17:20llasramsveri: In what sense of "sequence"?
17:20coventrysveri: ##(sequential? '(1 2 3))
17:20lazybot⇒ true
17:20rasmustooops, I read an "in" that wasn't there, my mistake
17:20svericoventry: llasram what coventry wrote is what i am looking for
17:20sverithank you
17:24rasmusto##(sequential {:a 1 :b 2})
17:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: sequential in this context
17:24rasmusto##(sequential? {:a 1 :b 2})
17:24lazybot⇒ false
17:24rasmusto##(sequential? (seq {:a 1 :b 2}))
17:24lazybot⇒ true
17:24rasmusto##(sequential? #{:a 1 :b 2})
17:24lazybot⇒ false
17:25rasmusto##(sequential? (sorted-set [:a 1 :b 2]))
17:25lazybot⇒ false
17:25rasmustosveri: I'm curious what you're using "sequential?" for, can you paste the code by chance?
17:26bitemyapp~colls
17:26clojurebotcolls is http://www.brainonfire.net/files/seqs-and-colls/main.html
17:26bitemyappsveri: ^^
17:26sverirasmusto: i am doing the 4clojure task: http://www.4clojure.com/problem/28
17:26llasramI am eagerly awaiting Clojure 1.6 if for no other reason than the end of "reference to field <x> can't be resolved" for `-`-prefixed single-argument protocol functions
17:27sverirasmusto: and i guess i have to check if there is a sequence inside a sequence
17:27rasmusto,(sequential? "123")
17:27clojurebotfalse
17:27rasmustoah, that might be a good use case
17:27rasmustosveri: I haven't solved that one yet, it's one of the few easy ones that is stumping me
17:28sverirasmusto: hehe, i am not sure how to do that, i just started it
17:28rasmustobitemyapp: thanks for the link :)
17:29scriptorspoilerish hint for 4clojure 28: try coll?
17:30coventrysequential? vs coll? should make no difference for that exercise, but people are right that I was wrong to recommend sequential? so quickly.
17:31rasmusto,(counted? (lazy-seq (range))
17:31clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
17:31rasmusto,(counted? (lazy-seq (range)))
17:31clojurebotfalse
17:31sveriwell, for me the problem is not to check what i have, but how to concatenate the inside seq
17:31rasmusto,(counted? (lazy-seq (range 32)))
17:31clojurebotfalse
17:32rasmustosveri: how about cons?
17:32bitemyapprasmusto: np
17:32bitemyapp,(type (list* 1 2 3 4 '()))
17:32clojurebotclojure.lang.Cons
17:32bitemyapp,(list? (list* 1 2 3 4 '()))
17:32clojurebotfalse
17:34scriptorsveri: what do you mean by inside seq?
17:34sverii guess cons will do :D
17:34sveriscriptor: i mean the seqs that are inside the seq
17:35scriptorthere's also concat
17:35sverithank you all very much, for now i got to go, my kid will be up in 7 hours :D
17:36svericu some time
17:36rasmustosveri: night ;>
17:37cellisttry checking out the function tree-seq
17:37rasmustoyay, seq is flattened, glad I finally figured that out
17:38cellistrasmusto: how did you end up doing it?
17:38rasmustocellist: https://www.refheap.com/19680
17:39rasmustoprobably inefficient
17:39cellistThis is probably cheating, but i looked at the source of flatten
17:39cellist,(source flatten)
17:39clojurebotSource not found\n
17:40rasmusto~source flatten
17:40cellistoops. Anyway, it's pretty compact. Still trying to understand it, but I'm guessing that's the best way
17:41llasram~flatten
17:41clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
17:41rasmustocellist: hmm, looks cool. I'll have to see what tree-seq does
17:41rasmustollasram: point noted, we're talking about a 4clojure problem though :D
17:41coventryflatten is great when you want to yank something out of a tree at the repl, though.
17:41llasramGolfing?
17:42rasmustollasram: trying for my first impl, now golfing/optimizing
17:42rasmusto(and drinking afternoon tea)
17:43llasramCool beans
17:43bitemyappdon't use (apply hash-map (mapcat concat ...)) - just use (into {} ...)
17:44rasmustobitemyapp: into and seq are inverses in some sense, yeah?
17:44rasmustowell, except for the key/set-elem duplication stuff
17:45bitemyapp,(doc into)
17:45clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
17:45rasmustoah, conj is the culprit
18:23logic_prog(require 'eopl.chap01) from user=> in lein works. However, (require 'main) fails when src/main.clj contains (:require eopl.chap01)
18:23logic_progso somehow, I can require eopl.chap01 from lein, but not from src/main.clj
18:23logic_progwhat am I likely to have done wrong?
18:24hyPiRiontry (:require [eopl.chap01]) instead
18:26logic_proghyPiRion: same error. However, "user> (ns tstblah (:require eopl.chap01))" works
18:27logic_progseems like I can type anything into the lein repl, and it works, but from src/main.clj, nothing works
18:37yeoj___when destructuring using ":keys" is there anyway to retain the : on the front of the name, so it's symbol once i'm in the function body?
18:41rasmustoyeoj___: you want the ':' on your symbol name? I'm confused
18:43yeoj___rasmusto: yeah thats it
18:43rasmustoyeoj___: symbol names can't have a ':' in front, they would be keywords
18:43yeoj___rasmusto: ah, ok.
18:44yeoj___rasmusto: thanks
18:46yeoj___i'm trying to get my head around unquote
18:46yeoj___i have a dictionary with instructures (not a function) in the value of a key
18:46yeoj___and i want that to be passed to the repl, when i copy and paste a prn it works, but putting a ~ on the front doesn't.
18:47SegFaultAXyeoj___: Not clear on what you're trying to do. Paste code. refheap.com
18:47yeoj___SegFaultAX: http://pastebin.com/krQBnnD1
18:47yeoj___oh, sorry
18:47yeoj___i'll put it on refheap.com
18:48yeoj___https://www.refheap.com/19681
18:49yeoj___SegFaultAX: i'm new to clojure... i have a lot to learn about the correct ways to do things i'm sure.
18:51yeoj___sorry i got disconnected
18:53justin_smithyeoj___: in '(str type_name ...) in the mssql-to-netezza-dictionary, why do you quote it, and where would type_name be coming from?
18:53yeoj___justin_smith: well, i'm sure thats an icky bit..... type_name comes from the destructing in the function call on line 50 i think
18:54justin_smiththen that should be an fn
18:54justin_smithnot a quoted form
18:54justin_smithso that it can be called with an arg
18:54yeoj___I was trying to get a sort of.... put "business rules" in a dictionary thing going
18:54yeoj___ok
18:54yeoj___so your saing the mssql-to-netezza-dictionary should have keys like "varchar" and values like (fn [] ...)
18:55rasmustoyeoj___: it looks like the destructuring should be happening in the mssql-to...dict function instead
18:55rasmustoor it should just be a function that takes one argument
18:55rasmustoinstead of a quoted form as justin_smith said
18:56yeoj___ok
18:56yeoj___i'll give it a shot and see what happens. i think i had it as a function but i still couldn't execute the function once it was returned.
18:56yeoj___let me check.
19:02yeoj___hmm... i wanted it to be a lookup... like lookup the logic for this data_type. It's starting to have (cond x ) in there now... i'll get it written then maybe someone can show me the clojure way
19:04rasmustoyeoj___: you can have a (fn [something] (lalalala something)) as a map entry
19:04yeoj___;w
19:04yeoj___ok
19:14justin_smith,((:a {:a (fn [x] (* x x)) :b (fn [x] (* x x x))}) 2)
19:15clojurebot4
19:16justin_smithyeoj___: ^ that demonstrates putting a value retrieved from a map in the calling position to apply it
19:36lodinWhat's the rationale for records not supporting (r :x), only (:x r)?
19:50logic_progis there a good way to do clojure/C interop? I want to have a clojure DSl that can output high performance C code
19:50logic_progand somehow send the datastructures back & forth
19:50logic_progthat would make me happy
19:51r0bgleesondoesnt sound easy
19:54gwslogic_prog: https://github.com/bagucode/clj-native did you see that? might be a start
19:57biggbearhello everybody
19:59lodinlogic_prog: Not that I have anything that can help you, but I'm curious: how do you plan to handle the data when crossing language boundaries? Convert (and copy) between representations for each argument/return value for every call?
19:59biggbeardoes anyone is using counterclockwise to create a leiningen template and having issues?
20:01logic_proglodin: yes, probably json
20:07biggbearone question folks please: do you know how to import by hand a leiningen project to eclipse?. Please
20:07lodinlogic_prog: I haven't used JNA, but it seems to me that it shouldn't be necessary to serialize to json.
20:07coventrylogic_prog: It's not clojure/C interop exactly, but tbaldridge has a talk about a clojure LLVM DSL which does the "output C code" part. Mjolnir is the project name.
20:10coventryWell, the "output machine code" part, I guess...
20:15justin_smithdoes anyone else thing that clojure.test/are is awful? why not just let an fn and test the results of applying it
20:16justin_smith*invoking it even
20:17coventryIt would really be a lot of extra boilerplate for something like clojure.test-clojure.numbers
20:17logic_progcoventry: yeah, saw the talk
20:18logic_progfound it a bit "heavy" (requires modifyhing LLVM, I believe)
20:18logic_progcoventry: btw, how is your side project going? do you intend to open source it?
20:19coventrylogic_prog: Once it's reliable enough. Wrapping every form in debugging instrumentation is pretty invasive.
20:20justin_smithcoventry: my complaint is it parses with a completely different set of rules than I see in any other standard clojure function - the way it breaks up the args into groups of n for example
20:20justin_smithwell, this is a macro, not function of course
20:21justin_smithpoint being I need to add a bunch of extra special cases to how I read code just for test/are that don't get applied anywhere else
20:22technomancyyeah, not a fan of c.t/are
20:51bitemyapptechnomancy: my coworker looked at me weird when I explained the point of c.t/are to him. I think it shamed me out of using it.
20:51technomancyfun fact: it is also the reason clojure.walk is part of clojure
20:52technomancy=\
20:52justin_smithwow
20:52justin_smithdouble whammy
20:54bitemyapptechnomancy: hey, I like clojure.walk.
20:54bitemyappI needed it in my project like 2 or 3x :P
20:54technomancyit's been publicly disavowed
20:55bitemyapptechnomancy: where? I can't google it up.
20:55technomancybitemyapp: probably just in this channel
20:56bitemyapptechnomancy: well I'm not giving up my tree-walkin'.
20:56technomancystuartsierra has his regrets
20:57justin_smithis the problem a problem with walking, or with that particular implementation of walking?
20:57technomancyI think it's the implementation
21:06coventrytechnomancy: Really? His clojure.walk2 only came up in July, and AFAIK it behaves the same way, just faster.
21:06coventry*came out
21:07technomancycoventry: just speculating
21:07technomancymaybe he has recanted his recantment
21:08coventryActually, there is a bug referenced in the clojure.walk2 README which says "The conditional dispatch in clojure.walk is slow and not open to extension. It also doesn't support records", which counts as a regret.
21:10justin_smith(walk/postwalk recant (read-string (with-out-str (source walk/postwalk))))
21:21akhudekan alternative to walking might be https://github.com/akhudek/zip-visit
21:22bitemyappI don't have zipped data structures in my case. I needed walk.
21:22akhudekah, right, sorry
21:25bitemyappakhudek: no problem. More libraries is always good :)
21:25akhudekbitemyapp: it's pretty easy to create zippers for arbitrary data structures too
21:29bitemyappakhudek: not worth it in my case.
21:29bitemyappI did consider it.
21:46cgagAnyone have experience with http-basic auth and friend? I'm getting sent straight to my unauthorized handler without ever seeing the basic auth prompt. https://gist.github.com/cgag/6944435
21:46nmqCould someone tell my why (mod (math-function/pow 11 23) 187) returns 1.34217728E8 and not 88?
21:47nmqmath-function being in clojure-contrib
21:48llasramnmq: Using clojure-contrib implies Clojure 1.2, which is several years old
21:49llasramnmq: Which unfortunately means few people will probably be able to help you with that specific question
21:49llasramnmq: But there is the broader issue -- why such an old Clojure?
21:49nmqI can use a new version
21:50nmqHas contrib been rolled into Clojure core?
21:50nmqnewer version*
21:51akhudeknmq it was broken into many small libraries
21:51akhudekhttp://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
21:52coventryhttps://github.com/clojure/math.numeric-tower has expt
21:54gfredericks,(rem (Math/pow 11.0 23.0) 187)
21:54clojurebot1.34217728E8
21:55gfredericks,(reduce #(rem (* %1 %2) 187) (repeat 23 11))
21:55clojurebot88
21:57gfredericks,(let [x (Math/pow 11.0 23.0)] (= x (inc x)))
21:57clojurebottrue
21:57gfredericksnmq: I think we can safely just blame floating point math
21:57nmqgfredericks: I agree, lol
21:57nmqI appreciate the example
21:58gfredericksalso:
21:58gfredericks,(mod (apply * (repeat 23 11N)) 187)
21:58clojurebot88N
22:10nmqThanks again for this, it helped out a lot, especially to you gfredericks
22:57ddellacostaso, this is more of an emacs question, but I figure someone here may know--I'm trying to override the key for nrepl's C-c C-c by using add-hook with nrepl-mode-hook, but no luck: https://www.refheap.com/19684
23:05amalloyddellacosta: is there some reason M-; is a problem for you?
23:05amalloy(also, C-c <any letter>) is reserved for the user, so you could use C-c c and C-c u without fear of conflicting with any (well-behaved) mode
23:06ddellacostaamalloy: yes, I suppose I can use M-;, that works just fine, thanks--I'd just gotten used to C-c c
23:06coventryddellacosta: I don't think you want the <> characters in there.
23:06coventryEsp. for nrepl-mode-hook
23:07amalloyM-; is even nicer, because it serves both purposes on a single key
23:07ddellacostacoventry: ah, my confusion over what was probably parameters, whoops
23:07ddellacostaamalloy: yeah, I'll start using that. Not the solution I thought I was looking for, but a better one in any case. Thanks!
23:07amalloyheh
23:09ddellacostaamalloy: although, nrepl most definitely maps C-c c, I should add. Not sure if that means it is poorly behaved or what.
23:10amalloyddellacosta: no, it maps C-c C-c
23:10coventryNo it doesn't. You're getting that from somewhere else.
23:10ddellacostaamalloy: sorry, excuse me, C-c C-c
23:10ddellacosta…is what I meant to say.
23:10amalloyright. that's not poorly behaved at all
23:10amalloyonly C-c c is reserved for you
23:11ddellacostaamalloy: ah, I see, thanks. Didn't know about these emacs conventions.
23:12ddellacostasorry for the emacs discussion in #clojure, but thank you folks!
23:16uvtcEmacs-related question: The readme for nREPL says that it provides both a server *and* a client. In typical usage with Emacs, are we using "the nREPL client", or does nrepl.el play that role?
23:18ddellacostauvtc: if you mean you log into a nrepl session started somewhere else, you are the client in emacs. But you can also start a nrepl server in emacs (nrepl.el). So it can do both, depending.
23:18ddellacostadepends on typical usage I suppose--I usually connect to an nrepl session started in another repl, in a project dir
23:19uvtcddellacosta, thanks. I'd like to understand the overall architecture here, and I'm not yet currently an nREPL/nrepl.el user.
23:20saosebastiaoany core.logic users in here?
23:20saosebastiaoI'm trying to understand how to solve a problem
23:21saosebastiao\list
23:21ddellacostauvtc: this section and the one immediately below it describe the two methods I've used to connect--one is for starting up your own server (nrepl-jack-in) and the other connecting to a running server (nrepl): https://github.com/clojure-emacs/nrepl.el#launch-a-nrepl-server-and-client-from-emacs
23:23uvtcddellacosta, Thanks. Reading that now.
23:27amalloy~anyone
23:27clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
23:27technomancynrepl.el is not a server; it contains a command to launch a server though
23:28uvtctechnomancy, Right. It is a client that can talk to the server provided by nREPL, correct?
23:28technomancyright
23:28technomancythere's only one nrepl server but many clients
23:29uvtcWhat is REPL-y ? When I start `lein repl`, it tells me that it's connected to an nREPL server, but then below that says "REPL-y 0.2.1".
23:30technomancyrepl-y is a client implemented in clojure that ships with lein
23:30uvtcOh, I see. I can talk to nREPL either using REPL-y (from `lein repl`), or using Emacs (nrepl.el). :)
23:30uvtctechnomancy++
23:31uvtcOh, wait. I forget the syntax here for karma infusion.
23:31uvtc,(inc technomancy)
23:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: technomancy in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:31uvtc$(inc technomancy)
23:31uvtcGah.
23:32technomancyor using grench
23:32uvtctechnomancy, I'm getting there, I'm getting there! Need to understand the basics before facing the Grench! :)
23:36seangrov`(inc technomancy)
23:36lazybot⇒ 84
23:38uvtcAh. Thanks, seangrov`.
23:38ruzu,(+ 1 2)
23:38clojurebot3
23:38uvtc&(+ 1 2)
23:38lazybot⇒ 3
23:47SegFaultAXuvtc: I read that in Tim Curry's voice. Was that intentional?
23:49uvtcSegFaultAX, Heh, the Grench was just a red herring.
23:50SegFaultAXuvtc: Flames... on the side of my face...
23:50ruzu,(.. System out (println "Cake!"))
23:50clojurebotnil
23:51ruzuThe cake... is a...
23:52SegFaultAXruzu: println has no [meaingful] return value
23:52SegFaultAXMeaningful, even.
23:59uvtcOk. I see. When I just open a file in a regular lein-based Clojure project, and there's no `lein repl` running, if I then do `M-x nrepl-jack-in`, nrepl.el is smart enough to recognize we're in a lein-based project and can have lein start up the nREPL for us?
23:59uvtcIs that correct?