2013-05-23
| 00:01 | tomoj | there we go https://www.refheap.com/paste/19106d9f53136ada764dd4792 |
| 00:01 | tomoj | ugly! :) |
| 01:02 | ivan | did korma's defentity go away with no doc update? |
| 01:03 | ivan | oh, it's in korma.core now |
| 01:03 | ivan | heh, c3p0 tries to repeatedly load the postgresql driver when it doesn't exist |
| 01:04 | ivan | I'm sure it'll show up in the classpath any day now |
| 01:33 | sinistersnare | hey, when i type the code into my text editor, it returns a syntax error, its from this page: http://java.ociweb.com/mark/clojure/article.html#Vars |
| 01:34 | sinistersnare | also, what does (def ^:dynamic v 1) do? i understand it makes a variable, but what does the ^:dynamic do? |
| 01:35 | tomoj | forking I think https://www.refheap.com/paste/d4c12399534de8b4938e4f3ac ... |
| 01:35 | tomoj | er. https://www.refheap.com/paste/74d4de4330a2bbc3fc71ed29d |
| 01:35 | sinistersnare | tomoj: what? |
| 01:36 | tomoj | wasn't responding to you |
| 01:37 | tomoj | ^:dynamic lets you give the var a thread-local binding |
| 01:38 | sinistersnare | can you explain why that gives me a syntax error? |
| 01:38 | sinistersnare | tomoj: forgot to site you |
| 01:39 | sinistersnare | cite* |
| 01:41 | ivan | sinistersnare: give us your REPL history |
| 01:42 | tomoj | sinistersnare: only if you upload the code and the entire error at refheap.com |
| 01:42 | sinistersnare | i gave you the link |
| 01:42 | sinistersnare | its that entire thing |
| 01:42 | sinistersnare | i put it in my text editor |
| 01:42 | sinistersnare | and hit run |
| 01:42 | ivan | the page does not include the error or what your REPL received |
| 01:42 | sinistersnare | its not in the repl |
| 01:42 | sinistersnare | its ran |
| 01:42 | sinistersnare | fully |
| 01:43 | sinistersnare | oh hold on |
| 01:43 | sinistersnare | it may be something else |
| 01:43 | sinistersnare | ok |
| 01:45 | sinistersnare | how about another question: how do you run a clojure program? do you do it thru lein? or how can i add clojure to my path to run it |
| 01:45 | ivan | yes, run it through lein |
| 01:45 | sinistersnare | what command? |
| 01:46 | ivan | lein repl, lein run, lein test |
| 01:46 | ivan | see lein help |
| 01:46 | sinistersnare | oh thanks, i put in an invalid command, and it gave me suggestions, and i thought those were all the commands |
| 01:47 | sinistersnare | ivan: im sorry for so many questions, never done this before |
| 01:47 | sinistersnare | but it says i need to define a namespace? |
| 01:47 | clojurebot | single-segment namespaces are unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them. |
| 01:48 | sinistersnare | clojure: whats a namespace needed for? |
| 01:48 | sinistersnare | is it that namespaces are required unlike in java where it just goes to the default package by defaultt? |
| 01:49 | ivan | if you use lein new myproj your files should have a namespace |
| 01:50 | sinistersnare | anyone? |
| 01:50 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 01:50 | sinistersnare | clojurebot: i am... im guessing youre a bot, so i dont know why im replying |
| 01:52 | tomoj | most vars have namespaces |
| 01:52 | tomoj | so if you want to def a var, you need a namespace |
| 01:52 | tomoj | there is a user namespace by default in the repl |
| 01:53 | tomoj | you could just do stuff in there |
| 01:53 | tomoj | but if you are building a project you'll put all the code into namespaces |
| 01:53 | tomoj | then other projects can access your public vars through the namespace |
| 01:54 | sinistersnare | oh ok |
| 01:54 | sinistersnare | so i need to do what the top answer does here?: http://stackoverflow.com/questions/14027774/no-main-namepsace-error-while-running-a-web-app-in-clojure-using-noir |
| 01:55 | tomoj | if you want to run some clojure with `lein run`, yeah |
| 01:55 | sinistersnare | ok cool |
| 01:55 | tomoj | you could also skip the :main and (defn -main ..) stuff, just put some code in a namespace and load and run it in a repl |
| 01:56 | sinistersnare | package control for sublime text is pissing me off right noow |
| 01:56 | sinistersnare | ok |
| 01:56 | sinistersnare | lemme try |
| 01:56 | devn | deploying to heroku is hard |
| 01:56 | tomoj | devn: custom buildpack? |
| 01:56 | devn | barely any change to my code, redeploy, of course something is wrong. |
| 01:56 | devn | no, on the cedar stack |
| 01:57 | tomoj | you don't even know, then :) |
| 01:57 | devn | my app connects to my elasticsearch database |
| 01:57 | devn | i log it when it does |
| 01:57 | devn | but then i make a request and i get a connection refused |
| 01:57 | devn | terrible logging, so no idea what's up |
| 01:57 | tomoj | src/example/foo.clj: (ns example.foo) (defn foo [] 42) |
| 01:58 | tomoj | in `lein repl`: (require '[example.foo :as foo]) (foo) |
| 01:58 | tomoj | er, (foo/foo) |
| 01:58 | tomoj | sinistersnare: ^ |
| 01:58 | sinistersnare | oh ok lemme see |
| 01:59 | sinistersnare | cool |
| 01:59 | tomoj | in the repl you can also do (use 'example.foo) and then just (foo) |
| 01:59 | sinistersnare | tomoj: what does the leading quote do? |
| 02:00 | tomoj | &(type 'foo) |
| 02:00 | lazybot | ⇒ clojure.lang.Symbol |
| 02:00 | tomoj | &(type foo) |
| 02:00 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: foo in this context |
| 02:00 | sinistersnare | thats pretty nifty |
| 02:00 | sinistersnare | it evals it? cool |
| 02:00 | tomoj | the quote prevents it from being eval'd |
| 02:00 | sinistersnare | ahhh |
| 02:00 | sinistersnare | interesting |
| 02:00 | tomoj | (let [x 42] [[x x] '[x x]]) |
| 02:01 | tomoj | > [[42 42] [x x]] |
| 02:01 | devn | tomoj: sigh -- any ideas on debugging clojure on heroku? I'm running locally using the heroku config vars and everything works. i deploy and see the connection succeed. when I go to search it explodes with a ConnectException |
| 02:01 | sinistersnare | how could i run the following in the repl? https://www.refheap.com/paste/14911 |
| 02:02 | tomoj | devn: does `heroku run lein repl` work? :) |
| 02:02 | tomoj | I'd be pleasantly surprised |
| 02:03 | tomoj | what makes you think the connection succeeded? |
| 02:03 | tomoj | what does 'succeed' mean? |
| 02:04 | tomoj | the biggest chunk of my uncertainty says you just don't have heroku authorized in your elasticsearch security group or whatever |
| 02:21 | devn | tomoj: my own damn fault. slamhound was fun and all, but i made a mistake when reviewing |
| 02:22 | devn | http://getclojure.org/search?q=-%3E%3E&num=0 got a better analyzer on the index and query side |
| 02:25 | devn | it no longer supports AND, OR, and the host of other things, but it also means I can quit removing half of the features of the advanced query parser and see -, ->, ->>, /, \, etc work without incident |
| 02:36 | sritchie | do you guys have any tips on how to concatenate two zipper data structures? |
| 02:39 | nightfly | concat? |
| 02:50 | supersym | lt |
| 02:50 | sritchie | nightfly: nope |
| 02:50 | sritchie | nightfly: it'snot a zipper any more |
| 03:07 | supersym | wow...lighttable + enlive together is so sweet |
| 03:11 | nibin | hi all |
| 03:12 | nibin | what is the best path to learn clojure.. ? I am good in Java/Groovy |
| 03:12 | nibin | I have also tried learning scheme (SICP) but couldn't finish the book..will start again |
| 03:12 | nibin | the problem is I am not able to think the problems in a functional way..how to solve this ? |
| 03:13 | nightfly | Use a functional language for a while |
| 03:14 | nightfly | I couldn't pick up haskell when I tried, but clojure I was able to manage because it doesn't force everything to be purely functional |
| 03:14 | nightfly | just highly encourages it |
| 03:15 | nibin | haskell is a language I tried long time back..failed to learn it |
| 04:01 | xificurC | anyone had issues creating a clean project via `lein new project-name` on windows? I get java skyrocketing to 180MBs of RAM and using up one whole cpu while not being able to ever finish the job, it just hangs on |
| 04:09 | Pure_Loulou | hello room |
| 04:16 | Pure_Loulou | how do i force a peristentlist that might contains lazyseq,to realize |
| 04:16 | Pure_Loulou | i want to track the time a function make to create the list,so i dont want it to have lazy members |
| 04:18 | noncom | xificurC: I use CCW and when my main prog hangs, the REPL is still there and yest, it can be hanging forever, taking up about that space.. and if I do not kill the java processess with the process man, they accumulate thhere |
| 04:18 | noncom | tends to be due to the fact that leinuses two jvms to do it's job, i think... |
| 04:19 | noncom | Pure_Loulou: try (doall (your-lazi-calculation-here) |
| 04:19 | noncom | ) |
| 04:21 | noncom | Pure_Loulou: or you can try like (into [] your-persistent-col) |
| 04:21 | Pure_Loulou | ok thanks noncom |
| 04:22 | Pure_Loulou | when i use (doall (function ...)) everything is calculated? |
| 04:22 | xificurC | noncom: and no solution? |
| 04:23 | noncom | Pure_Loulou: yes, examine docs for doall, doseq, dorun... also (into []) will force an existing col to be calced |
| 04:24 | Pure_Loulou | i have read them but i dont trust them much :P,thanks |
| 04:24 | noncom | xificurC: I did not find a solution, but I did not look thoroughly.. I think that someone who knows leiningen well might know. |
| 04:25 | clgv | noncom: there is a kill button for the current evaluation in CCW |
| 04:32 | noncom | clgv: yes, there is the eclipse "stop" button, and there is "interrupt" button in the repl window, but none of them help. I press interrupt, I press stop, then(!) I close the still running app of mine, which handles killing it's inner processes I'm pretty sure... and then there is one more java proc in the memory. and they accumulate with every run. what is interesting, each of them has an accompanying "conhost" process |
| 04:33 | noncom | * accumulate on every repl start |
| 04:34 | clgv | noncom: interupt is the one I mean |
| 04:35 | clgv | noncom: the "stop" button on the "console view" will kill the whole repl |
| 04:35 | clgv | noncom: they work reliably on all of my machines. one machine I use 5 of 7 days. |
| 04:36 | clgv | noncom: what is your scenario? |
| 04:46 | lpetit | Hello: Which FTP client do OS X guys use ? |
| 04:49 | clgv | lpetit: good morning. how are you? |
| 04:49 | lpetit | clgv: good morning. Fine, and you ? |
| 04:50 | clgv | lpetit: fine and busy. |
| 04:50 | clgv | lpetit: whats new on the CCW front-line? |
| 04:50 | lpetit | You may wonder why no new CCW release has occurred lately. It's simple: I haven't touch the code for a while. Instead, I've been working on full automatic build via maven, then I was on holidays, then I worked on automation of the publication |
| 04:51 | clgv | you anticipated that question :D |
| 04:51 | lpetit | I expect to have a full tool chain by the end of the day. I should have done that months (years ?) ago, so I decided now's the time :-) |
| 04:51 | clgv | I didnt touch CCW code neither for quite some time ;) |
| 04:52 | lpetit | Then the next step will be to add some automated smoke tests to the build (via SWTBot I guess) |
| 04:53 | lpetit | clgv: fact is, I thought, that if I don't stop what I'm doing and do this boring but important stuff, I will never do it, and continue to lose time building, testing, etc. So I re-read my classics and kicked my (own) ass. |
| 04:54 | lpetit | So … which FTP client for a poor OS X user? :) |
| 04:54 | clgv | lpetit: good. so all of CCW will be built with one maven command? |
| 04:55 | lpetit | clgv: yes. |
| 04:55 | clgv | hmm my reference os x user is not in our room right now... |
| 04:56 | lpetit | as easy as: git clone http://github.com/laurentpetit/ccw && cd ccw && mvn clean install |
| 04:57 | lpetit | (and drink a coffee or 2 the first time it downloads the Internet, of course ;-) ) |
| 04:59 | lpetit | clgv: and so there will be revamped update sites : for stable versions, for beta versions, and for the latest successful build via the continuous integration (travis-ci) |
| 04:59 | lpetit | clgv: https://code.google.com/p/counterclockwise/wiki/UpdateSites |
| 04:59 | testingtester | hi |
| 04:59 | clgv | lpetit: ah great |
| 05:00 | clgv | lpetit: you got your own server running for those sites now? |
| 05:00 | lpetit | clgv: yeah, and I bought the ccw-ide.org domain |
| 05:00 | clgv | or "soon" as it reads |
| 05:01 | lpetit | clgv: yeah, still playing with it, don't expect a public announcement today |
| 05:01 | clgv | lpetit: so I should revisit my repl enhancement branches in a few weeks ^^ |
| 05:01 | lpetit | clgv: I resorted to good old filezilla |
| 05:02 | lpetit | clgv: sure, I won't touché them. Next release will probably just be a release to test that everything's ok with the new build toolchain (maybe just with one bug fix for good mesure) |
| 05:14 | noncom | clgv: i just pres ctrl+alt+s and the repl starts. then no matter how i shut everything down, the java process remains there. |
| 05:14 | noncom | clgv: just tried with almost empty file - same thing |
| 05:20 | edolough1 | lpetit: Cyberduck is pretty good on OS X |
| 05:20 | lpetit | edolough1: ah indeed I saw it quoted a lot. Thx. |
| 05:32 | testingtester | where can i get free book on clojure? |
| 05:34 | clgv | noncom: I just did start a repl and close it. there is only the java process from eclipse |
| 05:34 | edoloughlin | testingtester: Some good pointers at http://www.elangocheran.com/blog/2012/03/the-newbies-guide-learning-clojure/ |
| 05:38 | devn | hello all |
| 05:39 | devn | Elixir's website makes me jealous |
| 05:39 | devn | Clojure needs a similar Getting Started section |
| 05:40 | noncom | clgv: ok, i have found out something. when i close the repl, the repl does not stop. I can then reconnect to it and it will execute clojure forms like if all is ok. |
| 05:41 | noncom | i think that this is the source of this issue in the first place |
| 05:42 | noncom | clgv: also, maybe it is relevant that i use 0.13 beta |
| 05:42 | noncom | of ccw |
| 05:45 | noncom | clgv: interrupt command does nothing except for writnig ;; Interrupting... to the output. maybe it is used to interrupt some long-running calculations |
| 05:45 | noncom | but not to kill the repl |
| 06:26 | llasram | Argh, Delays don't implement IObj? What the hell |
| 06:29 | tomoj | and if you make a new class force breaks |
| 06:31 | tomoj | what would with-meta mean? |
| 06:31 | tomoj | the meta of the delay has no connection to the meta of the result I guess? |
| 06:31 | llasram | In what sense? |
| 06:31 | llasram | Yah |
| 06:31 | tomoj | a less sensible thing occurred to me first :) |
| 06:31 | llasram | Ah :-) |
| 06:34 | clgv | noncom: switch to 0.12.3 |
| 07:27 | tomoj | say you want to save off the &env in a macro and use it later |
| 07:29 | tomoj | you could just save the symbols |
| 07:29 | tomoj | oh |
| 07:29 | tomoj | I was worried if they have metadata you're going to evaluate that metadata multiple times |
| 07:29 | tomoj | but you'd just expand so that they wind up in binding position as appropriate, where metadata does not appear to be evaluated |
| 07:29 | tomoj | I suspect I'm confused.. |
| 07:43 | asaleh | anybody using necessary-evil for xml-rpc? I have a few questions |
| 08:22 | clgv | I remember a private repository solution for jar artifacts with a web frontend that was either mentioned here or on the ML but I cant find the information. does someone know such repository applications? |
| 08:32 | clgv | are sonatype nexus and apache archiva the solutions to choose from? |
| 08:36 | Anderkent | clgv: there's also artifactory |
| 08:37 | clgv | Anderkent: ah thanx just saw it a minute ago in this feature matrix http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix;jsessionid=411E8A348FE3F04C025E07FC988DD79E |
| 08:37 | clgv | Anderkent: do you use one of them? |
| 08:38 | Anderkent | I don't personally use any, I think we have a nexus local mirror, but I don't manage it at all |
| 08:38 | nibin | we use archiva.. |
| 08:39 | clgv | even with the matrix I am unsure what to use |
| 08:42 | Anderkent | clgv: that would mean they look equally good to you, so just pick any and try setting it up :P |
| 08:42 | clgv | Anderkent: or that I do not know which features are important ;) |
| 08:42 | Anderkent | or google for 'setting up {archiva,artifactory,nexus}' and see which one has best setup guides |
| 08:43 | Anderkent | http://www.gluster.org/2013/04/maven-repo-management-with-archiva/ seems pretty simple |
| 08:58 | bordatoue | hello, I am trying to compile a java class file using lein 2.x , java file depends on few api .jar I had added the .jar references in :resource-paths and java-source-paths to point to my java class directory. However when I start the repl I still get compilation error saying it cannot find reference to the library required to compile the class file. |
| 09:03 | bordatoue | ok, how do i set the classpath for lein javac |
| 09:06 | luxbock | I'm trying to use a small Java library for my project but I'm having trouble with calling it from Clojure |
| 09:07 | luxbock | I have compiled the java source code into a .jar, then added the directory where the .jar is located to my CLASSPATH, but Clojure still won't find the library in question |
| 09:07 | clgv | luxbock: can you use it a dependency via your project.clj? or the simplified question: is it available on http://search.maven.org/ ? |
| 09:07 | luxbock | it's not |
| 09:08 | luxbock | it's not so much a library as it is just someone elses code that I would like to use for my project but I'm not very good with Java |
| 09:08 | clgv | will you need it permanently for your project? |
| 09:08 | luxbock | yes |
| 09:10 | clgv | then build a minimal my-lib.pom file and deploy it on clojars.org - you can then add it as dependency to your project.clj |
| 09:10 | xeqi | * only if it has an appropriate license for distribution |
| 09:10 | clgv | hm right. I assumed an open source license |
| 09:11 | luxbock | is there any way for me to use it, even if just temporarily (I don't know if anyone else will ever use the program besides myself) without uploading it? |
| 09:11 | clgv | you can install it in your local maven repository |
| 09:12 | luxbock | alright, thanks |
| 09:12 | tomoj | clojure-metal -> llvm.js ? |
| 09:12 | xeqi | if you are using leiningen, you can install it in the local maven cache with lein-localrepo, or abuse :resource-paths if it really is only you |
| 09:14 | luxbock | I'd just like to try it out first so I'll try to do that |
| 09:24 | bbloom | tomoj: is closing channels manually really necessary? shouldn't the garbage collector take care of most of that? |
| 09:25 | bbloom | tomoj: https://groups.google.com/forum/#!msg/golang-nuts/pZwdYRGxCIk/qpbHxRRPJdUJ |
| 09:34 | mefesto | Good morning all. |
| 09:35 | pterygota | morning! ridiculous newb question involving quil and interactive evaluation ... |
| 09:40 | Pupnik | just ask pterygota no need to wait |
| 09:41 | pterygota | I want to be able to reevaluate my defn from the emacs buffer while the quil app is running |
| 09:42 | pterygota | but I get a compiler exception myfunction already refers to etc error when I do that |
| 09:42 | pterygota | the only way I've figured out to get something like what I want is to do a (use :reload 'whatever.core) in the repl, but that starts a whole new app |
| 09:43 | pterygota | the idea that I could actually achieve this came from example2.clj in the quil project source, where it says ";; here's a function which will be called by Processing's (PApplet) |
| 09:43 | pterygota | ;; draw method every frame. Place your code here. If you eval it |
| 09:43 | pterygota | ;; interactively, you can redefine it while the applet is running and |
| 09:43 | pterygota | ;; see effects immediately |
| 09:43 | pterygota | " |
| 09:43 | Anderkent | pterygota: clojure 1.4 or 1.5? |
| 09:44 | Anderkent | http://dev.clojure.org/jira/browse/NREPL-31 seems to suggest this is fixed for 1.5 |
| 09:44 | pterygota | looks like I'm running 1.5.1 |
| 09:44 | Anderkent | oh wait nvm |
| 09:44 | Anderkent | i misread the bug |
| 09:45 | Anderkent | pterygota: can you post the exact exception? |
| 09:47 | jcromartie | I like it when the code for a whole namespace fits on the screen |
| 09:48 | pterygota | CompilerException java.lang.IllegalStateException: draw already refers to #'myproject.core/draw in namespace: user compiling:(NO_SOURCE_PATH:1:1) |
| 09:49 | pterygota | so I'm thinking this is just something that I'm doing wrong because I have no knowledge of how to do the thing I'm trying to do |
| 09:50 | pterygota | that's the message I get when I try to reevaluate the draw defn while the app is running |
| 09:50 | jcromartie | pterygota: are you just pasting it into the REPL? |
| 09:50 | jcromartie | or typing it in, i.e. (defn draw …) in the REPL |
| 09:51 | jcromartie | pterygota: try (in-ns 'myproject.core) first |
| 09:51 | jcromartie | then (defn draw …) |
| 09:51 | Anderkent | pterygota: you have to evaluate your (defn ) in the myproject.core ns, not in the user one |
| 09:51 | pterygota | I was doing a C-x C-e |
| 09:51 | jcromartie | yeah you need to change to the ns you want to evaluate in |
| 09:52 | Anderkent | do (in-ns 'myproject.core) then evaluate that form |
| 09:52 | jcromartie | C-c M-n in NREPL |
| 09:52 | pterygota | okay great yeah thats it, doing an eval-buffer gets me into the right ns |
| 09:52 | jcromartie | C-c C-k is good |
| 09:52 | pterygota | then after that I can reeval to my hearts delight |
| 09:52 | jcromartie | to recompile a whole file |
| 09:52 | jcromartie | that should do the trick too |
| 09:52 | pterygota | k noted |
| 09:52 | Anderkent | yes. So basically the problem was you were trying to evaluate a defn that would hide a function imported from a different ns |
| 09:53 | pterygota | okay, that makes sense and is meaningful to this total newb |
| 09:53 | pterygota | thanks so much! |
| 09:57 | luxbock | hmm I managed to add the file via 'lein localrepo install' and I can see it with 'lein localrepo list -f' |
| 09:57 | luxbock | and I used 'lein deps' afterwards in the project directory after having added the file as a dependency for my project |
| 09:57 | luxbock | but yet I still can't call it from the REPL via import |
| 09:57 | luxbock | did I miss something I was supposed to do? |
| 09:58 | clgv | luxbock: you import classes from the jar right? you do not try to import the jar-name? |
| 09:58 | pandeiro | if i do (defroutes a (GET "/" [] :foo)) and (defroutes b (GET "/abc" [] :bar)) and then (defroutes app (wrap-middleware a) b), why does the wrap-middleware affect 'b'? |
| 09:59 | luxbock | yes, the Java file in the class declares itself as: package pokerai.game.eval.indiana; |
| 09:59 | luxbock | so I'm trying to (import '(pokerai.game.eval.indiana)) |
| 10:00 | luxbock | or (import pokerai.game.eval.indiana) |
| 10:00 | clgv | luxbock: that wont work. you need to import the class not the package |
| 10:00 | luxbock | ahh |
| 10:02 | luxbock | yeah that does it, thanks! |
| 10:05 | Anderkent | pandeiro: it shouldn't. Do you have an actual example? |
| 10:06 | pandeiro | Anderkent: i would need to extract it from my actual project, let me see |
| 10:07 | jjttjj | any particular reason why cljx doesn't seem to be catching on as much as lein-cljsbuild crossovers? the former seems much more flexible and I'm not really seeing any reasons why someone would prefer the latter |
| 10:07 | pandeiro | what is happening though is that the middleware affects subsequent routes, so if I do (defroutes app b (wrap-middleware a)), b is no longer effected |
| 10:10 | pandeiro | Anderkent: if u don't mind sorting through my app's gobbledygook, here's what i'm using: http://sprunge.us/dMAh?clj |
| 10:10 | pandeiro | i'm still not fully understanding how routes and middleware can (and can't) be composed, i guess |
| 10:12 | pandeiro | (if i list the dashboard routes and their middleware *above* the auth routes, i get an endless redirect loop) |
| 10:15 | pandeiro | thinking about it, i guess it makes sense... defroutes is just compiling a sequence of functions to try on the request map one after another, so if the first results in a redirect w/o auth, i never break out of that loop |
| 10:16 | pandeiro | so i guess the question is, besides putting that middleware-affected collection of routes last, is there another way i could set up that authenticated-or-redirect-to-signin as middleware? |
| 10:30 | gtrak | pandeiro: defroutes doesn't do anything special, think of compojure's 'routes' as a big 'some' across a nil-punning contract. |
| 10:30 | gtrak | each 'GET' or whatever just returns a function that follows that contract |
| 10:30 | gtrak | the 'some' bit in 'routes' handles the composition |
| 10:30 | pandeiro | gtrak: k yeah i'm grokking that |
| 10:31 | pandeiro | now i'm just trying to see where in that sequence of functions to put redirects |
| 10:31 | pandeiro | when the user isn't authorized to get a particular route |
| 10:31 | pandeiro | so that i don't have to write that logic into each particular handler |
| 10:34 | pandeiro | i could just have the wrap-admin-only middleware return nil, but then where do i execute the redirect? (i have catch-all type routes for serving resources and 404/500 at the end... what i want is for the user trying to access a privileged route to simply be redirected to the login page) |
| 10:34 | pandeiro | i think i will separate the main route / and the privileged access json routes and handle them differently |
| 10:35 | pandeiro | sorry for spamming the channel with my sluggish brainstorming :) |
| 10:36 | gfredericks | does it sound plausible that clojure error messages and docstrings and code comments aren't well developed because most people don't consider it worth the effort to do the JIRA thing for any particular small improvement? |
| 10:38 | noidi | not just the JIRA thing, but the send-the-contributor-agreement-by-postal-mail thing |
| 10:38 | gfredericks | well that's a one-time thing |
| 10:38 | gfredericks | I guess I'm asking about the people who've already done that |
| 10:38 | noidi | it seems that sending a letter to the US can be quite expensive from some countries |
| 10:39 | gfredericks | I was just wondering about alternatives to the jira process. maybe some sort of batch ticket based on a github fork w/ pull reqs |
| 10:40 | gfredericks | that might still require separate patches to give everybody credit though :/ |
| 10:41 | clj_newb | Hi, it is possible to create an array of functions? to pass to a variadic function as a parameter |
| 10:42 | gfredericks | I'm having trouble interpreting those two sentences together |
| 10:42 | gfredericks | in any case yes |
| 10:42 | bbloom | clj_newb: your question is really hard to parse, but i'm gonna assume you need to know about ##(doc apply) |
| 10:42 | lazybot | ⇒ "([f args] [f x args] [f x y args] [f x y z args] [f a b c d & args]); Applies fn f to the argument list formed by prepending intervening arguments to args." |
| 10:42 | clj_newb | oh, sorry, trying to use fancy words here hehe |
| 10:42 | tomoj | I assumed he meant a variadic java method, but then why is it taking an array of fns? :) |
| 10:43 | TimMc | gfredericks: Absolutely. Well, Jira is one part; I think Rich is hostile to code comments and detailed docstrings. |
| 10:43 | gfredericks | TimMc: hostile to contributions of them? |
| 10:45 | clj_newb | well, just learning clojure, I came across this doubt, with the function (fn f[n & fs], if I try to call like (f 4 [inc -] it takes the second argument as a vector (because it is) |
| 10:45 | gfredericks | (apply f 4 [inc -]) |
| 10:45 | clj_newb | thanks gfredericks |
| 10:46 | clj_newb | bbloom: and tomoj thanks too |
| 10:46 | clj_newb | sorry |
| 10:47 | TimMc | gfredericks: Not just contributions. I think he would consider them clutter or something. |
| 10:48 | gfredericks | I guess this kind of muttering is where clojuredocs came from |
| 10:56 | bbloom | tomoj: ok so i'm attempting to port this: https://github.com/lintide/GoConcurrencyPatterns/blob/master/googleSearch05.go |
| 10:56 | bbloom | it's kinda tricky :-) |
| 10:57 | bbloom | a few issues: 1) i'm not sure i like how alt works, it feels verbose 2) it's idiomatic in go to write blocking code, but with the async block you get channels instead of values more often than you'd like 3) i'm concerned about unwrapped <! operations being unportable to cljs |
| 11:04 | bbloom | tomoj: https://www.refheap.com/paste/14917 |
| 11:04 | bbloom | doesn't work b/c alt is throwing an error |
| 11:05 | bbloom | also, that's a DIRECT PORT. uses transients for the mutable results collection |
| 11:05 | bbloom | obviously that won't work on cljs b/c of the blocking reads |
| 11:15 | pjstadig | protip: (:map :id foo) doesn't really do the same thing as (map :id foo) |
| 11:24 | jaley | anyone here experienced with aleph? I'm getting a nullpointerexception from some intCast() in http.core but can't figure out what's going on |
| 11:25 | gfredericks | any guesses how to get C-u C-x C-e to pretty-print (nrepl.el)? |
| 11:25 | gfredericks | pjstadig: crap I gotta go change all my function calls |
| 11:25 | yogthos | does anybody know if lein has some way to do namespace exclusions when creating the jar? |
| 11:30 | trptcolin | yogthos: file exclusion regexes are an option (:jar-exclusions) |
| 11:31 | trptcolin | but no way to do a 1-1 mapping that i know of |
| 11:31 | yogthos | trptcolin: yeah I saw that one, was wondering if that was the best way to do it |
| 11:31 | trptcolin | [in case you had done something crazy like defined 2 nses in 1 file] |
| 11:31 | yogthos | oh nothing that bad :) |
| 11:31 | yogthos | I think I can just move my ns to test package instead |
| 11:34 | gtrak | pandeiro: I think your missing link: |
| 11:35 | gtrak | (routes (GET ..) (POST ..) (POST_2 ..)) is equivalent to (routes (GET ..) (routes (POST ..) (POST_2 ..))) |
| 11:35 | gtrak | so, you can compose functionality that way, ie a specific middleware |
| 11:36 | gtrak | in pseudocode (some pred [1 2 3 4]) = (some pred [1 2 (some pred [3 4])]) |
| 11:38 | gtrak | this is why I hate defroutes, it's easy to miss the point |
| 11:38 | gtrak | it took me some digging to figure out the actual contract |
| 11:39 | gtrak | the second pred would be your access-control-redirect middleware |
| 11:42 | gtrak | I think of it like the linked-list portion of a hash-map lookup |
| 11:43 | gtrak | you could always use a bigger hashmap and have more buckets, and have no need for a list-traversal |
| 11:57 | justin_smith | "parsing html? sorry, that's for the parsers union, we regexes aren't allowed to handle that, union rules" |
| 11:58 | gfredericks | do a web crawl, figure out what the deepest html tree is, and then write a regex that handles one level past that |
| 11:58 | justin_smith | heh |
| 11:59 | TimMc | regex + stack can parse HTML just fine |
| 11:59 | TimMc | Of course, what you have now is a pushdown automaton. |
| 12:00 | gfredericks | the playground bully of automatons |
| 12:00 | pandeiro | gtrak: thanks a lot for the explanation, i've just sketched out a whole new route scheme and it's working exactly how i want it to :) |
| 12:01 | gtrak | excellent :-) glad that was helpful |
| 12:04 | noncom | clgv: hi again! so don't you have any more ideas on why java processes are hanging there? hem are repls - i can reconenct to them if i close the repl window. as i see, there is no way to actually kill a repl from ccw. |
| 12:04 | noncom | i'm using 0.13 beta |
| 12:05 | clgv | noncom: in 0.12.3 closing the repl view shutsdown the whole repl |
| 12:05 | noncom | clgv: yes i too remember that it was so. maybe it is a 0.13 bug? |
| 12:05 | clgv | noncom: you should use the stable updatesite. the beta update site is for developers |
| 12:06 | clgv | noncom: might be a not completed feature |
| 12:06 | noncom | clgv: i had to use this development version because it has some features in project management that i make use of. |
| 12:06 | clgv | noncom: huh? which? |
| 12:10 | clgv | noncom: I do not see related feature commits on github |
| 12:10 | noncom | clgv: something with the run config. it would not find java library classes, i got like "ClassNotFoundException com.jme3.app.SimpleApplication java.net.URLClassLoader$1.run (URLClassLoader.java:366)" with 0.12, and atkaaz in clojure google group adviced to move to 0.13 |
| 12:10 | noncom | updating relly resolved the problem |
| 12:12 | noncom | do you think this is a mistake? |
| 12:12 | clgv | noncom: when did you get that exception? maybe you just had an error with your project.clj or something... |
| 12:13 | noncom | lgv: well, as ar as i remember, solely updating to 0.13 solved the issue. in my project.clj i have :resource-paths ["lib/*"] and it won't find the jars there, with this error message. |
| 12:13 | noncom | sry keyboard issue with typing your nic |
| 12:15 | noncom | i am using a bunch of jars that arent on clojars |
| 12:15 | noncom | turns out to be a real pain in clojure world |
| 12:15 | clgv | ~repeatability |
| 12:15 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 12:15 | clgv | ;) |
| 12:15 | noncom | :D ahahah |
| 12:15 | noncom | yeah |
| 12:15 | clgv | it saves you from much pain later on ;) |
| 12:16 | noncom | agree, but then i wish clojars pushing was easier. |
| 12:16 | clgv | it is pretty easy |
| 12:16 | clgv | I did it with pure java projects myself... |
| 12:17 | clgv | noncom: humm might be that 0.13.0 beta has a more recent leiningen version - I dont remember that wildcards where allowed in resource-paths |
| 12:17 | justin_smith | gpg will hold your hand through creating a key |
| 12:18 | noncom | i could not find a definite step 1-2-3.. instruction anywhrere, and in clojure user group nobody really told me too. that solution is the best what community adviced... see, the library i use, a 3d engine, is a set of 30 jars and in order to push them i have to invent to much stuff.. all these pom descriptions which are not used in there... and asking the creators to do this is useless - they dont care |
| 12:19 | noncom | yeah, probably the wildcards thing is really a leinengen thing, not directly a ccw issue |
| 12:20 | llasram | I'm pretty sure that the `resource-paths` are just directly added to the classpath. So if the JVM interprets the wildcard, it should work. |
| 12:20 | llasram | You can do `lein classpath` to see what the constructed classpath looks like |
| 12:20 | noncom | oh and about clojars: i spent about 2 days trying to figure out what to do, searching instructions on internet |
| 12:21 | ianeslick | Protocol design question. I'm writing a proper inspector for nrepl and want to extend it so you can easily implement inspectors for new types like Datomic Entities. |
| 12:21 | ianeslick | Currently I pass an 'inspector' object to a render method for each primitive type (inspect inspector value) => inspector |
| 12:21 | noncom | llasram: yeah, probably, maybe i will try to use 0.12 with classpath in the run config. as i remember, i tried that with 0.12 and it did not work. but i'll setup a testing environment for that to check again. |
| 12:22 | ianeslick | So the method knows about the internals of the inspector object and maintains the inspector invariants |
| 12:22 | ianeslick | I can modify this as a protocol method (inspect [obj inspector]) and keep the same approach, but then it feels like protocol extends need to know too much about inspector internals. |
| 12:23 | llasram | noncom: Run config? |
| 12:23 | ianeslick | So perhaps a protocol for extracting the primitive elements so there is no inspector object being passed into the protocol methods... |
| 12:25 | llasram | ianeslick: Why `inspect` function implementations need to know about some sort of `inspector` object? |
| 12:26 | ianeslick | (defprotocol Inspectable |
| 12:26 | ianeslick | "Types implementing this protocol can be inspected by the nREPL inspector" |
| 12:26 | ianeslick | (header [obj] "Key-value pairs describing the object") |
| 12:26 | ianeslick | (inspect-shape [obj] ":atom|:seq|:map") |
| 12:26 | ianeslick | (contents [obj] "The value to render; a seq if :seq or a seq of pairs if :map")) |
| 12:27 | ianeslick | (Mostly talking out loud here, didn't like a protocol that depended on an inspector. Don't use protocols much so thinking through the design space) |
| 12:27 | technomancy | protocols are really not the right thing for this |
| 12:27 | ianeslick | technomancy: why not? |
| 12:27 | technomancy | because inspecting is I/O bound; dispatch speed is not an issue |
| 12:28 | ianeslick | How to solve the dependency injection problem for things like Datomic Entities so they can more easily be inspected (because even slime didn't get that righT) |
| 12:29 | technomancy | you could search the classpath for namespaces under a specific prefix which contain defmethods to be loaded at boot |
| 12:29 | ianeslick | I've got most of a new inspector implemented, much simpler / more functional now I think but I want to be able to allow external libraries extend the inspector to make it easier to inspect custom state. |
| 12:29 | llasram | ianeslick: I believe technomancy is expressing a preference for multimethods > protocols |
| 12:30 | noncom | llasram: yeah, the run config |
| 12:31 | ianeslick | I don't think I grok all the implications for load time resolution / extension of an inspector. For example we don't want project.clj to depend on nrepl-inspector to load a library, but we want a library to provide support for customized inspection if the nrepl-inspector is loaded in your profile.clj |
| 12:31 | llasram | noncom: Er. I meant: what is "the run config"? |
| 12:32 | technomancy | right; you would put the inspector in your user profile and it would detect any other inspect-method-providing namespaces on the classpath somehow and load them |
| 12:34 | ianeslick | e.g. (ns inspector.ext.datomic (:require inspector.methods :only [inspect])) is loaded if inspector core is present, otherwise that file is ignored so while it depends on the inspector for namespace resolution, it is ignored in cases where the inspector is not present? |
| 12:34 | noncom | llasram: it is a part of project run configuration in eclipse |
| 12:34 | technomancy | ianeslick: right |
| 12:35 | llasram | noncom: Ohhhh. Well, have fun with that :-) |
| 12:35 | noncom | llasram: hehe :) thanks |
| 12:38 | llasram | I wish CCW's Leiningen integration just did everything via Leiningen. The people on my team trying to use CCW have run into all kinds of weirdness from e.g. CCW launching REPL JVM's itself |
| 12:38 | ianeslick | Hmmm... |
| 12:39 | ianeslick | technomancy: I guess I have to change the multimethod dispatch to return primitive types so it's generic? |
| 12:40 | technomancy | or at least fall back to types |
| 12:40 | llasram | Wouldn't the dispatch function just be `type`? |
| 12:41 | ianeslick | It can be convenient to use type predicates for things like numerics. |
| 12:42 | llasram | You mean like: (if (number? x) ::number (type x)) ? |
| 12:42 | ianeslick | basically |
| 12:42 | llasram | That makes sense |
| 12:44 | ianeslick | Just means we can only extend the inspector for concrete types, but that's the same as protocols. |
| 12:44 | ianeslick | Good enough for now |
| 12:45 | ianeslick | technomancy: thanks |
| 12:45 | llasram | ##(type (with-meta [:what-am-i?] {:type :whatever-i-want})) |
| 12:45 | lazybot | ⇒ :whatever-i-want |
| 12:45 | ianeslick | llasram: Ah, good point |
| 12:46 | ianeslick | :default (or (:inspector-tag (meta obj)) (type obj)) |
| 12:52 | ianeslick | There is probably good work along these lines in Lightroom, now that I think about it. |
| 12:52 | ianeslick | Oops, lighttable |
| 12:57 | ianeslick | Mycroft is interesting, unmaintained though. |
| 13:00 | vrman | Ok guys, I've just started learning clojure and I don't get the point of keywords |
| 13:01 | vrman | Why not just have quoted literals? |
| 13:01 | ianeslick | vrman: quoted literals (you mean symbols) are namespace specific |
| 13:02 | ianeslick | vrman: keywords also double as functions, so it makes for a nice convention for accessing associative objects |
| 13:02 | vrman | Oh kewl. Thanks man |
| 13:03 | nDuff | vrman: ...also, being automatically interned means identity comparison works for them |
| 13:03 | technomancy | right; symbols are not singletons, because they have to be able to carry metadata in order to be useful for building code out of |
| 13:03 | technomancy | (line/file positions, etc) |
| 13:04 | hiredman | keywords roundtrip through printing and reading |
| 13:10 | clgv | can I get the bytes of a double array to write it to a file as one? |
| 13:11 | gfredericks | 8 bytes per double? |
| 13:12 | pepijndevos | This would be fun in C. |
| 13:12 | clgv | well. in C++ I'd just cast ^^ |
| 13:12 | gfredericks | ,(.toHexString 7.4) |
| 13:12 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: toHexString for class java.lang.Double> |
| 13:12 | noncom | in proxy how can i access "this"? |
| 13:12 | gfredericks | ,(Double/toHexString 7.4) |
| 13:12 | clojurebot | "0x1.d99999999999ap2" |
| 13:12 | gfredericks | wat |
| 13:13 | pepijndevos | clgv: http://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java |
| 13:13 | clgv | I just saw that in "kryo" the default array serializer for double arrays writes the doubles one by one |
| 13:14 | tomjack | guava primitives doesn't even do that :( |
| 13:14 | llasram | clgv: The JVM JIT makes it faster than one would naively expect |
| 13:14 | clgv | but it is the function that needs most of the time according to the profiler |
| 13:15 | pepijndevos | clgv: so you;re looking for a faster way to do the whole aray at once, like a C cast? |
| 13:15 | llasram | Ah! Numbers! |
| 13:15 | clgv | pepijndevos: indeed |
| 13:15 | gfredericks | llasram: how do they work? |
| 13:15 | llasram | I think with tiny magnets |
| 13:16 | tomjack | clgv: I think you'd need nio for that? |
| 13:17 | pepijndevos | The ByteBuffer looks like the way to go :/ |
| 13:18 | gfredericks | what is java.nio about? |
| 13:18 | gfredericks | not clear from the javadocs what distinguishes it from generic java.io |
| 13:18 | nDuff | gfredericks: basically, not being horrid.. |
| 13:18 | nDuff | gfredericks: ie. adding proper support for the select() call |
| 13:18 | nDuff | gfredericks: ...which the original java IO subsystem saw no need for. |
| 13:19 | llasram | clgv: I'm afraid I think you're out of luck. You might be able to do something crazy with JNI, but myself I don't know it well enough to know for certain you wouldn't end with a copy step |
| 13:20 | pepijndevos | I'm thinking of a way to is JNA to do some horrible thing to the array. |
| 13:20 | pepijndevos | *use |
| 13:44 | gfredericks | is there some sort of consistency with lein tasks taking arguments in -x style and :foo style? |
| 13:45 | technomancy | gfredericks: :keywordy is better |
| 13:46 | gfredericks | other style is legacy? |
| 13:46 | technomancy | ish |
| 13:53 | stirfoo | is it possible to catch an exception thrown during macro expansion using clojure.test? |
| 13:53 | stirfoo | the thrown? predicate works fine if the exception is thrown in the expanded code |
| 13:55 | technomancy | stirfoo: if your tests require code that won't compile, then your tests won't compile. |
| 13:56 | stirfoo | ah =) |
| 13:57 | technomancy | you could test compile-time behaviour by compiling at runtime though |
| 13:57 | dsabanin | hey guys |
| 13:58 | stirfoo | thanks technomancy, that's at least an option |
| 13:59 | dsabanin | starting to learn Emacs here for Clojure development, can someone recommend a good plugin to manage the project files? Something with file tree browser |
| 13:59 | mthvedt | if you want a new kind of exception, is there something more clojure-y than subclassing Exception in java |
| 14:00 | mthvedt | or proxying |
| 14:00 | dsabanin | mthvedt check out https://github.com/scgilardi/slingshot - it's awesome |
| 14:00 | technomancy | dsabanin: file tree browsers are not really a good use of screen space |
| 14:00 | technomancy | mthvedt: use ex-info |
| 14:00 | llasram | dsabanin: Most Emacs users don't use that sort of thing, honestly. I know of ECB and Speedbar, but not of their current states |
| 14:00 | llasram | dsabanin: You might have better luck asking on #emacs |
| 14:01 | dsabanin | technomancy well at least something like textmate's / sublime's Cmd + T command. Picking up files with C-x C-f is tiresome |
| 14:01 | justin_smith | dsabanin: I use ido |
| 14:01 | technomancy | dsabanin: sure, check out find-file-in-project |
| 14:01 | justin_smith | ido has fuzzy completion, which helps quite a bit |
| 14:02 | dsabanin | thanks for the suggestions, looking up |
| 14:03 | justin_smith | http://www.emacswiki.org/emacs/InteractivelyDoThings |
| 14:03 | justin_smith | bind C-x C-f to ido-find-file (I think you can do that via the custom buffer for ido) |
| 14:05 | dsabanin | justin_smith checking, thanks |
| 14:08 | rabidsnail | Can you write methods in java that expect clojure functions on primitives? It looks like the requisite interfaces (O, D, L, OD, OL, …) aren't accessible from java code outside of that file? |
| 14:08 | gfredericks | they aren't? |
| 14:08 | rabidsnail | they're nested inside IFn |
| 14:09 | gfredericks | they're public though |
| 14:09 | gfredericks | does clojure.lang.IFn.L compile in java? |
| 14:10 | gfredericks | I don't really know anything about nested interfaces but it would be weird if you couldn't get at it |
| 14:10 | rabidsnail | clojure.lang.IFn.L raises ClassNotFoundException in the repl |
| 14:11 | rabidsnail | so does clojure.lang.L |
| 14:11 | gfredericks | yeah the clojure repl is different |
| 14:11 | gfredericks | the clj syntax for an inner class is clojure.lang.IFn$D |
| 14:11 | gfredericks | which works for me in the repl |
| 14:11 | rabidsnail | ok, cool |
| 14:12 | rabidsnail | so if I `import clojure.lang.IFn.*;` in java I should be able to reference L as an interface? |
| 14:12 | gfredericks | hopefully |
| 14:12 | rabidsnail | :) |
| 14:12 | gfredericks | maybe would have to do clojure.lang.IFn; and then IFn.L |
| 14:13 | gfredericks | just let eclipse type it for you :P |
| 14:13 | rabidsnail | I'm not installing eclipse :P |
| 14:13 | rabidsnail | I'm only writing this one class in java |
| 14:23 | gfredericks | aw man I just spent a half hour trying to figure out why with-redefs didn't work |
| 14:24 | gfredericks | I had (defn foo ...) and (def bar (partial foo ...)) and redef'd foo and wondered why bar called the old code :( |
| 14:25 | gfredericks | dynamic runtimes are tricksy |
| 14:25 | bbloom | gfredericks: yup. use #'foo if you want that. or, better yet, avoid partial & comp for top level defns |
| 14:26 | gfredericks | bbloom: this makes me want even more a defn-partial that fixes this _and_ puts good metadata on the var |
| 14:26 | gfredericks | could have a little lib of related macros |
| 14:27 | gfredericks | would that be totally terrible? |
| 14:27 | gfredericks | seems lame to not be able to do functional programming |
| 14:28 | technomancy | gfredericks: ML has this problem for all top-level definitions |
| 14:28 | technomancy | though I suppose if everything works like that you're less likely to let your guard down |
| 14:28 | bbloom | eh, if you're making a public function, you're gonna want a doc string & sensible metadata for arguments and things. if you use partial, you get a variadic function instead of real arglists. without runtime metadata for signatures, you can't sensibly create doc strings |
| 14:29 | gfredericks | bbloom: this is the stuff my hypothetical lib would address |
| 14:29 | gfredericks | the semantics of HOFs with the benefits of defn |
| 14:29 | technomancy | yeah, partial blowing away arglists is a huge drag =\ |
| 14:29 | technomancy | not a fan |
| 14:29 | bbloom | you'd have to redef partial, etc |
| 14:29 | bbloom | b/c partial occurs at runtime |
| 14:29 | technomancy | bbloom: more than that; you'd need to move metadata from vars to functions themselves |
| 14:30 | bbloom | yeah |
| 14:30 | technomancy | which would be *awesome* |
| 14:30 | gfredericks | bbloom: I'm suggesting defn macros for this. defn-partial, defn-comp, and whatever else makes sense |
| 14:30 | bbloom | technomancy: and expensive |
| 14:30 | technomancy | bbloom: can't be bothered to care =P |
| 14:30 | bbloom | personally, i don't like any runtime code at the top level of my namespaces. i think it's a misfeature necessary for form-at-a-time evals |
| 14:30 | bbloom | it twarts static analysis |
| 14:30 | bbloom | thwarts* |
| 14:31 | gfredericks | is this an objection to my idea? |
| 14:31 | bbloom | so if you want to do it w/ a macro & look at the var metadata, sure |
| 14:31 | technomancy | gfredericks: your idea is too good for clojure in its present state |
| 14:31 | gfredericks | o_O? |
| 14:31 | clojurebot | reverse psychology is even less rigorous than forward psychology |
| 14:32 | technomancy | gfredericks: clojure throws away too much fn-level metadata for it to be practical IMO |
| 14:32 | gfredericks | technomancy: if it's a macro you can get at the underlying var |
| 14:32 | technomancy | oh, yeah I see |
| 14:33 | bbloom | seems like a lot of work b/c you're too lazy to write a function signature out for a public API :-) |
| 14:33 | technomancy | I'm just talking about partial behaving sensibly modulo reloading |
| 14:33 | technomancy | which is different |
| 14:33 | bbloom | i appreciate the whole DRY thing as much as anyone, but macroizing every little redundant thing ever seems like overkill |
| 14:33 | gfredericks | bbloom: yes, doing anything too much is too much |
| 14:34 | technomancy | I agree in that you should probably just get in the habit of adding #' yourself |
| 14:34 | technomancy | just like with defmulti dispatch functions |
| 14:34 | gfredericks | I feel icky when my app code has something that's only useful for interactive dev or testing |
| 14:34 | bbloom | technomancy: which dnolen won't let me add to cljs :-P |
| 14:34 | technomancy | bbloom: I don't think I want to know |
| 14:34 | tomjack | bbloom: nice |
| 14:34 | tomjack | bbloom: alt doesn't work yet with async so it's hopeless for cljs for now I guess |
| 14:35 | technomancy | vars are my favourite part of clojure; programming in a variant that lacks them doesn't sound much fun |
| 14:35 | gfredericks | bbloom: let's make a slow fork of cljs |
| 14:35 | gfredericks | it'll have numbers and vars and namespaces and... |
| 14:35 | bbloom | gfredericks: ignoring full reified vars, i just wanted #' to produce an object that implements IDeref for interactive development purposes |
| 14:35 | bbloom | and IFn |
| 14:36 | gfredericks | that doesn't sound like it would hurt perf when you're not using it |
| 14:36 | bbloom | gfredericks: that would still be fast b/c you'd only pay for the indirection if you explicitly wrote #' |
| 14:36 | tomjack | bbloom: oh and the <! hidden in fake-search won't get async'd :( |
| 14:36 | bbloom | tomjack: yeah, it will block :-/ |
| 14:36 | bbloom | doesn't seem quite ready for prime time yet |
| 14:36 | tomjack | nope. even if it were a macro or inline fn, the dispatch is on '<! not `<! for ssa |
| 14:37 | tomjack | I hope this causes rich to improve macros, but am not hopeful.. |
| 14:38 | gfredericks | how ofter do lein releases get minted? |
| 14:38 | gfredericks | often* |
| 14:38 | tomjack | https://github.com/technomancy/leiningen/tags |
| 14:39 | gfredericks | what's the opposite of a power user? that's what I am with github |
| 14:39 | technomancy | gfredericks: shooting for next week |
| 14:39 | gfredericks | technomancy: w00t |
| 14:40 | gfredericks | technomancy: colin and hyPiRion and I did a design thing last night and decided it was cleaner to keep the :main support of java classes and just get better errors |
| 14:41 | technomancy | gfredericks: yeah, it's something we can delete in 3.0 |
| 14:48 | technomancy | muhoo: speaking of jazz game soundtracks: http://www.gamemusicbundle.com/ <- jazz jackrabbit 1 & 2 =) |
| 14:50 | tomjack | anyone interested in remote pairing, there's a meetup for that in #pairprogrammers at 7pm PDT today http://www.meetup.com/remotepairprogrammers/ |
| 14:51 | muhoo | technomancy: nice. woudln't really call it jazz tho. more like 90's synth music |
| 14:51 | technomancy | muhoo: but it has jazz in the name! |
| 14:51 | technomancy | (I haven't downloaded it yet) =) |
| 14:51 | muhoo | i'm listening to their in-browser player. it's taking me back to korg M1's and alesis HR16's |
| 14:52 | clgv | jazz jackrabbit was awesome |
| 14:55 | muhoo | see, i'm not a gamer, i'm a musician. when it comes to coding music, i'm rather more partial to stuff like http://www.youtube.com/watch?v=30Acy8Z9jkw . or 90's acid-jazz of the soma.fm "groove salad" variety. |
| 14:57 | devn | speaking of game soundtracks |
| 14:57 | devn | i have some hot fire to share with you... |
| 14:58 | muhoo | http://somafm.com/play/groovesalad <-- was my coding music staple for a long time |
| 15:00 | devn | http://www.youtube.com/watch?v=k-pG8Hq6T6c |
| 15:00 | devn | ive got a beter one that i need to share with you |
| 15:01 | devn | it's the craziest, most jazz-fusion game soundtrack ive ever heard |
| 15:01 | technomancy | I actually don't play games much either; I just find music that works well for games works well for hacking. |
| 15:02 | devn | i dont game at all |
| 15:04 | devn | Bah! "The YouTube account associated with this video has been terminated due to multiple third-party notifications of copyright infringement" |
| 15:04 | devn | so sad. |
| 15:05 | devn | Ha! Found it. This is pretty amazing chiptune music: http://www.youtube.com/watch?v=D_QXD8tjjpw&list=PL758041D2D82928C7&index=2 |
| 15:06 | TimMc | For jazz-ish stuff to listen to while programming, I use http://www.jamendo.com/en/list/a2225/increase-the-dosage ; for electronic/chiptune, I go to http://binaerpilot.no/ |
| 15:06 | TimMc | (free downloads!) |
| 15:07 | devn | TimMc: Check this out: http://ubiktune.com/ |
| 15:07 | devn | this album in particular is rad: http://ubiktune.com/releases/ubi045-joshua-morse-waveform-3 -- listen to Turtle Dance 2 or C.S. Bossa |
| 15:08 | TimMc | Thanks, I'll check it out! |
| 15:08 | TimMc | I need some hard-driving music today: I'm writing JMock tests. :-/ |
| 15:08 | technomancy | the zeta force album from the ubiktune bundle was pretty great |
| 15:09 | devn | technomancy: ha, I thought my interest in chiptunes was some kind of weird thing that other people wouldn't relate to or know about. |
| 15:10 | technomancy | this is my personal favourite though: http://ubiktune.com/releases/ubi028-big-giant-circles-impostor-nostalgia |
| 15:10 | devn | Cool! I haven't heard this one. Thanks technomancy. |
| 15:11 | technomancy | =) |
| 15:11 | devn | technomancy: i lost my irc buffer recently. RE: clucy and the bug you said you had fixed... Any word on that? |
| 15:12 | technomancy | I will have to copy these links somewhere; my new music ingestion queue depth is already dangerously high with the retro bundle that was released today |
| 15:12 | technomancy | devn: I had it in a stash, and the upgrade to lucene 4 which just happened broke it |
| 15:13 | technomancy | it wasn't a bug fix, just added the ability to set a custom analyzer on a per-field basis |
| 15:13 | devn | I think my situation may have been different looking back -- I was trying to use the query-string parser and allow people to type in things like ->>, \, /, +, -, etc. and finally realized I should just quit messing with it and opted to use terms queries instead |
| 15:13 | devn | technomancy: gotcha |
| 15:14 | devn | technomancy: /go clojurebot |
| 15:14 | devn | whoops |
| 15:15 | technomancy | devn: I can gist the stash if you want to have a go at it, but I don't think I have the bandwidth to merge it right now |
| 15:15 | devn | technomancy: i'd be down to take a peek |
| 15:15 | technomancy | actually I should put it on a branch |
| 15:15 | devn | technomancy: I'd be very open to suggestions on getting the best results out of the data I have: https://github.com/devn/getclojure/blob/master/src/getclojure/search.clj |
| 15:16 | technomancy | hm; actually I didn't get that far |
| 15:16 | devn | I was messing with a dis-max query last night that included some fuzzy-like-this-field and more-like-this-field stuff, but I'm not much of a search expert. |
| 15:17 | devn | I should probably quit reading elasticsearch docs (pretty sparse) and just go dig into clucy/lucene |
| 15:17 | technomancy | looks like this is just for providing a custom analyzer at query time, which might be what you want? |
| 15:17 | devn | elastisch's docs are better than the elasticsearch guide |
| 15:17 | technomancy | raw lucene is great for corpuses which will never outgrow a single node |
| 15:17 | technomancy | devn: https://github.com/weavejester/clucy/tree/analyzers |
| 15:18 | antares_ | devn: thanks! |
| 15:18 | devn | technomancy: that may actually have been my issue! i tried permutations until something worked. I was trying to set :analyzer "my_analyzer" on query-string and was getting errors |
| 15:18 | devn | antares_: for what? |
| 15:19 | technomancy | devn: cool. maybe you could get it merged with master =) |
| 15:19 | devn | technomancy: maybe! :) I'm not exactly "free" much lately either. :\ |
| 15:20 | antares_ | devn: for the compliment about Elastisch's docs? |
| 15:20 | devn | oh, hey. I didn't know was you. Yeah, those docs are legit. I think I'll submit a PR to show some more examples of building up queries and using custom analyzers |
| 15:21 | devn | antares_: it took me awhile to figure out: "oh, right... I can do (q/filtered :query (q/dis-max :queries [...]))" or whatever |
| 15:24 | antares_ | devn: yeah, using s-expressions for nested data structures is so unusual ;) |
| 15:24 | devn | antares_: one other thing I was thinking: a lot of the analyzers, filters, etc. take [& {:as options}] -- It would be wildly handy to enumerate the list of options in the docstring or merge the users' options with defaults |
| 15:24 | antares_ | devn: it would be nice but there are so many of them and ES constantly adds new ones |
| 15:24 | antares_ | so it's a massive undertaking |
| 15:24 | devn | antares_: yeah, i figured that was the case |
| 15:25 | devn | they need a way to query for what options a damned filter, tokenizer, etc. can take and what the default values are |
| 15:25 | antares_ | we can hopefully document most |
| 15:26 | devn | antares_: im guessing it's just a lot of "make-work" to look at the elastic source and type them out. I'd be happy to help, just show me how you want them done and I'll work on it. |
| 15:26 | devn | (as in, should they be in the source and merged with the user's options, or should they be in the docstring, or both?) |
| 15:27 | antares_ | devn: I think we have some options in docstrings? If not, Langohr and Monger have examples |
| 15:27 | devn | cool. |
| 15:27 | antares_ | devn: you can pretty easily decipher it from ES's *Request and *Response classes, they follow a strict structure |
| 15:27 | antares_ | I think any option that will have effect should be documented |
| 15:28 | antares_ | but, of course, index or document-specific ones should be explained in general |
| 15:28 | antares_ | like, "pass a document property name here" |
| 15:28 | devn | antares_: some of the elasticsearch guide is like: "WAT?" -- "This token filter handles most of the options as token filter XYZ, except some are different. It also has some extra options, but this isn't the complete list..." |
| 15:28 | n_b | Were resource scopes as discussed here: http://dev.clojure.org/display/design/Resource+Scopes ever implemented in any form? |
| 15:29 | antares_ | devn: they are written by people who know how Lucene works for people who know how to use Lucene :) |
| 15:29 | amalloy | n_b: no |
| 15:29 | antares_ | devn: the ES team is very much aware of that, they are working on the docs |
| 15:30 | devn | antares_: I would be completely comfortable with links to Lucene docs or source or something. They just sort of gloss over it. Their guide is certainly better than SOLR's, so they're on the right track! |
| 15:30 | n_b | amalloy: Thank you |
| 15:30 | antares_ | devn: Lucene docs is a whole other can of worms |
| 15:30 | devn | :X |
| 15:30 | n_b | wasn't sure if they might have been in a core.* something |
| 15:31 | devn | antares_: haha oh my god. I hadn't even peeked at their docs. This is unbelievably daunting. |
| 15:32 | devn | http://lucene.apache.org/core/4_3_0/core/index.html -- *brain explodes when looking at the left pane* |
| 15:32 | technomancy | lol frames |
| 15:32 | antares_ | devn: well, it's a little bit more powerful than a K/V store ;) |
| 15:33 | devn | antares_: oh i know, that's totally fair, it's just like... whoa. I had no idea it was *that* big. |
| 15:34 | antares_ | devn: Elastisch docs took over 2 months to write, a couple of hours every evening. Part of that was spent on testing examples and re-reading Lucene in Action, though. |
| 15:34 | antares_ | devn: and there are holes in the docs, I was too bored to document yet another damn rarely used query type or filter |
| 15:34 | technomancy | Lucene in Action is pretty good |
| 15:34 | bbloom | devn: i used https://github.com/sunspot/sunspot for a rails app w/ active record & it was reasonably pleasant in taht horrifying active record does too much magic sort of way |
| 15:35 | antares_ | technomancy: yeah, it's the best material on the subject, I'd say |
| 15:37 | devn | bbloom: ewwww! no sunspot for me! I chose to just use RSolr and manage my own solrconfig.xml, schema.xml, and add a hook or 3 for :after_save, :before_destroy, etc. and then implement to_solr on the model |
| 15:38 | devn | bbloom: to_solr is basically just a giant map: {'id' => id, 'solr_field_name' => some_method_or_val} |
| 15:39 | devn | antares_: i dont blame you. there's a ton to document. |
| 15:40 | antares_ | devn: but now Elastisch runs a huge (one of the two largest) online newspapers so it was worth it :) |
| 15:40 | nathanielk | as a very new clojure developer clojuredocs.org is helpful and comes up high in google; but it appears to stop at clojure 1.3. is there a similar resource i should use if i'm working in 1.5? |
| 15:40 | antares_ | well, parts of teh, more to come |
| 15:40 | devn | antares_: it also seems like it shouldn't be necessary to do that assuming elasticsearch updates their guide -- most of those functions just have a body of {:dis_max options} or whatever |
| 15:41 | antares_ | nathanielk: no. Unfortunately, the new clojuredocs hasn't had much progress lately. It needs a complete rewrite to not be locked to a particular version. |
| 15:41 | antares_ | nathanielk: there are http://clojure-doc.org and http://getclojure.org |
| 15:42 | antares_ | devn: if you have a description for getclojure.org, we should probably link to it from clojure-doc.org |
| 15:42 | devn | nathanielk: i slurped a bunch of examples from clojuredocs on getclojure -- I'm planning to add ratings so we can get idiomatic examples moved to the top |
| 15:43 | devn | NOM |
| 15:45 | amalloy | devn: you were working on the data-collection for that like a year ago, right? i'm impressed you got it to work; could be a useful resource once you get sorting...sorted out |
| 15:45 | devn | antares_: I'm not really sure what to say other than: It has lots of examples, some idiomatic, some not. You can see the input, value, and output from an expression. If you're curious how other people have used function x in the past, you can look at getclojure.org and see. |
| 15:45 | devn | amalloy: this is like the first project I ever started in Clojure. I started this in like 2009 and just kept rewriting it as more libraries and what-not became available. |
| 15:46 | devn | amalloy: Patches and contributions are very much welcome. |
| 15:47 | devn | (not saying that in a snarky way at all) I could use some fresh eyes on a lot of it. |
| 15:47 | nathanielk | devn: antares_ cool, thanks for the information. |
| 15:47 | devn | nathanielk: np |
| 15:47 | akhudek | in java, instance fields are public by default, no? |
| 15:48 | amalloy | akhudek: no |
| 15:48 | amalloy | they're package-private, which is a basically useless designation |
| 15:48 | akhudek | oooohh, that explains it |
| 15:51 | bmentges | whats the best way to learn clojure in your opinion ? besides the docs, are there any good references that introduces clojure to java/python programmers in a more quick fashion ? |
| 15:52 | amalloy | quick, someone recommend 4clojure.com so it doesn't look like i'm tooting my own horn |
| 15:52 | justin_s` | bmentges: I think the clojure koans are OK https://github.com/functional-koans/clojure-koans |
| 15:52 | bmentges | justin_s`: oh ive heard of koans and used it to learn ruby a while ago... thanks |
| 15:52 | Raynes | I hear if you drink the blood of a Rich Hickey that you instantly become a Clojure expert. |
| 15:52 | bmentges | amalloy: thanks :) |
| 15:53 | jcrossley3 | bmentges: +1 for both. i say start here: http://clojurekoans.com/ |
| 15:53 | naeg | 2 |
| 15:53 | devn | Raynes: Then you get the mark of the beast. Hair like Rich and Ambrose. |
| 15:53 | Raynes | Ambrose has excellent hair. |
| 15:53 | bmentges | Raynes: lol Rich Hickey has some lengthy videos out there... im not a watching lectures for hours fan :P but I could give it a try |
| 15:53 | TimMc | I think you also get a restraining order. |
| 15:53 | devn | bmentges: it's worth it man. I know a lot of people who say that, but just meditate for a moment, start the video and unplug your keyboard and mouse. |
| 15:54 | devn | amalloy: Raynes: yay 4clojure! |
| 15:54 | devn | jcrossley3: I didn't even know about that! |
| 15:54 | devn | jcrossley3: radical. |
| 15:54 | Raynes | Man, I always feel like devn is chewing on acid when he says things like that. |
| 15:54 | bmentges | devn: well, I will then. :) thanks |
| 15:54 | TimMc | devn: By the way, I don't like all of Binärpilot's music; some of it is a bit too glitchy. Nordland is a very nice middle-of-the-road album. |
| 15:54 | devn | maybe I am... @_@ |
| 15:55 | nathanielk | the koans were helpful |
| 15:56 | devn | Raynes: i want to be like this guy: http://www.youtube.com/watch?v=LhiIezSVJAY |
| 15:57 | Raynes | devn: Heh, saw him on Tosh.0 recently. |
| 15:58 | devn | he has a ton of videos, and he's not kidding around about it. i can't watch it and not crack a smile. |
| 15:59 | devn | also, Raynes: http://www.youtube.com/watch?v=QvAkyoA7l4U |
| 15:59 | devn | important stuff. |
| 15:59 | Raynes | I revel in his surfer dude accent. |
| 16:01 | Raynes | devn: http://www.youtube.com/watch?v=VLTkD8WI8VU |
| 16:01 | Raynes | <3 California |
| 16:02 | jcrossley3 | bmentges: look at 4clojure *after* you've completed the koans. the trick to getting the most out of 4clojure imho is following experienced folks (eg amalloy) so you can compare your answers to theirs. |
| 16:02 | bmentges | cool |
| 16:02 | bmentges | thanks jcrossley3 for the tips |
| 16:03 | djwonk | i'm deploying to clojars for the first time. running `lein deploy clojars`. not sure why I'm getting asked for "You need a passphrase to unlock the secret key for ..." |
| 16:03 | Raynes | devn: I used to watch this in Alabama and think that the running street/highway joke was silly, but people really seem to do that here. I've seen 10 minute long discussions about which routes to take to and from work. |
| 16:14 | tcrawley | djwonk: lein is trying to gpg sign your artifacts using your default gpg key |
| 16:14 | djwonk | tcrawley: ok, i deployed a snapshot version for now -- when ready I'll do the GPG stuff |
| 16:15 | tcrawley | djwonk: see https://github.com/technomancy/leiningen/blob/master/doc/GPG.md |
| 16:15 | djwonk | I'm figuring out why Clojars is yelling at me for whatever I did wrong in my project :) |
| 16:18 | TimMc | bmentges: By the way, some of the people on 4clojure are code-golfing; not all of the solutions you see are good coding style. |
| 16:18 | TimMc | ...but they should at least be interesting. :-) |
| 16:20 | djwonk | tcrawley: thanks. is there a way to find who has signed my key? I asked a few people at ClojureConj last year. |
| 16:20 | bmentges | TimMc: yeah, good warning, do you know someone that consistently writes good coding style in the solutions ? |
| 16:20 | bmentges | just to keep an eye and compare :) |
| 16:20 | djwonk | i recommend the swearjure fork of clojure koans :P |
| 16:21 | tcrawley | bmentges: sure, search for it at pgp.mit.edu, then click through via the email address in the search results |
| 16:22 | bmentges | tcrawley: oops I guess that answer wasnt supposed to be for me lol |
| 16:22 | tcrawley | bmentges: oops. sorry |
| 16:22 | tcrawley | djwonk: ^ |
| 16:22 | djwonk | tcrawley: got it :) |
| 16:22 | bmentges | :) |
| 16:23 | bmentges | thanks for all the support... now im going to work hard here and watch 1:48:00 of rich hickey talking "clojure for java programmers - part 1" :) |
| 16:23 | djwonk | tcrawley: no signers yet. I'll find some people here in DC next time |
| 16:33 | jweiss | apparently this is bad. (let [[a b] (infinite-seq-fn)] ... ) i'm not sure what destructuring does internally but apparently that will consume the whole seq? |
| 16:34 | jweiss | ,(let [[a b] (iterate inc 1)] a) |
| 16:34 | clojurebot | 1 |
| 16:35 | jweiss | hm, that simple example works but my code which does something similar goes OOM |
| 16:35 | gfredericks | jweiss: destructuring shouldn't be the issue. some other subtle sort of head-holding maybe? |
| 16:35 | gfredericks | is there an explicit or implicit closure that has the seq in lexical scope? |
| 16:36 | jweiss | gfredericks: yeah, i am doing tracing |
| 16:36 | jweiss | but i have some code in there to avoid consuming more of the seq than is already realized, when printing out seqs in the trace |
| 16:37 | jweiss | i guess that does not work in this case. |
| 16:37 | gfredericks | a function can hold on to the head when you wouldn't naively expect it |
| 16:37 | jweiss | not sure why. |
| 16:37 | gfredericks | I'd have to look at your code to say for sure if that's relevant |
| 16:40 | jweiss | gfredericks: why would head-holding matter? something has to be consuming more of the seq besides just the first two items in the destructure. |
| 16:40 | jweiss | i would think it must be some failure in my trace code, that is supposed to avoid printing more of the seq than has already been realized (which in this case should be 2 items) |
| 16:42 | jweiss | the relevant code: https://www.refheap.com/paste/14931 |
| 16:50 | mefesto | hey all |
| 16:51 | darrickw | jweiss: would it help if you moved the lazy-seq up over the let in take-while-realized? |
| 16:51 | mefesto | thinking about using enlive templates for a web project in an attempt to maintain a nice separation between designers and developers. has anyone applied enlive for this reason and can speak to their experience doing so? |
| 16:52 | mefesto | i've been enjoying hiccup but it's painful to have to re-translate things that designers come up with into the html. so im hoping enlive will help alleviate some of that pain |
| 16:55 | jweiss | darrickw: looking closer at the trace, i don't think that is the problem, i think gfredericks is right, but i'm not sure. what i see in the trace is, as expected, the first two items are taken in the let. more trace, moving into the let body, calling functions there. then later on i see the trace where a huge number of new items are taken. but i have no idea how that can happen, nothing is referring to the head. |
| 16:55 | jweiss | nothing is referring to the original seq at all. |
| 16:56 | jweiss | i mean, if i have (let [[a b] (iterate inc 1)] ... ) there can't be anything inside that let that refers to the head, can there? |
| 16:57 | robink | Quick question: What's the fastest way to turn [[:keyword "val" 123 456] [:anotherkeyword "Some" "more" "vals" 789] [:lastkeyword "Only" "one level" "of nesting"]] into {:akeyword "[val" 123 456] :anotherkeyword ["Some" "more" "vals" 789] :lastkeyword ["Only" "one level" "of nesting"]}? |
| 16:57 | robink | I'm still playing with hiccup-style collections |
| 16:58 | gfredericks | jweiss: you get the OOM when you're not tracing as well? |
| 16:58 | robink | Only this time, rather than using nested fors that do a fixed level of recursion, I'm using the tools given by the API that'll transform a given vector (they all start with keywords) into whatever at any level of depth. |
| 16:58 | jweiss | gfredericks: uh, i am not sure, i haven't tried it |
| 16:58 | jweiss | can try now |
| 16:59 | robink | also s/\{\:akeyword\ \"\[/\{\:akeyword\ \[\"/ |
| 17:00 | darrickw | robink: I think this might do it (->> data (map (fn [a & b] [a b])) (into {})) |
| 17:00 | gfredericks | jweiss: it doesn't look suspicious to me |
| 17:00 | robink | darrickw: I'll try it |
| 17:00 | gfredericks | darrickw: robink: that function can also be (juxt first rest) |
| 17:00 | amalloy | darrickw: yeah, although (fn [a & b] [a b]) is (juxt first rest) |
| 17:01 | amalloy | fwiw i wouldn't use ->> there. it obscures the "main point", which is to make the thing into a map, by putting it at the end |
| 17:01 | gfredericks | "The savages from the amalloy tribe ran down the hill with their swords drawn, screaming of juxt..." |
| 17:02 | darrickw | Oh you're right, it's one char shorter! |
| 17:07 | hyPiRion | ,(reduce (fn [a [k & v]] (assoc a k v)) {} [[:a "hey"] [:b "yo"]]) |
| 17:07 | clojurebot | {:b ("yo"), :a ("hey")} |
| 17:08 | frozenlock | I've made a script to run a clojure program at startup. Contrary to when I run it by hand, it seems the program can't fetch some data from the net (via https). Is there some kind of root commnand I need to run before running the clojure program on startup? |
| 17:10 | frozenlock | I also tried to run it from the NetworkManager (on new connection), and from the startup file. Both fail :( |
| 17:10 | frozenlock | Oh btw, I'm on lubuntu |
| 17:13 | rgrinberg | anyone has experience with clojure on gae? |
| 17:15 | akurilin | Shameless newb question: I like the ruby/irb model of being able to require whatever gem I like that's been already downloaded onto the system. I'm trying to figure out if there is such an option with clojure, or if I don't have much of an alternative to creating lein projects with the right dependencies to place the right libraries on the classpath. |
| 17:15 | scottj | rgrinberg: there was a blog a year or two ago about a task program hosted on gae in clojure |
| 17:15 | scottj | rgrinberg: some assitant style program maybe by a german company. |
| 17:16 | technomancy | akurilin: you can use pomegranate to load code as you go for experimental coding. it's not a good fit outside exploratory exercises though. |
| 17:16 | robink | Last question (gfredericks, amalloy, your variant of darrickw's suggestion works best): If (rest coll) returns a single value, what's the best way to unwrap it from a list? '(1 2 3) or [1 2 3] is fine, '(123) or [123] is less ideal. |
| 17:17 | rgrinberg | scottj: i'll try and look it up |
| 17:17 | gfredericks | robink: conditionally unwrap you mean? |
| 17:17 | robink | gfredericks: Right, I want to transform '(1 2 3 '(4 5 6) '(7)) into '(1 2 3 '(4 5 6) 7). |
| 17:18 | akurilin | akurilin, part would be exploratory repl usage, and the other would be perhaps along the lines of scripting. Is scripting really forcing clojure to do what it's not well suited for? |
| 17:18 | gfredericks | (fn [[a & b]] [a (if (= 1 (count b)) (first b) b)]) for the first/rest example before |
| 17:18 | robink | gfredericks: Gotcha |
| 17:18 | akurilin | Oops, redirected that to myself. |
| 17:18 | robink | gfredericks: I assumed there was a clever way to conditionally unwrap, but I guess doing it explicitly is fine too. |
| 17:18 | akurilin | technomancy, part would be exploratory repl usage, and the other would be perhaps along the lines of scripting. Is scripting really forcing clojure to do what it's not well suited for? |
| 17:19 | amalloy | gfredericks: count isn't going to work well if the value for a key is (range) :P |
| 17:20 | amalloy | (defn length-one? [coll] (and (seq coll) (not (next coll)))) would be a more robust approach |
| 17:21 | scottj | akurilin: cljr was kind of like what you're looking for. (it appears abandoned though) |
| 17:21 | jweiss | gfredericks: i do get the OOM even without tracing |
| 17:22 | technomancy | akurilin: I don't know what "scripting" means |
| 17:22 | gfredericks | robink: it's subject to the same criticism as flatten |
| 17:22 | gfredericks | ~flatten |
| 17:22 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 17:22 | gfredericks | somewhat |
| 17:22 | gfredericks | duck-unwrapping :) |
| 17:23 | jweiss | although oddly even without trace, the OOM occurs in clojure.core/print-map. i'll have to figure out what is calling that. |
| 17:23 | akurilin | technomancy, something along the lines of "hey clojure take this random clj file that might have requirements beyond the standard library and run it without any sort of previous setup". I guess it sounds like pomegranate would handle that situation. |
| 17:24 | technomancy | akurilin: usually you would generate standalone uberjars for that |
| 17:25 | akurilin | scottj, I remember hearing Stuart Halloway mention that clojurescript might do that at some point soon, following the model of nodejs |
| 17:25 | hiredman | https://gist.github.com/hiredman/5033484 |
| 17:26 | hiredman | standalone clojure with shebang and pommy |
| 17:26 | robink | gfredericks: No worries, I'm still fairly confident that the collection I'm operating on has a fixed level of depth, and well-known types. |
| 17:29 | akurilin | hiredman, what does the shell command to run that look like? |
| 17:29 | hiredman | ./decay-db-dump.clj |
| 17:29 | hiredman | dumps |
| 17:30 | akurilin | Oh awesome, that's pretty fantastic. |
| 17:30 | akurilin | I guess the only downside is the scary boilerplate header. |
| 17:30 | hiredman | I run it on as schedule as one of those launchd job things |
| 17:30 | akurilin | But what you gonna do :) |
| 17:35 | robink | Trying to figure out how to shoehorn an if statement with conditional return values into #(juxt first rest) %1) |
| 17:35 | akurilin | Ok another terrible question: say I'm running an app with lein ring server and I have a bunch of defs in the code. I read that defs are per-thread. Does that mean that the def is executed every time a new thread is spawned, or do all threads share the same ones through immutability until over overwrites it? |
| 17:35 | hiredman | def is not per thread |
| 17:36 | hiredman | don't re-def things |
| 17:37 | technomancy | deref, don't redef |
| 17:37 | technomancy | (should have done that as tired/wired; joke ruined) |
| 17:37 | akurilin | :) |
| 17:38 | amalloy | technomancy: tired/wired? i don't even get the implied replacement joke |
| 17:38 | akurilin | Well I haven't run into a case where I need a thread-specific var value yet, so it's good to know that it's just one single value. |
| 17:40 | technomancy | amalloy: wired magazine sidebar thingy where they list things they think are hot and things that are lame |
| 17:40 | amalloy | ah |
| 17:40 | akurilin | On a different note, is there a true and tried approach for making lein ring apps init.d-friendly? |
| 17:41 | hiredman | servlets |
| 17:41 | hiredman | tomcat or jetty as a init.d service, your ring app as ware file |
| 17:41 | hiredman | war |
| 17:41 | hiredman | .win 5 |
| 17:42 | technomancy | akurilin: clojars uses upstart with a ring-jetty-adapter uberjar |
| 17:42 | technomancy | https://github.com/ato/clojars-web/blob/master/SYSADMIN.md |
| 17:44 | akurilin | Ok cool, thanks you two. Options are good. I guess I should at least look into upstart, haven't spent much time with it. |
| 17:44 | technomancy | complex deployments might outgrow upstart, but it's a simple way to get started |
| 17:45 | llasram | I'll +1 technomancy's solution, but s/upstart/runit/ |
| 17:46 | llasram | upstart is pretty straightforward bad, but you pretty much can't get any simpler than runit |
| 17:47 | technomancy | I've heard good things about runit |
| 17:47 | llasram | er, s,bad,, in above (started to say "not bad") |
| 17:47 | akurilin | What's the reason for people to switch off of init.d generally speaking? Is it just the pain of writing init scripts for it? |
| 17:47 | technomancy | the only problem I've had with upstart is that restarting a job doesn't allow config changes to be applied |
| 17:48 | technomancy | you have to explicitly stop and then start |
| 17:48 | technomancy | the idea that restart is different from stop+start is really stupid |
| 17:48 | llasram | `runit` scripts are pretty much literally the simplest things you can have -- just exec whatever process you want to be the service. And the runit service monitor will automatically restart services if they exit |
| 17:49 | llasram | It's about as Unix-y as you can get |
| 17:49 | lynaghk | llasram: if you want Unix-y, look at daemontools |
| 17:49 | technomancy | isn't it a djcb classic or something? |
| 17:50 | llasram | Yeah, runit is basically a re-impl of the ideas daemontools which plays slightly nicer with the FHS etc |
| 17:50 | lynaghk | llasram: ah, I hadn't seen it. I was reading the documentation on launchd this past weekend, and that looks very good to me |
| 17:50 | lynaghk | though I have no experience using it outside of OS X |
| 17:51 | technomancy | djb I mean |
| 17:51 | lynaghk | technomancy: yep. |
| 17:52 | llasram | I haven't looked into launchd yet... Probably about time to do another sweep of reviewing all the init system out there again |
| 17:53 | lynaghk | llasram: I revisited launchd after reading this blog post about systemd: http://0pointer.de/blog/projects/systemd.html unfortunately the author never clearly explains why he didn't think launchd was good enough, so I'm not sure what the particular differences are between those two. |
| 17:53 | technomancy | systemd is bonkers |
| 17:53 | technomancy | just completely nuts |
| 17:53 | lynaghk | technomancy: yeah? what about it? |
| 17:53 | technomancy | lynaghk: it logs in a binary format |
| 17:53 | llasram | huh |
| 17:54 | technomancy | kinda feel like it's an exercise in lennart showing everyone how clever he is |
| 17:54 | justin_smith | as a linux user, one of the weirder aspects of learning to use osx for work was the whole binary systemd format thing |
| 17:54 | lynaghk | technomancy: I'm not surprised about that, after reading that post. |
| 17:55 | justin_smith | never mind, I was thinking of some other thing |
| 17:55 | technomancy | lynaghk: he is a clever person, admittedly |
| 17:55 | lynaghk | technomancy: ohh, there's even a line in the FAQ: "If you love launchdo so much, why not adopt that?" "launchd is a great invention but I am not convinced it would fit well into Linux..." |
| 17:56 | technomancy | but he's also the guy behind pulseaudio |
| 17:56 | justin_smith | lennart will never be forgiven for pulseaudio |
| 17:56 | justin_smith | fucking mess |
| 17:57 | lynaghk | Speaking of DJB, I have been spending a bit of time desgining a redo-like build tool, and one of my design goals is that I think process execution should be a valid target, just like building a file. |
| 17:57 | lynaghk | but I'm wary about reinventing the init.d/launchd/systemd/upstart wheel yet again (and in userspace) |
| 17:58 | llasram | lynaghk: OOC, what's the use-case you have in mind? |
| 17:58 | justin_smith | to poetter: to recreate something that worked well enough already in an overengineered and brittle "clever" replacement |
| 17:59 | lynaghk | llasram: OOC? |
| 17:59 | llasram | Out Of Curiosity. You know, as opposed to *inside* of the Curiosity rover. Not much room |
| 17:59 | technomancy | justin_smith: the timing on that was the worst. just when alsa got to the point where it Just Worked always, that must mean it's time to throw it away and start over woooo |
| 17:59 | TimMc | clojurebot: OOC is "out of curiosity" |
| 17:59 | clojurebot | In Ordnung |
| 17:59 | TimMc | ERR_OUT_OF_CURIOSITY |
| 18:00 | llasram | nice |
| 18:01 | lynaghk | llasram: to build things, of course! =P In particular the work we do is spread across several languages and toolchains (mainly Clojure/ClojureScript with Ruby for HTML/CSS templating) and most of the tools I've seen are pretty language-specific silos. Redo has a very interesting design, but shelling out to build targets doesn't scale well with tools built in VMs with non-trivial startup times---i.e., the JVM, ruby with any gems, &c. |
| 18:02 | lynaghk | so basically I want to slice out all of the dependency tracking/management stuff into a single tool, rather than duct taping together a bunch of things that half-ass the job (e.g., "lein cljsbuild auto", "bundle exec guard", "lein midje :autotest") |
| 18:03 | justin_smith | lynaghk: so a dependency manager manager? |
| 18:03 | llasram | Ahhh, I see. Interesting... Or maybe a tool for multilingual programming? |
| 18:04 | lynaghk | it's more of a lib than a tool; I want something that solves dependency tracking in a general, pluggable way. |
| 18:04 | frozenlock | Ok so I have a little more details on my problem: when I run my clojure program at boot, (slurp "https://google.com") might return java.lang.nullpointerexception. Any ideas why? o_O |
| 18:04 | frozenlock | I don't know if it's a Clojure problem, a Java problem, or an OS problem... :( |
| 18:05 | lynaghk | llasram, justin_smith: an analogy: right now everyone is writing a half-assed implementation of gzip in their own programs because no one has written a suitable zlib. |
| 18:06 | llasram | lynaghk: I haven't used it in years, but how closely have you looked at SCons? It's about as far as you can get from the `redo` model, but has a completely flexible idea about what pretty much every step of the "build" process means |
| 18:07 | Okasu | ,(str "Guys we need dependency " (clojure.string/join " "(repeat 3 "manager")) ". ") |
| 18:07 | clojurebot | "Guys we need dependency manager manager manager. " |
| 18:07 | lynaghk | llasram: I haven't looked closely at it---most of my reading has been on Redo and Tup. Thanks for the pointer |
| 18:07 | bbloom | llasram: build systems and dependency systems are subtly different…. even though build systems (generally) require a depdency system |
| 18:08 | bbloom | and then when you get to namespaces & modules, code presents very different (and more complex) problems for dependency management than build systems |
| 18:08 | justin_smith | Okasu: but then we would also need the dependency manager manager dependency manager, for when the various dependency manager managers have conflicting dependencies |
| 18:08 | lynaghk | bbloom: what makes them fundamentally different? |
| 18:08 | bbloom | coherence. |
| 18:09 | Okasu | justin_smith: We are doomed. |
| 18:10 | bbloom | lynaghk: ok i can't find a good reference right now that isn't drowning in haskell and ocaml nonsense |
| 18:10 | bbloom | lynaghk: in short the problem is similar to that of protocols: two people can't define the same protocol for the same type |
| 18:10 | bbloom | lynaghk: the problem is similar to if you had two java apps load the same class file with a static variable in there |
| 18:11 | bbloom | do you have two static variables? how do you differentiate? what if each library depends on different versions? |
| 18:12 | lynaghk | bbloom: that would be a problem with any kind of scheme that uses fixed (rather than content-based) addresses |
| 18:12 | djwonk | lein question: can I push a new clojar if I don't change the version (currently at 0.1.0-SNAPSHOT) |
| 18:12 | lynaghk | bbloom: built artifacts at fixed places on the filesystem would have the same problem. |
| 18:12 | bbloom | lynaghk: it's worse than that. there is just no general way to resolve conflicting dependencies |
| 18:13 | lynaghk | bbloom: sure, but that's true for builds too. |
| 18:13 | technomancy | djwonk: yeah, that's fine. snapshots are designed to change. |
| 18:13 | lynaghk | ("build" being traditionally interpreted as some process that makes some artifact at a place on the filesystem) |
| 18:13 | frozenlock | &(take 2 (slurp "https://google.com")) |
| 18:13 | lazybot | java.security.AccessControlException: access denied (java.net.SocketPermission google.com:443 connect,resolve) |
| 18:13 | djwonk | technomancy: should I expect clojars to pick up the change pretty quickly? |
| 18:13 | bbloom | lynaghk: transient dependencies are just a fundamentally complex problem & there isn't an obvious solution, so each language community comes up with their own half-assed solution sorta out of necessity |
| 18:14 | technomancy | bbloom: not without manual input as to where the right boundaries for isolation are anyway |
| 18:14 | lynaghk | bbloom: ah, I see what you're getting at. Yeah, really it's a problem for everyone except people using Nix. |
| 18:14 | lynaghk | bbloom: that is another avenue I'd like to explore, but I gotta take it one thing at a time =) |
| 18:15 | technomancy | djwonk: clojars will serve it immediately. clients will usually cache it for 24h, but you can use `lein -U deps` to force a fetch. |
| 18:15 | bbloom | nix doesn't magically solve the problem |
| 18:15 | technomancy | djwonk: simpler to just use `lein install` and skip clojars if it's on the same machine though. |
| 18:15 | bbloom | nix is nice though |
| 18:15 | technomancy | nix has a natural unit of isolation already: the process |
| 18:15 | lynaghk | bbloom: all of the dependencies of Nix packages are content addressed; doesn't that solve the problem of transitive conflicts? |
| 18:15 | bbloom | and yes, a huuuge design improvement over most packaging systems |
| 18:15 | djwonk | technomancy: thanks. should I expect the clojars Web UI to pick up changes quickly? |
| 18:15 | lynaghk | technomancy: not Unix, NixOS. |
| 18:15 | technomancy | between processes you're only ever sharing text |
| 18:15 | technomancy | lynaghk: I know |
| 18:16 | technomancy | you don't have to worry about changing formats of data structures typically because it's a lot harder to share implementation details |
| 18:16 | djwonk | technomancy: b/c in my first deploy, I neglected to namespace the project (in defproject) |
| 18:16 | bbloom | lynaghk: no not really. it does solve other problems tho |
| 18:16 | technomancy | djwonk: there should be no delay in seeing it in the web UI |
| 18:17 | lynaghk | bbloom: we may have to Skype about this at some point, if you have time. |
| 18:17 | bbloom | lynaghk: technomancy: process isolation is helpful if your components are all communicating via pipes or sockets or whatever |
| 18:17 | lynaghk | bbloom: I can buy you all the beers when I'm in NYC in August. |
| 18:17 | bbloom | lynaghk: i had to make sense of .NET's absolutely insane class loader thinggie & how they solved this problem is kinda mind melting (and ultimately wrong) |
| 18:19 | djwonk | technomancy: ah ha! the only non-namespaced project is still around. should I use namespacing or not? I see examples of both. |
| 18:19 | djwonk | *delete 'only' |
| 18:19 | technomancy | djwonk: depends on the name you are using |
| 18:20 | technomancy | if it is a common word you should probably use a group-id |
| 18:24 | djwonk | technomancy: thanks. I don't think I need a group ID. should I clean up the other groups and names hanging around? |
| 18:25 | technomancy | djwonk: I can manually delete it if no one is using the bad name |
| 18:27 | djwonk | technomancy: ok, please remove "com.bluemontlabs/validata" |
| 18:28 | djwonk | (yes, another validation library, just what we all need) |
| 18:28 | technomancy | haha |
| 18:28 | technomancy | it's like test frameworks in ruby |
| 18:28 | djwonk | right |
| 18:28 | technomancy | poof |
| 18:28 | technomancy | gone |
| 18:29 | djwonk | they are easy enough to write and there are hundreds of ways to do it; therefore I'm surprised we have so few |
| 18:29 | djwonk | technomancy: thanks |
| 18:34 | technomancy | no problem |
| 18:38 | amalloy | djwonk: so few? i'm pretty sure i've seen like ten of them |
| 18:40 | Raynes | Tweet about downtime from the refheap twitter user that nobody knows about\n get followers\n take over the world\n ??????? \n profit! |
| 18:41 | mischov | Conds sure can get ugly... |
| 18:41 | djwonk | amalloy: out of the possible validation library universe, only about 0.1% have been implemented |
| 18:43 | djwonk | but, if anyone wants to make another, I've got a better name than validata |
| 18:43 | djwonk | vladinator |
| 18:44 | technomancy | heh |
| 18:44 | mischov | Can we skip to the point and call it Impaler? |
| 18:44 | technomancy | not bad as mascots go: https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Vlad_Tepes_002.jpg/220px-Vlad_Tepes_002.jpg |
| 18:45 | seangrove | mischov: Hrm, I think there's already vlad-the-deployer |
| 18:45 | djwonk | he's ready for a Manning book cover |
| 18:45 | justin_smith | vladinator should have a special logging behavior - "THREE THREE FORMS FAILED TO VALIDATE" |
| 18:46 | technomancy | djwonk: how convenient |
| 18:46 | justin_smith | "AH AH AH" |
| 18:46 | djwonk | seriously, thought, some of the implementation details in the validator libraries are kind of intense |
| 18:47 | djwonk | monads, for example |
| 18:49 | robink | So, now I have: (mapcat #(conj [] (first %1) (let [lv (rest %1)] (if (= (count lv) 1) (first lv) (vec lv)))) hiccup-vector) |
| 18:51 | llasram | robink: What are you trying to do? |
| 18:51 | robink | llasram: I'm trying to turn [[:a 1 2 3] [:b 4 5 6] [:c 7]] into {:a [1 2 3] :b [4 5 6] :c 7}. |
| 18:52 | llasram | Why not `:c [7]` ? Uniform structure is usually easier to deal with, consuming as well as producing |
| 18:54 | robink | llasram: A little hard to do since it's basically coming in from the transformed parse tree as [[:a 1 2 3] [:b 4 5 6] [:c 7]] |
| 18:54 | robink | llasram: It would be more work to wrap everybody in a seq/vec. |
| 18:54 | robink | llasram: Oh, output |
| 18:54 | llasram | Exactyl |
| 18:54 | llasram | Exactly, even |
| 18:54 | justin_smith | (into {} (map (fn [[k & v]] [k v]) input)) |
| 18:55 | llasram | Yeah, then you could do what justin_smith suggests |
| 18:55 | robink | justin_smith: Hm |
| 18:55 | hyPiRion | juxt man, juxt |
| 18:55 | robink | llasram: It's not critical, but it's nice to have a single value attached to a keyword if that's all there is. |
| 18:55 | amalloy | this conversation already happened like two hours ago |
| 18:55 | llasram | hah! |
| 18:55 | robink | hyPiRion: Should I have gone back to juxt? |
| 18:56 | robink | amalloy: I know that, I just ended up only managing to make it work with mapcat. |
| 18:56 | hyPiRion | robink: well, pick the one which is most evident for you |
| 18:56 | llasram | robink: Then I think you have what you want |
| 18:56 | llasram | ~juxt |
| 18:56 | clojurebot | juxt is a little hard to grok but it's the best thing ever |
| 18:56 | robink | hyPiRion: OK |
| 18:56 | hyPiRion | ~amalloy |
| 18:56 | clojurebot | amalloy is <amalloy> just use juxt, it'll be great |
| 18:56 | seangrove | hah |
| 18:56 | amalloy | i'm sure clojurebot knows more factoids about me than that; i dunno why that's the one that always comes up |
| 18:57 | llasram | ~amolloy |
| 18:57 | clojurebot | excusez-moi |
| 18:57 | justin_smith | ,(into {} (map (fn [[k & v]] [k v]) [[:a 1 2 3] [:b 4 5 6] [:c 7]])) |
| 18:57 | amalloy | but maybe someone deleted the others |
| 18:57 | clojurebot | {:a (1 2 3), :b (4 5 6), :c (7)} |
| 18:57 | llasram | ~amalloy |
| 18:57 | clojurebot | amalloy is the spotlight illuminating my dumb mistakes |
| 18:57 | justin_smith | robink: see, it works |
| 18:57 | robink | justin_smith: aha |
| 18:57 | llasram | amalloy: Hey, you're right! I was honestly skeptical |
| 18:57 | amalloy | llasram: so was i. i PMed him six times and got juxt every time |
| 18:57 | hyPiRion | hm |
| 18:57 | amalloy | only got spotlight after you did it |
| 18:58 | amalloy | i'm pretty sure he also used to know "amalloy is nuts for juxt" |
| 18:58 | amalloy | (a Raynes quote) |
| 18:58 | llasram | There are worse legacies |
| 19:00 | robink | Bah, if I use juxt I have to nest #()s |
| 19:00 | justin_smith | nesting #()? |
| 19:00 | robink | Oh wait, no I don't |
| 19:00 | hyPiRion | that's not possible (to next #()) |
| 19:00 | hyPiRion | nest* |
| 19:01 | robink | hyPiRion: I know that |
| 19:02 | mthvedt | is there a practical reason for no nested #()s, or is it an anti-smelly-code thing |
| 19:02 | llasram | What would the `%` in #(#(%)) mean? |
| 19:05 | hyPiRion | what would the % in (fn [%] (fn [%] %)) mean? |
| 19:06 | mthvedt | well here's a question |
| 19:06 | llasram | Well, fair enough. So I guess the semantics would be obvious |
| 19:06 | mthvedt | what does the %2 in #(%#(% %2)) mean |
| 19:07 | metellus | ,(#(inc %2) :only-one-arg) |
| 19:07 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval31$fn> |
| 19:08 | mthvedt | but does %2 belong to the inner or the outer |
| 19:08 | hyPiRion | mthvedt: well, it's not legal |
| 19:08 | metellus | but if it was |
| 19:08 | mthvedt | add args until it's legal, and re-ask the question |
| 19:08 | metellus | #(#(% %2) 1 2) or something |
| 19:08 | mthvedt | :P |
| 19:09 | metellus | (#(#(% %2)) 1 2) I mean... I think |
| 19:09 | hyPiRion | It would probably make the outer #() a fn with two arguments, and the inner with two arguments. |
| 19:09 | mthvedt | the outer could have 0 or 1 arguments |
| 19:10 | mthvedt | the point is in those semantics the outer has an indeterminate number of arguments |
| 19:10 | mthvedt | and making it match the inner is un-lispy |
| 19:10 | mthvedt | the way an expr compiles shouldn't depend on a subexpr |
| 19:11 | hyPiRion | mthvedt: as the reader works today, it's "dependent" on subexprs |
| 19:11 | mthvedt | hypirion: but as an implementation detail |
| 19:12 | hyPiRion | sure thing |
| 19:12 | hyPiRion | ,((#(fn [% %2] [% %2]) 1 2) 3 4) |
| 19:12 | clojurebot | [3 4] |
| 19:13 | hyPiRion | but it's not evident, which is why it's not allowed. |
| 19:16 | mthvedt | what's the arity of #(+ #(+ % %2) % %) |
| 19:16 | mthvedt | hang on |
| 19:17 | mthvedt | #(#(+ % %2) %) |
| 19:17 | mthvedt | #(#(+ % %2) % %) |
| 19:18 | seangrove | lynaghk: Did you ever play around with building a bigger app using cljs + angular? |
| 19:18 | mthvedt | no, that's also not right |
| 19:18 | seangrove | Thinking about building a frontend to Kandan using those two together as a test project to see how it is |
| 19:28 | robink | OK, now I have (into {} (map (juxt first #(let [lvals (rest %1)] (if (= (count lvals) 1) (first lvals) (vec lvals)))) [[:a 1 2 3] [:b 4 5 6] [:c 7]])) |
| 19:28 | robink | Which is still silly, it's destructuring and then restructuring and then destructuring the same data. |
| 19:29 | justin_smith | wanting to take c out of the list is a bad idea |
| 19:29 | robink | justin_smith: I don't lose :c, I lose the [] around 7. |
| 19:29 | justin_smith | that is what I mean |
| 19:29 | robink | justin_smith: Output is {:a [1 2 3], :b [4 5 6], :c 7} |
| 19:29 | justin_smith | eventually you feed the data somewhere else, and it needs a special case for seq or non-seq input |
| 19:30 | robink | justin_smith: Except it knows exactly what it's getting |
| 19:30 | justin_smith | which just spreads the ugliness |
| 19:30 | robink | justin_smith: A ({:c 7} :c) will never be dispatched to a function expecting a vector. |
| 19:30 | callen | muhoo: nice meeting you today! PM me your email so I can send you an article about AngularJS |
| 19:31 | robink | justin_smith: It'll always go to something that doesn't want to have to bother with unwrapping a seq with a single cell. |
| 19:31 | callen | Raynes: muhoo survived meeting me. Odds are looking good for you. |
| 19:31 | djwonk | How can I debug "#<FileNotFoundException java.io.FileNotFoundException: Could not locate validata__init.class or validata.clj on classpath: >" -- this is my first attempt to use a library I pushed to clojars |
| 19:31 | Raynes | callen: muhoo is equally as nuts as you are. I am not optimistic. |
| 19:32 | callen | Raynes: really? I hadn't noticed. |
| 19:33 | callen | Raynes: OTOH, as we were walking around SF a curious path of destruction was left in our wake. |
| 19:33 | callen | good mexican food though. |
| 19:34 | callen | Raynes: I managed to explain my position on template libraries over lunch, so at least one person can act as interpreter for me now. |
| 19:35 | callen | in case I start speaking in tongues and crawling up the walls. |
| 19:35 | Raynes | callen: Pretty sure I'd just punch you in the face and run away giggling. |
| 19:35 | justin_smith | robink: (juxt first #(let [lvals (rest %1)] (if (= (count lvals) 1) (first lvals) (vec lvals)))) is identical to |
| 19:36 | justin_smith | (fn [[k & [v & vs :as vals]]] [k (if vs vals v)]) |
| 19:36 | technomancy | djwonk: it looks like you're trying to require a single-segment namespace; that's not recommended |
| 19:36 | robink | justin_smith: Oh wow, nice |
| 19:36 | callen | Raynes: lol |
| 19:37 | callen | justin_smith: destructuring ftw? |
| 19:37 | justin_smith | <3 destructuring |
| 19:37 | robink | justin_smith: Indeed |
| 19:37 | robink | justin_smith: The nice thing about that one is it's actually explicit about the fact that what I'm wanting to do is destructure, not compose a bunch of function-returning functions. |
| 19:38 | justin_smith | though I still contend that on principle it is better to treat items consistently and not have special cases for single element sequences |
| 19:38 | robink | justin_smith: 'k |
| 19:38 | robink | justin_smith: You're probably right, but coming from C it looks weird |
| 19:39 | justin_smith | it is about composability - special cases expnonentially increase the complexity of any code that interacts with them |
| 19:40 | djwonk | technomancy: where would you suggest I make the change? in the `defproject` line? |
| 19:40 | technomancy | djwonk: namespaces are different from a project's artifact/group id |
| 19:41 | djwonk | ok, but I see lots of projects using 'my-name.core'. that's what is not recommended? |
| 19:41 | technomancy | .core is kind of a crappy name, but it's better than a single-segment namespace |
| 19:41 | djwonk | where am I using single segment namespaces? |
| 19:41 | technomancy | you can probably come up with something better since you know more about your project than `lein new` does |
| 19:41 | amalloy | djwonk: it's the least-creative solution possible to the problem that single-segment namespaces are bad news |
| 19:42 | technomancy | djwonk: you're running the equivalent of (require 'validata) somewhere |
| 19:42 | djwonk | d'oh. i am. got it now |
| 19:42 | djwonk | technomancy: thanks |
| 19:42 | lynaghk | seangrove: yeah, we've shipped several client projects with cljs+angular, and we are going to be releasing an iOS weather app built on that stack |
| 19:42 | lynaghk | seangrove: there will be a big open source drop once the app is available for purchase on the various app stores =) |
| 19:45 | frozenlock | If any of you is interested in my weird https problem, I've made a simple little test: https://github.com/Frozenlock/httpstest/blob/master/src/httpstest/core.clj On my main machine it seems to work flawlessly everytime, but on my other one the result is quite inconsistent. |
| 19:45 | tomjack | lynaghk: phonegap or? |
| 19:46 | frozenlock | The uberjared file: https://dl.dropboxusercontent.com/u/40737386/httpstest-0.1.0-SNAPSHOT-standalone.jar |
| 19:47 | lynaghk | tomjack: phonegap, yeah. |
| 19:48 | tomjack | sweet |
| 19:48 | lynaghk | at times, yes. At other times, it's painfully clear how jacked the web stack is for building rich apps =P |
| 19:50 | robink | justin_smith: Would it be OK to say (fn [[k & [v & vs]] [k (or vs v])? |
| 19:50 | robink | justin_smith: Or does :as do more than bind vs to vals? |
| 19:51 | tomjack | lynaghk: it's sort of like "sweet, you actually managed to make it work!" |
| 19:51 | llasram | ##((fn [[v & vs :as vals]] [v vs vals]) [:a :b :c]) |
| 19:51 | lazybot | ⇒ [:a (:b :c) [:a :b :c]] |
| 20:05 | callen | yogthos: boo |
| 20:06 | seangrove | lynaghk: Very nice - did you use https://github.com/pangloss/clang or use a different method? |
| 20:11 | callen | seangrove: this...I didn't know this existed.. |
| 20:11 | callen | son of a bitch |
| 20:12 | technomancy | that's like... a textbook case for when you *should* use a group-id |
| 20:13 | callen | muhoo: something to show you when you're back around |
| 20:14 | seangrove | muhoo: You mean clang? |
| 20:14 | callen | seangrove: hey hey, I'm over here. |
| 20:16 | seangrove | Haha, yes, that's right, slightly distracted |
| 20:16 | seangrove | ahem - callen, you mean clang? |
| 20:16 | callen | seangrove: if it actually works reliably, I'm very interested. |
| 20:16 | callen | AngularJS was one of my dealbreakers for CLJS |
| 20:16 | technomancy | shoulda called it angljure, sheesh |
| 20:17 | seangrove | There's also https://github.com/zcaudate/purnam which looks slightly more maintained |
| 20:17 | hyPiRion | technomancy: but lein-ironic-jure would kick in |
| 20:22 | lynaghk | seangrove: clang came out after we started; the philosophy we used is very different---we're manipulating JS with cljs, whereas clang is more about having angular use cljs. |
| 20:22 | lynaghk | seangrove: I Skyped with the author a while back, though. There's definitely room for both approaches. |
| 20:22 | clojurebot | author is hiredman |
| 20:23 | lynaghk | seangrove: the reason we went with our approach is that JS data structures integrate a bit better with Angular's model, and are faster in some key places (which is crucial on mobile) |
| 20:24 | lynaghk | seangrove: I've written a series of blog posts about all this--they will start to be released once the app is completed in a week or two. |
| 20:26 | seangrove | lynaghk: That seems a bit closer to what purnam is about, making the angular js interop less painful |
| 20:27 | lynaghk | seangrove: the purnam syntax stuff seems unnecessary to me. The approach I took was to extend cljs protocols to js objects |
| 20:27 | lynaghk | and then just use, e.g., transient "assoc!" to set keys/values on js objects. |
| 20:27 | lynaghk | there is an old sketch of this approach on the angular/cljs todoFRP source. |
| 20:28 | tomjack | interesting |
| 20:28 | tomjack | only thing is persistent! is not constant time, is it? |
| 20:29 | tomjack | nor transient? |
| 20:29 | tomjack | maybe that could be considered an optional feature of transients.. |
| 20:29 | lynaghk | tomjack: I'm just using the names; there is no shared implementation with clojurescript's data structures. |
| 20:29 | tomjack | I'm saying that maybe the names don't apply :) |
| 20:30 | seangrove | Did the performance come out alright on mobile? And did that level of integration matter? |
| 20:31 | tomjack | wait, you mean you extend ITransientCollection to object or no? |
| 20:33 | lynaghk | tomjack: yes, but "persistent!" throws an error since conj! just bashes in place |
| 20:34 | lynaghk | seangrove: perf is okay; there hasn't been any slowdown from using cljs compared to straight js---largely because we're not doing crazy stuff in cljs, we're just using it as a glorified coffeescript to get macros and better syntax for throwing around JS objects. |
| 20:35 | tomjack | persistent! could just be js->clj right? |
| 20:36 | lynaghk | sure, no reason why not |
| 20:36 | tomjack | well it doesn't get poisoned after that.. |
| 20:36 | lynaghk | but the way we were using Angular we didn't want to deal with cljs data structures |
| 20:36 | tomjack | ah |
| 20:36 | Pupnik- | as I understand you are locked out of a lot of clj fancy features in clojurescript anyway? |
| 20:37 | tomjack | and it's just convenient not to have to require and require :exclude :) |
| 20:40 | tomjack | I wonder if there is a discipline to CSP that ensures you don't get screwed by mutation, which can be encoded with nominal logic |
| 20:41 | tomjack | like you always use 'fresh' channels? |
| 20:52 | seangrove | tomjack: CSP? |
| 20:52 | seangrove | Ah, got it |
| 21:50 | seangrove | Do I have to configure my project.clj to get checkouts to work, or should lein automatically pick up on them? |
| 21:54 | tomjack | automatically, but you need the dep in project.clj still |
| 21:54 | tomjack | and if you don't already have that version installed, you must `lein install` it |
| 21:55 | seangrove | Ah, ok |
| 21:55 | seangrove | It |
| 21:55 | tomjack | so I guess not quite automatically.. |
| 21:55 | seangrove | It's not available on clojars, so I'm getting an error |
| 21:55 | seangrove | Let me try lein installing it |
| 21:57 | seangrove | Project: https://www.refheap.com/paste/14941 Output: https://www.refheap.com/paste/14940 |
| 22:07 | tomjack | seangrove: hmm |
| 22:08 | tomjack | ~/.m2/clang/clang/0.1.0-SNAPSHOT exists? |
| 22:08 | clojurebot | Huh? |
| 22:10 | tomjack | er, ~/.m2/repository of course |
| 22:13 | robink | llasram: Actually what I meant was: (fn [[k & [v & vs]]] [k (or vs v)]), which works. |
| 22:21 | r0bgleeson | ~ () |
| 22:21 | clojurebot | () is awesome |
| 22:21 | r0bgleeson | hehe |
| 22:25 | jcromartie | and this is why I'll never really learn Haskell http://upload.wikimedia.org/wikibooks/en/3/36/Functor.png |
| 22:25 | bmentges | devn: earlier you said it would be worthwhile to watch Rich Hickey's videos on clojure for java programmers... man, those videos are awesome. Yeah it was like 2:30 hours of awesomeness! Thanks :) |
| 22:25 | gfredericks | nobody who has listened to rhickey talk for 150 minutes has lived to regret it |
| 22:27 | bmentges | gfredericks: yeah, its just awesome. :) |
| 22:29 | bmentges | and im not really into watching lectures... but that guy really knows a lot. The audience is a bit chatty and keeps interrupting, but even this adds up because it makes him explain in detail a lot of stuff. |
| 22:30 | tomjack | anybody up for random remote pairing, otherwise I'm going to have to tell this room full of rubyists and js'ers "uh nevermind" :) |
| 22:30 | tomjack | or just sneak away quietly.. |
| 22:31 | r0bgleeson | i use ruby everyday almost :p |
| 22:32 | bmentges | im stumbling into clojure now, still learning... my day to day tool is python right now :P wanting to change that a bit. |
| 22:32 | r0bgleeson | same |
| 22:34 | bmentges | one question in coding style... for maps, do you guys use commas to make it more readable or is it ok to go with just spaces {:a 1 :b 2} or {:a 1, :b 2} ? |
| 22:36 | brehaut | ~style |
| 22:36 | clojurebot | style is http://paste.lisp.org/display/81021 |
| 22:36 | brehaut | ಠ_ಠ |
| 22:36 | brehaut | bmentges: commas are acceptable, but you can ignore them if you prefer |
| 22:36 | bmentges | Invalid paste number 81021! :( |
| 22:37 | brehaut | http://mumble.net/~campbell/scheme/style.txt |
| 22:37 | brehaut | thats a good basis for style questions |
| 22:37 | bmentges | brehaut: thanks :D |
| 22:37 | brehaut | clojurebot: forget style |
| 22:37 | clojurebot | Man, the living creature, the creating individual, is always more important than any established style or system. -- Bruce Lee |
| 22:38 | brehaut | clojurebot: forget style is http://paste.lisp.org/display/81021 |
| 22:38 | clojurebot | c'est bon! |
| 22:38 | brehaut | ~style |
| 22:38 | clojurebot | Man, the living creature, the creating individual, is always more important than any established style or system. -- Bruce Lee |
| 22:38 | bmentges | lol |
| 22:38 | tomjack | I'd say don't put commas at the end of a line |
| 22:38 | tomjack | but otherwise completely discretional |
| 22:52 | gfredericks | man half of my commas go at the end of a line |
| 22:52 | gfredericks | apparently I'm really inconsistent about it though |
| 22:52 | amalloy | brehaut: you've just taught him another factoid named "forget style", not removed the existing one :P |
| 22:53 | gfredericks | clojurebot: forget? |
| 22:53 | clojurebot | you need to put the verb in pipes |
| 22:53 | brehaut | amalloy: bah |
| 22:53 | brehaut | i can never remember the commands properly |
| 22:53 | amalloy | (inc clojurebot) |
| 22:53 | lazybot | ⇒ 27 |
| 23:25 | tomjack | are there more problems with protocol<->protocol extension besides that people will misuse it? |
| 23:26 | tomjack | I was thinking what if you require both sides of the arrow, so that it can only be used to express a natural isomorphism between two protocols |
| 23:26 | dch | How can I do a regex match, and if successful, extract different parts of the match? I can't find a suitable example, but I can do it with repeated (take / drop / of the splitted line). |
| 23:26 | bbloom | tomjack: what do you mean by proto<->proto ? |
| 23:26 | bbloom | dch: (find-doc "re-") |
| 23:26 | tomjack | like (extend-protocol AProtocol BProtocol (b [b])) |
| 23:26 | dch | e.g. I've got a string (actually via graphite protocol) (def line "stats.vm.foo.dfw.rs.process.more.values") and if stats.vm matches, I want to get out foo.dfw.fs and process.more.values separately |
| 23:27 | alandipert | bbloom: do you do much perf dowsing in firefox? |
| 23:27 | dch | bbloom: I've read those already and I can't see how to extract this in one go, I'm very new to clj. |
| 23:27 | bbloom | dch: you can use destructuring |
| 23:27 | dch | atm I am doing (take 3 (drop 2 (clojure.string/split line #"\."))) repeatedly for each section. |
| 23:29 | alandipert | bbloom: hit a perf wall in ff w/ a cljs thing, would much appreciate any insights |
| 23:29 | bbloom | ,(let [[match x y z] (re-find #"x(.*)y(.*)z(.*)w" "x123y45z6w")] {:match match :x x :y y :z z}) |
| 23:29 | dch | ooh I think I just figured it out |
| 23:29 | dch | (clojure.string/split line #"^stats\.vm\.(\w+\.)") |
| 23:29 | clojurebot | {:match "x123y45z6w", :x "123", :y "45", :z "6"} |
| 23:29 | bbloom | dch: see that ^^ |
| 23:29 | dch | gets me halfway there, just need to fix my regex |
| 23:29 | bbloom | alandipert: i'm not the perf expert, dnolen is. but i can try to help |
| 23:29 | bbloom | alandipert: what's the problem? |
| 23:29 | dch | bbloom: that is much tidier, tyvm! |
| 23:30 | alandipert | bbloom: check out http://micha.github.io/todofrp/ in chrome and then ff and notice the supreme suckage |
| 23:30 | alandipert | bbloom: the ff tools are horrible but i think it's GC |
| 23:31 | bbloom | alandipert: is this using hlisp etc ? |
| 23:31 | bbloom | alandipert: ey gads, that is extreme suckage |
| 23:32 | alandipert | it's compiled w/ no gclosure optimizations |
| 23:32 | alandipert | :simple gives it a 50% boost, :advanced makes it totally usable |
| 23:32 | bbloom | so use advanced ;-) |
| 23:32 | alandipert | well |
| 23:32 | alandipert | our $dayjob app that uses this has a lot more markup and won't compile in advanced |
| 23:33 | alandipert | NPE in gclosure after generating a 2.5gb working file |
| 23:33 | bbloom | that's why cljs was built on gclosure: b/c clojure idioms are slow on js boxes w/o static analysis |
| 23:33 | bbloom | alandipert: ouch. |
| 23:33 | alandipert | bbloom: btw, which version of ff did you run that you saw suckage? |
| 23:34 | bbloom | alandipert: 21.0 |
| 23:34 | alandipert | bbloom: ok yes, that one seems to suck the most |
| 23:34 | bbloom | alandipert: seems like set-text! and set-editing! are your hot spots |
| 23:35 | bbloom | update-state! is the common element |
| 23:35 | alandipert | yeah, we've been in the propagator for 2 days lol |
| 23:35 | alandipert | despite the profile i'm confident it's not cpu bound |
| 23:35 | alandipert | eliminated apply from javelin, we inline everything |
| 23:35 | bbloom | looks like the problem is IO to storage |
| 23:36 | alandipert | turning off storage makes it slightly faster, yeah |
| 23:36 | bbloom | some quick profiling shows 13% of one branch of the profile going to pr-str in the storage backend commit |
| 23:36 | alandipert | yeah but peanuts compared to GC run |
| 23:36 | bbloom | how large is the thing you're printing? |
| 23:36 | bbloom | i haven't profiled GC yet |
| 23:36 | alandipert | do you know how on FF? i haven't found any decent tools |
| 23:37 | alandipert | just very rudimentary things, can't see heap snapshot like in chrome |
| 23:37 | alandipert | about:memory is wiggid lame |
| 23:38 | tomjack | what if r/reducer used a protocol |
| 23:38 | bbloom | have you tried asking somewhere on irc.mozilla.org? seems like the FF folks are excited about the persistent data structures in cljs & are interested in optimizing their js engine |
| 23:38 | tomjack | then maybe (nth (r/map inc [1 2 3]) 2) is 3 or other less crazy stuff |
| 23:38 | bbloom | can probably provide you more experienced advice |
| 23:38 | tomjack | er, 4 |
| 23:38 | alandipert | bbloom: thanks, and yeah i'm in #memshrink |
| 23:39 | bbloom | alandipert: curious that advanced optimizations helps that much only on FF |
| 23:39 | bbloom | alandipert: also, have you emailed the gclosure mailing list about the NPE? |
| 23:40 | bbloom | alandipert: they are pretty friendly over there too |
| 23:40 | alandipert | bbloom: re: data structures my working theory is advanced mode eliminates a lot of array creation, pending any real insight |
| 23:41 | alandipert | bbloom: re gclosure, still workin' it, we were on an old cljs and are hoping for best |
| 23:41 | alandipert | bbloom: thank you on all points tho |
| 23:41 | alandipert | i wish the mozilla dudes were excited about... a better garbage collector :-( |
| 23:41 | bbloom | alandipert: is there a reason you're not on cljs master? |
| 23:41 | bbloom | alandipert: cljs is kinda allocation heavy… yeah |
| 23:41 | alandipert | bbloom: is there a nightly or similar? |
| 23:42 | alandipert | i guess we could do a submodule thing |
| 23:42 | bbloom | alandipert: lien's checkouts feature works great w/ cljs-build |
| 23:42 | alandipert | cool |
| 23:43 | bbloom | iirc anyway |
| 23:43 | bbloom | alandipert: how old of a cljs are you on? |
| 23:45 | xeqi | hugod: does nrepl-ritz have breakpoints? |
| 23:46 | bbloom | alandipert: also, are you using a lot of #{:constant "local" 'values "like this?"} |
| 23:47 | bbloom | alandipert: that's something dnolen told me is a huuge perf hit that we can fix in cljs |
| 23:47 | bbloom | causes boat loads of allocations |
| 23:48 | bbloom | gclosure can't do constant lifting for cljs composites |
| 23:54 | frozenlock | I'm getting a weird error when trying to start a repl... https://www.refheap.com/paste/14944 |