2013-02-21
| 00:12 | muhoo | oh yeah.... i've seen this before ,but forgot wtf it was about: "{"cn":"tOsgmP16Sh","tp":null,"osh":null,"ppu":"http://localhost:8080/robots.txt","lpu":"http://localhost:9000/robots.txt"}" |
| 00:29 | technomancy | callenbot: in the case of conkeror it's not to much "write an extension" as it is "dump a bunch of JS into an init file" |
| 00:29 | technomancy | since conkeror doesn't make the useless distinction between user extensions and the browser itself |
| 00:42 | devn | oh, if conkeror didn't suck... |
| 00:42 | technomancy | all software sucks |
| 00:43 | technomancy | it's a unit vector; if you're lucky you can find some that sucks in a direction you find less disagreeable |
| 00:43 | devn | technomancy: that's true, but the age-old editor holy war still dictates that we compare all things emacs to all things vim |
| 00:44 | devn | vimperator and the like are maintained |
| 00:44 | technomancy | actually gecko vs chrome has interesting parallels to emacs vs vim |
| 00:44 | devn | conkeror, if you join the irc channel and ask about versions of xulrunner -- they'll tell you something like: "uh, good luck. you could try X.Y.Z and see if that works..." |
| 00:44 | technomancy | gecko does the right thing and builds a runtime, then implements the application using the runtime, while chrome screws it up and hard-codes everything in C++ |
| 00:46 | devn | conkeror also may as well just be vimperator in a whole mess of ways. a good number of the chords that are emacs-like act basically like: leader + char + char + char +char |
| 00:46 | devn | might as well just use vimperator at that point |
| 00:46 | technomancy | some of the focus commands are weird |
| 00:47 | technomancy | the only thing that's ever really bothered me is the fact that github steals certain bindings in a way that I've never figured out how to override |
| 00:47 | devn | *nod* |
| 00:47 | devn | I gave up on conkeror awhile ago just because upgrading seemed like an exercise in futility |
| 00:47 | technomancy | pretty minor pain point compared to reprogramming my brain stem |
| 00:47 | devn | again, maintainership is the real problem |
| 00:47 | devn | the wiki is badly out of date |
| 00:47 | technomancy | I dunno... at some point it's more or less done. |
| 00:48 | devn | technomancy: the instructions on the wiki are flat out wrong for OSX |
| 00:48 | technomancy | it's so far ahead of anything else I've tried that it doesn't need any actual further development |
| 00:48 | devn | and have been for almost a year |
| 00:48 | technomancy | that's horrible... it's a wiki. |
| 00:48 | technomancy | don't OS X users actually bother to fix it? |
| 00:49 | devn | i guess it's mostly anecdotal from my point of view, but my experience has been that people in the community quietly acknowledge that no one cares about it |
| 00:49 | devn | and by community i mean #conkeror |
| 00:49 | technomancy | oh, I didn't know it had its own channel |
| 00:49 | technomancy | I've gotten lots of help in #emacs |
| 00:50 | devn | technomancy: do you actually use it as your primary? |
| 00:50 | devn | (browser i mean) |
| 00:50 | technomancy | yeah, I use it for everything except sensitive work stuff that runs under a separate unix user |
| 00:50 | devn | you're a better man than me, |
| 00:50 | technomancy | but I don't do any web development |
| 00:50 | devn | ah! |
| 00:50 | devn | yeah, chrome won |
| 00:51 | devn | also, the latest builds of firefox. there's cool stuff in there. stuff that i had 0 access to in conkeror. |
| 00:51 | technomancy | luckily it fits my requirements perfectly, except for the whole "you have to write javascript to hack it" part |
| 01:00 | muhoo | solution found: https://www.refheap.com/paste/11583 |
| 01:00 | muhoo | neermind piggieback and nrepl, doesn't work. regular cljsbuild repl-listen *does* work, so, yay |
| 01:15 | vurma | A little question here.. Iv been writing most of my code in C, and for its speed, i really think its the way to go for what im working on. |
| 01:16 | vurma | So, is there any way, besides clojurec or going through Java that i can interface clojure with C ? |
| 01:19 | vurma | I guess i could go with swig on that as well.. |
| 01:19 | vurma | Ideas? |
| 01:29 | Sgeo | vurma, Jnaerator? |
| 01:33 | vurma | Sgeo, how did i manage not to run into that one? |
| 01:33 | vurma | Thanks a bunch :3 |
| 01:33 | vurma | (munch munch) |
| 01:33 | Sgeo | you're welcome |
| 01:38 | nightfly | \ |
| 01:39 | vurma | Sgeo, i was thinking about going with swig first, but i dont have any experience with how hard i would be to use it for larger projects (the native compiling process and all that). |
| 01:40 | nightfly | \\\\\\\\\\\\\\\\\\\\\\ |
| 01:40 | nightfly | sorry... |
| 01:40 | ivan | cat owner detected |
| 01:56 | wei_ | is there a good way to splice items conditionally into a list? e.g. [1 (when true *[2 3]) 4] => [1 2 3 4] |
| 02:03 | amalloy | &`[1 ~@(when true [2 3]) 4] |
| 02:03 | lazybot | ⇒ [1 2 3 4] |
| 02:04 | wei_ | oh! awesome |
| 02:10 | wei_ | &`[1 ~@(when false [2 3]) 4] |
| 02:10 | lazybot | ⇒ [1 4] |
| 02:10 | wei_ | does it work in clojurescript too? |
| 02:16 | amalloy | try it and see |
| 02:22 | devn | Javellin is really cool |
| 02:22 | devn | "Spreadsheet-like programming" is such a great way to explain FRP |
| 02:23 | devn | Javelin* |
| 02:23 | devn | https://github.com/tailrecursion/javelin |
| 02:23 | piranha | devn: indeed it's a good analogy! :) |
| 02:24 | devn | btw, is anyone working up an rxjava clojure wrapper? |
| 02:25 | devn | nevermind. of course daveray beat me. |
| 02:28 | muhoo | frp? |
| 02:28 | clojurebot | FRP is functional reactive programming, or maybe fiberglass reinforced plastic |
| 02:30 | muhoo | event.cljs, net.cljs, and repl.cljs are either brilliant or bizarre or both. i think i have a week of reading up on google closure xhr to figure out how it all works. |
| 02:31 | piranha | devn: but then having no eventstreams, what's the best way of handling clicks and other instant user input? Still trying to figure this out... |
| 02:32 | piranha | I should probably ask alandipert, but he's likely to be in so different timezone that it would be hard to catch him :) |
| 02:32 | alandipert | piranha: sup! |
| 02:33 | piranha | alandipert: oh wow :) so the question is how do you plan to handle clicks and all that with javelin |
| 02:33 | pppaul | & *[1] |
| 02:33 | lazybot | ⇒ #<core$_STAR_ clojure.core$_STAR_@1234ce5> |
| 02:34 | piranha | alandipert: I was playing with Flapjax and did all that by having behavior for a whole form which contained something like {:submit false}, which was becoming true for a single animation frame on click :)) not sure that's the best way though |
| 02:34 | alandipert | piranha: wb! have you seen the demos? https://github.com/tailrecursion/javelin-demos |
| 02:34 | piranha | argh, my connection is not that good |
| 02:34 | alandipert | piranha: that's the way |
| 02:34 | piranha | ah cool! :) |
| 02:34 | alandipert | piranha: part of the javelin worldview is that event streams are a lie, and you should always work with values |
| 02:35 | alandipert | jamming events into concrete values ASAP so you can write code in terms of values instead of streams |
| 02:35 | piranha | this is very good, this means I'm not a heretic )) |
| 02:35 | alandipert | no we both are ;-) |
| 02:35 | piranha | I was just arguing with colleagues about that a month or so ago |
| 02:35 | piranha | well two heretics make a sect, which good enough for me |
| 02:36 | alandipert | lol |
| 02:36 | piranha | alandipert: thank you for the library though! It's much nicer to use in CLJS than Flapjax :) |
| 02:36 | alandipert | piranha: thank you! don't hesitate to ping w/ questions |
| 02:37 | alandipert | piranha: another helpful idea might be that at any given time, the page has one state |
| 02:38 | alandipert | and you want to represent that state w/ a minimum # of cells that take raw events, and model the page state beyond that "backbone" as formulas |
| 02:39 | alandipert | piranha: anyway i retreat to my timezone, thanks again for compliments and good luck. would love to see whatever you come up with |
| 02:50 | callenbot | yogthos: just ignore him |
| 02:50 | callenbot | yogthos: maybe he'll go away |
| 02:50 | callenbot | I think he's deranged. |
| 02:58 | Raynes | xeqi: Was that you that haxxored lazybot earlier? |
| 02:58 | Raynes | Maybe TimMc? |
| 02:58 | Raynes | Probably xeqi, since I said he should feel bad. |
| 02:58 | Raynes | :p |
| 04:09 | augustl | what's the best way to use lein-ring without a singleton handler that's created when the file compiles? |
| 04:09 | augustl | I want to pass a function or something, so that the handler isn't created until lein ring actually needs it |
| 04:10 | augustl | I do side effects such as reading config files in order to create the handler, so I would prefer that to be lazy so it's possible to compile the code without having config files for ring available :) |
| 04:11 | hiredman | https://github.com/weavejester/lein-ring/issues/53 |
| 04:21 | clgv | Is it somehow possible to get the output of `pr` pretty-printed? |
| 04:22 | amalloy | $google clojure pretty print |
| 04:22 | clgv | that would be pretty useful for serialization of config files |
| 04:22 | lazybot | [Pretty print in Clojure - Stack Overflow] http://stackoverflow.com/questions/295458/pretty-print-in-clojure |
| 04:23 | clgv | amalloy: well normal clojure pprint does not really serialize. it wont handle records and such correctly |
| 04:24 | amalloy | and if what you care about is serializing, why would you bother to pprint? a program is writing to its own config file, but you expect humans to also modify it from time to time? |
| 04:24 | clgv | amalloy: exactly |
| 04:25 | amalloy | i'd just tell the humans to paste the dang thing into emacs, personally |
| 04:26 | clgv | amalloy: thats pretty complicated then, since usually those configs are on remote machines. so copying here and back again would be necessary |
| 04:26 | amalloy | $google ssh tramp emacs |
| 04:26 | lazybot | [EmacsWiki: Tramp Mode] http://emacswiki.org/emacs/TrampMode |
| 04:27 | amalloy | i mean, what you're asking for is not unreasonable, but it doesn't exist. as far as i know, it would not be easy to add that feature to either pprint or pr |
| 05:55 | clgv | amalloy: I'd like to have that addition but I do not know who else does ;) |
| 05:56 | marcellus1 | is there a recent guide to getting started in incanter with all the project.clj deps listed? |
| 05:57 | clgv | marcellus1: what do you want to do? if you want all incanter libs, just add the single incanter dep |
| 05:58 | clgv | marcellus1: [incanter "1.4.1"] will draw all incanter libs in your project |
| 05:58 | marcellus1 | clgv: awesome that's what i was looking for thanks! |
| 05:58 | clgv | I hope I found the most recent^^ |
| 05:59 | marcellus1 | yep looks like it should be |
| 06:00 | thheller | ,[1 2 (comment 3) 4] |
| 06:00 | clojurebot | [1 2 nil 4] |
| 06:00 | thheller | should that be [1 2 4]? :P |
| 06:00 | clgv | ,[1 2 #_3 4] |
| 06:00 | clojurebot | [1 2 4] |
| 06:01 | thheller | ah thx |
| 06:01 | clgv | thheller: no. `comment` is a macro that expands to nil |
| 06:04 | thheller | right, forgot about reader vs macro expansion |
| 06:23 | michaelr525 | hello |
| 08:56 | silasdavis | yogthos: Hello.. luminus' project.clj as a missing closing '}' at :profiles |
| 08:57 | yogthos | silasdavis: I think I fixed that last night |
| 08:57 | yogthos | silasdavis: have you tried the latest template? |
| 09:01 | silasdavis | yogthos: cloned yesterday - yes fixed now :) |
| 09:02 | yogthos | silasdavis: what happened was I accepted a pull request to fix a trimming issue, and ended up with off by one when doing a substring on the project :) |
| 09:06 | xeqi | Raynes: it was me |
| 09:28 | clgv | echo you? |
| 09:28 | lazybot | you? |
| 09:28 | clojurebot | YOU WILL LIKE OVERTONE & CLOJURE |
| 09:28 | deg | (just wondering) Why is there no update function, for symmetry with update-in, assoc-in, and assoc? |
| 09:28 | bbloom | deg: deg what would it do? |
| 09:28 | bbloom | ~update |
| 09:28 | clojurebot | No entiendo |
| 09:29 | deg | bbloom: Like update-in, but at the top level. |
| 09:29 | bbloom | (doc update-in) |
| 09:29 | clgv | deg: you are right^^ there is also no dissoc-in and no contains-in? |
| 09:29 | clojurebot | "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created." |
| 09:29 | bbloom | deg: wouldn't (update x f) just be (f x) ? |
| 09:30 | clgv | bbloom: (update {:a 1} :a inc) => {:a 2} |
| 09:30 | deg | clgv: But here, there is the -in method method, but no the simple one. |
| 09:31 | clgv | deg: I just wanted to point out that symmetry was never a goal for these map functions it seems |
| 09:31 | bbloom | clgv: oh, so it updates at the FIRST level? *shrug* (update-in {:a 1} [:a] inc) works precisely the same. |
| 09:31 | clgv | I'd like it better if it was |
| 09:32 | deg | clgv: I guess that just begs my question. Why was symmetry not a goal? As folks learn the language, these assymetries get in the way. |
| 09:32 | clgv | bbloom: well for this reasoning we would not need `assoc` at all since assoc-in does its job as well ;) |
| 09:32 | bbloom | it's also a trivial function to write if you find you need it frequently: (defn update [m k f & args] (assoc m k (apply f (m k) args))) |
| 09:33 | clgv | bbloom: that's nor agument. the point is clojure.core is not symmetric for these two function classes ^^ |
| 09:33 | deg | bbloom: Sure. And, equally, can just wrap an extra pair of braces. But, it's the learning curve that I'm asking about, I guess. |
| 09:35 | hyPiRion | the problem is this: what signature should update have? |
| 09:36 | bbloom | the signature of assoc allows for multiple values to be assoced |
| 09:36 | bbloom | an 'update function couldn't have symmetry with that |
| 09:36 | deg | hyPiRion: [m k f & args], no? |
| 09:36 | bbloom | (doc assoc) |
| 09:36 | clojurebot | "([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)." |
| 09:36 | hyPiRion | (update {:a 1 :b 2} :a inc :b dec) or (update (update {:a 1 :b 2} :a inc) :b dec) |
| 09:37 | deg | (oh, right. my last line was a second too fast.) |
| 09:39 | clgv | hyPiRion: noo.this one [m k f & args], |
| 09:39 | bbloom | also, for dissoc-in, there's a question of what it's behavior should be |
| 09:39 | bbloom | it's been discussed plenty here in IRC, check the logs |
| 09:39 | clgv | bbloom: I had a ticket for it on jira ;) |
| 09:39 | hyPiRion | clgv: the last one, right. |
| 09:40 | clgv | bbloom: but apparently I'd need to create one in core.incubator^^ |
| 09:40 | clgv | I lost motivation then... |
| 09:40 | bbloom | clgv: there is also https://github.com/flatland/useful |
| 09:41 | bbloom | clojure core doesn't just add functions willy nilly on purpose. consider the 'remove function that every lisp has had for lists forever |
| 09:41 | bbloom | it's O(N) so core just doesn't have it |
| 09:41 | bbloom | finger-trees do, however, since they can provide better than O(N) |
| 09:42 | clgv | bbloom: which remove do you mean? there is a ##(doc remove) |
| 09:42 | lazybot | ⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects." |
| 09:42 | bbloom | clgv: sorry, i mean remove-nth |
| 09:42 | clgv | ,(doc drop-nth) |
| 09:42 | clojurebot | Excuse me? |
| 09:42 | bbloom | http://www.lispworks.com/documentation/HyperSpec/Body/f_rm_rm.htm |
| 09:45 | bbloom | a better example is 'insert into a vector at an index |
| 09:46 | bbloom | which is also another symmetry missing from assoc/dissoc |
| 09:46 | clgv | hmm `assoc` is not the best name for the vector case, right |
| 09:46 | bbloom | ,(assoc [:x :y :z] 1 :w) |
| 09:46 | clojurebot | [:x :w :z] |
| 09:46 | bbloom | ,(dissoc [:x :y :z] 1) |
| 09:46 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPersistentMap> |
| 09:46 | bbloom | trying to maintain symmetry is a thing that feels like a good idea, but actually isn't |
| 09:47 | bbloom | most mathematical functions & their inverses aren't entirely bijective |
| 09:47 | bbloom | http://en.wikipedia.org/wiki/Bijection |
| 09:47 | clgv | thats unfortunate indeed since it removes the "map-vector-transparency" assoc provides... |
| 09:47 | bbloom | clgv: unless you're not deleting anything.. :-) |
| 09:48 | bbloom | but even the simplest of functions require absurd caveats to be made bijective |
| 09:48 | bbloom | or to define inverses,r ather |
| 09:48 | clojurebot | Gabh mo leithscéal? |
| 09:48 | bbloom | consider the multiplication operator |
| 09:48 | bbloom | ,(* -5 -5) |
| 09:48 | clojurebot | 25 |
| 09:48 | clgv | yeah but if you really use the transparency you'll delete something sooner or later since maps support it ;) |
| 09:48 | bbloom | ,(Math/sqrt 25) |
| 09:48 | clojurebot | 5.0 |
| 09:49 | bbloom | it's a functional programming language, not a relational one :-) http://en.wikipedia.org/wiki/Relation_(mathematics) |
| 09:49 | clgv | well the symmetry demand I made was for completeness of the api provided and it can be done easily here |
| 09:50 | clgv | bbloom: you dont need to teach me math - I had plenty of it as undergraduate :P |
| 09:50 | deg | bbloom: I'm not following. What is the connection between symmetry and invertability? |
| 09:51 | clgv | deg: good question. I just ignored the invertability argument since it didnt seem to fit ;) |
| 09:51 | bbloom | #(assoc % :x :y) and #(dissoc % :x) are inverse functions, that is the nature of their symmetry.... |
| 09:51 | bbloom | symmetry is a geometric concept, not an algebraic one, so inverses are the closest algebraic idea :-P |
| 09:51 | clgv | bbloom: the current asymmetry is assoc, dissoc <=> assoc-in, update-in ;) |
| 09:52 | clgv | bbloom: thats wron. symmetry is also algebraic. read your link about relations above^^ |
| 09:53 | hyPiRion | assoc and dissoc aren't inverse functions |
| 09:53 | bbloom | clgv: heh, ok fine :-) |
| 09:53 | hyPiRion | (dissoc (assoc x y z) y) -> identity |
| 09:54 | hyPiRion | (assoc (dissoc x y) y z) -> assoc |
| 09:54 | bbloom | hyPiRion: yeah, they aren't bijective :-) |
| 09:54 | hyPiRion | (As far as I understand mathematics) |
| 09:55 | hyPiRion | oh right. |
| 09:55 | bbloom | but the whole point i was trying to make is that if it's not 100% obvious what the quasi-inverse/symentric function should do or how it would do it efficiently, then it's totally OK to not have perfect symmetry |
| 09:58 | clgv | bbloom: well for the discussed case it is very obvious. edge-cases are induced by the existing counterparts |
| 09:59 | clgv | bbloom: for dissoc-in there was discussion whether it should remove empty-maps. looking at assoc-in which creates maps, I'd say it should remove empty maps |
| 10:00 | bbloom | clgv: what do you do about records? |
| 10:01 | clgv | bbloom: regarding what exactly? |
| 10:01 | bbloom | i guess you wouldn't have a record with only one entry... |
| 10:01 | bbloom | so it would never make it empty... ok |
| 10:02 | clgv | bbloom: a record is converted to a map if you dissoc one of its "attribute keys" |
| 10:02 | TimMc | Raynes: I messed up lazybot a few weeks back, yeah. Remember, you were mad at me for wanting to perfect the trick before telling you? :-P |
| 10:02 | hyPiRion | clgv: There's a loss of data though |
| 10:03 | bbloom | yeah so (dissoc-in #Foo{:x {},:y 1} [:x :y]) |
| 10:03 | hyPiRion | (assoc-in {:a {:b {}}} [:a :b :c] x) == (assoc-in {:a {}} [:a :b :c] x) |
| 10:03 | bbloom | or [:x :z] or whatever |
| 10:04 | hyPiRion | (dissoc-in {:a {:b {:c foo}}} [:a :b :c]) == ??? |
| 10:04 | lazybot | hyPiRion: Oh, absolutely. |
| 10:04 | hyPiRion | But yeah, there's been some discussion around that. |
| 10:04 | hyPiRion | :p |
| 10:05 | bbloom | the one time i needed dissoc-in, i later discovered that i really wanted dissoc-in-up-to-some-limit |
| 10:05 | clgv | bbloom: well it is an implementation choice if it is important to keep the data as record or not. if this is more important dissoc-in should not be allowed to delete empty maps for uniformity reasons |
| 10:06 | bbloom | clgv: this is the whole point i'm trying to make: the behavior 1) isn't obvious 2) you actually extremely rarely need this function and 3) it's trivial to write exactly teh behavior you want |
| 10:06 | bbloom | any variation of dissoc-in will only be 5ish lines of code |
| 10:06 | TimMc | hyPiRion: Definitely {:a {:b {}}} |
| 10:06 | clgv | bbloom: being easy to write is no argument. there are lots of easy to write functions in core ;) |
| 10:07 | bbloom | clgv: it's no COMPLETE argument |
| 10:07 | bbloom | clgv: there are 2 other reasons in that argument i've made lol |
| 10:07 | clgv | bbloom: the implementation of disso-in is obvious but one needs to make the right decision for the edge case of emptying a map |
| 10:08 | TimMc | ,(update-in {:a {:b {:c :foo}}} [:a :b] dissoc :c) |
| 10:08 | clojurebot | {:a {:b {}}} |
| 10:08 | hyPiRion | TimMc: That's no data loss at least. |
| 10:09 | hyPiRion | But I've not really had issues related to this. |
| 10:09 | TimMc | (update-in ds [:a :b] dissoc :c) = (dissoc-in ds [:a :b :c]) |
| 10:09 | hyPiRion | update-in should've just been kalled `in` |
| 10:09 | clgv | bbloom: in fact it was suggested to implement dissoc-in in core-incubator first^^ |
| 10:09 | hyPiRion | (in ds [:a :b] dissoc c) |
| 10:10 | hyPiRion | Then there's no need for dissoc-in either. or assoc. |
| 10:10 | hyPiRion | assoc-in* |
| 10:11 | TimMc | Nice. |
| 10:11 | TimMc | I like it. Any bad corner cases? |
| 10:12 | abp` | A smooth sailin. |
| 10:12 | TimMc | It has a dangerously short name, of course. |
| 10:12 | abp` | Developing Clojure full time now for a few weeks. :) |
| 10:13 | TimMc | abp`: Me too! Well, starting March 4. |
| 10:13 | clgv | hyPiRion: looks nice since it extracts the common pattern. but it would probably create map level for dissoc in if they do not exist. or it would not do that for assoc as well |
| 10:13 | TimMc | Pumped. |
| 10:13 | kryft | Developing Clojure as in developing the language itself? |
| 10:13 | TimMc | Not I. |
| 10:13 | kryft | Or as in writing stuff in Clojure |
| 10:13 | abp` | TimMc: It's like a dream. Everything fitting perfectly fine into deadlines, producing minimal code straight to the point. |
| 10:14 | hyPiRion | clgv: yeah, update-in create new maps too. |
| 10:14 | abp` | kryft: Nope wep service and backend. |
| 10:14 | kryft | I should clearly get started writing clojure. I'm sure not trying to learn haskell at the same time would help :P |
| 10:14 | clgv | hyPiRion: but that would be counter-intuitive for dissoc-in ;) |
| 10:14 | clgv | hyPiRion: maybe it needs some kind of option. |
| 10:15 | TimMc | kryft: I mean, other than the fact that when programming in a Lisp, you're constantly refining the boundary between language and program. :-) (Where is that quote from?) |
| 10:15 | kryft | TimMc: Hehe |
| 10:15 | TimMc | *redefining, perhaps |
| 10:15 | abp` | TimMc: Don't know but it's neat. |
| 10:15 | TimMc | SOunds like a Let Over Lambda kind fo quote. |
| 10:16 | hyPiRion | clgv: This is why I'm not the head of the "new features"-department in Clojure. |
| 10:16 | TimMc | No, of course it's Paul Graham: http://www.paulgraham.com/progbot.html |
| 10:16 | TimMc | "Language and program evolve together. Like the border between two warring states, the boundary between language and program is drawn and redrawn, until eventually it comes to rest along the mountains and rivers, the natural frontiers of your problem. In the end your program will look as if the language had been designed for it." |
| 10:33 | AtKaaZ | how can we print and/or use the &env inside the macro? in the ` part |
| 10:34 | bbloom | AtKaaZ: syntax-quote isn't magical in any way, nor is it specific to macros |
| 10:34 | bbloom | AtKaaZ: you can use &env just like any other local name |
| 10:35 | bbloom | ,(let [&env :foo] `(identity ~&env)) |
| 10:35 | clojurebot | (clojure.core/identity :foo) |
| 10:35 | AtKaaZ | bbloom: but I can't even print it due to it looks like: {b #<LocalBinding clojure.lang.Compiler$LocalBinding@4cd671a1>} |
| 10:36 | AtKaaZ | (defmacro a [] (prn &env)) (let [b 1] (a)) |
| 10:36 | bbloom | AtKaaZ: yeah, that's b/c &env is implementation specific & the JVM implementation has a bunch of private java objects |
| 10:36 | bbloom | AtKaaZ: if you really need a portable/useful/printable &env, you can use ambrose's analyze library |
| 10:36 | bbloom | (i think) |
| 10:36 | AtKaaZ | k |
| 10:38 | AtKaaZ | ,(defmacro a [] (get &env 'b)) (let [b 1] (a)) |
| 10:38 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 10:46 | edoloughlin | I'm returning to a dormant project and migrating it to 1.4. I've discovered that in the CCW repl I can no longer redefine functions. The (defn) or (defn-) evaluates and returns ok but the functions are not changed - whatever was loaded when the repl started is still executed. Any ideas? |
| 10:47 | AtKaaZ | bbloom: oh i googled, found it: http://blog.jayfields.com/2011/02/clojure-and.html basically this: (defmacro show-env [] (println (keys &env)) `(println ~@(keys &env))) ... (let [band "zeppelin" city "london"] (show-env)) |
| 11:21 | Marble68 | o/ |
| 11:22 | Marble68 | Is anyone in here looking for work? I have a client that hired a guy to write a web app for her. He wrote it in clojure, then he quit. I'm looking for someone interested in a few hours a week to help maintain it. |
| 11:23 | Marble68 | Serious |
| 11:23 | marcellus1 | maybe, what kind of web app? |
| 11:24 | Marble68 | It's a web app that has a roles based access. It manages secret shoppers |
| 11:24 | Marble68 | I have all the source in git |
| 11:25 | Marble68 | I don't know Clojure - but I had someone look at it and they said the code is nice and clean |
| 11:25 | Marble68 | well commented, etc. |
| 11:30 | ToxicFrog | Marble68: if you'd asked that a year ago I'd be down, but I'm about to graduate and start full time work. Sorry. |
| 11:36 | Marble68 | thanks, ToxicFrog :) |
| 11:36 | Marble68 | I think it'd only be a month or two - maybe three |
| 11:37 | ToxicFrog | By "about to" I mean I defend on monday and start work the following week. |
| 11:38 | ToxicFrog | Please go back in time and mention this to Past Me when I had two months to kill waiting for the defence to be scheduled~ |
| 11:38 | Marble68 | ha :) |
| 11:40 | pepijndevos | What is the nicest way to use webscokets in clojurescript? |
| 11:40 | tomoj | I think a new closure has websocket support somewhere? |
| 11:41 | pepijndevos | tomoj, oh yea, I think I saw that somewhere... hmmm |
| 11:41 | abp` | pepijndevos: http://thegeez.net/2012/04/03/why_browserchannel.html |
| 11:41 | abp` | Maybe |
| 11:42 | pepijndevos | lol, amsterdam clojurians seem to have written 90% of everything websocket in the clojure landscape |
| 11:48 | pepijndevos | abp`, tomoj, I think I'll use alephs webockets with googles thing. There doesn;t seems to be a nice wrapper on hte client side. |
| 12:00 | pbostrom | pepijndevos: websockets in cljs is just a few lines of javascript interop: (reset! sock (js/WebSocket. ws-url)) (set! (.-onmessage @sock) msg-hdlr) |
| 12:01 | pbostrom | using an atom to store the socket |
| 12:01 | pbostrom | then write your handlers in cljs |
| 12:01 | pepijndevos | pbostrom, why would I put a socket in an atom? |
| 12:01 | pbostrom | to keep a reference to it |
| 12:01 | pbostrom | in case you want to close it |
| 12:02 | pbostrom | also to send msgs out on it |
| 12:02 | pepijndevos | pbostrom, yea, but a socket is just a mutable value right? So why can't I just def it? |
| 12:03 | pbostrom | pepijndevos: yeah, you could do that, but say the socket gets closed for some reason like a flaky connection, you'll have to redef with a new websocket value |
| 12:03 | pepijndevos | ah, I see |
| 12:12 | frenchyp | hi |
| 12:12 | frenchyp | So, I have a let form where I bind 4 different symbols to expressions. The 4th symbol is calculated from the 3rd, which is calculated from the 2nd, etc... |
| 12:12 | frenchyp | In this particular case, the 1st symbol contains a database row and can be null if the query didn't return any matching row. |
| 12:12 | frenchyp | The expression for the 2nd symbol triggers a null pointer exception if its input (symbol 1) is nil. |
| 12:12 | frenchyp | What is the idiomatic way to rewrite my let to account for this case? |
| 12:14 | frenchyp | should I nest a let in a if-let? |
| 12:14 | alandipert | frenchyp: if-let at top level i think |
| 12:15 | pbostrom | frenchyp: that's what I tend to do in those cases, not sure if that's the best way |
| 12:15 | frenchyp | alandipert: pbostrom ok, that will work for my case |
| 12:16 | frenchyp | but it won't if it's the 2nd symbol that can be null for example |
| 12:16 | frenchyp | well, would be awkward |
| 12:16 | alandipert | frenchyp: there are nil-guarding flavors of let that nil guard, often featured in monad tutorials |
| 12:17 | frenchyp | actually i started writting this with the maybe-m monad |
| 12:17 | alandipert | frenchyp: i think that's legit |
| 12:17 | frenchyp | but a) it seemed that something was wrong with my understanding to have to resort to a powerful construct like that in this case |
| 12:18 | frenchyp | b) i couldn't get the domonad form to return the value of its last expression, which might just be the way monads work |
| 12:18 | frenchyp | i have never used monads before |
| 12:18 | alandipert | well, personally i keep my maybe-nil op (always IO) at the top and find i don't run into this |
| 12:19 | alandipert | if there are multiple IO things involved that may collectively return nil i put them in a function that i consume via if/when-let elsewhere |
| 12:19 | alandipert | and thus rarely resort to maybe-m |
| 12:20 | frenchyp | makes sense, that seems like the practical solution |
| 12:20 | Chousuke | for a moment I thought this was #haskell and wondered "what's the problem, just use Maybe" :P |
| 12:20 | frenchyp | thank you |
| 12:20 | alandipert | no prob |
| 12:20 | Chousuke | but yeah, monads in clojure aren't quite as convenient. there are however, threading operators and other things that short circuit on nil |
| 12:21 | frenchyp | Chousuke: oh? which one? |
| 12:21 | alandipert | and functions that eat nil without indigestion, like + |
| 12:21 | Chousuke | don't remember the exact names :/ |
| 12:21 | tomoj | some-> and some->> ? |
| 12:22 | alandipert | ?-> i think |
| 12:23 | frenchyp | ha, can't imagine worse google nightmare than ?-> |
| 12:23 | alandipert | frenchyp: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L29 |
| 12:24 | frenchyp | awesome! |
| 12:25 | frenchyp | that seems perfect |
| 12:25 | frenchyp | thank you |
| 12:26 | alandipert | sure! |
| 12:26 | tomoj | that is named some-> in 1.5 |
| 12:26 | tomoj | (and it's in core) |
| 12:26 | frenchyp | tomoj: even better |
| 12:26 | technomancy | wait, some-> is nil-safe ->? |
| 12:26 | alandipert | oh right, https://github.com/clojure/clojure/blob/master/changes.md#24-new-threading-macros |
| 12:27 | technomancy | I thought some-> had something to do with some. |
| 12:27 | tomoj | "When expr is not nil, threads it into the first form (via ->), and when that result is not nil, through the next etc" |
| 12:27 | frenchyp | is that what people do? use 1.5.0RCX? |
| 12:29 | alandipert | frenchyp: dunno, but it's right around the corner |
| 12:40 | TimMc | frenchyp: symbolhound |
| 12:42 | frenchyp | TimMc: yep: http://symbolhound.com/?q=-%3F%3E+github+clojure |
| 12:42 | frenchyp | thanks |
| 12:43 | frenchyp | this chan has a high problem solving rate |
| 12:43 | tomoj | sweet |
| 12:44 | frenchyp | I have a very different and completely open ended question, feel free to shut down: |
| 12:44 | frenchyp | I have a fairly hairy (for me at least) imperative algorithm from a paper |
| 12:45 | frenchyp | mutates state all over the place, uses globals, etc... |
| 12:45 | Frozenlock | Burn it with fire! |
| 12:45 | jodaro | wow |
| 12:45 | Chousuke | :P |
| 12:45 | frenchyp | how would I even start 'translating' it to a functional algorithm? |
| 12:45 | jodaro | symbolhound |
| 12:46 | Chousuke | frenchyp: first figure out what it does |
| 12:46 | frenchyp | or rather, in broad strokes, what do people do in this situation |
| 12:46 | Chousuke | ie. when you give it input A, what is the result |
| 12:46 | Ember- | and try to understand *why* it does what it does |
| 12:46 | Chousuke | in general merely translating imperative algorithms to functional ones results in an inefficient algorithm though |
| 12:47 | Chousuke | because presumably the mutation is done for efficiency |
| 12:48 | Chousuke | the first step is to make all the state explicit though. |
| 12:48 | Chousuke | instead of using globals, pass around parameters |
| 12:48 | Chousuke | and capture modifications |
| 12:48 | Chousuke | then again, clojure is not a pure functional language. you might be okay with just implementing the imperative algorithm :P |
| 12:49 | frenchyp | than you for all the suggestions so far |
| 12:49 | frenchyp | I implemented it in java, but boy, it's messy |
| 12:50 | frenchyp | hopefully, trying to make it functional would help |
| 12:50 | ToBeReplaced | frenchyp: why not just leave it in java then? |
| 12:50 | Chousuke | frenchyp: generally functional solutions to problems result in completely different algorithms |
| 12:51 | frenchyp | ToBeReplaced: well, I never said I was a practical guy :) |
| 12:51 | Chousuke | frenchyp: it's good practice though. just don't start with 2" |
| 12:51 | Chousuke | oops |
| 12:51 | Chousuke | with "I need to translate this" |
| 12:51 | Chousuke | start with "I need something that has the same end result" |
| 12:51 | frenchyp | ToBeReplaced: plus, it's so inelegant, it hurts |
| 12:51 | frenchyp | Chousuke: yes, I think you are right |
| 12:52 | frenchyp | I can try to keep the same methods (algo is expressed as several methods), and translate them to func |
| 12:52 | Chousuke | and sometimes imperative algorithms get complicated precisely because they are mutable |
| 12:52 | frenchyp | or, try to really dig in and understand, but that might be too ambitious for my little brain |
| 12:52 | Chousuke | especially when you have to remember past values |
| 12:53 | Chousuke | in a functional language with immutability, all you do to remember a previous value is to keep a reference to it :P |
| 12:54 | frenchyp | would Purely Functional Data Structures by Okasaki, or his thesis, help? or is that too academic? |
| 13:14 | frommorf | anyone here? |
| 13:15 | technomancy | nope |
| 13:25 | mr_rm | '0 |
| 13:27 | mr_rm | `0 |
| 13:29 | mr_rm | what is the leading string to get the bot to evaluate something? |
| 13:30 | gfredericks | ,0 |
| 13:30 | clojurebot | 0 |
| 13:30 | gfredericks | &0 |
| 13:30 | lazybot | ⇒ 0 |
| 13:30 | mr_rm | ,((apply some-fn [even? neg?]) 1) |
| 13:30 | clojurebot | false |
| 13:30 | mr_rm | ,((apply some-fn '(even? neg?)) 1) |
| 13:30 | clojurebot | nil |
| 13:31 | mr_rm | does anyone know why i can't apply some-fn to a list? |
| 13:31 | tomoj | &((apply some-fn '(even? neg?)) {'neg? 42}) |
| 13:31 | lazybot | ⇒ 42 |
| 13:32 | tomoj | &((apply some-fn (list even? neg?)) 1) |
| 13:32 | lazybot | ⇒ false |
| 13:32 | tomoj | &('neg? {'neg? 42}) |
| 13:32 | lazybot | ⇒ 42 |
| 13:32 | mr_rm | tomoj: why does that work but the '() syntax doesn't? |
| 13:32 | tomoj | &(map type '(even? neg?)) |
| 13:32 | lazybot | ⇒ (clojure.lang.Symbol clojure.lang.Symbol) |
| 13:32 | tomoj | &(map type (list even? neg?)) |
| 13:32 | lazybot | ⇒ (clojure.core$even_QMARK_ clojure.core$neg_QMARK_) |
| 13:33 | mr_rm | &(map type (list even? neg?)) |
| 13:33 | lazybot | ⇒ (clojure.core$even_QMARK_ clojure.core$neg_QMARK_) |
| 13:33 | mr_rm | ahh, ok |
| 13:33 | mr_rm | doesn't evaluate anything inside '() |
| 13:34 | tomoj | ' means quote |
| 13:34 | mr_rm | &(map type (quote even? neg?)) |
| 13:34 | lazybot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol |
| 13:34 | tomoj | well, '(foo) means (quote (foo)) |
| 13:34 | mr_rm | &(map type (quote (even? neg?))) |
| 13:34 | lazybot | ⇒ (clojure.lang.Symbol clojure.lang.Symbol) |
| 13:34 | tomoj | i.e. \' says "quote the next form" |
| 13:35 | mr_rm | ok thanks |
| 13:35 | tomoj | i.e. "don't evaluate the next form" |
| 13:39 | Frozenlock | Is there a way to catch all subclass? (cath some-library.exception.* ... ? |
| 13:39 | Frozenlock | /s/cath/catch |
| 13:40 | technomancy | Frozenlock: subclasses are different from every class under a given package |
| 13:40 | technomancy | subclasses will be handled by catch, but what you described above isn't possible (might be using slingshot though) |
| 13:41 | ohpauleez | You can only catch subclasses if they have a common parent - as technomancy said, it looks like you're just talking about a certain level in the package |
| 13:45 | TimMc | Does the JVM's try/catch handling only do hierarchy matching, or can you inject arbitrary byte code to determine whether a catch clause is to be triggered? |
| 13:46 | Frozenlock | so if I have "direct known subclasses: ..." in the exception class, I can't catch them all in a big swoop? |
| 13:46 | abp` | Frozenlock: Sure via the one your looking at? |
| 13:46 | abp` | you're |
| 13:47 | Frozenlock | abp`: I tried, but the subclasses error seem to just pass through :( |
| 14:00 | abp` | Frozenlock: Strange |
| 14:01 | gfredericks | does anybody have any experience setting clojure.tools.logging/*logger-factory* manually? |
| 14:01 | gfredericks | I'm trying to use log4j (while datomic has the commons logging) |
| 14:01 | gfredericks | for some reason the loggers all end up disabled |
| 14:05 | tomoj | gfredericks: I assume you already followed http://docs.datomic.com/configuring-logging.html#sec-3 ? |
| 14:05 | jcromartie | I just realized a great way to test middleware in the REPL |
| 14:05 | jcromartie | ((wrap-whatever identity) {:uri "whatever/" :foo :bar}) |
| 14:08 | jcromartie | nREPL is fun |
| 14:08 | jcromartie | am I missing the automatic arg suggestion from SLIME though? |
| 14:08 | gfredericks | tomoj: no, that looks helpful, thanks |
| 14:15 | AdamC | Hi, don't know if anyone's interested, but I just made a thing for emacs which when given a library name (say "digest" or "incanter") will go off, look up the latest version number on clojars and insert into the buffer e.g. [incanter "1.4.1"]. |
| 14:15 | tomoj | fucking brilliant |
| 14:15 | AdamC | and then asks you if you want to use pomegranate to automatically add it to the classpath of your running repl |
| 14:15 | tomoj | ! |
| 14:15 | AdamC | got sick of nrepl restarts |
| 14:16 | AdamC | and could never remember what to import for pomegranate |
| 14:16 | AdamC | https://github.com/AdamClements/latest-clojure-libraries |
| 14:16 | technomancy | AdamC: huh, cool |
| 14:16 | AdamC | it's a little hacky getting the latest version from clojars |
| 14:16 | AdamC | (very hacky) |
| 14:16 | technomancy | AdamC: can you re-use lein's indices? |
| 14:17 | AdamC | that's what I wanted to do, but i have never been able to get them to work |
| 14:17 | tomoj | would you then have to reimplement semver? |
| 14:17 | AdamC | (you mean like lein search uses, rcight? |
| 14:17 | technomancy | AdamC: right. also getting a connection from Emacs to Leiningen's own process is a bit trickier. |
| 14:17 | AdamC | when i say haven't been able to get them to work, i mean even to do a lein search, or lein outdated |
| 14:18 | technomancy | AdamC: ideally you could have something that would add it into project.clj and pomegranate at the same time |
| 14:18 | technomancy | so you could keep your repl process vaguely in sync with project.clj |
| 14:18 | Raynes | $latest me.raynes/laser |
| 14:18 | lazybot | [me.raynes/laser "0.1.27"] -- https://clojars.org/me.raynes/laser |
| 14:18 | Raynes | AdamC, tomoj: ^ |
| 14:18 | Raynes | If you used ERC you already had this feature. ;) |
| 14:18 | TimMc | :-P |
| 14:19 | AdamC | it sort of does, so at the moment, it puts the vector under your cursor, so the idea is you go to your project.clj and open up your deps, and it'll type it automatically. I was going to try insert it automatically, but there's so much danger of messing up the formatting |
| 14:19 | technomancy | AdamC: oh, cool |
| 14:19 | Raynes | Haha, grep. You're pretty cool, AdamC. |
| 14:20 | AdamC | and then yeah, just a "want to add this to your classpath y/n" |
| 14:20 | technomancy | AdamC: the only reason I haven't written that myself is that until recently it was impossible to read project.clj, alter it, and spit it back out in a way that preserved comments |
| 14:20 | technomancy | but now you can do it with sjacket |
| 14:20 | tomoj | the link to the list of commands in lazybot's readme goes to the wrong place |
| 14:20 | AdamC | not heard of sjacket |
| 14:21 | Raynes | The command list is crazy out of date anyways, tomoj. |
| 14:21 | tomoj | and doesn't include latest, but I should have guess that from the start.. |
| 14:21 | Raynes | tomoj: I used to have a way to generate a list of commands at runtime. |
| 14:21 | Raynes | I need to re-add it. |
| 14:21 | Raynes | https://github.com/flatland/lazybot/blob/develop/src/lazybot/plugins/clojure.clj#L225 is the $latest command |
| 14:23 | AdamC | ah, so you are actually pulling teh clojars page, not using lein's indices? |
| 14:24 | Raynes | No. |
| 14:24 | Raynes | Er, yes. |
| 14:24 | Raynes | Using lein's indices would be horrific. At least for a bot. |
| 14:24 | Raynes | It also assumes that the indices are up to date. |
| 14:25 | AdamC | indeed, which sort of defeats the point |
| 14:25 | AdamC | is there any sort of api for this kind of thing on clojars, and if not, should there be? |
| 14:25 | technomancy | lein supports partial updates of indices; so you it's pretty cheap to just ask it to refresh |
| 14:28 | AdamC | technomancy: oh! lein search and lein outdated work now. I've tried them a few times over the past months and the search index never downloads |
| 14:29 | AdamC | perhaps I'll give that a try |
| 14:29 | technomancy | AdamC: yeah, during the previews there was some nasty breakage |
| 14:29 | technomancy | but unless you want to just launch a new process you have to deal with connecting to the Leiningen JVM |
| 14:29 | technomancy | you could try lein.el |
| 14:29 | AdamC | hmmm |
| 14:30 | AdamC | the other nice thing about this way, i've just found when adding lein-outdated into my profiles.clj |
| 14:30 | AdamC | is that it doesn't actually need lein to be running, or to be in a project |
| 14:31 | AdamC | Wouldn't some REST api be cheaper in the long run than having everyone download the full index to search? I don't know what's going on behind this search index |
| 14:32 | AdamC | given the use case of wanting most up to date, so probably trying to update every time it's used |
| 14:32 | technomancy | AdamC: it's not actually downloading the full indices; lein2 is able to just get the changes since the last time it checked |
| 14:33 | technomancy | but being able to do fully-local searches and search when offline is great |
| 14:33 | technomancy | plus this functionality already exists for performing the searches client-side, so it keeps the clojars codebase simpler |
| 14:35 | AdamC | yeah, I can see that, the big initial download is just a bit of an annoying barrier to entry. I'll have a go at hooking into the running lein process and see if I can get anything working client side |
| 14:39 | antares_ | two new releases today: Welle 1.4 (http://blog.clojurewerkz.org/blog/2013/02/21/welle-1-dot-4-0-is-released/) and Monger 1.5.0-beta1 (http://blog.clojurewerkz.org/blog/2013/02/21/monger-1-dot-5-0-beta1-is-released/) |
| 14:43 | jcromartie | how can I see the println output from my Jetty handler when running in nREPL |
| 14:44 | Raynes | antares_: Hi. |
| 14:44 | antares_ | Raynes: hey |
| 14:45 | Raynes | antares_: I noticed you've got comments on all the pagination spots in refheap that it should be using some built in pagination support. Was there a particular reason you didn't do that (just wondering if I should or not). |
| 14:45 | Raynes | Delete last period, insert question mark. |
| 14:45 | antares_ | Raynes: sorry, what comments? |
| 14:46 | antares_ | Monger has built-in pagination support in monger.query but I don't remember implementing pagination in refheap |
| 14:46 | antares_ | so I guess I just quickly ported things the most direct way |
| 14:46 | Raynes | antares_: https://github.com/Raynes/refheap/blob/master/src/refheap/models/paste.clj#L137 |
| 14:46 | Raynes | Yeah, that's what I was thinking. |
| 14:46 | Raynes | I just wanted to make sure there wasn't some technical problem in monger that precluded using that functionality. |
| 14:47 | antares_ | Raynes: yes, feel free to just use pagination there, it should be in the docs |
| 14:47 | Raynes | Cool. Thanks! |
| 14:50 | jcromartie | so how do I get println output from another thread to show up in my nREPL |
| 14:50 | jcromartie | I know I need proper logging at some point |
| 14:51 | jcromartie | but right now I am just spinning up a little dev server, and it completely hides any exceptions that happen during request handling |
| 14:53 | jcromartie | hm https://github.com/kingtim/nrepl.el/issues/83 |
| 14:56 | siscia | Very quickly, and very stupid question... |
| 14:56 | siscia | I extend a type (extend-type) on a java interface |
| 14:56 | siscia | in a particular namespace |
| 14:56 | siscia | writting several function on the particular interface |
| 14:57 | siscia | what/how i need to import to call those functions ? |
| 15:04 | borkdude | org-mode question: https://www.refheap.com/paste/11613 |
| 15:05 | borkdude | maybe a can use org-babel to keep a counter or smth? |
| 15:07 | dnolen_ | siscia: not sure I understand, you just call the functions. Load the require/use namespace where you make those modifications, and require/use the protocols fns. |
| 15:10 | siscia | dnolen_, hi, I was thinking the same... But it doesn't work... It may be because I am extending an interface instead of a real class ? |
| 15:12 | dnolen_ | siscia: you can extend-type on interfaces just fine. |
| 15:12 | dnolen_ | siscia: you should paste your code somewhere |
| 15:15 | borkdude | follow up on my org-mode question: http://stackoverflow.com/questions/15011355/org-mode-counter-for-items-visible-in-export |
| 15:17 | siscia | dnolen_, I have the extend-type at line 48 here https://github.com/siscia/parallel-colt-matrix/blob/master/src/parallel_colt_matrix/core.clj |
| 15:17 | siscia | dnolen_, and a stupid test here https://github.com/siscia/parallel-colt-matrix/blob/master/test/parallel_colt_matrix/core_test.clj |
| 15:18 | hiredman | :( those :imports can collapsed |
| 15:18 | hiredman | can be |
| 15:19 | siscia | it (lein test) raise excepetion at line 13, saying that "No such var: pc/implementation-key" |
| 15:19 | siscia | hiredman, you say that the problem could be the imports ? |
| 15:19 | hiredman | no |
| 15:19 | hiredman | I am just saying it makes me sad to see that |
| 15:20 | siscia | hiredman, I don't love it neither, but I work better with those... I will collapse them as soon as I finish... |
| 15:21 | siscia | hiredman, thanks thought |
| 15:22 | hiredman | siscia: yeah, so that error message is correct |
| 15:22 | hiredman | parallel-colt-matrix.core doesn't contain any protocols |
| 15:22 | hiredman | the function implementation-key only exists in the namespace where the protocol it is part of is defined |
| 15:23 | siscia | hiredman, ahhhh i didn't know it... thanks |
| 15:23 | siscia | now the problem... the protocols are defined in another library... |
| 15:24 | hiredman | so? |
| 15:24 | siscia | clojure.core.matrix.protocols (line 2 of core.clj) |
| 15:24 | siscia | I need to import it in the test ? |
| 15:24 | hiredman | it is just like any other function |
| 15:24 | hiredman | require the namespace, use the function |
| 15:25 | hiredman | protocols create groups of functions |
| 15:25 | siscia | hiredman, hummm i am follow... let me try... thanks |
| 15:25 | hiredman | like, you call functions from other namespaces right? |
| 15:25 | hiredman | just do that |
| 15:26 | siscia | ok |
| 15:28 | siscia | hiredman, I don't even need to require the core but only the protocols... it is possible ? |
| 15:28 | hiredman | siscia: maybe you should sit down with a basic clojure tutorial |
| 15:28 | hiredman | I hear there are good books |
| 15:29 | siscia | hiredman, it sound really weird for me... |
| 15:29 | siscia | well, thank you... |
| 15:29 | siscia | yeah I definitely need to study more... |
| 15:31 | lynaghk | Is there some way to dynamically bind the value of a compojure route when starting the server? I tried using vars, but then realized that because the server is running on a different thread that solution won't fly. |
| 15:40 | siscia | lynaghk, just wonder why you want to do so ? |
| 15:41 | uvtc | Does Clojure come with a way to check if a string contains some given substring, without using regexes? |
| 15:41 | abp` | lynaghk: Could you pass the fn to execute by the dynamic route via the request-map from a middleware, probably? |
| 15:41 | lynaghk | siscia: the backend serves data specific to different sites, which are defined in config files. Ideally you could launch multiple servers on different ports in the same JVM with, e.g., (start-server! 8080, site-A) |
| 15:41 | hiredman | uvtc: String has a .contains method |
| 15:41 | omarkj | Am I right to say the Clojure does not allow me to do bit ops on bignums (like BigInteger)? |
| 15:42 | lynaghk | siscia: and the route "/site-config" would return that data to clients. |
| 15:42 | uvtc | hiredman: Thanks. (After searching online, noticed that there used to be a `substring?` in an old string contrib lib.) |
| 15:43 | uvtc | Seems like there should be a clojure.string/contains. |
| 15:43 | lynaghk | abp`: not sure. I assume that everything including the middleware is run on another thread, so dynamic bindings won't work. |
| 15:43 | uvtc | (or similar) |
| 15:43 | ibdknox | lynaghk: I can't think of a way, but a simple solution would be to use middleware to prepend a dir to the url: /foo -> /site1/foo and then just use contexted routes |
| 15:44 | lynaghk | ibdknox: nah, then the frontends would need to know which site they were at |
| 15:45 | lynaghk | ibdknox: because they'd all need to know to hit a special URL. |
| 15:45 | ibdknox | why? |
| 15:45 | clojurebot | why is the ram gone |
| 15:45 | ibdknox | lynaghk: not if you mapped urls to sites in the middleware? |
| 15:45 | abp` | lynaghk: (wrap-site-config handler site-a) .. for each server doesn't work? |
| 15:45 | ibdknox | sounds like you should just run nginx though :) |
| 15:46 | lynaghk | ibdknox: ah, I see what you're saying. |
| 15:46 | abp` | So I did not understood what you are trying most likely. :) |
| 15:46 | lynaghk | ibdknox: yeah, totally that's what I'd like to do, which is why I'm trying to figure out a nice way to start up a bunch of servers with different configs without tangling the code |
| 15:47 | ibdknox | lynaghk: I just run them on different ports and then use nginx to reverse proxy |
| 15:47 | ibdknox | lynaghk: are you going to need to dynamically add them? |
| 15:47 | lynaghk | ibdknox: add what? |
| 15:47 | ibdknox | lynaghk: servers |
| 15:48 | muhoo | i'm pretty happy with just running lein cljsbuild repl-listen, but i'm curious why running piggieback in nrepl locks up |
| 15:48 | muhoo | the port 9000 is opened, the browser is connecting to it (sniffing packet confirms this), but there is no response from nrepl/piggieback |
| 15:49 | lynaghk | ibdknox: nah, probably not. I think middleware might be the way to go---it's more than I'd like to write, but I don't think dynamic vars are going to work |
| 15:49 | jcromartie | does it make sense to keep objects as a hash map of ids to values, or just a set of maps containing the ID as normal |
| 15:49 | ibdknox | lynaghk: yeah, I can't think of a way to do binding like that :/ |
| 15:49 | jcromartie | and use a map as an index if necessary |
| 15:49 | muhoo | whereas, running 'lein trampoline cljsbuild repl-listen", works perfectly, 9000 opens, browser connects, cljs repl responds, etc |
| 15:50 | sirvaliance | What is the proper way to test if a argument was passed into a function with & |
| 15:51 | sirvaliance | That is, (defn foo [a & b] (if (b) (print b))) |
| 15:51 | TimMc | (if (seq b) ...) |
| 15:51 | sirvaliance | The question really is, what should I be using instead of (if (b) |
| 15:51 | sirvaliance | Ahh |
| 15:51 | TimMc | sirvaliance: Well, (b) calls b as a function. |
| 15:51 | ibdknox | muhoo: are you refreshing the browser once piggieback connects? |
| 15:51 | drorbemet | Hi, I am having trouble to find out which role ":fin" plays in these code examples from the Clojure Koans. https://github.com/functional-koans/clojure-koans/blob/master/src/koans/16_atoms.clj |
| 15:52 | muhoo | ibdknox: yes, remember, i'm packet sniffing, i see all this happening. i don't think this is an "are you sure you plugged it in?" situation |
| 15:52 | sirvaliance | TimMC, Yeah, that was a dumb example. Something likt (exists? b) |
| 15:53 | muhoo | though i never underestimate my ability to do something stupid, in this case, it really is an A/B: with cljsbuild, it works, with exact same steps, with piggieback, it does not. |
| 15:53 | sirvaliance | TimMc: So even if I pass in a string for b, is it going to be of type seq no master what? |
| 15:53 | drorbemet | The example explains the atom construct. |
| 15:54 | TimMc | sirvaliance: b will always be nil or a seq. |
| 15:54 | gfredericks | if I want to extend a class and call super in a method, I need gen-class, right? |
| 15:54 | TimMc | sirvaliance: That's what rest-args are. |
| 15:55 | amalloy | gfredericks: proxy can do those things |
| 15:55 | TimMc | proxy-super? |
| 15:55 | gfredericks | the docstring for proxy made me think it couldn't o_O |
| 15:55 | sirvaliance | TimMc: If I know I will always be passing in a single string, would I be better off overloading via (defn foo ([a] (println a)) ( [a b] (println a b))) |
| 15:56 | gfredericks | TimMc: okay cool, thanks |
| 15:59 | TimMc | sirvaliance: Yes. |
| 15:59 | borkdude | solved my org-mode problem with dynamic blocks (had to find out they exist) |
| 15:59 | muhoo | i do get this interesting thing though: https://www.refheap.com/paste/11616 . i probably need to try to get a minimal failing case and then submit it somewhere |
| 15:59 | TimMc | And you can chain them, if appropriate. (defn foo ([a] (foo a "default")) ([a b] ...)) |
| 16:00 | sirvaliance | TimMc: Thanks |
| 16:00 | sirvaliance | TimMc: Ahhh :) |
| 16:07 | muhoo | huh that warning looks like an internal inconsistency inside cljs 1552, oddly. https://www.refheap.com/paste/11617 am i all screwd up or is this an actual bug in cljs? |
| 16:07 | gfredericks | when calling interop on a java-varargs function, I always have to pass an array? |
| 16:07 | amalloy | yes |
| 16:07 | gfredericks | I guess I don't do this very often. |
| 16:15 | dnolen_ | muhoo: hmm that's a good catch |
| 16:16 | muhoo | dnolen_: glad to be of service. thanks for doing so much to kep cljs moving forward |
| 16:18 | dnolen_ | muhoo: are you working off master? |
| 16:21 | dnolen_ | muhoo: though I'm surprised that you get that warning at all (array) macroexpands to (js* "[]") |
| 16:53 | weavejester | I have a queue/consumer project, and I'm just wondering how to arrange it |
| 16:54 | weavejester | I have a "client" namespace for pushing things onto the queue, and a "worker" namespace for consuming it |
| 16:54 | weavejester | I guess the natural thing to do is to divide it up into two projects |
| 16:54 | weavejester | But I've been wondering whether using two profiles in the same project could be an alternative |
| 17:04 | callenbot | yusssss. Found a good reason to use monads in Python again. |
| 17:23 | clojure-newb | hey guys, how can I get the index at which an element is present in a sorted-set ? |
| 17:24 | clojure-newb | in my case the items in my sorted-set are #inst |
| 17:24 | vijaykiran | ns |
| 17:24 | muhoo | dnolen_: i was trying to get piggieback running with lein-cljsbuild in the same project. it seems they disagree on which cljs version to use. that error was in 1552 . i suspect the warning was coming from piggieback or nrepl or such. |
| 17:25 | dnolen_ | muhoo: yeah, seems weird to me |
| 17:26 | hugod | would anyone have any tricks for creating guava TypeLiteral instances from clojure (they seem to rely on generics...)? |
| 17:26 | muhoo | i strongly suspect dependency conflict somewhere. weird indeed. |
| 17:26 | kencausey | clojure-newb: I think you are not asking the right question. Perhaps I'm mistaken but the terms set and index don't go together as far as I'm aware. What is the real problem you are trying to solve? |
| 17:27 | TimMc | hugod: What method or constructor are you trying to use? |
| 17:27 | clojure-newb | kencausey: I've got a sorted-set with a bunch of #inst items in… and I'd like to know where in the list a given #inst is… first, last etc |
| 17:27 | tomoj | clojure-newb: binary search? |
| 17:28 | tomoj | there is an .entryKey on Sorted which appears to give you the element for an index |
| 17:28 | tomoj | used to implement subseq |
| 17:28 | TimMc | hugod: Generics are erased in the compile process. |
| 17:28 | tomoj | well |
| 17:28 | kencausey | Perhaps I'm wrong, but I think you are not using the right data structure for the problem. |
| 17:29 | clojure-newb | tomoj: I think I need to do it the other way round… pass in an element, and determine its index |
| 17:29 | tomoj | (first (subseq sset = key)) ? :/ |
| 17:29 | clojure-newb | kencausey: very possible :-) |
| 17:29 | tomoj | yes, with a binary search :) |
| 17:30 | tomoj | wait |
| 17:30 | tomoj | .entryKey doesn't do that |
| 17:30 | clojure-newb | I need the collection whatever it is to be sorted, and only have unique items in... |
| 17:30 | tomoj | everything I just said is rubbish |
| 17:31 | clojure-newb | then I need to pass an element in to some computation which gets me its index in the list |
| 17:31 | kencausey | What do you do with the index? |
| 17:31 | turbofail | you search for something at that index |
| 17:31 | clojure-newb | no |
| 17:31 | turbofail | redis's sorted sets have that, for example |
| 17:31 | turbofail | or the other way around |
| 17:32 | TimMc | Sorted sets really should provide a "where would this be inserted" function. |
| 17:32 | clojure-newb | I figure out business logic later for other stuff later on depending on where the element is in the list… one rule for most recent item… (first in list) etc etc, and another rule for other items |
| 17:32 | hugod | TimMc: TypeLiteral somehow encodes the generics info into a class |
| 17:33 | clojure-newb | must admit I am slightly confused that I cannot get an index on something that is sorted… too newb I suppose |
| 17:34 | amalloy | TimMc: why? |
| 17:34 | turbofail | clojure-newb: a lot of sorted-set implementations don't let you do that. b-tree indices in databases usually don't, for example |
| 17:35 | clojure-newb | turbofail: fair enough… is there a clojure way to do this ? some other data structure I should use that will do the job ? |
| 17:36 | turbofail | don't think so |
| 17:36 | TimMc | amalloy: Because they know how to do it efficiently and I want the answer. :-P |
| 17:36 | clojure-newb | is it as simple as turning my sorted-set into a vector ? |
| 17:36 | turbofail | a vector won't give you efficient insertion for something that's supposed to be in the middle |
| 17:36 | amalloy | but what answer would it give? the position an item would go into? you can't do anything useful with that position, and it's not free to maintain |
| 17:37 | turbofail | it's sometimes useful to know how many elements in the set are less than / greater than some element |
| 17:37 | TimMc | Maybe some kind of sorted tree would be good? |
| 17:37 | clojure-newb | I'm not going to insert anything into my collection once I have retrieved it the first time |
| 17:37 | clojure-newb | I just need the position an item is at |
| 17:38 | turbofail | sure you could use a vector and then do a binary search |
| 17:38 | turbofail | in that case |
| 17:38 | clojure-newb | (.indexOf (vec ss) #inst "2013-01-21T20:30:06.437-00:00") ? |
| 17:38 | clojure-newb | or is that not going to preserve order necessarily once I convert to a vector ? |
| 17:38 | TimMc | amalloy: You can then look at that position and check if it has the thing you're looking for. |
| 17:38 | turbofail | or even a linear search if you don't really care |
| 17:39 | amalloy | TimMc: sorted sets aren't nthable quickly |
| 17:39 | turbofail | amalloy: if you're using a balanced tree and keep counts at each node, then they are |
| 17:40 | amalloy | sure, you can basically implement finger trees |
| 17:41 | turbofail | no it's way simpler than a finger tree |
| 17:41 | TimMc | Are finger-trees sorted? |
| 17:42 | turbofail | it's basically exactly the same as a normal search tree, except there's an extra "count" attribute |
| 17:43 | turbofail | er. well i guess that's one variety of finger tree |
| 17:44 | turbofail | minus the amortized constant time business |
| 17:58 | jcromartie | should I not use assert in dosync? |
| 17:58 | jcromartie | like, (dosync (assert some-precondition) (alter …)) |
| 18:00 | jcromartie | hm, I see, assertions are not covered by try/catch are they? |
| 18:00 | jcromartie | er |
| 18:00 | jcromartie | I mean (catch Exception ... |
| 18:00 | jcromartie | because they aren't Exceptions |
| 18:01 | alandipert | jcromartie: the macro expands into something that throws a java.lang.AssertionError |
| 18:01 | jcromartie | yeah |
| 18:02 | alandipert | you're not finding that catchable? |
| 18:02 | jcromartie | I see what's happening… the code that I'm expecting to catch my assertions is not, becuase it's doing (catch Exception e …) |
| 18:02 | jcromartie | and that won't catch an assertion error |
| 18:02 | jcromartie | silly |
| 18:02 | jcromartie | or should I not be using assertions? |
| 18:02 | alandipert | or you can catch Throwable t instead |
| 18:03 | jcromartie | yeah, this is a library |
| 18:03 | jcromartie | I'll put in a pull request at least |
| 18:03 | alandipert | ah, bummer |
| 18:07 | ravster | hello all |
| 18:08 | ohpauleez | hello |
| 18:26 | seangrove | Is it a good idea to create a bunch of function name from an array of strings? |
| 18:26 | seangrove | I'm wrapping the mailchimp api, and I'd like to have them available as "real" functions that can be tab-completed in the repl |
| 18:27 | jcromartie | somebody help me see Compojure exceptions in nREPL please! |
| 18:27 | jcromartie | it's a total silent death |
| 18:28 | muhoo | jcromartie: http://github.com/kenrestivo/firealarm ? |
| 18:30 | Raynes | muhoo: Is that noir specific? |
| 18:30 | alandipert | seangrove: i say go for it! |
| 18:30 | jcromartie | muhoo: it's a bit specific… not too general purpose |
| 18:31 | jcromartie | but thanks for the tip |
| 18:31 | muhoo | Raynes: nope |
| 18:31 | jcromartie | I can see the stacktraces in "lein repl" |
| 18:31 | jcromartie | but not in nREPL from Emacs |
| 18:31 | Raynes | muhoo: You might want to not mention noir in the readme. |
| 18:31 | Raynes | muhoo: Oh, never mind. |
| 18:31 | muhoo | Raynes: thanks, i should edit that. |
| 18:31 | Raynes | I could have swore I read something that implied it was noir specific. |
| 18:32 | muhoo | it's just a middleware, works with ring or anything |
| 18:32 | muhoo | i wrote it to deal with noir, originally, yes. |
| 18:32 | Raynes | Yeah, but you've updated the README to mention compojure and stuff too. |
| 18:32 | Raynes | So it's fine. |
| 18:32 | Raynes | You could remove the Noir stuff if you wanted to though, since Noir is deader than Elvis. |
| 18:33 | muhoo | elvis is not dead! |
| 18:36 | jcromartie | ugh this is insane |
| 18:36 | jcromartie | so I've got my handler wrapped in middleware that catches exceptions |
| 18:37 | jcromartie | first exception: OK, returns 500 and an error, I see the stacktrace I expect |
| 18:37 | jcromartie | now the same HTTP request yields no response at all, and a DIFFERENT stacktrace in the log |
| 18:37 | jcromartie | then the next (same again) request yields no response, and NO stacktrace in the log |
| 18:38 | muhoo | jcromartie: i forsee hours of bisecting in your future. |
| 18:38 | jcromartie | yeah |
| 18:39 | jcromartie | this is the stacktrace I get in "lein repl" (invisible in nREPL in Emacs) |
| 18:39 | jcromartie | https://gist.github.com/jcromartie/721501a9369ccc996791 |
| 18:39 | muhoo | ok, stacktraces caused by web failures won't show up in nrepl or emacs, normally. that's why i wrote firealarm. |
| 18:39 | jcromartie | yes, and thanks for that :) |
| 18:39 | jcromartie | I'm working on that aspect |
| 18:39 | muhoo | i have firealarm dump the errors, and then i open the buffer in emacs, and auto-revert-mode it |
| 18:40 | jcromartie | but this is weirder than just that |
| 18:40 | jcromartie | you see that at clojure.stacktrace$print_trace_element.invoke(stacktrace.clj:30) |
| 18:40 | muhoo | maybe your stacktrace handler is stacktracing |
| 18:41 | jcromartie | it is |
| 18:41 | jcromartie | it's clojure.stacktrace |
| 18:41 | muhoo | always wonderd how people debug debuggers. |
| 18:47 | jcromartie | glargbh |
| 18:47 | jcromartie | somebody save me before I got back to Rails |
| 18:57 | amalloy | muhoo: same way you compile compilers |
| 18:57 | jcromartie | I have to make a new project and try to narrow this down |
| 18:58 | amalloy | jcromartie: i can't stand clojure.stacktrace, for exactly this reason: a debugging tool that doesn't *always* work is unacceptable |
| 18:58 | jcromartie | the same thing happened with clj-stacktrace |
| 19:00 | amalloy | yep. can't abide any of them |
| 19:01 | jcromartie | amalloy: so… what do you use? |
| 19:01 | amalloy | java stacktraces? |
| 19:01 | jcromartie | ah |
| 19:01 | jcromartie | that would work |
| 19:01 | jcromartie | but they print to stderr, have to do some stuff to capture them eh |
| 19:02 | amalloy | http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html#printStackTrace(java.io.PrintStream) |
| 19:03 | amalloy | i generally just look at stderr myself, but you can have an exception print to wherever you want |
| 19:09 | jcromartie | this is so weird, it's like it gets stuck |
| 19:15 | mrowe | evanb: matt suggested 'smbpasswd -r win.int.realestate.com.au -U <username>' |
| 19:15 | mrowe | doh, wrong channel sorry |
| 19:16 | jcromartie | I think it's this one exception… |
| 19:16 | jcromartie | ,(re-seq #"" nil) |
| 19:16 | seangrove | I'm having a hard time un-quoting this macro properly: https://www.refheap.com/paste/11627 |
| 19:16 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 19:16 | jcromartie | for some reason this blows up on me |
| 19:17 | hyPiRion | ,(re-seq #"" "") |
| 19:17 | clojurebot | ("") |
| 19:17 | hyPiRion | ,(re-seq #"" "abc") |
| 19:17 | clojurebot | ("" "" "" "") |
| 19:17 | jcromartie | I'm not trying to make re-seq work |
| 19:17 | jcromartie | I'm trying to figure out the invisible stacktrace of doom |
| 19:17 | hyPiRion | oh |
| 19:17 | seangrove | The current eval-and-unpack is there from a bunch of different tweaks, not necessarily supposed to work |
| 19:18 | jcromartie | this is output in my REPL https://gist.github.com/jcromartie/4753cd3304f340ea8b66 |
| 19:18 | jcromartie | what the flying heck |
| 19:20 | ivan | try passing something other than nil? |
| 19:20 | ivan | (pst) will get you a real traceback |
| 19:20 | jcromartie | user=> (re-seq #"" 0) |
| 19:20 | jcromartie | ClassCastException java.lang.Long cannot be cast to java.lang.CharSequence clojure.core/re-matcher (core.clj:4286) |
| 19:21 | jcromartie | not with this :) ivan |
| 19:21 | seangrove | Ah, I see my problem, I need to pass in the array directly |
| 19:21 | jcromartie | try it: (re-seq #"" nil) (pst) |
| 19:21 | ivan | ,(doc re-seq) |
| 19:21 | clojurebot | "([re s]); Returns a lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), each such match processed with re-groups." |
| 19:21 | seangrove | jcromartie: https://www.refheap.com/paste/11629 |
| 19:22 | jcromartie | I KNOW HOW TO USE re-seq! |
| 19:22 | jcromartie | it's about the mystery invisible stacktrace |
| 19:22 | ivan | I see what seangrove sees |
| 19:23 | seangrove | jcromartie: Chill out |
| 19:23 | seangrove | I pasted the stacktrace I see for you |
| 19:23 | Apage43 | huh |
| 19:24 | Apage43 | I get the invisible one after I run the same thing ~15 times |
| 19:24 | Apage43 | maybe it's a JIT thing? |
| 19:24 | seangrove | Ah, same here after several attemps |
| 19:24 | Apage43 | https://www.refheap.com/paste/11630 |
| 19:27 | Apage43 | https://www.refheap.com/paste/11631 |
| 19:27 | Apage43 | also with (inc nil) |
| 19:27 | Apage43 | feels like a JIT thing |
| 19:28 | seangrove | Sounds right |
| 19:28 | ivan | -XX:+PrintCompilation to see what gets compiled when it starts breaking |
| 19:30 | ivan | I can't repro with 64-bit jdk7u13, Clojure 1.5 RC16, -server |
| 19:33 | ivan | okay, I see it with 1.4 and 1.5RC16 on Ubuntu, default lein repl |
| 19:36 | ivan | jcromartie: this looks like a -XX:+TieredCompilation bug (which lein sadly sets by default), if you add :jvm-opts [] to your project.clj it will work |
| 19:36 | amalloy | seangrove: that looks like a macro that meant to be a function |
| 19:43 | ivan | when I was looking at JIT activity with TieredCompilation enabled a week ago, I knew it was bound to be buggier than just the -server compiler, but I am surprised to find my suspicions confirmed so soon |
| 19:55 | ivan | jcromartie: in case you missed it <ivan> jcromartie: this looks like a -XX:+TieredCompilation bug (which lein sadly sets by default), if you add :jvm-opts [] to your project.clj it will work |
| 19:56 | jcromartie | ivan: ah! Thank you… that's really crazy |
| 19:56 | jcromartie | what's that all about anyway? |
| 19:56 | jcromartie | (I'm reading up on it) |
| 19:57 | ivan | see "Starting from early versions of JDK 6" https://gist.github.com/rednaxelafx/1165804 |
| 19:59 | jcromartie | ah ha… so the JIT must optimize out the failing code and never even run it? or something like that? |
| 20:01 | jcromartie | thanks guys, that was going to ruin my day |
| 20:01 | jcromartie | because it was actually masking other errors |
| 20:02 | jcromartie | so when things freak out and are not predictable like this, suspect JIT? |
| 20:02 | jcromartie | because yeah, (inc nil) should be pretty darn predictable :P |
| 20:03 | frozenlock | Is there a tutorial on how to publish documentation to github? codox + gh-pages? |
| 20:03 | Apage43 | jcromartie: or at least, when something that should have no state seems to change behavior over time |
| 20:03 | jcromartie | yeah |
| 20:04 | Apage43 | especially if it's a pattern like we saw where the behavior seems to change after doing it some number of times |
| 20:06 | jhulten_ | heyall |
| 20:07 | Apage43 | also if you see the pattern we have here where the behavior change seems to happen in related stuff that shares no state |
| 20:08 | Apage43 | that is, if you play with it, you'll see that once (inc nil) starts having [trace missing], so does (+ 1 nil) |
| 20:08 | Apage43 | and once (re-seq #"" nil) starts having [trace-missing], so does (re-matches #"" nil) |
| 20:17 | frozenlock | weavejester: codox-> "Could not generate documentation for my-project.core" Could you give me a hint as to what might be causing this? |
| 20:18 | weavejester | Frozenlock: Usually that means it can't load the namespace, i.e. that there's a syntax error or something. |
| 20:20 | frozenlock | weavejester: ah! Indeed, my repl fails to restart. Thanks :) |
| 20:57 | yogthos | weavejester: I noticed that when you add or remove routes sometimes they don't get picked up without having to restart, is there a pattern to what causes that? |
| 20:58 | weavejester | yogthos: Which version of lein-ring are you using? |
| 20:58 | yogthos | weavejester: ah I haven't noticed it recently, is it something that got fixed? :) |
| 20:59 | yogthos | weavejester: I remember it happening with 0.8 believe |
| 20:59 | weavejester | There have been a fair few bug fixes. Also I need to make a new release of ns-tracker, which might help solve things. |
| 21:00 | yogthos | weavejester: ah ok I'll try pay attention if I notice it and under what conditions next time |
| 21:00 | yogthos | weavejester: I noticed that it's most likely to get out of sync if there's any compilation errors |
| 21:07 | seangrove | Hey all, I have to deal with tons of different api's (~30 right now), all of which give more or less similar data, but screwed up enough to make it painful. |
| 21:08 | seangrove | I'm wondering about declarative approaches to data normalization |
| 21:09 | sshack | Two questions. Is anyone working on better error messages for clojure? |
| 21:09 | seangrove | Just in case anyone has any experience or thoughts on how to make normalization less painful and eye0gougingly ugle |
| 21:09 | sshack | and second, with is wrong with this? http://pastebin.com/VknAVVgn |
| 21:09 | Iceland_jack | sshack: Read the assertion message |
| 21:10 | Iceland_jack | Exception in thread "main" java.lang.AssertionError: Assert failed: (vector? (:dependencies project [])) |
| 21:10 | sshack | Yes, I have. One of the dependencies isn't a vector. |
| 21:10 | ravster | should I just use log4j or is the slf4j abstraction worth it? |
| 21:10 | seangrove | sshack: probable best to paste on refheap as well |
| 21:11 | seangrove | If just for the ease of scanning for others |
| 21:11 | ravster | I'm new to logging, so I don't know how complicated things could get |
| 21:11 | sshack | seangrove: That's much easier to read, yes |
| 21:11 | sshack | https://www.refheap.com/paste/11632 |
| 21:14 | sshack | seangrove: Any help? |
| 21:15 | seangrove | sshack: Looking... |
| 21:15 | sshack | Thanks. I'm missing something obvious. i'm sure. |
| 21:16 | seangrove | No, just a google |
| 21:16 | sshack | ? |
| 21:17 | sshack | The only changes I made were adding some depdenencies, and adding speclj. |
| 21:17 | seangrove | Update lein-ring to 0.8.2 |
| 21:17 | seangrove | Try it, anyway.. |
| 21:18 | sshack | Well that works. |
| 21:18 | weavejester | sshack: That error indicates that you have Lein 2.0.0 final, but some dependency is pulling in an old version of lein-jacker |
| 21:18 | seangrove | Yeah, looks like a problem with lein-jacker |
| 21:18 | seangrove | Beat by a few milliseconds |
| 21:19 | sshack | weavejester: Okay. So I should double down on my question. Is anyone working on clear error messages? |
| 21:19 | weavejester | Clear error messages for what? |
| 21:19 | seangrove | The error message was right... |
| 21:20 | weavejester | I mean, it's not a straightforward problem, because an error is, by its nature, something unexpected. |
| 21:20 | sshack | The error message was accurate. But not helpful. |
| 21:21 | weavejester | A better error message would require some prescience on behalf of the library writer |
| 21:21 | brehaut | lein-pedantic might catch the multiple versions of the same lib as a general problem? |
| 21:21 | seangrove | Well, a better response would be, what would have wanted it to say sshack ? |
| 21:21 | weavejester | The author of lein-jacker would need to know that the way dependencies are presented would change. |
| 21:21 | brehaut | ( https://github.com/xeqi/lein-pedantic ) |
| 21:22 | ambrosebs | I'm trying to track down a weird bug with Trammel. Could someone confirm that `mvn test` fails with an assertion error in this project? https://github.com/frenchy64/mvn-test |
| 21:22 | technomancy | weavejester: alternatively: time travel |
| 21:22 | ambrosebs | Not sure if it's just my config. |
| 21:22 | sshack | weavejester: That's part of what I'm getting at useful error messages and debugging tools are a very difficult task. |
| 21:22 | weavejester | In this case, the best error message would be "Lein-Ring 0.7.5 uses a version of Lein-Jacker that is incompatible with Lein 2.0.0's data structure" |
| 21:23 | weavejester | But that would require knowing that Lein's dependencies would change |
| 21:23 | sshack | I might have liked "This isn't the data structure I was expecting. I got foo, but was expecting something like bar" |
| 21:23 | technomancy | it's probably safe to drop leinjacker at this point, right? users of lein1 can just use older versions of a given plugin |
| 21:24 | technomancy | it seems unreasonable to refuse to upgrade Leiningen but demand newer plugins |
| 21:24 | weavejester | technomancy: Well, in this case it was an old plugin that didn't work with the new version of Lein. |
| 21:25 | weavejester | I mean, we could be very explicit about version numbers; i.e., plugin x.y.z will *only* work with Lein x.y.z |
| 21:25 | weavejester | But that would require way too much work, on both the library developer, and the people maintaining the deps |
| 21:26 | weavejester | If people adopted perfect semantic versioning it might work |
| 21:26 | technomancy | yeah, we have a min-lein-version, but no max-lein-version |
| 21:26 | technomancy | even that's for projects, not plugins |
| 21:26 | weavejester | But again, that tends to be tricky to do flawlessly. |
| 21:26 | weavejester | I think it's just a difficult problem to solve for all cases. |
| 21:27 | ravster | I'm trying to get tools.logging installed. lein deps is saying it can't find javax.jms, com.sun.jmx and com.sun.jdmk. is there somewhere else I could find these? |
| 21:27 | ravster | ... on maven.org and clojars.org |
| 21:28 | weavejester | Although… I wonder if one could make a function that looks up an error message in a remote DB. So common error messages could have an explanation. There would need to be some fuzzy matching, of course... |
| 21:30 | sshack | weavejester: Like old mainframe error message manuals? |
| 21:31 | sshack | Error: 3444 " -> walk to library and lookup error. |
| 21:31 | weavejester | Maybe. I don't know if it's a good idea. |
| 21:31 | rationalrevolt | , |
| 21:31 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 21:32 | rationalrevolt | ,(Math/signum 5) |
| 21:32 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: signum> |
| 21:32 | sshack | If there's a way for that knowledge to get back into the tool, it's an excellent idea. If it ends up as yet another disjoint repository of incomplete knowledge, not so much. |
| 21:32 | rationalrevolt | can someone tell me why this doesn't work? |
| 21:33 | brehaut | ,(Math/signum 5.0) |
| 21:33 | clojurebot | 1.0 |
| 21:33 | brehaut | ,(Math/signum (double 5)) |
| 21:33 | clojurebot | 1.0 |
| 21:33 | rationalrevolt | alright |
| 21:34 | brehaut | rationalrevolt: look at the typesig; it takes specifically a float or a double, not any number shaped thing |
| 21:34 | brehaut | (http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html) |
| 21:35 | rationalrevolt | yup - this is because autoboxing doesnt apply on reflection invokes? |
| 21:35 | brehaut | that is not autoboxing; thats type coercion |
| 21:36 | rationalrevolt | sorry, right |
| 21:37 | brehaut | ,(Math/signum (Double. 1.0)) |
| 21:37 | clojurebot | 1.0 |
| 21:37 | brehaut | the autoboxing works find |
| 21:37 | brehaut | fine |
| 21:38 | tomoj | "Normally, as a Clojure open source developer, you just don't walk into the Oracle office, but we invited her over anyway and told the infrastructure orcs to stay under their desks" |
| 21:38 | tomoj | https://blogs.oracle.com/nashorn/entry/clojurescript_repl_if_you_build |
| 21:38 | jcromartie | http://www.quickmeme.com/meme/3t3c6d/ |
| 21:38 | rationalrevolt | hmm, now i'm confused - doesn't clojure treat numbers are Doubles automatically? |
| 21:39 | rationalrevolt | sorry! |
| 21:39 | rationalrevolt | got it |
| 21:39 | brehaut | rationalrevolt: im pretty sure that since 1.2 or 1.3 clojure used primative numbers by default |
| 21:39 | rationalrevolt | I was confusing the double signature as a long |
| 21:43 | rationalrevolt | hmm, why doesn't type coersion apply in this case? |
| 21:44 | frozenlock | weavejester: I need your help, again... Following this https://github.com/weavejester/codox/wiki/Deploying-to-GitHub-Pages, I get this error "error: pathspec 'gh-pages' did not match any file(s) known to git." when trying `git checkout gh-pages'. :( |
| 21:45 | weavejester | Frozenlock: You ran through all the instructions, right? |
| 21:45 | weavejester | Frozenlock: Especially git symbolic-ref HEAD refs/heads/gh-pages |
| 21:45 | frozenlock | yes |
| 21:45 | frozenlock | Copy paste. Exaaaactly as it is. |
| 21:46 | weavejester | What's your git version? |
| 21:46 | frozenlock | 1.7.9.5 |
| 21:46 | weavejester | Similar to mine. I'm not sure what went wrong except some kind of typo |
| 21:47 | weavejester | I've run those instructions quite a few times without issue, and they're essentially taken from GitHub's own official instructions |
| 21:48 | frozenlock | hmm.. perhaps eshell is playing some tricks behind my back then. I'll try directly in my terminal. |
| 21:48 | weavejester | Although, it looks like the latest GitHub instructions have changed |
| 21:48 | weavejester | https://help.github.com/articles/creating-project-pages-manually |
| 21:48 | weavejester | git checkout --orphan gh-pages |
| 21:48 | weavejester | Seems to be the new |
| 21:48 | weavejester | git symbolic-ref HEAD refs/heads/gh-pages |
| 21:48 | weavejester | It probably does exactly the same thing behind the scenes, though. |
| 23:40 | seangrove | Hrm, what's usually the problem if korma can't connect to postgres locally, while psql and rails are just fine? |
| 23:40 | seangrove | I'm getting "CannotAcquireResourceException" |
| 23:44 | arohner | seangrove: can you gist the whole stacktrace? |
| 23:45 | seangrove | Sure, one second |
| 23:45 | seangrove | https://www.refheap.com/paste/11638 |
| 23:47 | seangrove | The server seems to be running on the default port, accepting connections from localhost (either with or without a user/pass combo) |
| 23:49 | amalloy | seangrove: that's not the stacktrace |
| 23:49 | seangrove | That's the entire output |
| 23:51 | seangrove | Ah, hold on |
| 23:51 | seangrove | Restarted the process to try again... https://www.refheap.com/paste/11639 |