2014-01-14
| 00:02 | logic_prog | is there a way to run clojure on go ? |
| 00:06 | egghead | clojure on the go |
| 00:15 | TEttinger | logic_prog, there might be some project that could, but it seems like it wouldn't really be optimal if Clojure on C isn't close to mature yet, and that's a way bigger use case |
| 00:31 | arrdem | bitemyapp: well it coulda gone worse... there was interest in a follow up. |
| 00:31 | arrdem | logic_prog: the real constraint with something like a clojure in C is that you loose so much of Clojure and unless you allow access to C primitives (scary shit!) you don't really win... |
| 00:32 | arrdem | logic_prog: such a compiled Clojure is very much something I'm intrigued by, but I'm convinced that it'd just be a better Lisp, not really Clojure. |
| 00:32 | arrdem | that said I don't really think CLJS is Clojure for the same reasons... |
| 00:32 | arrdem | </rant> |
| 00:39 | logic_prog | arrdem: Understood. Thanks. |
| 00:48 | arrdem | logic_prog: that's what Rust is for :D |
| 00:48 | logic_prog | arrdem: rust is a lisp |
| 00:49 | logic_prog | ? |
| 00:49 | arrdem | logic_prog: nah it's another C like with more safety gurantees |
| 00:49 | arrdem | logic_prog: I wish it was a lisp :P |
| 00:49 | noonian__ | http://www.rust-lang.org/ |
| 00:59 | quizdr | yes |
| 01:53 | danielcompton | I'm trying to do nested destructuring but am not sure how to do use :keys on anything but the innermost form |
| 01:53 | danielcompton | I want to turn https://www.refheap.com/23624 |
| 01:53 | danielcompton | into an expression where I don't need to specify name :name on the outer form |
| 01:54 | danielcompton | Can anyone help? |
| 01:59 | maravillas | danielcompton: do you mean like https://www.refheap.com/23625 ? |
| 02:00 | danielcompton | maravillas thats it. Thanks! |
| 02:00 | maravillas | welcome! |
| 02:01 | danielcompton | How would you do a third level? |
| 02:01 | TEttinger | maravillas, change m to book, btw |
| 02:02 | TEttinger | just ran it, it does work with that change. fast work |
| 02:02 | TEttinger | (inc maravillas) |
| 02:02 | lazybot | ⇒ 1 |
| 02:02 | maravillas | oh yeah, caught that. thanks :) |
| 02:03 | maravillas | danielcompton: if you wanted to destructure further into :details, you'd just add whatever's appropriate to the {:keys [pages isbn-10]} form |
| 02:05 | danielcompton | How would I do https://www.refheap.com/23626 ? |
| 02:06 | danielcompton | I think I've almost got it |
| 02:06 | maravillas | cover should be in a vector |
| 02:07 | TEttinger | yeah, cover in [cover] |
| 02:07 | danielcompton | Great! |
| 02:07 | danielcompton | I think it clicks now |
| 02:07 | maravillas | :) |
| 02:07 | danielcompton | Thanks TEttinger and maravillas |
| 02:07 | TEttinger | argument destructuring is great, no prob |
| 02:07 | maravillas | np |
| 02:08 | danielcompton | (inc maravillas) (inc TEttinger) |
| 02:08 | lazybot | ⇒ 1 |
| 02:08 | TEttinger | haha |
| 02:08 | TEttinger | I think that may have... |
| 02:08 | TEttinger | $karma maravillas) (inc TEttinger |
| 02:08 | lazybot | maravillas) has karma 0. |
| 02:08 | TEttinger | hm |
| 02:08 | danielcompton | (inc TEttinger ) |
| 02:08 | lazybot | ⇒ 1 |
| 02:08 | danielcompton | Thats better |
| 02:08 | TEttinger | what happened to my karma??? |
| 02:08 | lazybot | TEttinger: How could that be wrong? |
| 02:09 | TEttinger | oh haha |
| 02:09 | nones | $karma maravillas |
| 02:09 | lazybot | maravillas has karma 1. |
| 02:09 | maravillas | maybe it doesn't trim spaces? |
| 02:09 | TEttinger | $karma TEttinger |
| 02:09 | lazybot | TEttinger has karma 11. |
| 02:09 | TEttinger | $karma TEttinger |
| 02:09 | lazybot | TEttinger has karma 11. |
| 02:09 | TEttinger | hm |
| 02:09 | nones | $karma alhimik45 |
| 02:09 | lazybot | alhimik45 has karma 0. |
| 02:09 | TEttinger | $karma TEttinger ) |
| 02:09 | lazybot | TEttinger has karma 11. |
| 02:09 | TEttinger | no idea |
| 02:09 | arrdem | TEttinger: .... what are you doing. |
| 02:09 | TEttinger | what did it add the karma to? |
| 02:10 | TEttinger | sorry for spam |
| 02:10 | arrdem | TEttinger: I was just surprised is all.. |
| 02:11 | TEttinger | I tried it with trailing spaces, apparently the bot has a weird parse thing |
| 02:11 | TEttinger | I know it allows multi-word incs |
| 02:12 | TEttinger | I also am fairly sure that it needs to be done in-channel because at least one of the bots keeps some data specific to a channel |
| 02:12 | yuri_niyazov | What is the canonical location for the current documentation of clojure? |
| 02:12 | TEttinger | like how clojurebot now only allows def'd forms in the same channel |
| 02:13 | TEttinger | probably the API on the site. clojuredocs is out of date |
| 02:14 | yuri_niyazov | is this what everyone uses: http://clojure.github.io/clojure/index.html |
| 02:14 | yuri_niyazov | ? |
| 02:14 | TEttinger | http://clojure.github.io/clojure/clojure.core-api.html I think |
| 02:14 | TEttinger | oh yeah you're right |
| 02:15 | TEttinger | but it doesn't have the examples for unchanged or earlier-made parts of clojure that clojuredocs has |
| 02:15 | TEttinger | like the github.io page has reduced , clojuredocs doesn't |
| 02:15 | chare | hi guys |
| 02:15 | chare | remember me? |
| 02:16 | TEttinger | hi chare |
| 02:16 | arrdem | technomancy: so normally I wouldn't bother you, but chord is back for more. |
| 02:16 | TEttinger | I believe you were making a starcraft-like game? |
| 02:16 | chare | I gave up on that |
| 02:16 | arrdem | technomancy: see char |
| 02:16 | chare | I started learning Erlang |
| 02:16 | TEttinger | oh boy |
| 02:17 | chare | whats wrong with Erlang? |
| 02:17 | chare | its functional just lik eclojure |
| 02:17 | TEttinger | yes, I just have never seen it used |
| 02:17 | arrdem | http://i.imgur.com/p8gOKbv.jpg |
| 02:17 | TEttinger | can't be of much help |
| 02:18 | TEttinger | s/^/I / |
| 02:18 | chare | so does that mean you guys are jealous that I spend the effort to learn new languages and you guys don't |
| 02:20 | TEttinger | I wouldn't describe myself as jealous of you, no |
| 02:21 | chare | what have you guys been up to in my absense |
| 02:21 | andyf | gen-interface forms throw exceptions if you expand them twice (part of a defprotocol expansion). Are there any other known Clojure forms that have similar ill effects when exanded twice? |
| 02:22 | andyf | expanded* |
| 02:22 | TEttinger | I wonder if macroexpand can expand itself |
| 02:23 | arrdem | TEttinger: yep... shouldn't do anything tho. |
| 02:23 | andyf | It can, but macroexpansions of function calls are just the function calls |
| 02:24 | chare | lets talk about Datomic are you guys familiar with it? |
| 02:31 | chare | so thats a no? |
| 02:54 | bitemyapp | arrdem: back |
| 02:54 | bitemyapp | crazy fun type theory meetup :) |
| 02:55 | chare | shit I just got banned from #python for claiming that clojure > python |
| 02:56 | bitemyapp | chare: are you that starcraft dude? |
| 02:56 | chare | what does that mean |
| 02:56 | bitemyapp | there was some troll coming to this channel asking people to write a starcraft clone for him |
| 02:56 | bitemyapp | chare: are you him? |
| 02:56 | chare | I gave up on that |
| 02:57 | bitemyapp | ah, you are him |
| 02:57 | bitemyapp | new nick to ignore, cool. |
| 02:57 | chare | I got bored of starcraft |
| 02:57 | chare | i didn't change my nick |
| 02:57 | arrdem | bitemyapp: dude |
| 02:57 | bitemyapp | arrdem: what? |
| 02:57 | arrdem | bitemyapp: my drow streak is getting silly |
| 02:57 | bitemyapp | arrdem: mumbur. |
| 02:57 | arrdem | bitemyapp: bedtime. |
| 02:58 | bitemyapp | arrdem: dammit. Wanted to do a game before going to bed, type theory meetup was awesome! |
| 02:59 | chare | what do you guys think of linear typing |
| 02:59 | arrdem | bitemyapp: sweet! yeah this 1am 2am shit is getting old already... I'm considering some sort of electronic vaccation until I've gotten in a sane school swing... |
| 02:59 | arrdem | bitemyapp: much as I enjoy fivemanning with you and quiggles et all. |
| 03:00 | bitemyapp | arrdem: fair nuff. |
| 03:00 | chare | arrdem tell bitemyapp to unignore me please |
| 03:14 | AeroNotix | is there any integration with `lein check' and emacs already? Or is it something I should write? |
| 03:18 | andyf | I don't know of anything, but haven't looked. Seems like M-x next-error would be easily customizable for that. |
| 03:24 | AeroNotix | ok |
| 03:26 | ivan | these names don't make a whole lot of sense https://github.com/dakrone/cheshire#decoding |
| 03:26 | ivan | (first (cheshire/parsed-seq rdr)) to read JSON from a file with a reader |
| 03:28 | _eric | I have a (def) that just calls (System/getenv "VAR") and I'd like to override what it is in a test |
| 03:28 | _eric | is that reasonable and is there a simple way to do it? |
| 03:39 | clgv | eric: if it were wynamic you could rebind it with `binding` |
| 03:39 | clgv | *dynamic |
| 03:41 | Glenjawork | this is an odd question, but if i were trying to model a normalised data-model in memory (similar structure to an RDBMS) - would refs be a reasonable option? |
| 03:41 | clgv | Glenjawork: sure. |
| 03:42 | Glenjawork | can you do circular structures? |
| 03:43 | Glenjawork | ie, user1 is a ref containing a map, where one key is score1, and score1 is a ref containing a map where one key is user1 |
| 03:43 | clgv | not with the immutable/persistent values within the refs |
| 03:44 | Glenjawork | ah ok, so because refs are mutable you can't put them inside refs? |
| 03:44 | clgv | for building a circular structure you'll always need the indirection through a ref (when transactions are required, otherwise atoms work as well) |
| 03:44 | Glenjawork | right, so i could model each "table" as a map in a ref |
| 03:44 | clgv | Glenjawork: no. you can put refs into other refs |
| 03:45 | clgv | that would be an option. |
| 03:45 | Glenjawork | this is probably a bad idea, but we have a specific calculation our mysql DB is terrible at |
| 03:45 | clgv | first options that come to my mind: (1) whole database in ref, (2) each table in a ref, (3) each row in a ref |
| 03:46 | clgv | with different implications on scalability |
| 03:46 | Glenjawork | so we're considering writing something that can efficiently do this bit, without having to change the entire app onto a new db |
| 03:46 | clgv | Glenjawork: other DBs like PostgreSQL are no option? |
| 03:46 | AeroNotix | what's the best way to abort compilation in macros? I see some of the standard library uses assert-args. |
| 03:46 | Glenjawork | maybe |
| 03:47 | Glenjawork | but any DB is a black box |
| 03:47 | clgv | if you use jdbc anyway that would not be a complex change |
| 03:47 | Glenjawork | and potentially we want a white box |
| 03:47 | clgv | ok |
| 03:47 | Glenjawork | we don't even use clojure at the moment |
| 03:48 | Glenjawork | but if i want to calculate something atomically with high concurrency, it seems like a good fit |
| 03:48 | clgv | AeroNotix: assert-args just throws an exception |
| 03:48 | AeroNotix | clgv: so I'll just throw IllegalArgumentException or something? |
| 03:49 | clgv | AeroNotix: yeah. for a useful exception you should include line and file information to help the user |
| 03:49 | AeroNotix | clgv: cheers |
| 03:49 | Glenjawork | or it might be a dumb idea |
| 03:49 | Glenjawork | i'm not sure yet |
| 03:49 | Glenjawork | if there's an optimised FRP toolkit somewhere that might be a good fit as well |
| 03:49 | Glenjawork | as i only want to update dependant data |
| 03:50 | clgv | Glenjawork: you can search the ML for FRP - there were several discussions about it. but I don't remember whether there is a mature library yet |
| 03:50 | Glenjawork | its annoying, this dataset/calculation really shouldn't be that hard |
| 03:51 | Glenjawork | it's just a 1million person league table |
| 03:51 | AeroNotix | Glenjawork: and you're sure you've written the most optimized query available? |
| 03:51 | clgv | the bottlenekc is mysql right now? |
| 03:51 | Glenjawork | the bottleneck is a combination of current schema and mysql |
| 03:52 | Glenjawork | the bottleneck used to be data transfer between DB and app |
| 03:52 | Glenjawork | so we do all the work in the app |
| 03:52 | Glenjawork | and it maxes out one core |
| 03:52 | Glenjawork | but if i make it use more than one core, i need multiple connections and lose atomicity |
| 03:52 | Glenjawork | all the work in the DB even |
| 03:53 | clgv | you'd have transactions in the db as you'd have with clojure's ref |
| 03:53 | Glenjawork | i assume i can use reducers within a ref transaction |
| 03:53 | AeroNotix | MySQL has transactions Glenjawork, that's kind of the point. |
| 03:53 | Glenjawork | so i'd expect better parallelisation |
| 03:53 | Glenjawork | at the moment i can't make it use more than 1 core without losing atomicity |
| 03:54 | Glenjawork | unless maybe i do a table rename |
| 03:54 | Glenjawork | the query is (pseudo-sql) UPDATE score (select sum(score) from guess group by user) |
| 03:57 | Glenjawork | hrm, all the FRP things i find are about UI |
| 04:01 | clgv | Glenjawork: simple building blocks for FRP are the watch functions you can have for refs and atoms |
| 04:02 | Glenjawork | modelling rows as refs and using watch functions might work nicely |
| 04:02 | Glenjawork | although i guess thats equivalent to normalising my schema more, so perhaps it should do that first |
| 04:02 | Glenjawork | s/perhaps it/perhaps i/ |
| 04:03 | clgv | Glenjawork: I'd go for optimal schema and query first. if that is not sufficient you can use a real db like postgresql ;) |
| 04:04 | Glenjawork | yeah, that'll be a fun chat with ops |
| 04:04 | Glenjawork | we technically have a bunch of oracle licenses too |
| 04:04 | clgv | well then maybe oracle since you probably have experts for it as well then |
| 04:04 | Glenjawork | on the face of it that query looks like it should parellise perfectly |
| 04:06 | Glenjawork | anyway, cheers for the input |
| 04:06 | Glenjawork | lots more thinking to do :) |
| 04:17 | sm0ke | is there a better way to do, ##(get-in {:a {:b {:c 1}}} [:a :b :c]); than this |
| 04:17 | lazybot | ⇒ 1 |
| 04:18 | bitemyapp | AeroNotix: InnoDB has transactions |
| 04:18 | bitemyapp | AeroNotix: MySQL/MyISAM do not. |
| 04:21 | AeroNotix | bitemyapp: ;) |
| 04:21 | fredyr | sm0ke: i think thats it, what else do you have in mind? |
| 04:22 | AeroNotix | sm0ke: -> ? |
| 04:22 | AeroNotix | ->> ? |
| 04:22 | sm0ke | yea but not if keys are non keywords |
| 04:23 | sm0ke | i think map should take more than one argument |
| 04:23 | sm0ke | ,({:a {:b {:c 1}}} :a :b :c) |
| 04:23 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: PersistentArrayMap> |
| 04:23 | sm0ke | like that |
| 04:23 | sm0ke | ,({:a {:b {:c 1}}} :a) |
| 04:23 | clojurebot | {:b {:c 1}} |
| 04:24 | AeroNotix | sm0ke: make a macro |
| 04:25 | sm0ke | also how do i find max in [[1 2 4] [3 5 1] [3 4 6]] |
| 04:25 | AeroNotix | sm0ke: flatten+max? |
| 04:25 | sm0ke | what? |
| 04:25 | clojurebot | what is cells |
| 04:26 | sm0ke | heh |
| 04:26 | sm0ke | [1 2 4] sensibly is lesser than [1 2 1] |
| 04:26 | sm0ke | i am talking about tuple comparison |
| 04:26 | AeroNotix | why? |
| 04:26 | clojurebot | why is Why |
| 04:26 | AeroNotix | clojurebot: because |
| 04:26 | clojurebot | Excuse me? |
| 04:27 | AeroNotix | you heard me! |
| 04:27 | sm0ke | sorry |
| 04:27 | sm0ke | [1 2 1] < [1 2 4] i meant |
| 04:27 | AeroNotix | Sure |
| 04:27 | sm0ke | ,(< [1 2 1] [1 2 4]) |
| 04:27 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number> |
| 04:27 | pyrtsa | ,(< (compare [1 2 1] [1 2 4]) 0) |
| 04:27 | clojurebot | true |
| 04:28 | Glenjawork | what does 0 mean? |
| 04:28 | jonathanj | ,(compare [1 2 1] [1 2 4]) |
| 04:28 | clojurebot | -1 |
| 04:28 | pyrtsa | (compare a b) returns -1 if a<b, 0 if a=b, otherwise 1. |
| 04:28 | Glenjawork | oh right |
| 04:28 | sm0ke | ok so ##(max-key #(< (compare %1 %2)) [[1 2 4] [3 5 1] [3 4 6]]) |
| 04:28 | lazybot | ⇒ [[1 2 4] [3 5 1] [3 4 6]] |
| 04:28 | jonathanj | how does compare actually compare two vectors? |
| 04:29 | sm0ke | what the.. |
| 04:29 | squidz | does anybody know if there is a way to get lein to recompile the project when other source files change within the 'src' folder? I have a clojurescript project and have javascript files and want to get leiningen to recompile the clojurescript on change. Anybody know how to do this? |
| 04:29 | pyrtsa | But... Word of warning: Clojure does not define sequence comparisons as lexicographical. Instead, the shorter is considered smaller. :( |
| 04:29 | sm0ke | squidz: lein-reload |
| 04:29 | jonathanj | isn't that the same as Python? |
| 04:29 | pyrtsa | jonathanj: Lexicographical ordering would be the best definition. |
| 04:30 | pyrtsa | (compare [1 3] [1 2 4]) |
| 04:30 | pyrtsa | ,(compare [1 3] [1 2 4]) |
| 04:30 | clojurebot | -1 |
| 04:30 | pyrtsa | ,(compare [1 2] [1 2 4]) |
| 04:30 | clojurebot | -1 |
| 04:30 | pyrtsa | ,(compare [1 1 1 1] [1 2 4]) |
| 04:30 | clojurebot | 1 |
| 04:31 | sm0ke | ok this is weird |
| 04:31 | pyrtsa | jonathanj: Python does it lexicographically. |
| 04:31 | jonathanj | so you probably need to have a better definition of what it means to compare two vectors, given your software's domain |
| 04:31 | pyrtsa | I'm just saying what might probably be a sensible default. |
| 04:31 | amalloy | pyrtsa: well, clojure compares vectors the way that python compares tuples |
| 04:32 | pyrtsa | Of course, by-count comparison is faster if the count is known. |
| 04:32 | amalloy | which is different from the way it compares lists |
| 04:32 | pyrtsa | amalloy: No it doesn't! |
| 04:32 | amalloy | it does |
| 04:32 | amalloy | >>> (5) < (1,2) ## => True |
| 04:32 | sm0ke | ok so ##(max-key (partial compare [0 0 0]) [[1 2 4] [3 5 1] [3 4 6]]) |
| 04:32 | lazybot | ⇒ [[1 2 4] [3 5 1] [3 4 6]] |
| 04:32 | amalloy | oh wait, that's not a tuple |
| 04:32 | amalloy | okay, i take it back |
| 04:32 | pyrtsa | amalloy: Python: (1,3) < (1,2,4) == False, (1,2) < (1,2,4) == True. |
| 04:33 | pyrtsa | (1,) would be a Python tuple. |
| 04:34 | sm0ke | it doesnt make sense |
| 04:34 | sm0ke | why isnt there a sort-by-cmp or max-by-cmp |
| 04:35 | pyrtsa | sort-by does take a cmp argument, optionally. |
| 04:35 | sm0ke | pyrtsa: its a key func not comparison |
| 04:35 | pyrtsa | (sort-by identity cmp xs) |
| 04:35 | pyrtsa | sm0ke: In addition to the key. |
| 04:35 | amalloy | what would sort-by-cmp do? it would just be sort? |
| 04:35 | clgv | ,(apply max-key (partial compare [0 0 0]) [[1 2 4] [3 5 1] [3 4 6]]) |
| 04:35 | clojurebot | [3 4 6] |
| 04:35 | pyrtsa | amalloy: Sort with your custom comparator. Like it does. |
| 04:36 | amalloy | but that's what sort does |
| 04:36 | amalloy | &(doc sort) |
| 04:36 | lazybot | ⇒ "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator." |
| 04:36 | pyrtsa | Heh, true. |
| 04:36 | sm0ke | pyrtsa: what about max? |
| 04:37 | pyrtsa | sm0ke: max is unfortunately defined for sequences of java.lang.Number instances only. |
| 04:37 | pyrtsa | Thus, asking for a comparator would be asking for a different function. |
| 04:37 | sm0ke | now thats fucking stupid api to have |
| 04:37 | pyrtsa | I agree. |
| 04:38 | pyrtsa | Fun fact: I actually have my variations of min, max, <, <=, >, >= etc. defined for Comparables. Should probably open-source those. |
| 04:38 | Glenjawork | or add to core :p |
| 04:38 | pyrtsa | Yeah. |
| 04:39 | arcatan | pyrtsa: our codebase has those versions of <, <=, >, >=, too. cleverly i called them <<, <<=, >>, >>=. |
| 04:39 | pyrtsa | Glenjawork: Well, somebody *might* be right in arguing that the default impls are defined for Numbers only because of inlining. |
| 04:39 | arcatan | wasn't the best naming decision - now i'm like "wtf we are binding here?" |
| 04:39 | pyrtsa | arcatan: >>= -- I see what you did there! :D |
| 04:40 | pyrtsa | arcatan: I went for >' <' <=' >=' min' max'. |
| 04:40 | Glenjawork | pyrtsa: isn't there something in core that presents inlinable versions of functions for some types |
| 04:40 | Glenjawork | i seem to recall + is overloaded that way |
| 04:40 | pyrtsa | Glenjawork: I'm not sure. FWIW, there's a separate +' with different semantics. |
| 04:41 | pyrtsa | (Potentially returning BigInt etc.) |
| 04:41 | Glenjawork | https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L939 |
| 04:42 | Glenjawork | not that i know what :inline actually does |
| 04:47 | pyrtsa | Glenjawork: If I'm not missing something, the only way to redefine max etc so that inlining is available for Numbers, would be to guard them with an (if (instance? Number x) ... ...) check, and then make the "else" branch use the Comparable interface. |
| 04:47 | piranha | dnolen: are you by any chance still here? |
| 04:47 | pyrtsa | ...Which might not be that bad, since they cast to Numbers anyway. |
| 05:50 | AeroNotix | what do people use for linting/code analysis? |
| 05:58 | sm0ke | kibit is good |
| 05:58 | sm0ke | actually its awesome, just that it doesnt walk recursively |
| 06:02 | arcatan | then there's Eastwood, which has had some attention recently |
| 06:09 | sm0ke | also dynalint |
| 06:39 | AeroNotix | lots of cider/kibit stuff doesn't work but gives me an error in the bar: "Variable binding depth exceeds max-specdpl size" |
| 06:39 | AeroNotix | any ideas? |
| 06:48 | sm0ke | yes i got an idea, how about use vim and do :!lein kibit % |
| 06:55 | AeroNotix | sm0ke: how about no |
| 06:55 | sm0ke | well its up to you man |
| 06:55 | sm0ke | no pressure |
| 06:55 | sm0ke | take your time |
| 06:55 | AeroNotix | sm0ke: not sure what you're trying to insinuate there. |
| 06:59 | bitemyapp | lol. |
| 06:59 | AeroNotix | Just childish |
| 07:01 | sm0ke | id like to be serious sometimes |
| 07:02 | locks | sm0ke: until the first "y so serious" |
| 07:04 | CookedGryphon | AeroNotix: what do you get if you do M-h v max-specpdl-size |
| 07:04 | AeroNotix | 1500 |
| 07:04 | AeroNotix | I'm looking at: https://github.com/clojure-emacs/cider/issues/443 |
| 07:05 | AeroNotix | seems like the issue was fixed in tip, just seeing if marmalade is picking up the changes... |
| 07:05 | AeroNotix | ..secondary annoyance... why don't most marmalade packages just build from git/git tags |
| 07:05 | CookedGryphon | melpa does that doesn't it~? |
| 07:05 | CookedGryphon | think you'll find most stuff from marmalade in there |
| 07:06 | AeroNotix | lemme see |
| 07:06 | AeroNotix | oh wait, I'm using melpa |
| 07:20 | rurumate_ | Hi, is there an easy way to read only first line from a file, a la head -n 1 ? |
| 07:21 | rurumate_ | maybe useful has something? |
| 07:22 | CookedGryphon | (first (line-seq (reader file))) |
| 07:22 | rurumate_ | coo; |
| 07:22 | rurumate_ | *l |
| 07:22 | CookedGryphon | more correctly, (with-open [rdr (reader file)] (first (line-seq rdr))) |
| 07:23 | CookedGryphon | which will handle closing the file properly after you've read your one line |
| 07:23 | rurumate_ | I was just about to say you should close the reader |
| 07:23 | rurumate_ | but that's a bit too clunky |
| 07:24 | CookedGryphon | depending how critical this is... |
| 07:24 | CookedGryphon | you might want to just to (.readLine rdr) |
| 07:24 | CookedGryphon | what with lazy seqs chunking off the first 32, plus all the overhead of setting up the seq, even if it is idiomatic |
| 07:25 | rurumate_ | no it's not critical, just playing in the repl |
| 07:26 | rurumate_ | I'm trying to write it as short as possible.. looking for something like a bash implementation in clojure |
| 07:29 | CookedGryphon | stevedore might be interesting to you |
| 07:33 | rurumate_ | yes, that's interesting, thanks |
| 08:08 | oracle123 | aI have stored a string like "> 2 1" in db, then how to evaluate in clojure like (> 2 1) |
| 08:11 | AeroNotix | oracle123: read-string |
| 08:11 | AeroNotix | http://clojurecassandra.info/ <- is this as good as it looks? |
| 08:18 | oracle123 | I need to read a string from db, and then evaluate it as a filter, but looks like it doens't work as expected, both of the following return all the data in the vector., shouldn't the second one return empty since (< 3 2) is alway false? |
| 08:18 | oracle123 | (filter (fn [x] eval (read-string "(> 3 2)")) [0 1 2 3]) |
| 08:18 | oracle123 | (filter (fn [x] eval (read-string "(< 3 2)")) [0 1 2 3]) |
| 08:18 | oracle123 | |
| 08:21 | hyPiRion | oracle123: There's a difference between `(eval (read-string "(> 3 2)"))` and `eval (read-string "(> 3 2)")` |
| 08:23 | oracle123 | got it, thx hyPiRion |
| 08:50 | samfoo | Hey there clojurists! I have a bit of an open ended design/performance question that I was hoping some more experienced clojure developers might share some thoughts on... |
| 08:51 | samfoo | I've started implementing an NES emulator in clojure, and gotten to a point where immutability is causing pretty substantial performance trouble. |
| 08:52 | samfoo | The design is effectively that I have to "step" from one clock tick to the next. Each step produced a new system state... |
| 08:54 | Glenjawork | which part is the hotspot? |
| 08:54 | samfoo | Object churn |
| 08:54 | Glenjawork | are you changing lots of stuff each "tick" ? |
| 08:54 | samfoo | Yes |
| 08:54 | mdrogalis | Yeah unless you're using persistent data structures, that's going to hurt. |
| 08:54 | Glenjawork | maybe take a look at http://clojure.org/transients |
| 08:55 | samfoo | It's using defrecord or persistent maps for practically all the state |
| 08:55 | samfoo | So it's already persistent |
| 08:55 | mdrogalis | Did you use an actual profiler and observe that GC is the problem? |
| 08:56 | samfoo | I used VisualVM and observed that about 1/2 of the program time is spent in the constructors of some of my defrecords |
| 08:56 | Glenjawork | oh, you're making new records instead of assoc-ing ? |
| 08:56 | mdrogalis | samfoo: Interesting. I don't use defrecord all that much, so I can't comment on performance there. |
| 08:56 | samfoo | Which I interpretted as immutability being "slow" in this particular case |
| 08:57 | Glenjawork | clojure records are immutable in that when you change them you get a new cheap copy |
| 08:57 | Glenjawork | not in the sense that you have to make new ones |
| 08:57 | mdrogalis | What Glenjawork said :) |
| 08:57 | samfoo | Glenjawork: I'm assoc'ing and merging, but I assumed that assoc and merge internally have to call the record (java class) constructor |
| 08:57 | Glenjawork | hrm, interesting |
| 08:58 | samfoo | I could have misinterpretted the profiler output, of course |
| 08:58 | samfoo | I've never profile clojure before |
| 08:58 | mdrogalis | Not all too different from profiling Java IMO |
| 09:02 | oracle123 | (defrecord Alert [id amount unit]) |
| 09:02 | oracle123 | (def alerts (map (fn[x] (Alert. x (* 2 x) (* 3 x))) (range 10))) |
| 09:02 | oracle123 | (def rules ["(> .amount 3)" "(> .unit 4)"]) |
| 09:02 | oracle123 | I want to keep the alerts which meet every rules, how to do that? the rules definition are got from db, so the definition is type of string. |
| 09:02 | oracle123 | |
| 09:05 | daGrevis | is if a macro? |
| 09:06 | sandbags | daGrevis: trick I learned y'day to answer this question: 1) evaluate it |
| 09:06 | sandbags | macro's do not evaluate to themselves |
| 09:07 | sandbags | 2) was looking at the metadata IIRC but looking at it now maybe i got that wrong |
| 09:07 | jballanc | ,(macroexpand '(if true (println "Yes") (println "No"))) |
| 09:07 | clojurebot | (if true (println "Yes") (println "No")) |
| 09:07 | jballanc | even easier :-) |
| 09:07 | jballanc | ,(macroexpand '(-> crazy (nesting) (fun functions))) |
| 09:07 | clojurebot | (fun (nesting crazy) functions) |
| 09:08 | sandbags | jballanc: i'm not following what that tells you... how does that tell you that if is a macro? |
| 09:08 | daGrevis | ,if |
| 09:08 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: if in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 09:09 | jballanc | sandbags: "macroexpand" will expand out macros |
| 09:09 | daGrevis | ye sorry |
| 09:09 | teslanick | If is a special form -- I took that to mean that it was neither function nor macro, and loosely thought it's some sort of IFn implementor in the java land. |
| 09:09 | teslanick | I don't know if that's accurate or not |
| 09:10 | jballanc | teslanick: yup...but definitely not a macro |
| 09:10 | daGrevis | but why isn't it a macro? |
| 09:10 | jballanc | optimization |
| 09:10 | sandbags | jballanc: right, but the macro expansion of the 'if' is the same as the expression so what does that tell you? |
| 09:10 | jballanc | sandbags: that it's not a macro |
| 09:10 | jballanc | see my example with "->" |
| 09:10 | jballanc | which *is* a macro |
| 09:10 | sandbags | jballanc: right but it doesn't tell you that it isn't a function either |
| 09:11 | jballanc | well, you asked if "if" was a macro ;-) |
| 09:11 | sandbags | actually i didn't ;-) |
| 09:11 | jballanc | oh, whoops... daGrevis did |
| 09:11 | sandbags | but i take your point |
| 09:11 | jballanc | :P |
| 09:11 | Glenjawork | ,(var if) |
| 09:11 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve var: if in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 09:12 | sandbags | using macroexpand proves it isn't a macro |
| 09:12 | Glenjawork | ,(var and) |
| 09:12 | clojurebot | #'clojure.core/and |
| 09:12 | Glenjawork | it's a special form |
| 09:12 | Glenjawork | afaict |
| 09:13 | hyPiRion | $source and |
| 09:13 | lazybot | and is http://is.gd/go7OcG |
| 09:13 | jballanc | ,(letfn [(if [c t f] (println "Fooled you"))] (if true (println "If's not a function") (println "umm..."))) |
| 09:13 | clojurebot | If's not a function\n |
| 09:18 | jballanc | heh...fun 'n games: |
| 09:18 | jballanc | ,(letfn [(and [& clauses] (println "Macros can be replaced by functions"))] (and true (println "Macros can't be replaced by functions"))) |
| 09:18 | clojurebot | Macros can't be replaced by functions\nMacros can be replaced by functions\n |
| 09:18 | jballanc | :P |
| 09:22 | Glenjawork | http://clojure.org/special_forms#Special%20Forms--%28if%20test%20then%20else?%29 |
| 09:32 | TimMc | jballanc: Wow, `and` is surprisingly annoying to write. |
| 09:33 | TimMc | (defn and2 ([] true) ([test] (test)) ([test & more] (let [r (test)] (if r (apply and2 more) r)))) |
| 09:33 | TimMc | called like (and2 (fn [] true) (fn [] 5)) |
| 09:35 | deg | Moving my clojure env from Linux to my brand-new MacBook, but I'm a Mac newbie. So, wondering if better to use macports or homebrew, at least with respect to typical clojure/clojurescript usages? |
| 09:36 | AeroNotix | how do I parameterize builds? I want to have global variables (e.g. database hosts, other nodes in my network) as compile time constants. Does Lein support this? |
| 09:37 | jcromartie | AeroNotix: You can include a .properties file in your build and generate it with a template? |
| 09:37 | jcromartie | AeroNotix: but it's really better to specify those things at startup time |
| 09:37 | hyPiRion | AeroNotix: sort of. You can read resource files, and Lein supports specifying which resources to include |
| 09:37 | sandbags | deg: i've used both and found homebrew works better |
| 09:37 | jcromartie | i.e. from outside the .jar |
| 09:37 | hyPiRion | but yeah, jcromartie's suggestion is the best |
| 09:37 | AeroNotix | hyPiRion: jcromartie: I've got a resource file which I use. But I want to e.g. have a `make dev' and a `make production' target. Which will fill out that file. |
| 09:38 | sandbags | deg: in so far as I've never managed to get hb "wedged" and had to start from scratch |
| 09:38 | deg | sandbags: thanks. Any particular advantages, or just general sense? |
| 09:38 | deg | oops, msgs crossed. thx |
| 09:39 | AeroNotix | hyPiRion: jcromartie in Erlang there's a release generator (think uberjar, bit different though) and Erlang uses a sys.config file which you can write in a template language and then specify a file to fill out those templates at release generation time. |
| 09:40 | AeroNotix | using relx |
| 09:41 | hyPiRion | AeroNotix: yeah no, that's not possible in vanilla lein. But possible in plugins, I guess |
| 09:41 | AeroNotix | hmm ok |
| 09:42 | Glenjawork | AeroNotix: could you have the makefile spit out a shell script wrapper that sets env vars? |
| 09:42 | Glenjawork | which isn't really what you asked, but keeps the app free of config and gives you an easier build |
| 09:43 | AeroNotix | hmm, not perfect but... |
| 09:43 | Glenjawork | eg, if you need to add/move a DB host, you don't really want to recompile |
| 09:43 | Glenjawork | http://12factor.net/config and all that jazz |
| 09:43 | AeroNotix | sure. I'm just using what my ops dude likes to use |
| 10:08 | rurumate_ | I need a fast hash function, maybe murmur. Is there a ready-to-eat implementation somewhere? |
| 10:08 | hyPiRion | rurumate_: generally you'd like to use a java lib for that |
| 10:09 | rurumate_ | hyPiRion: yes, that's ok since it would probably be only one static call. but which one? |
| 10:10 | rurumate_ | or is is the wrong channel to ask ;_; |
| 10:12 | ddellacosta | rurumate_: re: wrong channel, personally think that kind of question is fine. Unfortunately don't have a great answer for you...maybe Zach Tellman's byte-transforms? https://github.com/ztellman/byte-transforms |
| 10:13 | hyPiRion | rurumate_: http://search.maven.org/#artifactdetails%7Ccom.google.guava%7Cguava%7C15.0%7Cbundle |
| 10:13 | hyPiRion | rurumate_: then http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/hash/Hashing.html |
| 10:15 | hyPiRion | I would generally just copypaste it and keep the license stuff available if the lib is too big |
| 10:18 | mrhanky | annybody here used servant with dommy? i keep getting an error something like "svgelement" is not defined. i dont know how to avoid this |
| 10:19 | mrhanky | sadly there's really not much information on servant in the web |
| 10:27 | AeroNotix | what are people using for cassandra? |
| 10:28 | stuartsierra | DataStax' Java client. |
| 10:30 | AeroNotix | stuartsierra: what about http://clojurecassandra.info/ |
| 10:30 | AeroNotix | it uses the datastax client underneath |
| 10:30 | AeroNotix | Does this take care of pooling? |
| 10:34 | matt444 | Whenever I define a function inside of a defn and use one of the defn's parameters, ClojureScript compiles that variable as being part of the namespace. Showing you what I mean: http://pastebin.com/Dv62ED2w |
| 10:34 | matt444 | Is this a bug or am I doing something wrong? |
| 10:34 | stuartsierra | AeroNotix: I don't know anything about that. |
| 10:34 | AeroNotix | stuartsierra: hmm, cheers anyway |
| 10:35 | CookedGryphon | matt444: one of those is aitimes, one is atimes |
| 10:35 | CookedGryphon | aitems, atimes* |
| 10:35 | matt444 | well that's embarrassing |
| 10:35 | CookedGryphon | :P |
| 10:36 | matt444 | lesson is to proofread my code, thanks |
| 10:43 | matt444 | Is there a function for turning clojure sequences into javascript arrays, for interop? |
| 10:44 | stuartsierra | matt444: clj->js should do it |
| 10:45 | AimHere | I was going to suggest into-array, but that might be a java-array thing |
| 10:45 | matt444 | @stuartsierra: when i google that I get a link to a gist, is this not in the cljs namespace |
| 10:46 | stuartsierra | matt444: I think it is. Look at the cljs.core source. |
| 10:52 | xificurC | is there a way to fetch all the code I wrote in my repl session? |
| 10:52 | CookedGryphon | no, but that would be an awesome plugin/middleware |
| 10:52 | xificurC | :( |
| 10:52 | llasram | xificurC: Are you using Emacs w/ cider/nrepl ? |
| 10:53 | xificurC | llasram: yes |
| 10:53 | clgv | hmm the repl has to keep its history somewhere... |
| 10:53 | llasram | xificurC: Do you have the Emacs variable `cider-history-file` set? |
| 10:53 | clgv | since you can step and search through it |
| 10:53 | xificurC | llasram: if you have to set it manually then no |
| 10:53 | CookedGryphon | my emacs repl resets every time, is there a way to stop it doing that? |
| 10:53 | llasram | xificurC, CookedGryphon: `customize` that variable. Then your history will be saved theer |
| 10:54 | llasram | And persist across emacs sessions |
| 10:54 | xificurC | llasram: will it save everything? |
| 10:54 | CookedGryphon | !!! |
| 10:54 | llasram | Yes |
| 10:54 | xificurC | even if I type (+ 2 3)? |
| 10:54 | llasram | Yes |
| 10:54 | CookedGryphon | that'll save me some time... |
| 10:54 | CookedGryphon | does it only do it globally though? Not per project? |
| 10:54 | llasram | It just saves the input |
| 10:54 | CookedGryphon | still better than nothing |
| 10:55 | xificurC | I'm playing around with seesaw and wanted to see if I could keep the stuff that worked |
| 10:55 | llasram | CookedGryphon: By default it's global, but I believe you could use e.g. dir locals to make it per-project |
| 10:55 | xificurC | so I am asking for stuff, redefining defs and defns etc |
| 10:55 | llasram | xificurC: Now you want magic :-) |
| 10:55 | llasram | Clojure doesn't save source attached to things it compiles |
| 10:55 | xificurC | I thought I could fetch the last used code :) |
| 10:55 | llasram | So there isn't a way to do that without doing something like custom middleware, as suggested earlier |
| 10:56 | xificurC | thats a shame |
| 10:56 | xificurC | there could be :source meta |
| 10:56 | llasram | xificurC: It's been discussed |
| 10:57 | clgv | xificurC: there is a serializable-fn macro |
| 10:57 | clgv | xificurC: I forgot the name of the lib but google should find it |
| 10:58 | xificurC | clgv: I wanted to save the session I'm running right now and am shutting down the pc in ~10-20 minutes, I don't think I'll be able to solve it till then :) |
| 10:58 | llasram | clgv, xificurC: https://github.com/technomancy/serializable-fn |
| 11:01 | xificurC | this works for fn only? |
| 11:02 | xificurC | very nice though |
| 11:02 | clgv | hm well, defn is missing. it's not difficult to add it though. |
| 11:02 | llasram | The source code is tiny -- reading it should answer all of your questions :-) |
| 11:04 | clgv | when you have a serializable defn, you could replace regular defn via leiningen project.clj to have all function with attached source ;) |
| 11:20 | xificurC | seesaw seems pretty nice |
| 11:21 | corecode | hi |
| 11:21 | corecode | is there a way to convert bigint to byte[]? |
| 11:21 | corecode | (byte-array 10N) returns an array with 10 elements :) |
| 11:22 | corecode | i mean something like BigInteger. .toByteArray |
| 11:22 | clgv | xificurC: it is. helped me to build a code comparison tool pretty fast :) |
| 11:22 | clgv | ,(.toByteArray 10N) |
| 11:22 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: toByteArray for class clojure.lang.BigInt> |
| 11:23 | clgv | ,(.. 10N toBigInteger toByteArray) |
| 11:23 | clojurebot | #<byte[] [B@19512c2> |
| 11:23 | clgv | corecode: there you go ^^ |
| 11:32 | jcromartie | mapcat is lazy… this is huge |
| 11:32 | jcromartie | why did I think that was impossible? |
| 11:33 | clgv | concat is lazy ;) |
| 11:42 | gfredericks | jcromartie: it's mostly lazy |
| 11:43 | gfredericks | $google CLJ-1218 |
| 11:43 | lazybot | [clojure/src/clj/clojure/core.clj at master · clojure/clojure · GitHub] https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj |
| 11:43 | gfredericks | baah |
| 11:43 | matt444 | Pretty sure I found a bug in clj->js |
| 11:43 | matt444 | http://cljsfiddle.net/fiddle/matthewp.myfiddle |
| 11:43 | gfredericks | http://dev.clojure.org/jira/browse/CLJ-1218 |
| 11:44 | clgv | see CLJ-1218 |
| 11:44 | clgv | $see CLJ-1218 |
| 11:44 | clgv | there was a shortcut for this^^ |
| 11:52 | jcromartie | so I'm torn on a design decision |
| 11:52 | AeroNotix | So it looks like this cassandra client (datastax) doesn't do connection pooling, can anyone recommend a generic connection pool? Java or otherwise. |
| 11:52 | jcromartie | I am using protocols and records to define events |
| 11:52 | jcromartie | but I want all events to have a :time attached to them |
| 11:53 | jcromartie | records obviously have no inheritance for things like this |
| 11:53 | clgv | just assoc time anyway? |
| 11:54 | clgv | defrecord has an almost regular map implementation |
| 11:54 | jcromartie | it seems kind of dirty because it's interfering with the record's own field |
| 11:54 | jcromartie | I could use multimethods for handling and maps for events |
| 11:54 | jcromartie | I don't have any real clear reason why I'd use protocols here anyway, I guess :| |
| 11:55 | clgv | you can use regular maps with type metadata |
| 11:55 | jcromartie | and then technomancy would be happy |
| 11:55 | clgv | ,(type (with-meta {:a 1 :time 42} {:type :awesome-event})) |
| 11:55 | clojurebot | :awesome-event |
| 11:56 | jcromartie | if it were maps it would just be {:time … :name :project-created :data {:attributes etc…}} |
| 11:56 | WWWest | Di |
| 11:56 | WWWest | *Hi |
| 11:56 | sveri | hi, i am trying to combine a luminus starter project with enlive, i am able to return a template, but this seems to be parsed by some middleware from luminus, does someone have an example project where he uses enlive and luminus together so i might have a look? |
| 11:56 | jcromartie | and then (defn make-event [name data] {:time … :data data :name name}) etc. |
| 11:56 | clgv | jcromartie: `type` as dispatch function for your different event types ^^ |
| 11:56 | WWWest | if I want to read a value from a channel it two different go blocks, what's the pretty way to do that? |
| 11:56 | jcromartie | type or :name |
| 11:56 | jcromartie | yeah |
| 11:57 | WWWest | *in two different |
| 11:57 | jcromartie | clgv: I don't think metadata is the answer there, because the name of the event is pretty integral to the whole thing, I want to see it |
| 11:57 | jcromartie | and make it obvious |
| 11:57 | jcromartie | I know it's there |
| 11:57 | jcromartie | but I don't like metadata |
| 11:57 | clgv | jcromartie: ok... |
| 11:57 | jcromartie | plus I have to store them |
| 11:57 | clgv | metadata is easily stored ;) |
| 11:58 | clgv | I use maps and type metadata in one of my important dataset formats |
| 11:59 | mikerod | does the latest stable counter clockwise version only work with Java 7? Getting this hinted from http://doc.ccw-ide.org/documentation.html#install-as-plugin . Seeing "Java Virtual Machine (JVM) 7 installed and setup in the Operating System’s PATH" under pre-reqs. |
| 12:00 | clgv | mikerod: humm good question. maybe if uses some java.nio2 features... |
| 12:00 | mikerod | clgv: hmm perhaps |
| 12:00 | clgv | mikerod: do you really want to continue to use unsupported java 6? |
| 12:00 | mikerod | I have some people using counter clockwise that I wouldnt' expect to have Java 7 as of yet |
| 12:01 | mikerod | Clojure only requires 1.5+ :) |
| 12:01 | clgv | isnt clojure 1.6 switching to java 7? |
| 12:01 | mikerod | clgv: I haven't seen this stated somewhere. You could be right. |
| 12:02 | clgv | ah no 1.6 |
| 12:02 | clgv | aka 6 |
| 12:02 | mikerod | yeah |
| 12:02 | koreth__ | I thought there was an issue with Android not moving to Java 7 yet. |
| 12:02 | clgv | "Clojure now builds with Java SE 1.6 and emits bytecode requiring Java SE 1.6 instead of Java SE 1.5. [CLJ-1268]" |
| 12:02 | mikerod | thoguht I read a debate on that somewhere |
| 12:02 | koreth__ | So moving Clojure to 7 would break Android development. |
| 12:02 | mikerod | poor Android |
| 12:03 | koreth__ | (But that's just what I've read; I'm just an interested bystander.) |
| 12:03 | aaelony | is there a concept in clj-time for computing business days between dates? |
| 12:05 | mikerod | When Clojure chooses to embrace invokedynamic, then we'll see Java 7 minimum :) |
| 12:06 | jcromartie | then again, multimethods avoid the AOT hell of protocols and records |
| 12:06 | clgv | mikerod: maybe 1.7? ;) |
| 12:06 | jcromartie | dammit |
| 12:07 | mikerod | jcromartie: AOT hell with protocols and records? hmm |
| 12:08 | hiredman | mikerod: once 1.6 is released the minimum jvm version will be 1.6 as well |
| 12:13 | mikerod | hiredman: yeah, I think that is pretty common that people have moved on to 1.6 |
| 12:13 | mikerod | I think 1.7 is a little less common still |
| 12:13 | mikerod | 1.7 jvm |
| 12:13 | jcromartie | mikerod: interactive development with AOT and protocols = pain |
| 12:14 | jcromartie | mikerod: not to mention without AOT, recompiling a namespace that defines a protocol = pain |
| 12:14 | jcromartie | because every instance of a record that implemented that protocol is now broken and needs to be recreated |
| 12:15 | jcromartie | mikerod: I even had a case where (not= some-record (read-string (pr-str some-record))) due to AOT |
| 12:15 | mikerod | jcromartie: that is true. I've seen the not= sort of scenario several times |
| 12:18 | koreth__ | Wait, how can that be true unless some-record is implementing non-value-based equality semantics? |
| 12:18 | mikerod | koreth__: I believe the Class is checked as well there |
| 12:19 | koreth__ | Ah, ok, TIL |
| 12:20 | mikerod | koreth__: With record (defrecord R [x]) ; (not= (->R 1) {:x 1}) |
| 12:20 | mikerod | so the type is part of the "value" for these |
| 12:21 | koreth__ | I guess I can see the reasoning, but intuitively it feels like it sort of breaks the "records should just be used as a performance optimization for maps" idea. But that idea is probably too simplistic to begin with. |
| 12:24 | mikerod | koreth__: Yeah, that is an interesting point. Testing the full equality of two maps probably isn't often what you want to do anyways I'd suppose though. |
| 12:24 | mikerod | (not= (into {} (->R 1)) {:x 1}) ; problem solved :P |
| 12:25 | WWWest | sorry if impolite, retrying: if I want to read a value from a channel it two different go blocks, what's the pretty way to do that? |
| 12:25 | ToBeReplaced | WWWest: do you mean, you have a channel with a value x on it, and you want two different go blocks to both get x? |
| 12:26 | WWWest | ToBeReplaced: yes |
| 12:26 | justin_smith | WWWest: maybe what you want is broadcast |
| 12:26 | justin_smith | one input, N outputs, each sees all inputs |
| 12:27 | WWWest | yes, looks good, thanks |
| 12:27 | justin_smith | "Usage: (broadcast & ports) Returns a broadcasting write port which, when written to, writes the value to each of ports." |
| 12:28 | justin_smith | I like how core.async is basically a recording studio, it means I can leverage my existing audio engineering skills |
| 12:29 | ToBeReplaced | WWWest: if you don't want the consumers to go out of sync (like, won't allow one consumer to eat more values than the other), then mult/tap will do it properly |
| 12:29 | justin_smith | ToBeReplaced: cool, I was not familiar with that one |
| 12:30 | ToBeReplaced | justin_smith: nothing wrong with broadcast afaict -- i've just been staying out of lab |
| 12:30 | justin_smith | lab? |
| 12:31 | ToBeReplaced | broadcast is a lab feature, i thought? |
| 12:32 | CaptainLex | Does anybody here know much about korma? |
| 12:32 | justin_smith | ToBeReplaced: I am sorry, I don't know what "lab" is |
| 12:33 | justin_smith | oh, now I see, yeah |
| 12:33 | justin_smith | sorry, my bad |
| 12:35 | gfredericks | should I be disturbed that clj-http README documents the :socket-timeout option but that keyword doesn't appear in its /src directory? |
| 12:36 | Glenjawork | it uses destructring a log |
| 12:36 | Glenjawork | a lot |
| 12:37 | gfredericks | yeah I forgot about that possibility |
| 12:37 | gfredericks | the world is as it should be |
| 12:37 | Glenjawork | i only know because i dug through for a similar reason |
| 12:38 | dakrone | gfredericks: https://github.com/dakrone/clj-http/blob/master/src/clj_http/core.clj#L206 |
| 12:39 | gfredericks | dakrone: yep; thanks |
| 12:40 | clgv | gfredericks: socket timeouts are for quitters. :P |
| 12:41 | Glenjawork | we had an issue this week where the client and server both thought they had an active TCP connection, but some hardware in between had killed it |
| 12:41 | Glenjawork | not fun |
| 12:42 | noonian | thats called a man in the middle attack :P |
| 12:45 | justin_smith | noonian: the passive-agressive version |
| 12:45 | noonian | lol |
| 13:03 | dnolen | anyone tried to enable more of paredit in Light Table? |
| 13:05 | jcromartie | koreth__: ,(do (defrecord R [a b]) (let [r (->R :x :y)] (= r (read-string (pr-str r))))) |
| 13:06 | jcromartie | or rather |
| 13:06 | jcromartie | ,(do (defrecord R [a b]) (let [r (->R :x :y)] (= r (read-string (pr-str r))))) |
| 13:06 | clojurebot | #<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true> |
| 13:06 | jcromartie | oh right |
| 13:07 | jcromartie | koreth__: it's even to the point where the record's and the record->string->record's class appear to be the same |
| 13:08 | noonian | i just started using paredit so idk what LT is missing |
| 13:08 | noonian | i think this is the paredit pugin for LT though: https://github.com/LightTable/Paredit |
| 13:09 | CookedGryphon | dnolen: I had a go at composing the existing primitives into something more like emacs' paredit, but it lacks select forward s-exp and wrap/unwrap type operations |
| 13:10 | CookedGryphon | doesn't look like it would be too much work, but I didn't have the time to play any more than that |
| 13:11 | dnolen | CookedGryphon: ok just making sure I wasn't missing something |
| 13:11 | dnolen | noonian: that's actually helpful, I think add parens + the shrink left/right might keep me from losing my mind |
| 13:11 | gfredericks | just wrote a haxy protocol to get the count of the messages in an async buffer; am I missing some existing functionality? |
| 13:13 | clgv | gfredericks: someone on the ML claimed you could just use count on the buffer |
| 13:13 | gfredericks | clgv: it's a (chan 40) actually |
| 13:13 | CookedGryphon | dnolen: have you seen this on the use of that plugin too? https://groups.google.com/forum/#!topic/light-table-discussion/BIyWHnRcoWc |
| 13:13 | clgv | the pattern was too build the buffer manually and then use it to construct a channel |
| 13:14 | gfredericks | clgv: that does appear to work; thanks |
| 13:25 | Pupnik | what does putting in the :seq tag here https://github.com/clojure/core.match/wiki/Overview#seq-matching actually do? is it just a performance optimisation or is there some syntax change I missed? |
| 13:26 | technomancy | Pupnik: it used to be that you couldn't use lists in patterns to match against lists |
| 13:27 | technomancy | I think that was recognized as a design error and fixed, but it could be some of the docs have leftover mentions of the workarounds or something? |
| 13:29 | dnolen | CookedGryphon: nice, so do I need to install the paredit plugin first or is that builtin? |
| 13:30 | Pupnik | hmm seems to have no problem at all working with vectors, but lists might be a bit funny, ill need to experiment more |
| 13:40 | aconbere | anyone here have any experience using amazonica? |
| 13:43 | abaker | is there a lein plugin or available API for creating release zips that are the jar + other goodies in your folder structure (like conf files and the like)? |
| 13:44 | arrdem | is there a particular favorite among the Clojure logging libraries? I'm looking for something with namespace level debugging control and minimal overhead beyond that. |
| 13:44 | ToBeReplaced | abaker: not the answer to your question, but could the conf files and related be "resources" instead that are packed up with the jar? |
| 13:44 | ToBeReplaced | arrdem: i like clojure.tools.logging |
| 13:44 | llasram | arrdem: I use tools.logging w/ slf4j + log4j |
| 13:45 | abaker | ToBeReplaced: no, they're too big and conceptually not typical resources you'd pack into the jar |
| 13:45 | technomancy | abaker: there is lein-tar for that |
| 13:45 | llasram | arrdem: You can configure it with a short Java properties file |
| 13:45 | abaker | technomancy: cool, that's what I was looking for |
| 13:46 | ne-on | dnolen: paredit is built in, but none of the commands are bound to keys. control-space and type 'paredit' to see commands, or 'keymap' to see keymapping stuff |
| 13:46 | dnolen | ne-on: thx |
| 13:53 | shiranaihito | what kind of problems can conflicting dependencies be expected to cause if one of them is ignored (to get past the build error)? .. in this case, i've included Datomic, which depends on AWS SDK, which depends on Codec 1.3 .. but other stuff depends on Codec 1.6 .. is there a sensible, non-dirty solution to this, or should i just wait for whatever trouble is coming my way? :P |
| 14:02 | stuartsierra | shiranaihito: As long as the more-recent version is 100% API-compatible with the older version, you can safely use the more-recent version. |
| 14:03 | shiranaihito | .. and only as pertains to what's actually being used by the dependencies? |
| 14:03 | justin_smith | shiranaihito: I usually use an :exclusions key, and go with whatever combination of :exclusions on various deps reliably gets me an app that works |
| 14:03 | shiranaihito | :P |
| 14:03 | stuartsierra | shiranaihito: yes, if you can determine what's used |
| 14:04 | shiranaihito | and what happens when there's a "compatibility conflict" with the calls being used? |
| 14:04 | stuartsierra | shiranaihito: stuff breaks ;) |
| 14:04 | shiranaihito | of course, but how mysteriously? :P |
| 14:05 | hyPiRion | very, usually :p |
| 14:05 | stuartsierra | It really depends on the library and the nature of the conflict. |
| 14:05 | shiranaihito | .. examples? :P |
| 14:05 | Slackwise | Where's the best place to ask newbie questions? I've got a snippet of code that's clearly not working, and it'd help to have someone explain what I'm doing wrong. |
| 14:05 | stuartsierra | A common symptom is a ClassNotFoundException or a method-not-found. |
| 14:05 | nDuff | Slackwise: Here isn't awful. |
| 14:05 | Slackwise | https://gist.github.com/Slackwise/c8f2af25bcc2598096e4 |
| 14:05 | rasmusto | Slackwise: here, drop a link to a gist/refheap paste |
| 14:06 | shiranaihito | stuartsierra: hmm.. well, a method-not-found would lead you in the right direction, at least |
| 14:06 | Slackwise | I'm trying to re-implement the comp function, but I'm getting an a crazy arity error. |
| 14:06 | Slackwise | ^a crazy |
| 14:06 | shiranaihito | how often do you guys run into trouble with dependencies? |
| 14:06 | stuartsierra | shiranaihito: Running `lein deps :tree` will print out warnings for possible dependency conflicts. |
| 14:07 | hyPiRion | Slackwise: (apply (first fs) results) should be ((first fs) results) |
| 14:07 | llasram | shiranaihito: Not very often in my experience |
| 14:07 | nDuff | Slackwise: right -- it's passing each character through as an argument. |
| 14:07 | shiranaihito | stuartsierra: well, i'm already getting an error - that's why i'm asking about this stuff :) |
| 14:07 | abaker | llasram: clearly you need more commons-logging in your life |
| 14:07 | shiranaihito | "Possibly confusing dependencies found" |
| 14:08 | hyPiRion | Slackwise: also, this happens in opposite order of comp, so if you want the exact same functionality, you need to reverse the list first |
| 14:08 | shiranaihito | but alright.. the most efficient way to sweep this madness under the rug is some kind of "general exclusions" key somewhere? |
| 14:08 | mikerod | so stuartsierra has officially embranced leiningen over maven for building Clojure projects? |
| 14:09 | nDuff | Slackwise: ...apply can/will do that. |
| 14:09 | pjstadig | well there was the hand off of power ceremony |
| 14:09 | hyPiRion | mikerod: hah. I just thinks he knows all the ways debug unexpected lein results. |
| 14:09 | mikerod | http://stuartsierra.com/2013/11/04/command-line-intransigence |
| 14:10 | nDuff | Slackwise: if you take out the apply, it works. |
| 14:10 | mikerod | hyPiRion: maybe true, I was just putting the blog post together with this hah. |
| 14:10 | hyPiRion | :p |
| 14:10 | nDuff | Slackwise: ...so, that line should be just ((first fs) results) |
| 14:10 | stuartsierra | shiranaihito: Yes, you can use `:exclusions […]` at the top level of project.clj |
| 14:11 | shiranaihito | stuartsierra: alright, thanks! .. i guess i'll.. be alright.. :p |
| 14:11 | Slackwise | nDuff, hyPiRion: I guess my problem is assuming args would be a seq? |
| 14:11 | Slackwise | I was using apply to "explode" a list. |
| 14:11 | nDuff | Slackwise: pardon? args *is* a seq. |
| 14:11 | mikerod | I have been on the fence on the topic at times. Maven is probably smoother in my current work environment, but leiningen is a possibility. Looking for that final inspiration to push more for lein here. |
| 14:11 | stuartsierra | mikerod: There are still things missing from Leiningen that Maven does (e.g. multi-module builds with automatic dependency ordering) but I default to Leiningen for most Clojure work. |
| 14:11 | nDuff | Slackwise: you might consider playing around with Light Table if you want to see what values are used in practice. |
| 14:11 | hyPiRion | Slackwise: ooh, sorry. You're right. Well, just for the first comp. |
| 14:12 | hyPiRion | then, when you've done (apply (first fs) result) once, the results will not be a list. |
| 14:13 | Slackwise | nDuff: Will Light Table do any form of debugging, or just evaluate expressions? (I've seen a bit of the screencast, so I know it will do inline eval.) |
| 14:13 | mikerod | stuartsierra: Yes, I have had a few times now where I'd prefer to be using Leiningen for our Clojure projects due to its greater (perhaps just simpler) build flexibility. |
| 14:14 | rasmusto | is there a good way to shell out in a lighttable plugin? I'm looking at the python plugin example and its doing a lot of (unnecessary?) stuff. I want to run git |
| 14:14 | Slackwise | hyPiRion: Ahh, good point. It was a seq coming in, but not out, and apply expects a seq, doesn't it... |
| 14:14 | hyPiRion | Slackwise: yes, exactly |
| 14:14 | Slackwise | So... use "into"? |
| 14:15 | Slackwise | Hmm. |
| 14:15 | djjolicoeur | Slackwise: You can set up kebindings to do things like macroexpand, benchmarking, or tracing in light table |
| 14:16 | nDuff | Slackwise: if there's stepwise debugging as such, I'm not aware of it. If that's what you want, you end up with something like Ritz, and that's... rather heavyweight. |
| 14:16 | sobel | oh hai, nDuff :) |
| 14:16 | nDuff | sobel: heh, small world. |
| 14:18 | Slackwise | djjolicoeur, nDuff: I meant to give Light Table a try anyway, so I'll definitely check it out. (Downloading.) |
| 14:22 | jcromartie | sigh… at some point you just have to set aside the pure functions and make API calls to six different systems :P |
| 14:22 | jcromartie | there's always going to be a point of no return |
| 14:44 | fredyr | i'm having trouble with lookups on om's cursors |
| 14:44 | fredyr | this is a manual cursor creation of the same state i have in my component |
| 14:44 | fredyr | https://gist.github.com/fredyr/8424220 |
| 14:44 | fredyr | which gives an error i'm not really able to follow |
| 14:48 | fredyr | it does work if i do (:author (om/value cursor)), but the cursor is implementing the lookup interface straight up, isn't that the idea? |
| 14:51 | noonian | fredyr: hmm, are you sure you need to build a cursor by hand? |
| 14:56 | fredyr | no, im not doing that in my original code, but i tried to narrow the behaviour down |
| 14:57 | fredyr | the manual cursor is a recreation of the same state i had in my component, which gave the same error |
| 15:01 | justin_smith | technomancy: I need to add a jar to the path that will be on a user's machine (comes with java) but is no longer included in the default classpath. Resolving it with an environment expansion under :source-paths works (and :java-source-paths would too) but I would like a key that more clearly species "this is a jar that is part of java but not in the default classpath" or something close to it |
| 15:01 | llasram | justin_smith: :resource-paths ? |
| 15:01 | justin_smith | hmm, yeah, that kind of makes sense |
| 15:02 | fredyr | noonian: updated the gist to contain the original code |
| 15:07 | aaelony | 12:02 *** tomobrien QUIT Ping timeout: 248 seconds |
| 15:08 | noonian | fredyr: try passing nil as the first arg to dom/div before your (dom/h2 nil ...) |
| 15:11 | fredyr | noonian: right, that was me messing up the gist, had a #js object there in the original. doesn't make any difference unfortunately |
| 15:11 | justin_smith | llasram: good enough, running with that one |
| 15:11 | justin_smith | (inc llasram) |
| 15:11 | lazybot | ⇒ 14 |
| 15:15 | noonian | fredyr: hmm, weird. and you're calling build on book? or om/root? |
| 15:16 | fredyr | noonian: yes, root on the initial state and build-all for the list of books |
| 15:17 | fredyr | noonian: as you see, the print-out of the state coming into the component is okay |
| 15:17 | fredyr | noonian: and it works if i call om/value |
| 15:20 | noonian | fredyr: i'm not sure whats' causing the error |
| 15:21 | gfredericks | is async/thread supposed to be a version of async/go without the crazy state machine? |
| 15:21 | noonian | i'd update to om 0.1.6 and try to figure out whats going on from the source |
| 15:21 | gfredericks | if not, what distinguishes it from go? |
| 15:21 | noonian | i think the error is from line 97 of the current source in core.cljs: (if (satisfies? IShouldUpdate c) |
| 15:22 | sveri | hi, when i use enlive with ring, is there a way to enable hot reloading of html templates? |
| 15:23 | dav | is there a document/blogpost somewhere that explains the performance/implementation of hash-maps ? |
| 15:24 | jcromartie | sveri: yes, there is https://github.com/cgrand/enlive#auto-reloading-112 |
| 15:24 | sveri | jcromartie: hm, i have seen that |
| 15:24 | sveri | but where do i have to put that? |
| 15:24 | sveri | in the handler? |
| 15:26 | jcromartie | sveri: I think you call it directly in the ns with templates |
| 15:26 | sveri | jcromartie: you mean where i define the templates? |
| 15:27 | sveri | in the clojure file? |
| 15:27 | noonian | dav: i think rich hickey has a few videos talking about them. they are a persistent version of an array mapped hash trie described by some dude name Bagwell but i can't find the paper with a quick google |
| 15:32 | fredyr | noonian: i'm on 0.1.6 btw, thanks for the help |
| 15:33 | noonian | fredyr: np, i might try to reproduce your error when i have time |
| 15:33 | fredyr | noonian: cool, let me know if you find anything |
| 15:33 | noonian | will do |
| 15:34 | dav | noonian: thanks |
| 15:34 | noonian | np |
| 15:34 | dav | noonian: http://en.wikipedia.org/wiki/Hash_tree_(persistent_data_structure) <= there are references there |
| 15:35 | noonian | thanks |
| 15:36 | edbond | using (go ... (om/read ... (<! ....))) tells me <! used not in go block. Why is that? |
| 15:45 | bitemyapp | http://news.sciencemag.org/people-events/2013/06/u.s.-supreme-court-strikes-down-human-gene-patents |
| 15:46 | technomancy | oops |
| 15:46 | aaelony | shouldn't this return true?? (re-matches #"\-" "hello-there") |
| 15:46 | bitemyapp | aaelony: are you asking us to change Clojure's regex library? |
| 15:47 | bitemyapp | aaelony: or Java's for that matter? |
| 15:47 | aaelony | no I foolishly have forgotten how to match a hyphen in a string... |
| 15:47 | technomancy | ,(some #{\?} (name 're-matches)) |
| 15:47 | edbond | ,(re-matches #"\-" "hello-there") |
| 15:47 | clojurebot | nil |
| 15:47 | clojurebot | nil |
| 15:47 | bitemyapp | ,(re-find #"-" "hello-there") |
| 15:47 | clojurebot | "-" |
| 15:47 | bitemyapp | ,(re-find #"BLAH" "hello-there") |
| 15:47 | clojurebot | nil |
| 15:48 | aaelony | thanks, I just need it to report true if there is a hyphen |
| 15:48 | bitemyapp | aaelony: you got two unhelpful answers and one helpful one. That's a better than average hit-rate. |
| 15:48 | bitemyapp | aaelony: "-" is true. |
| 15:48 | aaelony | that works :) |
| 15:48 | bitemyapp | ,(not "-") |
| 15:48 | clojurebot | false |
| 15:48 | technomancy | wait true or truthy? |
| 15:48 | bitemyapp | truthy |
| 15:48 | bitemyapp | I was trying to avoid using that word. |
| 15:49 | bitemyapp | saying "true" makes the ridiculous nature of it more obvious. |
| 15:49 | technomancy | truthiness is perfectly cromulent |
| 15:49 | aaelony | helpful answers to me, heheh |
| 15:50 | bitemyapp | aaelony: typing re-<TAB> would've given you some functions to fiddle with |
| 15:50 | bitemyapp | aaelony: could've easily figured it out yourself in the repl :P |
| 15:50 | aaelony | long story... but true |
| 16:05 | gfredericks | ~truthiness |
| 16:06 | clojurebot | Pardon? |
| 16:06 | gfredericks | clojurebot: truthiness is perfectly cromulent |
| 16:06 | clojurebot | Roger. |
| 16:14 | gfredericks | oh man async/alt! is a nasty macro |
| 16:23 | amalloy | isn't every async macro a nasty one? |
| 16:26 | gfredericks | prollably |
| 16:32 | milanj | what's usual way to get minimal useful stacktrace ? |
| 16:32 | technomancy | use a language that isn't clojure |
| 16:32 | TimMc | milanj: (pst) |
| 16:32 | trptcolin | BOOM technomancy'd |
| 16:33 | TimMc | milanj: clojure.repl/pst prints the most recent exception in a cleaner way. |
| 16:33 | milanj | TimMc, thanks, I'll look at it |
| 16:34 | milanj | technomancy, I wish |
| 16:39 | eric_normand | I would like to do something when a lazy seq has been exhausted |
| 16:39 | eric_normand | is there a common way to do that? |
| 16:40 | gfredericks | (concat some-seq (lazy-seq (side-effects) ())) ;; would work I think |
| 16:40 | gfredericks | I've never seen anybody do that |
| 16:40 | eric_normand | would like to close an input stream and delete a file |
| 16:40 | bitemyapp | eric_normand: wouldn't rest be nil? |
| 16:40 | eric_normand | gfredericks: ah! thanks! |
| 16:41 | gfredericks | eric_normand: probably there are better ways to handle resources like that |
| 16:41 | bitemyapp | man. |
| 16:41 | eric_normand | bitemyapp: wrong scope |
| 16:41 | gfredericks | pjstadig has this fascinating lib that I don't know anything about |
| 16:41 | bitemyapp | People complain about laziness in Haskell and then do stuff like that? |
| 16:41 | Bronsa | eric_normand: there is also realized? |
| 16:41 | eric_normand | again, wrong scope |
| 16:41 | bitemyapp | eric_normand: your face is a wrong scope :| |
| 16:41 | eric_normand | the file is too big to fit in memory |
| 16:41 | bitemyapp | eric_normand: jkjk :) |
| 16:42 | bitemyapp | eric_normand: liked the H-M post. |
| 16:42 | eric_normand | bitemyapp: thanks! |
| 16:42 | bitemyapp | eric_normand: didn't like the war it sparked off in HN. I wasn't responsible for that bonfire, for once. |
| 16:43 | eric_normand | bitemyapp: i try not to read comments there |
| 16:43 | eric_normand | bitemyapp: anything worthwhile? |
| 16:46 | bitemyapp | eric_normand: Wiser man than I. Good comments include: https://news.ycombinator.com/item?id=7053188 https://news.ycombinator.com/item?id=7052206 https://news.ycombinator.com/item?id=7052344 https://news.ycombinator.com/item?id=7051944 |
| 16:46 | bitemyapp | eric_normand: ignore the rest as much as possible, including responses. |
| 16:46 | eric_normand | bitemyapp: thanks |
| 16:47 | eric_normand | bitemyapp: i think I'll avoid the lazy seq solution |
| 16:47 | eric_normand | bitemyapp: cleaner just to return a cleanup closure |
| 16:47 | bitemyapp | eric_normand: thank you :) |
| 16:49 | abaranosky | is there a consensus on which JSON library has the best performance? |
| 16:49 | bitemyapp | abaranosky: Jackson? |
| 16:49 | bitemyapp | abaranosky: you won't like the output. |
| 16:50 | bitemyapp | abaranosky: use criterium and benchmark it against inputs and outputs you care about. |
| 16:51 | bitemyapp | abaranosky: throw jackson, clj-json, cheshire, and http://code.google.com/p/json-smart/wiki/Benchmark into the running. |
| 16:53 | technomancy | what |
| 16:53 | technomancy | clj-json is not a thing |
| 16:53 | bitemyapp | h/o |
| 16:53 | technomancy | it's just what cheshire used to be called |
| 16:54 | bitemyapp | oh |
| 16:54 | bitemyapp | well nevermind then. |
| 16:54 | technomancy | and jackson is just the lib underneath cheshire |
| 16:54 | bitemyapp | didn't know if there'd be a performance difference between it and cheshire. |
| 16:54 | bitemyapp | technomancy: yeah but is there overhead from mapification? |
| 16:55 | technomancy | bitemyapp: sure, but that's overhead nearly every clojure application is going to introduce anyway |
| 16:55 | dakrone | bitemyapp: there's always overhead, you could just loop over Jackson's JsonToken/START_OBJECT, but that would be a pain ;) |
| 16:55 | technomancy | whether in the lib or outside it |
| 16:55 | bitemyapp | technomancy: given what I know about abaranosky, I was taking non-mapification to be a serious option. |
| 16:55 | bitemyapp | Really. |
| 16:56 | dakrone | cheshire includes benchmarks, you could always run those |
| 16:56 | bitemyapp | dakrone: what agains what? |
| 16:56 | sveri | hm, i added (net.cgrand.reload/auto-reload *ns*) to my template definition .clj file, but the hot reloading is still not working with http-kit, any ideas what is wrong there? |
| 16:56 | bitemyapp | dakrone: it's safe to assume he's been using Cheshire all along and has run into a rough patch. |
| 16:56 | bitemyapp | (probably) |
| 16:57 | dakrone | bitemyapp: data.json, clj-json, and a lot of different parts in cheshire (keyword-izing, custom keyword coerce fns, etc) |
| 16:57 | `cbp | if i had a dime for every setup.py i've had to edit |
| 16:57 | bitemyapp | `cbp: if I had a dime for every setup.py I've had to edit, I'd have half a dollar. I'm pretty good at avoiding Python busywork. |
| 16:57 | bitemyapp | `cbp: mostly by writing Makefiles instead. |
| 16:58 | arrdem | bitemyapp: we should architect a Makefile replacement that's easier to write and harder to fuck up |
| 16:58 | bitemyapp | arrdem: doable with a Haskell EDSL. |
| 16:58 | `cbp | I mean setup.py that pip gives me |
| 16:58 | bitemyapp | arrdem: model it as a dependency tree. |
| 16:58 | arrdem | bitemyapp: exactly. |
| 16:59 | bitemyapp | `cbp: pip is for communists. |
| 16:59 | arrdem | now we just have 30 years of legacy makefiles to migrate.. |
| 16:59 | bitemyapp | arrdem: "Now there are 102 Makefile clones" |
| 16:59 | rasmusto | just replace tab characters with "[" and you're good |
| 16:59 | arrdem | rasmusto: oh gods why |
| 17:00 | bitemyapp | arrdem: GHC is enabling typeholes by default. This is amazing. |
| 17:00 | rasmusto | (for the makefile replacement) |
| 17:00 | bitemyapp | arrdem: http://www.haskell.org/haskellwiki/GHC/TypeHoles |
| 17:00 | arrdem | bitemyapp: the last make system I worked with used $(make $TARGET $OPTS) to allow for reconfiguring of "shared" components, thus making a parallel build impossible.. |
| 17:00 | bitemyapp | arrdem: noice. |
| 17:01 | `cbp | c based too hard too many unices too many differences |
| 17:01 | `cbp | jvm or bust imo |
| 17:01 | arrdem | RUST OR BUST |
| 17:02 | bitemyapp | arrdem: I'm considering using Rust in an AI competition tomorrow. |
| 17:02 | arrdem | bitemyapp: if you do lemme know how it goes.. I have yet to truly try out rust. |
| 17:02 | arrdem | hello world doesn't count at all. |
| 17:04 | bitemyapp | arrdem: most of what I know about it concerns the type system, ownership model, and concurrency model. For fairly obvious reasons (those are the interesting bits) |
| 17:04 | bitemyapp | arrdem: the secret here is keeping the rust devs honest WRT FP, which failed in the development of other languages. Rust is hybrid procedural / FP at the moment, no OO. |
| 17:04 | bitemyapp | arrdem: but make no mistake, it's no Haskell. It's pretty typical to mutate structs (which are memory-identical to C structs) and kick 'em around. |
| 17:05 | bitemyapp | arrdem: but the compiler keeps you honest, so that's good. |
| 17:05 | bitemyapp | arrdem: true const correctness! |
| 17:05 | bitemyapp | <3 |
| 17:05 | arrdem | bitemyapp: yeak. that the compiler is keeping you honest about pointers and memory locations I think is pretty cool. |
| 17:06 | arrdem | bitemyapp: I haven't read in to the channels system yet |
| 17:06 | jjido | if you're into C style syntax there is http://ceylon-lang.org too |
| 17:06 | bitemyapp | arrdem: well it's not pointers and memory locations so much as tree-based propagation of "properties" |
| 17:07 | arrdem | jjido: some things were not meant to be... |
| 17:07 | bitemyapp | arrdem: if container is mut, the sub-elements it "owns" are mut. Ditto immutability. Ditto ownership strategy. |
| 17:07 | bitemyapp | arrdem: well sorry, not quite ditto ownership strategy. |
| 17:08 | seangrove | Is there an index-of in clojurescript? |
| 17:08 | bitemyapp | arrdem: it's more subtle than that, you can have value and reference based sub elements mixed into a container. |
| 17:08 | seangrove | Or rather, what's a good way to find the index of an element in a collection that matches a predicate? |
| 17:09 | bitemyapp | seangrove: filter + map-indexed |
| 17:10 | dnolen | seangrove: I'm thinking about adding indexOf lastIndexOf to all sequential CLJS collections, I think there's a ticket for it even |
| 17:10 | bitemyapp | ,(ffirst (filter #(= (second %) "blah") (map-indexed vector ["woot" "blah" "blargh"]))) |
| 17:10 | clojurebot | 1 |
| 17:10 | bitemyapp | seangrove: ^^ |
| 17:11 | seangrove | bitemyapp: Ah, makes sense, thanks |
| 17:11 | seangrove | dnolen: Would certainly be nice, but I assume that would be looking for a specific item? |
| 17:11 | seangrove | dnolen: Or would you use the #{} syntax for it? |
| 17:11 | dnolen | seangrove: no predicate |
| 17:11 | dnolen | seangrove: same as Clojure |
| 17:11 | amalloy | bitemyapp: (first (keep-indexed ...))? |
| 17:12 | bitemyapp | amalloy: not my fault the language doesn't have loop fusion :( |
| 17:12 | bitemyapp | amalloy: good call. |
| 17:14 | piranha | dnolen: I'm not sure if that's a bug or not, but if I do two om.core/update! calls in a row, I get "Cannot manipulate cursor outside of render phase, only om.core/transact!, om.core/update!, and om.core/read operations allowed" |
| 17:14 | bitemyapp | arrdem: Reid read: http://www.haskell.org/haskellwiki/GHC/TypeHoles |
| 17:14 | piranha | afk right now, but if you want, I can provide more details |
| 17:14 | arrdem | bitemyapp: never do tha again. |
| 17:14 | arrdem | bitemyapp: already queued |
| 17:15 | dnolen | piranha: would need to see a minimal example, thanks |
| 17:15 | bitemyapp | arrdem: sweet |
| 17:16 | Cr8 | bitemyapp is a typehole |
| 17:16 | arrdem | (inc Cr8) |
| 17:16 | lazybot | ⇒ 3 |
| 17:17 | `cbp | LOL |
| 17:17 | bitemyapp | bitemyapp |is| a typehole |
| 17:17 | bitemyapp | clojurebot: bitemyapp |is| a typehole |
| 17:17 | clojurebot | Ik begrijp |
| 17:17 | arrdem | bitemyapp: you're already bitemyapp |is| |
| 17:17 | arrdem | it entertains me to mock other peoples gods |
| 17:18 | bitemyapp | ~bitemyapp |
| 17:18 | clojurebot | bitemyapp is a typehole |
| 17:18 | bitemyapp | arrdem: evidently not! |
| 17:18 | arrdem | bitemyapp: hum... clojurebot is supposed to gripe when you change your own ~ but w/e |
| 17:19 | Cr8 | huh |
| 17:19 | Cr8 | that's actually pretty neat |
| 17:19 | arrdem | one of these days I'm gonna figure out how to get clojurebot to bitch on my behalf whenever pastebin.com is mentioned in channel... |
| 17:19 | bitemyapp | ~bitemyapp |
| 17:19 | clojurebot | bitemyapp is it amuses me to mock other peoples' gods |
| 17:19 | Cr8 | then again I've been in C++ land all day so anything having to do with making error messages *reasonable* probably seems pretty neat to me right now |
| 17:19 | arrdem | ~botsnack |
| 17:20 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 17:20 | arrdem | bitemyapp: ooh! I know what I can use grimoire for... |
| 17:20 | arrdem | bitemyapp: clojurewiki lookup! |
| 17:20 | bitemyapp | arrdem: I already have a grimoire repo, YOU'RE TOO LATE |
| 17:21 | arrdem | Q_Q |
| 17:21 | bitemyapp | arrdem: jk jk. I do have a repo but it's a starting place for notes I wouldn't put in ClojureWiki. |
| 17:21 | arrdem | that's something else I want to add to the wiki... a naming convention article |
| 17:22 | arrdem | with extra bitching about $LEIN_IRONIC_JURE |
| 17:22 | technomancy | how about clo* |
| 17:22 | piranha | dnolen: not really minimal (I can provide smaller one tomorrow, time to sleep here already :), but here my actual code - http://paste.in.ua/9265/#11 - line 11 is failing |
| 17:23 | arrdem | technomancy: I only know three clo* projects.. clojurebot, clojail and cloutjure. |
| 17:23 | dnolen | piranha: that might be becauase that's in a go loop |
| 17:23 | piranha | dnolen: can I do anything because of that? |
| 17:23 | `cbp | what about cloact |
| 17:26 | dnolen | piranha: actually that should just work |
| 17:26 | piranha | :( |
| 17:26 | dnolen | piranha: oh I see |
| 17:26 | dnolen | piranha: the second one is problematic |
| 17:26 | dnolen | piranha: you are reading from a cursor that's a no no |
| 17:26 | bitemyapp | sadfaces on IRC sometimes actually make me sad. |
| 17:26 | bitemyapp | piranha's was one of them |
| 17:26 | dnolen | piranha: outside of the render phase |
| 17:27 | dnolen | :orig-locations |
| 17:27 | piranha | dnolen: ah! I see |
| 17:27 | arrdem | I wonder if there's an emacs minor-mode to do smilies->glyphs |
| 17:27 | piranha | hm, well I can read from global state atom here of course... |
| 17:27 | dnolen | piranha: no need |
| 17:27 | dnolen | piranha: just do it "inside" |
| 17:28 | dnolen | piranha: (update! data (fn [data] ...)) |
| 17:28 | bitemyapp | arrdem: you can definitely do it, given what Haskellers do with lambdas. |
| 17:29 | piranha | dnolen: hah, sure! thanks :) |
| 17:29 | arrdem | bitemyapp: looks like it's an emacs/erc builtin already. |
| 17:29 | bitemyapp | lolmacs. |
| 17:29 | arrdem | HAHA piranha's last got glyph'd :D |
| 17:29 | dnolen | piranha: yeah it's too easy to see inconsistent stuff, if Om doesn't enforce because of 16ms delay between renders |
| 17:29 | arrdem | bitemyapp: br0 I'm already a nyanmacs user... what did you expect of me? |
| 17:30 | dnolen | piranha: so it actually caught a potential bug for you :) |
| 17:30 | piranha | yeah I understand that :) |
| 17:30 | piranha | that's quite cool, the only problem that it's not documented/I couldn't understand from an error message what to do |
| 17:30 | piranha | but I can live with that :P |
| 17:31 | dnolen | piranha: yes we're getting close to the point where I'll starting documenting, I'm starting to see that what we have is pretty good with the exception of the outstanding issues |
| 17:31 | piranha | bitemyapp: and I'm sorry for a sadface, was confused :-) |
| 17:32 | piranha | dnolen: yeah it's quite usable right now, I don't think I miss anything... but you'll hear from me if I will :-) |
| 17:32 | dnolen | piranha: excellent :) |
| 17:32 | bitemyapp | arrdem: I use to use nyanmacs, until it started causing memory leaks. |
| 17:34 | wwell | sorry for the stupid question, but i'm just starting clojure and i was wondering about something regarding variables wrapped inside of lambdas: when i write something like (defn f [] y), i would think that it wouldn't give me unbound variable error, but rather just wait until f is applied (which is what happens with common lisp and scheme) |
| 17:34 | wwell | i guess this wouldn't be useful too often, but it seemed curious to me |
| 17:35 | shep-werk | wwell: i think that is dynamic binding |
| 17:35 | wwell | ohh |
| 17:35 | wwell | i'm not used to that |
| 17:35 | technomancy | it's not dynamic binding |
| 17:35 | shep-werk | and as i understand it, clojure has lexical binding |
| 17:35 | wwell | oh |
| 17:35 | bitemyapp | it has dynamic scope too. |
| 17:35 | bitemyapp | but that's not really the point in this case. |
| 17:35 | technomancy | wwell: clojure functions don't carry around their full environment |
| 17:35 | shep-werk | true, but you have to opt into that, correct? |
| 17:35 | technomancy | just the specific locals they depend upon |
| 17:36 | technomancy | so you can know during compile time whether a function refers to something non-existent |
| 17:36 | wwell | okay |
| 17:36 | technomancy | (also because there's no way to pass an environment to eval) |
| 17:36 | noonian | but this is a compile time error right? isn't it about the compiler trying to make guarantees for the jvm? |
| 17:36 | technomancy | noonian: nothing to do with the jvm |
| 17:37 | technomancy | there's just literally no way that function could ever work |
| 17:38 | noonian | if y was defined later it would work in other languages though, so the original question seems valid to me: why throw the error at compile time? |
| 17:38 | noonian | it sounds like you are saying it was a design choice |
| 17:38 | technomancy | as a top-level var or as a local? |
| 17:38 | noonian | a top level var |
| 17:39 | technomancy | as a local there's no way it could work; as a top-level var it was an explicit design choice to simplify the compiler and allow it to catch many kinds of errors |
| 17:39 | technomancy | s/local/closure/ |
| 17:39 | noonian | cool |
| 17:40 | technomancy | comes up every so often on the mailing list |
| 17:40 | technomancy | well, it used to |
| 17:40 | wwell | alright, thanks for the informative (and very quick/kind) answers. i gotta go now~ |
| 17:41 | scgilardi | it's why declare is useful/used |
| 17:43 | bitemyapp | technomancy: I just thought of a workaround. |
| 17:43 | bitemyapp | Agda is cooler anyway >:) |
| 17:53 | arrdem | bitemyapp: smiley mode totally mangled that last one... I got a > and then the glyph. evidently I need to do some hacking on this... |
| 17:54 | Cr8 | ew smilies |
| 18:03 | mikerod | is `(vec <some-coll>)` better than `(apply vector <some-coll>)` |
| 18:03 | amalloy | i mean, maybe it depends on your definition of "better" but it's better in any way i can think of |
| 18:04 | mikerod | vague I know, I mean if you had to choose |
| 18:04 | technomancy | mikerod: I'd guess it's less wasteful since apply has to create a seq for the args to vector |
| 18:04 | amalloy | i would never write (apply vector x) |
| 18:04 | technomancy | but no idea if that actually matters |
| 18:04 | amalloy | technomancy: huh? it creates exactly as many seqs as vec does |
| 18:04 | mikerod | ok, so a subtle difference; `vec` definitely seems more straight-forward, so then I'd pick it as "better" |
| 18:05 | technomancy | hm; true since you still have to step over it |
| 18:05 | technomancy | use whichever uses transients, if any |
| 18:08 | justin_smith | that would be (into [] coll) |
| 18:08 | bitemyapp | okay people |
| 18:08 | bitemyapp | we're going to stop guessing |
| 18:08 | technomancy | but I don't actually care |
| 18:08 | technomancy | you can't make me care |
| 18:08 | bitemyapp | I want empiricism damn you |
| 18:14 | bitemyapp | Execution time mean : 11.088373 ms for (apply vector (range 100000)) --- Execution time mean : 10.990399 ms for vec. |
| 18:14 | bitemyapp | std-dev of both was in the hundreds of microseconds. |
| 18:14 | bitemyapp | mikerod: now you know. |
| 18:15 | technomancy | http://sararyan.com/wp-content/uploads/covers/3183556620_14b37b97d0_m-150x150.jpg |
| 18:15 | bitemyapp | <3 |
| 18:16 | technomancy | was wearing that shirt yesterday |
| 18:16 | technomancy | also, now I really really want to find myself in a situation where I can drop the ape dung link and have it be apropos |
| 18:16 | technomancy | the one from yesterday |
| 18:17 | bitemyapp | Yeah, I remember. That won't be easy. |
| 18:17 | technomancy | we'll see |
| 18:17 | amalloy | bitemyapp: that didn't measure anything interesting |
| 18:17 | bitemyapp | amalloy: my repl is at your disposal. |
| 18:17 | technomancy | bitemyapp: I could be invited to contribute to a Go codebase or something |
| 18:17 | amalloy | you just measured how long it takes to fully evaluate (range 100000) |
| 18:18 | bitemyapp | ah, well, good point. h/o |
| 18:18 | bitemyapp | technomancy: that would do it. |
| 18:18 | amalloy | you want instead to (def l (doall (range 100000))), and then time (vec l) (apply vector l) |
| 18:18 | bitemyapp | amalloy: yeah, about to do that. |
| 18:18 | bitemyapp | technomancy: I've been wanting to repurpose some go-based dev-ops stuff in Haskell. |
| 18:20 | kristof | bitemyapp: I thought about something |
| 18:20 | bitemyapp | 4.374956 ms (vec l), 4.399963 ms (apply vector l) |
| 18:20 | bitemyapp | welp. |
| 18:20 | kristof | bitemyapp: I decided that type systems are not just for correctness or mini-proofing but most importantly are a rich way to describe the world |
| 18:21 | bitemyapp | kristof: a rich way to describe code and what it should look like, but from a higher order. |
| 18:21 | bitemyapp | kristof: (ala Theorems For Free!) |
| 18:21 | kristof | bitemyapp: I'm thinking more in terms of data-structures |
| 18:22 | bitemyapp | kristof: that too. We could discuss the categorical nature of product and sum types. |
| 18:22 | bitemyapp | kristof: they're categorical duals of each other :) |
| 18:22 | kristof | I've only ever understood product types, not sum types |
| 18:22 | bitemyapp | kristof: are you familiar with Lenses? |
| 18:22 | kristof | nein |
| 18:22 | bitemyapp | okay, we'll put that off until you're comfy with product and sum types. |
| 18:24 | bitemyapp | kristof: I'm about to go into a meeting, but I want to leave you with something before I go: http://ncatlab.org/nlab/show/product http://ncatlab.org/nlab/show/sum+type when you draw a category graph |
| 18:24 | bitemyapp | kristof: categorical duals are, put in a facile way, inversions of each other by flipping the arrows around. |
| 18:24 | bitemyapp | kristof: so a product type has a C with arrows from C to A and B, where a sum type has an A and a B with arrows pointing from each to C |
| 18:25 | bitemyapp | kristof: http://en.wikipedia.org/wiki/Coproduct |
| 18:25 | bitemyapp | kristof: sum types are basically just algebraic data types. "this or this or that" |
| 18:26 | bitemyapp | kristof: product types contain multiple things that can be obtained via a function. Sum types can be obtained *FROM* multiple things via a function. |
| 18:26 | justin_smith | https://www.refheap.com/23800 <- into is more than twice as fast as the others, which are about equivalent (reposting in proper channel) |
| 18:26 | kristof | bitemyapp: I didn't realize that tagged unions and sum types were the same thing, sorry |
| 18:26 | bitemyapp | kristof: yep! |
| 18:26 | kristof | neat |
| 18:27 | bitemyapp | kristof: oh very. |
| 18:27 | bitemyapp | kristof: when kmett was working on lenses (like jquery but for typed data), he realized there was a categorical dual, and thus prisms were born! And they're very useful! |
| 18:27 | kristof | bitemyapp: I'm confused. What would the C represent in the sum type? |
| 18:27 | bitemyapp | kristof: the best of both worlds when using those libraries, as far as typed/untyped goes :D |
| 18:27 | kristof | The "entire" tagged union? |
| 18:27 | bitemyapp | kristof: yes. |
| 18:27 | kristof | Oh, everything makes sense now :P |
| 18:27 | technomancy | justin_smith: wow; geez |
| 18:28 | technomancy | patch to get vec to use into, I guess? |
| 18:28 | bitemyapp | kristof: the member constructors of the tagged union are the functions/arrows/morphisms pointing to C. |
| 18:28 | kristof | gotcha |
| 18:28 | kristof | I know basic category theory from my abstract algebra class |
| 18:28 | bitemyapp | kristof: if you're in the bay area, you should come to the type theory meetups! |
| 18:29 | kristof | I'm a couple of hours away |
| 18:29 | bitemyapp | anyway, I have to go, but I'll be around. leave me messages on my query if you like. |
| 18:29 | kristof | Alright, nice talking to you :) |
| 18:29 | mikerod | bitemyapp: thank you for that empirical input |
| 18:29 | bitemyapp | mikerod: justin's was better. |
| 18:29 | mikerod | bitemyapp: was gone a minute, didn't see there was more examples out there |
| 18:30 | mikerod | ah, good analysis |
| 18:31 | bitemyapp | mikerod: and amalloy |
| 18:31 | bitemyapp | although that change didn't change the outcome. |
| 18:32 | mikerod | well, then thank you justin_smith for the example :) and amalloy and technomancy for that matter |
| 18:49 | justin_smith | mikerod: np |
| 18:49 | justin_smith | technomancy: yeah, really anything in core building an associative collection should be using transients at this point - or dispatching to into which uses them |
| 18:50 | justin_smith | unless transients are still somehow unproven |
| 18:53 | technomancy | nah, with into using them I can't see that being the case |
| 18:53 | technomancy | there were a bunch of bugs early on, but that was like 1.2 days |
| 18:53 | mikerod | transients all the way down |
| 18:55 | adhollander | ls |
| 18:55 | lazybot | boot media proc src srv sys |
| 19:03 | arrdem | bitemyapp: well, I decided to get lazy on multi-PC sync. Lets see what Dropbox does with all of ~/doc... |
| 19:51 | bitemyapp | arrdem: just spent 30 minutes explaining Haskell to a coworker I kidnapped. |
| 19:52 | bitemyapp | arrdem: I don't use dropbox. |
| 19:53 | bitemyapp | arrdem: I'm always surprised when people use dropbox, then I remember normal people have things like "paperwork" and "documents" |
| 19:56 | Raynes | gfredericks: <3 |
| 19:57 | bitemyapp | Raynes: zomg hare |
| 19:57 | Cr8 | bitemyapp's corner of the office is the Haskell Dungeon |
| 19:59 | bitemyapp | Cr8: it's an open space office. |
| 19:59 | bitemyapp | Cr8: I'm not in the corner, I'm in a main thoroughfare. I'm the troll taking his toll. |
| 19:59 | Cr8 | I'm imagining a sort of blanket fort |
| 20:00 | Cr8 | a Haskell Troll Bridge works too |
| 20:01 | bitemyapp | Cr8: IT guy has tried really hard to get me to make it into a blanket fort. |
| 20:01 | bitemyapp | Cr8: he wanted me to use camo netting |
| 20:01 | Cr8 | should add you to the office-themed text adventure I made a long time ago |
| 20:01 | bitemyapp | Cr8: throwing against Sphinx-like category theory questions? |
| 20:01 | bitemyapp | Cr8: WHAT IS THE CATEGORICAL DUAL OF PRODUCT? |
| 20:01 | bitemyapp | throwing saves* |
| 20:02 | Cr8 | > The third floor is an open-plan office. This is unfortunate, as the Haskell Troll is able to spot you as you leave the staircase. |
| 20:02 | Raynes | bitemyapp: I use dropbox mostly for pictures. |
| 20:02 | Raynes | bitemyapp: My screenshots, for example, automatically go there. |
| 20:02 | bitemyapp | Raynes: I'm buddhist about my data. |
| 20:02 | bitemyapp | much easier. |
| 20:03 | Cr8 | my photos go to dropbox |
| 20:03 | Cr8 | because the i like the convenience of them just being on my computer by the time i'm arsed to care |
| 20:04 | justin_smith | I like to imagine there is a cobitemyapp on #haskell who brings up clojure at every juncture |
| 20:04 | Cr8 | other than that it's all tax forms |
| 20:04 | technomancy | hehe |
| 20:05 | bitemyapp | justin_smith: I have some converts there, but they're already on the side of justice and morality. |
| 20:06 | justin_smith | so you are suggesting you are your own categorical dual? |
| 20:06 | bitemyapp | No. |
| 20:06 | bitemyapp | justin_smith: I don't advocate Clojure there, just not writing terrible code. |
| 20:06 | bitemyapp | same as here. |
| 20:06 | bitemyapp | I liked this quote from that channel, "<paper_ziggurat> clojure has a job market?" |
| 20:08 | bitemyapp | justin_smith: I'm searching the rather thorough Haskell IRC logs, the only nice things said about Clojure so far have been, "well. It's not Scala or Java." |
| 20:08 | justin_smith | heh |
| 20:08 | technomancy | "We have decided... that you are not orcs." |
| 20:09 | bitemyapp | justin_smith: I've got a couple of candidates for the title, but they're pretty weak sauce really :) |
| 20:09 | bitemyapp | technomancy: haha, love that moment. |
| 20:10 | bitemyapp | justin_smith: no wait, found him. monochrom. |
| 20:10 | bitemyapp | justin_smith: that's my dual. |
| 20:10 | bitemyapp | justin_smith: oddly, he's in there but not here. ?_? |
| 20:11 | locks | no point in preaching to the choir, right |
| 20:12 | bitemyapp | locks: well. I'm in #haskell to learn. |
| 20:12 | bitemyapp | locks: he must know everything about Clojure already. |
| 20:12 | Cr8 | <monochrom> I don't know clojure. I cannot compare. |
| 20:13 | bitemyapp | Cr8: nuts. older quote had him saying Clojure is better than Haskell. |
| 20:13 | bitemyapp | justin_smith: n/m the |
| 20:13 | bitemyapp | then* |
| 20:13 | Cr8 | that was 2013-12-26 |
| 20:13 | bitemyapp | Cr8: well. |
| 20:13 | bitemyapp | I dunno. |
| 20:15 | locks | maybe they were just being humble |
| 20:15 | locks | the whole the more you know, the more you know you don’t know |
| 20:15 | Janiczek | Hi, is there some kind of "map" or "doseq" for core.logic goals? I'm puzzled on how to do this: https://gist.github.com/Janiczek/8429048 |
| 20:17 | rsenior | bitemyapp: have you given much though to database migrations on a single datomic instance for brambling? |
| 20:17 | Janiczek | I see how that probably could be solved by some recursive goal, slicing the head of the map, converting it into the permuteo goal and then calling itself on the rest ... but maybe there's a better way? |
| 20:18 | rsenior | bitemyapp: or maybe that's what you mean with differential support? |
| 20:18 | bitemyapp | rsenior: single datomic instance? |
| 20:18 | bitemyapp | rsenior: that is almost certainly not what I mean by differential migrations. |
| 20:19 | bitemyapp | rsenior: differential migrations could also be called incremental or "catch-up" migrations. |
| 20:19 | bitemyapp | rsenior: they catch-up the 'difference' between the origin and the target incrementally. |
| 20:19 | bitemyapp | rsenior: origin and target can be on the same Datomic instance. |
| 20:20 | rsenior | bitemyapp: ah, maybe that's what I was missing |
| 20:20 | bitemyapp | rsenior: I cannot change the way Datomic works and I do not feel comfortable reaching into the internals when the jars are obfuscated. |
| 20:21 | bitemyapp | rsenior: as much as I'd like things to be some "other way", I really think the worrying over migrations is unmerited. Very few people have enough data that having a temporary copy of the database on disk is going to hurt anything. |
| 20:21 | rsenior | bitemyapp: so last week's version of my schema had a :foo/bar attribute, this week I want to add :foo/baz |
| 20:21 | bitemyapp | rsenior: if you're adding things you don't need brambling. |
| 20:22 | rsenior | bitemyapp: ok changing :-), I imagine I will do a fair bit of that, sounds like I just use origin and target as the same with brambling? |
| 20:22 | bitemyapp | rsenior: perhaps you mean something like renaming the attribute from bar to baz? |
| 20:22 | rsenior | bitemyapp: exactly |
| 20:22 | bitemyapp | rsenior: you write a migration that renames datoms with the attribute ident to the new one. |
| 20:22 | bitemyapp | rsenior: it copies all the data over, filtered through your migration, bada bing. |
| 20:23 | bitemyapp | rsenior: archive a backup of the origin, then delete from your database if you like. |
| 20:23 | bitemyapp | maybe brambling finally gets a user? |
| 20:24 | rsenior | bitemyapp: heh, last datomic app I worked on, we rolled our own (closed source, no longer working for them), now working on another app and it would be nice to build on something |
| 20:24 | bitemyapp | rsenior: plz do. |
| 20:24 | bitemyapp | rsenior: and if you reverse engineer the godforsaken jars so we can add in-place |
| 20:24 | bitemyapp | migrations, let me know. |
| 20:24 | bitemyapp | ;) |
| 20:25 | rsenior | bitemyapp: so the model is, create a new db, migrate datoms, drop old db, move back? |
| 20:25 | bitemyapp | rsenior: yeah and differential migrations are a way of narrowing the maintenance to something possibly programmatic. |
| 20:26 | bitemyapp | that's a discussion I'm a whiskey bottle away from having though. |
| 20:26 | bitemyapp | rsenior: look at it this way, the namespace is "brambling.moves.ya.bits.*"...pretty indicative. |
| 20:27 | rsenior | seems like it would be a big deal for bigger dbs, mine won't be |
| 20:27 | bitemyapp | rsenior: Right. I think it could be made manageable for larger dbs. |
| 20:27 | bitemyapp | catch-up migrations can make the 'shutdown and flip over' window very small with no lost data or race conditions. |
| 20:28 | bitemyapp | but that option only really exists because the data is an immutable log |
| 20:28 | bitemyapp | so, Hail Hickey for that one. |
| 20:29 | rsenior | bitemyapp: what would be the difficulty for user defined differential? |
| 20:29 | bitemyapp | rsenior: it wouldn't have to be user defined, purely automagic. |
| 20:29 | bitemyapp | rsenior: uhhh...partial migrations that understand when they're just catching up the history of the tx log with the same migration that got the ball rolling to begin with. |
| 20:30 | bitemyapp | rsenior: figured out the set point in the tx log that the last migration stopped at and picked things up from there. |
| 20:30 | bitemyapp | ideal being to continually/incrementally reduce origin/target delta until a "lockdown" of the origin would take a second or two. |
| 20:30 | bitemyapp | or at least a minute or something. you'd propagate the new dburi to the peers. |
| 20:30 | bitemyapp | cache warming could be an issue. |
| 20:31 | bitemyapp | yadda yadda. |
| 20:31 | rsenior | bitemyapp: but that still requires manual intervention of creating a new db, switching over etc |
| 20:31 | rsenior | I'm thinking about how I use relational db migrations |
| 20:31 | rsenior | I have a list of "revisions" of the db |
| 20:31 | bitemyapp | well that part does |
| 20:31 | rsenior | store that version info in the db |
| 20:31 | bitemyapp | implementing the differential migrations doesn't |
| 20:32 | bitemyapp | and it could still be automated modulo peer configuration. |
| 20:32 | bitemyapp | rsenior: people do that sort of thing "in the small" with Datomic in production, I think it's complete and utter gobshite. |
| 20:32 | rsenior | on startup, hey, I'm on v2, I need to be on v5, so I execute the v3, then v4, then v5 migrations |
| 20:32 | bitemyapp | rsenior: I do not want my time-dimension queries to get fucked by fields getting shuffled around |
| 20:32 | bitemyapp | meaning my queries cannot cross migration barriers. |
| 20:32 | bitemyapp | nuts to that. I'd rather use brambling. |
| 20:33 | bitemyapp | it's a simple fold. Really. |
| 20:33 | rsenior | bitemyapp: not following, how is creating a new db change that? |
| 20:33 | rsenior | that is drops the old data? |
| 20:34 | bitemyapp | I'm talking about when people want to change a data type |
| 20:34 | bitemyapp | instead of actually migrating the data |
| 20:34 | rsenior | ok, walk me through that |
| 20:34 | bitemyapp | they add a "new" attribute |
| 20:34 | bitemyapp | :myCar = "blah" gets changed to an enum or something |
| 20:34 | rsenior | got it |
| 20:34 | bitemyapp | the problem is when you add that new attribute to the schema and flip the application code over |
| 20:34 | bitemyapp | you have a breakpoint in your history that your queries cannot traverse |
| 20:34 | bitemyapp | so you have to maintain two versions of your queries. |
| 20:35 | bitemyapp | Bleh. |
| 20:35 | rsenior | right, unless you write a migration |
| 20:35 | bitemyapp | You write a migration and handling mapping your stringly values to an enum, and everything's kosher. All the history is intact and consistent. |
| 20:35 | bitemyapp | handle* |
| 20:35 | rsenior | ok, so a list of schema migrations, with a possible fn that does data migrations? |
| 20:36 | rsenior | then I don't need another db? |
| 20:36 | bitemyapp | rsenior: have you looked at the code in Brambling's readme? |
| 20:36 | rsenior | I did |
| 20:36 | bitemyapp | okay. That |
| 20:36 | bitemyapp | That's all I would ever advise doing. |
| 20:36 | bitemyapp | (origin -> target) - translate the data. |
| 20:36 | bitemyapp | whether you agree or not is your maintenance burden. |
| 20:37 | bitemyapp | Brambling is basically all I have to say for the time being about Datomic migrations. I literally haven't heard a single other thing (from Cognitect or otherwise) that I'd advise anybody to do. |
| 20:38 | rsenior | ok, I understand, your opinion is it's best to always migrate to a new db, that's fair |
| 20:38 | rsenior | I don't have an opinion to the contrary, just thinking about what would be involved in a new "deploy" of my app |
| 20:39 | bitemyapp | rsenior: easiest thing is shut the app down, migrate the database, archive, delete, repoint, start. |
| 20:39 | bitemyapp | or just leave the old one in place if the storage is trivial. |
| 20:39 | bitemyapp | then you can run differential functional tests to reproduce possible problems arising from migrations. |
| 20:39 | bitemyapp | which is another reason I'm not that keen on mutative migrations |
| 20:40 | bitemyapp | if you don't want to ever shut your app down, then start queuing your transactions and queries or never change your data. |
| 20:41 | rsenior | bitemyapp: I'll give it a try, I'm still in the early stages, so it'll be more test-like, but I'll try out one of those cycles |
| 20:41 | bitemyapp | I would kill for some youtube vitess/vitocc-esque middleware for Datomic. |
| 20:42 | bitemyapp | rsenior: let me know if it eats your data and eggs your mother's house. |
| 20:42 | thedarkside | Beginner. How do you guys go about remembering the 591 functions in clojure.core? |
| 20:42 | bitemyapp | thedarkside: writing code |
| 20:42 | bitemyapp | thedarkside: using clojuredocs.org |
| 20:43 | thedarkside | That's worse than PHP. Well, almost. |
| 20:43 | bitemyapp | thedarkside: too bad there's no hoogle for Clojure :( |
| 20:43 | bitemyapp | "worse than PHP" hahahahahaha |
| 20:43 | thedarkside | I mean memorising them, not looking them up. |
| 20:44 | thedarkside | You can't use a function you don't know exists or what it does. |
| 20:44 | bitemyapp | thedarkside: http://pic.dhe.ibm.com/infocenter/wsmashin/v1r1m1/index.jsp?topic=/zero.infocenter.singlebook.doc/using/zero.php/CoreFunctions.html |
| 20:44 | bitemyapp | arrdem: what's the find command? |
| 20:45 | thedarkside | bitemyapp: I was only joking. |
| 20:45 | bitemyapp | $findfn 1 2 |
| 20:45 | thedarkside | No, I'm not trolling. What memorisation techniques do you use? |
| 20:45 | lazybot | [clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc'] |
| 20:45 | bitemyapp | thedarkside: ding ding ^^ |
| 20:46 | bitemyapp | $findfn [[1] [2]] [1 2] |
| 20:46 | lazybot | [clojure.core/flatten] |
| 20:46 | bitemyapp | thedarkside: again ^^ |
| 20:46 | bitemyapp | thedarkside: I don't memorize things. If I'm using Hoogle I search by type. If I'm using Clojure I use findfn or I simply remember because I've been using Clojure a lot for some time now. |
| 20:46 | bitemyapp | I do have memorization techniques, I don't apply them to any of this. |
| 20:47 | hyPiRion | thedarkside: Using a decent repl with autocompletion in conjunction with the clojure cheatsheet is nice |
| 20:47 | thedarkside | To get the full benefit of Clojure surely they have to be internalised at some point? |
| 20:48 | hyPiRion | It's generally about applying them which makes me remember them. That, or the fact that some of them makes no sense |
| 20:48 | bitemyapp | thedarkside: sorta not really? hyPiRion's suggestion is solid. |
| 20:48 | bitemyapp | thedarkside: the benefits of FP don't have a lot to do with core libraries, although some are better designed than others. Haskell > Clojure > Scala |
| 21:08 | hiredman | map/mapcat/reduce/assoc/dissoc/update-in/inc do you really use anything else? |
| 21:09 | xuser | partial, comp, repeteadly |
| 21:13 | hyPiRion | for, into |
| 21:19 | gfredericks | Raynes: <3? |
| 21:19 | gfredericks | I don't mind a <3 or two but it seemed a bit unprovoked |
| 21:20 | seangrove | ,(doc seq?) |
| 21:20 | clojurebot | "([x]); Return true if x implements ISeq" |
| 21:21 | gfredericks | ,(seq? nil) |
| 21:21 | clojurebot | false |
| 21:22 | arrdem | bitemyapp: oh. lol. I thought you were talking about POSIX find |
| 21:23 | arrdem | $findfn is part of the clojurebot black magic... |
| 21:24 | arrdem | also $findfn doesn't come with the function warnings... such as how (flatten) is rarely actually what you want... |
| 21:35 | logic_prog | clojure is awesome |
| 21:35 | logic_prog | anyone disagree? |
| 21:35 | hyPiRion | the best channel to ask that question, I guess. |
| 21:35 | logic_prog | completely unbiasaed |
| 21:35 | arrdem | hyPiRion: least biased to be sure... |
| 21:36 | logic_prog | highest IQ people too |
| 21:36 | logic_prog | the only possible thing that could convince me that #clojure has gotten smarter |
| 21:36 | logic_prog | would be if it granted me ops |
| 21:37 | arrdem | logic_prog: .... you realize that in the five year history of this chan there have only ever been two ops, right? |
| 21:37 | arrdem | three if you count chanserv |
| 21:37 | logic_prog | arrdem: only two? |
| 21:37 | hyPiRion | arrdem: four then? rhickey, chouser and technomancy? |
| 21:37 | arrdem | hyPiRion: oh I didn't know chouser had op |
| 21:37 | logic_prog | rhickey (clojure_ and technomancy (lein) I know about |
| 21:37 | logic_prog | what has chouser done? |
| 21:38 | arrdem | yeah this isn't #atx2600 where everyone gets op every few months since our op management system is that anyone misbehaving gets smacked at the next meetup. |
| 21:46 | bitemyapp | arrdem: findfn is lazybot. |
| 21:46 | bitemyapp | logic_prog: I can find a smarter channel |
| 21:47 | bitemyapp | no the answer isn't #haskell |
| 21:47 | bitemyapp | that said, there are still a lot of smart and very awesome people. |
| 21:47 | bitemyapp | it's my favorite channel still. |
| 21:48 | bitemyapp | although Cale is turning the tide for #haskell on that front. |
| 21:48 | bitemyapp | arrdem: still on electronic leave? |
| 21:49 | arrdem | bitemyapp: up to date on my homework, I can do a game of two but I'm calling it by 11 Central |
| 21:50 | bitemyapp | arrdem: deal. |
| 21:53 | bitemyapp | arrdem: I'm in your mumble, not the minetexas one. |
| 22:04 | Bronsa | , |
| 22:04 | Bronsa | (loop [x (Integer. 1)] (if (number? x) (recur "foo") (.hashCode x)) |
| 22:04 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 22:04 | Bronsa | ,(loop [x (Integer. 1)] (if (number? x) (recur "foo") (.hashCode x)) |
| 22:04 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 22:05 | Bronsa | ,(loop [x (Integer. 1)] (if (number? x) (recur "foo") (.hashCode x))) |
| 22:05 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer> |
| 22:05 | Bronsa | ,(loop [x 1] (if (number? x) (recur "foo") (.hashCode x))) |
| 22:05 | clojurebot | 101574 |
| 22:05 | Bronsa | :( |
| 22:07 | logic_prog | does cljs support find-ns, create-ns, ns-resolve, var-get, and intern ? if so, what namesapce is it in? |
| 22:10 | maravillas | logic_prog: searching the repo suggests none of those are implemented yet |
| 22:12 | seancorfield | maravillas: presumably because cljs does not use the Var indirection that clj uses... |
| 22:13 | logic_prog | thus, what are the cljs equivalent for namespaces? |
| 22:15 | seancorfield | namespaces compile down into js objects i think |
| 22:19 | quizdr | if I enter (find-doc #"\?$") at the REPL, what exactly is the argument there, starting with the #? Because I can just use a string for (find-doc "reduce"), for example, with no # character |
| 22:20 | seancorfield | #"..." is a regex in clojure |
| 22:20 | seancorfield | "..." is a string |
| 22:20 | seancorfield | ,(source find-doc) |
| 22:20 | clojurebot | Source not found\n |
| 22:20 | seancorfield | bah! |
| 22:21 | quizdr | ah, i get it |
| 22:34 | seancorfield | ,(doc find-doc) |
| 22:34 | clojurebot | "([re-string-or-pattern]); Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern" |
| 22:36 | bendb | ,(keys (ns-publics *ns*)) |
| 22:36 | clojurebot | nil |
| 22:37 | seancorfield | according to the source for find-doc, it always treats the argument as a regex pattern, by calling re-pattern on it |
| 22:37 | seancorfield | ,(doc re-pattern) |
| 22:37 | clojurebot | "([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher." |
| 23:08 | ddellacosta | is there a way to specify a set of defaults for all builds in lein-cljsbuild? |
| 23:10 | alew | technomancy: are the instructions for new relic clojure support up to date? I'm not getting any results on the new relic dashboard but it is registering the app was deployed |
| 23:11 | quizdr | since all vars are immutable, it is possible to return a closure over a local var that increments it each time the closure fn is called? similar to this CL: (defparameter *lfn* |
| 23:11 | quizdr | (let ((count 0)) |
| 23:11 | quizdr | #'(lambda () |
| 23:11 | quizdr | (incf count)))) |
| 23:12 | quizdr | every time (funcall *lfn*) is called a new incremented number is returned |
| 23:12 | quizdr | when I try this in Clojure, I get the error that the local var is immutable |
| 23:14 | bja | (let [counter (atom 0)] #(swap! counter inc)) |
| 23:14 | quizdr | ah, so i'd use an atom as a local |
| 23:15 | bja | you could also define the var as dynamic I guess |
| 23:15 | bja | but I don't think anyone would recommend that you do that |
| 23:15 | S11001001 | hope not |
| 23:17 | quizdr | since clojure.string/split returns a non-lazy vector, if I was calling this in a very large amount of text and wanted a lazy result, would I simply wrap it in lazy-seq? |
| 23:19 | bja | quizdr, probably something like (re-seq #"\w+" ...) |
| 23:21 | quizdr | looks like re-seq uses lazy-seq in its implementatino |
| 23:24 | dnolen | a guide to the ClojureScript analyzer/compiler http://swannodette.github.io/2014/01/14/clojurescript-analysis--compilation/ |
| 23:26 | ddellacosta | getting java.lang.OutOfMemoryError: Java heap space with source maps, but compiles fine without source maps. Not sure how to resolve this--anyone have any suggestions? |
| 23:27 | ddellacosta | dnolen: very cool, look forward to digging into it! |
| 23:27 | dnolen | ddellacosta: increase memory to the JVM with :jvm-opts |
| 23:27 | dnolen | ^{:replace true} is important |
| 23:28 | ddellacosta | dnolen: okay, I've already bumped it to 1GB and it still didn't work, will bump it up some more. Will look into ^{:replace true}, thanks for the tips! |
| 23:28 | dnolen | ddellacosta: :replace is important otherwise won't work |
| 23:28 | ddellacosta | dnolen: ah, okay |
| 23:43 | rubber-duck | anyone knows why I'm getting "clojure.lang.ExceptionInfo: No implementation of method: :emit-instruction of protocol: #'cljs.core.async.impl.ioc-macros/IEmittableInstruction found for class: cljs.core.async.impl.ioc_macros.Jmp" in core.async go block ? |
| 23:43 | rubber-duck | here is a gist :https://gist.github.com/anonymous/8430856 |
| 23:43 | rubber-duck | it's clojurescript btw |
| 23:45 | dnolen | rubber-duck: might be a legit core.async bug I would make a minimal case |
| 23:46 | rubber-duck | dnolen, does the code at least look legit ? |
| 23:46 | rubber-duck | I'm still new to clojure I could be missing something obvious :) |
| 23:50 | egghead | is it related to <!remote on line 17? |
| 23:51 | rubber-duck | <!remote is just a macro that expands to (result (<! (rpc ...))) |