2013-06-17
| 00:00 | ddellacosta | cemerick: but self-hosting cljs would probably be better anyways, if you mean something loading in the browser env itself (?) |
| 00:00 | dnolen | hrm was going push out the first core.match beta but doesn't seem to want to build ... |
| 00:00 | cemerick | ddellacosta: yup |
| 00:01 | ddellacosta | cemerick: gotcha. Yeah, that would certainly be the best I think. |
| 00:02 | tomjack | hmm, you've discovered a new collection type? :) |
| 00:02 | ddellacosta | alright, I'm going to grab some lunch. cemerick: thanks for the help and pointers, I'll keep trying new things and try to communicate any new strategies I learn for getting my workflow/tooling smoother. |
| 00:02 | dnolen | tomjack: doubtful :) |
| 00:02 | cemerick | ddellacosta: https://github.com/kanaka/clojurescript/ |
| 00:03 | ddellacosta | ah, sweet. |
| 00:03 | cemerick | ddellacosta: np, and thanks :-) Maybe I'll squeeze off a 5m video sometime :-) |
| 00:03 | ddellacosta | sad the last commit is 4 years back. :-( |
| 00:03 | ddellacosta | cemerick: that'd be great! |
| 00:03 | cemerick | what, no |
| 00:03 | ddellacosta | oh, maybe wrong branch then |
| 00:04 | ddellacosta | yeah, that's weird, huh, since the README reference 2013 |
| 00:04 | ddellacosta | 2012 I mean |
| 00:04 | cemerick | ddellacosta: something's wonky...cljs isn't even two years old |
| 00:04 | ddellacosta | yeah, good point..heh |
| 00:04 | tomjack | dnolen: looking at Complier that's really the only explanation I can think of, though.. |
| 00:04 | ddellacosta | cemerick: yeah, clearly the commit log shows recent commits, so something is weird there. Anyways, will check it out. |
| 00:05 | dnolen | tomjack: eh, probably Hudson weirdness |
| 00:05 | tomjack | all the constructor calls for EmptyExpr are guarded with IPersistentCollection checks |
| 00:06 | tomjack | but it's not a list, vector, map, or set? boggling |
| 00:06 | cemerick | dnolen: I'd try wiping the hudson workspace and triggering a new build |
| 00:06 | dnolen | cemerick: how do you do that? |
| 00:06 | cemerick | dnolen: click on workspace, then 'wipe' |
| 00:07 | cemerick | then start a build |
| 00:07 | tomjack | hmm, PatternRow is a new collection type, irrelevant? |
| 00:07 | dnolen | cemerick: ok giving that a shot |
| 00:08 | cemerick | dnolen: that's the "clean" of the hudson world :-P |
| 00:08 | dnolen | tomjack: hrm, but why would that matter? |
| 00:09 | dnolen | cemerick: didn't work |
| 00:09 | dnolen | tomjack: and PatternRow has been a collection for a long time now |
| 00:09 | tomjack | but you just started AOT'ing, yes? |
| 00:10 | tomjack | doesn't make sense that it would break on hudson and not locally though |
| 00:10 | cemerick | dnolen: your project.clj requires clojure 1.5, but the default contrib pom specifies 1.4? |
| 00:10 | tomjack | actually |
| 00:10 | tomjack | I get the same error locally |
| 00:10 | dnolen | tomjack: yes I've been testing AOT locally |
| 00:11 | dnolen | cemerick: oh hmm |
| 00:11 | dnolen | tomjack: what are you doing to repro? |
| 00:11 | tomjack | mvn compile |
| 00:12 | tomjack | from master |
| 00:13 | dnolen | tomjack: yeah just tried that worked |
| 00:14 | dnolen | oops actually spoke too soon |
| 00:16 | tomjack | if PatternRow were the culprit I'd guess some macro would have to be returning one in the code it emits? |
| 00:17 | tomjack | and an empty one |
| 00:20 | dnolen | tomjack: pretty sure it's as cemerick says 1.5.0 issue |
| 00:23 | tomjack | seems so |
| 00:23 | tomjack | which is even more confusing to me |
| 00:25 | tomjack | because EmptyExpr seems the same in the relevant respects |
| 00:25 | dnolen | huzzah |
| 00:25 | tomjack | if not all respects |
| 00:25 | dnolen | core.match-beta1 is out! |
| 00:26 | dnolen | no more scary AOT warnings! |
| 00:41 | dnolen | it's remarkably satisfying that this stuff "just works" in CLJS |
| 00:53 | tomjack | so, what, using as-> and cond-> caused that crazy compiler error? O_o |
| 00:54 | dnolen | tomjack: no, I think marker protocols was the problem |
| 00:58 | tomjack | interesting |
| 01:00 | tomjack | https://groups.google.com/d/msg/clojure/7xa7Yg0-htc/fG1HuBozewwJ |
| 01:00 | tomjack | so the fix was a workaround in emit-protocol |
| 01:03 | dnolen | beta2 going out |
| 04:14 | ddellacosta | so, "null" and nil are not the same thing in ClojureScript?? |
| 04:14 | lazybot | ddellacosta: Uh, no. Why would you even ask? |
| 04:14 | ddellacosta | ?? |
| 04:14 | lazybot | ddellacosta: What are you, crazy? Of course not! |
| 04:14 | mthvedt | ?? |
| 04:14 | lazybot | mthvedt: Uh, no. Why would you even ask? |
| 04:14 | ddellacosta | didn't know lazybot did that. heh. |
| 04:14 | mthvedt | lazybot: are you well programmed?? |
| 04:14 | lazybot | mthvedt: Uh, no. Why would you even ask? |
| 04:15 | r0bgleeson | ddellacosta: did what, aritificial intelligence? |
| 04:15 | ddellacosta | r0bgleeson: no, responded with something specifically when you had double-question marks (if my conclusion is correct.) |
| 04:16 | ddellacosta | r0bgleeson: although, I guess maybe that's what you meant, so yes. |
| 04:17 | r0bgleeson | ddellacosta: i was making a lame joke :) |
| 04:17 | ddellacosta | r0bgleeson: ah, haha…sorry, I'm feeling a bit slow at the moment. ;-) |
| 04:47 | Guest15375 | @borkdude Hello |
| 04:47 | borkdude | Guest15375 hi |
| 04:48 | Guest15375 | @borkdude Nathan and Bram here, we have a question |
| 04:48 | borkdude | yes |
| 04:49 | borkdude | I'll turn on Skype |
| 04:50 | Guest15375 | @borkdude Is good, are you available on the HU? |
| 04:50 | borkdude | Guest15375 my skype name is michielborkent - no, from 14:00 I'm at the HU |
| 04:51 | Guest15375 | @borkdude Inventation has been sent. |
| 04:55 | wei_ | how do you serve a static html file in a compojure route? |
| 04:59 | clgv | wei_: route/files |
| 04:59 | clgv | wei_: with compojure.route :as route |
| 04:59 | wei_ | clgv: could I give it a name that's not the original filename? |
| 05:00 | Raynes | Eh |
| 05:00 | wei_ | oh i se |
| 05:00 | Raynes | wei_: Just do (let [static (slurp your-file-or-resource)] (defroutes …)) and serve it however you like it. |
| 05:00 | Raynes | That's what I do. |
| 05:00 | Raynes | More or less |
| 05:01 | wei_ | thanks |
| 05:01 | clgv | Raynes: but that keeps the file in memory which is not suitable in all use cases (very many large files...) |
| 05:02 | Raynes | uh |
| 05:02 | Raynes | clgv: If your HTML files are that large, you're going to have a hell of a time serving that data at any decent rate anyways. |
| 05:03 | Raynes | Unless you've got 20 100MB HTML files, you're probably okay. |
| 05:03 | clgv | Raynes: oh, the question was to html files only - I did miss that ;) |
| 05:04 | wei_ | there are huge html files, but mine is not one of them |
| 05:08 | bsmith | hi, i'm new and trying to understand code from ring |
| 05:08 | bsmith | (defn- ^SimpleDateFormat formatter [format] ...) |
| 05:08 | bsmith | does ^SimpleDateFormat have any effect here? or is it just to communicate the return type to the reader? |
| 05:09 | antares_ | bsmith: and to the compiler, too |
| 05:11 | bsmith | what effect does this have during compile-time or run-time? will it throw if the function returns a different type? |
| 05:11 | bsmith | is there a doc on clojure.org that explains this? sorry, i couldn't find one |
| 05:12 | borkdude | bsmith this is called type hinting |
| 05:12 | borkdude | http://clojure.org/java_interop#Java Interop-Type Hints |
| 05:12 | antares_ | bsmith: Clojure functions are compiled to Java classes that have invocation methods. They can take arguments of specific types or just Object, the same goes for return value. |
| 05:13 | antares_ | bsmith: Clojure compiler only considers type hints as advice and has limited type inference. it does not perform type checking. JVM also performs very little type checking but mis-hinting argument types won't come unnoticed most of the time, at runtime. |
| 05:14 | bsmith | great, thanks to both |
| 05:14 | antares_ | bsmith: I highly recommend http://clojure-doc.org, by the way |
| 05:15 | callen | just wish clojuredocs would get updated. |
| 05:15 | callen | antares_: how do you feel about a clojurewiki? |
| 05:16 | antares_ | callen: not sure what that is |
| 05:17 | callen | antares_: thinking of making a wiki for Clojure, like EmacsWiki |
| 05:18 | antares_ | callen: well, if the goal is to improve Clojure doc guides, just contribute to clojure-doc.org |
| 05:18 | antares_ | (which has a bit too much stuff because of how enthusiastic we were in the beginning, admittedly) |
| 05:19 | antares_ | emacswiki has *a lot* of stuff Emacs docs will never cover |
| 05:19 | callen | antares_: contributing to clojure-doc is really annoying. |
| 05:19 | antares_ | for that, more resources make sense |
| 05:19 | antares_ | callen: how? |
| 05:19 | callen | antares_: and AFAICT, it doesn't really cover the core docs use case like clojuredocs. |
| 05:19 | antares_ | it's markdown in a pull request on github |
| 05:19 | callen | antares_: dude, that's unacceptable. I'm sorry. |
| 05:19 | antares_ | how much more straightforward can it be? |
| 05:19 | callen | antares_: it's about friction, not obviousness. |
| 05:20 | antares_ | callen: hm |
| 05:20 | antares_ | callen: have you tried contributing to clojure at all? |
| 05:20 | antares_ | THAT'S unacceptable and friction |
| 05:20 | callen | antares_: I really don't care about core dev in this context |
| 05:20 | callen | antares_: their sins don't excuse yours. |
| 05:20 | antares_ | callen: you can literally edit markdown on github.com |
| 05:20 | callen | why is it easier to accumulate knowledge collaboratively for a text editor than a programming language + ecosystem? |
| 05:20 | callen | antares_: yeah, still don't care. |
| 05:21 | antares_ | how much more convenient can it be? |
| 05:21 | callen | antares_: it's not, at all. |
| 05:21 | antares_ | callen: sounds like you just "don't care for markdown". I don't care for wikis. |
| 05:21 | callen | it has nothing to do with markdown |
| 05:21 | antares_ | wikis are too hard to keep structured |
| 05:21 | callen | in fact I planned on using md for the wiki. |
| 05:21 | antares_ | callen: then how is it radically easier to edit a wiki page? |
| 05:21 | callen | if you don't understand the value of immediacy I can't really help you. |
| 05:21 | callen | antares_: just say, "no, I don |
| 05:22 | callen | 't see the value of a wiki" |
| 05:22 | antares_ | callen: I really don't think people contribute solid docs on the spot |
| 05:22 | callen | and leave it at that. |
| 05:22 | antares_ | like, let me JUST WHIM OUT SOME DOCS, RIGHT NOW |
| 05:22 | antares_ | no, that's not how it works |
| 05:22 | callen | you clearly haven't worked on a wiki. |
| 05:22 | antares_ | callen: yes I have, for many years. It's fucking terrible. |
| 05:23 | antares_ | wikis are undstructured mess unless you have an army of people and rules enforcing the structure, like Wikipedia does |
| 05:23 | antares_ | you same some time for writers |
| 05:23 | antares_ | and waste oceans of time for readers |
| 05:23 | antares_ | in any case, I don't mind you starting a wiki |
| 05:23 | antares_ | clojure-doc.org content is "free to steal", CC 3.0 licensed |
| 05:23 | antares_ | I don't believe the language documentation needs another resource |
| 05:24 | antares_ | and API reference (clojuredocs.rg) has nothing to do with clojure-doc.org, it was never a goal to provide an API ref |
| 05:24 | callen | antares_: I didn't say it was |
| 05:24 | antares_ | the new clojuredocs.org, whenever it is ready, can be integrated into clojure-doc.org |
| 05:24 | callen | antares_: I wasn't talking about clojure-doc at all. |
| 05:24 | antares_ | but it's still a separate resource, with an API |
| 05:25 | antares_ | callen: there is a wiki at dev.clojure.org for the cool kids with paper CA (read: living in America) |
| 05:25 | antares_ | it's not updated very often |
| 05:25 | callen | antares_: I hate JIRA |
| 05:25 | antares_ | in theory, it provides the benefits of a wiki |
| 05:25 | callen | and I don't want a wiki that requires CA |
| 05:25 | antares_ | that I can understand |
| 05:25 | callen | antares_: if you're going to offer suggestions, at least think first. |
| 05:25 | callen | antares_: if I want a low friction way to accumulate knowledge about clojure and the wider ecosystem, why would dev.clojure suffice? |
| 05:26 | antares_ | callen: you know what, I will probably go work on some OSS code instead of arguing you |
| 05:26 | callen | antares_: I just wanted to know if the notion of a wiki seemed useful to you or not. |
| 05:27 | callen | a simple no would've sufficed. |
| 05:27 | antares_ | callen: wikis suck. There is no need for another doc resource. Spend your time helping with the new clojuredocs.org. That's all I have to say. |
| 05:27 | callen | what new clojuredocs? |
| 05:27 | callen | as far as I aware, it was derelict. |
| 05:27 | antares_ | clojuredocs.org in Clojure, without being locked into a particular version http://github.com/clojuredocs |
| 05:27 | antares_ | and with an API |
| 05:28 | antares_ | the repo name is eisago |
| 05:29 | callen | antares_: it was last updated 7 months ago. |
| 05:29 | antares_ | callen: I will write a blog post about it |
| 05:29 | antares_ | callen: so? |
| 05:30 | callen | and it's still not live |
| 05:30 | antares_ | callen: the original author no longer has time |
| 05:30 | antares_ | callen: are you arguing to death about anything or just with me? |
| 05:30 | antares_ | fuckin make it go live |
| 05:30 | callen | why invest effort with no guarantee it would go live? |
| 05:30 | antares_ | hahahahaha |
| 05:30 | antares_ | callen: that's not how OSS works |
| 05:30 | antares_ | finish the code, deploy it, here, you have it live |
| 05:31 | callen | it's not even what I want |
| 05:31 | callen | what I want is the core docs + wiki |
| 05:31 | callen | I don't give a damn about an API either. |
| 05:31 | antares_ | callen: it is what clojuredocs.org has today |
| 05:31 | antares_ | + API |
| 05:31 | antares_ | callen: well you don't but it's useful |
| 05:31 | antares_ | a yet another wiki? no |
| 05:31 | antares_ | tools developers care about API reference having an API |
| 05:32 | antares_ | IDE plugin authors, nrepl integration hackers, etc |
| 05:33 | antares_ | you think I asked someone's permission to start clojurewerkz.org or clojure-doc.org, making sure it is "guaranteed to go live"? No, we just did it, it is live. That's how things work in the OSS community. |
| 05:33 | callen | antares_: I've run into problems in the past where somebody else owned the domain/trademark and I couldn't deploy a copy |
| 05:33 | callen | antares_: and if I wanted changes to go live, I had to harass them |
| 05:33 | callen | antares_: please stop pompously educating me on how "OSS works" |
| 05:34 | antares_ | callen: well, if you develop a clojuredocs.org replacement, I will point api.clojure-doc.org or reference.clojure-doc.org to it, I promise |
| 05:34 | callen | I've already said it isn't what I want, contributing to it wouldn't make sense. |
| 05:35 | antares_ | callen: I have no idea what you want then, but it's clearly something that YOU have to do |
| 05:35 | antares_ | contributing to things that are useful to the community are not your thing, I gather |
| 05:35 | callen | no, it just makes sense. |
| 05:35 | antares_ | good luck. No need to ask anybody for an opinion next time :) |
| 05:35 | callen | if I don't understand what I'd want out of it, I'm less capable of producing something nice and useful. |
| 05:36 | callen | That's just basic usability. |
| 05:36 | callen | all I wanted to know was if a wiki would be useful. Not to be put through the wringer. |
| 05:37 | antares_ | ok, I'm sorry |
| 05:39 | callen | antares_: it's fine, I just find it puzzling how people seem to think spontaneous content creation that doesn't belong to Stack Exchange wouldn't be useful. |
| 05:42 | antares_ | it is useful, I was talking about language documentation |
| 05:46 | callen | antares_: well if the new clojuredocs is a thing, then I can just focus on the wiki and hope that comes together. |
| 05:47 | antares_ | callen: most of it is done, I hope to work on it after we ship our next clojurewerkz library |
| 05:48 | antares_ | it also has a library that extracts docstrings and such from the code |
| 05:48 | antares_ | at the very least you can reuse that |
| 05:49 | callen | antares_: oooh, what's the next clojurewerkz library? |
| 05:49 | antares_ | http://clojurecassandra.info |
| 05:49 | callen | Very cool :) |
| 05:49 | antares_ | needs the docs finished and a proper announcement, currently at RC4 |
| 05:50 | antares_ | built on the new DataStax Java driver, pretty similar to clojure.java.jdbc in scope and API style |
| 06:26 | noncom | why does in COMPOJURE something like (GET "/test" [] {:a "aaa" :b "bbb}) retuns an empty page with no html code at all, and (GET "/test" [] (str {:a "aaa" :b "bbb})) returns a page with the textified map? |
| 06:27 | noncom | i mean why does not it turn the map into text by itself and yields nothing from it? |
| 06:27 | mpenet | because when you return a map it's supposed to follow the response spec |
| 06:27 | mpenet | from ring |
| 06:27 | mpenet | {:body "prout"} |
| 06:27 | mpenet | if you want an output |
| 06:28 | mpenet | a string return value will be fed to :body automagically |
| 06:28 | noncom | mpenet: oh i see! nice thing actually! didn't get to this point at docs, but thank you! |
| 06:28 | mpenet | noncom: https://github.com/ring-clojure/ring/blob/master/SPEC |
| 07:05 | m00nlight | Hi, if I build an web app using compojure, I can access the app through the localhost or even the machine in the same cluster, but can not access outside, what probabilily make this ? I can not access even I close the iptables |
| 07:13 | noidi | m00nlight, maybe your behind a NAT? |
| 07:13 | noidi | *you're |
| 07:13 | m00nlight | noidi: Yeah, I think so. My personal computer behinde an NAT, |
| 07:15 | m00nlight | noidi: So what maybe the problem? |
| 07:18 | noidi | m00nlight, you need to forward a port on the NATing device to your computer |
| 07:18 | noidi | m00nlight, http://en.wikipedia.org/wiki/Port_forwarding |
| 07:20 | m00nlight | noidi: if the server has an external IP, I still need forward a port? |
| 07:20 | m00nlight | noidi: The server has an external IP address |
| 07:21 | clgv | m00nlight: you are probably behind a router and need to forward the port at the router to your server |
| 07:23 | m00nlight | clgv: If I can not make change to the router server, is there any way to solve it? I can do anything on the server my application was on |
| 07:24 | clgv | m00nlight: you definitely need the system that is "in front of" your server to forward the port |
| 07:26 | m00nlight | clgv noidi: Thanks for your help |
| 07:30 | clgv | m00nlight: just to clarify, you rent a server in a computing center? |
| 07:46 | loz | hi |
| 07:47 | loz | how should i install data.json library? |
| 07:47 | loz | if i dont have a clojure project, its needed for rails/clojurescript? |
| 08:01 | cemerick | loz: Neither Clojure or ClojureScript libraries are "installed". They are obtained and tracked by a project file like those used by Leiningen. |
| 08:04 | loz | cemerick: i already found jar snapshots |
| 08:05 | loz | but i still got |
| 08:05 | loz | Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/data/json__init.class or clojure/data/json.clj on classpath: |
| 08:05 | cemerick | loz: are you using Leiningen? |
| 08:05 | loz | i dont have clojure project |
| 08:06 | cemerick | that's problem #1 |
| 08:06 | loz | does this error mean data.json is not in classpath? |
| 08:07 | cemerick | yup |
| 08:14 | loz | cemerick: should i add to classpath every .jar which bootstrap downloads? |
| 08:14 | loz | like google-closure-library-0.0-2029-2.jar |
| 08:15 | cemerick | loz: Unless you have a really good reason, you should be using leiningen. |
| 08:15 | loz | its rails dude |
| 08:16 | loz | and there is plugins for rails wich downloads and setups clojurescript |
| 08:16 | loz | plugin* |
| 08:16 | loz | and looks like this plugin is a bit outdated |
| 08:16 | cemerick | loz: don't konw what to tell you then. I suspect you'll find everyone else here (whenever they wake up, ;-) will repeat the same line about leiningen. |
| 08:17 | cemerick | perhaps ask whoever put together this rails/clojurescript integration how things are supposed to work there? |
| 08:18 | loz | okey, ill continue my investigation) |
| 08:19 | tomjack | script/bootstrap should download data.json |
| 08:20 | loz | tomjack: yep, but plugin doesnt include it into classpath |
| 08:20 | loz | gonna include every jar bootstrap downloads |
| 08:20 | loz | and try |
| 08:20 | loz | ls |
| 08:20 | lazybot | dev etc lost+found media root src |
| 08:21 | loz | haha lol |
| 08:23 | cemerick | loz: could you link to this rails/clojurescript thing? |
| 08:23 | loz | sure |
| 08:23 | loz | https://github.com/maximvl/clementine |
| 08:23 | loz | there is a blog post link on how to setup it |
| 08:25 | loz | oh and i gave you my fork link) |
| 08:25 | cemerick | np |
| 08:25 | cemerick | so this clojurescript source tree in /ext -- this is an example of the whole rails "vendoring" practice? |
| 08:26 | loz | idk im new to rails :D |
| 08:28 | cemerick | funny, reminds me of JSP precompilation |
| 08:29 | loz | is this code correct? |
| 08:29 | loz | (ns app) |
| 08:29 | loz | (defn ^:export init [] |
| 08:29 | loz | (js/alert "initializing!")) |
| 08:29 | loz | |
| 08:29 | loz | want to call ns.init() from html |
| 08:30 | loz | *app.init() |
| 08:31 | loz | cause now i get |
| 08:31 | loz | Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol |
| 08:31 | loz | |
| 08:39 | xeqi | cemerick: looks like thats a ruby project, but its a similar concept |
| 08:40 | cemerick | xeqi: Yup. Quite upsidedowninsideoutbackwards to me, but whatever. :-) |
| 08:41 | xeqi | heh, its recommended for external code. here is a rubygems guide showing it for a C wrapper http://guides.rubygems.org/c-extensions/ |
| 08:42 | cemerick | xeqi: don't mind me being curmudgeonly. I'm merely a ruby/rails observer, never used the stuff. |
| 08:43 | xeqi | cemerick: well now you've peaked my curiousity. Hows jni or the .net equivalent find the native code? |
| 08:44 | xeqi | *piqued |
| 08:45 | cemerick | xeqi: You can put C or C++ right into a .NET project, the tooling there saves you all of the legwork needed for mixed architecture stuff elsewhere. There's some details around whether the resulting assembly is managed or not, but I've long forgotten them. |
| 08:47 | cemerick | xeqi: JNI is a PITA. JNA is much more sane...and even so, it's *really* rare to have a mixed e.g. C + #{Java, Clojure, Scala} codebase. Generally, you're just linking to a library pulled from apt or whatever. |
| 08:48 | loz | xeqi: do you have any experience with cljs on rails?) |
| 08:48 | cemerick | Rails aside, it seems to be a common thing in ruby only because so many of its modules are apparently thin C wrappers |
| 08:49 | hyPiRion | xeqi: oh, JNI is painful. Anything very low-level is painful in general |
| 08:50 | xeqi | loz: nope |
| 08:51 | cemerick | hyPiRion: ever used JNA? It wasn't so bad, last time I used it (~2 years now) |
| 08:54 | hyPiRion | cemerick: I was more thinking about low-level jvm stuff, such as catching POSIX signals or throwing file decriptors from a process to another |
| 08:54 | hyPiRion | I managed to find a way to catch POSIX signals, although if the method which handles the exceptions throws an exception you end up with a segfault |
| 08:55 | hyPiRion | /s/exceptions/signals/ |
| 09:23 | futile | mthvedt: it's gonna be kinda weird that each "group" is self-contained, because each one's :parent key will contain another group, rather than reference it. |
| 11:01 | stuartsierra | JNI isn't that bad. You can skim the docs and get something running in half an hour. |
| 11:04 | wink | that's like "you can skim the recipe and not die eating what you cooked" |
| 11:05 | llasram | That is the best analogy I've heard all week |
| 11:05 | bpr | that is pretty classic |
| 11:07 | janpaulbultmann | Any thoughts on how to do co recursion with let bindings? akin to this https://gist.github.com/ticking/5797558 |
| 11:09 | llasram | janpaulbultmann: Lazy sequences which references themselves sometimes work, but as an implementation side-effect. They generally are not a good idea |
| 11:11 | janpaulbultmann | llasram: thanks, noted :) |
| 11:24 | mikerod | Has anyone used clojure-maven-plugin and experienced it hanging for a pretty long time when compiling the last Clojure file. The file doesn't seem to matter, it just freezes up a while after the last "Compiling file.clj" line. |
| 11:25 | Lajjla | mikerod, |
| 11:25 | Lajjla | the Ashtadhyayi is the single most brilliant thing ever made by man |
| 11:28 | mikerod | Lajjla: I'm not sure I follow you... |
| 11:28 | Lajjla | mikerod, do you know what it is? |
| 11:28 | mikerod | I had to look up this Ashtadhyayi, and the most relevant meaning I could find is its relation to language theory. |
| 11:28 | Lajjla | It's essentially a formal definition of the grammar of Sanskrit in some sort of backus-nauer esque form |
| 11:28 | Lajjla | made 400 BCE. |
| 11:28 | Lajjla | A formal definition of the grammar of a natural language. |
| 11:28 | Lajjla | At that time |
| 11:28 | Lajjla | It took up to the 20th century before western linguistics could catch up. |
| 11:30 | mikerod | Lajjla: That is quite interesting. hah |
| 11:31 | mikerod | Lajjla: You found that this relates to clojure-maven-plugin? :) |
| 11:31 | Lajjla | mikerod, panini also innovated the destinction of the phone to the phoneme |
| 11:31 | Lajjla | mikerod, not at all. |
| 11:31 | Lajjla | It is far more important |
| 11:31 | Lajjla | because it is the single most brilliant thing ever |
| 11:32 | Lajjla | the Ashtadhyayi fully defines the grammar of sanskrit with zero redundancy |
| 11:32 | ohpauleez | it's unclear if this is spam or a troll |
| 11:32 | ohpauleez | but either way, it's irrelevant |
| 11:32 | mikerod | Lajjla: Well, I am enlightened now. |
| 11:32 | ohpauleez | haha |
| 11:32 | ken_barber | lol |
| 11:33 | Lajjla | ohpauleez, please, this is something anyone should know. |
| 11:33 | Lajjla | The Ashtadhyayi was two millennia before its time |
| 11:33 | llasram | Oddest spammer ever |
| 11:33 | ohpauleez | yes |
| 11:33 | ohpauleez | for real |
| 11:34 | Lajjla | it innovated the formal system, it gave a rudimentary definition of a finit etate machine, it innovated the destinction between the phone and the phoneme |
| 11:34 | ohpauleez | can we get an admin? |
| 11:34 | Lajjla | How can you consider appreciation for such a monumental effort spam? |
| 11:34 | Lajjla | What kind of willfully ignorant person are you to not recognise the significance of the ashtadhyayi, nor its brilliance. |
| 11:35 | mthvedt | i feel like the time cube guy has found a new hobby |
| 11:35 | llasram | Lajjla: No matter brilliance, it is far off topic for this channel, and thus contextually spam |
| 11:36 | Lajjla | Brilliance ought never to be off topic. |
| 11:36 | Lajjla | Besides |
| 11:36 | Lajjla | it stands at the very fundament of programming languages. |
| 11:36 | ohpauleez | We've recently had a bit of an issue with spammers in the channel (most likely because of our charming personalities and stunning good looks) |
| 11:37 | ohpauleez | nonetheless, it's a good way to get you kicked |
| 11:37 | Lajjla | Please, I've been doing this for 5 years in this channel. |
| 11:37 | Lajjla | Raynes loves me. |
| 11:37 | Lajjla | Do you not raynes? |
| 12:03 | futile | Thinking it's nearing done: https://github.com/evanescence/test2/blob/master/SPEC.md |
| 12:03 | futile | It addresses the issues amalloy_ and mthvedt have recently brought up. |
| 12:07 | bbloom | futile: why are there still noun suffixes on everything? |
| 12:07 | bbloom | (runner finder reporter) => (run find report) |
| 12:07 | bbloom | they are functions, not abstractions, right? |
| 12:09 | bbloom | and another nit pick: to me, "find" implies searching for one or a few specific things. "discover" implies searching for anything that you might uncover. |
| 12:14 | futile | bbloom: I think of them as roles, not just functions. |
| 12:15 | futile | bbloom: the fact that it's currently a function is incidental (although they'll likely always be functions) |
| 12:15 | bbloom | futile: you are specifying them to be functions.... |
| 12:15 | futile | bbloom: i like the idea of renaming finder -> discoverer though |
| 12:15 | futile | bbloom: yes. but i still think of them as roles. |
| 12:15 | futile | bbloom: it's hard to refer to them in the documentation as verbs: |
| 12:15 | bbloom | futile: that's just leftover OOP brain damage :-) |
| 12:16 | futile | bbloom: it may be so. let me look through the spec for a second. |
| 12:16 | bbloom | (str "the " role " function") |
| 12:16 | futile | maybe its not as ugly as im thinking to say it |
| 12:16 | futile | "The Runner does not need to return." -> "`run` does not need to return." |
| 12:16 | futile | I can see that. |
| 12:16 | bbloom | yup |
| 12:17 | bbloom | i'm sure somebody already pull this move on you: |
| 12:17 | bbloom | ~nouns |
| 12:17 | clojurebot | excusez-moi |
| 12:17 | bbloom | ~kingdom |
| 12:17 | clojurebot | It's greek to me. |
| 12:17 | bbloom | blah. |
| 12:17 | bbloom | ~noun |
| 12:17 | clojurebot | LINE-ing-en ['laɪnɪŋən] |
| 12:17 | futile | bbloom: yea i saw that |
| 12:17 | futile | didnt read it yet, but yeah |
| 12:17 | futile | i mean i skimmed it |
| 12:17 | futile | yegge is verbose |
| 12:17 | mthvedt | bbloom: having a test file full of "run"s seems confusing |
| 12:17 | bbloom | yes, yegge is very verbose |
| 12:18 | bbloom | mthvedt: no, you have a test file full of tests…. you only need one run function |
| 12:18 | mthvedt | sorry, misread |
| 12:18 | TimMc | If this is who I think it is: /ignore -replies *!g2g2go2@* |
| 12:19 | TimMc | Oh, it's the other one. |
| 12:19 | futile | bbloom: for example, a "Definer" is an extension that happens to provide one or more ways to define tests. it may not even use functions, it may use macros |
| 12:19 | mthvedt | but the objection works for finder and reporter… i think the idea is that you might have other impls |
| 12:20 | futile | bbloom: but the Definer is really the extension, which serves a purpose, does a role, but its still the extension itself, which is a noun. |
| 12:20 | rlb | what's the name of the command line library that automatically handles sub commands? |
| 12:20 | rlb | i.e. "$ foo cmd ..." |
| 12:21 | bbloom | futile: this is a trivial matter of word smithing |
| 12:21 | bbloom | futile: rename your sections to "Definitions", "Assertions", "Discovery", "Execution", and "Reporting" |
| 12:21 | bbloom | rename the finder/runner/reporter functions to discover/run/report |
| 12:21 | bbloom | or discover/execute/report |
| 12:22 | bbloom | you don't need to reify the "roles" |
| 12:22 | devn | rlb: er, not sure? |
| 12:22 | futile | bbloom: fancy |
| 12:22 | rlb | devn: ok, thanks -- someone posted it either here or on the list a while back, but now I can't recall the name. |
| 12:22 | futile | bbloom: I like that idea. But I think it's a last priority, and I'd like to get the rest of the spec itself mostly finished before I go s/this/that/ anything. |
| 12:23 | mthvedt | i would remove the nouns definer and asserter, but keep the other ones |
| 12:23 | bpr | #p |
| 12:23 | bpr | bleh |
| 12:24 | rlb | devn: I assumed I'd be able to find it via web search when I wanted to go back and look at it, but so far, no luck. |
| 12:24 | devn | rlb: i did a cursory search for you |
| 12:24 | devn | but no dice |
| 12:25 | devn | rlb: is it an argument parsing library then? |
| 12:25 | rlb | yes |
| 12:25 | rlb | I thought it was posted by someone from one of the clojure companies I'd heard of, but don't recall... |
| 12:25 | rlb | (there was a github page, etc.) |
| 12:25 | rlb | devn: anyway, thanks -- I'm sure I'll find it eventually. |
| 12:25 | mthvedt | oo style nouns like 'asserter' are loaded with the idea that you're talking about closures with behavior |
| 12:26 | mthvedt | behavior that fits an interface to some other lib |
| 12:26 | rlb | devn: if I recall correctly, the lib made it easy to specify the sub-commands and their behavior. |
| 12:26 | mthvedt | but asserters are consumers of the test2 interface |
| 12:26 | bbloom | mthvedt: yeah, when i see an actor suffix like -er or -or, i assume there is state in that thing |
| 12:27 | devn | rlb: i found an old one: argparse4clj (https://github.com/tatsuhiro-t/argparse4clj) |
| 12:27 | futile | bbloom: that sounds like a faulty assumption on your part, not a bad definition |
| 12:27 | rlb | devn: yeah -- that's not the name I recall |
| 12:27 | rlb | devn: it was some *other* lib for parsing command lines with sub-commands. |
| 12:28 | bbloom | futile: more of a conservative heuristic than a faulty assumption |
| 12:28 | mthvedt | but i think e.g. 'reporter' is OO in the sense that a reporter is expected to fit an interface and have some behavior |
| 12:28 | mthvedt | OO-lite |
| 12:31 | mthvedt | maybe clojurians might prefer 'report-fn' over 'reporter', i dunno |
| 12:32 | bbloom | mthvedt: yes. if you want to differentiate between a report data structure and the report function |
| 12:32 | TimMc | ohpauleez: Unfortunately, I think chouser and rhickey are the only ones with ops. |
| 12:33 | ohpauleez | TimMc: Yeah, I saw the message on the mailing list - perhaps we'll get some more admins in here |
| 12:35 | bpr | mthvedt: very much so |
| 12:35 | futile | ohpauleez: for what? |
| 12:36 | bpr | mthvedt: but, report is ok for me as well |
| 12:36 | ohpauleez | futile: There's been a slight rise in spammers in the channel |
| 12:36 | futile | oh? hadn't noticed. |
| 12:36 | ohpauleez | and it's bothering some people enough that they raised the issue |
| 12:36 | futile | I see. |
| 12:36 | ohpauleez | I didn't either, until this morning |
| 12:37 | TimMc | It's very sporadic. |
| 12:37 | ohpauleez | yes |
| 12:43 | futile | Okay, notified mailing list. Expecting to get yelled at again for some reason. |
| 13:09 | loliveira | hi, does somebody know some good Facebook library? |
| 13:33 | futile | Oh no! |
| 13:33 | futile | Sometimes the same function isn't = to itself! |
| 13:35 | futile | ,(= = =) |
| 13:35 | clojurebot | true |
| 13:35 | futile | ,(= = (eval '=)) |
| 13:35 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 13:36 | futile | Oh right. |
| 13:36 | futile | ,(load-string "=") |
| 13:36 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 13:36 | futile | :( |
| 13:36 | futile | ,(= = (var-get (resolve '=))) |
| 13:37 | clojurebot | true |
| 13:37 | futile | bultitude!! |
| 13:37 | futile | At least I think that's what's making this not equal :( |
| 13:37 | ianeslick | If I want to extend a map, such as adding sorting capability (we'll call the extended type an Index), what is the proper strategy? I want to change it so that (seq) returns sorted pairs, vals and keys are sorted, etc |
| 13:38 | futile | ianeslick: if you aren't married to the idea of extending Map, you could just return [[k v] [k v] ...] already sorted. |
| 13:39 | ianeslick | I'm creating a new data type that wraps the functionality of a remote database (scalable key-value stores). |
| 13:39 | futile | ianeslick: i.e. ##(sort-by :a [{:a 3 :b 3} {:a 1 :b 1} {:a 2 :b 2}]) |
| 13:39 | lazybot | ⇒ ({:a 1, :b 1} {:a 2, :b 2} {:a 3, :b 3}) |
| 13:39 | ianeslick | I'm building an in-memory testing version first |
| 13:39 | futile | Uhh, oops. |
| 13:39 | ianeslick | So this is a subproblem |
| 13:39 | futile | ianeslick: oh |
| 13:40 | futile | ,(sort-by :a [{:a 3 :b 3} {:a 1 :b 1} {:a 2 :b 2}]) |
| 13:40 | clojurebot | ({:a 1, :b 1} {:a 2, :b 2} {:a 3, :b 3}) |
| 13:40 | ianeslick | Use a map to simulate a remote key-value store without re-implementing or wrapping Map |
| 13:40 | ianeslick | I have some new protocols for transforming Index Values to a smaller Index based on range, value-filter, or other constraints. |
| 13:40 | futile | ianeslick: fwiw we just have a function that takes mongo "objects" and converts it to a real-live Clojure map |
| 13:40 | futile | ianeslick: but that's the last of my helpfulness on this topic |
| 13:41 | futile | (if it even is such) |
| 13:41 | ianeslick | Yeah, Mongo had a production bug about a year ago that screwed me hard - never used it after that. Silently dropped writes after you updated a particular structure too often. |
| 13:42 | ianeslick | Want to have semantics that are separable from the underlying store so it's: a) easier to reuse existing clojure coding methods but still have clean semantics and b) be independent of a particular backend. |
| 13:42 | ianeslick | I'm starting with DynamoDB, but may need to leave Amazon later this year for legal reasons. |
| 13:42 | ianeslick | So I need an in-memory testing version + a production DDB version of the type. |
| 13:42 | ianeslick | Still feel like I don't fully understand protocols! |
| 13:43 | Wild_Cat` | ianeslick: note that DynamoDB doesn't sort anything. |
| 13:43 | Wild_Cat` | wait, no, it does. It sorts by range key |
| 13:44 | Wild_Cat` | but hash keys are arbitrarily-ordered. |
| 13:44 | futile | Oh no! (require :reload) makes = no longer work on functions, because it gives them a new ptr! Dang. |
| 13:44 | ianeslick | Yes, so you have to have hints that tell the interface how to construct keys for range queries |
| 13:44 | futile | Okay okay, calm down. |
| 13:44 | futile | Is there another way to compare two functions as being equal when in a test? |
| 13:44 | ianeslick | I'm only generalizing enough for my simple application |
| 13:45 | Tuplanolla | How can I automatically reload Clojure files in the repl when they change? |
| 13:45 | technoma` | futile: you have to compare vars |
| 13:45 | futile | technoma`: :( that's what I was afraid of. |
| 13:45 | hyPiRion | humm |
| 13:45 | futile | technoma`: because in test2 we agreed to move away from vars for the internal representation of tests, so now my tests have false negatives |
| 13:46 | futile | i.e., (= {:func test-1} (find-test-1-somehow)) fails |
| 13:46 | futile | blast! foiled again. |
| 13:47 | Tuplanolla | Setting up the toolchain is really difficult. |
| 13:48 | ianeslick | Is there a way to compare the source code of the function? |
| 13:48 | ianeslick | In some toolchains that is stored in the Var metadata |
| 13:48 | ianeslick | (or something like that) |
| 13:48 | futile | hyPiRion, technoma`: does this seem too horrible to live in a test? (= (.getName (type test-1)) (find-test-1-somehow)) |
| 13:49 | ianeslick | So, no hints on best practice for creating a derived version of Map with new behaviors and some extra protocol implementations? |
| 13:49 | Tuplanolla | There's ring.middleware, but it's essentially undocumented, so I have no idea how to use it. |
| 13:50 | patchwork | Tuplanolla: It doesn't reload automatically when source changes, you have to (require :reload '[your.namespace :as x]) |
| 13:50 | dnolen | ianeslick: it's a bit of work, look at how defrecord is implemented |
| 13:50 | Tuplanolla | I want to avoid doing that. |
| 13:50 | technoma` | Tuplanolla: there are ways to make it work, but it's way easier to just get your editor to trigger the reload. |
| 13:50 | technoma` | since it knows when you save already |
| 13:51 | technoma` | futile: if everyday testing requires stuff like that then yeah; pretty bad. depends on context though. |
| 13:51 | Tuplanolla | I'm not so sure about IDEA. |
| 13:51 | patchwork | laneslick: you can have all this functionality without deriving a new Map implementation |
| 13:51 | weavejester | Tuplanolla: What do you mean by ring.middleware? The middleware in the official Ring libraries? |
| 13:51 | mthvedt | futile: why not compare assertions to know you've found the right test |
| 13:52 | futile | mthvedt: thats disproportionally harder |
| 13:52 | Tuplanolla | This, weavejester: https://github.com/weavejester/ring-reload-modified |
| 13:52 | weavejester | ianeslick: Unless you want polymorphism, you don't need to use protocols to add new functionality |
| 13:53 | mthvedt | if you're just smoke testing discovery, you could even compare return values |
| 13:53 | weavejester | Tuplanolla: That should have a deprecated note on. The functionality has been rolled into ring-devel for a while now. |
| 13:53 | ianeslick | I want to have many of the existing clojure methods work with the new types, and there will be multiple implementations of the protocols (different stores and two different data types) |
| 13:54 | Tuplanolla | I don't see the note anywhere. I'm just trying to set things up. |
| 13:54 | weavejester | Tuplanolla: Nope, that's why I said "should" :). I'll add the note to the readme. |
| 13:55 | weavejester | Tuplanolla: If you use lein-ring, it will setup reloading for you automatically. |
| 13:55 | weavejester | Tuplanolla: Otherwise you can wrap your handler in ring.middeware.reload/wrap-reload |
| 13:55 | futile | (inc lein-ring) |
| 13:55 | lazybot | ⇒ 1 |
| 13:55 | futile | Have been very pleased with it. |
| 13:56 | ianeslick | Basically I'm adding two new immutable datatypes that support the sequence and map interface, but have different implementations underneath. I also have two 'store' classes that return these new values and process inserts and updates in coordinated ways (insert!, update! an indexed kv-store and append! a searchable log) |
| 13:56 | Tuplanolla | There seem to be a lot of web things related to it. I don't need any of that. |
| 13:56 | arcatan | Tuplanolla: if (require :reload ...) is too much, tools.namespace offers you simple call to (refresh) |
| 13:56 | dnolen | ianeslick: sure, but what kind of guidance are you looking for? just implement the interfaces you care about. |
| 13:56 | arcatan | you'll lose your state, though |
| 13:57 | ianeslick | dnolen: I probably need to re-implement most of the map interfaces as the underlying semantics are different and I don't think there's an easy way to change the implementation of an existing type. |
| 13:58 | dnolen | ianeslick: it's in fact impossible |
| 13:58 | ianeslick | dnolen: Ok, that's helpful! |
| 13:58 | dnolen | ianeslick: and you have no inheritance, you just need to implement everything yourself |
| 13:58 | Wild_Cat` | ianeslick: do you need real immutability, or could you make do with java.util.TreeMap? |
| 13:59 | weavejester | ianeslick: Are you implementing a new immutable data structure? |
| 13:59 | dnolen | ianeslick: you can compose and delegate of course if that's your cup of tea - again see defrecord |
| 13:59 | Tuplanolla | So what's the non-deprecated way of doing it, weavejester? |
| 13:59 | patchwork | laneslick: I feel like the whole issue is your requirement that it work with existing clojure map code. That seems misguided |
| 13:59 | weavejester | Tuplanolla: Are you creating a website or web service or something else? |
| 14:00 | patchwork | Just have it work as a library, and call your code explicitly |
| 14:00 | patchwork | It is not a clojure map |
| 14:00 | patchwork | so it shouldn't work with clojure map syntax |
| 14:00 | weavejester | Tuplanolla: reload-modified and it's successor in RIng, ring.middleware.reload, are just for Ring |
| 14:00 | Tuplanolla | My first project, weavejester. |
| 14:00 | ianeslick | No, the idea is to create a datatype that supports clojure interfaces so the new types fit into the system neatly. |
| 14:00 | Tuplanolla | The most basic setup. |
| 14:00 | ianeslick | Why create new interfaces and new accessors to reproduce what Clojure already supports? |
| 14:01 | ianeslick | weavejester: Yes, new immutable structure that is consistent across a cluster of machines. |
| 14:01 | weavejester | Tuplanolla: But what is it? The purpose of your application depends on how you reload it. For instance, if you're creating a web application, you can check for new files on every request. |
| 14:01 | Tuplanolla | I just don't want to spend half of the time writing (reload) or hitting up to find it in the command history. |
| 14:01 | arcatan | Tuplanolla: what editor do you use? |
| 14:01 | Tuplanolla | IDEA at the moment, arcatan. |
| 14:02 | technoma` | hrm; should get refresh hooked into nrepl auto-discovered commands |
| 14:02 | arcatan | okay. i'm not familiar with IDEA. |
| 14:02 | weavejester | ianeslick: I'm not sure I completely understand. By definition, an immutable structure is always consistent. |
| 14:02 | patchwork | ianeslick: Because they are not built in clojure maps. We create new datatypes all the time, they just don't need to act like the native types |
| 14:02 | patchwork | they come with their own interface |
| 14:02 | ianeslick | Wild_Cat`: Immutability allows consistent reads, even if references are passed across the cluster. Side effects are managed by a proxy class that talks to the underlying datastore. |
| 14:03 | ianeslick | weavejester: Yes, but the concept of a value is different than the implementation of it. I need to pass 'values' between nodes without passing a terabyte of data. |
| 14:03 | arcatan | Tuplanolla: in Emacs you'd connect to nrepl and press C-c C-k to load the file you're working on to the repl. i'm sure something similar is possible with IDEA. |
| 14:03 | clojurebot | Ack. Ack. |
| 14:03 | Tuplanolla | I've tried emacs, but the keys are painful with a foreign keyboard. |
| 14:03 | technoma` | clojurebot: forget Tuplanolla: in Emacs you'd connect to nrepl and press C-c C-k to load the file you're working on to the repl. i'm sure something similar |is| possible with IDEA. |
| 14:03 | clojurebot | I forgot that Tuplanolla: in Emacs you'd connect to nrepl and press C-c C-k to load the file you're working on to the repl. i'm sure something similar is possible with IDEA. |
| 14:03 | ianeslick | That means the abstraction provides an immutable view of an external resource (think HBase used in a write-mostly fashion and keeps history) |
| 14:04 | patchwork | ianeslick: That is such a specific use case that I wouldn't want it masquerading as built in clojure types |
| 14:04 | ianeslick | Architecturally this is solving similar problems that Datomic solves, but in a write-scalable rather than read scalable fashion. |
| 14:04 | weavejester | ianeslick: Ah, okay, so you have some large immutable data structure somewher that's referred to by a UUID or cryptographic hash, presumably. |
| 14:05 | ianeslick | weavejester: basically. Tablename + Timestamp + Key is always consistent |
| 14:06 | weavejester | ianeslick: And presumably you want a way of doing things to the data structure, like conj etc. without loading it into memory first. |
| 14:06 | Tuplanolla | I'm just trying to find a simple setup. I'm a scientist, not a system administrator. |
| 14:06 | ianeslick | weavejester: Should say that Tablename + Timestamp in HBase allows me to construct a cluster-wide consistent view of a datastructure. That table is reified as a new type Index which supports performant scan and filter operations server-side. |
| 14:07 | arcatan | Tuplanolla: this tutorial suggests that IDEA/La Clojure has "Load file to REPL", "Execute last S-Expression in REPL" etc. http://blog.tomeklipski.com/2013/04/running-and-debugging-clojure-code-with.html |
| 14:07 | arcatan | Tuplanolla: have you tried using those? |
| 14:07 | ianeslick | weavejester: My use case is more restricted than the low-level API requires, but common enough to justify some up-front work. (I also have a Log structure which operates similarly). |
| 14:08 | weavejester | ianeslick: My thought is that the mechanisms for working with a distributed database over one in memory are different enough to warrant a new namespace, even if the function names are the same. |
| 14:09 | Tuplanolla | That seems to work, kind of. It doesn't trigger on save or change the namespace though. I'll have to see if there's a button to send snippets to the repl. |
| 14:09 | weavejester | ianeslick: e.g. (require [foobar.distributed :as d]) (d/conj remote-structure new-value) |
| 14:09 | ianeslick | weavejester: One decision I made similar to Datomic was to separate side effects from read-only interactions. I don't create derived Immutable values by a local conj because I need to catch side effects made by remote systems - so the new type supports keyword access, get, seq, etc but not conj, assoc, etc. |
| 14:10 | ianeslick | A Store type handles new operations insert/update/append and returns new Index and Log types which interoperate with clojure's built-in read operations. |
| 14:10 | weavejester | ianeslick: That seems like all the more reason to treat it differently from in-memory data structures. Don't use clojure.core/get - use your-lib.distributed/get. |
| 14:10 | ianeslick | Store is easy. Could be done with multi-methods, but Index/Log should probably be types. |
| 14:11 | ianeslick | weavejester: That's a good argument. |
| 14:11 | ianeslick | weavejester: Easier than implementing clojure's internal interfaces too |
| 14:12 | technoma` | Tuplanolla: I'm working on a tool to help expose server-side functionality like refresh easily across any editor, but it's still in early stages: https://github.com/technomancy/nrepl-discover |
| 14:12 | technoma` | no one seems interested in implementing it for non-emacs editors so far though =\ |
| 14:12 | Tuplanolla | Clojure is developing so quickly, half of the materials I find on the internet are already deprecated. |
| 14:12 | weavejester | clojure.core.reducers takes that approach - it has its own versions of map, reduce, etc. with subtly different semantics. |
| 14:12 | weavejester | And I'm taking that approach with my FRP library |
| 14:13 | ianeslick | weavejester: Reuse the clojure idioms and clearly produce 'local values' for processing by clojure at some point, but allow interactions with new types to be done in a new namespace. |
| 14:13 | ianeslick | weavejester: Perhaps I was over-influenced by my work with Datomic. |
| 14:13 | Tuplanolla | I'll follow that progress, technoma. |
| 14:13 | ianeslick | weavejester: Where Entities behave alot like Maps, implementing a subset of clojure interfaces |
| 14:14 | ianeslick | My Index type a collection just like that. |
| 14:15 | weavejester | ianeslick: I didn't realize datomic did that. I'd assume that there aren't any side-effects to treating an Entity as a map, though? |
| 14:15 | ianeslick | weavejester: So eschew niceties like keyword lookups, collection as IFn, etc? |
| 14:16 | technoma` | Tuplanolla: if it does get picked up, it'll probably be implemented in eclipse before idea. |
| 14:16 | weavejester | ianeslick: I'd still use IFn… maybe keyword lookups too... |
| 14:17 | weavejester | ianeslick: I guess things that I can port directly I would, but anything which doesn't quite fit would need a new function. |
| 14:17 | ianeslick | weavejester: They do something interesting. A Connection accepts transactions to update the database, produces immutable Database types which support queries that return Entities which are immutable. You cannot derive new Entities except by submitting transactions to Connections and getting a new Database + Entities. |
| 14:17 | Tuplanolla | If only Eclipse wasn't so slow at everything... |
| 14:17 | ianeslick | Entities are tied to a particular point-in-time Database value. |
| 14:18 | weavejester | ianeslick: It sounds like Entities are in-memory and immutable, but have additional constraints over maps. |
| 14:18 | ianeslick | weavejester: Easier to implement a custom index/get than the java Map interface to use the built-in get. I can always backport from a custom namespace later. |
| 14:18 | ianeslick | weavejester: Yes, took a bit to get used to writing code based on maps you couldn't augment directly. |
| 14:18 | ianeslick | weavejester: via assoc |
| 14:18 | technoma` | Tuplanolla: I've never used it; I've just noticed they seem to be more on top of things |
| 14:18 | weavejester | Interesting... |
| 14:19 | ianeslick | You basically end up with a separate read path and a write path in your code. Makes everything much more transactional - write a big pure function which takes an immutable value, generates a set of 'diffs', and then transactionally commits those diffs, or rolls back and retries with the latest Database value. |
| 14:20 | ianeslick | Tranactions can include functions that run on the transactor, so you can avoid most rollbacks based on local read-modify-write operations. |
| 14:20 | Tuplanolla | It starts for fifteen minutes and using content assist with the whole JDK 7 included freezes the context menu for five minutes. |
| 14:20 | ianeslick | Gives you cluster wide transactability, but all your data manipulation is based on in-memory cached covered indexes of the current state. |
| 14:20 | weavejester | ianeslick: In my libs, I've tended to extend generic and simple interfaces like IDeref and IFn, but I find that the more complex the interface the less likely it is that it will fit in exactly. And if it doesn't fit, I don't force it; I just create a new function in a new namespace. |
| 14:20 | ianeslick | weavejester: You've sold me on that as an interim if not final strategy, thanks. Just the advice I was looking for. |
| 14:21 | futile | All this pain is making me rethink using vars again in the official data representations, /cc mthvedt amalloy et al |
| 14:26 | Tuplanolla | IDEA seems to be also missing documentation. I guess I'll have to use emacs. |
| 14:27 | bpr | learning emacs is an investment that pays off many times over |
| 14:27 | bpr | though, it is an investment |
| 14:28 | Tuplanolla | I learned the basic usage, but had to give up on the shortcut mess. There's ergoemacs I'll have to try though. |
| 14:28 | justin_smith | I prefer to think of it as technical speculation in the technical lottery that keeps printing winning tickets |
| 14:29 | technoma` | ergomacs is a bit nutty |
| 14:31 | weavejester | Has anyone use LightTable in a serious project? Maybe that's another possibility. |
| 14:32 | CaptainLex | weavejester: I'm about to begin in using LightTable in a serious project |
| 14:33 | technoma` | was there the gsoc project for clooj? |
| 14:35 | hiredman | I'd like an in browser clojure editor for my chromebook, adobe brackets looks interesting, but they don't have it working in browsers yet (it uses a custom browser app thing similar to lighttable) |
| 14:38 | hiredman | I tried to get brackets running as a chrome extension, but errors seem to be swallowed for some reason, and something is clobbering the console object so logging doesn't work, and all the jquery defered stuff proved too much for me |
| 14:39 | ianeslick | weavejester: The easy/most useful interfaces for a type seem to be Seqable, IFn, IDeref, Ilookup, IKeywordLookup and maybe IHashEq, IObj. Seqable basically lets me turn an index into a sequence and then the usual clojure stuff will work. So (filter <pred> (index/scan index <start> <end>)), index/scan returns a new index, filter calls .seq to get a linear sequence and filters the scanned result. I also have an index/filter which will do server side |
| 14:39 | ianeslick | filtering - the general performance model is to push filters into the index to get a reduced sized index to reduce network traffic then do clojure ops on the returned standard clojure collections and values. |
| 14:53 | dnolen | cemerick: good point about js/Date IEquiv, I've backed that out of master |
| 14:53 | cemerick | dnolen: gah! :-P |
| 14:54 | CaptainLex | So does the classes-and-interfaces vector in proxy actually not take multiple members? |
| 14:54 | cemerick | dnolen: what about number and string, then? |
| 14:54 | cemerick | oh, the string extend is for keywords |
| 14:54 | dnolen | cemerick: those are safe - they don't modify prototypes |
| 14:54 | weavejester | ianeslick: Those all seem reasonable interfaces to implement |
| 14:55 | cemerick | dnolen: I guess there's a subtle difference between Date and e.g. Number? |
| 14:55 | dnolen | cemerick: which won't last for long when we optimize constants |
| 14:55 | dnolen | cemerick: there's a big difference, CLJS doesn't modify real JS natives, proto implementation lookup is done via hashtables |
| 14:56 | cemerick | dnolen: but through prototypes for non-native classes, I guess. |
| 14:57 | cemerick | Maybe whatever whitelist that exists for strings and numbers can be extended. Not being able to e.g. test for date equality is rough. |
| 14:58 | dnolen | cemerick: actually we can't back it out yet |
| 14:58 | dnolen | cemerick: yes I put it back and noted we could add special handling, patch welcome |
| 15:01 | tomjack | is "add comment about possible future change" the comment about possible future change? |
| 15:18 | Bronsa | mh |
| 15:18 | Bronsa | http://sprunge.us/MOKh |
| 15:18 | Bronsa | this looks wrong to me |
| 15:20 | dnolen_ | Bronsa: I'd be surprised if defrecord validated non-basis keys |
| 15:20 | bbloom | Bronsa: the problem seems to be the second output, not the third |
| 15:21 | Bronsa | bbloom: yeah. |
| 15:21 | dnolen_ | Bronsa: bbloom: I think you'd be likely to hear that the issue is the third |
| 15:22 | Bronsa | dnolen_: but records can be used effectively as maps |
| 15:22 | bbloom | dnolen_: record reader forms accept extra keys |
| 15:22 | bbloom | dnolen_: https://www.refheap.com/15852 |
| 15:22 | dnolen_ | Bronsa: bbloom: just a hunch given that defrecord are a performance optimization like structs |
| 15:23 | dnolen_ | what's the point of putting arbitrary keys in there if you care about perf at all |
| 15:23 | bbloom | dnolen_: you care about perf of access to the core fields |
| 15:23 | bbloom | dnolen_: records allow extra fields for annotations & non perf critical things like that |
| 15:23 | Bronsa | this potentially causes some records that are valid at runtime to be non readable back |
| 15:23 | Bronsa | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1237-L1242 the check is done explicitely though. |
| 15:24 | tomjack | core.async's ioc-macros is an in-the-wild use case that occurs to me |
| 15:24 | dnolen_ | Bronsa: bbloom: in anycase my point is, it's not clear to me that records are designed to permit *semantically* non keyword keys |
| 15:24 | dnolen_ | I maybe wrong about that |
| 15:24 | tomjack | well those are all keywords |
| 15:24 | dnolen_ | but that's what the behavior sits on |
| 15:25 | dnolen_ | and the explicit check in the Reader backs me up |
| 15:27 | bbloom | dnolen_: i see no reason why they shouldn't allow keys of other types. that works just fine at runtime. the issue is the reader is unnecessarily restrictive. |
| 15:27 | tomjack | the explicit check just seems bizarre to me |
| 15:27 | Bronsa | maybe it is a leftover from early experimentations on record |
| 15:27 | Bronsa | I relly see no point in that check |
| 15:27 | bbloom | Bronsa: that would be my guess |
| 15:28 | bbloom | semantically, records are pretty much just maps with a minimum set of keys and a type differentiator |
| 15:28 | bbloom | practically, they are faster for read/write access to those minimum keys |
| 15:28 | tomjack | http://dev.clojure.org/jira/browse/CLJ-800 |
| 15:29 | Bronsa | tomjack: yeah, I was just reading that |
| 15:29 | tomjack | don't see any explanation |
| 15:29 | bbloom | yup |
| 15:35 | dnolen_ | bbloom: Bronsa: hmm I was thinking perhaps struct-maps were limited in this way - but it turns out not. So perhaps you all are right. |
| 15:35 | tomjack | maybe symbols are disallowed because allowing them brings up the question of whether they should be evaluated? |
| 15:36 | Bronsa | tomjack: I don't think so |
| 15:36 | Bronsa | #foo.bar{:foo bar} is valid |
| 15:36 | Bronsa | and bar is not evaluated |
| 15:36 | tomjack | ah |
| 15:37 | bbloom | I'm 99% sure this is a reader bug |
| 15:37 | tomjack | that seems odd to me |
| 15:38 | tomjack | not that I really want them to be evaluated, but the inconsistency vs a regular map seems odd |
| 15:39 | bbloom | tomjack: it's consistent with respect to tagged literals, but that came later :-P |
| 15:40 | bbloom | ,{:x 'y} |
| 15:40 | clojurebot | {:x y} |
| 15:40 | tomjack | in that it is just impossible to have your tagged literal type evaluate symbols inside? |
| 15:40 | bbloom | i guess you need to use edn/read-whatever when reading clojure maps |
| 15:41 | bbloom | tomjack: it's not impossible, you just need to call eval :-/ |
| 15:41 | bbloom | or do symbol resolution |
| 15:41 | tomjack | well not at read-time clearly |
| 15:41 | bbloom | it does seem odd that records don't work precisely the same as maps in this respect |
| 15:41 | tomjack | but eval on some funky object is identity, so there's nothing you can do about how it evals |
| 15:41 | tomjack | (right? I don't understand that stuff) |
| 15:42 | bbloom | tomjack: you don't eval the result of the reader, you eval while building the result of the reader |
| 15:42 | bbloom | (def x 1) (eval 'x) => 1 |
| 15:43 | tomjack | that doesn't make sense to me |
| 15:44 | tomjack | say `#funky {:foo a}` returns, uh, some funky map-like thing. a deftype? you don't want to eval 'a at read-time. if you wanted map-like semantics you'd want to eval 'a when the deftype is eval'd, but you have no control |
| 15:44 | tomjack | or am I totally confused? feels that way |
| 15:45 | bbloom | oh yeah, you're right, sorry |
| 15:46 | bbloom | i guess the fundamental issue is that {:foo "bar"} means (hash-map :foo "bar") but #whatever{:foo "bar"} means #<someobjecthere> |
| 15:47 | bbloom | bbloom: i guess the real thing is you need to know "am i quoted?" when reading the literal |
| 15:48 | bbloom | lol i just bbloom:ed myself. whoops |
| 15:48 | bbloom | dnolen_: this is related to the constants work w/ cljs. tagged literals are inherently constants: they can't do any evaluation |
| 15:48 | bbloom | same for records |
| 15:49 | bbloom | this is why :map, :vector, and :set need to be special forms |
| 15:49 | bbloom | b/c they need to do something different depending on context |
| 15:49 | amalloy | bbloom: {:foo "bar"} doesn't mean (hash-map :foo "bar"). it doesnt' read to a list, it reads to a map |
| 15:49 | bbloom | amalloy: it means both depending on how it's used |
| 15:49 | bbloom | amalloy: if quoted, it means a map. if unquoted, it means code which builds a map |
| 15:50 | bbloom | amalloy: if unquoted and recursively constant, it can mean a map as an optimization |
| 15:50 | amalloy | that is a bizarre claim. in what case does the reader see input {} and return (hash-map)? |
| 15:50 | bbloom | amalloy: it doesn't |
| 15:51 | Bronsa | '`{} |
| 15:51 | Bronsa | ,'`{} |
| 15:51 | clojurebot | (clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat))) |
| 15:51 | Bronsa | ,'`() |
| 15:51 | clojurebot | (clojure.core/list) |
| 15:51 | bbloom | Bronsa: ehhh. that's cheating. that's the behavior of syntax-quote |
| 15:51 | amalloy | sure, backquoting, although i'd argue that it's ` doing that, not {} |
| 15:51 | mefesto | \quit |
| 15:51 | bbloom | amalloy: consider {:foo (query-the-internet)} |
| 15:52 | bbloom | that doesn't do anything until that line of code is run |
| 15:52 | bbloom | it's logically equiv to (hash-map :foo (query-the-internet)) |
| 15:53 | amalloy | welllllll, i wouldn't say it's logically equivalent, since that doesn't really mean anything useful. but i see the distinction you're making re: deftype objects |
| 15:53 | amalloy | ie, that (eval some-deftype-object) doesn't eval its fields, whereas (eval some-hashmap) evals its fields |
| 15:59 | tomjack | looks like CLJ-374/800 added cases in Compiler/analyze for IRecord/IType to ConstantExpr |
| 15:59 | Bronsa | yep |
| 16:00 | tomjack | where IPersistentMap gets a MapExpr which always emits a PAM/PHM |
| 16:01 | tomjack | I guess letting people control eval would be nuts? |
| 16:01 | Bronsa | you'd need hooks in the compiler |
| 16:02 | hiredman | luckily lisp has a mechanism for tha |
| 16:02 | hiredman | t |
| 16:02 | hiredman | «» |
| 16:02 | hiredman | feh |
| 16:02 | hiredman | quotation |
| 16:03 | Bronsa | hiredman: I'm not sure how that matters |
| 16:03 | futile | welp |
| 16:04 | hiredman | "I guess letting people control eval would be nuts?" |
| 16:04 | Bronsa | hiredman: quoting only prevents evaluation |
| 16:04 | Bronsa | there's no way to "make it happen" |
| 16:06 | Bronsa | user=> `#user.foo{:a ~'a} |
| 16:06 | Bronsa | #user.foo{:a (clojure.core/unquote (quote a))} |
| 16:06 | Bronsa | this kinda sucks |
| 16:06 | tomjack | I've considered having data readers look for unquote :/ |
| 16:08 | tomjack | but thinking about it, they can't do anything useful even if they look for it, huh |
| 16:08 | bpr | Bronsa: maybe i'm missing context, but what sucks about that? |
| 16:08 | futile | tomjack: https://github.com/evanescence/test2/blob/master/SPEC.md |
| 16:09 | bpr | if you have a reader registered for #user.foo, doesn't it provide the apropriate data-type? |
| 16:09 | Bronsa | bpr: http://sprunge.us/FdRB |
| 16:09 | Bronsa | bpr: user.foo is a record not a tagged reader |
| 16:10 | bpr | oh |
| 16:11 | tomjack | I guess you should just be using `(map->foo {:a ~'a}), similarly for data readers |
| 16:12 | tomjack | like you don't use #db/id in code, you use datomic.api/tempid |
| 16:15 | bpr | Bronsa: does using a tagged data literal to properly construct your record work as expected? |
| 16:16 | dnolen_ | bbloom: unrelated, I had a copy of that functional parsing paper you sent along. I'd come across it when looking into how people built parsers in Prolog |
| 16:16 | bbloom | dnolen_: yeah, was really cool that it also served as a generator :-) |
| 16:19 | tomjack | which paper? |
| 16:20 | dnolen_ | "A Functional-Logic Perspective of Parsing" |
| 16:25 | tomjack | intriguing |
| 16:25 | tomjack | I had written <*> in my little LogicT experiment |
| 16:25 | tomjack | and <|> is just mplus? |
| 16:26 | Hetu | thanks for the paper tip dnolen_ |
| 16:27 | dnolen_ | tomjack: I never actually read too much about LogicT |
| 16:27 | tomjack | confirmed <|> is mplus in LogicT source at least |
| 16:31 | tomjack | I'd guess you'd get what the paper shows with LogicT ((->) Rep) something. but wtf is something? |
| 16:36 | tomjack | hmm probably not |
| 16:39 | dnolen_ | tomjack: are you referring to the original LogicT paper? |
| 16:40 | tomjack | yeah |
| 16:40 | tomjack | I dunno what changed between the paper and http://hackage.haskell.org/package/logict though |
| 16:41 | tomjack | (if there are important differences I refer to the package not the paper) |
| 16:43 | dnolen_ | tomjack: hrm, sounds like the repo is an "adaptation" ? |
| 16:43 | dnolen_ | tomjack: I don't read Haskell good |
| 16:44 | tomjack | yeah, I hadn't noticed till now that the author of the package is not one of the authors of the paper |
| 16:44 | tomjack | I think they're the same in spirit |
| 16:44 | tomjack | I did notice at least one implementation difference |
| 16:45 | akells` | let's say I have a method get-file-size that returns a particular file's size. How would I properly construct a java ByteArrayOutputStream with that size? I'm making a binding for *out* to that ByteArrayOutputStream, so I'm trying (binding [*out* (ByteArrayOutputStream. (get-file-size file) *out*)] |
| 16:45 | akells` | but I'm getting No matching ctor found for class java.io.ByteArrayOutputStream -- I know I'm just missing something simple, but I can't seem to make it work |
| 16:46 | bpr | akells`: cast (get-file-size file) to an int |
| 16:47 | bpr | also, *out* doesn't need to be in the call to the constructor |
| 16:47 | akells` | thanks for your response, bpr. I'll double check that its an int |
| 16:47 | akells` | oh, okay. I guess maybe I've been doing that wrong then. |
| 16:49 | dnolen_ | tomjack: hmm I don't know enough Haskell to say but the original looks pretty straightforward and library you linked to busts out some fancy extensions |
| 16:50 | tomjack | extensions? |
| 16:50 | dnolen_ | tomjack: language extensions |
| 16:52 | tomjack | guess that's inherited from MonadReader etc |
| 16:53 | tomjack | I was hoping to avoid that stuff.. |
| 16:53 | tomjack | the parsing paper appears not to use monads at all which is promising |
| 17:02 | tomjack | hmm, parser_rep is only an applicative if the representation is a monoid |
| 17:11 | tupi | hello, i have a quiz about clojure/imagej interaction. i wrote a simple clojure script which execute a watershed command over an image, the clojure script is just a couple of lines really. right now i run the script as 'imagej test_2.clj', but i actually would prefer [to enhance these script with 'real' clojure code...] to call this script through clojure itself, telling where the imagej jars are .. is this possible ? |
| 17:42 | tomjack | working out any relation between LogicT and the parsing paper has proved difficult |
| 17:44 | antares_ | New ClojureWerkz project, Cassaforte: a Clojure Cassandra client built around CQL 3.0: http://blog.clojurewerkz.org/blog/2013/06/17/introducing-cassaforte/ |
| 17:48 | tupi | how can i tell clojure where to find extra classes ? |
| 17:50 | puredanger | tupi: Clojure runs on the JVM and the JVM finds classes via classloaders, most commonly by the system classloader that reads classes from the "classpath", a list of "class containers", which may be directories or JAR files (basically just zips) |
| 17:50 | tupi | puredanger: here is what i try: |
| 17:51 | tupi | java -cp clojure-1.4.0.jar clojure.main /usr/lpdi/projects/fiji/plugins/test_2.clj |
| 17:51 | tupi | |
| 17:51 | tupi | which does not wotk because it does not know ehere imagej clases are, and there are here: |
| 17:51 | tupi | /usr/local/src/Fiji.app/jars |
| 17:52 | puredanger | -cp defines the classpath - add jars to it like: -cp clojure-1.4.0.jar:/usr/local/src/Fiji.app/jars/XYZ.jar:... |
| 17:52 | tupi | ah, merci! trying |
| 17:53 | puredanger | java 6+ can also use the specific wildcard format of /the/dir/* to add all jars (in arbitrary order) to the classpath |
| 17:53 | puredanger | note this is not general glob support - it only works with just "*". |
| 17:54 | puredanger | in general, I highly recommend using a build tool (leiningen or if you hate life, perhaps Maven) to assemble your classpaths for you |
| 17:54 | technoma` | further proof that writing /usr/bin/java was a task that Sun delegated to the interns |
| 17:54 | puredanger | technoma`: ha, yeah |
| 17:54 | puredanger | can't tell you how many times I've written *.jar only to get burned |
| 17:57 | tupi | java -cp clojure-1.4.0.jar:/usr/local/src/Fiji.app/jars clojure.main /usr/lpdi/projects/fiji/plugins/test_2.clj |
| 17:57 | tupi | Exception in thread "main" java.lang.ClassNotFoundException: ij.IJ |
| 17:57 | tupi | |
| 17:58 | tupi | test_2.clj starts like this: (import '(ij IJ) |
| 17:58 | tupi | '(ij ImagePlus)) |
| 17:59 | puredanger | what's the actual full Java class name with package? |
| 18:01 | tupi | puredanger: i don't know |
| 18:02 | tupi | my knowledge of java is close to null [and will remain so i am afraid] |
| 18:02 | puredanger | tupi: try doing something like jar -tf /usr/local/src/Fiji.app/jars/YOUR.jar | grep IJ |
| 18:02 | puredanger | I don't know what YOUR.jar should be but jar -tf will list all classes in the jar and grep should find the IJ class ? |
| 18:04 | tupi | trying |
| 18:08 | puredanger | tupi: your import looks ok if you have an ij.IJ Java class |
| 18:09 | tupi | yes, that i know because the script runs if i run it 'from' imagej |
| 18:10 | puredanger | can you post your whole command line? |
| 18:10 | tupi | it does not find the jar, i don't understand |
| 18:11 | tupi | pure i did already, i think |
| 18:11 | tupi | java -cp clojure-1.4.0.jar:/usr/local/src/Fiji.app/jars clojure.main /usr/lpdi/projects/fiji/plugins/test_2.clj |
| 18:11 | tupi | |
| 18:12 | atyz | Hi guys, i feel dumb for asking but does this namespcae no longer exist? clojure.contrib.string |
| 18:12 | puredanger | you need to put the actual name of the jar after /jars - the directory is not sufficient |
| 18:12 | puredanger | atyz: no, you should use clojure.string |
| 18:13 | atyz | does that contain substring? |
| 18:13 | puredanger | no! :) |
| 18:13 | tupi | oh this won't be possible with real code, there are hunderds of jars in imagej |
| 18:13 | puredanger | but subs is actually part of core now |
| 18:13 | puredanger | tupi: you can use .../jars/* if you want to get them all |
| 18:13 | tupi | ok |
| 18:14 | puredanger | atyz: (subs "foobar" 3) ==> bar |
| 18:14 | atyz | puredanger: i dont' want a substring, basically i want a check to see if a string is a substring |
| 18:14 | atyz | so i could use (.contains "abcd" "bc") |
| 18:15 | futile | Evening. |
| 18:15 | futile | I mean, hi. |
| 18:15 | puredanger | atyz: ah, first see: http://clojure.org/cheatsheet |
| 18:16 | atyz | puredanger: thanks |
| 18:16 | puredanger | atyz: second, you can go the Java route with (.indexOf "foo" "oo") |
| 18:16 | puredanger | which returns the position of the substring |
| 18:17 | puredanger | but perhaps better to use the re-* functions to do regex matching depending what you're doing |
| 18:18 | atyz | puredanger: thats exactly what i'm doing |
| 18:18 | atyz | I appreciate it :) |
| 18:18 | atyz | I need to get more familiar with teh clj std library |
| 18:20 | tupi | it's getting a little further but complains about graphicsenvironment. puredanger for you to understand, that directory contains clojure.jar which is clojure 1.3 and i wanted to use the latest debian stable and also getting a better control over comand line args. |
| 18:20 | tupi | here is the output of 'imagej': |
| 18:20 | tupi | david@capac:~/lpdi/projects/fiji/plugins 15 $ imagej test_2.clj |
| 18:20 | tupi | WARNING: clojure.lang.Repl is deprecated. |
| 18:20 | tupi | Instead, use clojure.main like this: |
| 18:20 | tupi | java -cp clojure.jar clojure.main -i init.clj -r args... |
| 18:20 | tupi | Clojure 1.3.0 |
| 18:20 | tupi | nil |
| 18:20 | tupi | user=> |
| 18:21 | tupi | [the nil is (println *command-line-args*)] |
| 18:21 | tupi | but i wanted to run clojure1.4 and tell it where imagej classes where, it seems more complicated then i thought |
| 18:22 | CapnKernul | What ever happened to lazytest? |
| 18:22 | tupi | using clojure1.4,as copied earlier, it complains: |
| 18:22 | tupi | java -cp clojure-1.4.0.jar:/usr/local/src/Fiji.app/jars/* clojure.main /usr/lpdi/projects/fiji/plugins/test_2.clj |
| 18:25 | tupi | nil |
| 18:25 | tupi | Exception in thread "main" java.awt.HeadlessException |
| 18:25 | tupi | at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207) |
| 18:25 | tupi | at java.awt.MenuComponent.<init>(MenuComponent.java:159) |
| 18:25 | tupi | ... ... |
| 18:25 | tupi | so i guess imagej [which a binary file unfortunately] does more then just launching clojure ... |
| 18:25 | puredanger | you're causing AWT (the Java window toolkit) to get instantiated, which is not too surprising |
| 18:25 | puredanger | given that it's an image lib |
| 18:26 | puredanger | you can use -Djava.awt.headless=true I believe to avoid that |
| 18:26 | tupi | well image processing does work in the memory [and in this case does not open any window] |
| 18:27 | puredanger | tupi: try that flag in your command line |
| 18:28 | puredanger | or put it at the top of your code (above the ij import) - (System/setProperty "java.awt.headless" "true") |
| 18:29 | tupi | here is the full script, it is really short so i'll copy it here |
| 18:29 | tupi | (import '(ij IJ) |
| 18:29 | tupi | '(ij ImagePlus)) |
| 18:29 | tupi | |
| 18:29 | tupi | (let [imp (IJ/openImage "/usr/lpdi/projects/fiji/tests/image_to_watershed.png")] |
| 18:29 | tupi | (IJ/run imp "8-bit" "") |
| 18:29 | tupi | (IJ/run imp "Watershed", "") |
| 18:29 | tupi | (IJ/save imp "/tmp/itw.png")) |
| 18:29 | tupi | |
| 18:29 | tupi | and all i want is to get it work passing the directoru and image name as a command line arg |
| 18:31 | tupi | puredanger: -Djava.awt.headless=true is before clojure.main ? |
| 18:31 | puredanger | tupi: that should work |
| 18:32 | tupi | arhgg it did not [yet], here is the cmd and 1st line of error: |
| 18:32 | tupi | java -cp clojure-1.4.0.jar:/usr/local/src/Fiji.app/jars/* -Djava.awt.headless=true clojure.main /usr/lpdi/projects/fiji/plugins/test_2.clj |
| 18:32 | tupi | Exception in thread "main" java.awt.HeadlessException |
| 18:32 | tupi | at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207) |
| 18:32 | tupi | at java.awt.MenuComponent.<init>(MenuComponent.java:159) |
| 18:32 | tupi | |
| 18:33 | jtoy | if im in the repl, how can i run a function that has sudo permissions? |
| 18:34 | jtoy | is this possible? it sounds like more of a unix question? |
| 18:35 | tupi | puredanger: tx so much to get me up and running with this by the way |
| 18:35 | tupi | i really need to take the control of imagej through clojure and not the other way around ... |
| 18:35 | llasram | jtoy: Generally speaking, whole processes run as a particular user. Definitely a Unix (or whatever OS-context) question |
| 18:36 | futile | I really like the idea of LightTable suddenly. |
| 18:36 | tupi | what is the clojure command to exit the repl? |
| 18:37 | puredanger | ctrl-c ? :) |
| 18:37 | futile | If this thing has paredit-like keys, I'm quite possibly sold. |
| 18:37 | aaelony | ctrl-d |
| 18:37 | justin_smith | tupi (System/exit 0) |
| 18:37 | tupi | justin_smith: tx |
| 18:37 | puredanger | your command-line args will end up in a variable named *command-line-args* |
| 18:38 | puredanger | so you can access them like (first *command-line-args*) and (second *command-line-args*) |
| 18:38 | puredanger | gotta run, hope that helps a little - I don't think you're far |
| 18:38 | puredanger | despite appearances |
| 18:39 | tupi | puredanger: tx, it is weird to be so close but ... |
| 18:39 | jtoy | thx |
| 18:55 | jtoy | if i want to keep a secured persistent connection to another site through clojure, what protocol/technology would you recommend? |
| 18:56 | justin_smith | either shell out to ssh (or tunnel across an external ssh processes tunnel) or aleph/https web socket maybe? |
| 18:58 | jtoy | cool, ill try that |
| 18:59 | jtoy | justin_smith: do you know if aleph can work from clojurescript? |
| 18:59 | justin_smith | clojurescript should be able to create a websocket via javascript interop |
| 18:59 | jtoy | sweet |
| 19:00 | justin_smith | I bet there is an example on the web for using aleph/clojurescript for two way web sockets |
| 19:05 | jtoy | would be cool to send raw lisp down the channel to eval on the other side |
| 19:06 | justin_smith | I usually have each end creating and reading json, and responding to it |
| 19:07 | tupi | it is amazing, like really totally crazy, how difficult it is to launch a memory computation based on imagej from clojure. the headless environment takes pages and pages on the web, to tell you how to write a complete program in java not to get the windowing system invlolved in your terrifically basic pure mem computation |
| 19:13 | muhoo | under what conditions would doall fail to do all? |
| 19:14 | muhoo | i have a lazyseq, i'm trying to spit it out to a file, i tried wrapping it in doall, and all i get in the file is clojure.lang.LazySeq@eff30ce0 |
| 19:14 | muhoo | oops, nevermind pr-str :-) |
| 19:15 | callen | muhoo: don't feel bad, I was doing some dumb stuff with iterate not too long ago. |
| 19:15 | callen | muhoo: stuff that required killing Emacs and restarting the REPL :( |
| 19:16 | muhoo | it did not occur to me to feel bad :-P |
| 19:17 | muhoo | but thanks anyway. it was my big derp of the day; i always have at least one. |
| 19:19 | callen | muhoo: so does anybody use defstruct anymore? |
| 19:23 | robink | How do I make EDN dispatch on a Joda Time #<DateTime .*> object that has been serialized? |
| 19:31 | robink | I can also change the DateTime object in the collection being output by pr, but I'm not sure how to make it a tagged element (i.e. #chrdc/jdt "2013-05-11T23:04:12.000-07:00"). |
| 19:36 | rhickey | t |
| 19:37 | @rhickey | Is there a straightforward way to get lein to use the clojure.jar of my choice from my local disk (not installing in maven)? |
| 19:39 | TimMc | rhickey: For lein's own process, or for the codebase it is launching? |
| 19:39 | @rhickey | the codebase |
| 19:40 | @rhickey | really, get it in lein classpath |
| 19:40 | TimMc | Honestly, if I have source I usually just mvn install with a unique version and use that in the pom/project... |
| 19:41 | TimMc | If I'm just hacking around, :resource-paths is a close enough approximation. |
| 19:41 | TimMc | technomancy will yell at you, though. |
| 19:42 | technoma` | hrm; no, :resource-paths makes sense for this. |
| 19:42 | technoma` | typically you'd use checkout-deps, but that only works if you're trying to include a leiningen project |
| 19:42 | technoma` | no one's hooked it up to maven yet |
| 19:42 | ianeslick | Weird, anyone get errors from nrepl require like "namespace 'dstore.api' not found after loading '/dstore/api'?" |
| 19:43 | @rhickey | technoma`: you put the jar name in resource-paths? |
| 19:43 | ianeslick | (i.e. load nrepl into fresh lein project, define that namespace at src/dstore/api.clj and then try to require) |
| 19:43 | technoma` | rhickey: full path to the jar should do the trick |
| 19:43 | technoma` | well, relative path from the project root should work too |
| 19:43 | technoma` | oh yeah, and that's a string in a vector |
| 19:44 | technoma` | :resource-paths ["/path/to/clojure.jar"] |
| 19:44 | @rhickey | technoma`: will that disable any defaults for clojure del? |
| 19:44 | @rhickey | dep |
| 19:44 | technoma` | rhickey: no, you'd need a top-level exclusion as well to keep clojure from being transitively included |
| 19:44 | technoma` | :exclusions [org.clojure/clojure] |
| 19:45 | @rhickey | ok, thanks |
| 19:45 | technoma` | sure |
| 19:45 | robink | Would the latter approach be preferable? |
| 19:45 | robink | I just want the date output to be parsable and sane |
| 19:45 | technoma` | typically the resources one would shadow the transitive one, but if there's a file in one but not the other shadowing gets weird |
| 19:45 | technoma` | better to be explicit about it |
| 19:46 | tomjack | robink: it sounds like you're asking about print-method |
| 19:46 | robink | (org.joda.time.DateTime. "2013-05-11T23:04:12.000-07:00") returns a <DateTime 2013-05-11T23:04:12.000-07:00>, which is what I'm after. |
| 19:47 | tomjack | the problem is that you want DateTime to print as a tagged element? |
| 19:47 | jtoy | silly question, why would I get this error when the file exists and I have permission (I am testing as root): IOException error=2, No such file or directory java.lang.UNIXProcess.forkAndExec (UNIXProcess.java:-2) |
| 19:47 | futile | Oh no! Missed my one chance to deliver the message to rhickey about that one thing that could.. Save the World ... dun dun DUNNNN!!! |
| 19:48 | jtoy | all I am doing is appending data to a file: (writer "/etc/hosts" :append true)... |
| 19:48 | robink | tomjack: The problem is I want to serialize a collection that contains a Joda Time <DateTime blah> object in several places. I want to do it sanely, and I want to do it relatively securely. I control both the output (generated right now by pr) and the reader (using clojure.edn), and can change how I store/serialize/read the data I'm trying to save as EDN. |
| 19:49 | robink | tomjack: My question is what's a sane and appropriate means to save and read the data, provided I'm still using EDN? |
| 19:49 | tomjack | I guess I still don't understand |
| 19:49 | tomjack | EDN is a sane way to save and read data |
| 19:49 | fgallina | Hi all, I'm having a weird error, any help is appreciated: I defined a protocol in my src/core.clj, when I require it from another file and use defrecord implementing this protocol's methods, calling any of them with a record instance fails with "Unable to resolve symbol: <method> in this context". |
| 19:49 | tomjack | I'm guessing you want (defmethod print-method DateTime [out date-time] (binding [*out* out] (print "#foo ") ...)) or whatever |
| 19:49 | robink | tomjack: pr outputs, literally, "<DateTime 2013-05-11T23:04:12.000-07:00>", which the reader (clojure.edn/read) doesn't like. |
| 19:50 | tomjack | right, define a print-method for the types of interest |
| 19:50 | robink | tomjack: Ah, OK |
| 19:50 | tomjack | EDN has nothing about printing, it's up to the host. in clojure it's print-method |
| 19:50 | robink | Gotcha |
| 19:53 | robink | tomjack: [out date-time] should apparently be [date-time out]. |
| 19:53 | robink | tomjack: but otherwise, perfect, thanks. |
| 19:57 | robink | tomjack: Better to have it tagged anyway, I suppose if any instance type or method could be instantiated or acted upon it would be no more secure than clojure.core/read. |
| 20:03 | tomjack | oh, yeah, whoops |
| 20:08 | gdev_ | Stanley Cup Playoffs as a value |
| 20:16 | tomjack | gdev_: yes. |
| 20:42 | gdev_ | tomjack, really? hrm I wonder if its too late to submit a proposal for a talk |
| 21:15 | mefesto | using clojurescript in a new project and wondering how i should initialize event handlers and such for different pages. currently, lein-cljsbuild is outputting a single file (app.js) which all pages load. BUT, each page will call it's own `init()` function. is this a terrible approach? should i be outputting multiple js files instead of one? |
| 21:15 | mefesto | https://gist.github.com/anonymous/5801886 |
| 21:19 | dnolen_ | mefesto: there's a thread on the mailing list about this hopefully something comes of it |
| 21:19 | dnolen_ | mefesto: on the CLJS mailing list |
| 21:19 | mefesto | dnolen_: oh i didn't realize cljs stuff is no longer using the clojure mailing list. i'll have to join :) |
| 21:19 | supersym | you can do goog.require('foo')? |
| 21:20 | dnolen_ | mefesto: you can ask your question in either place, but CLJS specific things seem to moving off the main ML |
| 21:21 | mefesto | dnolen_: do you know the title of the discussion so i can search for it? |
| 21:22 | dnolen_ | mefesto: Compiling "Modules" via ClojureScript Compiler |
| 21:22 | dnolen_ | mefesto: I see some of the discussion has moved to clojure-dev too |
| 21:23 | mefesto | dnolen_: thanks! |
| 22:14 | rationalrevolt | using ring and ring-jetty adapter, can i configure something like a session-listener? I would like to have a count of active sessions in my web-app |
| 22:15 | rationalrevolt | i'm not sure how i would use the :configurator parameter for this situation |
| 22:23 | callen | rationalrevolt: there's a number of ways to do this, the best all involve using a third party analytics solution. |
| 22:23 | callen | rationalrevolt: not futzing around with Ring. |
| 22:25 | rationalrevolt | hmm, i want to show the number of user who are online on the page, when a user visits my app - i was hoping to keep the active session count as an atom/ref and mutating it through something like a sessionlistener |
| 22:25 | minikomi | Hi there |
| 22:30 | brehaut | rationalrevolt: sessions seem like an awkward way to track that given http is stateless |
| 22:31 | brehaut | and teh lifetime of a session doesnt necessarily correspond to the actual lifetime of a visit |
| 22:32 | callen | rationalrevolt: don't do that. |
| 22:32 | rationalrevolt | my app is a statefull game - and every user's gamestate is stored on the session |
| 22:32 | callen | rationalrevolt: you need JS to know who's actually on the site. |
| 22:32 | rationalrevolt | thats true |
| 22:32 | callen | rationalrevolt: you could do a JS -> heartbeat API -> Redis |
| 22:32 | callen | rationalrevolt: but I mean, third party analytics solutions have already done the work and come with APIs. |
| 22:32 | callen | so. |
| 22:33 | callen | best solution would be to cache the results from the third party API |
| 22:33 | callen | because if you try to write a client-side heartbeat module, I guarantee you it is going to break in subtle and impossible to track down ways. |
| 22:33 | callen | ways that could lead to Cthulhu siphoning off your sanity with one of his many eldritch tentacles. |
| 22:33 | brehaut | callen: distributed computation is hard, news at 11 :P |
| 22:34 | callen | brehaut: to be fair, we've had atomic increments and decrements for a long time. |
| 22:34 | brehaut | also, he eats with tentacles, his mere presence or dreams do the sanity siphoning ;) |
| 22:35 | callen | ^^ twoo |
| 22:35 | callen | rationalrevolt: do you have any other dreams I can crush? |
| 22:35 | callen | rationalrevolt: I've had coffee and am feeling frisky/. |
| 22:36 | brehaut | Fhtagn |
| 22:37 | callen | brehaut: I'm actually listening to lovecraftian black metal right now. |
| 22:37 | rationalrevolt | lol, i know session's wouldn't tell me how many are actually really playing my game |
| 22:37 | callen | brehaut: slash blackgaze. It's quite wonderful. |
| 22:37 | brehaut | callen: lol |
| 22:37 | callen | rationalrevolt: it wouldn't tell you anything at all. |
| 22:37 | callen | brehaut: totally incidentally, I was listening to it before this conversation started. |
| 22:38 | brehaut | callen: its only appears incidental because your meagre human perspective is so small |
| 22:38 | callen | brehaut: I mean, the great old ones have been manipulating my will for many years now. |
| 22:38 | brehaut | callen: important question then: tree or star |
| 22:40 | callen | brehaut: tree because it flies past the muggles. |
| 22:41 | brehaut | https://www.youtube.com/watch?v=BWT07iRvI9M |
| 22:42 | callen | brehaut: yeah I've seen that. good video. |
| 22:43 | callen | brehaut: it really bothers me when youtube has better content than 97% ofSNL |
| 22:43 | brehaut | i have no idea what SNL is |
| 22:43 | callen | brehaut: saturday night live? |
| 22:44 | brehaut | oh right. ive never seen it. |
| 22:44 | callen | brehaut: best way to be. Keep it that way. |
| 22:58 | rlazerowitz | Does anybody know of a library that will let me get the distance (radius) between 2 coordinates? |
| 22:59 | rlazerowitz | So I can check if one pair of coordinates is .5 miles near another coordinate |
| 22:59 | callen | rlazerowitz: isn't that just arithmetic? |
| 22:59 | rlazerowitz | callen: Is it? |
| 23:00 | rlazerowitz | callen: to actually get a radius? |
| 23:00 | callen | rlazerowitz: is this something involved data in a database, or in-memory? |
| 23:00 | rlazerowitz | callen: As part of a function |
| 23:00 | rlazerowitz | callen: Yea I guess you are right just simple arithmetic |
| 23:01 | callen | so I'm not totally crazy. |
| 23:01 | rlazerowitz | callen: Yea lol I feel like an idiot. Any good libs though that handle geolocation? |
| 23:01 | xeqi | well, coordinate systems that convert to miles usually do some warping |
| 23:02 | rlazerowitz | xeqi : go on? |
| 23:08 | brehaut | rlazerowitz: http://en.wikipedia.org/wiki/Map_projection |
| 23:08 | rlazerowitz | brehaut: Thanks but this function would not be for more than a few miles |
| 23:09 | xeqi | right, thats what I was thinking |
| 23:09 | xeqi | though wgs84 and the haversine formula might work fine |
| 23:10 | xeqi | assuming a spherical earth was close enough |
| 23:10 | brehaut | rlazerowitz: if you picked the wrong projection, a few miles is enough to distort depending the points are located |
| 23:10 | rlazerowitz | I see this just needs to give a rough estimate of how close you are to someone else in a city |
| 23:10 | rlazerowitz | a few blocks |
| 23:10 | gt` | hi |
| 23:11 | gt` | need to get some pointers on how to configure slime for clojure on emacs |
| 23:13 | brehaut | gt`: do you absolutely need slime? |
| 23:13 | brehaut | gt`: because clojure emacs integration is moving to nrepl |
| 23:13 | brehaut | gt`: http://technomancy.us/163 |
| 23:14 | xeqi | rlazerowitz: as for libs, geotools was the standard java one several years back. Totally over kill for this usage. |
| 23:14 | xeqi | I see there is http://code.google.com/p/simplelatlng/ from a SO question, but can't vouch for it |
| 23:14 | gt` | brehaut: that is wot ppl are using right ? |
| 23:14 | brehaut | its likely that something from openstreetmaps might suffice, but then you have an osm dependancy |
| 23:15 | brehaut | gt`: nrepl is yes |
| 23:15 | gt` | okay how to i get nrepl |
| 23:15 | malyn | rlazerowitz: I use https://www.refheap.com/15862 |
| 23:15 | brehaut | gt`: https://github.com/kingtim/nrepl.el the readme explains |
| 23:16 | brehaut | gt`: depending on your choice of emacs package installation mechanism |
| 23:16 | callen | malyn: I do all of my geolocation stuff with an abacus and a compass. |
| 23:16 | gt` | brehaut: thanks will check it out |
| 23:23 | rlazerowitz | marlyn: thanks but that won't account for warping right? |
| 23:23 | malyn | callen: Sounds too complex. My preferred approach to geolocation is to start a random walk and just wait. |
| 23:24 | malyn | rlazerowitz: You mean because the earth is an ellipsoid and not a sphere? |
| 23:24 | rlazerowitz | malyn: yes |
| 23:24 | callen | malyn: you just but I've seen people use random-neighborhood walkers as a solution to a search problem before. |
| 23:25 | callen | you jest* |
| 23:25 | malyn | rlazerowitz: I thought you only needed accuracy to within a few blocks? |
| 23:25 | rlazerowitz | malyn: yup |
| 23:26 | malyn | rlazerowitz: So wouldn't a spherical earth work in that situation then? |
| 23:26 | rlazerowitz | malyn: I suppose thanks! |
| 23:27 | malyn | rlazerowitz: You bet. Let me know if you need a 16-bit integer version written in Forth. ;) |
| 23:27 | malyn | (which is what I last used that for) |
| 23:27 | rlazerowitz | malyn: forth? |
| 23:27 | rlazerowitz | lol |
| 23:28 | malyn | Turns out it's somewhat complex to do geo calculations without floating point. You have to invent weird new units. |
| 23:28 | callen | rlazerowitz: He actually means the programming language Fors, but he has a Lisp. |
| 23:28 | rlazerowitz | callen: I got that thought it was funny |
| 23:28 | callen | someday I'll invent a joke so punningly awful it's lethal. Then the world is mine. |
| 23:29 | malyn | Of course on IRC you won't know if we're dead or it's a netsplit. |
| 23:29 | callen | malyn: especially on freenode. |
| 23:30 | malyn | callen: Exactly. Everyone else may be dead already. |
| 23:31 | Raynes | callen: I'm buying a car. :D |
| 23:31 | callen | Raynes: I'm considering flouting the official requirements of this programming problem that was sent to me and doing it in zippers. Good idea? Y/N |
| 23:31 | callen | Raynes: oooh, congrats on the car! |
| 23:31 | Raynes | Coworker is selling me his car because he is buying a new one. Ridiculously cheap. No way I could turn it down. |
| 23:31 | Raynes | Bad part is that now I have to deal with the DMV to get my CA license. |
| 23:31 | Raynes | v_v |
| 23:32 | callen | Raynes: CA DMV is the innermost circle of Hell. |
| 23:32 | callen | Raynes: I have made vehicle purchasing decisions based purely on avoiding them in the past. |
| 23:32 | Raynes | Hahaha |
| 23:32 | callen | I'm srs :( |
| 23:32 | Raynes | Alex has been working with me to get me used to driving again before I do any examinations. |
| 23:32 | Raynes | I'm going to drive us to work tomorrow, for example. |
| 23:33 | Raynes | He has been very helpful. Selling me the car super cheap and assisting me with getting the license. |
| 23:33 | callen | Raynes: good idea. Try not to die. |
| 23:33 | Raynes | Well, I drove for the first time in LA, for the first time at all in 7 months, for the first time in his particular car last Saturday. |
| 23:33 | tim | \nick tbaldridge |
| 23:33 | Raynes | He had me drive to Century City and then to Santa Monica. |
| 23:34 | Raynes | It's ridiculous that I have to practice for this crap when I've already been licensed before, but since my AL license expired the day I came here, it's possible they make me take a behind the wheel test. |
| 23:34 | Raynes | Protip: don't not drive for almost a year. |
| 23:34 | callen | Yerp |
| 23:35 | Raynes | callen: I also got tickets to OneRepublic in September at the Greek. |
| 23:35 | Raynes | :D |
| 23:36 | Raynes | PLEASE LOS ANGELES, TAKE ALL MY MONEY. |
| 23:43 | robink | Is it possible to have a macro defined in a binding other than a global one? |
| 23:44 | robink | For instance, I have a source file ${projectdir}/src/core.clj that has an individual (defmacro blah ...) line, and the macro is used by a function defined after it. However, the macro ends up getting called from another namespace (user). Is there a way to prevent this? |
| 23:45 | robink | i.e. I only want the macro to apply for a single function in the source file. I'm OK with it being used in an entire namespace, but I would like it not to apply to other namespaces. |
| 23:45 | echo-area | Probably by defining it as a private one? |
| 23:45 | robink | echo-area: Ah, how do you define a macro as private? |
| 23:46 | echo-area | robink: Adding {:private true} to its meta |
| 23:46 | robink | echo-area: Aha |
| 23:48 | amalloy | robink: see also clojure.tools.macro/macrolet |
| 23:49 | amalloy | (macrolet [(m [body] (whatever))] (defn foo [x] (m x))) |
| 23:49 | robink | amalloy: Thanks |
| 23:56 | robink | amalloy: Does macrolet support defining a macro that's used by defmulti? |
| 23:57 | robink | amalloy: I've got a macro that's (defmethod name type [binding] (expanded form)) |
| 23:57 | amalloy | huh? it just defines a macro that exists only within the defined lexical scope |
| 23:57 | robink | amalloy: Gotcha. |
| 23:57 | robink | amalloy: and defmulti handles the dispatch appropriately, whether the macro is local to a scope or not? |
| 23:58 | amalloy | robink: try it and see |
| 23:58 | robink | amalloy: OK |