2014-02-12
| 00:01 | benkay | ,(.byteValue 60002) |
| 00:01 | clojurebot | 98 |
| 00:11 | technomancy | is anyone using user-env-compile on a clojure heroku app? |
| 00:17 | teslanick | I might now that I know about it. |
| 00:31 | technomancy | no, don't |
| 00:31 | technomancy | it's going away |
| 00:31 | Raynes | technomancy: Careful, damn it! With great power comes... you know this already. |
| 00:33 | glosoli | What's going away ? |
| 00:37 | technomancy | glosoli: an experimental beta feature is getting replaced with something less janky |
| 00:37 | technomancy | possibly alpha, actually |
| 00:38 | glosoli | Is there some link one could read (might be of an interest) |
| 00:38 | glosoli | :? |
| 00:39 | dsrx | more official support for anvil would mean most cases of user-env-compile I can think of would be obsoleted |
| 00:39 | technomancy | sure, https://devcenter.heroku.com/articles/labs-user-env-compile |
| 00:39 | technomancy | dsrx: there are issues with making config values inputs to the build |
| 00:39 | glosoli | technomancy: thanks sir |
| 00:39 | technomancy | because we don't force a rebuild when your config values change |
| 00:40 | technomancy | which we really should if you think of them as arguments to a function |
| 00:40 | technomancy | (which is the right way to think about builds) |
| 01:37 | xsyn | *waves* |
| 01:42 | sm0ke | what is the function which basically does a reduce but returns the list of each steps result? |
| 01:42 | arrdem | sm0ke: ... what? there's iterate... |
| 01:42 | arrdem | sm0ke: but idk about a reduce that shows intermediaries... |
| 01:43 | sm0ke | for sure there was something like that in haskell |
| 01:43 | sm0ke | its prefectly viable isnt it? |
| 01:43 | bob2 | what was it called in haskell |
| 01:43 | arrdem | I mean I can see implementing it pretty easily... |
| 01:43 | sm0ke | and useful too |
| 01:43 | sm0ke | bob2: let me check on lyah |
| 01:45 | sm0ke | bob2: scanl scanr |
| 01:45 | sm0ke | ,(doc scan) |
| 01:45 | clojurebot | Huh? |
| 01:46 | arrdem | sm0ke: it's just gonna be a recursive lazy-seq... not to hard to build. |
| 01:46 | sm0ke | arrdem: yea, wanted to know if its already available |
| 01:46 | arrdem | ,(doc reductions) |
| 01:46 | clojurebot | "([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:47 | arrdem | gotcha. |
| 01:47 | arrdem | sm0ke: ^^ |
| 01:47 | sm0ke | ,(reductions + 1 [1 2 3 4]) |
| 01:47 | clojurebot | (1 2 4 7 11) |
| 01:47 | sm0ke | ,(reductions + [1 2 3 4]) |
| 01:47 | clojurebot | (1 3 6 10) |
| 01:47 | sm0ke | awesome! |
| 01:48 | sm0ke | (inc arrdem) |
| 01:48 | lazybot | ⇒ 20 |
| 01:48 | arrdem | holy shit. 20 karma? |
| 01:49 | sm0ke | what i particularly like is the lineage starts from the first element |
| 01:50 | sm0ke | exactly what i wanted :D :D |
| 01:51 | quizdr | wow that's a useful little function to know about. |
| 01:51 | quizdr | (inc arrdem) |
| 01:51 | lazybot | ⇒ 21 |
| 01:52 | arrdem | two karma... a new (to me) clojure.core function... dogecoin through the roof... is it my birthday? |
| 01:53 | sm0ke | heyyy inc my karma too, i was the one who asked |
| 01:54 | sm0ke | :P |
| 01:54 | Raynes | Well shit arrdem I could have taught you about reductions. |
| 01:54 | Raynes | ;p |
| 01:54 | arrdem | <3 |
| 02:02 | quizdr | (inc sm0ke) |
| 02:02 | lazybot | ⇒ 4 |
| 02:08 | sm0ke | haha |
| 02:08 | sm0ke | ok |
| 02:18 | alew | reduced is a pretty crazy function |
| 02:30 | amalloy | alew: well, it's nice, but compared to, eg, haskell, where you don't even need reduced because of laziness, reduced is nothing special |
| 02:30 | sm0ke | so guys, one more question is dont know if this makes sense |
| 02:30 | szymanowski | i 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:31 | arrdem | szymanowski: so you want writes with side-effects? |
| 02:31 | szymanowski | :) |
| 02:31 | arrdem | (dec so) ;; yes I'm still downvoting that guy |
| 02:31 | lazybot | ⇒ -7 |
| 02:32 | arrdem | szymanowski: 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:32 | arrdem | szymanowski: better would be to just have an update function that recomputes the fields |
| 02:32 | szymanowski | yes i see |
| 02:33 | amalloy | what? he didn't say he needed to mutate anything at all |
| 02:33 | arrdem | amalloy: he said he wanted parametric fields... that's an implicit update to me... |
| 02:33 | amalloy | uhhh...no he didn't? he said he wanted a map with fields in it |
| 02:33 | amalloy | it can be an immutable map |
| 02:34 | sm0ke | so i wanted something like apply, (+ (flat [1 2 3])) |
| 02:34 | arrdem | "where field are constrained to each others by relations, so i can change one field value and the change is propagated" |
| 02:34 | sm0ke | is see that apply is pretty limited |
| 02:34 | amalloy | and 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:34 | maravillas | szymanowski: not sure if it's quite what you have in mind, but you might look at https://github.com/tailrecursion/javelin/ |
| 02:34 | sm0ke | why isnt there something which just flattens in place |
| 02:35 | arrdem | ,(flatten [1 [2 [3 [4 [5]]]]]) |
| 02:35 | clojurebot | (1 2 3 4 5) |
| 02:35 | arrdem | sm0ke: works fine over here... |
| 02:35 | arrdem | ~flatten |
| 02:35 | sm0ke | arrdem: no i want an apply like functionality |
| 02:35 | arrdem | clojurebot: flatten |is| almost certainly not the tool you are looking for |
| 02:36 | sm0ke | you get my point |
| 02:36 | sm0ke | ? |
| 02:36 | amalloy | sm0ke: you want ruby/python's splat? |
| 02:36 | sm0ke | amalloy: sorry i dont know about it |
| 02:36 | amalloy | cool, cause you can't have it. it just doesn't work in a language with macros |
| 02:36 | amalloy | but it's what you're asking for |
| 02:37 | sm0ke | amalloy: why cant we have (defmarco splat [body] ~@body) |
| 02:37 | sm0ke | hmm ok that didnt made any sense |
| 02:37 | sm0ke | macros are compile time |
| 02:38 | sm0ke | amalloy: hey then how does apply works? |
| 02:38 | amalloy | apply is a language primitive, and of course you can do anything with apply that you'd rather do with splat |
| 02:38 | sm0ke | amalloy: for starters apply doesnt take other macros |
| 02:38 | amalloy | but it has to be a function, it can't be an infix operator that works in the middle of any old crazy mess |
| 02:39 | amalloy | apply isn't a macro either |
| 02:39 | sm0ke | amalloy: i really need to look into splat if you mean what i mean |
| 02:39 | sm0ke | brb |
| 02:39 | amalloy | cool, have fun. i'm going to bed |
| 02:44 | sm0ke | ok i read about it and seems to be what i want, but some how this doesnt works for me in pyhton |
| 02:44 | sm0ke | print(*[1,2,3]) |
| 02:45 | sm0ke | arrdem: so my point was print(*[1,2,3]) == print(1,2,3) |
| 02:45 | sm0ke | you see? |
| 02:45 | arrdem | sm0ke: apply does that.... |
| 02:45 | arrdem | ,(apply println [1 2 3 4 5]) |
| 02:45 | clojurebot | 1 2 3 4 5\n |
| 02:46 | sm0ke | yes but apply is hardcoded to some level before the last argument |
| 02:46 | sm0ke | you see its not ideal solution |
| 02:46 | szymanowski | i 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:46 | sm0ke | more over (apply somemacro list) wont work either |
| 02:47 | arrdem | okay... amalloy just told you we don't feature the " |
| 02:47 | arrdem | ideal solution" |
| 02:47 | arrdem | so what's the problem |
| 02:47 | arrdem | this is what you've got. |
| 02:48 | arrdem | and of course (apply somemacro) doesn't work. |
| 02:48 | arrdem | that's what `(do (somemacro ~@list)) is for |
| 02:49 | arrdem | szymanowski: 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:49 | arrdem | why the hell am I up. I'm going for a run. good luck. |
| 02:52 | quizdr | if I need to serialize some stuff into JSON, should I just generate it myself using functions like str, etc to concatenate it manually? |
| 02:52 | szymanowski | arrdem: thank you |
| 02:53 | arrdem | quizdr: does data.json not _have_ a serializer already? |
| 02:53 | arrdem | $google clojure.data.json |
| 02:53 | lazybot | [clojure/data.json · GitHub] https://github.com/clojure/data.json |
| 02:55 | mduerksen | quizdr: a lot of clojure libs are listed here, JSON parsers/serializers as well: http://www.clojure-toolbox.com/ |
| 02:56 | quizdr | nice toolbox site |
| 02:57 | mduerksen | yes, it has helped me uncounted times |
| 02:58 | mduerksen | and it is updated regularly. it does not give guidance for choosing though, thats up to you/google |
| 03:17 | _eric | is there a way to get the current index when using (line-seq)? |
| 03:17 | _eric | I'm looking for something like ruby's each_with_index |
| 03:18 | _eric | and I'm sure there's a simple way I could do something with zip, but I can't reason it out |
| 03:20 | mduerksen | _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 | _eric | sweet |
| 03:25 | quizdr | I want a string of a long random number not including its first two digits (which are usually "0.") and this just seems inelegant: |
| 03:25 | quizdr | ,(clojure.string/join (drop 2 (str (rand)))) |
| 03:25 | clojurebot | "08478211199316987" |
| 03:25 | mduerksen | _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:25 | quizdr | Is this an idiomatic way to achieve this? |
| 03:28 | sm0ke | ,(.substring (str (rand)) 2) |
| 03:28 | clojurebot | "15675975031956557" |
| 03:28 | mduerksen | quizdr: 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:29 | edbond | quizdr, long random number? ,(doc rand-int) |
| 03:29 | quizdr | ok. rand-int is no better as I'd just have to specify a very large int to get same precision. |
| 03:30 | edbond | or you can rand-nth from string "123456798" |
| 03:30 | clojurebot | Titim gan éirí ort. |
| 03:30 | mduerksen | does your random have to be cryptographically secure? |
| 03:31 | edbond | ,(repeatedly 5 #(rand-nth "123")) |
| 03:31 | clojurebot | (\3 \3 \3 \2 \2) |
| 03:31 | quizdr | no nothing fancy is required, just want to ensure totally unique file names |
| 03:31 | sm0ke | quizdr: why not use uuid? |
| 03:31 | sm0ke | ,(str (java.util.UUID/randomUUID)) |
| 03:31 | clojurebot | "782469d1-fff0-40cd-88c9-11dd9a9afce4" |
| 03:32 | quizdr | ah, didn't know about that one. nice. |
| 03:32 | quizdr | (inc sm0ke) |
| 03:32 | lazybot | ⇒ 5 |
| 03:34 | edbond | korma 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:34 | edbond | any way to get correct Date? without hour / minute /second ? |
| 03:41 | wink | sounds like a UTC problem |
| 03:41 | wink | I don't think it's incorrect |
| 03:42 | wink | edbond: do you know about https://github.com/clj-time/clj-time ? :) |
| 03:43 | edbond | wink, I think that may help. It seems that date converted to UTC from my local TZ +2 |
| 03:44 | edbond | I expected to have something like <LocalDate 2013-03-14> |
| 03:44 | wink | can't help you with your specific problem unfortunately, but have a look at joda, it usually solves my woes :P |
| 03:46 | edbond | wink, thanks |
| 03:47 | wink | yw |
| 03:51 | mklappstuhl | how can I install a lein dependency straight from git? |
| 03:53 | sm0ke | mklappstuhl: you can use lein-git-deps plugins |
| 03:53 | sm0ke | but its ugly |
| 03:57 | edbond | mklappstuhl, create checkouts dir and clone project there |
| 03:58 | edbond | mklappstuhl, https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies |
| 04:01 | sm0ke | edbond: i dont see the point if you are doing that much manual work |
| 04:01 | sm0ke | you can directly do `lein install` from the cloned project instead |
| 04:02 | sm0ke | or mvn install or whatever build system that project is using |
| 04:03 | edbond | sm0ke, yes I think you right. If you not going to edit deps or update frequently |
| 04:07 | mklappstuhl | edbond: 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:08 | edbond | mklappstuhl, it will use version you have in the directory |
| 04:09 | mklappstuhl | edbond: cool |
| 04:23 | mklappstuhl | edbond: 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:24 | edbond | mklappstuhl, remove it from project.clj, lein clean, lein repl, require/use |
| 04:45 | quizdr | here's an odd one |
| 04:45 | quizdr | https://www.refheap.com/36884 |
| 04:45 | quizdr | it actually returns a lazy collection in quotes? |
| 04:45 | quizdr | what's weird is if I don't include the "[" then it returns an actual collection as a string as you'd expect |
| 04:46 | quizdr | as if the act of making a string causes evaluation to occur of the entire string |
| 04:52 | tazz | Hey guys I am trying to convert a filter (filter #(= "foo" ) to start accepting regex |
| 04:52 | tazz | right now I get "java.lang.ClassCastException: java.util.regex.Pattern cannot be cast to clojure.lang.IFn" type of exceptions. |
| 04:56 | edbond | ,(apply str "[" (interpose "," (map #(str "\"" % "\"") [1 2 3])) "]") |
| 04:56 | clojurebot | "[clojure.lang.LazySeq@5fd031bd]" |
| 04:56 | edbond | ,(apply str "[" (interpose "," (map #(str "\"" % "\"") [1 2 3])) |
| 04:56 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 04:57 | edbond | ,(type (map inc [1 2 3])) |
| 04:57 | clojurebot | clojure.lang.LazySeq |
| 04:59 | edbond | quizdr, nice trick. Looks like a bug to me |
| 05:00 | edbond | or not, interpose returns lazySeq |
| 05:00 | edbond | ,(type (interpose "," [1 2 3])) |
| 05:00 | clojurebot | clojure.lang.LazySeq |
| 05:02 | edbond | ,(str "[" (apply str (interpose "," (map #(str "'" % "'") [1 2 3]))) "]") |
| 05:02 | clojurebot | "['1','2','3']" |
| 05:02 | edbond | quizdr, ^ |
| 05:02 | edbond | tazz, use re-find |
| 05:02 | tomjack | wow, I just looked at const__i in a fn |
| 05:03 | edbond | ,(filter #(re-find #"foo" %) ["foo" "bar"]) |
| 05:03 | tomjack | guess I sorta knew this was happening but not how exactly |
| 05:03 | clojurebot | ("foo") |
| 05:07 | quizdr | edbond i think i figured it out |
| 05:07 | quizdr | i was not using apply correctly |
| 05:07 | quizdr | the last argument to apply must be a list |
| 05:13 | pyrtsa | quizdr: To use apply with a non-list as last argument, make it not-last by appending () to the arguments. ;) |
| 05:14 | edbond | pyrtsa, then you don't need apply |
| 05:31 | pyrtsa | edbond: Haha, indeed. |
| 05:44 | danielcompton | I 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:45 | danielcompton | i.e. (do (side-effect 1) (side-effect 2)) vs ((side-effect 1) (side-effect 2)) |
| 05:45 | pyrtsa | You use do to evaluate multiple expressions for side effects. |
| 05:45 | danielcompton | Won't the second expression still evaluate both side effects though? |
| 05:46 | pyrtsa | Wrapping 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:46 | algernon | the second will evaluate (side-effect 1), and try to call the result as an fn with (side-effect 2) as argument. |
| 05:46 | danielcompton | ah of course |
| 05:46 | danielcompton | I knew I was missing something |
| 05:46 | danielcompton | obvious |
| 05:47 | danielcompton | Thanks! |
| 05:47 | pyrtsa | danielcompton: You *don't* need do when there's an implicit do, like in the bodies of (when x ...) or (fn [...] ...). |
| 05:48 | edbond | I find do needed with (if) when you have several thing in one branch. (if <cond> (do .. ..) <else>) |
| 05:48 | danielcompton | Is there something like when that will work for true and false? |
| 05:49 | danielcompton | So you don't need to wrap if bodies in do? |
| 05:49 | pyrtsa | edbond: In those cases, it might make sense to create an own function of the body of the if-true branch. |
| 05:50 | edbond | pyrtsa, sure. sometimes I just what to (prn) and remove later :) |
| 05:51 | pyrtsa | danielcompton: What would separate the else branch from the body of the if-true branch then? |
| 05:51 | arrdem | ,(println "arrdem: pong") |
| 05:51 | clojurebot | arrdem: pong\n |
| 05:52 | danielcompton | pyrtsa: 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:53 | pyrtsa | danielcompton: You can write your own macro for that. |
| 05:53 | danielcompton | so (when-if expr ((side-effect 1) (side-effect 2)) (side-effect 3))) |
| 05:53 | danielcompton | pyrtsa: That's what I started thinking as I was typing it :) |
| 05:53 | arrdem | ... so saving two characters for what? |
| 05:53 | pyrtsa | In my opinion, it doesn't read well. The outer (...) still looks like a function call. |
| 05:54 | edbond | danielcompton, just add do ) |
| 05:55 | Anderkent]away | danielcompton: 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:55 | danielcompton | Yeah, it's not the best idea |
| 05:55 | Anderkent | cond is your friend |
| 05:56 | danielcompton | even for either or scenarios? |
| 05:57 | Anderkent | well, if you can fit at least one branch on a single line, then (if expr (short branch) (do long branch)) is fine |
| 05:58 | Anderkent | but 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:25 | ohcibi | when 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:26 | ohcibi | (set (remove ...)) would work for sets but this looks kinda verbose to me |
| 06:28 | AimHere | ,(disj #{:a :b :c :d} :b :c) |
| 06:28 | clojurebot | #{:a :d} |
| 06:28 | AimHere | That the sort of thing you want? |
| 06:29 | AimHere | Oh wait, perhaps not |
| 06:31 | Anderkent | ohcibi: (set (remove ...)) is unfortunately right; a generic form is (into (empty coll) (remove pred coll)), which will work for 95% of use cases |
| 06:31 | Anderkent | and when it doesnt it'll give you back a list because fuck reasonable apis |
| 06:33 | Anderkent | ,(let [c (first {:a 1})] [c (into (empty c) (map identity c)]) |
| 06:33 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> |
| 06:33 | Anderkent | ,(let [c (first {:a 1})] [c (into (empty c) (map identity c))]) |
| 06:33 | clojurebot | [[:a 1] (1 :a)] |
| 06:36 | ohcibi | Anderkent: thanks |
| 06:38 | jowag | Is it correct to say that Atom, Ref and Var are 'stateful' types? |
| 06:38 | AimHere | Mutable is probably a better word |
| 06:38 | Anderkent | to the first approximation yes |
| 06:40 | clgv | Anderkent: are you performing a taylor analysis on that definition? :D |
| 06:44 | jowag | thanks, and what about Agents, can they be considered 'stateful' too? |
| 06:45 | Anderkent | yes, agents have mutable state too |
| 06:46 | clgv | is the Hickey word "state (change) management types" or similar? |
| 06:50 | jowag | an 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:54 | clgv | immutable but not necessarily immediately accessible. same category as delay or promise |
| 07:00 | jowag | yeah but can i call them 'stateful'? |
| 07:01 | cleatoma | That depends what your definition of "is" is. |
| 07:03 | clgv | jowag: I would not since you can not change their "state" after they have one in contrast to refs, atoms, agents |
| 07:05 | jowag | clgv: 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:18 | sveri | haha, nice topic |
| 07:26 | noidi | ,`() |
| 07:26 | clojurebot | () |
| 07:27 | noidi | ,`(~@[]) |
| 07:27 | clojurebot | nil |
| 07:27 | noidi | isn't this a bug? |
| 07:27 | Anderkent | eh, nil and empty list are kinda almost the same thing |
| 07:28 | Anderkent | ,(do ~@'()) |
| 07:28 | jowag | I've found an interesting blog about this problem: http://lalitpant.blogspot.sk/2008/01/object-state-identity-immutability-and.html |
| 07:28 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote-splicing> |
| 07:28 | Anderkent | ,§(do ~@'()) |
| 07:28 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: � in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 07:28 | Anderkent | ,`(do ~@'()) |
| 07:28 | clojurebot | (do) |
| 07:28 | Anderkent | fffs |
| 07:28 | Anderkent | ,`(do ~@[]) |
| 07:28 | clojurebot | (do) |
| 07:28 | noidi | Anderkent, no, they're not |
| 07:28 | noidi | ,(boolean `(~@[])) |
| 07:28 | clojurebot | false |
| 07:28 | noidi | ,(boolean `()) |
| 07:28 | clojurebot | true |
| 07:28 | jowag | "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:29 | Anderkent | as i said, kinda almost |
| 07:29 | algernon | noidi: ~@ unpacks, there's nothing in [], therefore nil |
| 07:29 | AimHere | Anderkent, again, no |
| 07:29 | noidi | having the opposite truthiness is not almost the same :) |
| 07:29 | AimHere | (if nil "Truthy" "Falsy") |
| 07:29 | AimHere | ,(if nil "Truthy" "Falsy") |
| 07:29 | clojurebot | "Falsy" |
| 07:29 | AimHere | ,(if '() "Truthy" "Falsy") |
| 07:29 | clojurebot | "Truthy" |
| 07:29 | Anderkent | ... that's the same exact example |
| 07:29 | Anderkent | I KNOW THAT |
| 07:30 | Anderkent | that's why I didn't say they're the same thing |
| 07:30 | noidi | algernon, it didn't unpack nil, it replaced the containing empty list with nil |
| 07:30 | AimHere | nil and false are much more similar |
| 07:30 | Anderkent | I said they're kinda almost the same thing; many core functions treat nil as empty list |
| 07:30 | algernon | noidi: you unpacked an empty list. that doesn't make sense => nil |
| 07:31 | noidi | no, I unpacked an empty sequence into a list |
| 07:31 | Anderkent | why do you say unpacking an empty list makes no sense? |
| 07:31 | noidi | so I expect to get the empty list (as nothing was unpacked into it) |
| 07:31 | noidi | instead the list is replaced with nil |
| 07:31 | Anderkent | ,(seq '()) |
| 07:31 | clojurebot | nil |
| 07:31 | Anderkent | empty list being replaced with nil is idiomatic |
| 07:32 | algernon | ,`[~@[]] |
| 07:32 | clojurebot | [] |
| 07:37 | noidi | ,(list? `()) |
| 07:37 | clojurebot | true |
| 07:37 | noidi | ,(list? `(1)) |
| 07:37 | clojurebot | true |
| 07:37 | noidi | ,(list? `(1 2)) |
| 07:37 | clojurebot | false |
| 07:37 | llasram | ,`(1 2) |
| 07:37 | clojurebot | (1 2) |
| 07:37 | llasram | ,(class`(1 2)) |
| 07:37 | clojurebot | clojure.lang.Cons |
| 07:38 | llasram | There's the case where Anderkent (IIRC?) had suggested earlier where the reader produces non-list?s |
| 07:38 | llasram | Cool |
| 07:39 | Anderkent | Yeah! Ta. |
| 07:40 | llasram | Oh, but I bet it isn't, not exactly |
| 07:40 | llasram | ,'`(1 2) |
| 07:40 | clojurebot | (clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2))) |
| 07:41 | llasram | Yeah, so the reader is producing *code* for syntax-quote, which then evaluates to a non-list? seq |
| 07:41 | llasram | Oh, you crazy LispReader you |
| 08:18 | pellis | hello |
| 08:18 | pellis | i'd like to process in parallel a list of tasks. however i only have N threads. let's say 2 |
| 08:18 | pellis | when 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:19 | pellis | any mechanism to do this? what is this called? |
| 08:20 | edbond | pellis, why do you want to free threads? throw away results? |
| 08:20 | cleatoma | I think you want interrupts: http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html |
| 08:21 | pellis | edbond: yes throw away results |
| 08:21 | pellis | i want to limit parallelism. however new items are more important to me |
| 08:21 | jph- | pellis, seems like you need some sort of queuing |
| 08:21 | pellis | so i want some kind of job stealing to happen |
| 08:22 | llasram | That's not quite what job-stealing usually means :-) |
| 08:22 | cleatoma | Hmm, 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:22 | pellis | jph-: 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:22 | pellis | however now i need to orchestrate the 2 threads i have |
| 08:22 | llasram | pellis: I think you just want your queue to actually be a stack |
| 08:22 | llasram | So that whenever threads get a new work item, they always get the most recent |
| 08:23 | pellis | llasram: correct. how do i cancel the old items? remember i only have 2 "heads" that can process items off the stack |
| 08:23 | edbond | he want to free threads as soon as new tasks arrive |
| 08:23 | pellis | if new items are entering the stack, they get priority and need to be processed instead of current ones |
| 08:23 | jph- | you'll need a watchdog or equiv |
| 08:23 | jph- | to halt current processing when new jobs appear |
| 08:23 | edbond | I think you need to use java Threads and interrupt |
| 08:24 | pellis_ | sorry |
| 08:24 | jph- | if new jobs appear at known intervals, you could simplify by using a timeout |
| 08:24 | pellis_ | once item rate is "relaxed", the threads are free to do the entire stack worth of jobs |
| 08:24 | jph- | if existing tasks dont complete within timeout, they die |
| 08:24 | pellis_ | this is like some sort of reverse-throttling |
| 08:24 | pellis_ | jph-: yep, that idea also crossed my mind. what if i'm not willing to even wait the timeout? |
| 08:25 | jph- | pellis_, i'd argue you start with a timeout rather than increasing the complexity too fast |
| 08:25 | llasram | pellis_: 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:26 | pellis_ | jph-: you are right in this argument. i want to explore the more complex solution as well :) |
| 08:26 | pellis_ | i just thought my Java isn't that polished in order to express what i need |
| 08:26 | pellis_ | i guess I'm looking for a "RingExecutor" |
| 08:27 | pellis_ | where new items in the ring will kill old items |
| 08:27 | pellis_ | and the ring's size is the size of the threadpool |
| 08:32 | llasram | pellis_: 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:32 | pellis_ | yep, ok that's good enough. i just needed to know i'm not reinventing the wheel |
| 08:32 | edbond | pellis_, look at futures and future-cancel |
| 08:33 | pellis_ | why does the abstraction of future solve this? |
| 08:34 | edbond | it runs on thread, you can cancel it. |
| 08:34 | llasram | I'm pretty sure the pellis_ doesn't actually want to cancel in-progress work items |
| 08:34 | pellis_ | llasram: yes, i do |
| 08:35 | llasram | Really? Because then you aren't guaranteed to actually ever produce any results |
| 08:35 | edbond | "id like to free up busy threads by force, and make them process the new items instead of the old ones" |
| 08:35 | pellis_ | i need to do everything i can to process the newer items first |
| 08:35 | llasram | I know, but I believe they are mistaken |
| 08:35 | clgv | jowag: 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:36 | llasram | pellis_: 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:36 | llasram | pellis_: 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:36 | pellis_ | they are arriving order of magnitues faster, however there are periods of time where there is a "low" and inactivity time |
| 08:36 | pellis_ | they are arriving in bursts so to speak |
| 08:37 | pellis_ | and i never know whats the size of a burst |
| 08:37 | llasram | So you want to produce 0 results during bursts? |
| 08:37 | Anderkent | pellis_: then you can't do newest first or you'll never produce any results until burst ends |
| 08:37 | Anderkent | rather, you want to finish the current work item then take the newest item on the stack |
| 08:37 | pellis_ | for a burst of 10 items, and 2 processing threads, when the burst "relaxes" i want the last 2 items processed |
| 08:37 | llasram | (inc Anderkent) |
| 08:37 | lazybot | ⇒ 7 |
| 08:38 | edbond | maybe async sliding-buffer is all you need. You can't be sure which items you process |
| 08:38 | pellis_ | this is like a 'debouncing' algorithm. when you do a text-completion and they don't really go to the network immediately |
| 08:38 | llasram | pellis_: 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:38 | Anderkent | llasram: the sad thing bout helping newbies 90% of the time is they don't know about inc :( |
| 08:38 | llasram | Anderkent: Haha. Yeah |
| 08:38 | jowag | clgv: I agree. the term 'stateful' is not clearly defined |
| 08:39 | pellis_ | llasram: let me think about that scenario |
| 08:39 | llasram | Anderkent: OTOH, it prevents the "Stack Overflow" effect |
| 08:39 | Anderkent | :D |
| 08:39 | pellis_ | llasram: that might be a mid-way solution, yes. |
| 08:39 | jowag | clgv: 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:40 | clgv | jowag: do you want to explain clojure's building blocks to newcommers with that categorization? |
| 08:45 | jowag | clgv: 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:46 | clgv | jowag: ah ok. then I'd categorize in mutable concepts (atom, ref, agent) and asynchronous concepts (delay, promise, future) |
| 08:47 | jowag | clgv: but delay is lazy, not asynchronous :) |
| 08:49 | clgv | jowag: yeah lazily triggered. but somehow that is asynchronous as well, since you do not know who computes its value when |
| 08:52 | jowag | clgv: same can be told of a lazy sequences, lazy seqs are not realized by those who create, but those who consume first. |
| 08:54 | clgv | jowag: 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:56 | clgv | jowag: though Joy of Clojure has futures and promises in the "Mutation" chapter |
| 08:58 | clgv | jowag: "Clojure Programming" groups delay, future and promises together in "shifting computation through time and space" |
| 08:59 | jowag | clgv: now you see there is no clear categorization :) |
| 08:59 | Anderkent | well, 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:01 | tbaldridge | clgv: it's not asyn as a deref of a delay will cause the delay to be executed on the caller's stack |
| 09:01 | clgv | from 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:01 | tbaldridge | *async |
| 09:01 | jowag | Anderkent: deref takes optional timeout, in that case it can return different result based on whether the future is realized or not. |
| 09:02 | Anderkent | ah, fair enough |
| 09:02 | tbaldridge | I think the world needs a term for "mutable, but will only be mutated once" |
| 09:02 | Anderkent | tbaldridge: lazy? |
| 09:02 | clgv | tbaldridge: 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:02 | tbaldridge | I suppose....I guess I could say "hashmaps have lazily computed hash value caches" |
| 09:03 | tbaldridge | clgv: 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:04 | tbaldridge | In that case, I don't think delay really qualifies. |
| 09:04 | clgv | saying promise, future, delay are mutable is more a view on implementation details then on the user perspective I'd say |
| 09:04 | clgv | tbaldridge: ah, delay does not support timeout deref? |
| 09:04 | jowag | clgv: I would not say that future is mutable, but that it is stateful |
| 09:05 | jowag | clgv: delay does not block |
| 09:05 | clgv | jowag: humm ok, so we need those definitions to be clear ^^ |
| 09:05 | clgv | jowag: delay sort of blocks when it does the computation. but right that is splitting hairs again |
| 09:06 | tbaldridge | clgv: 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:06 | tbaldridge | so yeah, it doesn't matter most of the time. |
| 09:08 | clgv | I think I am just arguing to group atom, ref, agent together and promise, future, delay in another group when presenting them to newcommers |
| 09:08 | jowag | clgv: yeah, I wanted to say that it does not block in sense that a thread does not wait for something to finish. |
| 09:40 | gfredericks | does anybody happen to remember how to make a c.j.jdbc query to postgres load the result set lazily? |
| 09:40 | gfredericks | generic 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:40 | quizdr | I 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:41 | edbond | gfredericks, could you use limit+offset to load in batches? |
| 09:41 | Anderkent | quizdr: 'works fine' as in doesn't break, or is the :doc metadata set properly? |
| 09:42 | Anderkent | gfredericks: I don't think you can be fully lazy with jdbc; once you close the connection the resultset is invalidated |
| 09:43 | quizdr | well, doesn't break. I didn't check meta. |
| 09:43 | gfredericks | Anderkent: I know this would be before closing the connection |
| 09:43 | quizdr | I'm refactoring now anyway. |
| 09:43 | Anderkent | as in you just want to only return the first N elements from (query)? |
| 09:43 | gfredericks | edbond: I don't know for sure that wouldn't work but it doesn't sound like the most performant |
| 09:44 | Anderkent | you can do that with :result-set-fn set to something like #(doall (take 25 %)) |
| 09:44 | gfredericks | Anderkent: I can't fit the results in memory, so I want to process them as they're coming in |
| 09:44 | Anderkent | ah. |
| 09:44 | Anderkent | do the processing in result-set-fn |
| 09:44 | gfredericks | right |
| 09:44 | gfredericks | but jdbc loads it all eagerly anyhow |
| 09:44 | Anderkent | huh. |
| 09:45 | Anderkent | that doesn't sound right; are you maybe using as-arrays? |
| 09:45 | gfredericks | nope |
| 09:45 | gfredericks | it's pretty vanilla |
| 09:45 | edbond | gfredericks, https://stackoverflow.com/questions/19728538/clojure-java-jdbc-query-large-resultset-lazily |
| 09:46 | gfredericks | edbond: that looks quite relevant, thanks |
| 09:46 | edbond | yw |
| 09:47 | Anderkent | gfredericks: that's exaclty the as-arrays issue i mentioned |
| 09:47 | Anderkent | if you're not doing as-arrays that shouldnt happen |
| 09:48 | Anderkent | gfredericks: did you play with :fetch-size ? |
| 09:48 | gfredericks | Anderkent: I'm working on that now |
| 09:48 | Anderkent | jdbc will fetch :fetch-size results at once |
| 09:48 | gfredericks | trying to figure out how it fits into the api |
| 09:49 | gfredericks | since now I have to use prepare-statement instead of query |
| 09:49 | Anderkent | I believe the default fetch size is 10 anyway |
| 09:49 | Anderkent | so it shuoldn't be the issue |
| 09:49 | gfredericks | in which case I still don't know what the issue is |
| 09:49 | quizdr | what'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:50 | Anderkent | gfredericks: can you post your query code just in case? |
| 09:50 | Anderkent | (in case there's something obvious you're missing :P) |
| 09:51 | edbond | quizdr, lein install other project and add it to dependencies |
| 09:52 | gfredericks | Anderkent: (jdbc/query db ["SELECT foo FROM bar WHERE baz = ?" quuz] :result-set-fn (constantly :foo)) |
| 09:53 | gfredericks | if I add LIMIT 5 to the query it returns :foo immediately; otherwise it OOMs |
| 09:53 | Anderkent | hm okay, that's pretty straightforward |
| 09:54 | Anderkent | try adding :fetch-size 5 to the sql query then I suppose? |
| 09:54 | quizdr | edbond run lein install inside the project directory already created with lein? |
| 09:54 | edbond | quizdr, yes, the one you depends on |
| 09:54 | gfredericks | Anderkent: adding it where? |
| 09:55 | Anderkent | ["SELECT foo FROM bar WHERE baz = ?" quuz :fetch-size 5] is where it goes I think |
| 09:55 | Anderkent | miiight be wrong |
| 10:01 | gfredericks | Anderkent: okay so it goes in a map at the front like [{:fetch-size 5} "SELECT ..." quux] |
| 10:01 | gfredericks | but setting the fetch-size still gets me an OOM, though setting max-rows doesn't |
| 10:01 | gfredericks | but max-rows truncates the result set |
| 10:03 | mskou72 | hi |
| 10:03 | gfredericks | google suggests I need to turn autocommit off |
| 10:04 | mskou72 | I 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:04 | gfredericks | mskou72: what should "foo" be as a vector? |
| 10:04 | Anderkent | gfredericks: I guess that's something with the oracle driver not discarding the previous resultset as you ask for a new page? |
| 10:04 | Anderkent | though you don't even ask for the next page |
| 10:05 | gfredericks | afaik it's just plain ole eager |
| 10:06 | Anderkent | well, c.j.jdbc isn't; but the underlying driver might be |
| 10:06 | mskou72 | the vector should just contain the one string. |
| 10:06 | Anderkent | in which case you're screwed I guess? |
| 10:06 | gfredericks | Anderkent: that's been my assumption the whole time |
| 10:06 | gfredericks | mskou72: ##(let [arg "foo"] (cond-> arg (not (vector? arg)) (vector))) |
| 10:06 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: cond-> in this context |
| 10:07 | Anderkent | I 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:07 | gfredericks | ,(let [arg "foo"] (cond-> arg (not (vector? arg)) (vector))) |
| 10:07 | clojurebot | ["foo"] |
| 10:07 | mskou72 | ok, thanks! |
| 10:07 | gfredericks | Anderkent: 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:08 | Anderkent | gfredericks: http://stackoverflow.com/questions/984073/java-jdbc-lazy-loaded-resultset might help? |
| 10:08 | Anderkent | I guess thats what you found, they mention auto-commit |
| 10:08 | gfredericks | yep |
| 10:09 | gfredericks | Anderkent: thanks! |
| 10:15 | xificurC | ,(re-seq #".\*." "ab*b*c") |
| 10:15 | clojurebot | ("b*b") |
| 10:15 | xificurC | how can I change this ^ to return ("b*b" "b*c") ? |
| 10:16 | Anderkent | xificurC: you'll need lookahead |
| 10:16 | Anderkent | hm actually |
| 10:17 | quizdr | what 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:17 | xificurC | Anderkent: dont know lookahead yet |
| 10:17 | Anderkent | no I was mistaken, lookahead doesnt do it |
| 10:17 | Anderkent | lemme think |
| 10:17 | CookedGryphon | hey, I'm trying to get native android libs out of a fat jar using lein-droid |
| 10:18 | edbond | quizdr, reader/read-string maybe? |
| 10:18 | quizdr | edbond ah of course, thanks |
| 10:18 | quizdr | (inc edbond) |
| 10:18 | lazybot | ⇒ 2 |
| 10:19 | CookedGryphon | does anybody have any tips? In lein-droid/create-apk there's a .addNativeLibraries call which takes a file |
| 10:19 | `cbp | xificurC: Can't be done with regex afaik |
| 10:19 | CookedGryphon | but the native file I want is inside a jar in a dependency and I don't know how to get the path |
| 10:20 | CookedGryphon | if I had the path I could make it look through and extract all the native deps in all the jars |
| 10:20 | `cbp | xificurC: regex can't backtrack their steps |
| 10:20 | xificurC | `cbp: thought so but gave it a try. How would you solve it then? |
| 10:22 | `cbp | xificurC: Implement your own pattern matching |
| 10:23 | cleatoma | re-seq is applying the regexp over and over, but it's only trying from where the previous match ended. |
| 10:23 | cleatoma | You 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:24 | xificurC | `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:24 | edbond | ,(filter #(= (nth % 1 false) \*) (partition-all 3 1 "ab*b*c")) |
| 10:24 | clojurebot | ((\b \* \b) (\b \* \c)) |
| 10:24 | edbond | xificurC, ^^ |
| 10:25 | edbond | :-P |
| 10:25 | xificurC | edbond: yeah I just wrote that myself |
| 10:25 | xificurC | or something very similar |
| 10:25 | mklappstuhl | I 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:25 | mklappstuhl | ? |
| 10:26 | `cbp | Well I guess it depends on how fast you want it :P |
| 10:26 | Anderkent | `cbp: xificurC: it's definitely doable with the raw java api |
| 10:26 | Anderkent | just not sure if there's a clojure abstraction for it |
| 10:26 | Anderkent | in java you can tell the matcher at which point to start looking |
| 10:27 | edbond | mklappstuhl, lein classpath | grep checkouts |
| 10:27 | Anderkent | so you basically do (while (.find m (.start m 1)) ...) |
| 10:27 | edbond | mklappstuhl, also you can check lein deps :tree |
| 10:29 | xificurC | Anderkent: thanks, good to know |
| 10:32 | xificurC | oh I'd have another question (not about clojure per se) - vim, emacs, lighttable, ..., use percentage / recommendation? |
| 10:32 | xificurC | I'm new to coding but I used emacs exclusively in the last year, didnt know any editor before |
| 10:33 | `cbp | i use emacs 100% for clojure |
| 10:33 | `cbp | lighttable feels better for clojurescript but its still buggy as a dog |
| 10:34 | mklappstuhl | xificurC: I used vim for Clojure and it works pretty well |
| 10:35 | xificurC | mklappstuhl: with a repl in vim as well? |
| 10:35 | Anderkent | a full repl in vim is always awkward |
| 10:35 | xificurC | I just see this constant vim vs emacs battle on the net |
| 10:35 | `cbp | like right now it's been dling version 0.6.4 for 10 minutes now even though i updated yesterday.. |
| 10:35 | Anderkent | I've used foreplay without issues |
| 10:35 | Anderkent | uhm, I mean fireplace |
| 10:36 | xificurC | and thinking if there really is anything to fight about or its just preference |
| 10:36 | Anderkent | well, yeah vim vs emacs is a thing |
| 10:36 | xificurC | I mean, are the vim commands THAT faster and more powerful? |
| 10:36 | Anderkent | emacs 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:36 | mklappstuhl | Anderkent, 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:36 | Anderkent | oh, sure. |
| 10:36 | elfenlaid | xificurC, why not to try it yourself :) but, ghm, light table is quite interesting |
| 10:36 | xificurC | Anderkent: i know emacs only actually |
| 10:36 | Anderkent | then I don't think changing just to use clojure in vim is worth it |
| 10:37 | xificurC | I tried vim for 2 days now, going through some tutorials, just to know the difference |
| 10:37 | Anderkent | i've been playing with lighttable from time to time too |
| 10:37 | mklappstuhl | edbond: 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:37 | xificurC | but havent created an opinion yet |
| 10:37 | Anderkent | think trying both is pretty hard; both have a steep learning curve |
| 10:37 | Anderkent | you'll spend a lot of time just getting proficient in both |
| 10:38 | xificurC | Anderkent: well i love a challenge :) |
| 10:38 | edbond | mklappstuhl, remove dependency from project.clj |
| 10:38 | Anderkent | sure, but why not pick a challenge that will actually acomplish something :P |
| 10:38 | edbond | mklappstuhl, did you try lein install? maybe an easier option if you don't plan to hack checkouts source. |
| 10:38 | xificurC | its 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:38 | Anderkent | eh, well, if you find it fun feel free :) |
| 10:38 | mklappstuhl | edbond: no I didn't. how would I do that? |
| 10:39 | edbond | mklappstuhl, go to project dir and run 'lein install' |
| 10:39 | mklappstuhl | to the project I want to use? |
| 10:39 | mklappstuhl | would I leave it in the :dependencies array? |
| 10:39 | edbond | then update dependencies in your project to use latest version. -SNAPSHOT |
| 10:39 | mklappstuhl | err, list |
| 10:39 | xificurC | Anderkent: actually i was thinking of trying viper on emacs, I dont want to switch to vim completely |
| 10:39 | xificurC | but to work with viper you gotta know the vim commands |
| 10:40 | edbond | mklappstuhl, yes, install project you want to use and update your deps |
| 10:41 | mklappstuhl | edbond; is lein install global or would I do that in the same dir where the depending project is? |
| 10:42 | Anderkent | mklappstuhl: it's global. it puts it into your ~/.m2/repository |
| 10:42 | mklappstuhl | Anderkent: ah, ok. that explains it |
| 10:43 | `cbp | xificurC: http://emacsrocks.com/ |
| 10:43 | `cbp | vim is too ghetto imho |
| 10:43 | Anderkent | let's not turn this into a flamewar |
| 10:43 | xificurC | `cbp: yeah I saw them |
| 10:44 | xificurC | Anderkent: not my attention at all, I just wanted to know more about both sides |
| 10:44 | Anderkent | xificurC: I was adressing `cbp more than you :P |
| 10:45 | xificurC | Anderkent: i know but indirectly it would still be my mistake bringing up the topicc |
| 11:06 | TimMc | xificurC: Don't worry, this channel is fairly... mature about the topic. |
| 11:07 | TimMc | Lots of people here use vim *and* emacs, for that matter. |
| 11:10 | xificurC | TimMc: thats what I expected anyway, just like people are willing to learn multiple languages they should be willing to learn multiple editors/IDEs |
| 11:10 | xificurC | its funny tht |
| 11:11 | xificurC | that even after a year of trying the functional I still find it often simpler to write something the imperative way |
| 11:11 | xificurC | not all of course, many things are much simpler when written functionally |
| 11:12 | devn | TimMc: Yeah, I use both. |
| 11:12 | devn | I have both open right now. |
| 11:13 | cark | many things are easier to express in the imperative style... functional programming really only shines for larger projects in my opinion |
| 11:14 | cark | hum that's not entirely true ... what i really mean is that you reap the benefit later for a little suffering right now |
| 11:15 | CookedGr1phon | I 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:15 | cark | yes |
| 11:15 | CookedGr1phon | just generally a lot less brittle |
| 11:15 | CookedGr1phon | though that's a lot to do with types too I guess |
| 11:16 | Anderkent | I 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:16 | Anderkent | that I do a lot. |
| 11:18 | cark | there are so many cases where just doing it imperatively is so much easier |
| 11:18 | cark | like maybe expressing a graph |
| 11:18 | cark | circular references |
| 11:19 | cark | sure 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:22 | BobSchack | cark have you seen Brandon's talk about graphs? |
| 11:23 | cark | i haven't |
| 11:23 | cark | do you maybe have a link ? |
| 11:23 | BobSchack | cark: http://www.youtube.com/watch?v=j649Tr25RyA |
| 11:23 | cark | thanks i'll check it out right away ! |
| 11:24 | BobSchack | he talks about how circular reference are evil and how to do trees functionally |
| 11:24 | Anderkent | weeeell, but that's assuming your data can be modelled as a tree |
| 11:25 | cark | yep sometimes there's no way around it, there has to be some circular references |
| 11:56 | Anderkent | anyone 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:57 | Anderkent | my initial attempts are like O(n^6) worst case |
| 11:57 | clgv | Anderkent: I am not sure I understand the problem description fully. |
| 11:58 | clgv | do you have a small example of that problem or a formal description? |
| 11:59 | Anderkent | imagine two lines of points one above the other |
| 12:00 | Anderkent | and some links between your points - you can assume the graph is connected |
| 12:00 | Anderkent | you can only swap a node with a node in the same row |
| 12:01 | Anderkent | get minimum number of links crossing |
| 12:01 | Anderkent | it's easier to draw than describe |
| 12:01 | clgv | ah ok |
| 12:06 | clgv | I dont recall a similar graph problem right now. graph layout algorithms may face similar problems |
| 12:07 | clgv | but the good ones for large graphs are mostly inexact heuristic algorithms |
| 12:09 | `cbp | oh lighttable you mess everything up for international keyboards!! |
| 12:14 | moquist | I'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:20 | broquaint | moquist: 'C-h m' might be a good place to start, also 'C-h k' generally. |
| 12:21 | stuartsierra | moquist: you probably to add some initialization to allow CIDER to add keybindings to clojure-mode. Check the CIDER docs. |
| 12:26 | moquist | broquaint, stuartsierra: OK, thx. I'll see what I can figure out. |
| 13:10 | semperos | can'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:16 | dnolen_ | semperos: I don't believe it's option that fires on change, rather select |
| 13:16 | teslanick | When would an option change? |
| 13:16 | teslanick | ^ |
| 13:18 | dnolen_ | 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:19 | dnolen_ | 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:19 | dnolen_ | (think rollbacks) |
| 13:19 | dnolen_ | 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:20 | dnolen_ | 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:21 | dnolen_ | https://github.com/swannodette/om/blob/txq/examples/counters/src/core.cljs |
| 13:21 | dnolen_ | signature for anonymous fn on line 59 should be (fn [tag root tx-data] ...) |
| 13:21 | dnolen_ | will fix that later today |
| 13:29 | gfredericks | I have a seemingly simple streaming problem that I can't tell how to solve with built-in java stream stuff |
| 13:30 | gfredericks | given a lazy seq of strings from a jdbc query result, lazily concat & gzip, presenting the result as an InputStream to an http request |
| 13:31 | gfredericks | I 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:31 | gfredericks | i.e., I'm going to end up subclassing something |
| 13:33 | pjstadig | gfredericks: use piped streams? |
| 13:33 | amalloy | gfredericks: well like, SequenceInputStream |
| 13:33 | amalloy | and for gzipping, i think you do have to use one piped stream |
| 13:33 | gfredericks | amalloy: yeah I started with that |
| 13:34 | gfredericks | amalloy: pjstadig: are piped streams a built in thing or a technique? |
| 13:34 | amalloy | built in |
| 13:34 | pjstadig | at least with piped streams at least you don't have to do the siphoning yourself |
| 13:34 | amalloy | they 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:34 | pjstadig | gfredericks: https://github.com/pjstadig/es/blob/master/src/pjstadig/es.clj#L101-L120 |
| 13:35 | llasram | gfredericks: If you want to live on the edge, there's also https://github.com/ring-clojure/ring/pull/115 |
| 13:35 | gfredericks | I'm gonna have to pipe twice, won't I? SequenceInputStream -> GZIPOutputStream -> SomethingInputStream? |
| 13:36 | llasram | Oh, HTTP request, not ring HTTP response |
| 13:36 | amalloy | gfredericks: there's also https://github.com/amalloy/ring-gzip-middleware/blob/master/src/ring/middleware/gzip.clj#L38 |
| 13:37 | amalloy | i haven't worked out whether this is quite what you need, but it's related |
| 13:37 | gfredericks | amalloy: it looks eager |
| 13:37 | gfredericks | the doseq in the future |
| 13:37 | amalloy | oh, for sure |
| 13:38 | amalloy | well |
| 13:38 | amalloy | but also piped input streams have a limited buffer size, and block if it gets too far ahead |
| 13:38 | amalloy | so it's not quite as eager as you might think |
| 13:38 | gfredericks | clojurebot: the doseq in the future |would be| a great name for a rock band |
| 13:38 | clojurebot | Ik begrijp |
| 13:38 | gfredericks | amalloy: oh that's good to know |
| 13:39 | gfredericks | thanks amalloy pjstadig llasram; not sure how I forgot about these |
| 13:40 | amalloy | gfredericks: sounds more like a movie or novel title |
| 13:41 | amalloy | gfredericks: 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:43 | amalloy | i 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:43 | llasram | wha |
| 13:43 | llasram | What does that even do? |
| 13:44 | amalloy | llasram: if a, b, and c are input streams, it yields a nwe input stream which is the concatenation of them |
| 13:45 | llasram | Interesting |
| 13:48 | semperos | dnolen_: thank you for the feedback (and your continued progress on Om), will give it a look |
| 13:49 | danneu | Are there any options for getting a part-time job as a developer? |
| 13:50 | dacc | does 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:50 | amalloy | i'm pretty sure this universe does contain people who work part-time as developers, danneu |
| 13:50 | dacc | (i tried :java-source-paths [] inside the profile) |
| 13:50 | dacc | .. but i think it's merging anyway. maybe need two profiles |
| 13:51 | technomancy | dacc: maybe :prep-tasks ^:replace ["compile"] if you want java that depends on clojure |
| 13:51 | technomancy | dacc: hyPiRion blogged about this a few days ago |
| 13:51 | hyPiRion | devn: woah, nice timing there |
| 13:51 | dacc | technomancy: thanks i'll look |
| 13:51 | hyPiRion | *decc |
| 13:52 | hyPiRion | dacc: http://hypirion.com/musings/advanced-intermixing-java-clj |
| 13:52 | danneu | amalloy: 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:52 | danneu | Maybe someone here works part-time |
| 13:53 | gfredericks | amalloy: a movie or novel based on the rock band of course |
| 13:53 | dacc | hyPiRion: cheers, just found it =) |
| 13:53 | hyPiRion | You 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:53 | dacc | hyPiRion: ok thanks |
| 13:54 | llasram | Wow, these make Java 8 look like it might actually be a language for programming: http://www.java8.org/ |
| 13:58 | gfredericks | java is the new clojure |
| 13:58 | ystael | looks more like the new scala though |
| 13:58 | TimMc | llasram: Hey, maybe now *Clojure* will get method references. |
| 13:59 | hyPiRion | gfredericks: what, Java uses s-exps now? |
| 13:59 | llasram | TimMc: I'm just going to start actually using https://github.com/llasram/method-fn |
| 14:00 | danneu | My 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:02 | technomancy | danneu: no one sensible would penalize you for posting learning projects; you should be judged on your best work, not your early stuff |
| 14:02 | jconnolly | i have a private github account where i have what i consider my "please don't judge me for employment on these" private repos |
| 14:02 | hyPiRion | danneu: No, but don't use GH as a resume. Insteead, specify some projects you are satisfied with in your resume. |
| 14:02 | jconnolly | rather, paid github account |
| 14:02 | danneu | What if your best stuff is all running in production? |
| 14:03 | danneu | rather, the code isn't released |
| 14:03 | jconnolly | and proprietary... welcome to my world |
| 14:03 | hyPiRion | jconnolly: if it's for yourself only, you could consider using bitbucket |
| 14:03 | technomancy | danneu: then you convince folks to relicense it |
| 14:03 | jconnolly | hyPiRion: good call. |
| 14:03 | TimMc | heh |
| 14:03 | technomancy | the idea that your competitors will eat your lunch if they can see it is completely preposterous 90% of the time |
| 14:04 | hyPiRion | danneu: either what technomancy said, or you could get a reference from them along with what you have done/do |
| 14:04 | jconnolly | we 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:04 | danneu | technomancy: well, it's stuff i've written and i host it. i just don't like having production code sitting in the open |
| 14:04 | technomancy | danneu: well, that's going to make things harder |
| 14:04 | ystael | technomancy: what about the idea that competitors will eat your lunch if you spend the necessary time to make it a publishable release? |
| 14:04 | TimMc | There's a difference between publishing the source and making a project of it, yeah. |
| 14:05 | technomancy | ystael: what's the difference between "publishable" and "high quality"? |
| 14:05 | TimMc | "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:06 | danneu | yeah, 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:07 | technomancy | the project I hack on at work is used by direct competitors |
| 14:07 | hyPiRion | danneu: 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:07 | technomancy | http://blog.appharbor.com/2013/07/01/introducing-realtime-logging |
| 14:07 | ystael | technomancy: 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:08 | technomancy | ystael: I don't understand why feature-completeness is a prerequisite to changing the license |
| 14:09 | TimMc | I think the biggest part of open-sourcing it would be teasing out the business logic. |
| 14:09 | technomancy | TimMc: which you should be doing anyway, right? |
| 14:10 | TimMc | Unfortunately, that's not necessarily what I would get paid to do. |
| 14:10 | hyPiRion | technomancy: yes, but time |
| 14:10 | technomancy | the things you need to do to make it "presentable" is a subset of the things you need to do for proper engineering |
| 14:11 | technomancy | hyPiRion: 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:11 | hyPiRion | technomancy: It's not fine, but it's stupid bosses and marketing guys assuming we can get stuff done in half a second =/ |
| 14:12 | technomancy | yeah =( |
| 14:12 | TimMc | So 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:13 | teslanick | hyPiRion: http://www.youtube.com/watch?v=8xRqXYsksFg |
| 14:13 | technomancy | TimMc: it sounds like you're getting other people to pay off your technical debt for you? |
| 14:13 | TimMc | Another 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:13 | technomancy | haha |
| 14:13 | TimMc | technomancy: There's debt and there's debt. |
| 14:14 | technomancy | well, once it's released, it gives you more leverage to spend time to do the right thing from a technical perspective |
| 14:14 | ystael | I don't know that we have enough of an institutional commitment to open source yet to make that a true statement |
| 14:16 | TimMc | Yet. |
| 14:16 | dacc | i'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:18 | technomancy | it's not always practical for a given organization, but most of the immediate objections people have to it don't make sense |
| 14:18 | technomancy | and it's a ton easier to do it in the open from the start |
| 14:19 | TimMc | llasram: That's the first plausible use of tagged literals I've seen so far. |
| 14:19 | llasram | TimMc: Haha |
| 14:20 | technomancy | oh dang |
| 14:20 | technomancy | that is very slick |
| 14:21 | TimMc | llasram: I mean, (mfi String/toUpperCase) would also work as a macro, but... plausible. |
| 14:21 | srruby | I'm running into a case where (= parsed (postwalk identity parsed)) is returning false. parsed is a vector. Am I using postwalk incorrectly? |
| 14:21 | sdegutis | Declarative programming? More like declariawesome. |
| 14:21 | srruby | parsed is returned by the instaparse parser. |
| 14:22 | llasram | TimMc: That's true :-) |
| 14:22 | AeroNotix | how to check if a variable is undefined? |
| 14:22 | AeroNotix | seems like such a silly question |
| 14:22 | llasram | AeroNotix: Like find out if a var exists? |
| 14:22 | AeroNotix | but isn't there something like: (unbound? ...) |
| 14:22 | AeroNotix | llasram: yeah |
| 14:23 | llasram | Not just?: (nil? (resolve sym)) |
| 14:23 | AeroNotix | ,(def c) (nil? (resolve sym)) |
| 14:23 | clojurebot | #'sandbox/c |
| 14:23 | AeroNotix | derp |
| 14:23 | AeroNotix | ,(def c) (nil? (resolve c)) |
| 14:23 | clojurebot | #'sandbox/c |
| 14:23 | AeroNotix | ,(nil (resolve c)) |
| 14:23 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:23 | AeroNotix | ffs |
| 14:23 | AeroNotix | ,(nil? (resolve c)) |
| 14:23 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Symbol> |
| 14:24 | AeroNotix | ,(nil? (resolve 'c)) |
| 14:24 | clojurebot | false |
| 14:24 | llasram | That said, mucking w/ `resolve` etc frequently means you're going against the grain |
| 14:24 | llasram | What's your use-case? |
| 14:24 | AeroNotix | llasram: |
| 14:24 | AeroNotix | sorry, I've had a few beers. Fat fingers |
| 14:25 | llasram | TimMc: That's a really, really good point, actually. Adding those macros now |
| 14:25 | AeroNotix | So, a library I use defines a global default connection parameter which it (alter-root-var)'s when a connection is made |
| 14:25 | AeroNotix | it blindly assumes in some areas that the default connection exists |
| 14:25 | AeroNotix | (def *default-connection) |
| 14:25 | AeroNotix | (def *default-connection*) |
| 14:26 | AeroNotix | perhaps it'd be better to just patch it to give *default-connection* an initial value |
| 14:26 | AeroNotix | like :omfg-dont-use-me-ffs |
| 14:27 | llasram | AeroNotix: Which library is this, so that I may never use it? :-) |
| 14:27 | AeroNotix | llasram: no comment. |
| 14:27 | llasram | hah, fair enough |
| 14:27 | AeroNotix | and I'll bet you already do |
| 14:28 | AeroNotix | if you do any LOLWEBSCALE work |
| 14:28 | llasram | nope |
| 14:28 | AeroNotix | ah ok |
| 14:28 | llasram | I prefer to store my data in a database |
| 14:28 | TimMc | Is there anything like data-writers? |
| 14:28 | TimMc | Somethign that produces tagged literals? |
| 14:28 | llasram | TimMc: I think someone had a library... Struggling... |
| 14:28 | AeroNotix | llasram: nosql databases are still databases, just ones with differing goal.s |
| 14:29 | technomancy | TimMc: why not print-method? |
| 14:29 | TimMc | I should answer this question myself actually. |
| 14:29 | llasram | It 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:30 | AeroNotix | just out of interests sake, *is* there actually a way to see if a variable is unbound |
| 14:30 | AeroNotix | ? |
| 14:30 | danneu | jcromartie: 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:31 | TimMc | technomancy: A print-method impl that emits a string with a space in it? :-( |
| 14:31 | llasram | AeroNotix: So the var exists, and you just wan to know if it has a root binding already? |
| 14:31 | AeroNotix | llasram: exactamundo |
| 14:31 | llasram | ,(do (def foo) (.hasRoot #'foo)) |
| 14:31 | clojurebot | false |
| 14:31 | llasram | ,(do (def foo :value) (.hasRoot #'foo)) |
| 14:31 | clojurebot | true |
| 14:31 | AeroNotix | oh .hasRoot |
| 14:31 | AeroNotix | llasram: cheers |
| 14:31 | pjstadig | bound? |
| 14:32 | pjstadig | ,(doc bound?) |
| 14:32 | clojurebot | "([& 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:32 | llasram | Haha! |
| 14:32 | llasram | Even better |
| 14:32 | jowag | bound?, .hasRoot is undocumented |
| 14:32 | AeroNotix | God damnit, I was trying (unbound? ..) |
| 14:32 | pjstadig | that won't tell you if it's a root binding |
| 14:32 | llasram | That's true |
| 14:32 | AeroNotix | ,(def c) |
| 14:32 | clojurebot | #'sandbox/c |
| 14:32 | pjstadig | for that you'd have to do something like (and (bound? x) (not (thread-bound? x))) |
| 14:32 | AeroNotix | ,(bound? c) |
| 14:32 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Var> |
| 14:32 | AeroNotix | ,(bound? 'c) |
| 14:32 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.Var> |
| 14:33 | pjstadig | ,(bound? #'c) |
| 14:33 | clojurebot | false |
| 14:33 | AeroNotix | hmm ok |
| 14:33 | llasram | I'd peeked recently at the implementation of `defonce`, so that's what I remembered |
| 14:33 | AeroNotix | llasram: ah of course |
| 14:34 | pjstadig | <obligatory mention of (one of) my open Jira issues http://dev.clojure.org/jira/browse/CLJ-1077> |
| 14:35 | hugod | is there a list of forms that core.async's go macro supports/doesn't support? |
| 14:35 | AeroNotix | hugod: |
| 14:35 | AeroNotix | misclick |
| 14:36 | hugod | just wondering about `for` and `doseq` |
| 14:37 | patrkris | is guns (github.com/guns) on this channel? |
| 14:40 | danneu | hugod: are you having an issue? |
| 14:41 | hugod | danneu: Assert failed: <! used not in (go ...) block, when using (doall (for [c cs] (<! c))) inside a go block |
| 14:42 | danneu | hugod: can you gist the code |
| 14:44 | hugod | danneu: https://www.refheap.com/37228 |
| 14:44 | hugod | oops, ignore the doseq comment |
| 14:47 | hugod | replacing the (doall (for …)) with loop works |
| 14:49 | Anderkent | ,(require '[clojure.core.async :as a]) |
| 14:49 | clojurebot | #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath: > |
| 14:49 | Anderkent | meh |
| 14:49 | Anderkent | anyway |
| 14:49 | Anderkent | (go (doall (for [x [1 2 3 4]] (>! c x)))) |
| 14:49 | Anderkent | has the same issue |
| 14:50 | danneu | hugod: 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:50 | Anderkent | seems like core.async macroexpands the body before picking out <!? |
| 14:51 | TimMc | patrkris: A user by that name does show up sometimes. |
| 14:51 | Anderkent | there's a bot command to say when someone was last seen, right? |
| 14:52 | Anderkent | seen guns |
| 14:52 | TimMc | last showing up ~4k lines ago |
| 14:52 | Anderkent | ,seen guns |
| 14:52 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seen in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:52 | Anderkent | damnit :p |
| 14:52 | TimMc | $seen guns |
| 14:52 | lazybot | guns was last seen quitting 3 days and 14 hours ago. |
| 14:52 | Anderkent | right! |
| 14:52 | Anderkent | i'd get there eventually |
| 14:55 | Anderkent | hugod: yeah looks like core.async can't work with a for loop |
| 14:55 | Anderkent | which is a shame |
| 14:57 | danneu | Why doesn't apt-get install leiningen install 2.x |
| 14:57 | hugod | Anderkent: Indeed - not sure if that warrants an issue. At least I can use loop. |
| 14:57 | danneu | I have no idea how the package ecosystem works |
| 14:58 | rplaca | danneu: there's always a lag and it also depends which Ubuntu you have |
| 14:58 | danneu | rplaca: I have 13.0x |
| 14:58 | rplaca | technomancy would know more |
| 14:58 | Anderkent | danneu: because it takes forever to update anything |
| 14:58 | Anderkent | in debians repos |
| 14:58 | danneu | Ah, got it. |
| 14:59 | Anderkent | also I'm not sure if anyone here actually cares |
| 14:59 | Anderkent | :P |
| 15:00 | danneu | Yeah exactly. I asked because if it was just a matter of sending a pull request somewhere, I'd do it |
| 15:00 | Anderkent | nah, it's a Process. |
| 15:06 | danneu | I 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:09 | sdegutis | I just learned a new emoticon... :v |
| 15:09 | sdegutis | It's that face! Like when you move your lips to the side in a skeptical but lighthearted fashion! |
| 15:10 | borkdude | :v |
| 15:14 | danneu | someone 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:15 | dacc | >=-)~ |
| 15:16 | danneu | although they must have paredit-mode disabled in their irc buffer |
| 15:27 | akurilin2 | Quick 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:28 | akurilin2 | I'm thinking that running a def from within that init routine would get the job done |
| 15:28 | akurilin2 | This is a one-time caching and the data isn't expected to change, or I'd use atoms |
| 15:31 | dsrx | write once? you could use a promise |
| 15:32 | TimMc | akurilin2: def inside a def is basically always bad |
| 15:34 | akurilin2 | Ok so how do I create a run-time var then that's namespace visible? |
| 15:34 | gfredericks | TimMc: yo dawg, I heard you like vars in your vars so I |
| 15:35 | akurilin2 | This would be only done at initialization time |
| 15:35 | stuartsierra | akurilin2: `intern` |
| 15:35 | gfredericks | o_O |
| 15:35 | TimMc | stuartsierra: What no don't |
| 15:35 | stuartsierra | I didn't say it was a good idea. |
| 15:35 | TimMc | If someone says "I need to remove this door", you don't hand them a chainsaw. |
| 15:36 | ruzu | you don't? |
| 15:36 | akurilin2 | So you guys are thinking more along the lines of atoms here? |
| 15:36 | akurilin2 | As far as "good solutions" go? |
| 15:36 | rplaca | TimMc: depends how much entertainment you want |
| 15:36 | stuartsierra | We already handed them Clojure, what more damage could we possibly do? :) |
| 15:36 | TimMc | Fair. |
| 15:36 | akurilin2 | I think I'm aiming for low entertainment value right now :) |
| 15:36 | rplaca | just pr it into a string and `eval` :) |
| 15:37 | TimMc | akurilin2: You want your defs out in the open where they are highly visible to readers and to tools. |
| 15:37 | TimMc | Initializing something at startup (with low entertainment value) means you'll need an extra layer of indirection: delay, atom, ref, promise... |
| 15:38 | TimMc | promise sounds like the most useful here |
| 15:39 | gfredericks | would stuartsierra make a defrecord and put stuff in there? |
| 15:39 | akurilin2 | TimMc: ok let me try that one |
| 15:40 | stuartsierra | My approach is https://github.com/stuartsierra/component but it is more elaborate. |
| 15:42 | SegFaultAX | stuartsierra: Does the capture part of what you described in your blog post? |
| 15:43 | gfredericks | stuartsierra: 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:43 | gfredericks | I don't remember why I would have wanted to |
| 15:43 | stuartsierra | gfredericks: Just because the record is immutable doesn't mean it can't contain mutable references like Atoms and Refs. |
| 15:44 | stuartsierra | SegFaultAX: I'm sorry, I don't understand your question. |
| 15:44 | gfredericks | stuartsierra: I know but it feels like a weird mix, since you have to be careful |
| 15:44 | gfredericks | about duplicating references to stateful objects |
| 15:44 | stuartsierra | gfredericks: Yes, you do have to be careful. The component library is designed to help with that. |
| 15:45 | SegFaultAX | stuartsierra: Sorry, that was a fragment. Referring to http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded |
| 15:45 | gfredericks | stuartsierra: I probably just need to try it with more determination |
| 15:45 | SegFaultAX | Is that a library that tries to encapsulate the workflow described in that article? |
| 15:45 | TimMc | stuartsierra: I neded multiple instances of your component framework. |
| 15:45 | TimMc | (kidding, kidding) |
| 15:45 | sdegutis | How do you verify in your integration tests that business data are never created in an inconsistent or incomplete state? |
| 15:45 | stuartsierra | SegFaultAX: 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:46 | SegFaultAX | stuartsierra: Awesome. |
| 15:46 | sdegutis | I imagine you use preconditinos and postconditions to verify state within relevant functions? |
| 15:48 | gfredericks | stuartsierra: have you combined this with core.async much? |
| 15:49 | gfredericks | by which I just mean using both at the same time |
| 15:49 | stuartsierra | gfredericks: A little bit, experimentally. There's nothing about the model that forbids it. |
| 15:49 | sdegutis | Oh snap, deja vu. |
| 15:52 | gfredericks | stuartsierra: 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:52 | TimMc | Could component be used to help provide instancing of namespaces? |
| 15:53 | stuartsierra | gfredericks: Assuming the threads themselves are managed by a component lifecycle there should be a place to shut them down correctly. |
| 15:53 | stuartsierra | TimMc: Not as such, but components behave somewhat like parameterized modules. |
| 15:54 | TimMc | Might be close enough. |
| 15:54 | stuartsierra | I certainly use them that way. |
| 15:54 | gfredericks | stuartsierra: by having the threads poll a flag? |
| 15:55 | stuartsierra | gfredericks: That's one option. Or shut down on a 'poison' message. Or have a separate 'shutdown' channel. |
| 15:55 | gfredericks | stuartsierra: right. okay I will probably revisit this. thanks. |
| 15:55 | stuartsierra | gfredericks: you're welcome |
| 16:00 | tjd | I'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:05 | stuartsierra | tjd: You need a custom printer. clojure.edn doesn't have one yet. |
| 16:06 | tjd | cool. can do. |
| 16:06 | SegFaultAX | Ah so component is essentially just DI for Clojure? |
| 16:06 | SegFaultAX | (I'm looking over the docs now) |
| 16:07 | llasram | tjd: If you just want it to work for individual record types, you can just define `print-method` for that type |
| 16:07 | stuartsierra | SegFaultAX: It's a means to achieve DI, yes. |
| 16:08 | `cbp | tjd: https://github.com/miner/tagged |
| 16:09 | technomancy | danneu: 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:09 | technomancy | *ahem* and licensing issues with Leiningen itself =/ |
| 16:09 | tjd | `cbp: oh, awesome! just what i was looking for. thank you. |
| 16:10 | danneu | technomancy: thanks |
| 16:31 | rhg135 | \\ |
| 16:31 | rhg135 | oops |
| 16:34 | dacc | akurilin2: delay is a lazy promise i believe, if that helps |
| 16:44 | justin_smith | ,@(delay 1) |
| 16:44 | clojurebot | 1 |
| 16:47 | dacc | or rather, a lazy future |
| 17:03 | sdegutis | wow, so functions, very data, much immutable, nice lazy |
| 17:05 | socksy | what'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:06 | technomancy | socksy: uberjar+runit is the way to go |
| 17:08 | socksy | forgive my ignorance — is this runit? https://github.com/hw-cookbooks/runit |
| 17:08 | technomancy | that's a runit cookbook, yeah |
| 17:09 | socksy | what is runit? difficult to google for |
| 17:09 | gtrak | is there a way to set AOT bytecode versioning in the project.clj? |
| 17:09 | socksy | or is it this? http://smarden.org/runit/ |
| 17:10 | socksy | which 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:10 | technomancy | systemd is kind of an eldritch horror, and upstart is pretty limited |
| 17:11 | technomancy | but if your requirements are simple upstart is fine too |
| 17:11 | technomancy | I've used upstart enough to be reluctant to recommend it |
| 17:11 | technomancy | clojars uses it |
| 17:12 | socksy | I know systemd is supposed to be terrible, but it also looks to be somewhat ubiquitous in the future :) |
| 17:12 | technomancy | distopian nightmare future |
| 17:12 | stuartsierra | gtrak: You mean class file versions like JDK 1.5, 1.6? I think Clojure always sets 1.5. |
| 17:13 | gtrak | yea, hmm. |
| 17:13 | gtrak | I'm getting Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class, comp... |
| 17:13 | gtrak | at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463) ... |
| 17:14 | gtrak | been playing with java8 |
| 17:14 | stuartsierra | That's a new one on me. |
| 17:27 | oskarkv | Does 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:28 | amalloy | i mean, robert.hooke mangles vars, and you replaced those with brand-new non-mangled vars |
| 17:29 | brehaut | gfredericks: ive run into javascript + css head-holding again. /me despairs |
| 17:30 | amalloy | that'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:30 | amalloy | brehaut: any time i deal with javascript and css i have to hold my own head too |
| 17:32 | brehaut | amalloy: responsive design (while a good thing) makes it so much worse :/ |
| 17:33 | seangrove | brehaut: Doesn't bootstrap pretty much make it a non-issue? |
| 17:33 | brehaut | lol |
| 17:34 | systemfault | bootscrap... |
| 17:37 | brehaut | seangrove: 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:38 | brehaut | seangrove: 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:39 | oskarkv | amalloy 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:44 | oskarkv | amalloy 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:52 | oskarkv | amalloy Hm the problem happens even if I don't use robert.hooke |
| 18:07 | gfredericks | brehaut: I predict that by 2017 "slash me" is going to be part of the standard teenager lexicon |
| 18:08 | brehaut | gfredericks: they're bound to pickup something far more obtuse |
| 18:08 | gfredericks | like "colon slash slash"? |
| 18:09 | brehaut | sounds painful |
| 18:09 | gfredericks | maybe something from swearjure |
| 18:15 | shriphani | hi. any advice on getting the cljs repl to speak to the browser. It takes 5-ish mins to connect. |
| 18:16 | pbostrom | shriphani: refresh your browser after connecting the repl |
| 18:16 | shriphani | pbostrom, done that |
| 18:17 | shriphani | (+ 1 1) hasn't returned yet |
| 18:17 | clojurebot | 2 |
| 18:17 | pbostrom | sorry that's all I got |
| 18:20 | ivan | shriphani: did you try austin? |
| 18:20 | shriphani | ivan, no. I am just following the modern-cljs tutorials and I was not sure if it would interfere. |
| 18:20 | shriphani | should I use austin ? |
| 18:20 | ivan | probably; not certain it will solve your problem though |
| 18:20 | ivan | could be a browser issue |
| 18:22 | shriphani | so how do I check if it is a browser issue ? |
| 18:22 | shriphani | I restarted my browser |
| 18:22 | shriphani | visited the page in question |
| 18:23 | ivan | use the Firefox inspector or Chrome Dev Tools to look for errors; try a clean browser profile |
| 18:25 | shriphani | I can open the js file and see the compiled stuff |
| 18:25 | shriphani | in the browser i.e. |
| 18:27 | pbostrom | shriphani: you can also look at the network tab to make sure your app is connecting back to the repl |
| 18:27 | acron | Hi everyone |
| 18:27 | acron | I'm having difficult with clj-mail 0.1.5 |
| 18:27 | acron | Keep getting the following warning |
| 18:27 | acron | Warning: *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:28 | shriphani | goog.require could not find: domina |
| 18:28 | shriphani | that's neat |
| 18:28 | technomancy | acron: probably the library is designed for clojuer 1.2 or older |
| 18:28 | acron | Bah :( |
| 18:29 | sdegutis | womp womp |
| 18:29 | acron | How can I actually see the src? |
| 18:29 | acron | The version on github looks like it *does* define session as dynamic... |
| 18:30 | acron | https://github.com/MayDaniel/clj-mail/blob/master/src/clj_mail/core.clj |
| 18:30 | shriphani | pbostrom, I don't see a repl process |
| 18:33 | acron | Alternatively then, can anyone recommend any decent mail libraries? |
| 18:34 | pbostrom | shriphani: your cljs source should have (repl/connect "http://localhost:9000/repl") 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:34 | shriphani | yep I have that call to connect |
| 18:34 | akurilin2 | technomancy: just checking with you: does it make sense that a ring app started with lein trampoline won't pick up changes in checkouts/ ? |
| 18:35 | shriphani | so I do lein deps and it checks out |
| 18:35 | shriphani | but it can't find domina |
| 18:35 | shriphani | how is that. |
| 18:35 | technomancy | akurilin2: not really, trampolining shouldn't affect the classpath |
| 18:35 | technomancy | it might affect auto-reloads; those are kinda iffy |
| 18:35 | technomancy | but the changes should be visible |
| 18:36 | bob2 | is there a style consense on which of (:foo somemap) (somemap :foo) and (get somemap :foo) to generally use? |
| 18:37 | broquaint | The first is idiomatic, bob2. |
| 18:37 | bob2 | ah, thank you |
| 18:38 | akurilin2 | technomancy: yeah I could only see changes in the local dependencies after running lein install |
| 18:38 | akurilin2 | without trampoline it works just as expectred |
| 18:39 | sdegutis | bob2: whoa you're here too |
| 18:39 | akurilin2 | Not really a dealbreaker for me since in production it uses the local repo anyway |
| 18:39 | technomancy | akurilin2: does reading the classpath under `lein trampoline repl` show you src/ of the checkouts? |
| 18:40 | bob2 | not 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:40 | sdegutis | bob2: :) |
| 18:40 | sdegutis | bob2: Except that ->> makes it way prettier to transform collections than in Python maybe. |
| 18:41 | sdegutis | (oh no he didn't!) |
| 18:41 | bob2 | yes |
| 18:41 | bob2 | I agree |
| 18:41 | bob2 | finding python increasingly tedious |
| 18:41 | gtrak | I had a j2ee job, tried to escape via jython, but jython made me sad... clojure was a nice surprise. |
| 18:41 | sdegutis | bob2: Welcome aboard good sir, welcome aboard. |
| 18:41 | gtrak | simply because jython was dying and out of date. |
| 18:42 | sdegutis | That seems to be an inherent problem with bridges. They're overambitious assuming the maintainers will have infinite steam to keep up. |
| 18:42 | bob2 | it seems to be a fair bit better off these days |
| 18:42 | akurilin2 | technomancy: yeah seems like it |
| 18:42 | socksy | potentially 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:43 | gtrak | socksy: could always wrap it in a (do blah nil) |
| 18:43 | bob2 | I 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:44 | sdegutis | bob2: future? |
| 18:44 | gtrak | bob2: taken a look at netty and friends? |
| 18:44 | sdegutis | Oh. Yeah never mind. |
| 18:44 | sdegutis | I'm thinking of core.async or core.logic or something. |
| 18:44 | bob2 | gtrak, yeah, netty is the sort of thing, but seemingly has really tedious apis |
| 18:44 | bob2 | core.async just hides the threads from you |
| 18:44 | socksy | gtrak: 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:45 | gtrak | bob2: you'd want aleph maybe, it's a clojure wrapper |
| 18:45 | bob2 | which 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:45 | gtrak | not sure where threads have to enter into it |
| 18:45 | bob2 | gtrak, ah, I had heard of but not looked at it yet - cheers |
| 18:46 | gtrak | there's a wrapper over the async httpclient |
| 18:46 | gtrak | bob2: https://github.com/neotyk/http.async.client |
| 18:46 | gtrak | and I think this can do it too: http://http-kit.org/ |
| 18:47 | gtrak | you can throw that into core.async without threads in between. |
| 18:47 | gfredericks | gtrak: our lunch group (15-20 people) spent an hour playing with your disassembler on monday; great fun |
| 18:47 | gtrak | :-) |
| 18:47 | gtrak | I showed it to a group of rubyists last night. |
| 18:48 | gtrak | along with reducers over a proc. |
| 18:48 | gtrak | jruby proc.. |
| 18:48 | gfredericks | do you know why (disassemble (def foo 42)) is so crazy? is it disassemble's fault or def's fault? |
| 18:48 | gtrak | hrm.. well it would be disassembling the return value, which is the var, yea? |
| 18:48 | bob2 | ah, 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:48 | gfredericks | I guess; don't know what that means wrt what it will do though :) |
| 18:49 | gtrak | Var.java would be the thing |
| 18:49 | gtrak | that is disassembled |
| 18:49 | gtrak | it's got a lot of stuff in it |
| 18:50 | gtrak | bob2: he's using a go block in the callback. |
| 18:53 | gtrak | gfredericks: 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:54 | bob2 | is there anything sensible to point flymake at for clojure code? |
| 18:54 | sdegutis | Hmm, I've never used flymake. |
| 18:55 | sdegutis | bob2: 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:55 | bob2 | well, I'm ok with telling cider to load ma file and do a thing to it |
| 18:55 | bob2 | or having cider run something |
| 18:56 | gtrak | bob2: if you can think of a good nrepl middleware, it goes here: https://github.com/clojure-emacs/cider-nrepl |
| 18:56 | bob2 | basically, I don't want to find out about typoes at 'lein test' time |
| 18:57 | sdegutis | Hmm, 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:57 | sdegutis | Sounds like it could work, with a smart enough mind. |
| 19:00 | justin_smith | bob2: maybe lein check? |
| 19:01 | bob2 | justin_smith, can I invoke that in the repl? |
| 19:01 | justin_smith | well, you could just have a dedicated process that calls load on the file |
| 19:02 | technomancy | doesn't flymake assume you'll keep going after a compilation failure? |
| 19:02 | justin_smith | you likely wouldn't what to do that in a repl that you were using for general interaction though |
| 19:02 | justin_smith | technomancy: I think it re-invokes when you save? |
| 19:02 | justin_smith | could be wrong |
| 19:03 | technomancy | yeah, I guess only getting one failure at a time isn't a big deal |
| 19:04 | bob2 | ah, 'lein check' just does a load on each file anyway |
| 19:04 | justin_smith | https://github.com/illusori/emacs-flymake oh, someone's been improving flymake |
| 19:05 | justin_smith | and 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:05 | bob2 | yeah, it's a lot better than it used to be |
| 19:05 | technomancy | check also turns warn-on-reflection on |
| 19:06 | justin_smith | shouldn't be too hard to launch a grench load with warn-on-reflection |
| 19:06 | bob2 | can I have something else show me unbalanced forms? paredit mode only seems to complain when I'm on the form |
| 19:06 | justin_smith | with the load being done on a temp file derived from the state of the buffer |
| 19:06 | technomancy | bob2: reindenting helps with that |
| 19:07 | bob2 | technomancy, hm, what specifically do you mean? |
| 19:07 | justin_smith | hit tab to make emacs indent the line |
| 19:07 | justin_smith | if it indents weird, your parens are weird |
| 19:08 | bob2 | hah |
| 19:08 | justin_smith | (or indent-buffer, indent-region etc.) |
| 19:08 | bob2 | it's usually the trailing ones that are screwed for me |
| 19:08 | technomancy | if you don't close your parens, the next defn will not be in column zero |
| 19:08 | justin_smith | bob2: indent-buffer will make trailing parens indent other forms afterward |
| 19:08 | justin_smith | (missing trailing parens that is) |
| 19:08 | bob2 | true |
| 19:09 | justin_smith | looks 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:09 | bob2 | I 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:10 | justin_smith | maybe you want kibit |
| 19:10 | bob2 | I want it even more now 'lein checkall && lein test' takes 10x longer than 'nose' did |
| 19:10 | justin_smith | https://github.com/jonase/kibit |
| 19:10 | bob2 | I 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:11 | justin_smith | be sure to turn on the option that emails technomancy to tell him you are using when for the return value |
| 19:11 | justin_smith | so he can judge you |
| 19:11 | technomancy | M-x look-of-disapproval |
| 19:11 | technomancy | bob2: that sounds like a great fit for nrepl-discover actually |
| 19:11 | technomancy | http://p.hagelb.org/clojurewest-2014.org.html |
| 19:12 | justin_smith | bob2: 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:12 | bob2 | technomancy, yeah, you mentioned it yesterday, was hoping there'd be code today ;p |
| 19:12 | bob2 | justin_smith, right |
| 19:12 | technomancy | there's code! |
| 19:12 | technomancy | https://github.com/technomancy/nrepl-discover |
| 19:12 | technomancy | it's kind of scattered all over the place |
| 19:14 | bob2 | oh, awesome |
| 19:18 | bob2 | technomancy, ah, btw, nrepl-discover.el is lacking a dep on nrepl |
| 19:18 | technomancy | ah, thanks |
| 19:20 | bob2 | probably a stupid question, but is cider a fork of nrepl, and both are maintained? |
| 19:20 | technomancy | it's just a rename |
| 19:20 | bob2 | ah |
| 19:21 | dsrx | it's a rename along with a hundreds of comments long bikeshedding issue deciding on a new logo |
| 19:21 | bob2 | obviously |
| 19:21 | bob2 | gotta tackle the big issues first |
| 19:22 | bob2 | what action will trigger 'lein' to install dependencies listed in ~/.lein/profiles.clj {:user {:dependencies ? |
| 19:22 | technomancy | bob2: anything calculating the classpath |
| 19:22 | technomancy | run, compile, check, test, classpath, deps, maybe more |
| 19:25 | bob2 | http://bpaste.net/show/gBq1mDKPdh8RTHGQk6Wt/ |
| 19:26 | technomancy | bob2: miiiiight need to lein install from source |
| 19:26 | technomancy | bit of a mess right now; sorry |
| 19:26 | technomancy | simplest actualyl to just `lein repl` in the nrepl-discover project itself |
| 19:27 | bob2 | oh, no worries, just interested in trying to implement the stuff above :) |
| 19:29 | bob2 | hah, Exception in thread "main" java.lang.UnsupportedOperationException: nth not supported on this type: core$require |
| 19:30 | amalloy | bob2: (ns foo require ...) instead of (ns foo (require ...)) |
| 19:31 | amalloy | from your tone i think you knew that already, but just in case |
| 19:31 | amalloy | or, well, i guess that would be a different error, wouldn't it. i'm curious what was actually wrong |
| 19:36 | bob2 | ah, I see what's happening |
| 19:38 | bob2 | missing char in instructions, and me missing that I need to do 'lein repl' in the source before I can edit profile.clj :) |
| 19:39 | bob2 | nrepl.discover.sample still seems unimportable |
| 19:42 | technomancy | bob2: are you running 0.1.0? that one doesn't have that ns; you need master |
| 19:43 | benkay | so 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:44 | bob2 | technomancy, yeah, this is 'lein repl' in master of it |
| 19:45 | technomancy | weird |
| 19:47 | bob2 | erk, 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:50 | socksy | playing with agents some more, I don't think I'm fully understanding them |
| 19:50 | socksy | in this mock example, it prints "{}" — how come? https://www.refheap.com/37614 |
| 19:51 | amalloy | benkay: https://github.com/ninjudd/io/blob/develop/src/flatland/io/core.clj#L50 |
| 19:52 | amalloy | i don't remember if it's perfectly optimized or has some unnecessary slowness, but it does exactly what you wanted, at least |
| 19:52 | benkay | oooooo |
| 19:52 | benkay | thanks amalloy |
| 19:54 | amalloy | second time today someone's wanted a function that already exists in flatland/io. weird |
| 19:59 | ninjudd | amalloy: good thing i didn't delete that repo yesterday. i was wondering why it existed |
| 20:04 | socksy | just realised map is done lazily, so putting a doall around it solves the example I gave |
| 20:13 | kristof | java 8 has first class functions, zomg |
| 20:13 | sdegutis | I have an overwhelming urge to post only serious deep thoughts on reddit and only funny gifs on hackernews. |
| 20:13 | kristof | will clojure's compiler get a deep refactoring accordingly? |
| 20:15 | technomancy | kristof: no; clojure is a long way away from requiring java7 features, much less java 8 |
| 20:15 | kristof | oh okay :( |
| 20:18 | bob2 | sdegutis, wouldn't want to the lower the considered and open tone of hn like that |
| 20:20 | sdegutis | I think it's some weird kind of existential angst mixed with disillusionment settling in, possibly caused by burnout. |
| 20:24 | kristof | programmer burns out |
| 20:24 | kristof | posts gifs to hn |
| 20:24 | kristof | sounds reasonable. |
| 20:29 | sdegutis | the serious deep thoughts to reddit is more far-fetched to me |
| 20:29 | dacc | project lambda just looks like syntax sugar for Callable and friends, no? well, besides the additions to the library. |
| 20:33 | amalloy | "just" |
| 20:33 | dacc | yeah, i guess that's all it takes... |
| 20:34 | dacc | was trying to clarify if kristof knew of some jvm optimizations for it clojure could take advantage of |
| 20:35 | amalloy | the 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:36 | amalloy | dacc: 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:37 | dacc | wasn't trying to belittle syntax sugar, by any means =) |
| 20:39 | gfredericks | syntax protein |
| 20:46 | aka | any opinions on enlive vs hivvup for my first clojure web dev project? |
| 20:47 | brehaut | aka: hiccup is simpler to grasp, enlive is a more powerful abstraction but harder to get into |
| 20:53 | aka | enlive 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:54 | aka | see if I can grok it quickly or not |
| 21:08 | holo | hi |
| 21:08 | oskarkv | hi |
| 21:09 | holo | I have a simple (heh) question: why keep is called that way? |
| 21:09 | dacc | holo: called how? |
| 21:09 | holo | dacc, keep |
| 21:10 | gfredericks | I think dacc means why is it named that |
| 21:10 | dacc | ooh i see |
| 21:10 | gfredericks | or holo means |
| 21:10 | holo | gfredericks, yes it's me :D |
| 21:10 | dacc | hmm, i guess it returns the keepers =) |
| 21:11 | dacc | clojurebot? |
| 21:11 | clojurebot | clojurebot is not very good at indicating the difference between a return value and an exception |
| 21:11 | dacc | hmm, how to have him evaluate things? |
| 21:11 | gfredericks | ~keep |
| 21:11 | clojurebot | It's greek to me. |
| 21:11 | gfredericks | ,(str 'evaluate :things) |
| 21:11 | clojurebot | "evaluate:things" |
| 21:11 | dacc | ,(keep identity [1 nil 2 nil 3]) |
| 21:11 | clojurebot | (1 2 3) |
| 21:11 | dacc | cool |
| 21:12 | holo | oh i see.. that's a good mnemonic :D |