2015-09-27
| 00:32 | akkad | what editor has the clojure dev mindshare these days? |
| 00:35 | scriptor | largely emacs, I think some people use Cursive or Vim with Fireplace |
| 00:36 | cfleming | (disclaimer: Cursive author) Actually, a lot of people use non-Emacs setups these days |
| 00:37 | nxqd | hi guys, does anyone here using reagent. I have a little problem when working with the lib. I'm trying to create a component with local state and parameters, what I have tried is : (defn comp [x] (let [state (r/atom {:test true})] (fn [x] [:div (str x)])) |
| 00:37 | nxqd | but x doesn't seem to be passed down. it's value is nil. |
| 00:37 | cfleming | akkad: If you're new to Clojure, generally you should use whatever you're used to, and not try to mix learning Clojure and a new editor |
| 00:37 | akkad | use to CL and emacs, but cider clearly is more than the editor can handle |
| 00:37 | scriptor | cfleming: what's the breakdown these days? I haven't really been following the community news much |
| 00:38 | scriptor | akkad: cider works great with emacs |
| 00:38 | cfleming | scriptor: The only data I'm aware of is the state of Clojure survey, which is almost a year out of date now and must be due for a new one soon. |
| 00:39 | nxqd | akkad: if you are learning Clojure, but advice is don't mix up learning and customizing editor at the same time. |
| 00:39 | akkad | https://gist.github.com/7bc575c5e69574af27e9 it loves emacs like a parasite |
| 00:39 | akkad | nxqd: obviously not |
| 00:39 | nxqd | I use only inferior-lisp to integrate with clojure repl. No fancy stuff :D it just works |
| 00:39 | akkad | yeah that does seem less likely to eat cpu |
| 00:42 | akkad | was just curious where most of the love was going these days for improvements. |
| 00:45 | akkad | is there an inspect/describe equiv? |
| 01:03 | nowprovision | when using spyscope, is it the best approach to remove #spy/* entirely once shipping, or is there a simple way to make #spy/* be a no-op? |
| 01:07 | nowprovision | or put another way change/replace data readers depending on environment |
| 01:59 | craftybones | What is the difference between let and when-let? I mean I get it from the documentation, but I don't see when to use the when-let. Let seems to handle it in most cases |
| 02:04 | craftybones | Ah, never mind. Got it |
| 02:29 | craftybones | Can most node libraries be used interchangeably in cljs? |
| 02:55 | akkad | https://gist.github.com/b5d9b69f6978827a2782 this look proper? |
| 03:00 | tmtwd | (defn mmap [m f a] (->> m (f a) (into (empty m)))) what does this function do? |
| 03:02 | tmtwd | nvm |
| 03:40 | craftybones | Is there a preferred way of doing an indexOf look up? I am using .indexOf, but I can't pass that around as it is Java interop. Is there a better way? |
| 03:41 | craftybones | I have a function that may use indexOf or lastIndexOf depending on different situations. |
| 03:46 | nowprovision | what do you want to do with the index, perhaps you can use something that encapsualte both the lookup and next operation (e.g. a regex replace) |
| 03:47 | craftybones | I have a series of headings(north south etc). Depending on which direction I turn, I want to pick the next heading |
| 03:48 | craftybones | I am storing this in a vector [:N :NE :E :SE :S :SW :W :NW] |
| 03:50 | craftybones | I simply want the next index, but the next index is not a simple dec/inc if its the last or first element. |
| 03:50 | craftybones | in order to deal with this, I wanted to have the vector as [:N :NE :E :SE :S :SW :W :NW :N] |
| 03:51 | craftybones | Now, my turn-left and turn-right are simply (dec .lastIndexOf) and (inc .indexOf) respectively |
| 03:52 | TEttinger | it is a simple inc/dec if you modulo by length |
| 03:54 | TEttinger | ,(let [coll [:N :NE :E :SE :S :SW :W :NW]] (map #(nth coll (rem % (count coll)) (range 6 11))) |
| 03:54 | craftybones | @TEttinger, the indexOf is a simple modulo, however, let us say I end up with a 0 as the index. I can't simply dec. |
| 03:54 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 03:54 | TEttinger | ,(let [coll [:N :NE :E :SE :S :SW :W :NW]] (map #(nth coll (rem % (count coll))) (range 6 11))) |
| 03:54 | clojurebot | (:W :NW :N :NE :E) |
| 03:55 | TEttinger | ,(let [coll [:N :NE :E :SE :S :SW :W :NW]] (map #(nth coll (rem (- 2 %) (count coll))) (range 6 11))) |
| 03:55 | clojurebot | #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException> |
| 03:55 | TEttinger | hm |
| 03:55 | TEttinger | which was it then... |
| 03:55 | craftybones | My input btw is not an index. My input is a direction. So there is a lookup |
| 03:55 | craftybones | (= :NW (left-of :N)) |
| 03:56 | TEttinger | ,(let [coll [:N :NE :E :SE :S :SW :W :NW]] (map #(nth coll (mod (- 2 %) (count coll))) (range 6 11))) |
| 03:56 | clojurebot | (:S :SE :E :NE :N) |
| 03:57 | TEttinger | sounds like this would be a good choice for a map? |
| 03:57 | craftybones | @TEttinger - yeah, that's a copout. I was just wondering if there's a way to do this with an indexOf. |
| 03:57 | craftybones | Thanks though |
| 03:57 | TEttinger | ,(zipmap [:N :NE :E :SE :S :SW :W :NW] (range)) |
| 03:57 | clojurebot | {:N 0, :NE 1, :E 2, :SE 3, :S 4, ...} |
| 03:58 | craftybones | @TEttinger - I was thinking of making each direction hold both its left and right headings. That way its just a straight ahead lookup |
| 03:58 | craftybones | But yeah, that'll work too |
| 03:58 | craftybones | Thanks |
| 04:02 | TEttinger | ,(let [coll [:N :NE :E :SE :S :SW :W :NW] reversed (zipmap coll (range)) shift #(nth coll (mod (% (reversed %2)) (count coll))) left (partial shift dec) right (partial shift inc)] (-> :N left left left right)) |
| 04:02 | clojurebot | :W |
| 04:03 | TEttinger | ^ craftybones: look decent? |
| 04:04 | craftybones | @TEttinger yeah, that's pretty cool |
| 04:05 | TEttinger | bidirectional maps are unusually useful considering how rarely they end up in standard libraries. But I guess that's because they're easy enough to fake with a technique like a vector and a map |
| 04:11 | craftybones | https://gist.github.com/craftybones/a5b7a407b321d16e89bf |
| 04:11 | craftybones | @TEttinger - this is what I got |
| 04:11 | craftybones | Tell me what you think if you've a minute |
| 04:12 | TEttinger | sure thing |
| 04:12 | craftybones | Ignore the directions being clobbered, that was just a quickie ;) |
| 04:14 | TEttinger | hm, were you trying to avoid .indexOf ? |
| 04:14 | TEttinger | that is a clever approach, btw |
| 04:15 | TEttinger | (doc memfn) |
| 04:15 | clojurebot | "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn. name may be type-hinted with the method receiver's type in order to avoid reflective calls." |
| 04:15 | craftybones | Thanks. No, I wasn't avoiding it, just wasn't sure how to pass it |
| 04:15 | craftybones | Thanks a ton for memfn |
| 04:15 | craftybones | That looks like what I want, though, what I've written seems to be readable |
| 04:15 | TEttinger | cool, it's an odd name for sure |
| 04:16 | TEttinger | indeed. |
| 04:16 | TEttinger | is performance a concern at all? |
| 04:18 | craftybones | Not yet, but if it were, I'd just use a map |
| 04:18 | TEttinger | I would think storing two vectors, one already reversed, would avoid a slight amount of overhead from rseq (which is not slow compared to reverse, so that's something) and converting back to vec in next-heading |
| 04:18 | TEttinger | but that really only matters if calling this a ton |
| 04:18 | craftybones | @TEttinger that's cool too |
| 04:18 | TEttinger | I see directions and i think of functions that get called a lot, from a game programming angle |
| 04:19 | craftybones | Yeah, hopefully, eventually. As of now, its just katas :) |
| 04:19 | TEttinger | ah cool |
| 04:19 | craftybones | Btw, what's a canonical way to test wrt assertions/test? Do you have a deftest that has one large case with each "testing" having more than one assertions? |
| 04:21 | roelof | hello, for checking if I use good clojure code can I better use kibit or eastwood ? |
| 04:22 | TEttinger | craftybones: I would imagine you would have multiple deftests if you have multiple things that could fail, but I haven't written any tests in clojure |
| 04:23 | TEttinger | roelof: I think the dev of eastwood is in here. |
| 04:24 | TEttinger | ah, roelof they can be used together |
| 04:24 | roelof | TEttinger: oke, I know kibit could find thinks like this (= ( + a b) 0) that could be better (zero? (+ a b)) |
| 04:24 | roelof | oke, I do a github course and I like to know if im on the right track |
| 04:25 | craftybones | @TEttinger - hee hee. Sorry, the test thing...its just been sort of drummed into me to do it. |
| 04:25 | TEttinger | I need to get used to it too |
| 04:25 | roelof | TEttinger: who is the dev of eastwood then ? |
| 04:26 | TEttinger | I was incorrect, I think I mixed up a contributor with the primary dev. and there's a lot of contributors |
| 04:26 | roelof | NP |
| 04:26 | TEttinger | I would guess since the URL of eastwood has jonase in it and that is what someone's nick starts with here... not to nick-alert if it's night-time or work-time... |
| 04:27 | roelof | then the next task is to find out how to add the two to this : http://lpaste.net/141813 |
| 04:27 | roelof | oke |
| 04:28 | roelof | here it is morning time : 10:39 hour |
| 04:28 | TEttinger | https://github.com/jonase/eastwood#installation--quick-usage |
| 04:28 | TEttinger | while you have your profile open, https://github.com/jonase/kibit#usage |
| 04:29 | roelof | oke, I could just past these two after the profiles ? |
| 04:29 | TEttinger | let me check mine |
| 04:30 | TEttinger | it should be inside the map |
| 04:30 | TEttinger | the whole of profiles.clj should be a single {} map |
| 04:32 | TEttinger | if it specifies to put it in plugins, plugins is a vector of vectors [[foo "foo"] [bar "bar"]] containing pairs like that |
| 04:33 | roelof | I have now this : http://lpaste.net/141814 but it fails with this message : aused by: java.lang.IllegalArgumentException: No value supplied for key: {:user {:plugins [[jonase/eastwood "0.2.1"] [lein-kibit "0.1.2"]]}} |
| 04:35 | TEttinger | oh, I'm not sure it works with the profiles in a project.clj |
| 04:35 | TEttinger | it's a plugin for lein, both of them are |
| 04:36 | TEttinger | the instructions here tell you where to go https://github.com/jonase/eastwood#installation--quick-usage |
| 04:38 | roelof | TEttinger: I thought I did what the instructions said :( |
| 04:39 | TEttinger | profiles.clj is a file in a subdirectory of your user directory, ~/.lein/profiles.clj |
| 04:40 | craftybones | Have you guys heard of this neat tool called pathpicker? |
| 04:41 | craftybones | Just started using it. Really cool and convenient. Lets you parse files out of arbitrary text output and then perform tasks on them |
| 04:41 | TEttinger | woah |
| 04:46 | expez | Anyone seen file-seq produce results like "/home/expez/the/root/~/the/root/src/some.ns/file.clj"? |
| 04:46 | expez | It's 99% correct, but I get a few files with screwed up paths like that |
| 04:49 | neurostorm | Whats the library to use for dom manipulation and dom element creation? Dommy + Hipo? |
| 05:11 | muhuk | expez: strange. I also use linux, I get good results when I do (file-seq (file "/home/muhuk")) |
| 05:12 | muhuk | expez: could it be symlinks |
| 05:12 | expez | muhuk: I have 73 files and 3 paths that are messed up |
| 05:12 | expez | muhuk: nope |
| 05:12 | expez | "/home/expez/git/refactor-nrepl/~/git/refactor-nrepl/src/refactor_nrepl/rename_file_or_dir.clj/find_symbol.clj" |
| 05:13 | muhuk | expez: yeah, I've just checked symlinks work fine. |
| 05:13 | expez | this path is the combination of two others, but the two other files are additionally listed correctly |
| 05:13 | expez | I figured I would just filter with .exists, but that returns true on those files! |
| 05:13 | muhuk | expez: what path are you using? how do you build it? |
| 05:13 | expez | "/home/expez/git/refactor-nrepl" |
| 05:14 | muhuk | so you don't combine File's etc. |
| 05:14 | muhuk | you just pass that str as the root path? |
| 05:14 | expez | I inspected the output of the file-seq and I couldn't spot the problem, but I might've missed it looking at thousands of entires |
| 05:15 | expez | muhuk: no I pass that to the java.io.File constructor (or it would obv blow up) |
| 05:15 | ionthas | ls |
| 05:15 | expez | (.endsWith (.getPath (io/file path-or-file)) ".clj") <= this is the filter I use on the file-seq which seems to be side-effecting, somehow? |
| 05:15 | muhuk | expez: that's what I meant. |
| 05:16 | ionthas | (ups, sorry about that) |
| 05:16 | muhuk | expez: what side-effect? |
| 05:17 | muhuk | expez: actually why don't you paste your code somewhere |
| 05:20 | expez | muhuk: https://gist.github.com/expez/a055c5296aaccd52ffaa |
| 05:22 | muhuk | expez: well written code |
| 05:22 | expez | muhuk: you can even clone the repo if you want to get the exact same output https://github.com/clojure-emacs/refactor-nrepl |
| 05:22 | muhuk | expez: file-seq returns a seq of files, so you probably shouldn't wrap them with io/file, no? |
| 05:23 | expez | io/file on a File is a no-op |
| 05:23 | expez | acts like identity |
| 05:23 | muhuk | expez: just for fun, try without wrapping it again |
| 05:23 | muhuk | could be the cause of weirdness denormalization |
| 05:23 | expez | yeah, I did try that, when I got real desperate :p |
| 05:24 | muhuk | no cigar eh? |
| 05:25 | expez | nope |
| 05:26 | muhuk | expez: sorry I can only think of less than semi-useful stuff at this point |
| 05:26 | expez | muhuk: could you try cloning the repo and see if you get the same result? |
| 05:26 | muhuk | if you figure it out let me know though I'm curious |
| 05:26 | muhuk | ok let me try |
| 05:26 | expez | If I'm the only affected user then this isn't *that* serious a bug |
| 05:27 | expez | It might also be limited to my computer on this project :) |
| 05:32 | muhuk | expez: I wrote the clj-file fn, tried with it |
| 05:32 | muhuk | I get good paths |
| 05:32 | xtrntr | i'm having trouble understanding this piece of code |
| 05:32 | expez | muhuk: thanks for checking, then I'm going to worry about this until someone else experiences similar issues |
| 05:33 | xtrntr | (swap! state (fn [curr] (update-canvas curr surface) (-> curr .. .. ..))) |
| 05:33 | muhuk | expez: 69 results returned |
| 05:33 | muhuk | xtrntr: which part of that code is confusing for you? |
| 05:35 | xtrntr | i suppose the first thing is swap! returns some kind of value |
| 05:35 | xtrntr | but i don't see how it's being used in the function |
| 05:36 | expez | xtrntr: swap! is side-effecting, it's only used to change the value held by the atom named "state" |
| 05:36 | muhuk | xtrntr: swap!'s return value is not really its thing. You should perhaps read on it first. |
| 05:37 | xtrntr | side-effecting? |
| 05:37 | xtrntr | the docs aren't clearing up anything for me sorry |
| 05:37 | justin_smith | muhuk: the return value of swap! is the new value of the atom |
| 05:37 | muhuk | xtrntr: if update-canvas is side effecting, this is not good code (unless it's clojurescript) |
| 05:37 | xtrntr | it is clojurescript yeah.. |
| 05:37 | muhuk | justin_smith: I didn't say it's not, why are you telling me this? |
| 05:38 | justin_smith | "swap!'s return value is not really its thing" - the changed value of the atom (which is what it returns) is it's main thing |
| 05:38 | muhuk | xtrntr: then just think of swap! as a set operation (instead of a compare-and-set operation) |
| 05:39 | muhuk | xtrntr: side-effecting means it has side effects, like printig/logging something or changing DOM. |
| 05:41 | xtrntr | okay, i think i understand the rest |
| 05:41 | expez | muhuk: I figured it out. I actually have a dir called ~/ in my refactor-nrepl directory after working on the rename-file-or-dir refactoring a while back. *face palm* |
| 05:41 | xtrntr | so the end result of this swap! is a new state value |
| 05:41 | xtrntr | and before you do it you call update-canvas |
| 05:41 | xtrntr | then call tick-ball |
| 05:41 | xtrntr | then pass the result of tick-ball to handle-brick-collision and vice versa for handle-paddle-collision (the -> thingy) |
| 05:42 | muhuk | expez: cool |
| 05:42 | xtrntr | so this function changes the value of state? |
| 05:42 | xtrntr | why do you say it's not code unless its clojurescript though? |
| 05:43 | muhuk | xtrntr: it's not good code unless it's cljs |
| 05:43 | xtrntr | i suppose i've been confused all the while where the state was being held, and it's updated through some kind of timer |
| 05:43 | xtrntr | the function is essentially one big set! operation |
| 05:43 | muhuk | xtrntr: because JavaScript is single-threaded, so there will be no retries |
| 05:43 | xtrntr | no retries? |
| 05:44 | muhuk | xtrntr: Clojure is multi-threaded, so more than one thread might be trying to swap! the same atom |
| 05:44 | muhuk | xtrntr: one of them wins, the rest will re-try, re running their function |
| 05:44 | muhuk | xtrntr: with the current result of the winning thread |
| 05:45 | xtrntr | what would that code look like if it weren't written for single threading? |
| 05:45 | xtrntr | i'm curious what this re-try would look like in code |
| 05:45 | muhuk | xtrntr: you woudn't have update-canvas in your fn |
| 05:45 | muhuk | xtrntr: ok, it might be idempotent, but suppose it isn't |
| 05:46 | muhuk | xtrntr: in multi-threaded env, first swap! wins, having called update-canvas |
| 05:46 | muhuk | xtrntr: second thread calls update-canvas twice, because it re-tried |
| 05:46 | muhuk | xtrntr: makes sense? |
| 05:46 | justin_smith | muhuk: first does not win - the only one that did not see a concurrent change (that is, the last of the overlapping calls, if there were any overlaps) wins |
| 05:47 | justin_smith | well maybe not even the last actually |
| 05:47 | justin_smith | it's very possible for none to win (or more than one) depending on how the calls line up |
| 05:49 | xtrntr | ahh |
| 05:49 | xtrntr | i don't understand really |
| 05:49 | xtrntr | maybe i can come back to this later |
| 05:50 | justin_smith | xtrntr: atoms don't lock - they check the value, run the function you pass to swap, then only if the value has not changed since you started running the function do they commit the result |
| 05:50 | justin_smith | xtrntr: they retry if any changes occur while they are calculating |
| 05:51 | xtrntr | i think i understand that, but i gotta see the code for that first |
| 05:51 | muhuk | justin_smith: please don't tag me. I'm not interested in your bikeshedding. |
| 05:51 | xtrntr | and i've never written applications that call for this kind of thing yet so far |
| 05:52 | muhuk | xtrntr: rule of thumb is; don't have side effects in the function you pass to swap!. |
| 05:52 | muhuk | xtrntr: also see https://clojuredocs.org/clojure.core/io! |
| 05:52 | xtrntr | i think update-canvas has side-effects |
| 05:52 | xtrntr | it's just redrawing the whole game state |
| 05:53 | xtrntr | is that okay? |
| 05:55 | muhuk | xtrntr: kinda subjective. Some would say it's OK if it's cljs. I would still not have that there. |
| 05:55 | muhuk | xtrntr: I use reset! a lot more in clojurescript for this particular reason. reset! is honest. |
| 05:57 | xtrntr | okay :) |
| 05:57 | xtrntr | i was planning to program some graphical stuff |
| 05:57 | xtrntr | seems like it'll be a bit tricky |
| 05:57 | xtrntr | to do it clojure style |
| 05:58 | xtrntr | what kind of fun stuff is clojure good at? |
| 05:59 | muhuk | xtrntr: all kinds of stuff, once you get the hang of it |
| 05:59 | muhuk | keep working on graphics stuff I say |
| 05:59 | muhuk | more gratifying than most stuff IMO |
| 06:00 | xtrntr | i did it imperative style in racket |
| 06:55 | thiagofm | 12:55 *** NAMES @ChanServ [Neurotic] _alejandr0 _ato `brian aaron7 abh adamhill adammh addisonj adereth AeroNotix ahoegh__ AimHere akhudek akilism akkad akurilin alchemis7 alexbaranosky alexyakushev algernon Alina-malina alisdair amalloy amano- ambrosebs Amun_Ra ananthakumaran andereld andrewstewart andreypopp ane anekos anon-5660 Answrguy_ anti-freeze aperiodic apetresc arkh arnihermann arpunk arrdem arrubin ashnur |
| 06:55 | thiagofm | Atlanis atomi auganov augustl avdi averell AWizzArd awwaiid babilen bacon1989 bailon bakedb ballingt Balveda basteni bdruth bencryption benizi beppu bg451 bhagany bigs Biohazard bja bjeanes bkamphaus blake_ blkcat Blkt bobpoekert bobth__ bobwilliams bodie_ bogdanteleaga boodle borkdude bourbon boyscared boztek|afk bracki brandonkl brianwong brixen brokenstring Bronsa broquaint bru bruceadams btobolaski budai cantsi |
| 06:55 | thiagofm | n carc cartwright cataska cespare cfleming cfloare cgfbee charliekilo chavezgu chenglou ChiralSym choas ChongLi chouser-log Chousuke chrchr chriswk cichli clojurebot cmbntr_ cmiles74 codefinger codelahoma coffeejunk cojy CookedGryphon cprice404 Cr8 craftybones crodjer cross cursork CVTJNII cYmen cyraxjoe d4gg4d d_run daemian dakrone dalecooper30 danlarkin danlentz danlucraft danneu danvet danzilio dean demophoon den |
| 06:55 | thiagofm | e14 Deraen DerGuteMoritz devn devsda dhruvasagar dhtns Diabolik dignati_ dillap diyfupeco dj_ryan djcoin dkua dm3 dnolen doctorinserenity dogonthehorizon dominiclobue_ DomKM donbonifacio dopamean_ Draggor dsantiago dsp_ dubitae Duke- dukeraoul dustinm dxlr8r dylanp dysfun dzimmerman eagleflo ecelis edoloughlin_ eduaquiles egli egogiraffe ekroon ellinokon emdashcomma emperorcezar Empperi EnergyCoffee engblom eno789 e |
| 06:55 | thiagofm | oinh ephemeron erdic ericbmerritt eriktjacobsen Ethan- euphoriaa evilthomas evoqd Excureo expez f10w3r5 f3ew Fare farhaven felher felipedvorak felixn fikusz firstdayonthejob fluchtreflex folker Foxboron franco franklnrs futuro fuziontech gabrbedd galaux gcommer georgej162 gf3 gfredericks ggherdov ggreer ghjibwer gienah gigetoo gilliard GivenToCode gko gozala grandy gratimax gregf_ greghendershott grim_radical groot |
| 06:55 | thiagofm | Guest18627 Guest38454 guilleiguaran__ gws H4ns hadronzoo hakvroot halorgium HDurer HDurer_ henrytill herrwolfe heurist hipertracker hiredman hive-mind honkfestival honza hsaliak hugod hyPiRion iamdustan ibdknox icedp idnar ieure ikitommi_ imanc infinite1tate inoperable insamniac ionthas itruslove ivan\ j0ni J_Arcane jaaqo jackhill jackjames jamiei janne jasalt_ jaster jave jayne jba_ jconnolly jcromartie jcsims jdag |
| 06:55 | thiagofm | gett jeadre jeaye jeregrine jeremyheiler jet jetlagmk2 jez0990_ jfojtl jgdavey jgmize|strngloop jimrthy_away jinks_ jjmojojjmojo jjttjj jkni jkogut jkogut_gs jlewis jlf jlf` jlouis jlpeters jlyndon jmolet jodaro joeytwiddle jonasen jonathanchu jonathanj jonathanj_ joshskidmore jrdnull jsime JStoker juancate Juhani julienXX justin_smith justinmcp justizin jweiss kandinski karls katratxo keen__________ keifer ken_barb |
| 06:55 | thiagofm | er kenrestivo kephale kitallis klobucar Klumben kmicu Kneiva kraft Kruppe kungi kwmiebach kylo l1x l2x lachenmayer lambdahands lancepantz larme laxask LBRapid ldcn lea leftylink leifw lenstr Leonidas leptonix lfranchi Licenser littleli LnL lnostdal lobotomy lodin_ lokydor Lollypop lotia low-profile lpaste Lugoues LukeWinikates___ luma LuminousMonkey luxbock Luyt_ lvh lwlvlpl lyddonb lzhang m00nlight m1dnight_ m_3 ma |
| 06:55 | thiagofm | chty madscientist_ magnars mahnve maio majoh makufiru malyn Mandus manytrees marce808 mariorz markmarkmark marshzor martinklepsch martintrojer marvi MasseR matt_c matt_d matthavener mattrepl maxmartin mccraig mcktrtl mdeboard meandi_2 mearnsh Meeh Mendor|scr merlinsbrain metadaddy mfikes mgaare michaniskin michel_slm mihaelkonjevic_ mikolalysenko mindCrime misv mlb- mmikeym Mongey moop moquist Morgawr MPNussbaum mrb |
| 06:55 | thiagofm | _bk_ mrLite mrowe_away msassak mtd mtdowling Mugatu muhuk mungojelly MVPhelp myguidingstar mysamdog n1ftyn8_ n8a naga` nano- narendraj9 Natch nathanic nberger ndrst necronian neektza neena newgnus nexysno NhanH nickenchuggets nickmbailey nighty-_ nighty^ nilern_ ninjudd nlew noidi nomiskatz_ noncom noplamodo nseger nsuke nulpunkt numberten nw nzyuzin Ober ocharles__ octane-- oddcully OdinOdin omarkj onthestairs opqd |
| 06:55 | thiagofm | onut ordnungswidrig oskarth osnr owenb_____ owengalenjones oyvinrob ozzloy p_l paulweb515 pcn pepijndevos perplexa perrier philth_ piippo pisketti pjstadig pkug pleiosaur pmbauer povilas preyalone psy_ Pupnik_ puredanger puzza007 pwzoii pydave6367 pyon qz r0kc4t r4vi ragge Ragnor raifthenerd randy_ RandyT_ rapzzard^cloud rasmusto Ravana Raynes Raynos raywillig RazorX razum2um razzledazzle rberdeen rboyd rdema reiddr |
| 06:55 | thiagofm | aper retrogradeorbit rfv rigalo_ rinwa__ riotonthebay rippy rivarun rj-code rjknight rlb rlr robink robotmayo rotty rowth rpaulo rs0 rtl rufoa rweir ryanf s0lder safety saltsa sarlalian saurik scgilardi schwap Scorchin scpike_ scriptor sduckett seabre seako seangrove SegFaultAX segmond sephiap septomin seubert Shambles_ sharkz Shayanjm shaym_ shem shiranaihito SHODAN shoky si14 sickill silven sirtaj sivoais sjl__ sk |
| 06:55 | thiagofm | a-fan skrblr sleezd snakeMan64 snits Snurppa sobel socksy sohum solvip someone someplace soncodi Sorella sorenmacbeth spacepluk Speed spicyj splunk spoofednoob srcerer sross07 ssideris stain stardiviner stasku StatusQuotidian stevenleeg StevePotayTeo stian surtn sw1nn taij33n talvdav_ tarcwynne_ tazjin tbatchelli tclamb tcrawley-away tcrayford____ tdammers TDJACR tekacs telex tempredirect terjesb terom TEttinger2 th |
| 06:55 | thiagofm | e-kenny thearthur thecontrarian42 ThePhoeron thesquib thiagofm threeve_ TimMc timvisher TMA tmarble tmciver tokik tomaw tombooth tomjack tomku tomphp tonini torgeir ToxicFrog tpope Trieste Trioxin Tristam Tritlo troydm truemped tschimmi42 Tuna-Fish turbofail tuxlax tvaalen twem2 Uakh uber ubuntu3 vandemar varioust vedwin vendethiel Viesti vilmibm vishesh visof visof_ voidlily waamaral wamaral wang wasamasa whee whoo |
| 06:56 | diyfupeco | thiagofm: … |
| 06:56 | thiagofm | sorry. |
| 06:56 | Alina-malina | ho nigga pleaseeee |
| 06:56 | diyfupeco | thiagofm: Let me guess, emacs? |
| 06:56 | thiagofm | yes, emacs |
| 06:56 | scriptor | been there |
| 06:56 | farhaven | that's... happening a lot lately |
| 06:56 | thiagofm | so, what do I do? :( |
| 06:56 | jeaye | -_- |
| 06:56 | diyfupeco | Learn to control your editor. |
| 06:57 | thiagofm | am I going to get banned? |
| 06:57 | thiagofm | :D |
| 06:57 | Uakh | fuck the police |
| 06:57 | diyfupeco | Uakh: But only the cute ones! :P |
| 06:57 | muhuk | what is causing this? |
| 06:57 | muhuk | I don't use emacs |
| 06:57 | Bronsa | thiagofm: consider using a client with flood protection |
| 06:58 | thiagofm | Bronsa: really regretting going rcirc by a suggestion of a friend |
| 06:58 | Bronsa | if you want to keep using emacs, erc is built-in and has that facility |
| 06:58 | Bronsa | utility* |
| 06:59 | Bronsa | thiagofm: and no you won't get banned |
| 07:01 | diyfupeco | muhuk: Basically a function which lists all users and gets written into the message buffer somehow. |
| 07:02 | muhuk | diyfupeco: got it. Sounds innocent. Thanks for the info. |
| 07:33 | leftylink | I don't usually see this happen, maybe I don't hang around in channels with emacs users often enough... |
| 07:34 | hellofunk | does anyone know how Heroku knows which project.clj profile to use when you deploy there? I can't find docs about how to name and specify the profile |
| 08:03 | triss | whats the simplest way of getting a temporary file *path*.... I'd like a file name rather than a java File returned. |
| 08:03 | triss | ? |
| 08:06 | triss | hang on i don't need it! |
| 08:06 | triss | splendid. spit works with files |
| 08:25 | roelof | Anyone who can help here ? https://www.reddit.com/r/Clojure/comments/3mk6n1/how_to_add_the_plugins_in_this_projectcli/ |
| 08:35 | ane | how did he manage that nick thing |
| 08:35 | ane | is it some feature of erc or something |
| 08:46 | roelof | no body who can help me with my little problem |
| 08:47 | mysamdog | roelof: just add the {:user} bit under :profiles |
| 08:47 | oddcully | roelof: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj |
| 08:48 | oddcully | roelof: or you put that {:user...} thingy in your ~/.lein/profiles.clj |
| 08:50 | roelof | oke, and if I look at the sample I need to use :user and not { :user } |
| 08:54 | roelof | mysamdog: oddcully thanks, this (http://lpaste.net/532544041686925312) seems to be done the job |
| 08:59 | roelof | I use this to check if a number is negative (neg? x) kibit is allright with it but eastwood is saying this : rc/i_am_a_horse_in_the_land_of_booleans.clj:10:3: unused-ret-vals: Pure static method call return value is discarded: (. clojure.lang.Numbers (clojure.core/isNeg x)) |
| 08:59 | roelof | do I have a problem in my code or not ? |
| 08:59 | Bronsa | roelof: looks like you're not using the return value of neg? |
| 09:00 | Bronsa | which usually means you have a bug in your code |
| 09:00 | roelof | I think I do . Here is the code : http://lpaste.net/141822 . I try to make a absolute value |
| 09:01 | Bronsa | roelof: there's no if there |
| 09:01 | roelof | oke, so I need the if. Wierd that midje and kibit did not found it. |
| 09:02 | Bronsa | neither midje nor kibit are linters |
| 09:03 | roelof | oke, but midje schould find it because i assume that the function will produce wrong output |
| 09:04 | Bronsa | if you wrote a reasonable test for it, sure |
| 09:04 | Bronsa | that function as you wrote it is just identity |
| 09:05 | roelof | Bronsa : I did not write the test. This is a clojure course I found on github from the University of Helsinki |
| 09:07 | roelof | nice to see that eastwood also do a lein midje |
| 09:09 | roelof | With the help of eastwood and kibit I could solve a lot of exercises :) |
| 09:15 | roelof | one last question : if I make a function and then a function that the opposite of the first one. Is it allright to use not or can I better use another function |
| 09:15 | craftybones | I've a destructuring question |
| 09:15 | roelof | craftybones: shoot |
| 09:16 | craftybones | I want to destructure [0 0 :N] as {:co-ord [0 0] :heading :N} |
| 09:16 | roelof | that possible |
| 09:17 | craftybones | I can do it the long way by [[x y] :as co-ord h :as heading] and then return it individually |
| 09:17 | craftybones | is there a terse way of saying it? |
| 09:18 | roelof | I do not know . I only know the long way |
| 09:19 | roelof | I hope Bronsa or oddcully can help you |
| 09:24 | craftybones | Ended up writing it as follows |
| 09:24 | craftybones | (defn position [x y h] {:co-ord [x y] :heading h}) |
| 09:26 | muhuk | craftybones: you can also use core.match for that. It'd move the logic of deconstruction closer to where you use it. Either way is fine, you decide. |
| 09:26 | muhuk | roelof: a function that is opposite of another function is vague. If your fn return a boolean value, not is the way to go. |
| 09:34 | craftybones | Is there a way to destructure all keys of a map into corresponding variable names? |
| 09:34 | craftybones | Like so |
| 09:35 | craftybones | (let [{:keys _} {:x 1 :y 2}] x) ? |
| 09:38 | AimHere | Well you can pull the symbols out using 'name' and 'symbol'. I think you might need a macro to bind them to the values again |
| 09:39 | AimHere | ,(map symbol (map name (keys {:x 1 :y 2 :z "wibble"}))) |
| 09:39 | clojurebot | (x y z) |
| 09:39 | muhuk | craftybones: via macros maybe. I wouldn't want to do that though. Too much magic. |
| 09:39 | craftybones | @muhuk that's right |
| 09:39 | craftybones | I stuck to making it more readable |
| 09:39 | craftybones | thanks |
| 09:39 | muhuk | yw |
| 10:12 | roelof | muhuk: thanks, some people say I schould use complement |
| 10:13 | roelof | its about a function that returns true or false |
| 10:19 | reutermj | How do you create a record and inherit from an abstract class? |
| 10:22 | Bronsa | you can't |
| 10:23 | reutermj | darn, does that mean I have to use java and just instantiate the java class? |
| 10:28 | roelof | last challenge. making a leap year function using and/or |
| 10:35 | roelof | I have this code : http://lpaste.net/141825 and see this warning : test/i_am_a_horse_in_the_land_of_booleans_test.clj:2:9: unlimited-use: Unlimited use of (iloveponies.tests.i-am-a-horse-in-the-land-of-booleans) in i-am-a-horse-in-the-land-of-booleans-test |
| 10:35 | roelof | what does it mean |
| 10:43 | roelof | here are the tests : https://github.com/iloveponies/i-am-a-horse-in-the-land-of-booleans-tests/blob/master/src/iloveponies/tests/i_am_a_horse_in_the_land_of_booleans.clj |
| 10:47 | muhuk | roelof: they are right, (complement f) is better than (comp not f) & #(not (apply f %&)) etc. |
| 10:48 | roelof | muhuk: oke, then I will change this (not(teen? age))) to (complement (teen? age)) |
| 10:49 | muhuk | roelof: well not is good there, but (defn opposite-of-f (complement f)) |
| 10:50 | muhuk | roelof: (not (teen? age)) is better than ((complement teen?) age) |
| 10:50 | roelof | oke, then I will it this way |
| 10:50 | muhuk | roelof: not operates on a value, returns a value. complement takes a fn & returns a fn |
| 10:50 | roelof | muhuk: thanks for the explanation |
| 10:50 | muhuk | yw |
| 10:51 | roelof | Now I hope someone can help me with my eastwood warning |
| 10:54 | muhuk | roelof: your paste doesn't make sense to me |
| 10:54 | muhuk | leap-year? |
| 10:57 | muhuk | roelof: ok, it makes sense now. Can't do much about unlimited-use there, it originates from the tests. |
| 10:57 | muhuk | roelof: I would exclude tests from eastwood. |
| 10:59 | roelof | muhuk: oke, how can I do that ? |
| 11:01 | muhuk | roelof: are you familiar with leiningen? |
| 11:02 | roelof | a liitle bit . Im just learning clojure by following the online course from the University of Helsinki |
| 11:03 | muhuk | roelof: ok, you can go to eastwood's github and it should be documented in the readme. |
| 11:03 | muhuk | basically you'll change something in project.clj |
| 11:03 | zxc | Hello! Can somebody teach me Clojure and web stuff, please? |
| 11:03 | roelof | correct . found already in the readme |
| 11:06 | muhuk | He said "please". C'mon! |
| 11:07 | mzdravkov | what is a simple way to implement rand-nth but with non-uniform chance to pick an element? |
| 11:08 | muhuk | mzdravkov: test.check frequencies does a similar thing, but I'm not sure if it's the simplest. |
| 11:08 | muhuk | mzdravkov: can you re-map your distribution to [0.0, 1.0) ? |
| 11:09 | mzdravkov | if I have [a b c] and a has 70% chance, b 20% and c 10% I can put them like ranges side by side: a [0;70), b [70;90), c [90; 100] and then pick a (rand 100) and check in which range it is, but this seems too complicated |
| 11:10 | mzdravkov | muhuk: yes, I'll check it out. Thanks |
| 11:10 | zxc | muhuk: I like you |
| 11:11 | muhuk | mzdravkov: what I meant by mapping was a bit different |
| 11:12 | muhuk | (f 0.33) -> 0.7, (f 0.67) -> 0.9, (f 1.0) -> 1.0 |
| 11:12 | muhuk | well my numbers are probably wrong, but I think you get the idea, fitting a function. |
| 11:13 | roelof | pity , according to the manual it cannot be supressed and this (lein eastwood "{ exclude-linters[:unlimited-use] }" does also not work |
| 11:16 | roelof | found it, make a typo : this one is working : ein eastwood "{ :exclude-linters[:unlimited-use] }" |
| 11:16 | roelof | so this chapter is ready ":) |
| 11:17 | roelof | zxc: what do you think of this course : http://iloveponies.github.io/120-hour-epic-sax-marathon/ |
| 11:18 | roelof | Im doing it myself |
| 11:22 | zxc | roelof: I was doing brave clojure some time ago, but found it boring |
| 11:22 | zxc | too many unnecessary words |
| 11:22 | wasamasa | brave people enjoy all the words |
| 11:23 | roelof | I know that brave is rewritten and in a few weeks a new edition is out and a new website |
| 11:23 | roelof | maybe doing the same course till there is a new version of brave |
| 11:23 | zxc | it was fun to read, but not fun when I had like 30min of free time and unable to learn anything, because of jokes |
| 11:23 | zxc | (busy college student) |
| 11:25 | zxc | roelof: It seems nice, also real life programs are interesting |
| 11:25 | zxc | roelof: I'll definitely read that |
| 11:37 | roelof | why this error |
| 11:37 | roelof | xception Unsupported binding form: (get v 0) on this code :http://lpaste.net/141828 |
| 11:40 | oddcully | roelof: isnt just (let [[f _ t] v] ...)? |
| 11:40 | oddcully | if you want the (get) there, then remove one layer of [], since this is no destructuring then |
| 11:41 | roelof | in the explanation is this stated : (get ["a" "b" "c"] 1) ;=> "b" |
| 11:42 | oddcully | yes, so either go (let [x (get ...)]) or destructure |
| 11:42 | oddcully | your are mixing things, therefor the error |
| 11:43 | roelof | odd , if I do it this way : http://lpaste.net/141829 thirt_number cannot be resolved |
| 11:44 | roelof | or do I misunderstood you |
| 11:44 | oddcully | no, but you removed the wrong layer of [] (the outer one |
| 11:44 | oddcully | ) |
| 11:45 | oddcully | its (let [x (get) y (get)]) |
| 11:45 | roelof | sorry, I will hit the books to see what it must be |
| 11:46 | oddcully | the grimoire has lots and lots of examples: http://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/let/ |
| 11:46 | roelof | pff, finally working. Sometimes the [ and () are making me grazy |
| 11:52 | roelof | Thanks all. I call it a day. Its time for dinner and watching tv |
| 12:03 | Trioxin | why everybody's name get mentioned all the time in here? |
| 12:04 | Trioxin | thankfully I don't do business on IRC really so I don |
| 12:04 | Trioxin | don't have it set to wake me up |
| 12:09 | roelof | my name is also not always here. |
| 12:09 | roelof | Very very last question : Is clojure web essentials a good book to learn making web sites with clojure |
| 12:11 | muhuk | roelof: not if you know you web programming generally |
| 12:12 | muhuk | roelof: web frameworks are generally well documented compared to other stuff (I wonder why ;) ) |
| 12:13 | roelof | muhuk: do you have a better recommendation then ? |
| 12:13 | roelof | I only know a little html and css |
| 12:13 | roelof | BRB Dinner |
| 12:14 | muhuk | roelof: then reading a book is a good idea. |
| 12:32 | roelof | muhuk: thanks, I was also looking at web development with clojure but that seems you have to use light table so a no-go for me. |
| 12:32 | roelof | Im using a cloud enviroment which has his own ide |
| 12:32 | rhg135 | You don't have to |
| 12:33 | rhg135 | I use vim |
| 12:33 | rhg135 | But any editor works |
| 12:35 | roelof | I know. But in the first chapters I have to change namespaces to make the tables in the database and nowhere a explantion how to do that |
| 12:36 | rhg135 | (in-ns 'my.db.ns) |
| 12:36 | rhg135 | In a repl |
| 12:37 | roelof | I tried that but I could not call a function in that namespace. I have asked for help on the google group but no one could help me then |
| 12:39 | rhg135 | Is this cljs? If so you should try #clojurescript. I failed :-( |
| 12:42 | seako | did you call the function with the namespace prefix like (my.db.ns/your-function) or did you call (your-function) |
| 12:45 | rhg135 | Actually, that sounds like the ns isn't loaded. As clj will let you switch to an uninitialized one. |
| 12:47 | roelof | seako: I did (your-function) like the book said |
| 12:48 | roelof | rhg135: I think that was the problem. I was not loading the right one but a empty one |
| 12:49 | rhg135 | Yeah, that got me too at first |
| 12:50 | roelof | then I gave up and continued learning clojure with the help of a github course |
| 12:57 | mungojelly | we have it set up so there's some web front ends where you can run a little clojure but that's understood to be just "trying" it out and then to be "really" using it you have to have what is from an ordinary perspective quite a lot of skill in system administration |
| 12:58 | mungojelly | there should be a front end on the web that's considered legitimate and real and given some power because that's how most people have access at the moment |
| 13:11 | roelof | mungojelly what do you then use for your web site ? |
| 13:12 | roelof | rhg135: how to solve the problem of loading a empty ns instead of the right one |
| 13:32 | noncom|2 | how do i verify a token generated in buddy? |
| 13:43 | roelof | no one who can recommend a book / tutorial for making web sites'with clojure and maybe Selmer ? |
| 13:43 | rhg135 | Roelof: require |
| 13:43 | roelof | rgh: ??? |
| 13:45 | rhg135 | You should require it before switching. Or better yet require then alias it |
| 13:45 | rhg135 | ,(doc alias) |
| 13:45 | clojurebot | "([alias namespace-sym]); Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly." |
| 13:48 | roelof | moment, Im in the user namespace and I need to goto this namespace (ns guestbook.models.db and carry out this function sql/create-table |
| 13:49 | roelof | I can do (ns-in 'guestbook.models.db) but then the create-table cannot be found |
| 13:50 | roelof | rhg135: how to solve this with require ?? |
| 13:50 | rhg135 | (require 'guestbook.models.db) |
| 13:51 | rhg135 | Before in-ns |
| 13:52 | roelof | rhg135: So first (require 'guestbook.models.db) then (ns-in 'guestbook.models.db) and then I can use (create-table) |
| 13:52 | roelof | Do I understand you right ? |
| 13:53 | rhg135 | in-ns, not ns-in. Correct. |
| 13:55 | roelof | oke, thanks for the lessons. Now I can also use the web development with clojure and not using a framework :) |
| 13:56 | rhg135 | Np |
| 13:57 | roelof | I like the clojure community . Always someone who is willing to help a beginner and teach a beginner something |
| 13:58 | rhg135 | Yup, very nice compared to the last language I used |
| 14:05 | Trioxin | Is the performance really slower in clojure than java? |
| 14:05 | Trioxin | or as much as it maybe used to be? |
| 14:05 | Trioxin | i was reading some ppl say that |
| 14:06 | rhg135 | Higher level tends to be, even in java |
| 14:07 | Trioxin | what I would love is to use clojure with matlab. I know my matlab can spit out java |
| 14:08 | rhg135 | Passing around lists instead of arrays in java would be slower for example |
| 14:09 | Trioxin | matlab has the whole built in nvidia processing and distributed/parallel computing engines going for it |
| 14:09 | Trioxin | for my machine learning algos |
| 14:09 | roelof | rhg135: what is then the last one ? for me I tried erlang |
| 14:10 | rhg135 | I'm sorry, what was that? |
| 14:10 | Trioxin | I should be able to work with this in clojure pretty easy right? http://www.mathworks.com/products/matlab-compiler-sdk/ |
| 14:11 | roelof | I give a question to your respons on 19:58 Yup, very nice compared to the last language I used |
| 14:12 | rhg135 | Trioxin, you should, but I've never tried |
| 14:12 | gfredericks | amalloy_: is hacking 4clojure to use an atom instead of mongo as tediously difficult as I think it might be? |
| 14:13 | rhg135 | Roelof, I used python. It felt as if I was alone. |
| 14:14 | roelof | oke, I tried to used erlang But I get lost in pattern matching everything |
| 14:14 | Trioxin | i just started using py. it's ezness so far |
| 14:14 | Trioxin | not the kind of different things I have to get used with clojure |
| 14:15 | rhg135 | I just didn't improve much since no help |
| 14:15 | Trioxin | what's that site uhm.. rosettacode. you can clearly see clojure being far less code than java and most others |
| 14:15 | engblom | Pattern matching is actually one thing I like really much in Haskell. |
| 14:16 | rhg135 | Here otoh, I can at least get another pair of eyes on my buggy code :-P |
| 14:18 | Trioxin | i have to go java.lang.exception. meh. I'm guessing I could shorten that |
| 14:18 | roelof | engblom: I tried Haskell but could not find any good beginners book which prepares me for CIS194 and NICTA |
| 14:18 | rhg135 | java.lang.* is autoimported. |
| 14:19 | Trioxin | could I create an alias as just Exception? |
| 14:19 | rhg135 | Just Exception by default, but yes |
| 14:19 | Trioxin | well, I do see cond, throw |
| 14:20 | rhg135 | ,(doc import) |
| 14:20 | clojurebot | "([& import-symbols-or-lists]); import-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly." |
| 14:20 | engblom | I find Haskell to be a nice language itself, but the tools and libraries around it quite bad. The "equivalent" of lein for Haskell is cabal, and half of the time cabal will fail with installing dependencies |
| 14:20 | Trioxin | i hears hickley speaking much ill of haskell |
| 14:21 | Bronsa | where? |
| 14:21 | clojurebot | where is amalloy to explain it |
| 14:21 | rhg135 | ,(do (import 'java.util.UUID) (UUID/randomUUID)) |
| 14:21 | clojurebot | #uuid "555c09fb-44a5-4703-9ef8-0a045d873f17" |
| 14:21 | Trioxin | in a video, well basically poking fun saying raise your hands if you code haskell; I feel sorry for you |
| 14:23 | rhg135 | ,Exception |
| 14:23 | clojurebot | java.lang.Exception |
| 14:25 | engblom | Trioxin: That is lowering my opinion about Hickley. He should not mock people, that is not how you win people for your project. |
| 14:26 | Trioxin | he was just joking |
| 14:26 | mungojelly | the mocking of haskell is some gentle ribbing between equals, it's the mocking of java where he gets actually sour, but i think it's fair |
| 14:27 | mungojelly | java is awful not because of sincere innocent errors but in a giant conspiracy to conquer things and make money so fuck that |
| 14:28 | mungojelly | i want to learn haskell just so i can understand if there's actually a point to that syntax or if we should have strong typing and pure functions and also a readable syntax too, if there's some reason we can't have everything i don't understand it |
| 14:28 | rhg135 | The error would be no nice data structures |
| 14:28 | rhg135 | That's always what I miss most |
| 14:29 | mungojelly | the jvm was designed to make it difficult to compile other languages to it. and indeed clojure's construction was tremendously difficult. any sort of coherent rich anything would defeat that purpose of being uninteroperable. |
| 14:30 | rhg135 | Eh, it's not that bad I think |
| 14:31 | Bronsa | mungojelly: mapping clojure to jvm bytecode is not that difficult actually |
| 14:31 | mungojelly | well it depends on how you look at it. from their perspective they were putting a bunch of money into developing it so of course they didn't want to make it easy to plug in your language of choice and let everyone run away with it. |
| 14:31 | rhg135 | There's a lot of jvm languages |
| 14:31 | Bronsa | and there have been efforts for years to make the jvm suitable for other languages |
| 14:32 | mungojelly | yes but there was absolutely no reason except profit that it was ever difficult at all in the first place. |
| 14:32 | engblom | I really wish Clojure would have picked another platform than jvm. You could never write a tool meant to be repeatly run from scripts, like 'sed' in clojure as it is too slow in starting up. |
| 14:32 | rhg135 | Compilers are never easy to write |
| 14:32 | mungojelly | engblom: have you tried drip? i tried it out yesterday, it works great. it just spins up a spare jvm so one's ready instantly when you need it. |
| 14:33 | rhg135 | Check out gcc |
| 14:33 | gfredericks | mungojelly: I feel like the fact that the bytecode spec existed so early at all means they were trying quite hard to make it suitable for other languages |
| 14:35 | Bronsa | mungojelly: the jvm was designed for java. it's only natural that mapping an other language on top of its bytecode might require some workarounds |
| 14:35 | mungojelly | you can say it's reasonable somehow that they were trying to make a virtual machine strongly tied to a single language but it's odd to say that's not what they were doing. that was the whole idea. |
| 14:35 | rhg135 | I should write a shell in clojure. |
| 14:36 | rhg135 | That way it'd just be calling functions for scripting |
| 14:36 | Bronsa | mungojelly: that's exactly what they were doing. but you made the jump from that to "they were actively trying to design it so that it would be difficult to write another language on top of it" and that's a non sequitur |
| 14:36 | l3dx | I'm trying to use cljs-ajax to POST a FormData object, but I can't figure out what I'm doing wrong. When inspecting the request in devtools I can't see anything from the formdata. Anyone done this before? |
| 14:38 | rhg135 | I suppose that would just be a repl with a slightly modified reader |
| 14:39 | mungojelly | rhg135: why do you have to modify the reader? i'd think you'd just need to use a library with some good file system functions |
| 14:40 | rhg135 | Easy syntax sugar to call executables |
| 14:40 | mungojelly | i'd be happy with (ex "./file") i think |
| 14:41 | engblom | mungojelly: I got curious about drip and tried it. Still very slow. The only thing drip improves is booting java itself, not the booting of clojure. |
| 14:41 | rhg135 | Needs to rewrite stuff like 'vim' to (ex "vim") |
| 14:42 | rhg135 | Laziness |
| 14:42 | rhg135 | It's 6 more characters |
| 14:43 | mungojelly | i think a way that would make sense to script with clojure is to write some clojure that compiles into a script in whatever fast booting language |
| 14:43 | mungojelly | hmm well you could write (vim) |
| 14:43 | rhg135 | Then I'd have to extend the evaluator |
| 14:44 | rhg135 | And 2 more |
| 14:44 | mungojelly | parentheses are extra to type, you say? but that's not a general rule is it? ;) |
| 14:45 | rhg135 | I could use post fix, but meh |
| 14:45 | rhg135 | I like parens |
| 14:46 | rhg135 | Mungojelly, that's cljs |
| 14:47 | rhg135 | Node starts fast |
| 15:06 | mungojelly | changing the reader and the representation and everything just to save keypresses seems extreme, how about just if you typed "vim" and then pressed a key that wraps it in (shellpackage.stuff/execute "vim") and runs it |
| 15:11 | mzdravkov | I am trying to write a macro that generates patterns for core.match. I'll try to explain with an example: Suppose I want to test if this [[:a :b :a :b]] matches to one of [:a :b & r], [_ :a :b & r] or [_ _ :a :b & r]. Here are two mathes. Here is my code: https://gist.github.com/mzdravkov/d13d8083849f6dcc1cd7 |
| 15:12 | mzdravkov | The problem is that it never matches and I can't find the bug. This is the first ever macro I try to write, so it's probably some lame mistake. |
| 15:23 | rhg1351 | that's what I'm thinking, mungojelly |
| 15:23 | rhg1351 | make the reader just emit a list if it sees that |
| 15:27 | rhg135 | it'd be pretty cool to be able to invoke clojure and java from the shell |
| 15:28 | rhg135 | deling with objects, not just strings |
| 15:30 | mzdravkov | it seems like match doesn't expand my pattern macro |
| 15:31 | mzdravkov | can anyone explain me why this is so |
| 15:32 | gfredericks | mzdravkov: match probably isn't designed to macroexpand anything |
| 15:33 | mzdravkov | gfredericks: is there any workaround? |
| 15:34 | gfredericks | mzdravkov: maybe not without having your macro wrap the whole match call |
| 15:35 | mzdravkov | I thin it wraps it. If I correctly understand what you mean. |
| 15:35 | mzdravkov | think* |
| 15:35 | gfredericks | in which case *I* don't understand correctly what your problem is |
| 15:36 | gfredericks | have you tried using macroexpand-1 to debug your macro? |
| 15:36 | mzdravkov | I used macroexpand |
| 15:37 | gfredericks | okay; that's all I can recommend |
| 15:37 | rboyd | hi gfredericks! |
| 15:38 | gfredericks | hi rboyd! |
| 15:38 | mungojelly | a really clojurey shell should return for each command a nondestructive reference to a filesystem as changed by that command |
| 15:39 | gfredericks | rboyd: I still have the rboyd memorial hex dice, and used them to generate some data one time: https://twitter.com/gfredericks_/status/561191705052205058 |
| 15:39 | rhg135 | I'd have to reimplement part of the kernel for that |
| 15:39 | rboyd | hey! that's fantastic |
| 15:40 | rhg135 | at least write a lot of c |
| 15:41 | mzdravkov | whenever I call macroexpand on my macro that builds the match call it prints like 50 lines of obfuscated code, so I tryed to put 'println instead of 'match and the result is perfectly fine, except my inner macro is not expanded. |
| 15:41 | gfredericks | mzdravkov: oh macroexpand-1 and macroexpand don't recursively expand things |
| 15:42 | mzdravkov | So I can't have macro inside of another macro? |
| 15:42 | gfredericks | clojure.walk/macroexpand-all might help |
| 15:42 | gfredericks | it's just a tooling problem, not an issue with macros |
| 15:47 | mzdravkov | Yes, right. Actually macroexpand is recursive (Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms) Macroexpand-all fixed printing of subform macros. |
| 15:49 | mzdravkov | But now it's even stranger: if I call macroexpand when calling 'match in the macro it prints like 50-100 lines of obfuscated code. So I changed it to 'println and the result is perfect. If I copy the result of macroexand-all and change the println to match it works fine |
| 15:56 | gfredericks | this might be a rather complex first macro attempt |
| 16:00 | akkad | https://gist.github.com/a7761767d77c4dabd23a how do you accumulate properly with recur/loop? |
| 16:08 | gfredericks | akkad: does that not work for some reason? |
| 16:42 | irctc | anyone know why lein uberjar would create a target dir that has a classes and a stale dir but not the actual uberjar? |
| 18:21 | Trioxin | is 4clojure a prime resource for a beginner to learn? |
| 18:22 | AimHere | It's a good resource yes |
| 18:23 | AimHere | Pick a bunch of random people to follow, and when you solve a problem, see how they solve it |
| 18:23 | AimHere | Usually you get a feel for more idiomatic ways of doing things |
| 18:23 | AimHere | Occasionally, they might be wrong though (like the quine examples!) |
| 18:34 | justin_smith | dnolen: thanks for including that Merzbow clip in your Strange Loop talk, I appreciated that. I never thought I would see that particular interest join this one however tangentially. |
| 18:35 | justin_smith | and the Ulmer too, great stuff |
| 18:37 | justin_smith | I've been listening to a lot of Anne Gillis recently while programming (French concret / industrial), I just got her 5 CD box set. |
| 18:40 | wasamasa | igorrr is where it's at |
| 20:05 | dnolen | justin_smith: glad you enjoyed the reference :) |
| 21:25 | Surgo | anyone know of a java or clojure lib for modifying PE/Coff files? |
| 21:25 | Surgo | I've seen plenty for parsing, not so much for "I just want to change this value" |
| 21:56 | Surgo | anyone know of a java or clojure lib for modifying PE/Coff files? I've seen plenty for parsing, not so much for editing |
| 22:07 | krat0sprakhar | hello.. i'm having a hard time in changing file permissions of a file |
| 22:08 | justin_smith | krat0sprakhar: does it have to be portable? |
| 22:13 | krat0sprakhar | nope.. unix inly |
| 22:13 | krat0sprakhar | *only |
| 22:13 | krat0sprakhar | i need to run chmod 400 on it, basically |
| 22:14 | krat0sprakhar | @justin_smith there's also https://github.com/Raynes/fs |
| 22:14 | krat0sprakhar | but i'm not sure if i want to add the entire lib just for this |
| 22:23 | amalloy | krat0sprakhar: there are a bunch of permission-related methods on java.io.File as of java 1.6. everything you need to get to chmod 400, albeit a little clumsily |
| 22:23 | amalloy | http://docs.oracle.com/javase/7/docs/api/java/io/File.html#setWritable(boolean,%20boolean) |
| 22:23 | krat0sprakhar | to be honest, i'm having a hard time understanding java interop |
| 22:23 | krat0sprakhar | in clojure |
| 22:23 | krat0sprakhar | is there a good guide to help? |
| 22:25 | krat0sprakhar | https://www.irccloud.com/pastebin/twYsnCS5/brave-clojure |
| 22:25 | krat0sprakhar | how do I do file.setWritable(true) on this? |
| 22:26 | amalloy | have you read http://clojure.org/java_interop? |
| 22:27 | krat0sprakhar | ah my bad.. will go through this.. thank you |
| 23:00 | coetry | what can a novice expect to be the outcome of having completed the clojure koans? |
| 23:00 | coetry | I have experience programming, i know variables, loops, functions, and basics like that, but haven't really weaved all those concepts together in any major project |
| 23:16 | kenrestivo | i wonder if i'm alone in great pain having resulted from starting to use the components library. |
| 23:20 | amalloy | kenrestivo: i don't think any library exists that hasn't caused someone great pain |
| 23:23 | cfleming | Does anyone know of a classloader that I could use to load classes from jar files that isn’t a URLClassLoader? |
| 23:28 | kenrestivo | amalloy: true indeed. |
| 23:28 | kenrestivo | in this case, i'm trying to figure out why if i have [:log] as a dependency in component/using, the log component isn't starting until after the other ones do |