#clojure logs

2014-02-12

00:01benkay,(.byteValue 60002)
00:01clojurebot98
00:11technomancyis anyone using user-env-compile on a clojure heroku app?
00:17teslanickI might now that I know about it.
00:31technomancyno, don't
00:31technomancyit's going away
00:31Raynestechnomancy: Careful, damn it! With great power comes... you know this already.
00:33glosoliWhat's going away ?
00:37technomancyglosoli: an experimental beta feature is getting replaced with something less janky
00:37technomancypossibly alpha, actually
00:38glosoliIs there some link one could read (might be of an interest)
00:38glosoli:?
00:39dsrxmore official support for anvil would mean most cases of user-env-compile I can think of would be obsoleted
00:39technomancysure, https://devcenter.heroku.com/articles/labs-user-env-compile
00:39technomancydsrx: there are issues with making config values inputs to the build
00:39glosolitechnomancy: thanks sir
00:39technomancybecause we don't force a rebuild when your config values change
00:40technomancywhich we really should if you think of them as arguments to a function
00:40technomancy(which is the right way to think about builds)
01:37xsyn*waves*
01:42sm0kewhat is the function which basically does a reduce but returns the list of each steps result?
01:42arrdemsm0ke: ... what? there's iterate...
01:42arrdemsm0ke: but idk about a reduce that shows intermediaries...
01:43sm0kefor sure there was something like that in haskell
01:43sm0keits prefectly viable isnt it?
01:43bob2what was it called in haskell
01:43arrdemI mean I can see implementing it pretty easily...
01:43sm0keand useful too
01:43sm0kebob2: let me check on lyah
01:45sm0kebob2: scanl scanr
01:45sm0ke,(doc scan)
01:45clojurebotHuh?
01:46arrdemsm0ke: it's just gonna be a recursive lazy-seq... not to hard to build.
01:46sm0kearrdem: yea, wanted to know if its already available
01:46arrdem,(doc reductions)
01:46clojurebot"([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."
01:47arrdemgotcha.
01:47arrdemsm0ke: ^^
01:47sm0ke,(reductions + 1 [1 2 3 4])
01:47clojurebot(1 2 4 7 11)
01:47sm0ke,(reductions + [1 2 3 4])
01:47clojurebot(1 3 6 10)
01:47sm0keawesome!
01:48sm0ke(inc arrdem)
01:48lazybot⇒ 20
01:48arrdemholy shit. 20 karma?
01:49sm0kewhat i particularly like is the lineage starts from the first element
01:50sm0keexactly what i wanted :D :D
01:51quizdrwow that's a useful little function to know about.
01:51quizdr(inc arrdem)
01:51lazybot⇒ 21
01:52arrdemtwo karma... a new (to me) clojure.core function... dogecoin through the roof... is it my birthday?
01:53sm0keheyyy inc my karma too, i was the one who asked
01:54sm0ke:P
01:54RaynesWell shit arrdem I could have taught you about reductions.
01:54Raynes;p
01:54arrdem<3
02:02quizdr(inc sm0ke)
02:02lazybot⇒ 4
02:08sm0kehaha
02:08sm0keok
02:18alewreduced is a pretty crazy function
02:30amalloyalew: well, it's nice, but compared to, eg, haskell, where you don't even need reduced because of laziness, reduced is nothing special
02:30sm0keso guys, one more question is dont know if this makes sense
02:30szymanowskii would like to create a map where field are constrained to each others by relations, so i can change one field value and the change is propagated to other fields via pre-defined relations, does it make sense?
02:31arrdemszymanowski: so you want writes with side-effects?
02:31szymanowski:)
02:31arrdem(dec so) ;; yes I'm still downvoting that guy
02:31lazybot⇒ -7
02:32arrdemszymanowski: there isn't any really idiomatic way to do exactly that.. I mean you could fake it by using an atom with watchers but ugh
02:32arrdemszymanowski: better would be to just have an update function that recomputes the fields
02:32szymanowskiyes i see
02:33amalloywhat? he didn't say he needed to mutate anything at all
02:33arrdemamalloy: he said he wanted parametric fields... that's an implicit update to me...
02:33amalloyuhhh...no he didn't? he said he wanted a map with fields in it
02:33amalloyit can be an immutable map
02:34sm0keso i wanted something like apply, (+ (flat [1 2 3]))
02:34arrdem"where field are constrained to each others by relations, so i can change one field value and the change is propagated"
02:34sm0keis see that apply is pretty limited
02:34amalloyand given such a map, you can certainly write a function (update-firstname m "mike") which updates the first name and then also the full name
02:34maravillasszymanowski: not sure if it's quite what you have in mind, but you might look at https://github.com/tailrecursion/javelin/
02:34sm0kewhy isnt there something which just flattens in place
02:35arrdem,(flatten [1 [2 [3 [4 [5]]]]])
02:35clojurebot(1 2 3 4 5)
02:35arrdemsm0ke: works fine over here...
02:35arrdem~flatten
02:35sm0kearrdem: no i want an apply like functionality
02:35arrdemclojurebot: flatten |is| almost certainly not the tool you are looking for
02:36sm0keyou get my point
02:36sm0ke?
02:36amalloysm0ke: you want ruby/python's splat?
02:36sm0keamalloy: sorry i dont know about it
02:36amalloycool, cause you can't have it. it just doesn't work in a language with macros
02:36amalloybut it's what you're asking for
02:37sm0keamalloy: why cant we have (defmarco splat [body] ~@body)
02:37sm0kehmm ok that didnt made any sense
02:37sm0kemacros are compile time
02:38sm0keamalloy: hey then how does apply works?
02:38amalloyapply is a language primitive, and of course you can do anything with apply that you'd rather do with splat
02:38sm0keamalloy: for starters apply doesnt take other macros
02:38amalloybut it has to be a function, it can't be an infix operator that works in the middle of any old crazy mess
02:39amalloyapply isn't a macro either
02:39sm0keamalloy: i really need to look into splat if you mean what i mean
02:39sm0kebrb
02:39amalloycool, have fun. i'm going to bed
02:44sm0keok i read about it and seems to be what i want, but some how this doesnt works for me in pyhton
02:44sm0keprint(*[1,2,3])
02:45sm0kearrdem: so my point was print(*[1,2,3]) == print(1,2,3)
02:45sm0keyou see?
02:45arrdemsm0ke: apply does that....
02:45arrdem,(apply println [1 2 3 4 5])
02:45clojurebot1 2 3 4 5\n
02:46sm0keyes but apply is hardcoded to some level before the last argument
02:46sm0keyou see its not ideal solution
02:46szymanowskii would like to be able create a map like that (def rm (rel-map {:a 1 :b 2 :c ?} :where (= :c (+ :a :b)))) => ({:a 1 :b 2 :c 3}) and then be able to (assoc rm :b 3) => {:a 1 :b 3 :c 4}
02:46sm0kemore over (apply somemacro list) wont work either
02:47arrdemokay... amalloy just told you we don't feature the "
02:47arrdemideal solution"
02:47arrdemso what's the problem
02:47arrdemthis is what you've got.
02:48arrdemand of course (apply somemacro) doesn't work.
02:48arrdemthat's what `(do (somemacro ~@list)) is for
02:49arrdemszymanowski: you can't mix your data and code that way unless you want to write new updater operations which will respect your update rules.
02:49arrdemwhy the hell am I up. I'm going for a run. good luck.
02:52quizdrif I need to serialize some stuff into JSON, should I just generate it myself using functions like str, etc to concatenate it manually?
02:52szymanowskiarrdem: thank you
02:53arrdemquizdr: does data.json not _have_ a serializer already?
02:53arrdem$google clojure.data.json
02:53lazybot[clojure/data.json · GitHub] https://github.com/clojure/data.json
02:55mduerksenquizdr: a lot of clojure libs are listed here, JSON parsers/serializers as well: http://www.clojure-toolbox.com/
02:56quizdrnice toolbox site
02:57mduerksenyes, it has helped me uncounted times
02:58mduerksenand it is updated regularly. it does not give guidance for choosing though, thats up to you/google
03:17_ericis there a way to get the current index when using (line-seq)?
03:17_ericI'm looking for something like ruby's each_with_index
03:18_ericand I'm sure there's a simple way I could do something with zip, but I can't reason it out
03:20mduerksen_eric: not sure how you use line-seq, but you could something like (map-indexed f (line-seq rdr)). then f gets the index and the element
03:22_ericsweet
03:25quizdrI want a string of a long random number not including its first two digits (which are usually "0.") and this just seems inelegant:
03:25quizdr,(clojure.string/join (drop 2 (str (rand))))
03:25clojurebot"08478211199316987"
03:25mduerksen_eric: alternatively you could do this: (map f (line-seq rdr) (range)) . this way, you can have the index paramter second if you like. using map with multiple arguments is something i sometimes forget is possible
03:25quizdrIs this an idiomatic way to achieve this?
03:28sm0ke,(.substring (str (rand)) 2)
03:28clojurebot"15675975031956557"
03:28mduerksenquizdr: there is a function rand-int, so you could do (str (rand-int n)). if you need it 0-padded, you could do (format "%012d" (rand-int n)). not sure if i got the format syntax right
03:29edbondquizdr, long random number? ,(doc rand-int)
03:29quizdrok. rand-int is no better as I'd just have to specify a very large int to get same precision.
03:30edbondor you can rand-nth from string "123456798"
03:30clojurebotTitim gan éirí ort.
03:30mduerksendoes your random have to be cryptographically secure?
03:31edbond,(repeatedly 5 #(rand-nth "123"))
03:31clojurebot(\3 \3 \3 \2 \2)
03:31quizdrno nothing fancy is required, just want to ensure totally unique file names
03:31sm0kequizdr: why not use uuid?
03:31sm0ke,(str (java.util.UUID/randomUUID))
03:31clojurebot"782469d1-fff0-40cd-88c9-11dd9a9afce4"
03:32quizdrah, didn't know about that one. nice.
03:32quizdr(inc sm0ke)
03:32lazybot⇒ 5
03:34edbondkorma question: how to select date from DB? I have 'date' column, contains "2013-03-14". Korma select returns #inst "2013-03-13T22:00:00.000-00:00" that is of java.sql.Date type.
03:34edbondany way to get correct Date? without hour / minute /second ?
03:41winksounds like a UTC problem
03:41winkI don't think it's incorrect
03:42winkedbond: do you know about https://github.com/clj-time/clj-time ? :)
03:43edbondwink, I think that may help. It seems that date converted to UTC from my local TZ +2
03:44edbondI expected to have something like <LocalDate 2013-03-14>
03:44winkcan't help you with your specific problem unfortunately, but have a look at joda, it usually solves my woes :P
03:46edbondwink, thanks
03:47winkyw
03:51mklappstuhlhow can I install a lein dependency straight from git?
03:53sm0kemklappstuhl: you can use lein-git-deps plugins
03:53sm0kebut its ugly
03:57edbondmklappstuhl, create checkouts dir and clone project there
03:58edbondmklappstuhl, https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
04:01sm0keedbond: i dont see the point if you are doing that much manual work
04:01sm0keyou can directly do `lein install` from the cloned project instead
04:02sm0keor mvn install or whatever build system that project is using
04:03edbondsm0ke, yes I think you right. If you not going to edit deps or update frequently
04:07mklappstuhledbond: I setup a checkout dir and linked etc, but does that take the HEAD and not the version which is specified in the project.clj?
04:08edbondmklappstuhl, it will use version you have in the directory
04:09mklappstuhledbond: cool
04:23mklappstuhledbond: how can I check if that lib is actually being used then? somehow there is no effect and I'd like to double check if I've done it correctly
04:24edbondmklappstuhl, remove it from project.clj, lein clean, lein repl, require/use
04:45quizdrhere's an odd one
04:45quizdrhttps://www.refheap.com/36884
04:45quizdrit actually returns a lazy collection in quotes?
04:45quizdrwhat's weird is if I don't include the "[" then it returns an actual collection as a string as you'd expect
04:46quizdras if the act of making a string causes evaluation to occur of the entire string
04:52tazzHey guys I am trying to convert a filter (filter #(= "foo" ) to start accepting regex
04:52tazzright now I get "java.lang.ClassCastException: java.util.regex.Pattern cannot be cast to clojure.lang.IFn" type of exceptions.
04:56edbond,(apply str "[" (interpose "," (map #(str "\"" % "\"") [1 2 3])) "]")
04:56clojurebot"[clojure.lang.LazySeq@5fd031bd]"
04:56edbond,(apply str "[" (interpose "," (map #(str "\"" % "\"") [1 2 3]))
04:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
04:57edbond,(type (map inc [1 2 3]))
04:57clojurebotclojure.lang.LazySeq
04:59edbondquizdr, nice trick. Looks like a bug to me
05:00edbondor not, interpose returns lazySeq
05:00edbond,(type (interpose "," [1 2 3]))
05:00clojurebotclojure.lang.LazySeq
05:02edbond,(str "[" (apply str (interpose "," (map #(str "'" % "'") [1 2 3]))) "]")
05:02clojurebot"['1','2','3']"
05:02edbondquizdr, ^
05:02edbondtazz, use re-find
05:02tomjackwow, I just looked at const__i in a fn
05:03edbond,(filter #(re-find #"foo" %) ["foo" "bar"])
05:03tomjackguess I sorta knew this was happening but not how exactly
05:03clojurebot("foo")
05:07quizdredbond i think i figured it out
05:07quizdri was not using apply correctly
05:07quizdrthe last argument to apply must be a list
05:13pyrtsaquizdr: To use apply with a non-list as last argument, make it not-last by appending () to the arguments. ;)
05:14edbondpyrtsa, then you don't need apply
05:31pyrtsaedbond: Haha, indeed.
05:44danielcomptonI have a question about do which is a little basic. When do you need to use do and when can you wrap the forms in parens without a do?
05:45danielcomptoni.e. (do (side-effect 1) (side-effect 2)) vs ((side-effect 1) (side-effect 2))
05:45pyrtsaYou use do to evaluate multiple expressions for side effects.
05:45danielcomptonWon't the second expression still evaluate both side effects though?
05:46pyrtsaWrapping anything in a pair of parentheses executes it as a function. ((side-effect 1) (side-effect 2)) will only work if (side-effect 1) returns a function that can be called with the result of (side-effect 2) as its single argument.
05:46algernonthe second will evaluate (side-effect 1), and try to call the result as an fn with (side-effect 2) as argument.
05:46danielcomptonah of course
05:46danielcomptonI knew I was missing something
05:46danielcomptonobvious
05:47danielcomptonThanks!
05:47pyrtsadanielcompton: You *don't* need do when there's an implicit do, like in the bodies of (when x ...) or (fn [...] ...).
05:48edbondI find do needed with (if) when you have several thing in one branch. (if <cond> (do .. ..) <else>)
05:48danielcomptonIs there something like when that will work for true and false?
05:49danielcomptonSo you don't need to wrap if bodies in do?
05:49pyrtsaedbond: In those cases, it might make sense to create an own function of the body of the if-true branch.
05:50edbondpyrtsa, sure. sometimes I just what to (prn) and remove later :)
05:51pyrtsadanielcompton: What would separate the else branch from the body of the if-true branch then?
05:51arrdem,(println "arrdem: pong")
05:51clojurebotarrdem: pong\n
05:52danielcomptonpyrtsa: there would still be (if expr true-form false-form) but inside true-form you wouldn't need to wrap them inside another do
05:53pyrtsadanielcompton: You can write your own macro for that.
05:53danielcomptonso (when-if expr ((side-effect 1) (side-effect 2)) (side-effect 3)))
05:53danielcomptonpyrtsa: That's what I started thinking as I was typing it :)
05:53arrdem... so saving two characters for what?
05:53pyrtsaIn my opinion, it doesn't read well. The outer (...) still looks like a function call.
05:54edbonddanielcompton, just add do )
05:55Anderkent]awaydanielcompton: yeah that looks really confusing. What if you had ((partial foo) x) as your expr - wrap that in another set of parens? Just use do, or prefferably dont use if
05:55danielcomptonYeah, it's not the best idea
05:55Anderkentcond is your friend
05:56danielcomptoneven for either or scenarios?
05:57Anderkentwell, if you can fit at least one branch on a single line, then (if expr (short branch) (do long branch)) is fine
05:58Anderkentbut if both are long, and you don't want to pull the contents out to separate defs, (cond (expr) (first-branch) :else (second-branch)) is nicer imo - much clearer where the branches end
06:25ohcibiwhen using core/remove on a set it returns a list. what is the idiomatic way of passing a collection to a function like remove and get a collection of the same type as result?
06:26ohcibi(set (remove ...)) would work for sets but this looks kinda verbose to me
06:28AimHere,(disj #{:a :b :c :d} :b :c)
06:28clojurebot#{:a :d}
06:28AimHereThat the sort of thing you want?
06:29AimHereOh wait, perhaps not
06:31Anderkentohcibi: (set (remove ...)) is unfortunately right; a generic form is (into (empty coll) (remove pred coll)), which will work for 95% of use cases
06:31Anderkentand when it doesnt it'll give you back a list because fuck reasonable apis
06:33Anderkent,(let [c (first {:a 1})] [c (into (empty c) (map identity c)])
06:33clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
06:33Anderkent,(let [c (first {:a 1})] [c (into (empty c) (map identity c))])
06:33clojurebot[[:a 1] (1 :a)]
06:36ohcibiAnderkent: thanks
06:38jowagIs it correct to say that Atom, Ref and Var are 'stateful' types?
06:38AimHereMutable is probably a better word
06:38Anderkentto the first approximation yes
06:40clgvAnderkent: are you performing a taylor analysis on that definition? :D
06:44jowagthanks, and what about Agents, can they be considered 'stateful' too?
06:45Anderkentyes, agents have mutable state too
06:46clgvis the Hickey word "state (change) management types" or similar?
06:50jowagan what about Futures? :) they have a internal state, however not directly mutable by user, but you can use realized? to see if it is computed.
06:54clgvimmutable but not necessarily immediately accessible. same category as delay or promise
07:00jowagyeah but can i call them 'stateful'?
07:01cleatomaThat depends what your definition of "is" is.
07:03clgvjowag: I would not since you can not change their "state" after they have one in contrast to refs, atoms, agents
07:05jowagclgv: that's what mutable is. I wanted to express the fact that there is some state which you can at least query and that can change between two calls.
07:18sverihaha, nice topic
07:26noidi,`()
07:26clojurebot()
07:27noidi,`(~@[])
07:27clojurebotnil
07:27noidiisn't this a bug?
07:27Anderkenteh, nil and empty list are kinda almost the same thing
07:28Anderkent,(do ~@'())
07:28jowagI've found an interesting blog about this problem: http://lalitpant.blogspot.sk/2008/01/object-state-identity-immutability-and.html
07:28clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote-splicing>
07:28Anderkent,§(do ~@'())
07:28clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: � in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:28Anderkent,`(do ~@'())
07:28clojurebot(do)
07:28Anderkentfffs
07:28Anderkent,`(do ~@[])
07:28clojurebot(do)
07:28noidiAnderkent, no, they're not
07:28noidi,(boolean `(~@[]))
07:28clojurebotfalse
07:28noidi,(boolean `())
07:28clojurebottrue
07:28jowag"an object has state if its behavior (as defined by its methods) may observably change over the course of time. In other words, the output of (the methods of) a stateful object is determined not only by the input received, but also by some modifiable internal state."
07:29Anderkentas i said, kinda almost
07:29algernonnoidi: ~@ unpacks, there's nothing in [], therefore nil
07:29AimHereAnderkent, again, no
07:29noidihaving the opposite truthiness is not almost the same :)
07:29AimHere(if nil "Truthy" "Falsy")
07:29AimHere,(if nil "Truthy" "Falsy")
07:29clojurebot"Falsy"
07:29AimHere,(if '() "Truthy" "Falsy")
07:29clojurebot"Truthy"
07:29Anderkent... that's the same exact example
07:29AnderkentI KNOW THAT
07:30Anderkentthat's why I didn't say they're the same thing
07:30noidialgernon, it didn't unpack nil, it replaced the containing empty list with nil
07:30AimHerenil and false are much more similar
07:30AnderkentI said they're kinda almost the same thing; many core functions treat nil as empty list
07:30algernonnoidi: you unpacked an empty list. that doesn't make sense => nil
07:31noidino, I unpacked an empty sequence into a list
07:31Anderkentwhy do you say unpacking an empty list makes no sense?
07:31noidiso I expect to get the empty list (as nothing was unpacked into it)
07:31noidiinstead the list is replaced with nil
07:31Anderkent,(seq '())
07:31clojurebotnil
07:31Anderkentempty list being replaced with nil is idiomatic
07:32algernon,`[~@[]]
07:32clojurebot[]
07:37noidi,(list? `())
07:37clojurebottrue
07:37noidi,(list? `(1))
07:37clojurebottrue
07:37noidi,(list? `(1 2))
07:37clojurebotfalse
07:37llasram,`(1 2)
07:37clojurebot(1 2)
07:37llasram,(class`(1 2))
07:37clojurebotclojure.lang.Cons
07:38llasramThere's the case where Anderkent (IIRC?) had suggested earlier where the reader produces non-list?s
07:38llasramCool
07:39AnderkentYeah! Ta.
07:40llasramOh, but I bet it isn't, not exactly
07:40llasram,'`(1 2)
07:40clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2)))
07:41llasramYeah, so the reader is producing *code* for syntax-quote, which then evaluates to a non-list? seq
07:41llasramOh, you crazy LispReader you
08:18pellishello
08:18pellisi'd like to process in parallel a list of tasks. however i only have N threads. let's say 2
08:18pelliswhen new items enter, id like to free up busy threads by force, and make them process the new items instead of the old ones
08:19pellisany mechanism to do this? what is this called?
08:20edbondpellis, why do you want to free threads? throw away results?
08:20cleatomaI think you want interrupts: http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html
08:21pellisedbond: yes throw away results
08:21pellisi want to limit parallelism. however new items are more important to me
08:21jph-pellis, seems like you need some sort of queuing
08:21pellisso i want some kind of job stealing to happen
08:22llasramThat's not quite what job-stealing usually means :-)
08:22cleatomaHmm, actually interrupts looks like it's just some standard messaging. You still have to write the processing code so that it repeatedly checks whether to stop.
08:22pellisjph-: yes, i think priority queue that i have items i can change priority for. once i change priority these items will be closer to the end of the queue
08:22pellishowever now i need to orchestrate the 2 threads i have
08:22llasrampellis: I think you just want your queue to actually be a stack
08:22llasramSo that whenever threads get a new work item, they always get the most recent
08:23pellisllasram: correct. how do i cancel the old items? remember i only have 2 "heads" that can process items off the stack
08:23edbondhe want to free threads as soon as new tasks arrive
08:23pellisif new items are entering the stack, they get priority and need to be processed instead of current ones
08:23jph-you'll need a watchdog or equiv
08:23jph-to halt current processing when new jobs appear
08:23edbondI think you need to use java Threads and interrupt
08:24pellis_sorry
08:24jph-if new jobs appear at known intervals, you could simplify by using a timeout
08:24pellis_once item rate is "relaxed", the threads are free to do the entire stack worth of jobs
08:24jph-if existing tasks dont complete within timeout, they die
08:24pellis_this is like some sort of reverse-throttling
08:24pellis_jph-: yep, that idea also crossed my mind. what if i'm not willing to even wait the timeout?
08:25jph-pellis_, i'd argue you start with a timeout rather than increasing the complexity too fast
08:25llasrampellis_: Just make the stack bounded size. I think the Java std lib has something which will do that for you automatically, but worst case just have your insertion function drop off the oldest work-item if the stack is too large
08:26pellis_jph-: you are right in this argument. i want to explore the more complex solution as well :)
08:26pellis_i just thought my Java isn't that polished in order to express what i need
08:26pellis_i guess I'm looking for a "RingExecutor"
08:27pellis_where new items in the ring will kill old items
08:27pellis_and the ring's size is the size of the threadpool
08:32llasrampellis_: I think you'll need to write something relatively custom... The Java std lib has most of the parts, but not all put together the way you want
08:32pellis_yep, ok that's good enough. i just needed to know i'm not reinventing the wheel
08:32edbondpellis_, look at futures and future-cancel
08:33pellis_why does the abstraction of future solve this?
08:34edbondit runs on thread, you can cancel it.
08:34llasramI'm pretty sure the pellis_ doesn't actually want to cancel in-progress work items
08:34pellis_llasram: yes, i do
08:35llasramReally? Because then you aren't guaranteed to actually ever produce any results
08:35edbond"id like to free up busy threads by force, and make them process the new items instead of the old ones"
08:35pellis_i need to do everything i can to process the newer items first
08:35llasramI know, but I believe they are mistaken
08:35clgvjowag: no in my opinion you can call atom, ref and agent "stateful". but a narrow definition for this "stateful" from the clojure perspective will not fit delay, future, promise. anyway, it is all about how you define "stateful". without a definition attempt it is almost impossible to discuss it reasonably
08:36llasrampellis_: If work items are arriving at a slower rate than the rate at which you can process them, then you don't need any of what you've described
08:36llasrampellis_: If they are arriving at a faster rate, and you interrupt in-progress work-items, then you'll never finish processing any given item, and never produce any results
08:36pellis_they are arriving order of magnitues faster, however there are periods of time where there is a "low" and inactivity time
08:36pellis_they are arriving in bursts so to speak
08:37pellis_and i never know whats the size of a burst
08:37llasramSo you want to produce 0 results during bursts?
08:37Anderkentpellis_: then you can't do newest first or you'll never produce any results until burst ends
08:37Anderkentrather, you want to finish the current work item then take the newest item on the stack
08:37pellis_for a burst of 10 items, and 2 processing threads, when the burst "relaxes" i want the last 2 items processed
08:37llasram(inc Anderkent)
08:37lazybot⇒ 7
08:38edbondmaybe async sliding-buffer is all you need. You can't be sure which items you process
08:38pellis_this is like a 'debouncing' algorithm. when you do a text-completion and they don't really go to the network immediately
08:38llasrampellis_: Why not just have threads work on the most-recent item each time they become free? They're still guaranteed to process the two most-recent items, and to produce their results last
08:38Anderkentllasram: the sad thing bout helping newbies 90% of the time is they don't know about inc :(
08:38llasramAnderkent: Haha. Yeah
08:38jowagclgv: I agree. the term 'stateful' is not clearly defined
08:39pellis_llasram: let me think about that scenario
08:39llasramAnderkent: OTOH, it prevents the "Stack Overflow" effect
08:39Anderkent:D
08:39pellis_llasram: that might be a mid-way solution, yes.
08:39jowagclgv: I've found one that fits my purposes, "an operation is said to be stateful if you can observe that its state has changed, e.g. by repeating the same operation with the same arguments but getting different results. Such an operation depends on state which is not provided as part of invoking the operation."
08:40clgvjowag: do you want to explain clojure's building blocks to newcommers with that categorization?
08:45jowagclgv: I'm designing a library for IO resources which plays nicely with Clojure's concepts of references, reducers, channels, and I need to get some concepts straight
08:46clgvjowag: ah ok. then I'd categorize in mutable concepts (atom, ref, agent) and asynchronous concepts (delay, promise, future)
08:47jowagclgv: but delay is lazy, not asynchronous :)
08:49clgvjowag: yeah lazily triggered. but somehow that is asynchronous as well, since you do not know who computes its value when
08:52jowagclgv: same can be told of a lazy sequences, lazy seqs are not realized by those who create, but those who consume first.
08:54clgvjowag: humm right. but I wouldnt call delay a lazyseq. because of that and that it shares a lot (querying whether a value was realized ...) with promise and future I'd call it async as well.
08:56clgvjowag: though Joy of Clojure has futures and promises in the "Mutation" chapter
08:58clgvjowag: "Clojure Programming" groups delay, future and promises together in "shifting computation through time and space"
08:59jowagclgv: now you see there is no clear categorization :)
08:59Anderkentwell, they're mutable in a very restrictive way; I think that's worth distrinuishing. The core operation @ will always return the same result, just might or might not block. realized? is the mutable part, but often you don't care.
09:01tbaldridgeclgv: it's not asyn as a deref of a delay will cause the delay to be executed on the caller's stack
09:01clgvfrom a user point of view they are not mutable by the user. the user can just trigger computation or wait for the computation to finsh. he can not mutate the values ;)
09:01tbaldridge*async
09:01jowagAnderkent: deref takes optional timeout, in that case it can return different result based on whether the future is realized or not.
09:02Anderkentah, fair enough
09:02tbaldridgeI think the world needs a term for "mutable, but will only be mutated once"
09:02Anderkenttbaldridge: lazy?
09:02clgvtbaldridge: yeah we had that before. but some other thread might deref it first the it would be async. so has an async characteristic in general
09:02tbaldridgeI suppose....I guess I could say "hashmaps have lazily computed hash value caches"
09:03tbaldridgeclgv: it depends how you define async. I don't define it as "computed somewhere else" but as "can I continue doing work while this computation completes"
09:04tbaldridgeIn that case, I don't think delay really qualifies.
09:04clgvsaying promise, future, delay are mutable is more a view on implementation details then on the user perspective I'd say
09:04clgvtbaldridge: ah, delay does not support timeout deref?
09:04jowagclgv: I would not say that future is mutable, but that it is stateful
09:05jowagclgv: delay does not block
09:05clgvjowag: humm ok, so we need those definitions to be clear ^^
09:05clgvjowag: delay sort of blocks when it does the computation. but right that is splitting hairs again
09:06tbaldridgeclgv: the question of mutability of delays will only really hit you when you try to write delay in a completely pure statically typed language.
09:06tbaldridgeso yeah, it doesn't matter most of the time.
09:08clgvI think I am just arguing to group atom, ref, agent together and promise, future, delay in another group when presenting them to newcommers
09:08jowagclgv: yeah, I wanted to say that it does not block in sense that a thread does not wait for something to finish.
09:40gfredericksdoes anybody happen to remember how to make a c.j.jdbc query to postgres load the result set lazily?
09:40gfredericksgeneric postgres googling suggests doing .setBatchSize on the Statement; does this require hacking c.j.jdbc or is there an option I'm not seeing?
09:40quizdrI just noticed I've been putting my doc strings after the parameter list in defn and it's been working fine, but looks like the doc should got before the parameter list?
09:41edbondgfredericks, could you use limit+offset to load in batches?
09:41Anderkentquizdr: 'works fine' as in doesn't break, or is the :doc metadata set properly?
09:42Anderkentgfredericks: I don't think you can be fully lazy with jdbc; once you close the connection the resultset is invalidated
09:43quizdrwell, doesn't break. I didn't check meta.
09:43gfredericksAnderkent: I know this would be before closing the connection
09:43quizdrI'm refactoring now anyway.
09:43Anderkentas in you just want to only return the first N elements from (query)?
09:43gfredericksedbond: I don't know for sure that wouldn't work but it doesn't sound like the most performant
09:44Anderkentyou can do that with :result-set-fn set to something like #(doall (take 25 %))
09:44gfredericksAnderkent: I can't fit the results in memory, so I want to process them as they're coming in
09:44Anderkentah.
09:44Anderkentdo the processing in result-set-fn
09:44gfredericksright
09:44gfredericksbut jdbc loads it all eagerly anyhow
09:44Anderkenthuh.
09:45Anderkentthat doesn't sound right; are you maybe using as-arrays?
09:45gfredericksnope
09:45gfredericksit's pretty vanilla
09:45edbondgfredericks, https://stackoverflow.com/questions/19728538/clojure-java-jdbc-query-large-resultset-lazily
09:46gfredericksedbond: that looks quite relevant, thanks
09:46edbondyw
09:47Anderkentgfredericks: that's exaclty the as-arrays issue i mentioned
09:47Anderkentif you're not doing as-arrays that shouldnt happen
09:48Anderkentgfredericks: did you play with :fetch-size ?
09:48gfredericksAnderkent: I'm working on that now
09:48Anderkentjdbc will fetch :fetch-size results at once
09:48gfrederickstrying to figure out how it fits into the api
09:49gfrederickssince now I have to use prepare-statement instead of query
09:49AnderkentI believe the default fetch size is 10 anyway
09:49Anderkentso it shuoldn't be the issue
09:49gfredericksin which case I still don't know what the issue is
09:49quizdrwhat's the best way for me to use a source file in a new project, where the file is in an entirely different project? the ns seems to make idiomatic referencing of other source files in the same project, but the path would get rather long otherwise?
09:50Anderkentgfredericks: can you post your query code just in case?
09:50Anderkent(in case there's something obvious you're missing :P)
09:51edbondquizdr, lein install other project and add it to dependencies
09:52gfredericksAnderkent: (jdbc/query db ["SELECT foo FROM bar WHERE baz = ?" quuz] :result-set-fn (constantly :foo))
09:53gfredericksif I add LIMIT 5 to the query it returns :foo immediately; otherwise it OOMs
09:53Anderkenthm okay, that's pretty straightforward
09:54Anderkenttry adding :fetch-size 5 to the sql query then I suppose?
09:54quizdredbond run lein install inside the project directory already created with lein?
09:54edbondquizdr, yes, the one you depends on
09:54gfredericksAnderkent: adding it where?
09:55Anderkent["SELECT foo FROM bar WHERE baz = ?" quuz :fetch-size 5] is where it goes I think
09:55Anderkentmiiight be wrong
10:01gfredericksAnderkent: okay so it goes in a map at the front like [{:fetch-size 5} "SELECT ..." quux]
10:01gfredericksbut setting the fetch-size still gets me an OOM, though setting max-rows doesn't
10:01gfredericksbut max-rows truncates the result set
10:03mskou72hi
10:03gfredericksgoogle suggests I need to turn autocommit off
10:04mskou72I have an argument to a function which is either a string or vector. How can i convert it so I'm sure its a vector?
10:04gfredericksmskou72: what should "foo" be as a vector?
10:04Anderkentgfredericks: I guess that's something with the oracle driver not discarding the previous resultset as you ask for a new page?
10:04Anderkentthough you don't even ask for the next page
10:05gfredericksafaik it's just plain ole eager
10:06Anderkentwell, c.j.jdbc isn't; but the underlying driver might be
10:06mskou72the vector should just contain the one string.
10:06Anderkentin which case you're screwed I guess?
10:06gfredericksAnderkent: that's been my assumption the whole time
10:06gfredericksmskou72: ##(let [arg "foo"] (cond-> arg (not (vector? arg)) (vector)))
10:06lazybotjava.lang.RuntimeException: Unable to resolve symbol: cond-> in this context
10:07AnderkentI remember talking with someone yesterday about a similar issue, except he got :result-fn #(doall (take 25 %)) to work, so the underlying driver had to be at least page-level lazy
10:07gfredericks,(let [arg "foo"] (cond-> arg (not (vector? arg)) (vector)))
10:07clojurebot["foo"]
10:07mskou72ok, thanks!
10:07gfredericksAnderkent: yeah I figured it's the PG driver; I can't imagine why this is the default behavior, though maybe it's some ACID detail
10:08Anderkentgfredericks: http://stackoverflow.com/questions/984073/java-jdbc-lazy-loaded-resultset might help?
10:08AnderkentI guess thats what you found, they mention auto-commit
10:08gfredericksyep
10:09gfredericksAnderkent: thanks!
10:15xificurC,(re-seq #".\*." "ab*b*c")
10:15clojurebot("b*b")
10:15xificurChow can I change this ^ to return ("b*b" "b*c") ?
10:16AnderkentxificurC: you'll need lookahead
10:16Anderkenthm actually
10:17quizdrwhat is idiomatic way to slurp in a collection from a file and work with it? slurp returns a string, which is not the same thing.
10:17xificurCAnderkent: dont know lookahead yet
10:17Anderkentno I was mistaken, lookahead doesnt do it
10:17Anderkentlemme think
10:17CookedGryphonhey, I'm trying to get native android libs out of a fat jar using lein-droid
10:18edbondquizdr, reader/read-string maybe?
10:18quizdredbond ah of course, thanks
10:18quizdr(inc edbond)
10:18lazybot⇒ 2
10:19CookedGryphondoes anybody have any tips? In lein-droid/create-apk there's a .addNativeLibraries call which takes a file
10:19`cbpxificurC: Can't be done with regex afaik
10:19CookedGryphonbut the native file I want is inside a jar in a dependency and I don't know how to get the path
10:20CookedGryphonif I had the path I could make it look through and extract all the native deps in all the jars
10:20`cbpxificurC: regex can't backtrack their steps
10:20xificurC`cbp: thought so but gave it a try. How would you solve it then?
10:22`cbpxificurC: Implement your own pattern matching
10:23cleatomare-seq is applying the regexp over and over, but it's only trying from where the previous match ended.
10:23cleatomaYou could re-use most of the regexp matching stuff, it's just if you get one match you want to start looking again from one character after the start of that match, not after the end of it.
10:24xificurC`cbp, cleatoma: well thats a pain, I was thinking of something more lightweight. Anyway dont go too far helping me out, this is just an exercise
10:24edbond,(filter #(= (nth % 1 false) \*) (partition-all 3 1 "ab*b*c"))
10:24clojurebot((\b \* \b) (\b \* \c))
10:24edbondxificurC, ^^
10:25edbond:-P
10:25xificurCedbond: yeah I just wrote that myself
10:25xificurCor something very similar
10:25mklappstuhlI tried to add a git repo as a checkout to my local repository to work on the most recent state but I have no idea if that worked. Is there any way to figure out what dependencies are used when running lein ...
10:25mklappstuhl?
10:26`cbpWell I guess it depends on how fast you want it :P
10:26Anderkent`cbp: xificurC: it's definitely doable with the raw java api
10:26Anderkentjust not sure if there's a clojure abstraction for it
10:26Anderkentin java you can tell the matcher at which point to start looking
10:27edbondmklappstuhl, lein classpath | grep checkouts
10:27Anderkentso you basically do (while (.find m (.start m 1)) ...)
10:27edbondmklappstuhl, also you can check lein deps :tree
10:29xificurCAnderkent: thanks, good to know
10:32xificurCoh I'd have another question (not about clojure per se) - vim, emacs, lighttable, ..., use percentage / recommendation?
10:32xificurCI'm new to coding but I used emacs exclusively in the last year, didnt know any editor before
10:33`cbpi use emacs 100% for clojure
10:33`cbplighttable feels better for clojurescript but its still buggy as a dog
10:34mklappstuhlxificurC: I used vim for Clojure and it works pretty well
10:35xificurCmklappstuhl: with a repl in vim as well?
10:35Anderkenta full repl in vim is always awkward
10:35xificurCI just see this constant vim vs emacs battle on the net
10:35`cbplike right now it's been dling version 0.6.4 for 10 minutes now even though i updated yesterday..
10:35AnderkentI've used foreplay without issues
10:35Anderkentuhm, I mean fireplace
10:36xificurCand thinking if there really is anything to fight about or its just preference
10:36Anderkentwell, yeah vim vs emacs is a thing
10:36xificurCI mean, are the vim commands THAT faster and more powerful?
10:36Anderkentemacs I'd say is a bit better suited for clojure; but if you already know vim the pain of switching might not be worth it
10:36mklappstuhlAnderkent, xificurC yeah fireplace is really good. but if you've been using emacs for the last year, there is not really a reason to use vim now..
10:36Anderkentoh, sure.
10:36elfenlaidxificurC, why not to try it yourself :) but, ghm, light table is quite interesting
10:36xificurCAnderkent: i know emacs only actually
10:36Anderkentthen I don't think changing just to use clojure in vim is worth it
10:37xificurCI tried vim for 2 days now, going through some tutorials, just to know the difference
10:37Anderkenti've been playing with lighttable from time to time too
10:37mklappstuhledbond: lein deps :tree just renders whats in project.clj — I have a more up to date dependency in checkouts, that I'd like to test on, but I don't know if it's properly loaded
10:37xificurCbut havent created an opinion yet
10:37Anderkentthink trying both is pretty hard; both have a steep learning curve
10:37Anderkentyou'll spend a lot of time just getting proficient in both
10:38xificurCAnderkent: well i love a challenge :)
10:38edbondmklappstuhl, remove dependency from project.clj
10:38Anderkentsure, but why not pick a challenge that will actually acomplish something :P
10:38edbondmklappstuhl, did you try lein install? maybe an easier option if you don't plan to hack checkouts source.
10:38xificurCits true that i don know all of emacs yet but I can do the code editing just fine. What I lack is knowledge of advanced features
10:38Anderkenteh, well, if you find it fun feel free :)
10:38mklappstuhledbond: no I didn't. how would I do that?
10:39edbondmklappstuhl, go to project dir and run 'lein install'
10:39mklappstuhlto the project I want to use?
10:39mklappstuhlwould I leave it in the :dependencies array?
10:39edbondthen update dependencies in your project to use latest version. -SNAPSHOT
10:39mklappstuhlerr, list
10:39xificurCAnderkent: actually i was thinking of trying viper on emacs, I dont want to switch to vim completely
10:39xificurCbut to work with viper you gotta know the vim commands
10:40edbondmklappstuhl, yes, install project you want to use and update your deps
10:41mklappstuhledbond; is lein install global or would I do that in the same dir where the depending project is?
10:42Anderkentmklappstuhl: it's global. it puts it into your ~/.m2/repository
10:42mklappstuhlAnderkent: ah, ok. that explains it
10:43`cbpxificurC: http://emacsrocks.com/
10:43`cbpvim is too ghetto imho
10:43Anderkentlet's not turn this into a flamewar
10:43xificurC`cbp: yeah I saw them
10:44xificurCAnderkent: not my attention at all, I just wanted to know more about both sides
10:44AnderkentxificurC: I was adressing `cbp more than you :P
10:45xificurCAnderkent: i know but indirectly it would still be my mistake bringing up the topicc
11:06TimMcxificurC: Don't worry, this channel is fairly... mature about the topic.
11:07TimMcLots of people here use vim *and* emacs, for that matter.
11:10xificurCTimMc: thats what I expected anyway, just like people are willing to learn multiple languages they should be willing to learn multiple editors/IDEs
11:10xificurCits funny tht
11:11xificurCthat even after a year of trying the functional I still find it often simpler to write something the imperative way
11:11xificurCnot all of course, many things are much simpler when written functionally
11:12devnTimMc: Yeah, I use both.
11:12devnI have both open right now.
11:13carkmany things are easier to express in the imperative style... functional programming really only shines for larger projects in my opinion
11:14carkhum that's not entirely true ... what i really mean is that you reap the benefit later for a little suffering right now
11:15CookedGr1phonI find it's really easy to hack together something that works for this particular case you're looking at with imperative... but as soon as you throw something out of the ordinary at it it'll break, where with functional for only a little more though, you get something that's resilient and works in all sorts of cases you hadn't even thought of
11:15carkyes
11:15CookedGr1phonjust generally a lot less brittle
11:15CookedGr1phonthough that's a lot to do with types too I guess
11:16AnderkentI find cases where it's easier for me to write imperatively rare, unless we count stuff like firing of a python repl to do a scan through a file or something
11:16Anderkentthat I do a lot.
11:18carkthere are so many cases where just doing it imperatively is so much easier
11:18carklike maybe expressing a graph
11:18carkcircular references
11:19carksure it's easy to have a map from id to node and express your dependencies that way ... but you have to admit, imperative is alluring in such case
11:22BobSchackcark have you seen Brandon's talk about graphs?
11:23carki haven't
11:23carkdo you maybe have a link ?
11:23BobSchackcark: http://www.youtube.com/watch?v=j649Tr25RyA
11:23carkthanks i'll check it out right away !
11:24BobSchackhe talks about how circular reference are evil and how to do trees functionally
11:24Anderkentweeeell, but that's assuming your data can be modelled as a tree
11:25carkyep sometimes there's no way around it, there has to be some circular references
11:56Anderkentanyone know an algorithm for finding minimum crossing arrangement between two rows of points (connections are between points on seperate rows or the same row)
11:57Anderkentmy initial attempts are like O(n^6) worst case
11:57clgvAnderkent: I am not sure I understand the problem description fully.
11:58clgvdo you have a small example of that problem or a formal description?
11:59Anderkentimagine two lines of points one above the other
12:00Anderkentand some links between your points - you can assume the graph is connected
12:00Anderkentyou can only swap a node with a node in the same row
12:01Anderkentget minimum number of links crossing
12:01Anderkentit's easier to draw than describe
12:01clgvah ok
12:06clgvI dont recall a similar graph problem right now. graph layout algorithms may face similar problems
12:07clgvbut the good ones for large graphs are mostly inexact heuristic algorithms
12:09`cbpoh lighttable you mess everything up for international keyboards!!
12:14moquistI've been using emacs+EVIL+cider for a while now, but I haven't taken full advantage of cider's keyboard shortcuts. AFAICT, I just don't have them bound. For example: "C-c M-e is undefined" I'm using cider. I'm in clojure-mode. Where should I look to figure out what's breaking (e.g.) "C-c M-e"? I'm actually new to emacs itself, so don't shy away from telling me basic things that may be obvious to others...
12:20broquaintmoquist: 'C-h m' might be a good place to start, also 'C-h k' generally.
12:21stuartsierramoquist: you probably to add some initialization to allow CIDER to add keybindings to clojure-mode. Check the CIDER docs.
12:26moquistbroquaint, stuartsierra: OK, thx. I'll see what I can figure out.
13:10semperoscan't seem to get Om's om.dom/option onChange handler to fire, no problem with other elements; anyone had experience or have insight?
13:16dnolen_semperos: I don't believe it's option that fires on change, rather select
13:16teslanickWhen would an option change?
13:16teslanick^
13:18dnolen_I mentioned this in #clojurescript, but probably worth mentioning here as well - there's a new txq branch which lets you listen on all transactions on the app state
13:19dnolen_so in Om you will be able to observe every change to the app state and you get a tag, a root cursor, and a map containing change path, old / new value on that path, as well as the old and new app state
13:19dnolen_(think rollbacks)
13:19dnolen_the breaking bit is that every transact! or update! call must be given a tag, since often there's not enough information in the previous/new value
13:20dnolen_if you're feeling adventurous give :tx-listen a try and feedback would be most welcome - the counters example in the txq branch uses :tx-listen if you're looking for an example.
13:21dnolen_https://github.com/swannodette/om/blob/txq/examples/counters/src/core.cljs
13:21dnolen_signature for anonymous fn on line 59 should be (fn [tag root tx-data] ...)
13:21dnolen_will fix that later today
13:29gfredericksI have a seemingly simple streaming problem that I can't tell how to solve with built-in java stream stuff
13:30gfredericksgiven a lazy seq of strings from a jdbc query result, lazily concat & gzip, presenting the result as an InputStream to an http request
13:31gfredericksI can't think of anything that doesn't involve siphoning between input streams and output streams and then the requirement to keep it lazy seems to require a lot of manual effort
13:31gfredericksi.e., I'm going to end up subclassing something
13:33pjstadiggfredericks: use piped streams?
13:33amalloygfredericks: well like, SequenceInputStream
13:33amalloyand for gzipping, i think you do have to use one piped stream
13:33gfredericksamalloy: yeah I started with that
13:34gfredericksamalloy: pjstadig: are piped streams a built in thing or a technique?
13:34amalloybuilt in
13:34pjstadigat least with piped streams at least you don't have to do the siphoning yourself
13:34amalloythey take more work than unix pipes, because you have to fork the thread to read them yourself, as opposed to the process starting implicitly
13:34pjstadiggfredericks: https://github.com/pjstadig/es/blob/master/src/pjstadig/es.clj#L101-L120
13:35llasramgfredericks: If you want to live on the edge, there's also https://github.com/ring-clojure/ring/pull/115
13:35gfredericksI'm gonna have to pipe twice, won't I? SequenceInputStream -> GZIPOutputStream -> SomethingInputStream?
13:36llasramOh, HTTP request, not ring HTTP response
13:36amalloygfredericks: there's also https://github.com/amalloy/ring-gzip-middleware/blob/master/src/ring/middleware/gzip.clj#L38
13:37amalloyi haven't worked out whether this is quite what you need, but it's related
13:37gfredericksamalloy: it looks eager
13:37gfredericksthe doseq in the future
13:37amalloyoh, for sure
13:38amalloywell
13:38amalloybut also piped input streams have a limited buffer size, and block if it gets too far ahead
13:38amalloyso it's not quite as eager as you might think
13:38gfredericksclojurebot: the doseq in the future |would be| a great name for a rock band
13:38clojurebotIk begrijp
13:38gfredericksamalloy: oh that's good to know
13:39gfredericksthanks amalloy pjstadig llasram; not sure how I forgot about these
13:40amalloygfredericks: sounds more like a movie or novel title
13:41amalloygfredericks: and flatland/io has concat-input-streams, so you don't have to deal with SequenceInputStream yourself: https://github.com/ninjudd/io/blob/develop/src/flatland/io/core.clj#L30
13:43amalloyi had forgotten this, but apparently we even make Seqable participate in clojure.java.io, so that you can just call (input-stream [a b c])
13:43llasramwha
13:43llasramWhat does that even do?
13:44amalloyllasram: if a, b, and c are input streams, it yields a nwe input stream which is the concatenation of them
13:45llasramInteresting
13:48semperosdnolen_: thank you for the feedback (and your continued progress on Om), will give it a look
13:49danneuAre there any options for getting a part-time job as a developer?
13:50daccdoes anyone have a mixed java/clojure lein project working? i tried following these instructions, but precomp compile still does javac -- not sure how to disable that https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md
13:50amalloyi'm pretty sure this universe does contain people who work part-time as developers, danneu
13:50dacc(i tried :java-source-paths [] inside the profile)
13:50dacc.. but i think it's merging anyway. maybe need two profiles
13:51technomancydacc: maybe :prep-tasks ^:replace ["compile"] if you want java that depends on clojure
13:51technomancydacc: hyPiRion blogged about this a few days ago
13:51hyPiRiondevn: woah, nice timing there
13:51dacctechnomancy: thanks i'll look
13:51hyPiRion*decc
13:52hyPiRiondacc: http://hypirion.com/musings/advanced-intermixing-java-clj
13:52danneuamalloy: haha, right. I mean to ask what kind of avenues are available? I've never seen a listing for a part-time developer gig.
13:52danneuMaybe someone here works part-time
13:53gfredericksamalloy: a movie or novel based on the rock band of course
13:53dacchyPiRion: cheers, just found it =)
13:53hyPiRionYou can also do https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md, but I feel it's a bit over the top if you only need one or two compiled Clojure namespaces before javac
13:53dacchyPiRion: ok thanks
13:54llasramWow, these make Java 8 look like it might actually be a language for programming: http://www.java8.org/
13:58gfredericksjava is the new clojure
13:58ystaellooks more like the new scala though
13:58TimMcllasram: Hey, maybe now *Clojure* will get method references.
13:59hyPiRiongfredericks: what, Java uses s-exps now?
13:59llasramTimMc: I'm just going to start actually using https://github.com/llasram/method-fn
14:00danneuMy Github is mostly a dumping ground for unfinished/exploratory projects from my ~/Code folder. Do yall think it does more damage than it's worth to have sloppy repos when looking for employment?
14:02technomancydanneu: no one sensible would penalize you for posting learning projects; you should be judged on your best work, not your early stuff
14:02jconnollyi have a private github account where i have what i consider my "please don't judge me for employment on these" private repos
14:02hyPiRiondanneu: No, but don't use GH as a resume. Insteead, specify some projects you are satisfied with in your resume.
14:02jconnollyrather, paid github account
14:02danneuWhat if your best stuff is all running in production?
14:03danneurather, the code isn't released
14:03jconnollyand proprietary... welcome to my world
14:03hyPiRionjconnolly: if it's for yourself only, you could consider using bitbucket
14:03technomancydanneu: then you convince folks to relicense it
14:03jconnollyhyPiRion: good call.
14:03TimMcheh
14:03technomancythe idea that your competitors will eat your lunch if they can see it is completely preposterous 90% of the time
14:04hyPiRiondanneu: either what technomancy said, or you could get a reference from them along with what you have done/do
14:04jconnollywe try to carve out parts of our codebase that might be useful to open source, but it's not a mandate by any means
14:04danneutechnomancy: well, it's stuff i've written and i host it. i just don't like having production code sitting in the open
14:04technomancydanneu: well, that's going to make things harder
14:04ystaeltechnomancy: what about the idea that competitors will eat your lunch if you spend the necessary time to make it a publishable release?
14:04TimMcThere's a difference between publishing the source and making a project of it, yeah.
14:05technomancyystael: what's the difference between "publishable" and "high quality"?
14:05TimMc"Here's a giant pile of code I've filed the serial numbers off of" vs. "here is a project we are publicly maintaining"
14:06danneuyeah, i guess getting a development job isn't magical. i should extract an open source project from my production code so i have something to show.
14:07technomancythe project I hack on at work is used by direct competitors
14:07hyPiRiondanneu: At work, I tend to decouple some parts which seem to be completely irrelevant to what we do from the "main" projects. I then publish those on GH if I get an ok from my boss.
14:07technomancyhttp://blog.appharbor.com/2013/07/01/introducing-realtime-logging
14:07ystaeltechnomancy: TimMc and I have been working for some time on a major project that we'd _like_ to open source, but there's a substantial distance between "feature complete for business needs" and "feature complete for the standard we purport to implement". And I don't know that we're going to get the time to traverse that distance.
14:08technomancyystael: I don't understand why feature-completeness is a prerequisite to changing the license
14:09TimMcI think the biggest part of open-sourcing it would be teasing out the business logic.
14:09technomancyTimMc: which you should be doing anyway, right?
14:10TimMcUnfortunately, that's not necessarily what I would get paid to do.
14:10hyPiRiontechnomancy: yes, but time
14:10technomancythe things you need to do to make it "presentable" is a subset of the things you need to do for proper engineering
14:11technomancyhyPiRion: sure; "we don't have time to do it properly" is fine, but then you shouldn't be implying that the codebase is something you'd like to show to someone interested in hiring you =)
14:11hyPiRiontechnomancy: It's not fine, but it's stupid bosses and marketing guys assuming we can get stuff done in half a second =/
14:12technomancyyeah =(
14:12TimMcSo let's say we release it, and then someone else submits a big PR to make the code more general. That would probably require a partial rewrite of our business logic to make it mate with the FL/OS component again. That "needlessly" (from a business standpoint) perturbs a service that was doing just fine.
14:13teslanickhyPiRion: http://www.youtube.com/watch?v=8xRqXYsksFg
14:13technomancyTimMc: it sounds like you're getting other people to pay off your technical debt for you?
14:13TimMcAnother option is to release it without references to the company so that if it decays or isn't maintained, it doesn't reflect badly on the company. :-P
14:13technomancyhaha
14:13TimMctechnomancy: There's debt and there's debt.
14:14technomancywell, once it's released, it gives you more leverage to spend time to do the right thing from a technical perspective
14:14ystaelI don't know that we have enough of an institutional commitment to open source yet to make that a true statement
14:16TimMcYet.
14:16dacci've had opportunities to release internal stuff open source, but the extra effort to get it into a form someone else could reasonably use always seems to come out of my own hide =)
14:18technomancyit's not always practical for a given organization, but most of the immediate objections people have to it don't make sense
14:18technomancyand it's a ton easier to do it in the open from the start
14:19TimMcllasram: That's the first plausible use of tagged literals I've seen so far.
14:19llasramTimMc: Haha
14:20technomancyoh dang
14:20technomancythat is very slick
14:21TimMcllasram: I mean, (mfi String/toUpperCase) would also work as a macro, but... plausible.
14:21srrubyI'm running into a case where (= parsed (postwalk identity parsed)) is returning false. parsed is a vector. Am I using postwalk incorrectly?
14:21sdegutisDeclarative programming? More like declariawesome.
14:21srrubyparsed is returned by the instaparse parser.
14:22llasramTimMc: That's true :-)
14:22AeroNotixhow to check if a variable is undefined?
14:22AeroNotixseems like such a silly question
14:22llasramAeroNotix: Like find out if a var exists?
14:22AeroNotixbut isn't there something like: (unbound? ...)
14:22AeroNotixllasram: yeah
14:23llasramNot just?: (nil? (resolve sym))
14:23AeroNotix,(def c) (nil? (resolve sym))
14:23clojurebot#'sandbox/c
14:23AeroNotixderp
14:23AeroNotix,(def c) (nil? (resolve c))
14:23clojurebot#'sandbox/c
14:23AeroNotix,(nil (resolve c))
14:23clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
14:23AeroNotixffs
14:23AeroNotix,(nil? (resolve c))
14:23clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Symbol>
14:24AeroNotix,(nil? (resolve 'c))
14:24clojurebotfalse
14:24llasramThat said, mucking w/ `resolve` etc frequently means you're going against the grain
14:24llasramWhat's your use-case?
14:24AeroNotixllasram:
14:24AeroNotixsorry, I've had a few beers. Fat fingers
14:25llasramTimMc: That's a really, really good point, actually. Adding those macros now
14:25AeroNotixSo, a library I use defines a global default connection parameter which it (alter-root-var)'s when a connection is made
14:25AeroNotixit blindly assumes in some areas that the default connection exists
14:25AeroNotix(def *default-connection)
14:25AeroNotix(def *default-connection*)
14:26AeroNotixperhaps it'd be better to just patch it to give *default-connection* an initial value
14:26AeroNotixlike :omfg-dont-use-me-ffs
14:27llasramAeroNotix: Which library is this, so that I may never use it? :-)
14:27AeroNotixllasram: no comment.
14:27llasramhah, fair enough
14:27AeroNotixand I'll bet you already do
14:28AeroNotixif you do any LOLWEBSCALE work
14:28llasramnope
14:28AeroNotixah ok
14:28llasramI prefer to store my data in a database
14:28TimMcIs there anything like data-writers?
14:28TimMcSomethign that produces tagged literals?
14:28llasramTimMc: I think someone had a library... Struggling...
14:28AeroNotixllasram: nosql databases are still databases, just ones with differing goal.s
14:29technomancyTimMc: why not print-method?
14:29TimMcI should answer this question myself actually.
14:29llasramIt really should work that way though -- some way of getting the tag+literal objects instead of just the printed string form of the same
14:30AeroNotixjust out of interests sake, *is* there actually a way to see if a variable is unbound
14:30AeroNotix?
14:30danneujcromartie: A while back you said you were experimenting with HTML templating libs. Which one did you settle on? I recall you've mentioned Enlive since then.
14:31TimMctechnomancy: A print-method impl that emits a string with a space in it? :-(
14:31llasramAeroNotix: So the var exists, and you just wan to know if it has a root binding already?
14:31AeroNotixllasram: exactamundo
14:31llasram,(do (def foo) (.hasRoot #'foo))
14:31clojurebotfalse
14:31llasram,(do (def foo :value) (.hasRoot #'foo))
14:31clojurebottrue
14:31AeroNotixoh .hasRoot
14:31AeroNotixllasram: cheers
14:31pjstadigbound?
14:32pjstadig,(doc bound?)
14:32clojurebot"([& vars]); Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided."
14:32llasramHaha!
14:32llasramEven better
14:32jowagbound?, .hasRoot is undocumented
14:32AeroNotixGod damnit, I was trying (unbound? ..)
14:32pjstadigthat won't tell you if it's a root binding
14:32llasramThat's true
14:32AeroNotix,(def c)
14:32clojurebot#'sandbox/c
14:32pjstadigfor that you'd have to do something like (and (bound? x) (not (thread-bound? x)))
14:32AeroNotix,(bound? c)
14:32clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Var>
14:32AeroNotix,(bound? 'c)
14:32clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.Var>
14:33pjstadig,(bound? #'c)
14:33clojurebotfalse
14:33AeroNotixhmm ok
14:33llasramI'd peeked recently at the implementation of `defonce`, so that's what I remembered
14:33AeroNotixllasram: ah of course
14:34pjstadig<obligatory mention of (one of) my open Jira issues http://dev.clojure.org/jira/browse/CLJ-1077&gt;
14:35hugodis there a list of forms that core.async's go macro supports/doesn't support?
14:35AeroNotixhugod:
14:35AeroNotixmisclick
14:36hugodjust wondering about `for` and `doseq`
14:37patrkrisis guns (github.com/guns) on this channel?
14:40danneuhugod: are you having an issue?
14:41hugoddanneu: Assert failed: <! used not in (go ...) block, when using (doall (for [c cs] (<! c))) inside a go block
14:42danneuhugod: can you gist the code
14:44hugoddanneu: https://www.refheap.com/37228
14:44hugodoops, ignore the doseq comment
14:47hugodreplacing the (doall (for …)) with loop works
14:49Anderkent,(require '[clojure.core.async :as a])
14:49clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath: >
14:49Anderkentmeh
14:49Anderkentanyway
14:49Anderkent(go (doall (for [x [1 2 3 4]] (>! c x))))
14:49Anderkenthas the same issue
14:50danneuhugod: i have a weak understanding of core.async and this limitation, but i run into this assert when i have <! nested within anonymous functions, for one. which the `for` macro is rife with.
14:50Anderkentseems like core.async macroexpands the body before picking out <!?
14:51TimMcpatrkris: A user by that name does show up sometimes.
14:51Anderkentthere's a bot command to say when someone was last seen, right?
14:52Anderkentseen guns
14:52TimMclast showing up ~4k lines ago
14:52Anderkent,seen guns
14:52clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seen in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:52Anderkentdamnit :p
14:52TimMc$seen guns
14:52lazybotguns was last seen quitting 3 days and 14 hours ago.
14:52Anderkentright!
14:52Anderkenti'd get there eventually
14:55Anderkenthugod: yeah looks like core.async can't work with a for loop
14:55Anderkentwhich is a shame
14:57danneuWhy doesn't apt-get install leiningen install 2.x
14:57hugodAnderkent: Indeed - not sure if that warrants an issue. At least I can use loop.
14:57danneuI have no idea how the package ecosystem works
14:58rplacadanneu: there's always a lag and it also depends which Ubuntu you have
14:58danneurplaca: I have 13.0x
14:58rplacatechnomancy would know more
14:58Anderkentdanneu: because it takes forever to update anything
14:58Anderkentin debians repos
14:58danneuAh, got it.
14:59Anderkentalso I'm not sure if anyone here actually cares
14:59Anderkent:P
15:00danneuYeah exactly. I asked because if it was just a matter of sending a pull request somewhere, I'd do it
15:00Anderkentnah, it's a Process.
15:06danneuI bet it ensnares newcomers frequently. Running `lein` in Ubuntu even tells you to `apt-get install leiningen`. And doing so installs a very incompatible version of leiningen.
15:09sdegutisI just learned a new emoticon... :v
15:09sdegutisIt's that face! Like when you move your lips to the side in a skeptical but lighthearted fashion!
15:10borkdude:v
15:14danneusomeone recently defended their use of the insufferable "%)" as a "programmer-brained optimization" since % combines eyes and a nose into a single character. but i think the real optimization is just ")" which my russian friends all use.
15:15dacc>=-)~
15:16danneualthough they must have paredit-mode disabled in their irc buffer
15:27akurilin2Quick question: is it weird to def from within a defn? E.g. I have an "initialize" routine in my ring app where I need to fetch some stuff from a db and initialize a set of vars to the corresponding values (effectively caching some data)
15:28akurilin2I'm thinking that running a def from within that init routine would get the job done
15:28akurilin2This is a one-time caching and the data isn't expected to change, or I'd use atoms
15:31dsrxwrite once? you could use a promise
15:32TimMcakurilin2: def inside a def is basically always bad
15:34akurilin2Ok so how do I create a run-time var then that's namespace visible?
15:34gfredericksTimMc: yo dawg, I heard you like vars in your vars so I
15:35akurilin2This would be only done at initialization time
15:35stuartsierraakurilin2: `intern`
15:35gfrederickso_O
15:35TimMcstuartsierra: What no don't
15:35stuartsierraI didn't say it was a good idea.
15:35TimMcIf someone says "I need to remove this door", you don't hand them a chainsaw.
15:36ruzuyou don't?
15:36akurilin2So you guys are thinking more along the lines of atoms here?
15:36akurilin2As far as "good solutions" go?
15:36rplacaTimMc: depends how much entertainment you want
15:36stuartsierraWe already handed them Clojure, what more damage could we possibly do? :)
15:36TimMcFair.
15:36akurilin2I think I'm aiming for low entertainment value right now :)
15:36rplacajust pr it into a string and `eval` :)
15:37TimMcakurilin2: You want your defs out in the open where they are highly visible to readers and to tools.
15:37TimMcInitializing something at startup (with low entertainment value) means you'll need an extra layer of indirection: delay, atom, ref, promise...
15:38TimMcpromise sounds like the most useful here
15:39gfrederickswould stuartsierra make a defrecord and put stuff in there?
15:39akurilin2TimMc: ok let me try that one
15:40stuartsierraMy approach is https://github.com/stuartsierra/component but it is more elaborate.
15:42SegFaultAXstuartsierra: Does the capture part of what you described in your blog post?
15:43gfredericksstuartsierra: when I tried this style it made me feel a little gross that I couldn't update my record; I don't have any better ideas though
15:43gfredericksI don't remember why I would have wanted to
15:43stuartsierragfredericks: Just because the record is immutable doesn't mean it can't contain mutable references like Atoms and Refs.
15:44stuartsierraSegFaultAX: I'm sorry, I don't understand your question.
15:44gfredericksstuartsierra: I know but it feels like a weird mix, since you have to be careful
15:44gfredericksabout duplicating references to stateful objects
15:44stuartsierragfredericks: Yes, you do have to be careful. The component library is designed to help with that.
15:45SegFaultAXstuartsierra: Sorry, that was a fragment. Referring to http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
15:45gfredericksstuartsierra: I probably just need to try it with more determination
15:45SegFaultAXIs that a library that tries to encapsulate the workflow described in that article?
15:45TimMcstuartsierra: I neded multiple instances of your component framework.
15:45TimMc(kidding, kidding)
15:45sdegutisHow do you verify in your integration tests that business data are never created in an inconsistent or incomplete state?
15:45stuartsierraSegFaultAX: The 'component' library is an extension of the ideas expressed in that blog post. They are complementary, but not necessarily dependent on one another.
15:46SegFaultAXstuartsierra: Awesome.
15:46sdegutisI imagine you use preconditinos and postconditions to verify state within relevant functions?
15:48gfredericksstuartsierra: have you combined this with core.async much?
15:49gfredericksby which I just mean using both at the same time
15:49stuartsierragfredericks: A little bit, experimentally. There's nothing about the model that forbids it.
15:49sdegutisOh snap, deja vu.
15:52gfredericksstuartsierra: yeah; I found myself needing to e.g. shutdown threads that were writing to channels, since they can't tell that the channel has closed, so I had a separate system for managing core.async components, and abandoned the stuartsierra style due to not wanting a confusing hybrid; so currently I don't feel good about anything :/
15:52TimMcCould component be used to help provide instancing of namespaces?
15:53stuartsierragfredericks: Assuming the threads themselves are managed by a component lifecycle there should be a place to shut them down correctly.
15:53stuartsierraTimMc: Not as such, but components behave somewhat like parameterized modules.
15:54TimMcMight be close enough.
15:54stuartsierraI certainly use them that way.
15:54gfredericksstuartsierra: by having the threads poll a flag?
15:55stuartsierragfredericks: That's one option. Or shut down on a 'poison' message. Or have a separate 'shutdown' channel.
15:55gfredericksstuartsierra: right. okay I will probably revisit this. thanks.
15:55stuartsierragfredericks: you're welcome
16:00tjdI'm trying to output a (defrecord ...) record as edn, but prn is giving the tag as #packagename.type { ... } as opposed to #packagename/type {...}, and as i understand it from the edn spec, tags must contain a prefix component. not sure if the dot qualifies as a prefix componenet
16:05stuartsierratjd: You need a custom printer. clojure.edn doesn't have one yet.
16:06tjdcool. can do.
16:06SegFaultAXAh so component is essentially just DI for Clojure?
16:06SegFaultAX(I'm looking over the docs now)
16:07llasramtjd: If you just want it to work for individual record types, you can just define `print-method` for that type
16:07stuartsierraSegFaultAX: It's a means to achieve DI, yes.
16:08`cbptjd: https://github.com/miner/tagged
16:09technomancydanneu: there are people working on lein2 for debian, but the number of dependencies they need to package is huge. also there are issues where the licensing of certain libraries are incorrect that they have to fix before it can be included
16:09technomancy*ahem* and licensing issues with Leiningen itself =/
16:09tjd`cbp: oh, awesome! just what i was looking for. thank you.
16:10danneutechnomancy: thanks
16:31rhg135\\
16:31rhg135oops
16:34daccakurilin2: delay is a lazy promise i believe, if that helps
16:44justin_smith,@(delay 1)
16:44clojurebot1
16:47daccor rather, a lazy future
17:03sdegutiswow, so functions, very data, much immutable, nice lazy
17:05socksywhat's the current best practice for deploying something to run on AWS? lein uberjar and java via chef etc? or is there a more idiomatic way?
17:06technomancysocksy: uberjar+runit is the way to go
17:08socksyforgive my ignorance — is this runit? https://github.com/hw-cookbooks/runit
17:08technomancythat's a runit cookbook, yeah
17:09socksywhat is runit? difficult to google for
17:09gtrakis there a way to set AOT bytecode versioning in the project.clj?
17:09socksyor is it this? http://smarden.org/runit/
17:10socksywhich would be an odd thing to specify, given ubuntu has upstart and others have sysv/systemd... so I'm guessing that's not what you're referring to
17:10technomancysystemd is kind of an eldritch horror, and upstart is pretty limited
17:11technomancybut if your requirements are simple upstart is fine too
17:11technomancyI've used upstart enough to be reluctant to recommend it
17:11technomancyclojars uses it
17:12socksyI know systemd is supposed to be terrible, but it also looks to be somewhat ubiquitous in the future :)
17:12technomancydistopian nightmare future
17:12stuartsierragtrak: You mean class file versions like JDK 1.5, 1.6? I think Clojure always sets 1.5.
17:13gtrakyea, hmm.
17:13gtrakI'm getting Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class, comp...
17:13gtrakat clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463) ...
17:14gtrakbeen playing with java8
17:14stuartsierraThat's a new one on me.
17:27oskarkvDoes anyone know what's going on here? http://stackoverflow.com/questions/21714704/my-logging-with-robert-hooke-does-not-work-properly-with-tools-namespace-refre
17:28amalloyi mean, robert.hooke mangles vars, and you replaced those with brand-new non-mangled vars
17:29brehautgfredericks: ive run into javascript + css head-holding again. /me despairs
17:30amalloythat's basically all there is to it? it's as if you didn't have robert.hooke at all, after you refresh the values it mucks with
17:30amalloybrehaut: any time i deal with javascript and css i have to hold my own head too
17:32brehautamalloy: responsive design (while a good thing) makes it so much worse :/
17:33seangrovebrehaut: Doesn't bootstrap pretty much make it a non-issue?
17:33brehautlol
17:34systemfaultbootscrap...
17:37brehautseangrove: maybe if you are just a developer who needs to ship some stuff on the web then bootstrap is fine. for design agency stuff its not going to fly
17:38brehautseangrove: however, for basic responsive stuff, bootstrap doesnt really provide anything if you know what you are doing. basic responsive is easy. its complicated the design changes drastically at different breakpoints responsive that is just hard
17:39oskarkvamalloy but I run add-hook each time I run the code. It's just that the code that calls add-hook can't even find a var with the correct name in the namespace. In the summary I don't even mention robert hooke
17:44oskarkvamalloy Hm, maybe robert hooke has something to do with it anyway. I did just try it for vars that had been subject to robert hooke. But, is there a solution? How do I find the correct vars after refreshing?
17:52oskarkvamalloy Hm the problem happens even if I don't use robert.hooke
18:07gfredericksbrehaut: I predict that by 2017 "slash me" is going to be part of the standard teenager lexicon
18:08brehautgfredericks: they're bound to pickup something far more obtuse
18:08gfrederickslike "colon slash slash"?
18:09brehautsounds painful
18:09gfredericksmaybe something from swearjure
18:15shriphanihi. any advice on getting the cljs repl to speak to the browser. It takes 5-ish mins to connect.
18:16pbostromshriphani: refresh your browser after connecting the repl
18:16shriphanipbostrom, done that
18:17shriphani(+ 1 1) hasn't returned yet
18:17clojurebot2
18:17pbostromsorry that's all I got
18:20ivanshriphani: did you try austin?
18:20shriphaniivan, no. I am just following the modern-cljs tutorials and I was not sure if it would interfere.
18:20shriphanishould I use austin ?
18:20ivanprobably; not certain it will solve your problem though
18:20ivancould be a browser issue
18:22shriphaniso how do I check if it is a browser issue ?
18:22shriphaniI restarted my browser
18:22shriphanivisited the page in question
18:23ivanuse the Firefox inspector or Chrome Dev Tools to look for errors; try a clean browser profile
18:25shriphaniI can open the js file and see the compiled stuff
18:25shriphaniin the browser i.e.
18:27pbostromshriphani: you can also look at the network tab to make sure your app is connecting back to the repl
18:27acronHi everyone
18:27acronI'm having difficult with clj-mail 0.1.5
18:27acronKeep getting the following warning
18:27acronWarning: *session* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *session* or change the name. (clj_mail/core.clj:6)
18:28shriphanigoog.require could not find: domina
18:28shriphanithat's neat
18:28technomancyacron: probably the library is designed for clojuer 1.2 or older
18:28acronBah :(
18:29sdegutiswomp womp
18:29acronHow can I actually see the src?
18:29acronThe version on github looks like it *does* define session as dynamic...
18:30acronhttps://github.com/MayDaniel/clj-mail/blob/master/src/clj_mail/core.clj
18:30shriphanipbostrom, I don't see a repl process
18:33acronAlternatively then, can anyone recommend any decent mail libraries?
18:34pbostromshriphani: your cljs source should have (repl/connect "http://localhost:9000/repl&quot;) somewhere, and then when you load the compiled js in your browser you should see that connection loaded in the network tab (if using chrome)
18:34shriphaniyep I have that call to connect
18:34akurilin2technomancy: just checking with you: does it make sense that a ring app started with lein trampoline won't pick up changes in checkouts/ ?
18:35shriphaniso I do lein deps and it checks out
18:35shriphanibut it can't find domina
18:35shriphanihow is that.
18:35technomancyakurilin2: not really, trampolining shouldn't affect the classpath
18:35technomancyit might affect auto-reloads; those are kinda iffy
18:35technomancybut the changes should be visible
18:36bob2is there a style consense on which of (:foo somemap) (somemap :foo) and (get somemap :foo) to generally use?
18:37broquaintThe first is idiomatic, bob2.
18:37bob2ah, thank you
18:38akurilin2technomancy: yeah I could only see changes in the local dependencies after running lein install
18:38akurilin2without trampoline it works just as expectred
18:39sdegutisbob2: whoa you're here too
18:39akurilin2Not really a dealbreaker for me since in production it uses the local repo anyway
18:39technomancyakurilin2: does reading the classpath under `lein trampoline repl` show you src/ of the checkouts?
18:40bob2not a coincidence - I've used emacs for like 15 years, and python for 10, and clojure reminds me of a lisped python with a much happier deployment story
18:40sdegutisbob2: :)
18:40sdegutisbob2: Except that ->> makes it way prettier to transform collections than in Python maybe.
18:41sdegutis(oh no he didn't!)
18:41bob2yes
18:41bob2I agree
18:41bob2finding python increasingly tedious
18:41gtrakI had a j2ee job, tried to escape via jython, but jython made me sad... clojure was a nice surprise.
18:41sdegutisbob2: Welcome aboard good sir, welcome aboard.
18:41gtraksimply because jython was dying and out of date.
18:42sdegutisThat seems to be an inherent problem with bridges. They're overambitious assuming the maintainers will have infinite steam to keep up.
18:42bob2it seems to be a fair bit better off these days
18:42akurilin2technomancy: yeah seems like it
18:42socksypotentially a silly question, but can I send something to an agent without printing to the terminal? I am doing a lot of these send to update a map and rlwrap is hanging.
18:43gtraksocksy: could always wrap it in a (do blah nil)
18:43bob2I do wish the jvm had better event-driven network stuff, though, instead of making me throw walls of threads at problems (even if clojure makes the wall much nicer)
18:44sdegutisbob2: future?
18:44gtrakbob2: taken a look at netty and friends?
18:44sdegutisOh. Yeah never mind.
18:44sdegutisI'm thinking of core.async or core.logic or something.
18:44bob2gtrak, yeah, netty is the sort of thing, but seemingly has really tedious apis
18:44bob2core.async just hides the threads from you
18:44socksygtrak: I thought of that, but the way send works is to apply the function to the agent state, and then set the agent to the return value of that applied function. Returning nil will set it to nil
18:45gtrakbob2: you'd want aleph maybe, it's a clojure wrapper
18:45bob2which is good, I think in most cases you want an abstraction above threads, but when I want to just do 100 000 slowish http requests as quickly as possible, I don't need to block them in threas
18:45gtraknot sure where threads have to enter into it
18:45bob2gtrak, ah, I had heard of but not looked at it yet - cheers
18:46gtrakthere's a wrapper over the async httpclient
18:46gtrakbob2: https://github.com/neotyk/http.async.client
18:46gtrakand I think this can do it too: http://http-kit.org/
18:47gtrakyou can throw that into core.async without threads in between.
18:47gfredericksgtrak: our lunch group (15-20 people) spent an hour playing with your disassembler on monday; great fun
18:47gtrak:-)
18:47gtrakI showed it to a group of rubyists last night.
18:48gtrakalong with reducers over a proc.
18:48gtrakjruby proc..
18:48gfredericksdo you know why (disassemble (def foo 42)) is so crazy? is it disassemble's fault or def's fault?
18:48gtrakhrm.. well it would be disassembling the return value, which is the var, yea?
18:48bob2ah, it wasn't clear to me based on http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io/#httpkit whether go-ing httpkit was sensible or not
18:48gfredericksI guess; don't know what that means wrt what it will do though :)
18:49gtrakVar.java would be the thing
18:49gtrakthat is disassembled
18:49gtrakit's got a lot of stuff in it
18:50gtrakbob2: he's using a go block in the callback.
18:53gtrakgfredericks: it was the most heinous thing I could think of in a short amount of time: https://github.com/gtrak/jvmrubyists/blob/master/src/jvmrubyists/core.clj#L129
18:54bob2is there anything sensible to point flymake at for clojure code?
18:54sdegutisHmm, I've never used flymake.
18:55sdegutisbob2: I can't think of anything offhand. Even if there were, they'd probably require loading a new JVM just to work, unideal for this task.
18:55bob2well, I'm ok with telling cider to load ma file and do a thing to it
18:55bob2or having cider run something
18:56gtrakbob2: if you can think of a good nrepl middleware, it goes here: https://github.com/clojure-emacs/cider-nrepl
18:56bob2basically, I don't want to find out about typoes at 'lein test' time
18:57sdegutisHmm, you may be able to write a little function that tries calling "(read)" on whatever Clojure forms you give it, and report on the error it gieves.
18:57sdegutisSounds like it could work, with a smart enough mind.
19:00justin_smithbob2: maybe lein check?
19:01bob2justin_smith, can I invoke that in the repl?
19:01justin_smithwell, you could just have a dedicated process that calls load on the file
19:02technomancydoesn't flymake assume you'll keep going after a compilation failure?
19:02justin_smithyou likely wouldn't what to do that in a repl that you were using for general interaction though
19:02justin_smithtechnomancy: I think it re-invokes when you save?
19:02justin_smithcould be wrong
19:03technomancyyeah, I guess only getting one failure at a time isn't a big deal
19:04bob2ah, 'lein check' just does a load on each file anyway
19:04justin_smithhttps://github.com/illusori/emacs-flymake oh, someone's been improving flymake
19:05justin_smithand I guess it's not just a question of running when it saves, - though with clojure, for sanity's sake, you may want to only capture / only check when you have balanced forms
19:05bob2yeah, it's a lot better than it used to be
19:05technomancycheck also turns warn-on-reflection on
19:06justin_smithshouldn't be too hard to launch a grench load with warn-on-reflection
19:06bob2can I have something else show me unbalanced forms? paredit mode only seems to complain when I'm on the form
19:06justin_smithwith the load being done on a temp file derived from the state of the buffer
19:06technomancybob2: reindenting helps with that
19:07bob2technomancy, hm, what specifically do you mean?
19:07justin_smithhit tab to make emacs indent the line
19:07justin_smithif it indents weird, your parens are weird
19:08bob2hah
19:08justin_smith(or indent-buffer, indent-region etc.)
19:08bob2it's usually the trailing ones that are screwed for me
19:08technomancyif you don't close your parens, the next defn will not be in column zero
19:08justin_smithbob2: indent-buffer will make trailing parens indent other forms afterward
19:08justin_smith(missing trailing parens that is)
19:08bob2true
19:09justin_smithlooks like as far as I can tell flymake is still not modular - though that doesn't mean it wouldn't be hard to add a new flymake setup from the outside
19:09bob2I guess I really want what I had for python - run flake8 from flymake and it'll show syntaxerrors, indentation errors, unused imports, some style mistakes
19:10justin_smithmaybe you want kibit
19:10bob2I want it even more now 'lein checkall && lein test' takes 10x longer than 'nose' did
19:10justin_smithhttps://github.com/jonase/kibit
19:10bob2I use kibit, it's more about a) having it overlay the buffers, as the awesome clojure-test stuff does, and b) not eating jvm start time so often
19:11justin_smithbe sure to turn on the option that emails technomancy to tell him you are using when for the return value
19:11justin_smithso he can judge you
19:11technomancyM-x look-of-disapproval
19:11technomancybob2: that sounds like a great fit for nrepl-discover actually
19:11technomancyhttp://p.hagelb.org/clojurewest-2014.org.html
19:12justin_smithbob2: I'd say whatever you want to flymake, you need to extend flymake for that tool, just suggesting kibit could be a tool / the tool to use
19:12bob2technomancy, yeah, you mentioned it yesterday, was hoping there'd be code today ;p
19:12bob2justin_smith, right
19:12technomancythere's code!
19:12technomancyhttps://github.com/technomancy/nrepl-discover
19:12technomancyit's kind of scattered all over the place
19:14bob2oh, awesome
19:18bob2technomancy, ah, btw, nrepl-discover.el is lacking a dep on nrepl
19:18technomancyah, thanks
19:20bob2probably a stupid question, but is cider a fork of nrepl, and both are maintained?
19:20technomancyit's just a rename
19:20bob2ah
19:21dsrxit's a rename along with a hundreds of comments long bikeshedding issue deciding on a new logo
19:21bob2obviously
19:21bob2gotta tackle the big issues first
19:22bob2what action will trigger 'lein' to install dependencies listed in ~/.lein/profiles.clj {:user {:dependencies ?
19:22technomancybob2: anything calculating the classpath
19:22technomancyrun, compile, check, test, classpath, deps, maybe more
19:25bob2http://bpaste.net/show/gBq1mDKPdh8RTHGQk6Wt/
19:26technomancybob2: miiiiight need to lein install from source
19:26technomancybit of a mess right now; sorry
19:26technomancysimplest actualyl to just `lein repl` in the nrepl-discover project itself
19:27bob2oh, no worries, just interested in trying to implement the stuff above :)
19:29bob2hah, Exception in thread "main" java.lang.UnsupportedOperationException: nth not supported on this type: core$require
19:30amalloybob2: (ns foo require ...) instead of (ns foo (require ...))
19:31amalloyfrom your tone i think you knew that already, but just in case
19:31amalloyor, well, i guess that would be a different error, wouldn't it. i'm curious what was actually wrong
19:36bob2ah, I see what's happening
19:38bob2missing char in instructions, and me missing that I need to do 'lein repl' in the source before I can edit profile.clj :)
19:39bob2nrepl.discover.sample still seems unimportable
19:42technomancybob2: are you running 0.1.0? that one doesn't have that ns; you need master
19:43benkayso I have a vector of byte-arrays, and I'm failing to come up with a sensible way to collapse them into a single large byte array short of iterating across each byte in each array and aset-byte'ing everything. what's a better way to accomplish what i'm trying to do here?
19:44bob2technomancy, yeah, this is 'lein repl' in master of it
19:45technomancyweird
19:47bob2erk, I lie, sorry - 'lein repl' is fine, it's requiring nrepl.discover.sample that fails, and that's one of the lines the README.md suggests putting in profile.clj
19:50socksyplaying with agents some more, I don't think I'm fully understanding them
19:50socksyin this mock example, it prints "{}" — how come? https://www.refheap.com/37614
19:51amalloybenkay: https://github.com/ninjudd/io/blob/develop/src/flatland/io/core.clj#L50
19:52amalloyi don't remember if it's perfectly optimized or has some unnecessary slowness, but it does exactly what you wanted, at least
19:52benkayoooooo
19:52benkaythanks amalloy
19:54amalloysecond time today someone's wanted a function that already exists in flatland/io. weird
19:59ninjuddamalloy: good thing i didn't delete that repo yesterday. i was wondering why it existed
20:04socksyjust realised map is done lazily, so putting a doall around it solves the example I gave
20:13kristofjava 8 has first class functions, zomg
20:13sdegutisI have an overwhelming urge to post only serious deep thoughts on reddit and only funny gifs on hackernews.
20:13kristofwill clojure's compiler get a deep refactoring accordingly?
20:15technomancykristof: no; clojure is a long way away from requiring java7 features, much less java 8
20:15kristofoh okay :(
20:18bob2sdegutis, wouldn't want to the lower the considered and open tone of hn like that
20:20sdegutisI think it's some weird kind of existential angst mixed with disillusionment settling in, possibly caused by burnout.
20:24kristofprogrammer burns out
20:24kristofposts gifs to hn
20:24kristofsounds reasonable.
20:29sdegutisthe serious deep thoughts to reddit is more far-fetched to me
20:29daccproject lambda just looks like syntax sugar for Callable and friends, no? well, besides the additions to the library.
20:33amalloy"just"
20:33daccyeah, i guess that's all it takes...
20:34daccwas trying to clarify if kristof knew of some jvm optimizations for it clojure could take advantage of
20:35amalloythe clojure compiler will probably never see any large changes to its java code again. it works, and nobody wants to do lots of work to it; if anyone does decide to put in effort like that, they'll probably port it to clojure instead
20:36amalloydacc: and of course (fn [x] (* 2 x)) is "just" syntax sugar for (reify clojure.lang.IFn (invoke [this] (throw (ArityException. ...)) (invoke [this x] (* 2 x)) (invoke [this x] (throw (ArityException. ...))) ...)
20:37daccwasn't trying to belittle syntax sugar, by any means =)
20:39gfrederickssyntax protein
20:46akaany opinions on enlive vs hivvup for my first clojure web dev project?
20:47brehautaka: hiccup is simpler to grasp, enlive is a more powerful abstraction but harder to get into
20:53akaenlive looks like an awesome solution especially since I have a designer providing static html pages. I guess I'm just gonna have to give enlive a whirl.
20:54akasee if I can grok it quickly or not
21:08holohi
21:08oskarkvhi
21:09holoI have a simple (heh) question: why keep is called that way?
21:09daccholo: called how?
21:09holodacc, keep
21:10gfredericksI think dacc means why is it named that
21:10daccooh i see
21:10gfredericksor holo means
21:10hologfredericks, yes it's me :D
21:10dacchmm, i guess it returns the keepers =)
21:11daccclojurebot?
21:11clojurebotclojurebot is not very good at indicating the difference between a return value and an exception
21:11dacchmm, how to have him evaluate things?
21:11gfredericks~keep
21:11clojurebotIt's greek to me.
21:11gfredericks,(str 'evaluate :things)
21:11clojurebot"evaluate:things"
21:11dacc,(keep identity [1 nil 2 nil 3])
21:11clojurebot(1 2 3)
21:11dacccool
21:12holooh i see.. that's a good mnemonic :D