2014-04-06
| 00:00 | arrdem | I suppose I can approximate a circle really well with an inscribed 64-gon but still. |
| 00:00 | arrdem | $seen sjofra |
| 00:00 | lazybot | I have never seen sjofra. |
| 00:06 | mercwithamouth | starting to really like lisp =P i think i'll stick with it for a while |
| 00:08 | arrdem | really... this guy didn't deploy his F/OSS Clojure project to Clojars.. |
| 00:08 | arrdem | fine... |
| 00:08 | jph- | yeh, i get annoyed by that |
| 00:08 | jph- | and feel a bit awkward deploying my own |
| 00:09 | arrdem | I mean the guy's been inactive for four months... I could open a "deploy to clojars you fool" issue and see what happens... |
| 00:09 | nightfly | do that |
| 00:10 | kenrestivo | no harm in asking. |
| 00:11 | arrdem | eh I mean I could pull it down and package it myself then PR it in the same time... |
| 00:18 | arrdem | woah what the shit... |
| 00:23 | miseria | "un buscador, no es el que sabe lo que busca, un buscador es quien descubre que la vida, es una continua busqueda" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival* |
| 00:24 | arrdem | second spambot in two days.. we must be popular :P |
| 00:26 | myguidingstar | somebody please help implement this Java thing in Clojure. I tried but can't get Java |
| 00:26 | myguidingstar | https://gist.github.com/myguidingstar/27c6a1511fab4c5b2575 |
| 00:26 | myguidingstar | (it's very short) |
| 00:33 | ambrosebs | myguidingstar: see deftype |
| 00:34 | myguidingstar | ambrosebs, do I have to import something to use an interface? |
| 00:35 | ambrosebs | myguidingstar: you don't need to load anything, but you can use import/:import to abbreviate the interface name |
| 00:35 | ambrosebs | via the ns macro |
| 00:37 | myguidingstar | (in my pure Clojure brain they look like undefined symbols) |
| 00:37 | myguidingstar | btw, in `public TemplateModel exec` so what do I do with `TemplateModel`? |
| 00:39 | ambrosebs | myguidingstar: I can't remember. It might work without type annotations, otherwise you might need something like gen-class. |
| 00:39 | ambrosebs | try something like: TemplateModel (exec [this args] ...) |
| 00:40 | myguidingstar | thanks, let me see |
| 00:41 | gtrak | in core.async, do taps close their passed-in channel? |
| 00:42 | gtrak | docs say they close if the channel closes, but I want the reverse. |
| 00:44 | gtrak | hrm.. |
| 00:44 | gtrak | looks like no |
| 00:45 | gtrak | except in my case, maybe it'll get GC'd |
| 00:47 | amalloy | ambrosebs: the return types for interfaces are inferred by name |
| 01:06 | gfredericks | amalloy: yeah, I started with the loop and then pulled it out because emitting was just as easy and less nested |
| 01:06 | gfredericks | and ~@ is easier than concat |
| 02:03 | dissipate | what is the best unit testing framework for clojure? is it midje? |
| 02:26 | Raynes | dissipate: It's whatever your favorite is. |
| 02:32 | arrdem | Raynes: dat cop out tho |
| 02:32 | Raynes | His question is fundamentally unanswerable. |
| 02:33 | Raynes | There are a variety of libraries throughout the Clojure ecosystem providing solutions for more or less any sort of testing methodology or combinations thereof that one could ever ask for. |
| 02:33 | dissipate | Raynes, i'm asking for opinions. :P |
| 02:33 | Raynes | Aimed at different people, these libraries do not deserve to be compared. |
| 02:37 | trap_exit | in cljs, what is the inverse of clojure.edn/parse-string ? |
| 02:37 | trap_exit | i.e. I have a data structure, and I want to string-encode it via edn |
| 02:51 | maxthoursie | trap_exit: can't you use pr-str? |
| 03:14 | trap_exit | maxthoursie: yes, pr-str works |
| 03:14 | maxthoursie | great |
| 03:45 | vimuser2 | For recur, im a bit confused why you can do something like (loop [] (let [] recur)) but not (loop [] #(recur)) . I thought let just expands to a anonymous function anyway? |
| 03:45 | vimuser2 | (above isn't valid lsip, was just focusing on order of function calls) |
| 03:53 | mercwithamouth | vimuser2: i'm fairly new to clojure and most likely wrong but wouldn't #(recur) screw up the scope? |
| 03:54 | mercwithamouth | you're putting it inside of a function thats not actually called or hit... |
| 04:04 | vimuser2 | mercwithamouth: yeah, meant to say something like (#(recur .. )) |
| 04:05 | dissipate | what is going on with this error? Exception in thread "main" java.lang.RuntimeException: No such var: leiningen.util.injected/add-hook, compiling:(NO_SOURCE_PATH:1) |
| 04:05 | dissipate | all i did was 'lein new my-project' and then 'cd my-project' and 'lein test' |
| 04:23 | dissipate | nevermind, i found out my version of leiningen was out of date |
| 05:14 | ggherdov_ | hi, for my program I need an HTTP client library. What would be the go-to choice? |
| 05:36 | scottj | ggherdov_: clj-http |
| 05:57 | ptcek | any way to get namespace part of keyword/symbol (as `name` gets the, ehm, name)? |
| 05:59 | ptcek | ,(namespace :ns/name) |
| 05:59 | clojurebot | "ns" |
| 05:59 | ptcek | so obvious... :) |
| 08:47 | mercwithamouth | (->> (range 10)(map inc)(interpose 5)(reduce +)) |
| 08:47 | mercwithamouth | ,(->> (range 10)(map inc)(interpose 5)(reduce +)) |
| 08:47 | clojurebot | 100 |
| 08:47 | mercwithamouth | ok why does that work here but i get an illegalstateexception error in my repl?! =( |
| 08:50 | mercwithamouth | ,(->> (range 10)(map inc)(interpose 5)) |
| 08:50 | clojurebot | (1 5 2 5 3 ...) |
| 09:00 | ivan | mercwithamouth: can you paste your error? |
| 09:02 | ToxicFrog | mercwithamouth: works for me. |
| 09:11 | mercwithamouth | ivan: IllegalStateException Attempting to call unbound fn: #'user/inc clojure.lang.Var$Unbound.throwArity (Var.java:43) |
| 09:19 | mercwithamouth | ok weird i restarted my repl, now it works |
| 09:28 | stain | did you accitdentally def 'inc' perhaps? |
| 09:43 | gfredericks | ,(def inc dec) |
| 09:43 | clojurebot | #<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)> |
| 12:52 | hiteki | hi |
| 13:21 | vimuser2 | Is there a built in function for applying a function to each element in a seq? |
| 13:22 | vimuser2 | as in, given f, and a [1 2 3], then (f 1) (f 2) (f 3) will be called. I don't care about the output (doing side effect stuff) |
| 13:22 | ambrosebs | vimuser2: (doall (map f coll)) |
| 13:22 | vimuser2 | i could technically use reduce and just keep returning ni |
| 13:23 | ambrosebs | or dorun, doseq |
| 13:23 | ambrosebs | see the docs for the differences |
| 13:23 | vimuser2 | ah thanks |
| 13:23 | bbloom | would be nice to have clojure.core/each, *shrug* oh well |
| 13:29 | zakwilson | I'm trying to use sensors on Android, and the Java documentation for that involves casting a SystemSensorManager to a SensorManager, but when I call (cast SensorManager the-SystemSensorManager), the object returned is still a SystemSensorManager, which does not define the registerListener method and therefore crashes at runtime. |
| 13:29 | bbloom | tbaldridge: spotted effect_lisp -- glad to see you're experimenting too :-) |
| 13:49 | yotsov | zakwilson: SystemSensorManager extends SensorManager, so it looks like you are trying to upcast, which cannot have the benefit of exposing more methods |
| 13:51 | AmandaC | zakwilson: where are you getting a SystemSensorManager from? |
| 13:52 | AmandaC | zakwilson: because there’s no such class that I can find. |
| 14:29 | dissipate | how the hell do you do a simple 'find and replace' in light table |
| 14:33 | `szx | dissipate: cmd+f? |
| 14:34 | `szx | cmd+shift+f for for multiple files |
| 14:36 | dissipate | `szx, that's find what about replace? |
| 14:36 | `szx | dissipate: it's both - left field is find, right field is replace |
| 14:36 | dissipate | 0 |
| 14:37 | dissipate | `szx, i see, thanks |
| 14:37 | `szx | UI could be better, i agree |
| 14:43 | zakwilson | AmandaC: (.getSystemService ^Activity a "sensor") returns a SystemSensorManager. The class is not documented in the Android docs. |
| 14:43 | AmandaC | zakwilson: ah, I see. |
| 14:44 | AmandaC | zakwilson: and it doesn’t function the same? |
| 14:44 | zakwilson | yotsov: what you say sounds right to me, but I get "No matching method found: registerListener for class android.hardware.SystemSensorManager" at runtime. Wait... it could do that if I supplied incorrect arguments too. |
| 14:45 | zakwilson | AmandaC: I'm not sure. The Java example code includes the cast. I'm exploring the possibility that I'm calling it wrong. |
| 14:46 | zakwilson | It really doesn't look like I am though. |
| 14:46 | AmandaC | zakwilson: the Java Exampple Code includes the cast because getSystemService returns an Object, IIRC |
| 14:50 | miseria | "el deseo de vivir un millon de años, me obligan a buscar y matar la muerte, antes que ella me convierta en calavera" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival* |
| 14:52 | zakwilson | AmandaC: that makes sense, now that I think about it. |
| 15:05 | yedi | is there a function that does (first (filter fn coll)) more tersely? |
| 15:06 | yedi | some |
| 15:06 | hyPiRion | yedi: some does something else in the general case |
| 15:06 | bbloom | if you're binding a name to the result, you can leverage destructuring: |
| 15:07 | bbloom | ,(let [[x] (filter pos? [0 -1 2 1 0])] x) |
| 15:07 | clojurebot | 2 |
| 15:07 | yedi | hyPiRion: how so? is it not always the first element? |
| 15:08 | bbloom | (doc some) |
| 15:08 | clojurebot | "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)" |
| 15:08 | hyPiRion | yedi: ##((juxt (comp first filter) some) pos? [0 -1 2 1 0]) |
| 15:08 | lazybot | ⇒ [2 true] |
| 15:08 | yedi | oh, i see |
| 15:08 | bbloom | (inc juxt) |
| 15:09 | lazybot | ⇒ 7 |
| 15:37 | Averell | as long as it's not one of the 4clojure juxt exercises :) |
| 15:39 | DomKM | Is there a way to write to a java.io.BufferedWriter without reflection? |
| 15:39 | DomKM | (with-open [^java.io.BufferedWriter wrtr (clojure.java.io/writer path)] (.write wrtr "string"))) uses reflection |
| 15:42 | clifton | hi, i have a proprietary jar file launches a swing interface. is there a good way to use leiningen to have that jar file included in the classpath when i launch the repl? |
| 15:43 | clifton | im trying to programatically manipulate the interface (seesaw looks nice) and do not have access to the source code |
| 15:43 | hiredman | DomKM: what makes you think it uses reflection? |
| 15:43 | DomKM | hiredman: I get a reflection warning |
| 15:44 | hiredman | DomKM: with that actual code, or is that a simplified example? |
| 15:45 | DomKM | hiredman: it's a simplified example |
| 15:45 | hiredman | DomKM: do you actually get a reflection warning with it? |
| 15:45 | hiredman | (I don't think you will, so I don't think it is a good simplified example) |
| 15:47 | DomKM | hiredman: you're right, I didn't |
| 15:48 | DomKM | hiredman: I needed to replace "string" with (cheshire.core/encode {}) to get a warning |
| 15:48 | hiredman | ^String (cheshire.core/encode {}) |
| 15:49 | hiredman | or I believe cheshire has functions for encoding directly to streams |
| 15:49 | DomKM | hiredman: perfect, thanks :) |
| 15:49 | hiredman | https://github.com/dakrone/cheshire/blob/master/src/cheshire/core.clj#L36 |
| 15:49 | noprompt | $seen Raynes |
| 15:49 | lazybot | Raynes was last seen talking on #clojure 13 hours and 16 minutes ago. |
| 15:50 | Raynes | sup |
| 15:50 | noprompt | hey cool, you're here. |
| 15:51 | noprompt | could lein-pdo be tweaked to tag output from tasks? ex. lein pdo a, b would do something like |
| 15:51 | noprompt | [a] STDOUT from a |
| 15:52 | noprompt | [b] STDOUT from b |
| 15:52 | Raynes | noprompt: ship it |
| 15:52 | noprompt | Raynes: so it's possible? |
| 15:53 | Raynes | I highly doubt it. |
| 15:53 | Raynes | But I also haven't looked at that plugin since the 5 minutes it took me to write it. |
| 15:53 | noprompt | that's what i thought. |
| 15:53 | Raynes | noprompt: I mean, it might be possible. |
| 15:54 | Raynes | noprompt: You could perhaps rebind *out* to intercept prints. |
| 15:54 | Raynes | Each task execution is just a function call, so presumably (binding ..) would apply. |
| 15:54 | noprompt | Raynes: i'll give it a shot. i ended up handrolling something at work before i knew about lein-pdo. |
| 15:55 | pandeiro | anyone know a strategy for swapping out URLs in a cljs app meant for a service-oriented architecture where development and production URLs are different? |
| 15:55 | noprompt | pandeiro: you can use enlive to do that. |
| 15:55 | hyPiRion | noprompt: just ensure you perform a locking on the original *out* value, otherwise you end up with possibly interleaved prints |
| 15:55 | pandeiro | noprompt: i will use enlive for the html part, yeah |
| 15:55 | pandeiro | but i am talking about within the cljs app |
| 15:55 | noprompt | pandeiro: at work we have a build process that compiles new html files for production apps after we push new builds to s3. |
| 15:56 | pandeiro | noprompt: cool yeah html problem is resolved for me |
| 15:56 | pandeiro | enlive is perfect for that |
| 15:56 | michaniskin | does doing (def thing (future ...)) not make sense for some reason? i'm having trouble compiling a namespace that assigns a var like that (compiling seems to take forever) |
| 15:56 | pandeiro | but within my cljs app i have a lot of xhr to do |
| 15:57 | noprompt | pandeiro: ah ok. well, you could write a macro that reads something from the environment etc. and handle it there. |
| 15:57 | pandeiro | noprompt: ah ok so at macro-expansion time, interesting |
| 15:57 | noprompt | pandeiro: since cljs macros are expanded in clojure you could pretty much do whatever you want. |
| 15:57 | pandeiro | sure, that's the path then |
| 15:57 | pandeiro | thanks |
| 15:58 | noprompt | pandeiro: the idea is similar to this https://gist.github.com/noprompt/9086232 |
| 15:58 | pandeiro | ah but how do i determine in the macro if it's a dev or prod build? |
| 15:58 | noprompt | pandeiro: probably do something like ENV=production lein cljsbuild ... |
| 15:58 | pandeiro | yep, ok |
| 16:00 | andyf_ | Bronsa: ping |
| 16:00 | noprompt | hyPiRion: how do i do that? |
| 16:02 | Raynes | noprompt: If you need assistance let me know and I'll be as useless as ever. |
| 16:02 | Raynes | :D |
| 16:02 | noprompt | lol |
| 16:03 | noprompt | i don't mind the output being interleaved, i just want it tagged so i know where it's coming from. |
| 16:03 | hyPiRion | noprompt: interleaved as in `lein pdo shell echo 111, shell echo 222` may print out '11222\n1' |
| 16:04 | noprompt | yeah that's fine. i'd like to see |
| 16:05 | noprompt | [shell echo 111] 111 |
| 16:05 | noprompt | [shell echo 222] 222 |
| 16:05 | hyPiRion | exactly, which means you probably don't want to see `[shell echo 111] 11[shell echo 222] 2221` |
| 16:05 | noprompt | oh wait but i see what you mean. |
| 16:06 | hyPiRion | I think it should be sufficient to reify some interface, then do `(locking original-out (. call original-out with-args))` on every fn. |
| 16:07 | hyPiRion | Writer, probably. |
| 16:08 | hyPiRion | Only thing is that you'd likely want to gobble data until you hit a newline or EOF, then print a line. That may be a bit more complicated. |
| 16:08 | Bronsa | andyf_: pong |
| 16:09 | noprompt | gotcha |
| 16:09 | andyf_ | Still as busy as ever fixing tools.analyzer(.jvm) bugs, I see (and thank you) |
| 16:09 | noprompt | alright i'm gonna dig in to this and see what i come up with. |
| 16:09 | andyf_ | I was curious whether there was a relatively short set of rules I could use in Eastwood to warn about badly placed :tag metadata |
| 16:10 | Bronsa | andyf_: eh, I have a list of bugs to solve that I discovered a couple of days ago but I'm too tired to fix them now |
| 16:10 | andyf_ | I don't have such a set of rules in my head yet, and was hoping you could help me bypass a big chunk of guessing, experimentation, and reading code, if you had such knowledge ready at hand. |
| 16:11 | Bronsa | andyf_: the only place where I saw people put metadata where it actually isn't doing what they think it's doing is in def symbols |
| 16:11 | andyf_ | Do you know of any good reasons to put tag metadata on symbols being def'd? |
| 16:12 | andyf_ | i.e. does the compiler itself ever pay attention to it there? |
| 16:12 | Bronsa | andyf_: maybe, I don't remember, let me check |
| 16:13 | andyf_ | So the short rule might look something like (def ^nothere myfn ^ret-tag-here [^arg1tag arg1 ^arg2tag arg2 ...] fn-body) |
| 16:14 | andyf_ | Oops, that should be defn, not def |
| 16:14 | ztellman | anyone on here who knows core.async well? |
| 16:14 | ztellman | have a question about 'alt' |
| 16:15 | andyf_ | and more generally (defn ^nothere myfn (^rettype1 [^arg1tag arg1] body-for-1arg) (^rettype2 [^arg1tag arg1 ^arg2tag arg2] body-for-2-args)) |
| 16:15 | Bronsa | andyf_: actually the compiler uses tag attached on Vars too |
| 16:15 | Bronsa | andyf_: the only issue really is if you're tagging primitives |
| 16:16 | Bronsa | it works fine for objects |
| 16:16 | andyf_ | So those code snippets I showed are what should be used for primitive type tags, and the only ones supported are ^long and ^double ? |
| 16:16 | Bronsa | yeah |
| 16:16 | S3thc0n | Hello everyone, I spent the last few weeks pondering the very basics of programming languages and wondered: How (except for forward reference) would a global let differ from using defs? Since (IMHO) everything should be an expression and not a statement I think this would be cleaner. But the problem of other libraries / namespaces with their own let arises, as well as accessing declared |
| 16:16 | S3thc0n | values/functions from outside (a REPL for example). What do you think? |
| 16:16 | Bronsa | if you tag with a primitive tag the Var rather than the arglist there are going to be two problems |
| 16:17 | andyf_ | And if they are non-primitive tags, they will work in the same places as for primitive ones, but a non-primitive tag on a Var "works the same way" as if it is on the arg vector? |
| 16:17 | Bronsa | - the Var meta is going to be evaluated so you'll get :tag #<the-primitive-function> instead of the tag |
| 16:18 | andyf_ | Yeah, I've seen that case plenty of times now |
| 16:18 | Bronsa | - even if you quote the tag, the compiler will not optimize the function with a prim interface for the return type |
| 16:19 | Bronsa | e.g. (defn ^{:tag 'long} x [^long a] a) will make x a IFn$LO rather than IFn$LL |
| 16:19 | Bronsa | so you get boxing on the return type |
| 16:20 | Bronsa | if you do (defn x ^long [^long a] a) however you get what you'd expect |
| 16:21 | andyf_ | And non-primitive type tags are only used for avoiding reflection in Java interop calls, either in the function body for type tags on args, or wherever the function return value is used for the return type tag? |
| 16:21 | Bronsa | andyf_: yes |
| 16:22 | Bronsa | well, and to hint at the correct method too |
| 16:22 | andyf_ | OK, I think I'm down to 1 question, and then I go off to experiment with these variations for my own confirmation: A non-primitive tag on the Var, or on the arg vector, work the same way, or nearly so? |
| 16:23 | Bronsa | say you have a class A which implements B and C, and you have a method foo that takes a B or a C, a type hint to B in a function that returns an A makes a call to foo resolve to the call to foo(B) |
| 16:24 | Bronsa | andyf_: that should be correct, I can't think of a case where that would be false |
| 16:25 | andyf_ | So it sounds like the main cases where it would help if Eastwood gave warnings are for attempted primitive tags that are neither long nor double, anywhere they appear, or for ^long or ^double on Vars. |
| 16:25 | Bronsa | andyf_: well |
| 16:26 | andyf_ | Oh, I guess ^int and such are still useful in a Java interop call? |
| 16:26 | Bronsa | right |
| 16:26 | Bronsa | I was just going to say that |
| 16:26 | andyf_ | Are primitive hints ever used in a let or loop binding? |
| 16:27 | Bronsa | andyf_: you can do that |
| 16:28 | andyf_ | By which I mean a code snippet like (let [^double x 0.0] let-body) |
| 16:28 | amalloy | can you? i think you have to write (let [x (double 0.0)] body) |
| 16:28 | amalloy | or, well, 0.0 is a double literal, so you don't have to. but like (long 0) |
| 16:28 | Bronsa | you can't do that specifically, but I believe you can do (let [^double x (something)] ..) |
| 16:32 | Bronsa | amalloy: looks like you can indeed |
| 16:32 | yedi | anyone know what this might mean? compiling cljs: Caused by: java.lang.IllegalStateException: Nested #()s are not allowed |
| 16:33 | Bronsa | amalloy: (fn [] (let [^int a (Integer. 1)] (clojure.lang.RT/box a))) compiles to http://sprunge.us/OBjJ |
| 16:33 | Bronsa | while (fn [] (let [a (Integer. 1)] (clojure.lang.RT/box a))) compiles to http://sprunge.us/LQag |
| 16:33 | yedi | i'm not getting a line number in the stack trace or anything so debugging that is proving to be a lil difficult |
| 16:34 | amalloy | yedi: #(foo #(bar)) |
| 16:35 | yedi | ah found it |
| 16:35 | yedi | thanks amalloy |
| 17:06 | yedi | in om/react, does rerendering not detect changes in styles? |
| 17:07 | S3thc0n | Hello everyone, I spent the last few weeks pondering the very basics of programming languages and wondered: How (except for forward reference) would a global let differ from using defs? Since (IMHO) everything should be an expression and not a statement I think this would be cleaner. But the problem of other libraries / namespaces with their own let arises, as well as accessing declared |
| 17:07 | S3thc0n | values/functions from outside (a REPL for example). What do you think? |
| 17:07 | yedi | i have it so that i change the color of some spans, however when i rerender the new colors don't show and the old color still remains |
| 17:08 | yedi | i'm assuming it's because the diffing algo doesn't detect differences within the style attribute? |
| 17:08 | yedi | atleast that's what it looks like.. |
| 17:09 | gfrederi` | S3thc0n: clojure's defs are very much not like a let |
| 17:10 | gfredericks | one of the things clojure's design accomplishes is that entering code at the repl is almost exactly the same as having it in a file that's loaded |
| 17:11 | gfredericks | I think your ideas would make that relationship a lot more complex; would also have to figure out what code-reloading means, if it even makes sense |
| 17:15 | hiredman | lisp is small pieces has a good section on different strategies for top-level environments |
| 17:15 | hiredman | lisp in small pieces |
| 17:31 | yedi | in om: are you allowed to om/transact! cursors in (will-mount) ? |
| 17:31 | yedi | my cursor is showing up as nil |
| 17:32 | clifton | anyone here familiar with seesaw? |
| 17:32 | yedi | however it seems to works after some specific state changes |
| 17:35 | yedi | heh, used (om/get-props owner) instead of the cursor passed to the component and it seemed to work |
| 17:37 | gtrak | yedi: has it clicked for you yet? I'm still figuring it out as I go along. |
| 17:37 | yedi | gtrak: i'm slowly figuring things out |
| 17:37 | gtrak | maybe I'll make another pass at react docs once I've built the thing I'm trying to build. |
| 17:38 | gtrak | time-pressure sucks :-) |
| 17:38 | yedi | i've spent quite sometime grappling with some silly gotchas but i figure after this initial foray into om things'll go a lot more smoothly |
| 17:39 | `szx | yedi: gtrak: do you guys use sablono/kioo or just straight up om? |
| 17:39 | `szx | just wondering |
| 17:39 | gtrak | sablono's nice but it adds yet another layer. been using it. yea. |
| 17:39 | yedi | i'm using straight up om |
| 17:39 | yedi | i may switch to sablono once im more familiar with om |
| 17:39 | `szx | yedi: yeah, i think i might do that as well |
| 17:39 | `szx | no time pressure here :) |
| 17:40 | yedi | `szx: likewise, we're lucky |
| 17:40 | gtrak | I made a single component that worked, but it got way too tedious to use om dom once I started worrying about styling. |
| 17:40 | gtrak | they compose though |
| 17:41 | `szx | gtrak: how does sablono help the styling issue? |
| 17:41 | yedi | whats weird is i know that much of the stuff ive done in om so far id be able to do way faster in an imperative jquery style |
| 17:41 | gtrak | just easier to see stuff at a glance, it's more terse and regular. |
| 17:42 | yedi | but one thing i noticed is that as the app's complexity increases, the spaghetti-ness of my code doesn't |
| 17:42 | yedi | it's relatively simple to add new functionality with core.async and om |
| 17:42 | `szx | yeah, with jquery you invariably end up with spaghetti in my experience |
| 17:43 | whodidthis | how do i set value = something; in clojurescript |
| 17:43 | yedi | (let [value something] value) |
| 17:43 | whodidthis | to a javascript variable |
| 17:43 | michaniskin | whodidthis: (set! (.-value js/window) something) |
| 17:44 | gtrak | `szx: it was getting unwieldy: https://gist.github.com/gtrak/10011760 |
| 17:44 | whodidthis | sweet, thanks |
| 17:44 | michaniskin | whodidthis: (aset js/window "value" something) |
| 17:44 | michaniskin | that's like window["value"] = something; |
| 17:46 | gtrak | `szx: the data parts and the code parts just feel different and are easy to pick out visually, I feel like om/dom stuff just has more mental overhead, and I'm not super familiar with hiccup. |
| 17:46 | `szx | gtrak: yeah, this look nice and clean |
| 17:46 | `szx | *looks |
| 17:49 | noprompt | hyPiRion: i don't think i understand what's happening here: https://gist.github.com/noprompt/b2893da6dd4fb6551874 |
| 17:49 | noprompt | hyPiRion: i'd expect to see [foo] bar |
| 17:52 | hyPiRion | noprompt: so apparently writer is probably not what you'd like to use |
| 17:52 | noprompt | hyPiRion: well it works fine for plain old print but not println |
| 17:53 | noprompt | hyPiRion: what would your recommend instead? i haven't ventured in to these parts of clojure before. |
| 17:54 | michaniskin | noprompt: maybe java.io.PrintWriter? |
| 17:55 | hyPiRion | noprompt: Well, I guess a writer could work, but you just need to know where a line starts and another ends |
| 17:57 | pandeiro | michaniskin: how is hoplon/boot coming along? |
| 17:57 | hyPiRion | noprompt: so essentially, you'll have to buffer the write calls, and whenever you see a newline or somebody closes the writer, you print the current buffer with the prefix |
| 17:58 | michaniskin | pandeiro: we're plugging away, planningthe future of boot next week. |
| 17:59 | pandeiro | michaniskin: i need to take a look, it's been a while... been teaching and writing too much to program over the last several months (eternity in open source time ;) |
| 18:00 | cddr | Is it possible to deploy to clojars after a successfull travis build? I |
| 18:00 | cddr | see that travis has "secure environment variables". Is there a way to |
| 18:00 | cddr | get lein deploy to get the input it needs from these? |
| 18:00 | michaniskin | pandeiro: you're welcome to join us, check out the topic in #hoplon for the schedule |
| 18:01 | bob2_ | cddr, if you can write them to ~/.lein/credentials.clj sure |
| 18:05 | noprompt | sorry |
| 18:05 | pandeiro | michaniskin: awesome, filled out the poll and hope i can be there |
| 18:05 | noprompt | sorry, had to step a way for a second. |
| 18:06 | noprompt | michaniskin: i'm proxying java.io.PrintWriter. did you see the gist? |
| 18:06 | haole | how do I map over a set of hashmaps? I want my function to be applied to each hash, and not have clojure apply it to the set of first items, then seconds and etc |
| 18:07 | bob2 | haole, isn't that already how it works? |
| 18:07 | haole | bob2: not quite... for example: I'd like (def hs {:a 1 :b 2 :c 3}) (map #(print %) hs) to be equivalent to (print hs) |
| 18:08 | haole | but I get ([:b 2][:c 3][:a 1]) |
| 18:09 | arrdem | haole: what are you trying to do with this behavior? |
| 18:09 | arrdem | haole: the example you give is an artifact of clojure core semantics.. you aren't going to change that. |
| 18:10 | michaniskin | noprompt: sorry, ignore my comment; it was nonsense |
| 18:10 | haole | arrdem: my data structure right now is a hash-map in a given format and I'd like to iterate over hashmaps |
| 18:10 | haole | and not their key-value pairs |
| 18:11 | arrdem | unclear. give me an IO case. |
| 18:11 | cddr | But hs seems like a single hashmap to me |
| 18:11 | cddr | Wouldn't (map #(print %) [hs]) do what you want? |
| 18:11 | haole | cddr: yes, it is, but I'd like to use a set of hashmaps |
| 18:11 | michaniskin | ,(map #(pr-str %) #{ {:a 1 :b 2} {:c 3 :d 4} }) |
| 18:11 | clojurebot | ("{:c 3, :d 4}" "{:b 2, :a 1}") |
| 18:12 | arrdem | haole: you could do (map my-fn (juxt :key1 :key2 :key3)) |
| 18:12 | haole | cddr: hmmm maybe |
| 18:12 | michaniskin | haole: that's a set of hash-maps |
| 18:12 | arrdem | haole: or you could map over (vals).. |
| 18:12 | haole | ha! that's what I want: (map fn [hs]) |
| 18:12 | haole | :D |
| 18:12 | arrdem | wat. |
| 18:12 | arrdem | that's exactly (fn hs). |
| 18:13 | haole | I'm using Clojure with the basic concepts first... I'll evolve into proper data structures as I get familiar with the language |
| 18:13 | haole | arrdem: (map fn [hs]) makes fn be called in each hs and not the k-v pairs |
| 18:14 | haole | I hope I'm making sense :D |
| 18:14 | noprompt | michaniskin: cool. i just have no idea why i'm getting the extra "[foo]" at the end of the string. regular print works just fine. |
| 18:14 | haole | and I hope that I'm not using Clojure in an awkward way |
| 18:14 | noprompt | oh i think i see now |
| 18:14 | bjorkintosh | as long as you don't write fortran in it! |
| 18:15 | haole | wow, wait... juxt replaces most of the logic I've written for my function |
| 18:15 | haole | damn! gonna use that instead :D |
| 18:15 | cddr | hoole: lol :D |
| 18:16 | haole | I have a set of functions that I have to apply in a set of hashes |
| 18:16 | haole | I was doing something like: (map #(% hs) set-of-funcs) |
| 18:16 | haole | looks like juxt to me now |
| 18:16 | noprompt | it's (newline) |
| 18:16 | noprompt | i didn't implement append |
| 18:17 | michaniskin | comp, juxt, partial, apply, the solution to all of life's problems |
| 18:18 | dpathakj | Does anyone know a good way to get access to a list containing vars bound via destructuring with :keys? |
| 18:18 | michaniskin | dpathakj: are you writing a macro? |
| 18:18 | dpathakj | Naively, something like ((fn [{:keys [a b] :as k}] k) {:a 1 :b 2}) but with ':as k' inside the vector [:a :b] |
| 18:18 | haole | michaniskin: I'm already using partial without even thinking about it... the others will come with time and practice :) |
| 18:19 | dpathakj | Nope, just runtime shenanigans. It's not really important because the application I'm thinking of has only two keys. |
| 18:19 | dpathakj | I'm aware that as written, (vals k) works. |
| 18:22 | dpathakj | I think what I was thinking of probably doesn't exist since the docs on destructuring would mention it. |
| 18:22 | dpathakj | Wondered if anyone here would see something I missed. |
| 18:23 | michaniskin | dpathakj: your anon fn is basically the identity function with the exception that it'll throw an exception if you call it with something that isn't associative? |
| 18:25 | noprompt | michaniskin, hyPiRion: this seems to work just fine https://gist.github.com/noprompt/b2893da6dd4fb6551874 |
| 18:25 | dpathakj | Don't think so. |
| 18:25 | dpathakj | ,((fn [{:keys [a b] :as k}] k) 1) |
| 18:25 | clojurebot | 1 |
| 18:26 | noprompt | Raynes: i guess we can tag the output then. |
| 18:27 | arrdem | $seen tbaldridge |
| 18:27 | lazybot | tbaldridge was last seen joining on clojure-social 19 hours and 50 minutes ago. |
| 18:28 | arrdem | damnit lazybot y u ping |
| 18:34 | haole | if I want to apply a function in a value or in a set of values, how do I do it in a simple way? currently, I'm ussing (flatten (list my-value)) before applying map to it |
| 18:34 | arrdem | ~flatten |
| 18:34 | arrdem | clojurebot: are you still sleeping in the job... |
| 18:36 | haole | I want to filter, for example, 1 to (1) and (1 2 3) to (1 2 3) |
| 18:36 | hyPiRion | noprompt: might work for your case, but may also mangle output |
| 18:36 | haole | (flatten (list ...)) seems to work but it smells bad :D |
| 18:37 | michaniskin | ,(flatten (list {:a [1 2 3]})) |
| 18:37 | clojurebot | ({:a [1 2 3]}) |
| 18:38 | michaniskin | ,(flatten (list [:a [1 2 3]])) |
| 18:38 | clojurebot | (:a 1 2 3) |
| 18:38 | bob2 | haole, can you change the api to not require that? |
| 18:38 | haole | ,(flatten 1) |
| 18:38 | clojurebot | () |
| 18:38 | haole | heh |
| 18:38 | bob2 | consistent types will make things easier to implement and understand, imho |
| 18:38 | haole | yeah, probably... I'm asking to get to know all the alternatives :) |
| 18:38 | haole | my program is way too lispy right now |
| 18:39 | haole | maybe I'll have to step back and use some more advanced data structures |
| 18:39 | noprompt | hyPiRion: well how could i stress test it to find the edge cases? |
| 18:39 | michaniskin | haole: flatten does recursion, which you probably don't want there |
| 18:39 | haole | hmm good point |
| 18:39 | bob2 | I don't think you need more advanced data structures |
| 18:39 | arrdem | my advice: fix your types, don't use flatten. flatten is one of those functions which rarely exhibits the desired behavior. |
| 18:39 | bob2 | just to use the oens you're already using, better |
| 18:40 | michaniskin | i don't think i've ever wanted to use flatten in 3 years now |
| 18:40 | michaniskin | wenever i think i want it, i always end up wanting prewalk or postwalk or something |
| 18:40 | noprompt | michaniskin: funny, i just realized a similar thing not to long ago. |
| 18:41 | noprompt | haven't used flatten in a while. |
| 18:41 | arrdem | (watching TB's tools analyzer talk) is there a spec _anywhere_ for the intersection of Clojure and clojurescript? |
| 18:41 | michaniskin | noprompt: tree-seq ftw |
| 18:41 | holo | hi |
| 18:41 | hyPiRion | noprompt: (let [timeout (+ (System/currentTimeMillis) 50)] (with-out-tag "foo" (loop [] (println "hello from foo") (if (< (System/currentTimeMillis) timeout) (recur))))) or something |
| 18:42 | noprompt | ok let me try that. |
| 18:45 | hyPiRion | It may also work just as you want it to, depending on the JVM you use, cores, etc. Its thread-unsafeness makes it hard to know what exactly will happen. |
| 18:45 | noprompt | ah, interesting. |
| 18:45 | holo | I want to use this kind of stuff in my clj/cljs code: かな? but ? is not a valid character for identifiers in cljs, it seems. it is valid in clj though. would it be possible to extend identifiers allowed characters to ?in cljs? |
| 18:45 | noprompt | hyPiRion: why does this happen with the loop example? |
| 18:46 | arrdem | holo: most likely that's an issue with JS, so I doubt it. |
| 18:46 | arrdem | holo: you'd need to implement UTF8 munging in the cljs compiler |
| 18:46 | arrdem | holo: not worth it. |
| 18:48 | holo | I see. I asked this because "?" is also not a valid js character. check it here: http://mothereff.in/js-variables so if the exception was made for "?", why not make it for "?" too? |
| 18:49 | hyPiRion | noprompt: because you call it so often that it's almost guaranteed that a .write call starts while another .write call is currently running |
| 18:49 | holo | arrdem, sorry, the answer above was for you :) |
| 18:49 | hyPiRion | that's not the case when you wait over a millisecond |
| 18:50 | noprompt | hyPiRion: so that's why you were saying i should implement a locking mechanism. gotcha. |
| 18:50 | arrdem | holo: you could implement arbitrary UTF8 munging for cljs, just like ? is munged, but clearly it wasn't a developer priority. |
| 18:52 | noprompt | ok, gotta step out for an early dinner. i'll work on this a bit more later. |
| 18:52 | hyPiRion | noprompt: it's not that hard to do it here, luckily. just wrap all proxy methods in a (locking old-out ...), then you should in theory be set |
| 18:54 | holo | arrdem, OK I'm going to try doing that |
| 18:54 | holo | (inc arrdem) ; :D |
| 18:54 | lazybot | ⇒ 23 |
| 18:55 | arrdem | tbaldridge: ping |
| 18:55 | arrdem | tbaldridge: this time for real :P |
| 19:01 | haole | michaelneale: fixing my API to work only with lists has reduced my code by 1/3 |
| 19:02 | haole | thanks for the tip |
| 19:02 | haole | ops... it's michaniskin ^ |
| 19:02 | haole | :D |
| 19:02 | michaelneale | haole: I think that would be for someone else - I don't recall providing a tip! |
| 19:02 | michaelneale | I am sure it was a good tip! |
| 19:03 | michaniskin | haha, just the tip, though. it's a pretty good tip. |
| 19:03 | haole | :) |
| 19:08 | rberdeen | in a clojurescript repl, should the variables in a namespace be available after evaluating (ns whatever)? |
| 19:08 | rberdeen | they appear to be in the vanilla clojurescript repl, but not when I use austin |
| 19:14 | rberdeen | it looks like i need to (load-namespace 'whatever) before (ns whatever) even if the namespace has been loaded in the browser... |
| 19:21 | michaniskin | whatever happened to pods? was the concept abandoned? |
| 19:23 | bob2 | haole, it's a useful thing to do in most languages |
| 19:26 | hyPiRion | michaniskin: yeah, it's abandonded |
| 19:27 | michaniskin | hyPiRion: thanks. "pod" is a choice name, but don't want to confuse with core Clojure things |
| 19:28 | hyPiRion | I think you can safely use the term pod in your project without being scared of it suddenly popping into existence |
| 19:29 | michaniskin | oh thank god |
| 19:41 | antonv | why when I evaluate (require 'myprj.core), I get "syntax-ppss: Lisp nesting exceeds `max-lisp-eval-depth'" error in CIDER? |
| 19:41 | antonv | is it some circularity in the returnined value, preventing object printing? |
| 19:42 | antonv | I mean printing of the returned namespace object? |
| 19:42 | clifton | anyone know why it says method not in interface when it is? (reify AWTEventListener (eventDispatched [event] (println event))) |
| 19:43 | antonv | but in *cider-repl* (require 'myprj.core) works |
| 19:53 | holo | I found a trick to not pull out my hair when developing clj/cljs compatible macros to use in .cljx. just create two .clj files. one for clj macros, other for cljs macros, and name the macros the same way in both files, only change impl. then in the ns form use #+clj/#+cljs. sanity back!! |
| 19:54 | clifton | nevermind, it didnt work because interface methods need to be reified with [this & args] and not just [& args] |
| 20:09 | creese | I need to create a local library that I can link to. Anyone know how to do the equivalent of 'python setup.py develop'? |
| 20:13 | ered | creese: what does `python setup.py develop` do? |
| 20:15 | creese | it installs a local version of the library into your environment so you can use it elsewhere, changes in the source lib are automatically reflected in other projects, useful for development |
| 20:15 | ered | creese: you might want lein checkouts |
| 20:16 | ered | https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies |
| 20:19 | yedi | anyone have experience deploying datomic clojure apps to ec2? |
| 20:19 | creese | ered: That's exactly what I need. Thanks! |
| 20:19 | yedi | if so wanna send some pointers my way? |
| 20:23 | michaniskin | yedi: http://docs.datomic.com/aws.html <-- worked for me |
| 21:05 | noprompt | well it didn't work. |
| 21:05 | noprompt | Raynes: can't figure out what i need to do to make this happen. |
| 21:05 | noprompt | if it's even possible. |
| 21:06 | noprompt | hyPiRion: thanks for the tip by the way. it works great now. |
| 21:09 | arrdem | michaniskin: pods? |
| 21:10 | michaniskin | arrdem: these things: https://kotka.de/blog/2010/12/What_are_Pods.html |
| 21:10 | arrdem | michaniskin: already reading it.. |
| 21:14 | oinksoft | is it normal to isolate exported classes in an aot namespace? |
| 21:15 | oinksoft | a project i am working on has :aot [this-project.aot] |
| 21:15 | oinksoft | and other source files will say ;; gen-class statement in this-project.aot |
| 21:20 | noprompt | well i'm fresh out of ideas. |
| 21:21 | noprompt | hyPiRion: if you're still around and you have any thoughts ping me. |
| 21:38 | chare | someone buy me terraria |
| 22:07 | TravisD | Does anyone know if Gorilla REPL can display incanter data? (Charts, matrices, etc). Also, is it mature enough to use as a tool? |
| 22:09 | arrdem | TravisD: well it features plugable rendering so if it doesn't you can add it.. |
| 22:10 | TravisD | arrdem: Yeah, that's true :) |
| 22:10 | arrdem | TravisD: as to maturity it seems to still be really young so I wouldn't expect so. |
| 22:10 | TravisD | ah, shucks. Are there other graphical notebook-style repls? |
| 22:10 | arrdem | I mean.. it works. It's just also being actively developed. |
| 22:11 | arrdem | nope looks like Gorilla is the first and only Clojure notebook |
| 22:11 | arrdem | unless you count Light Table |
| 22:12 | TravisD | cool, thanks! |
| 22:15 | ivan | TravisD: Session is another |
| 22:15 | arrdem | $google clojure Session repl notebook |
| 22:15 | lazybot | [Session — Medium] https://medium.com/p/1a12997a5f70 |
| 22:15 | arrdem | also ultra new and actively developed... |
| 22:16 | TravisD | hehe, cool :D Thanks for checking. I feel like I didn't do my own legwork |
| 22:17 | arrdem | eh... I'd love to have a good notebook style tool, so this is personal research for me too :P |
| 22:19 | TravisD | hehe :D |
| 22:20 | arrdem | hum... anyone care to comment on using core.logic with a relatively large external dataset? |
| 22:21 | arrdem | I suppose that I could dynamically construct DBs... but that feels a little gross. |
| 22:25 | gtrak | anyone have any tips how to debug core.async? I'd like to be able to see which channels are blocked/full. Maybe fantasy :-). |
| 22:26 | gtrak | I might resort to sliding buffers, but that seems dirty. |
| 22:40 | arrdem | do we have a standard way of writing edn files, all I see is pr-str :c |
| 22:42 | ivan | arrdem: http://dev.clojure.org/jira/browse/CLJ-1201 |
| 22:42 | ivan | nothing else yet afaik |
| 22:42 | arrdem | thanks ivan, voted the ticket up. |
| 22:57 | Raynes | noprompt: Well. |
| 22:57 | Raynes | noprompt: I can't think of a way to make it work very well. |
| 22:58 | Raynes | noprompt: I guess you can buffer lines and output them with tags. |
| 22:58 | Raynes | My idea was just replace *out* with something you control, and then handle outputting yourself with tags. |
| 22:59 | oinksoft | aw clojure doesn't have guards :( |
| 22:59 | noprompt | Raynes: so yeah: https://gist.github.com/noprompt/a29cf0da3684990e6373#file-dup-clj-L23 |
| 23:00 | Raynes | You expect me to work with you when you link to gist? |
| 23:00 | Raynes | I'm not a savage bro |
| 23:00 | noprompt | lol |
| 23:00 | noprompt | Raynes: well video call you and share my screen. |
| 23:00 | noprompt | Raynes: haha |
| 23:01 | noprompt | Raynes: solving a problem over IRC is savagery. |
| 23:01 | Raynes | Video calls give me hives. |
| 23:01 | noprompt | so where did we get with all this? |
| 23:01 | noprompt | no where. |
| 23:01 | noprompt | haha |
| 23:02 | Raynes | So what isn't working about this? |
| 23:03 | noprompt | it's either a) tagging one line and then not tagging the rest or b) not tagging anything at all and showing no output. |
| 23:04 | Raynes | noprompt: You're right, we definitely needed a video call for that sentence. :P |
| 23:04 | clojurebot | Huh? |
| 23:05 | Raynes | clojurebot: shhhh |
| 23:05 | clojurebot | Cool story bro. |
| 23:05 | Raynes | Moving to PM |
| 23:06 | amalloy | ~guards |
| 23:06 | clojurebot | SEIZE HIM! |
| 23:06 | amalloy | ;; for oinksoft |
| 23:06 | bob2 | oinksoft, as in for pattern matching? |
| 23:30 | oinksoft | amalloy, haha |
| 23:30 | oinksoft | bob2, yea |
| 23:30 | amalloy | oinksoft: i mean, clojure doesn't have pattern matching at all, so the fact that guards are missing isn't what would get me down |
| 23:31 | oinksoft | amalloy, i found this https://github.com/clojure/core.match |
| 23:31 | Raynes | $google core.match |
| 23:31 | lazybot | [clojure/core.match · GitHub] https://github.com/clojure/core.match |
| 23:31 | Raynes | DAMN IT |
| 23:31 | oinksoft | :p |
| 23:32 | amalloy | sure, but if you're willing to use core.match, that has guards |
| 23:32 | amalloy | https://github.com/clojure/core.match/blob/master/src/main/clojure/clojure/core/match.clj#L1443-L1448 |