2013-03-06
| 00:00 | TimMc | dcolish: futures implement j.u.c.Future |
| 00:01 | dcolish | ok thats what i thought |
| 00:01 | adu | what does j.u.c stand for? |
| 00:01 | dcolish | java.util.concurrent |
| 00:01 | adu | ah |
| 00:02 | dcolish | althought it looks like future does a dispatch to some thread pool or executor too |
| 00:03 | TimMc | ~j.u.c. |
| 00:03 | clojurebot | excusez-moi |
| 00:03 | TimMc | Raynes: You can make it up to me by explaining how clojure.core/promise gets away with only implementing one arity of invoke for IFn. |
| 00:04 | Raynes | *shrug* |
| 00:04 | dcolish | ah it submits to an actor |
| 00:04 | dcolish | having the source in the docs is a nice feature |
| 00:05 | dcolish | i've wanted that in javadoc over xrefs |
| 00:08 | dcolish | its too bad clojure-guava only wraps the guava collections |
| 00:09 | TimMc | Raynes: I guess the JVM allows instances of classes that have abstract methods, even though Java doesn't. |
| 00:14 | amalloy | TimMc: i think java allows you to use instances of such classes too, just not compile them |
| 00:14 | TimMc | amalloy: Create them via reflection? Sure. |
| 00:15 | TimMc | But I would be surprised if you could link against them. |
| 00:15 | amalloy | TimMc: well, i meant "invoke methods on them when passed them from somewhere else", but i think that's actually a pretty silly distinction |
| 00:17 | TimMc | I'm not even sure how to look this up or test it out. |
| 00:17 | TimMc | (The linking question.) |
| 00:18 | TimMc | ,((promise) 1 2) |
| 00:18 | clojurebot | #<AbstractMethodError java.lang.AbstractMethodError: clojure.core$promise$reify__6354.invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;> |
| 00:21 | dcolish | hmm, i think the jvm will enforce instantiation of abstract classes |
| 00:21 | dcolish | its one of the access flags for the class file format |
| 00:29 | amalloy | TimMc: https://www.refheap.com/paste/9ed6c6cdbad1b47596d9be371 compiles fine, and runs fine with java -cp .:clojure.jar tmp.core - there's no special "clojure-specific" linking going on at that point, just the jvm linking with a .class file that claims to implement j.u.List but doesn't have all the methods |
| 01:00 | technomancy | clojurebot: java.util.concurrent? |
| 01:00 | clojurebot | java.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c." |
| 01:00 | technomancy | better late than never, eh |
| 01:00 | jeremyheiler | That's great. |
| 01:01 | technomancy | I stole it from Ted Nyman |
| 01:01 | dcolish | amalloy: neat |
| 01:02 | technomancy | there's also a version that goes "When I find myself in times of trouble / Col. Sanders comes to me / Cooking breasts of chicken / K.F.C." but that one is less relevant to this channel |
| 01:03 | jeremyheiler | technomancy, I went to Oswego, so it makes me laugh because it's so true. |
| 01:04 | technomancy | oswego? |
| 01:04 | jeremyheiler | Sorry. Doug Lea teaches at Oswego. |
| 01:04 | technomancy | oh, nice |
| 01:05 | jeremyheiler | I stayed an extra semester so I could take is Parallel Computing class. Worth every dime. |
| 01:05 | jeremyheiler | his* |
| 01:05 | technomancy | he may not be aware that he has a copyright-infringing theme song, but maybe you can advise him of the fact the next time you visit your alma mater |
| 01:06 | technomancy | huh: http://gee.cs.oswego.edu/dl/html/jcp22oct10.html |
| 01:06 | jeremyheiler | haha |
| 01:06 | jeremyheiler | oh, yeah, that was interesting |
| 01:07 | technomancy | go openjdk |
| 01:09 | jeremyheiler | yea seriously |
| 01:11 | technomancy | rockin' stache too |
| 01:11 | jeremyheiler | usually has the full Einstein look. |
| 01:15 | jeremyheiler | it's funny. he once said he ' |
| 01:15 | jeremyheiler | "programs in java-ese and then translate it into java so we all can understand it" |
| 01:16 | jeremyheiler | speaking about juc of course. |
| 02:26 | noidi | ambrosebs, it doesn't work for me now either. somehow it did work for me on monday, which is odd. maybe I had my repl in some weird state that made it work :) |
| 02:27 | ambrosebs | noidi: It should be easy to support, probably just needs a flag that says which namespaces are currently being checked. |
| 02:28 | noidi | that would be nice |
| 02:28 | noidi | otherwise you'd need a unit test running check-ns for each namespace to get automatic type checking |
| 02:29 | ambrosebs | noidi: namespace management is also something that's lacking. |
| 02:29 | ambrosebs | I might include a "typed-ns" macro which names dependencies and automatically has check-ns invoked in its mexpansion. |
| 02:31 | noidi | so you'd use typed-ns instead of ns? |
| 02:31 | ambrosebs | Um, probably not. |
| 02:31 | ambrosebs | I was thinking of both. |
| 02:31 | ambrosebs | Might not be the best idea. |
| 02:31 | amalloy | you can't really avoid having ns |
| 02:31 | ambrosebs | kinda. |
| 02:31 | noidi | yeah, that's what I thought |
| 02:32 | noidi | you'd still have to get a hold of the custom ns-replacement somehow :) |
| 02:33 | ambrosebs | perhaps you could provide leiningen with which namespaces should be type checked. |
| 02:36 | ambrosebs | There's also some interesting contract wrapping that could be done. I basically want all references to a particular var untyped.ns/foo from a namespace typed.ns to be wrapped in a particular contract. But it does not affect other namespaces. Any ideas? |
| 02:37 | ambrosebs | Maybe the easiest would be to create a new def typed.ns/foo which is untyped.ns/foo wrapped in a contract. |
| 02:38 | noidi | so you'd use the typed-ns macro to rewrite typed code (to add contracts, etc.)? |
| 02:39 | ambrosebs | Something along those lines. We don't really need the ns macro, just provide a typed-require. |
| 02:39 | ambrosebs | Two ns macros kinda sucks. |
| 02:47 | noidi | maybe the contract checking should happen on the caller side. then it would also work when calling functions passed in as arguments. |
| 02:48 | noidi | otherwise untyped code could call typed code and pass in a function with the wrong contract |
| 03:42 | dEPy | What is reify in clojure? O_ô |
| 03:47 | illiux | DEPy: It creates an instance of an anonymous type |
| 03:48 | illiux | err dEPy |
| 03:50 | dEPy | am, naonymous type is what? like an interface? |
| 03:52 | tsdh | Is there a way to define the order of execution of deftests in a test file when run by "lein test"? It seems the order is arbitrary. |
| 03:53 | Foxboron | ambrosebs: yeah i have. Interesting tbh. But i don't really know how the whole type system works, so kinda unknown territory ^^ |
| 03:56 | ambrosebs | Foxboron: Well if you feel it might be useful, I've started some tutorials http://clojure-doc.org/articles/ecosystem/core_typed/home.html |
| 04:06 | illiux | dEPy: Not an interface, but closely related. riefy you provide implementation methods for a set of protocols and interfaces, it returns and instance of the type defined by that implementation. |
| 04:06 | illiux | *an instance |
| 04:21 | ciphergoth | Inside a running web server process (Aleph) I want to poll for something every second. Is the right thing to fork off a thread that calls (Thread/sleep 1000) after every poll? |
| 04:23 | mpenet | ciphergoth: use scheduled executors in j.u.c |
| 04:24 | mpenet | or is it tied to the requests/responses? (ex: long polling) |
| 04:24 | ciphergoth | As a server, we allow our clients to long poll so they don't have to worry about this sort of nonsense. Sadly the services we're using don't offer that. |
| 04:25 | ciphergoth | hmm, https://github.com/overtone/at-at |
| 04:25 | mpenet | ok, so java.util.concurrent or a wrapper ex: https://github.com/mpenet/knit#scheduledfuture |
| 04:25 | mpenet | or at-at yes |
| 04:27 | ciphergoth | I'm strongly influenced in my choice of library by things like nice colours in the README.md and the words "build:passing" after the name :) |
| 04:27 | mpenet | :) |
| 04:27 | ciphergoth | they tend to correlate with being the good library! |
| 04:27 | ciphergoth | it's not quite as shallow as it seems! |
| 04:27 | mpenet | well the tests in knit are weak, but it works (I am using it in a few libs in production) |
| 04:27 | mpfundstein | are you guys using classes in clojure? |
| 04:29 | clgv | mpfundstein: deftypes and records when needed |
| 04:29 | mpenet | at-at should be just as good, it's just a different api, matter of personal preference |
| 05:23 | mpfundstein | can i somehow pass a sequence like this as an argument to assoc? (:id 33333 :time 1362565416258 :priority 3 :action "hehe" :args nil :group nil) |
| 05:24 | Kototama | mpfundstein: (apply assoc m s) |
| 05:24 | mpfundstein | Kototama: thx |
| 05:24 | Kototama | mpfundstein: see also (merge |
| 05:49 | augustl | with clojure.xml/parse, is it possible to manually specify encoding? We get an utf-8 encoded file but the xml file says its encoding is utf-16 so parsing fails |
| 06:34 | squidz | does anybody know what my javascript file is being read in as a html document? I am using compojure with clostache. I have two <script type="text/javascript" src="..."></script> calls. The first refers to a url which loads fine. The second call refers to a js file in my resources/public folder. I also added (route/resources "/") to my defroutes |
| 06:35 | squidz | I am getting a 404 not found while trying to load the second local js file |
| 06:39 | faust45 | squidz: you can use firebug to debug your app |
| 06:41 | squidz | faust: yes I think it is a problem with my setup on the compojure side. I now see that I might have to specify the resources-path in my project.clj |
| 06:43 | squidz | maybe not |
| 06:51 | squidz | okay when I change my route addresses that preced my (resources "/") call then it works. I just changed a previous GET call from (GET "/p" [] (page-call)) to (GET "/" [] (page-call)). Can anybody explain why this affected my (route/resources ...) call? |
| 06:57 | faust45 | squidz: i think this kind of questions you can debug by self |
| 07:01 | squidz | faust45: Yeah, I already have it solved, but I should state my solution, and out of curiosity ask to get a deeper understanding |
| 07:46 | justinleitgeb | rubygems |
| 09:01 | TimMc | amalloy_: (java.lang.reflect.Modifier/isAbstract (.getModifiers (class (reify java.util.List (size [this] 10))))) -> false |
| 09:02 | TimMc | amalloy_: The question, is what would *javac* do upon encountering such a class file that a .java file was referencing. I know the JVM itself is all hunky-dory with it. |
| 09:03 | TimMc | Is there some way I can persist a runtime class object to disk as a .class? |
| 09:08 | jcidaho | hi - anyone using elastisch or clj-elasticsearch - am wondering if either of these give the ability to limit the fields that come back from es, using http://www.elasticsearch.org/guide/reference/api/search/fields.html... |
| 09:43 | clgv | TimMc: yes set *compile-files* to true |
| 10:01 | fbernier | How could I split a sorted-map into two collection of keys and values while keeping the order |
| 10:01 | clgv | fbernier: do `keys` and `vals` not work? |
| 10:03 | fbernier | clgv: no, they return a hash which is not guaranteed to keep the order |
| 10:04 | fbernier | user=> (keys {:a 1 :b 2 :c 3}) |
| 10:04 | fbernier | (:a :c :b) |
| 10:05 | rplaca | fbernier: that's not a sorted map |
| 10:05 | clgv | ,(keys (sorted-map :a 1 :c 3 :b 2)) |
| 10:05 | clojurebot | (:a :b :c) |
| 10:06 | clgv | ,(vals (sorted-map :a 1 :c 3 :b 2)) |
| 10:06 | clojurebot | (1 2 3) |
| 10:06 | fbernier | sweet |
| 10:06 | fbernier | thanks |
| 10:28 | jcromartie | so I found a very simple solution to the "no println output when running a compjure server in Emacs/nREPL" problem |
| 10:29 | jcromartie | simply wrap your handler with bound-fn when starting Jetty... |
| 10:29 | jcromartie | now what are the potential problems with this? |
| 10:40 | jtoy | can anyone point me to a webpage that explains how to interpret this or can someone explain it to me: [& {:keys [file user]}] |
| 10:40 | jtoy | that is options for a function i see |
| 10:41 | andreaslundahl | jtoy: http://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring) |
| 10:42 | mikerod | jtoy: Another link I like for clojure destructuring is http://blog.jayfields.com/2010/07/clojure-destructuring.html |
| 10:44 | jtoy | thanks |
| 10:51 | deg | I've just moved from Clojure 1.4 to 1.5, and the (pst) function seems to have disappeared?? |
| 10:51 | lazybot | deg: Uh, no. Why would you even ask? |
| 10:52 | aroemers | heh, there's your answes :) |
| 10:52 | aroemers | *answer |
| 10:52 | deg | ?? Why did Lazybot trigger on that line? |
| 10:53 | aroemers | Just randomly |
| 11:08 | rahcola | anyone around who knows about the internals of nrepl? |
| 11:13 | jtoy | how do I create a sequence with one item in it? (map ( fn[x] '(x)) [1 2 3]) doesnt seem t owork |
| 11:13 | llasram | jtoy: ##(map vector [1 2 3]) |
| 11:13 | lazybot | ⇒ ([1] [2] [3]) |
| 11:16 | jtoy | llasram: i think i need an actual seq, im testing now though |
| 11:17 | llasram | &(seq? [1]) |
| 11:17 | lazybot | ⇒ false |
| 11:17 | llasram | Oh, heh |
| 11:17 | mpfundstein | i love clojure |
| 11:17 | mpfundstein | period |
| 11:17 | llasram | jtoy: Then ##(map list [1 2 3]) |
| 11:17 | lazybot | ⇒ ((1) (2) (3)) |
| 11:17 | gtrak | ,(seq [1]) |
| 11:17 | clojurebot | (1) |
| 11:18 | llasram | Yeah. Vectors are seqable, but don't directly implement ISeq (apparently) |
| 11:18 | gtrak | quoting doesn't work because it quotes what's inside the s-exp |
| 11:19 | gtrak | does the :parent key in a lein2 project map have practical use in a multi-module project? How would I go about doing something like that? |
| 11:22 | jtoy | parenedit vim question, if I am at the |: [|(re-pattern x)] , how do I add parens so it becomes: ( [(re-pattern x)] ) |
| 11:34 | gadget | jtoy: i put my cursor over the left bracket and type <leader>W( |
| 11:39 | gadget | jtoy: sorry, i should have typed it out first before respondign. you can either do <leader>W or <leader>w( |
| 11:39 | jtoy | gadget: cool, im still learning paredit |
| 11:40 | babilen | Speaking of paredit ... Is there a nice cheat sheet somewhere? |
| 11:40 | spligak | Making a request using clj-http with :throw-exceptions false and :as :json, when the response would normally throw an exception (say, status 400+), it doesn't honor the :as :json and decode the body. Anyone else experience this? |
| 11:41 | spligak | I don't mind decoding the body manually, just seemed odd. |
| 11:41 | ToBeReplaced | babilen: first google result http://emacswiki.org/emacs/PareditCheatsheet |
| 11:41 | jtoy | gadget: that only puts around the current symbol, that doesnt go around the whole piece im trying to add it around, do I then just need to move it manually? |
| 11:43 | babilen | ToBeReplaced: ... for vim (as was previously discussed) |
| 11:44 | gadget | jtoy: i'm not sure i understand, you wanted it to look like ([(re-pattern x)]) right? what does it look like to you after wrapping it in the extra parens? |
| 11:44 | babilen | ToBeReplaced: sorry, I should have stated that more clearly rather than relying on the assumptions that people will interpret that question in the context of the ongoing conversation |
| 11:45 | gadget | babilen: i just use the paredit.txt file in the ./vim/bundle/paredit-0.9.7/doc directory |
| 11:45 | gadget | if you're using pathogen that's where it would be at least |
| 11:46 | babilen | gadget: yeah, sure. I can read that easily with ":help paredit.txt", but Emacs' paredit has a very helpful cheatsheet that might have been translated for the vim version already |
| 11:46 | gadget | babilen: oh sorry i don't know of one |
| 11:46 | babilen | gadget: Take a look at the cheat sheet ToBeReplaced linked earlier and you might realise how that comes in handy during the initial learning period |
| 11:46 | NeedMoreDesu | I'm still interested in hot code swapping on .class/.jars. Any help would be appreciated. |
| 11:50 | NeedMoreDesu | http://stackoverflow.com/questions/15145721/clojure-hot-code-swapping-for-uberjars-classes |
| 11:53 | dakrone | spligak: let my see if I can reproduce it |
| 11:55 | spligak | dakrone, I'm using the 'request' function directly, passing in a handful of options in addition to those two. happy to throw up a gist if you'd like. |
| 11:56 | TimMc | clgv: Thanks! *compile-files* is exactly what I needed. |
| 11:57 | clgv | TimMc: good. :) you have to use alter-var-root though |
| 11:57 | clgv | TimMc: `set!` won't work... |
| 11:59 | deg | I've just moved from Clojure 1.4 to 1.5, and the (pst) function seems to have disappeared?? Is this a known issue? |
| 12:02 | kittylyst | Anyone recommend a good Clojure project for parsing Apache logs? |
| 12:03 | spligak | dakrone, hah. get it? "throw" up a gist? *rimshot* |
| 12:03 | S11001001 | deg: clojure.repl/pst is still defined in clojure-1.5.0 |
| 12:03 | zodiak | deg, yeah, pst is definitely still in 1.5 |
| 12:03 | dakrone | spligak: heh, a gist would be helpful if you could get one to me |
| 12:04 | TimMc | amalloy_, clgv: Yep, you can totally compile Java against a class with abstract methods: https://gist.github.com/timmc/5100962 Color me surprised. |
| 12:04 | spligak | not a problem at all. one minute. |
| 12:05 | zodiak | kittylyst, surely you could jst open up a clojure.java.io/reader and run over it |
| 12:05 | zodiak | kittylyst, if it's really big, and always appending, you could always play around with storm ;) |
| 12:05 | clgv | TimMc: duck typing with java ^^ |
| 12:05 | clgv | args with jvm ;) |
| 12:06 | kittylyst | zodiak: Homebrewing with regexps was precisely what I was trying to avoid :) |
| 12:07 | zodiak | regexps ? surely you jst use clojure.string/split, and then decompose what you want out from there |
| 12:07 | zodiak | your regex would be " " :) |
| 12:07 | owengalenjones | does anyone use clj-soap? is this project dead forever? |
| 12:07 | zodiak | or rather, #"\s+" (if you prefer) |
| 12:09 | zodiak | clj-soap is dead ? |
| 12:09 | gfredericks | So (let [nums (range)] (#(dorun nums))) leaks, but (let [nums (range)] ((^{:once true} fn* [] (dorun nums)))) does not |
| 12:09 | owengalenjones | sean corfield has stated he has given up on it |
| 12:09 | gfredericks | is the :once metadata a supported feature? should it be encouraged in macros that create thunks that are only called once, e.g. clojure.java.jdbc/transaction ? |
| 12:10 | zodiak | owengalenjones, must have missed that.. do you have a problem with the implementation, or is missing something ? |
| 12:11 | owengalenjones | zodiak: I have the same issue listed in this thread (which I using as a test) https://groups.google.com/forum/#!topic/clojure/dewY8-Ao9AE, sean's last comment appears to be him giving up on it :/ |
| 12:12 | zodiak | interesting. reading |
| 12:12 | kittylyst | zodiak: Your regex fails on the first line of my log file, e.g.: |
| 12:13 | kittylyst | 123.125.71.102 - - [03/Mar/2013:06:31:19 +0100] "GET / HTTP/1.1" 302 299 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" |
| 12:13 | mikerod | If I want return a function that has a to-be-determined number arguments/formal parameters, I have determined this works for me (eval `(fn [~@params] ~expr)). I do not think this is a clean solution (it uses eval). What I'm wanting to be able to do is to spread out some list of params into the param vector of the anonymous fn. |
| 12:14 | kittylyst | zodiak: And I can make it fail in pretty much arbitrary ways if I can't control the date format |
| 12:14 | zodiak | kittylyst, the apache regex wholly and totally depends on how ~you~ have configured apache and it's log format |
| 12:15 | zodiak | perl-mongers have some pretty nice regex's on this mind you. don't see why a regex (posix compliant) shouldn't jst map across (no pun intended) |
| 12:15 | clojurebot | map is slightly retarded |
| 12:15 | zodiak | +1 internets clojurebot |
| 12:15 | kittylyst | zodiak: Yes, I'm an old perl monkey, so I'm aware of some of them I just hoped there were nicely wrapped versions |
| 12:16 | kittylyst | E.g. "^([\\d.]+) (\\S+) (\\S+) \\[([\\w:/]+\\s[+\\-]\\d{4})\\] \"(.+?)\" (\\d{3}) (\\d+) \"([^\"]+)\" \"([^\"]+)\"" - which is not quite right, but isn't a bad start |
| 12:16 | kittylyst | \ |
| 12:16 | spligak | dakrone, https://gist.github.com/jasonjohnson/5101078 -- let me know if that helps. |
| 12:16 | owengalenjones | zodiak: anyway what I was attempting to do is use magento's soap api as their rest api only is available to half their customers, everything seems to work using their examples but clj-soap chokes: http://d.pr/n/fbKI |
| 12:16 | spligak | appreciate you checking it out. love the library. |
| 12:16 | S11001001 | mikerod: it's not meaningful to build a non-variadic function if you don't know the arity until runtime, so you might as well just use & args and apply |
| 12:16 | hiredman | kittylyst: there are a number of parser combinator type libraries around on github, but none of them seems to be very good, and they often end up abandoned |
| 12:17 | spligak | dakrone, I'm using clojure 1.4.0 - that's just what lein spit out when I created the sample. updating that. |
| 12:17 | dakrone | spligak: looking through the tests, apparantly this is on purpose right now, because many errors don't come back as json when a 503 or whatever is hit, so I'm thinking of adding a {:coerce #{:always :unexceptional :exceptional}} setting to force behaviour |
| 12:18 | dakrone | spligak: what version of clj-http? |
| 12:18 | zodiak | owengalenjones, yeah.. I don't think the "cool kids" use soap much these days (sorry). It's kinda strange/worrying that the author seemed to hit a bump and then say 'eff it' |
| 12:18 | hiredman | there is always http://meshy.org/2009/12/13/widefinder-2-with-clojure.html |
| 12:18 | owengalenjones | I dont blame him, this is my first experience with soap, its giving me an ulcer after only a day of looking at it. thanks for your time |
| 12:19 | zodiak | owengalenjones, no worries. Yeah. soap is .. pretty nasty (especially all that automagically wsdl stuff). |
| 12:19 | spligak | dakrone, using 0.6.4 in my project. and that's totally cool - just making sure I wasn't using it improperly. |
| 12:19 | dakrone | spligak: okay, I'll work on a fix |
| 12:22 | mikerod | S11001001: I understand what you are saying. I have a strange use-case for this. I writing a DSL in Clojure and at what ends up happening in this case is that I need a function with unknown number of args and unknown formal parameter names, however, this function will end up being called from java with the IFn#invoke(args). |
| 12:23 | zodiak | "Magento Core API supports the SOAP and XML RPC protocols. It does not support REST" .. how old IS this magento thing ?! xml-rpc ? mercy (that maybe a LOT easier to get running in clojure btw) |
| 12:23 | zodiak | owengalenjones, I suspect you can find a fair few xml-rpc libs |
| 12:23 | S11001001 | mikerod: if your DSL is, by nature, a builder of fresh clojure code, then perhaps it ought to do so by way of macroexpansion? |
| 12:24 | eriko | kittylyst: this rough parser is for cachefly logs, but they're derived from the Apache format. YMMV: https://gist.github.com/erikols/5101134 |
| 12:25 | noidi | is it OK to leave the project name empty on the Contributor Agreement, if I want to be able to contribute to any project requiring a CA? |
| 12:25 | kittylyst | eriko: Thx. I've arrived at this for general Extended Common Log Format: |
| 12:25 | kittylyst | #"([^ ]*) ([^ ]*) ([^ ]*) \[([^]]*)\] \"([^\"]*)\" ([^ ]*) ([^ ]*) \"([^\"]*)\" \"([^\"]*)\"" |
| 12:25 | kittylyst | You can do better for the apache case, by doing better for the case of first-column-is-an-IP |
| 12:25 | noidi | I'd hate to send a new CA every time I want to send a patch to a new core project... |
| 12:26 | mikerod | S11001001: I agree, macroexpansion is usually the best place to do something like this. I will take a look at what I'm doing a bit more closely and see if I can restructure it into a macro. Thanks for the help. |
| 12:27 | eriko | kittylyst: Cool, thx! |
| 12:36 | owengalenjones | zodiak: thanks, Im looking into https://github.com/brehaut/necessary-evil (its got an awesome name) |
| 12:36 | zodiak | *laughs* that's all sorts of good naming :D |
| 12:43 | owengalenjones | zodiak: omg thank you, it appears to have worked for my tests, work can continue. I never would've tried that, I dont even know the difference between soap xml-rpc all this junk... |
| 12:44 | zodiak | owengalenjones, nw. yeah. soap is the heavier cousin of xml-rpc. it's "technically" better (betamax vs vhs - which is an urban myth, I know ;) but. meh. |
| 12:44 | zodiak | whatever works. works. |
| 12:46 | zodiak | back to simcity 2013 for me :D |
| 12:47 | owengalenjones | zodiak: enjoy your tiny 2k*2k city plots :) |
| 12:52 | rplaca | noidi: just put "Clojure and Contributed Libraries" and you'll be set |
| 12:52 | noidi | rplaca, thanks! |
| 12:53 | rplaca | noidi: np |
| 12:54 | noidi | :) |
| 12:57 | noidi | I wish Clojure used something like echosign, like the Chef project http://wiki.opscode.com/display/chef/How+to+Contribute |
| 12:58 | technomancy | it's been discussed many times, but there doesn't seem to be much motivation to actually make contribution easier |
| 12:58 | noidi | sending information by moving physical objects seems so archaic :) |
| 13:00 | noidi | I don't think I even have any envelopes or stamps at hand, so that means a trip to the post office |
| 13:01 | noidi | technomancy, I've seen the discussions, and I've always wondered why Clojure/Core does not see this as an issue |
| 13:02 | technomancy | http://p.hagelb.org/mystery.gif |
| 13:04 | llasram | Maybe because the current process is already yielding more patches than rhickey wants personally review? |
| 13:06 | technomancy | #firstwordlproblems |
| 13:06 | noidi | llasram, that's a good problem to have and should be solved by scaling the approval process, not by making it harder to contribute |
| 13:07 | llasram | noidi: I don't disagree -- just generating hypotheses |
| 13:40 | thearthur | arohner: I sent a pull request porting clj-r53 to 1.4.0, It was crashing for me with 1.4.0 :-/ |
| 13:41 | thearthur | arohner: If I buy you beer sometime will ya release it as 1.0.2 soon? |
| 13:41 | arohner | thearthur: great! |
| 13:43 | thearthur | I tested it on create and update record |
| 13:45 | arohner | thearthur: cool. releasing soon |
| 13:49 | arohner | thearthur: 1.0.2 is released |
| 13:49 | arohner | thanks for the patch |
| 13:51 | TimMc | noidi: You're not sending information by physical object in the CA process -- you're applying Color to existing information: http://ansuz.sooke.bc.ca/entry/23 |
| 13:51 | thearthur | arohner: and thanks for the quick turnaround, I hate releasing with forks... much appreciated |
| 13:52 | TimMc | It's a legal ritual that "blesses" the data. |
| 13:53 | TimMc | ,(dorun (range)) |
| 13:53 | clojurebot | Execution Timed Out |
| 14:01 | amalloy | so i noticed something interesting about delays yesterday. if you delay an expression that throws an exception, then forcing it multiple times does not always yield the same result |
| 14:02 | amalloy | specifically, the first time you get the exception you threw; after that you get a NPE in the middle of clojure.lang.Delay |
| 14:02 | llasram | That seems to have a low probability of being intended/desirable behavior |
| 14:02 | Raynes | Mhm |
| 14:03 | amalloy | indeed. it's possible to work around it, either in your code or in c.l.Delay, so that it saves the first exception and rethrows it. it's not possible to make it actually retry in case some mutable state has changed |
| 14:03 | llasram | Yeah. Re-throwing is what I'd expect to happen |
| 14:06 | amalloy | well, i should be more specific. not *every* exception-throwing delay expression causes this. it has to be one that refers to some lexical locals in the scope of the delay |
| 14:20 | tomoj | is it me or are url locals bound in a strange place by moustache? |
| 14:20 | tomoj | I mean, the locals it gives you for url segments |
| 14:21 | tomoj | it seems you have to pass them into functions that return handlers |
| 14:21 | Raynes | Those words don't make sense to me. |
| 14:22 | tomoj | (app ["foo" id] (foo-handler-generator id)) |
| 14:22 | tomoj | (fn foo-handler-generator [id] (fn [req] ...)) |
| 14:22 | tomoj | that's the only way I can see to make use of the 'id binding |
| 14:23 | Raynes | Oh. |
| 14:23 | Raynes | tomoj: Yeah, I thought you were talking about mustache. |
| 14:23 | Raynes | I'm not a fan. |
| 14:25 | Raynes | Man, I love hating on cgrand's stuff. |
| 14:25 | tomoj | I don't think I am either |
| 14:25 | Raynes | I'm waiting for him to challenge me to a duel. |
| 14:26 | danneu | if you /quit |
| 14:26 | danneu | whoops |
| 14:27 | rabbit_airstrike | lisp duel |
| 14:28 | tomoj | on the other hand compojure seems to make a sort of opposite error.. |
| 14:30 | tomoj | I want (route :get ["foo" :id]) to be a middleware that routes and adds an :id param or url-param to the request |
| 14:30 | tomoj | maybe compojure can do something very close to that? |
| 14:35 | tomoj | ah, make-route |
| 14:38 | amalloy | tomoj: it's called context. i forget what compojure namespace it's in |
| 14:38 | amalloy | (context "/foo" [id] some-route) |
| 14:40 | tomoj | oh wait |
| 14:40 | tomoj | I guess moustache assoc's onto the request too |
| 14:42 | tomoj | not usefully afaict |
| 14:43 | yogthos | Raynes: speaking of I've got a quesiton ;) |
| 14:44 | yogthos | Raynes: can't seem to get wrap-file-info to work with uberjar |
| 14:45 | yogthos | Raynes: I did (wrap-resource "public") and in the uberjar you end up with a public directory under it, so what am I missing there |
| 14:45 | yogthos | Raynes: works fine in wars |
| 14:46 | Raynes | yogthos: No idea. |
| 14:46 | yogthos | Raynes: I guess I'll have to find weavejester for this mystery :) |
| 14:47 | yogthos | Raynes: I'm going to be so glad when I have that app-handler working properly, nesting middleware can be so brittle |
| 14:47 | yogthos | Raynes: nobody should have to do that again :P |
| 14:48 | Raynes | yogthos: So the problem is that your resources aren't being seen at all? |
| 14:48 | yogthos | Raynes: they are but the mime type isn't set |
| 14:49 | Raynes | Does that even make sense? |
| 14:49 | yogthos | Raynes: if I don't add wrap-resource or wrap-file-info then mime types are set |
| 14:49 | Raynes | So you *can* access the resources? |
| 14:49 | Raynes | It just doesn't set the mime type? |
| 14:49 | yogthos | Raynes: yeah |
| 14:49 | Raynes | Yeah, that's way above my pay grade. |
| 14:49 | yogthos | Raynes: hehe |
| 14:50 | yogthos | Raynes: what's weirder is that it *sets* the mime type if you don't put wrap-file-info at all |
| 14:50 | yogthos | Raynes: so I wonder if there's some alternate mechanism that gets invoked |
| 14:53 | sujeet | devn, where u b dawg |
| 14:55 | jrobie | for what operations does nil NOT raise a n exception if used as an operand - just for conditions and for functions specifically designed to handle it? |
| 14:59 | amalloy | jrobie: lots of things. collection operations, especially |
| 15:00 | jrobie | amalloy, thanks - is there an easy way to look up the collection operations for which nil is defined? |
| 15:00 | amalloy | i don't think so. it's basically all of them |
| 15:01 | jrobie | thanks. but i assume all math functions, string functions, aggregate functions, etc. raise exceptions for nil, are there any other big groups of functions besides the collection functions that i should think of? |
| 15:04 | amalloy | jrobie: what language? if it's one you're building from scratch, i recommend not including nil |
| 15:04 | technomancy | inc |
| 15:04 | jrobie | amalloy, we need something like nil for xquery to support json, imho |
| 15:04 | technomancy | if you want inspiration, look at a language with a proper type system like OCaml or Haskell |
| 15:04 | jrobie | we have empty sequences |
| 15:04 | jrobie | but we need something that occupies a position |
| 15:05 | amalloy | no you don't. you can use a special null value for the json library; it doesn't have to be part of the language |
| 15:05 | amalloy | Tony Hoare, inventor of the null reference, has a presentation called: "Null References: The Billion Dollar Mistake" |
| 15:05 | jrobie | amalloy, good to know |
| 15:06 | jrobie | i do need a special null value |
| 15:06 | amalloy | for example, haskell's json library defines what is basically an enum for the six-ish kinds of values json can have |
| 15:06 | amalloy | and for operations outside of json, which in clojure or java might return either a value or nil, it instead returns Maybe value |
| 15:06 | S11001001 | Maybe is cool |
| 15:07 | jrobie | ok. xquery doesn't have a maybe value |
| 15:07 | zodiak | jrobie, well, now, null was only "required" in the case that you had missing data. C.J Date proposed everything having a "default value" (which I am sure has Codd spinning in his grave). maybe that's another solution ? |
| 15:07 | zodiak | but yeah.. a maybe monad could be the ticket |
| 15:08 | jrobie | we don't have anything like maybe in xquery, and what we mostly need is an item that can occupy a position and represents the lack of a vlaue |
| 15:08 | jrobie | i'd like to keep this as simple as we can |
| 15:09 | jrobie | xquery uses empty sequences as the rough equivalent of a sql null, but an empty sequence can't occupy a position in a sequence |
| 15:09 | solussd_ | is it possible to extend a keyword's ability to look itself up in a map? How is that ability defined? |
| 15:10 | jrobie | zodiak, i've spent much too much of my life debating how sql nulls relate to xquery ;-> |
| 15:11 | jrobie | codd, date, and chamberlin definitely disagreed on that issue |
| 15:11 | zodiak | jrobie, I believe you :) |
| 15:11 | jrobie | chamberlin was a co-inventor for xquery, so guess whose view won in xquery? |
| 15:11 | zodiak | oohh.. tough q ;) |
| 15:13 | zodiak | it could be you have an impedence mismatch that's not easily solved.. in which case you may jst be better off either one of (a) not taking null's in the first place, (b) default value if null or (c) maybe monad (although then you are pushing the complexity to the user/next fn to deal with) |
| 15:13 | zodiak | probably a few more solutions but.. it's not going to be pretty ;) |
| 15:14 | Apage43 | solussd_: Keywords can look themselves up in anything that implements ILookup |
| 15:14 | Apage43 | -or- anything that clojure.lang.RT.get works on |
| 15:14 | Apage43 | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Keyword.java#L132 |
| 15:14 | solussd_ | thanks |
| 15:15 | jrobie | zodiak, we're trying to minimize the damage ... |
| 15:16 | Apage43 | which means java.util.Map works too |
| 15:16 | zodiak | jrobie, minimize and pass upstream or wrap and deal with it ? |
| 15:16 | jrobie | hmmmm, Maybe is looking better than i had expected at first blush ... |
| 15:17 | zodiak | monads ftw (jst don't tell #haskell that ;) |
| 15:18 | arkh | what's the next best option to a multiple bind (when-let [ ... ]) ? |
| 15:18 | arkh | because when-let only allows for a single binding |
| 15:20 | jimkcar | does anyone in here work for Relevance? |
| 15:21 | rabbit_airstrike | one of the things I like about R is the granularity of NULL, NaN, NA, and the Infs |
| 15:22 | zodiak | arkh, well.. you could always jst pass in a hashmap into the vector |
| 15:22 | zodiak | (when-let [data {:a 9, :b nil}] (println (:a data) (:b data))) |
| 15:22 | jrobie | zodiak, amalloy - opinions on Python's None? |
| 15:22 | amalloy | rubbish. it's no different from nil |
| 15:22 | zodiak | jrobie, not much really, jst another form of nil, null from my understanding |
| 15:23 | arkh | zodiak: I like it - thanks! |
| 15:23 | zodiak | arkh, more than welcome |
| 15:36 | siscia | Hi, I am having problem to understand protocols, namespace, and implementation of the protocols themselves... |
| 15:36 | siscia | do you suggest any good resource ? |
| 15:39 | hiredman | a protocol is a named group of named functions that are polymorphic on their first argument's type |
| 15:40 | hiredman | the names of protocols and the functions that are part of protocols are vars |
| 15:40 | hiredman | vars exist in namespaces |
| 15:41 | hiredman | the impl is not something to concern yourself with |
| 15:42 | hiredman | (vars themselves also have names, which are namespaced symbols) |
| 15:54 | solussd_ | anything wrong with extending a protocol to a clojure.lang Interface? E.g. IPersistentMap |
| 15:55 | siscia | hiredman, sorry i didn't hear the bip of xchat |
| 15:55 | solussd_ | wait… dont records have marker interfaces now? |
| 15:56 | siscia | hiredman, still something no completely clear |
| 15:57 | siscia | hiredman, I define a protocol in a namespace (call it "A") |
| 15:57 | siscia | hiredman, (in-ns B (:use A)) |
| 15:58 | siscia | (extend-type java-class somenthing-in-A (function [_]) (f2 [_])) |
| 15:59 | siscia | hiredman, if now I (:use A) in another namespace i should be able to call (f2 java-class) |
| 15:59 | siscia | it is right ? |
| 16:02 | frommorf | (filter #(zero? (mod n %)) (range 1 n)) ; Why does this result in a outofmemory for large n? isnt it lazy? |
| 16:03 | nDuff | frommorf: You're clearly evaluating it somewhere. |
| 16:03 | nDuff | frommorf: If I define it without evaluating or printing it, I get no memory error. |
| 16:04 | TimMc | solussd_: If you own the protocol, that's fine. |
| 16:04 | frommorf | nDuff: i evaluate it at the repl |
| 16:05 | solussd_ | TimMc: I want to implement a protocol on all things that act like maps, so I'm thinking about extending MyProto to clojure.lang.ILookup |
| 16:05 | nDuff | frommorf: Exactly. |
| 16:05 | nDuff | frommorf: I imagine that if you only grab a few items of the beginning with take, you have no problem. |
| 16:05 | solussd_ | too bad I cant extend a protocol to a protocol.. :) |
| 16:06 | amalloy | http://dev.clojure.org/jira/browse/CLJ-1175 is the jira issue i just created for the weird behavior of clojure.core/delay, if anyone wants to look at it or, say, vote for it |
| 16:07 | frommorf | nDuff: yes, but i need all the items. is there a way to optimize it? |
| 16:08 | siscia | frommorf, how big is n ? |
| 16:08 | frommorf | 600851475143 |
| 16:08 | frommorf | siscia: 600851475143 |
| 16:08 | siscia | frommorf, are you looking for the divisor of that number ? |
| 16:09 | frommorf | siscia: all the factors of that number, I know there's a better algorithm. But i am wondering why it so slow this way |
| 16:09 | ninjudd | everyone should go vote for amalloy's issue |
| 16:09 | nDuff | Err. The slow part doesn't seem surprising at all. |
| 16:10 | siscia | frommorf, me neither... |
| 16:10 | nDuff | Running out of memory, on the other hand, was surprising (if not holding onto the head). |
| 16:11 | siscia | frommorf, a quick fix could be something like (filter #(zero? (mod n %)) (range 1 (int (sqrt n)))) |
| 16:11 | frommorf | I'm very new to clojure so I dont know what is going on. |
| 16:11 | edw | I'm looking to write some code that needs to be evaluated eventually, but I really want to treat it as "fire and forget"; is it kosher to do something like (dorun (for [batch (partition 10 1 nil xs)] (future (frobinate batch))))? |
| 16:12 | siscia | frommorf, you are making a lazy seq (you know what that is?) and you try to print it all... |
| 16:13 | frommorf | siscia: yes i do. but i thought since it was lazy it wouldnt need to store the whole thing in memory? |
| 16:14 | siscia | frommorf, yes that is the point of the lazyness, however if you try to print it |
| 16:15 | siscia | the sequence has to be somewhere... |
| 16:15 | siscia | it has to be realized in order to print it... |
| 16:16 | frommorf | siscia: right, sorry my brain is not working today. |
| 16:17 | siscia | frommorf, :-) |
| 16:19 | TimMc | Who's the main Clojure JIRA wrangler? It looks like the version tag "Release 1.5" is still marked as Unreleased. |
| 16:24 | ohpauleez | TimMc: I'm not 100% sure but Sierra or Andy |
| 16:26 | nDuff | Hrm; in clojure-mode, (avout/dosync!! *avout-client* <NEWLINE> indents the next line to be with the *avout-client*; is there a straightforward way to configure emacs to only indent one level (two spaces) there, rather than aligning with the first parameter? |
| 16:26 | TimMc | stuartsierra: FYI, the CLJ Jira project still has "Release 1.5" marked as Unreleased. |
| 16:27 | TimMc | nDuff: Something about M-x customize-variable RET clojure-defun-indents |
| 16:29 | stuartsierra | I disavow all responsibility for JIRA. ;) |
| 16:31 | nDuff | TimMc: useful; thanks |
| 16:39 | amalloy | whew! it's nice to not be the only one who recommends defun-indents, TimMc |
| 16:40 | TimMc | amalloy: I still haven't used it, and if nDuff breaks his leg and comes running to me, I'm going to point him at you. |
| 16:41 | nDuff | TimMc: ...for what it's worth, my leg appears to be intact |
| 16:41 | nDuff | (and my code well-formatted). |
| 16:41 | TimMc | stuartsierra: Andy is the one, then? |
| 16:41 | jimkcar | running with a broken leg would be impressive |
| 16:41 | TimMc | amalloy: Is there some sort of modeline thingum that can be used to make it portable? |
| 16:41 | amalloy | if anyone is interested, https://www.refheap.com/paste/0bccc08fbe2924fd38fa38b88 sets up git to provide custom hunk headers for clojure files in diffs. so the diff header tells you what function the diff is in the middle of |
| 16:41 | stuartsierra | TimMc: Probably. Email clojure-dev. |
| 16:41 | amalloy | TimMc: huh? |
| 16:42 | TimMc | amalloy: 404 |
| 16:42 | TimMc | Interlocutor Not Found |
| 16:42 | amalloy | this world makes no sense any longer |
| 16:42 | amalloy | i resign |
| 16:43 | TimMc | amalloy: 404 on your refheap link, actually. |
| 16:43 | amalloy | really? it works fine for me, even clicking on it now |
| 16:44 | TimMc | Oh, huh! |
| 16:44 | jimkcar | I get "Insert fancy 404 image here." |
| 16:44 | TimMc | gnome-terminal was including the space after the URL |
| 16:44 | TimMc | Got a weird char in there? |
| 16:44 | Raynes | I don't see any 404/ |
| 16:45 | llasram | non-breaking space between the URL and 'sets' |
| 16:45 | amalloy | you're right, it looks weird to me too. must be some weird character |
| 16:45 | jimkcar | <space> sets was coming up as part of the url |
| 16:45 | amalloy | try https://www.refheap.com/paste/0bccc08fbe2924fd38fa38b88 |
| 16:45 | TimMc | http://lab.brainonfire.net/whatchar/identify.php?data=https%3A%2F%2Fwww.refheap.com%2Fpaste%2F0bccc08fbe2924fd38fa38b88%C2%A0 |
| 16:45 | amalloy | my browser (or my irc client?) was apparently stripping out that extra character at the end |
| 16:45 | TimMc | Non-breaking space. |
| 16:46 | TimMc | amalloy: Sp, re: clojure-defun-indents, is there a way to make it so that collaborators get the same indentation rules? |
| 16:46 | TimMc | *So |
| 16:46 | amalloy | $google dir-locals.el |
| 16:46 | lazybot | [Directory Variables - GNU Emacs Manual] http://www.gnu.org/s/emacs/manual/html_node/emacs/Directory-Variables.html |
| 16:47 | stuartsierra | You can also use file-local variables. |
| 16:47 | amalloy | i found it a bit fiddly to get everything lined up just right so that those work, TimMc, but it's definitely possible |
| 16:47 | TimMc | Oh, so it's a modeline thingy. |
| 16:47 | amalloy | no it's not. i don't know why you keep talking about the modeline |
| 16:48 | TimMc | I think that's what vim calls that. |
| 16:48 | amalloy | well, emacs has something called the modeline, and it's something other than whatever you're talking about :P |
| 16:48 | TimMc | Oh right, that term is overloaded. |
| 16:49 | TimMc | Polymorphic across editors. :-P |
| 17:03 | gfredericks | So (let [nums (range)] (#(dorun nums))) leaks, but (let [nums (range)] ((^{:once true} fn* [] (dorun nums)))) does not |
| 17:03 | gfredericks | is the :once metadata a supported feature? should it be encouraged in macros that create thunks that are only called once, e.g. clojure.java.jdbc/transaction ? |
| 17:07 | edw | My app is not exiting after creating agents (and awaiting them too). Is there something I need to do to let the JVM die a natural death? |
| 17:07 | amalloy | gfredericks: thunks that are called only once are delays |
| 17:07 | amalloy | ie, don't write them yourself, use the one that already exists |
| 17:08 | hiredman | amalloy: the problem with delays is they memoize their results |
| 17:08 | hiredman | well, I guess not a problem in gfredericks's example |
| 17:08 | nDuff | edw: there's a call to shut down the agent pool. |
| 17:09 | amalloy | right, i think for anything you only call once that memoization won't be a problem |
| 17:09 | amalloy | but i could be wrong |
| 17:09 | hiredman | "the problem with using delays with lazy-seqs is ..." |
| 17:09 | nDuff | edw: (shutdown-agents) |
| 17:09 | edw | Ah, I was just staring at the cheat sheet on my iPad. |
| 17:09 | edw | Thanks. |
| 17:12 | amalloy | hiredman: if you let the delay get GCed, that shouldn't be a problem, right? |
| 17:12 | amalloy | ,(let [d (delay (range))] (dorun @d)) |
| 17:13 | clojurebot | Execution Timed Out |
| 17:14 | amalloy | ie, if it's really called only once, you can arrange to call it in a place where the delay itself is GCable, and the memoization doesn't matter then |
| 17:15 | hiredman | amalloy: sure, but if you do something like (let [d (delay (produce-seq))] some-complicated-logic-with-d) it is very easy to end up holding on to the head of the seq by holding on to d |
| 17:19 | amalloy | gfredericks: speaking of delays, did you see my jira issue earlier today about (what is arguably) a bug in c.l.Delay? http://dev.clojure.org/jira/browse/CLJ-1175 - vote early, vote often! |
| 17:19 | llasram | Isn't it vote early, vote only twice? |
| 17:19 | llasram | Of course, I have no idea how many tickets I voted on |
| 17:20 | amalloy | llasram: rich suggested that policy, but since it's based on rich believing that clojure developers will follow the honor system, of course it can never work |
| 17:21 | hiredman | I think the reports andy generates do some kind of fractional weighted voting |
| 17:21 | amalloy | last week andy fingerhut started counting how many issues you've voted on, so that if you've voted five times then each vote counts as 1/5 of a vote |
| 17:21 | llasram | Ah, interesting |
| 17:21 | amalloy | thus everyone "counts" as one vote, distributed as thinly as you like |
| 17:21 | llasram | That sounds like a better approach |
| 17:21 | amalloy | much |
| 17:21 | technomancy | time to start creating sock puppets |
| 17:22 | amalloy | yeah, i know |
| 17:22 | llasram | And have them submit CAs? |
| 17:22 | amalloy | technomancy: but sock puppets can't fill out CAs |
| 17:22 | amalloy | so this is 100% secure |
| 17:22 | llasram | Sock Q Puppet III |
| 17:22 | cemerick | has anyone yet abused the BigDecimal implementation in gwt-math with ClojureScript? The references to it aren't exactly encouraging. |
| 17:22 | technomancy | amalloy: good point, that would involve signing something which is false, which as we know is a logical impossibility. |
| 17:23 | hiredman | technomancy: well for bots |
| 17:23 | llasram | Mechanical Turk |
| 17:23 | hiredman | ~truth |
| 17:23 | clojurebot | Titim gan éirí ort. |
| 17:24 | trptcolin | more like mechanical JERK |
| 17:24 | trptcolin | ok, i'm done, sorry |
| 17:24 | augustl | what's the simples way to turn a map into a map with a type I can use to extend a protocol? |
| 17:25 | llasram | augustl: Existing protocol, or your own? |
| 17:26 | augustl | llasram: my own, so I can pass in a map to a protocol function and have it run my implementation for my specific type |
| 17:26 | augustl | essentially I just want a map with a type I specify so I can implement a protocol for that type |
| 17:26 | llasram | If it's your protocol, could you just use multimethods instead? |
| 17:27 | llasram | &(map type [{} {:type :foo}) |
| 17:27 | lazybot | java.lang.RuntimeException: Unmatched delimiter: ) |
| 17:27 | llasram | &(map type [{} {:type :foo}]) |
| 17:27 | lazybot | ⇒ (clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap) |
| 17:27 | llasram | fail, me |
| 17:27 | llasram | &(map type [{} ^{:type :foo} {}]) |
| 17:27 | lazybot | ⇒ (clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap) |
| 17:28 | llasram | Huh. That should have worked |
| 17:28 | llasram | &(map type [{} (vary-meta {} assoc :type :foo)]) |
| 17:28 | lazybot | ⇒ (clojure.lang.PersistentArrayMap :foo) |
| 17:28 | llasram | Anyway |
| 17:29 | llasram | So there's a builtin approach to using multimethods dispatching on the type of a value, or on some other arbitrary token you specify via metadata |
| 17:30 | augustl | here's an example of what I want to do: https://www.refheap.com/paste/12180 |
| 17:31 | augustl | the idea is that I have some routing code but I don't want it to be ring specific, i.e. I don't want to assume that request contains ":request-method", but also allow for just :method (which I actually use, since I have a system where I use HTTP-like routing over a message queue, no Ring |
| 17:31 | augustl | ) |
| 17:31 | augustl | so the default implementation assumes a Ring map, but I want uses to be able to extend it |
| 17:31 | augustl | not sure if protocols are a good fit though :) |
| 17:32 | llasram | Protocols dispatch on concrete JVM types. If you don't already have concrete types or need the speed their implementation in terms of interfaces provides, then they probably aren't the right fit |
| 17:33 | llasram | You could create a macro which generates new `deftypes` which are basically just trivial map implementations, but it doesn't seem like the right solution to me |
| 17:33 | augustl | I do have just a normal map, yeah |
| 17:33 | llasram | Then multimethods seem like a much better fit |
| 17:34 | augustl | not sure what I should dispatch on since they're always just normal maps |
| 17:35 | llasram | If you were already contemplating wrapping them in some other type, you can just assoc in a dispatch key instead, or add :type metadata |
| 17:35 | llasram | :type metadata has other implications for e.g. printing though |
| 17:35 | augustl | hmm |
| 17:36 | augustl | types seems cleaner.. Not that I know what I'm talking about, though |
| 17:36 | augustl | and a protocol also means the methods will be neatly grouped |
| 17:36 | brehaut | augustl: concrete implementation types are only clearer if they already exist; if you are going to map all your data to a concrete type just for dispatch, multimethods are better |
| 17:37 | llasram | Types are only cleaner if you really need a concrete type for some reason, which I don't believe is the case here |
| 17:37 | llasram | As for grouping together, you can create a macro which lets you define groups of related multimethods |
| 17:37 | llasram | I don't have it published publicly anywhere ATM, but I use such a macro pretty extensively in my work codebase |
| 17:38 | llasram | For ex: https://www.refheap.com/paste/12181 |
| 17:39 | augustl | why do that when protocols work just fine? (Except I'm not sure they do, since I'm still not sure how to create a special map that's a map except a different type) |
| 17:40 | llasram | augustl: Basically, you could implement protocols in terms of multimethods, but not vice versa |
| 17:40 | llasram | Grouping together related functions is just a nicety, making code a bit easier to read by making the relationship clearer |
| 17:41 | llasram | But the fundamental machinery of multimethods is more powerful and flexible |
| 17:41 | llasram | I'd even argue that protocols only define functions together because they *need to*, due to their JVM implementation in terms of interfaces, which requires that all the functions be known at once |
| 17:41 | augustl | you can defmethod for defmultis from another namespace, right? |
| 17:41 | llasram | Yes |
| 17:47 | jimkcar | is there a white paper or something that shows how Datomic uses the key-value storage underneath. i.e. what do the keys and values look like |
| 17:48 | jimkcar | or is that proprietary? |
| 17:51 | bbloom | jimkcar: it's likely proprietary, but it's not that difficult to imagine what it looks like if you understand a bit about how datomic indexes work |
| 17:52 | bbloom | jimkcar: in short, key-value or other storage is used like a big hash table |
| 17:52 | bbloom | jimkcar: you don't store one datum per key, you store many |
| 17:52 | gfredericks | amalloy: hiredman: whoops I ran away; thanks for the discussion :) |
| 17:53 | bbloom | jimkcar: so basically, you name the key after some identifier for a page of data |
| 17:53 | jimkcar | yeah that's kind of what I figured. I work a lot with the Apache Accumulo project and was wondering how difficult it would be to adapt Datomic to use it. |
| 17:53 | augustl | jimkcar: all I know is that it's a 3 level deep tree structure |
| 17:53 | bbloom | jimkcar: i assume not that difficult, considering they already support other sorted key value stores |
| 17:53 | augustl | the actual data they put in storage, that is |
| 17:54 | hiredman | it sounds like the main requirement is conditional writes |
| 17:54 | bbloom | augustl: what are those levels? |
| 17:54 | augustl | supporting key/value stores is not necessarily easy. For riak, they need to use zookeeper as well, to keep track of things |
| 17:54 | bbloom | augustl: i assume the correspond to elements of EAVT |
| 17:55 | augustl | bbloom: I'm not sure.. |
| 17:55 | hiredman | augustl: zookeeper is used to enable conditional put on riak |
| 17:56 | jimkcar | Does Datomic have any sense of permissions like Accumulo? There can be a lot of data in Accumulo, but you may not be able to access it all. |
| 17:56 | augustl | no, none at all afaik |
| 17:59 | bbloom | yeah, i think lack of permissions is an intentional design decision |
| 17:59 | hiredman | jimkcar: you might check out cascalog, since it looks like Apache Accumulo plays well with hadoop |
| 17:59 | bbloom | there are many types of permissions systems and you can build them on top if you want |
| 17:59 | augustl | llasram: seems another reason not to use defrecords "in place of" maps is that records aren't callable, like (my-map :key) |
| 17:59 | hiredman | cascalog is a datalog like layer on top of serveral other layers on top of hadoop |
| 18:00 | jimkcar | yeah I've played with cascalog a bit. Full disclosure, this is me: http://hadoopsummit2013.uservoice.com/forums/196821-enterprise-data-architecture/suggestions/3714766-managing-hadoop-and-accumulo-with-clojure |
| 18:00 | bbloom | augustl: whoa, i didn't believe you, but you are right... |
| 18:00 | augustl | indeed, it's very common to build APIs (with authentication etc) on top of datomic peers. |
| 18:00 | augustl | bbloom: wut? :) |
| 18:01 | bbloom | augustl: i did (defrecord Point [x y]) and then ((Point. 5 10) :x) and was astonished to see an exception cannot be cast to clojure.lang.IFn |
| 18:01 | augustl | ah right |
| 18:01 | dakrone | spligak: just released 0.6.5 with this commit: https://github.com/dakrone/clj-http/commit/426049c93eba360c6eca92fc542b70627a7d2be3 |
| 18:02 | jimkcar | augustl: the problem with that is that the peers have the data in hand, regardless of the permissions |
| 18:02 | augustl | jimkcar: indeed |
| 18:03 | augustl | I'm not sure about the specifics, but I guess that the fact that peers gets transactions pushed to them is one of the reasons there are no permissions on that level |
| 18:03 | augustl | to avoid fancy routing on the transactor to correctly distribute data based on permissions |
| 18:05 | jimkcar | I really need to grok Datomic a bit more. |
| 18:05 | bbloom | what fucking year is it that jira still breaks my fucking back button!?! argh. |
| 18:05 | augustl | jimkcar: feel free to ask :) |
| 18:05 | amalloy | bbloom: really? i've had many problems with jira, but not that one |
| 18:06 | bbloom | amalloy: if you issue a "quick search" query, you get an "Issue Navigator" results page |
| 18:06 | bbloom | amalloy: the URL does not contain your search terms |
| 18:06 | bbloom | if you click an issue and then press back, Chrome warns about content resubmission |
| 18:06 | amalloy | bbloom: well, there's your problem: you're using jira's search feature |
| 18:06 | jimkcar | augustl: well i don't really understand how it can scale. If the index is at the peer for searching, doesn't that limit your index size quite a bit? How do you deal with Petabytes of data in your store? |
| 18:07 | bbloom | amalloy: how dare i attempt to use software |
| 18:07 | augustl | jimkcar: datomic is not a good fit for that |
| 18:07 | augustl | jimkcar: if by petabytes of data you mean petabytes of data in use |
| 18:07 | augustl | if you need to average or count a petabyte of numbers, with datomic you need to have a petabyte of memory available. So you're better off with something like map/reduce in that case |
| 18:08 | bbloom | augustl: datomic can still be useful for that, but you just need a layer above it to coordinate the subprocesses |
| 18:08 | jimkcar | augustl: so what is the most common Datomic use? |
| 18:08 | augustl | jimkcar: however, datomic has a LRU cache for data on the peer. So say you're building a project management system. Projects that haven't been active for a while (for example, due to limiting number of active projects in the app to 10 and having an archive function that makes the project inaccessible from the app) makes the data for those projects disappear |
| 18:08 | augustl | from the cache |
| 18:08 | augustl | </randomexample> |
| 18:09 | bbloom | jimkcar: datomic is designed to be a better foundation for the use cases you'd traditionally use a SQL database for |
| 18:09 | augustl | partitions can also help, if you have completely unrelated domain objects that typically are used in separate peers for each partition |
| 18:09 | augustl | jimkcar: you need to have the active data set in RAM anyway for most databases, to get good performance ;) |
| 18:09 | spligak | dakrone, hey thanks! that's really helpful when working with things like couch. allows me to define that meaningful/exceptional line nicely (and in the correct layer, IMHO) |
| 18:10 | dakrone | spligak: thanks for the report, it's a nice feature to have |
| 18:10 | jimkcar | I guess good performance is relative. |
| 18:10 | augustl | bbloom, jimkcar: yeah, there's aggregation right? |
| 18:10 | Roxxi | Aside from Cascalog and Clojure-hadoop, are there any other popular clojure map-reduce libraries that people commonly use? |
| 18:10 | jimkcar | augustl: yes there is aggregation |
| 18:11 | jimkcar | Roxxi: not that I've used |
| 18:11 | augustl | don't have a good answer to your guess :) |
| 18:18 | jimkcar | augustl: so there is only ever a single transactor in play? |
| 18:19 | augustl | jimkcar: yes |
| 18:19 | technomancy | Roxxi: it's easy to roll your own over a queue: https://github.com/technomancy/die-roboter |
| 18:19 | augustl | jimkcar: you can have failover transactors ready and waiting to avoid having to wait for JVM startup etc |
| 18:20 | augustl | jimkcar: but only one is running at a time, in order to achieve ACID |
| 18:20 | augustl | jimkcar: so if you need arbitrary write scale (in other words, you can't have ACID), Datomic is not a good fit |
| 18:21 | augustl | note however that because the transactor only does writes, it is likely easier to scale than an ACID database where the same process/server/whatever does both reads and writes |
| 18:22 | jimkcar | augustl: yes I see. I wonder if you could have both. Accumulo is highly optimized for data ingest. A single Transactor wouldn't be able to keep up. |
| 18:23 | jimkcar | is it possible to make bulk updates to the transactor indices? |
| 18:23 | corecode | i think clojure will become my next favorite language |
| 18:23 | augustl | the actual indexing operation is eventual. The ACID transaction only writes a log to make it fully ACID, then it's eventually merged into the index tree |
| 18:26 | augustl | ..if that's what you mean |
| 18:28 | jimkcar | augustl: So I'm thinking it would just be an app service along side your main data store. |
| 18:37 | ayia_ | Hi guys! Can I wrap some code in other code depending on a condition? I have a parameter to my function. If it is a seq then i should evaluate some code. If it is a string I should wrap this code in (apply str ...). |
| 18:39 | brehaut | ayia_: maybe https://github.com/flatland/useful/blob/develop/src/flatland/useful/fn.clj#L30-L48 is what you are after |
| 18:41 | janiczek | hi guys, having a trouble with namespaces :/ i want to use this https://github.com/clojure/java.jdbc - no trable so far, [org.clojure/java.jdbc "0.2.3"] in project.clj, (:use clojure.java.jdbc) in (ns), but when I want to use clojure.java.jdbc.sql, it screams at me... how should I refer to it? ( https://github.com/clojure/java.jdbc/blob/master/src/test/clojure/clojure/java/test_sql.clj ) |
| 18:44 | technomancy | janiczek: that's a test namespace |
| 18:45 | ayia | brehaut: thanks... so, there is no "standard" way... |
| 18:46 | janiczek | technomancy: I'm not requiring clojure.java.test-sql, but clojure.java.jdbc.sql |
| 18:46 | brehaut | janiczek: i wasnt aware that the jdbc.sql was in a released version yet |
| 18:47 | technomancy | yeah, you're looking at the master branch rather than the release |
| 18:47 | janiczek | aha ... so it's just on a github but not in clojars yet? |
| 18:47 | brehaut | and its also pretty experimental |
| 18:48 | janiczek | can I refer to it as 0.2.4-SNAPSHOT, or is 0.2.3 the most I'll get from leiningen? |
| 18:49 | technomancy | janiczek: that varies by project. typically contrib projects don't deploy to clojars, so it might be more difficult to track down |
| 18:50 | janiczek | tried it, clojars don't have 0.2.4-SNAPSHOT. hmm ... so right now my chances are a) just don't use it, b) copy the file from github to my project? |
| 18:50 | augustl | jimkcar: that could work, yeah. As long as you don't try to alter what datomic puts in storage for itself :) |
| 18:50 | technomancy | janiczek: you could ask the maintainer to deploy a snapshot or install it locally from a checkout |
| 18:50 | brehaut | janiczek: https://oss.sonatype.org/index.html#nexus-search;quick~java.jdbc |
| 18:51 | brehaut | janiczek: "0.2.4-20130227.030138-16" appears to be on the sonatype snapshot repo |
| 18:51 | technomancy | that's weird; I thought the next version was going to be 0.3.0 |
| 18:52 | brehaut | technomancy: true, i thought so too |
| 18:52 | janiczek | how do I make leiningen see that repo? it says it can't find the artifact in clojars, so it's probably only searching that |
| 18:53 | janiczek | or should I just download that jar? |
| 18:53 | technomancy | janiczek: see `lein help sample`; look for :repositories |
| 18:54 | brehaut | janiczek: 'just download the jar' is almost never the right idea with leiningen / maven |
| 19:04 | janiczek | YES, did it :) thank you! |
| 19:17 | augustl | hmm, I'm not able to sign stuff for "lein deploy" it seems. I generated a key, and "lein deploy" prompts me for "Enter passphrase:". I enter it, and nothing happens. If I hit enter one more time, I get "gpg: Invalid passphrase; please try again ...". Running OS X. Any suggestions? |
| 19:21 | augustl | are there any getting started guides for using leiningen to deploy to clojars from os x? |
| 19:23 | Frozenlock | seancorfield: Do you have some tips on references in mongo/congomongo? I have some collections that are becoming quite big (>Go) and was thinking about spliting them at each 'keyword'. For example {:main {:a data :b data :c data}} ----> {:main ref_a ref_b ref_c} {:a data} {:b data} {:c data}. |
| 19:23 | TheBusby | augustl: I did it last night for the first time and it as pretty simple |
| 19:23 | TheBusby | augustl: had to use macports to get gnupg installed, and then setup a gpg key |
| 19:24 | seancorfield | Frozenlock: I haven't had cause to use references in MongoDB yet, sorry |
| 19:25 | augustl | fixed it by not having a passphrase for the gpg key |
| 19:29 | augustl | how do I find my gpg public key to paste into the clojars profile page? |
| 19:33 | xeqi | augustl: gpg --armor --export $KEY_ID |
| 19:33 | amalloy | Frozenlock: have you read http://docs.mongodb.org/manual/applications/database-references/ already? it seems quite likely to me that you only need manual refs, which are not hard |
| 19:34 | augustl | xeqi: hmm, I don't have $KEY_ID in my env |
| 19:35 | xeqi | augustl: `gpg --list-keys`, find your 'pub' one, use 8 characters after "/" |
| 19:36 | augustl | xeqi: thanks! |
| 19:37 | xeqi | technomancy: ^ has that been documented anywhere besides your inital mailing? |
| 19:37 | technomancy | xeqi: no, it should be added to clojars |
| 19:37 | technomancy | but right now that's only used for promotion, which is basically on hold |
| 19:38 | technomancy | I mean, it's documented as part of GPG of course |
| 19:48 | amalloy | technomancy: it looks to me like LEIN_IRONIC_JURE's error message doesn't match its behavior. its regex doesn't match "clojure", but its message says "clojure" isn't allowed. it also says it doesn't allow *jure, when really it means *jure* as far as i can tell: eg, jurey-duty is forbidden by that check |
| 19:51 | technomancy | amalloy: the check for "clojure" is outside the regex |
| 19:51 | technomancy | but yeah, I'd take a pull req for the latter |
| 19:51 | technomancy | we kept getting confused newbies who named their own projects "clojure" =\ |
| 19:52 | technomancy | I should probably go in and replace that message with something more sarcastic |
| 19:52 | amalloy | technomancy: that's my point. this cond-clause never "fails" for the name "clojure", so why does its error message tell you about it? |
| 19:52 | technomancy | oh, gotcha. dunno. I took a pull request for that and didn't read it carefully. |
| 19:52 | amalloy | the other clause, which matches specifically clojure, has the right error message |
| 19:52 | technomancy | story of my life |
| 19:54 | amalloy | technomancy: a friend notes: "words you can't use: abjure, adjure, conjure, injure, objure, perjure. so much for my lawyer-themed wizard-hospital simulator!" |
| 19:54 | technomancy | heh |
| 19:54 | brehaut | ha |
| 19:54 | technomancy | conjure and I think perjure are taken; my condolances |
| 19:54 | amalloy | abjure too |
| 19:55 | technomancy | there was one particularly outrageous one that prompted me to add that check where before I had only been thinking about it |
| 19:55 | TimMc | $dict objure |
| 19:55 | lazybot | TimMc: : To swear. |
| 19:55 | technomancy | an objective-C bridge IIRC |
| 19:55 | technomancy | Couverjure argh |
| 19:55 | amalloy | ugh. already this discussion has induced semantic satiation for the syllable "jure". none of these look like words |
| 19:55 | TimMc | Oh man, that's what I should have called swearjure. |
| 19:56 | gfredericks | TimMc: crap. |
| 19:56 | TimMc | technomancy: http://static.tvtropes.org/pmwiki/pub/images/stopallthis_5242.png |
| 19:56 | amalloy | TimMc: abjure is a good name for some kind of security service |
| 19:58 | technomancy | TimMc: http://p.hagelb.org/outrage.jpg |
| 19:59 | gfredericks | technomancy: why your domain name gotsta be so cool :( |
| 20:00 | technomancy | that's the thing with domains |
| 20:00 | technomancy | gotta act fast |
| 20:00 | gfredericks | I had lolwaffle.com for a year or so but never figured out how to make a million dollars with it. |
| 20:01 | TimMc | I own oddlyshapedrock.com for no good reason. |
| 20:01 | technomancy | I assume roflwaffle was taken? |
| 20:01 | brehaut | ahaha |
| 20:01 | gfredericks | technomancy: too explicit |
| 20:02 | gfredericks | lolwaffle's users are sophisticated and do not need to be spoonfed the joke |
| 20:03 | gfredericks | they are also X for any property X |
| 20:03 | TimMc | What joke? I don't get it! |
| 20:05 | TimMc | There's also nextnewsound.com, which would probably be awesome for I dunno, maybe a music reviews site? |
| 20:08 | brehaut | TimMc: markov based music reviers using pitchfork.com's reveiws to generate fictional reviews of bands you havent heard of yet |
| 20:08 | brehaut | (and pitchfork so that they are snarky) |
| 20:08 | TimMc | That's... that's a really good idea. |
| 20:08 | TimMc | Look, if anyone wants to write that I will host the shit out of it. |
| 20:08 | technomancy | I always had a dream of putting together a compilation album where real artists would each submit a track as a fictional band. |
| 20:09 | brehaut | kind of like the gorillaz and new order |
| 20:09 | brehaut | but more people |
| 20:09 | amalloy | if that's what living in seattle does to you, i think i'll stay in california |
| 20:09 | gfredericks | if a band makes real music in what sense could it still be fictional? |
| 20:09 | amalloy | right? seattle is where the music hipsters are? maybe that's portland |
| 20:09 | technomancy | gfredericks: no, I mean like musicians who are established from an existing fictional universe |
| 20:10 | TimMc | technomancy: Somehow this feels related: http://www.thesecretknots.com/2012/12/06/how-to-make-an-album-with-people-instead-of-songs/ |
| 20:10 | technomancy | like the Tenmen or Jason Taverner |
| 20:10 | rabbit_airstrike | I think Seattle, Portland, and Brooklyn compete for music hipsters |
| 20:10 | gfredericks | technomancy: heck if I know of any fictional musicians but I get it now |
| 20:10 | brehaut | TimMc: if i was smart enough at the markov stuff, i'd totally be building that for you |
| 20:10 | TimMc | brehaut: The core of it is super easy. I just don't feel like doing all the plumbing. |
| 20:10 | brehaut | real musical hipsters come from towns you've never heard of |
| 20:11 | technomancy | TimMc: interesting |
| 20:11 | technomancy | amalloy: portland still holds the crown |
| 20:11 | metellus | I'm sure someone else has done the Markov work somewhere |
| 20:11 | rabbit_airstrike | psychic tv did a double album where all of the listed artist credits were of people who were not psychic tv |
| 20:12 | TimMc | I'd probably just throw all the data together and use Dissociated Press, which is easier, albeit a bit slower. |
| 20:12 | gfredericks | seattle is the _____ of portland |
| 20:12 | technomancy | I had a bunch of other bands I would include too, but I've forgotten now |
| 20:12 | technomancy | possibly Sex Bob-omb, but that's been done now. |
| 20:12 | rabbit_airstrike | "bigger, gloomier, more urban sister of" |
| 20:12 | gfredericks | "texas" |
| 20:13 | amalloy | technomancy: i think youo'd have to include at least one real band that everyone makes fun of, "because they've never released any real music" |
| 20:13 | TimMc | gfredericks: What do you suppose France's Paris is? |
| 20:13 | technomancy | amalloy: in this alternate fictional universe featured on this band's web site, $BAND are a creative, dynamic group of artists |
| 20:25 | ambrosebs | technomancy: I don't think I'll be using metadata as the primary storage for static types. The main worry I have is whether vars exist at all at the point I do the static type checking. A secondary worry is I want complete control over when and how my types are updated. |
| 20:26 | devn | hey all |
| 20:27 | technomancy | updating metadata after the fact is easy |
| 20:27 | brehaut | ambrosebs: I've started dabbling with c.typed on a new project; ive hit on some code thats very Any-full. Am i right in assuming that you can't do much with Any? |
| 20:27 | technomancy | I don't understand the use case for wanting to annotate non-existing vars though |
| 20:29 | devn | simplest way to do pagination in a compojure+ring+lib-noir web app? |
| 20:29 | ambrosebs | My point is I can freely put my type annotations wherever I want, and it doesn't matter whether I've compiled the relevant namespace for the var to exist. |
| 20:29 | devn | without writing the damn thing myself |
| 20:29 | TimMc | devn: Like, first/prev/next/last? |
| 20:29 | ambrosebs | So it can't be the primary storage, but I'm ok with adding redundant metadata. |
| 20:29 | technomancy | I understand what you mean, I just don't see the value. |
| 20:30 | hiredman | you can annotate non-existant vars by creating the vars |
| 20:30 | devn | TimMc: Yeah -- I'm using elastisch and right now I have it returning 25 results from the offset which I'm calculating |
| 20:30 | hiredman | ,(doc intern) |
| 20:30 | clojurebot | "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var." |
| 20:30 | technomancy | to me, having to refer something at compile time is extra overhead |
| 20:30 | technomancy | I would expect to be able to add annotations to a file that has none without touching my ns form |
| 20:30 | technomancy | otherwise I'll be less inclined to actually do it |
| 20:31 | TimMc | devn: Well, this is a thing I wrote that computes some stuff based on page number + total results: https://github.com/timmc/handy/blob/develop/src/org/timmc/handy.clj#L137 |
| 20:31 | devn | TimMc: but im not calculating the number of pages, and so on. I'm just looking for a simple way to have a "model-like" thing so I can get pudding-simple pagination without a lot of messing around. |
| 20:32 | devn | TimMc: it would be nice if there was some kind of convention for adding pagination to "model-like" things in clojure web apps |
| 20:32 | TimMc | Yeah, pagination is surprisingly... involved. |
| 20:32 | devn | in rails (hold your sighs) things like will_paginate and so on have always been very popular |
| 20:33 | devn | it would be nice if we could just allow people to define a basic pagination partial in their templating language of choice, and then let the person using the library provide it with a couple of required params |
| 20:33 | technomancy | devn: take and drop on lazy seqs are *so* close to getting you that |
| 20:33 | technomancy | sadly there is no way for drop to signal that a given section of the lazy seq is going to be discarded |
| 20:33 | hiredman | technomancy: devn is talking about generating pages |
| 20:33 | devn | technomancy: yeah, but with elasticsearch you say: "give me 25 results, from the following offset" |
| 20:33 | technomancy | I know |
| 20:34 | TimMc | drop and give me 50 |
| 20:34 | devn | you could get them all, but idk, just give me some simple pagination brothers |
| 20:35 | devn | TimMc: technomancy: hiredman: Does it seem ill-advised or wrong to have a library, let's call it "paginatjure" just to irk technomancy |
| 20:36 | TimMc | paginature |
| 20:36 | ambrosebs | technomancy: Yes, that would be cool. |
| 20:36 | TimMc | oh, yes: paginatjure |
| 20:36 | devn | where you basically say: here is the basic paginate function. it takes a template you specify where prev, next, last, first, and so on are specified |
| 20:36 | qbg | pajinature |
| 20:36 | TimMc | devn: It's *hard*. There are three basic cases: No results, page out of bounds, and valid page. |
| 20:36 | devn | honestly i dont know what it looks like, im just trying to think of a way to provide a very general pagination library where someone using hiccup, enlive, whatever, can use it |
| 20:37 | ambrosebs | technomancy: I'm not sure how I'd recognise the type annotations though. Right now I check for dummy invocations of core.typed vars, which signify where type annotations are. |
| 20:37 | TimMc | devn: After that, you have to have or not have a link for each of first/prev/next/last, and maybe even swap out images for each of those. |
| 20:37 | TimMc | The template looks like a goddamn mess when you're done with it. |
| 20:38 | devn | TimMc: that's totally fine though! what im suggesting is that there is a library of disgusting templates written in various templating languages |
| 20:38 | TimMc | heh |
| 20:38 | TimMc | Here's what I ended up doing for my photo gallery, UI-wise: http://gallery.brainonfire.net/filter/run?tag[Content][]=flower |
| 20:39 | devn | and consumers of the lib can say: (:use [paginatjure.templates.hiccup :only (pagination-controls)]) |
| 20:39 | TimMc | It was easier to write. :-P |
| 20:39 | TimMc | paje |
| 20:39 | devn | and then you just have [:html [:body [:div#pagination (pagination-controls)]]] |
| 20:39 | devn | or something |
| 20:40 | devn | pagination-controls takes a few args |
| 20:40 | devn | but it offloads as much of the bs as it can |
| 20:40 | TimMc | (pagination-controls 50 0 7145) |
| 20:40 | TimMc | + a link builder function, I guess |
| 20:41 | devn | TimMc: i know this is needed, just not sure what the right way would be to do it for consumers |
| 20:41 | devn | maybe just assume you're using hiccup at first? |
| 20:41 | TimMc | And you'd have to tell it where to find images, if you're using images... |
| 20:42 | devn | that's extra puddin' |
| 20:42 | TimMc | I dunno, I'd want something pretty generic. |
| 20:42 | devn | at first it's just a damned (range 1 (calculated-max-num-pages)) |
| 20:45 | qbg | Maybe you'd want a collection of page number to label mappings? |
| 20:48 | devn | http://getclojure.org/search?q=comp+AND+juxt&num=2 |
| 20:48 | devn | http://www.github.com/devn/getclojure |
| 20:48 | devn | TimMc: you can see the nastiness im doing for pagination. basically it doesn't work for lots of things. i just unconditionally assume there's 10 pages of results. |
| 20:49 | devn | it also needs some design love, but it's seeded with 32k records or so and returns results and plays nice with query strings |
| 20:50 | TimMc | Oh, this is that thing. |
| 20:50 | devn | TimMc: that thing :) |
| 20:51 | devn | TimMc: patches very welcome. i'd like to make it really nice to use. |
| 20:51 | devn | that includes adding some kind of a rating system so people can rate examples based on a couple of dimensions |
| 20:51 | TimMc | devn: Well, the org.timmc/handy thing will certainly tell you how many pages of results you have, and what the next record offset will be. |
| 20:51 | devn | like "idiomatic", "concision", etc. |
| 20:52 | TimMc | devn: "swearjure" |
| 20:52 | devn | haha |
| 20:52 | TimMc | "someone trying to break a bot" |
| 20:52 | devn | "abomination (but still fun anyway)" |
| 20:52 | TimMc | I guess those are more categories than ratings. |
| 20:53 | devn | "thus spake rhickey" |
| 20:53 | devn | etc. |
| 20:53 | Sgeo | What's an abomination? |
| 20:53 | devn | like definitionally? |
| 20:53 | devn | or what we were referring to? |
| 20:53 | Sgeo | What you were referring to |
| 20:53 | devn | we were talking about swearjure |
| 20:53 | Sgeo | Ah |
| 20:54 | devn | I kid the swearjure people. I think it's cool, just trying to guard poor defenseless newbs from running away screaming when they see it. |
| 20:55 | devn | (#(% %) #(% %)) |
| 20:55 | devn | still my favorite |
| 20:55 | Sgeo | That's pretty famous (that concept, not the swearjure), I think |
| 20:55 | ghadishayban | arrgggh local clearing bug in 1.5: https://gist.github.com/w01fe/5088279 |
| 20:55 | devn | yeah, i just like the symmetry in swearjure |
| 20:56 | devn | it looks nice |
| 20:56 | ghadishayban | can't figure out whether it was my code that is blowing the heap or the bug... |
| 20:56 | Sgeo | The Haskell version of that uses letters |
| 20:57 | Sgeo | (\x -> x x) (\x -> x x) |
| 20:57 | Sgeo | Although that can be written as |
| 20:57 | Sgeo | app id id (app id id) |
| 20:57 | Sgeo | I think |
| 20:57 | Sgeo | (According to lambdabot) |
| 20:58 | yedi | how painful is the process of working with nodejs through cljs |
| 20:59 | Sgeo | erm, not app, ap |
| 21:00 | ghadishayban | yedi: check bodil stokke's wonderful work on github, and her video https://www.youtube.com/watch?v=MTxNnYfWHOw&list=PLZdCLR02grLoyWsKpovatiBYJyf-RKx0c |
| 21:00 | Sgeo | id<*>id$id<*>id |
| 21:00 | Sgeo | Should be the same |
| 21:00 | Sgeo | Don't know how to get rid of id there |
| 21:00 | yedi | ghadishayban: many thanks |
| 21:00 | Sgeo | Also, apparently this is not actually valid Haskell |
| 21:01 | ghadishayban | yedi: github/bodil/cljs-noderepl |
| 21:01 | Sgeo | Bot is manipulating things that don't actually type |
| 21:01 | Sgeo | My head hurts |
| 21:04 | Sgeo | Can write a function that can take itself |
| 21:04 | Sgeo | (id can take itself) |
| 21:04 | Sgeo | But can't write (\x -> x x) which can only take a function that can take itself |
| 21:12 | gfredericks | ghadishayban: I had a memory leak a week or two ago which was very similar to the bug but I think just regularly my fault |
| 21:14 | ghadishayban | gfredericks: yeah - it's hard to tell sometime |
| 21:15 | ghadishayban | gfredericks: when you reduce over a large file under a with-open, then try/catch on the inside as well... |
| 21:30 | gfredericks | Raynes: dangit you got me using ^:private now |
| 21:30 | Raynes | gfredericks: Good, good. |
| 21:31 | gfredericks | but it will scare the n00bs |
| 21:33 | ambrosebs | technomancy: Sorry I'm slow. I finally figured out your beef was with the massive dependency that is all of core.typed. Is it you'd rather core.typed just didn't exist at runtime (production?) and just leaves a trace of type annotations on vars? |
| 21:34 | ambrosebs | I was thinking about the actual type checking strategy. |
| 21:36 | ambrosebs | bbl |
| 21:43 | gfredericks | is there a good local name for hiccup data? |
| 21:46 | devn | best JS syntax hilighter for clojure? |
| 21:46 | devn | amalloy_: Raynes: opinions? |
| 21:46 | Raynes | syntaxhilighter |
| 21:46 | Raynes | brehaut wrote a great lexer for it. |
| 21:46 | devn | is that still the one to use? |
| 21:46 | devn | the one from a couple years ago? |
| 21:46 | Raynes | Probably. |
| 21:47 | devn | cool, didn't know if something had moved into its place |
| 21:47 | brehaut | i dont think anybody else has been insane enough to bother |
| 21:47 | devn | i just finished doing cleanup on (clojure.string/join "|" (map (comp str :name meta second) (ns-publics 'clojure.core))) |
| 21:48 | yogthos | syntaxhilighter is pretty fantastic :) |
| 21:48 | devn | for a giant regex |
| 21:48 | devn | trying to use google prettify and am getting more and more disappointed |
| 21:48 | devn | should have stuck with syntaxhighlighter, but it adds way more markup than prettify |
| 21:48 | devn | probably for good reason |
| 21:50 | brehaut | the clojure brush is structurally aware though, which i like to think makes up for it |
| 21:50 | devn | brehaut: yeah, that's important actually |
| 21:50 | devn | im getting some weird issues with prettify highlighting this: |
| 21:51 | devn | (let [-' [10]] (clojure.core/seq (clojure.core/concat -'))) |
| 21:51 | devn | it misses the outer closing ] in the let binding form |
| 21:51 | brehaut | my clojure brush misses #= stuff |
| 21:52 | devn | brehaut: that could be an issue for me :X |
| 21:52 | brehaut | patches welcome ;) |
| 21:52 | devn | hahaha |
| 21:52 | devn | brehaut: what's the link to your highlighter? |
| 21:52 | brehaut | mostly i jest; theres quite a large loop you'd have to tackle |
| 21:52 | devn | inc-clojure-brush? |
| 21:52 | brehaut | https://github.com/brehaut/inc-clojure-brush |
| 21:52 | brehaut | yeah thts it |
| 21:52 | devn | k cool |
| 21:54 | brehaut | its probably actually not too hard to add; mostly it'd be like supporting #_ |
| 22:28 | gfredericks | is anybody on the latest CLJS? I got an NPE when the first form in my file was (foo.bar "docstring") |
| 22:28 | gfredericks | would like to report it as a "bad error" bug |
| 22:34 | devn | brehaut: what's the proper way to wrap with your brush? |
| 22:35 | gfredericks | to the beat |
| 22:35 | devn | brehaut: is that a css override i should use? basically, in some cases the code is an extremely long line. I'd like to wrap it for viewing purposes. Is there a good way to wrap? |
| 22:35 | devn | gfredericks: well played |
| 22:35 | devn | (inc gfredericks) |
| 22:35 | lazybot | ⇒ 16 |
| 22:35 | gfredericks | a hypercube! |
| 22:36 | brehaut | devn: yeah i think you can add an overflow declaration to something syntax highlighter adds. just a moment |
| 22:36 | devn | (-> with-wrapper the-beat) |
| 22:36 | devn | brehaut: i can show you what i mean, one sec |
| 22:37 | brehaut | devn: sure. actually, if you want it to wrap rather scroll, you might be out of luck. thats outside the scope of the brush itself |
| 22:39 | devn | brehaut: deploying right now |
| 22:39 | devn | brehaut: yeah. i figured. it doesn't *have to* be that way |
| 22:40 | devn | im just looking for a way to display long lines in a way that doesn't suck |
| 22:40 | tomoj | &(reduce-kv #(assoc %1 %3 %2) {} [:foo :bar :baz]) |
| 22:40 | lazybot | ⇒ {:baz 2, :bar 1, :foo 0} |
| 22:40 | tomoj | &(clojure.set/map-invert [:foo :bar :baz]) |
| 22:40 | lazybot | java.lang.UnsupportedOperationException: nth not supported on this type: Keyword |
| 22:40 | devn | either that means changing to something like opening the code in a new window or something |
| 22:41 | devn | brehaut: http://getclojure.org/search?q=comp+AND+juxt&num=0 |
| 22:41 | devn | see the first result for example |
| 22:41 | brehaut | devn: i think you are limited to scrolling horiz; syntax highlighter outputs a table with two columns, one for line numbers, one for code. it limits options :/ |
| 22:42 | devn | but i could do a collapse and truncate the line or something |
| 22:42 | devn | with jTruncate |
| 22:42 | brehaut | devn: if you are happy with not having line numbers, you'll probably just be able to use some css |
| 22:42 | devn | idk, requires some imagination |
| 22:42 | brehaut | just a moment |
| 22:42 | devn | just trying to get an idea of what is usable |
| 22:43 | devn | one other unfortunate bit is that i think SyntaxHighlighter kills my pretty printing of clojure code using code-dispatch |
| 22:43 | devn | :( |
| 22:43 | devn | oops, no, nevermind, still works |
| 22:44 | devn | see: ((comp (juxt (juxt first second) (juxt (comp first rest rest) (comp second rest rest ...)))) |
| 22:44 | devn | on the above URL |
| 22:45 | brehaut | i dont know what it should look like? |
| 22:45 | devn | heh, nor do i |
| 22:45 | devn | im soliciting suggestions |
| 22:46 | devn | basically, what would be a good thing to do for disgustingly long values or output? |
| 22:59 | pppaul | you juxt my heart away |
| 23:01 | Raynes | Oh stop, you're making amalloy blush. |
| 23:36 | devn | you (comp)lete me |
| 23:42 | Raynes | devn: Maaaaaaaaaaarry me. |