2011-11-07
| 00:07 | leo2007 | Joy of Clojure says the expansion of '(-> 25 Math/sqrt int list)' is (list (int (Math/sqrt 25))), which is not the value of (macroexpand '(-> 25 Math/sqrt int list)) |
| 00:07 | leo2007 | ideas? |
| 00:07 | leo2007 | (list (clojure.core/-> (clojure.core/-> 25 Math/sqrt) int)) |
| 00:08 | tomoj | (doc macroexpand) |
| 00:08 | clojurebot | "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms." |
| 00:09 | tomoj | ,(clojure.contrib.macro-utils/mexpand-all '(-> 25 Math/sqrt int list)) |
| 00:09 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.macro-utils> |
| 00:10 | leo2007 | tomoj: OK |
| 00:10 | tomoj | tools.macro now I think? |
| 00:10 | tomoj | ,(do (require 'tools.macro) (tools.macro/mexpand-all '(-> 25 Math/sqrt int list))) |
| 00:10 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: tools.macro> |
| 00:12 | amalloy | clojure.walk |
| 00:12 | amalloy | though tools.macro probably has it too |
| 00:13 | amalloy | &(use '[clojure.walk :only [macroexpand-all]]) |
| 00:13 | lazybot | ⇒ nil |
| 00:13 | amalloy | &(macroexpand-all '(-> 25 Math/sqrt int list)) |
| 00:13 | lazybot | ⇒ (list (int (. Math sqrt 25))) |
| 01:18 | flognikr | ok, just in case someone is still listening and interested in the emacs24/swank challenges I was facing earlier: emacs (/Applications/Emacs.app/Contents/MacOS/Emacs in my case) needs to be run from within the project root -- it was my error to expect that opening a file within the project root (such as project.clj) would help … I know this is mentioned in the swank-clojure README that "From inside a project, invoke M-x clojure-jack-i |
| 01:18 | flognikr | but for me it only works if I start emacs from within a clojure project... |
| 01:19 | amalloy | flognikr: that is not the expected behavior, sounds like a mac problem |
| 01:20 | amalloy | send technomancy a github issue or something? |
| 01:20 | flognikr | amalloy: thanks -- I am just worried that I am making a rookie emacs setup mistake, sending technomancy on a wild goose chase. |
| 01:21 | mindbender1 | I'm getting "java.lang.ClassNotFoundException: java.swing.JPanel" after using (ns foo.bar (import (java.swing Jpanel JFrame ...) and compiling with C-c C-k to repl user namespace |
| 01:21 | amalloy | mindbender1: javax |
| 01:21 | amalloy | and also :import |
| 01:21 | mindbender1 | ok thanks |
| 01:22 | mindbender1 | also how do I refer to my other ns ? |
| 01:22 | technomancy | flognikr: that is very strange |
| 01:22 | technomancy | I have never heard of that being a requirement before |
| 01:23 | flognikr | technomancy: I am sure it is not a requirement, but it made it work for me :-) |
| 01:23 | flognikr | it's happily swanking now |
| 01:23 | mindbender1 | I used (use foo.bar) is that right? |
| 01:24 | technomancy | clojurebot: ns? |
| 01:24 | clojurebot | ns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful. |
| 01:24 | technomancy | mindbender1: ^^ |
| 01:24 | mindbender1 | ok thanks |
| 01:28 | Raynes | amalloy: That is hardly a mac problem. |
| 01:28 | Raynes | Sounds more like an emacs problem. |
| 01:28 | amalloy | Raynes: "a problem related to your being on a mac", not "a problem that all macs have" |
| 01:29 | Raynes | I still don't think that's true. At least, I've never heard of this problem. Path problems, sure, but not Emacs not knowing where it is. |
| 01:29 | Raynes | So, if it is a being-on-a-mac problem rather than a something-weird-going-on-with-emacs problem, then I guess not many people have had this problem. |
| 01:30 | Raynes | Just seems strange. |
| 01:30 | amalloy | Raynes: all problems are caused by being on a mac |
| 01:32 | flognikr | amalloy: not quite |
| 01:32 | Raynes | I hate you, amalloy. |
| 01:32 | flognikr | raynes: yes, it is strange. |
| 01:35 | mindbender1 | amalloy: I'm still getting java.lang.ClassNotFoundException: javax.swing.JFrame |
| 01:39 | flognikr | so my hopes are dashed once again. it is true that I now can use C-x C-e to veal expressions, the result appears in the mini buffer. However, when I C-c C-l the current buffer, it doesn't actually happen in the *slime-repl* |
| 01:39 | flognikr | the footer of the slime-repl also shows *slime-repl nil* |
| 01:40 | flognikr | this can't be good. |
| 01:41 | amalloy | ,javax.swing.JFrame |
| 01:41 | clojurebot | javax.swing.JFrame |
| 01:41 | Raynes | &javax.swing.JFrame |
| 01:41 | lazybot | ⇒ javax.swing.JFrame |
| 01:41 | amalloy | ,(seq (.getDeclaredMethods javax.swing.JFrame)) |
| 01:41 | clojurebot | (#<Method public void javax.swing.JFrame.remove(java.awt.Component)> #<Method public void javax.swing.JFrame.setIconImage(java.awt.Image)> #<Method protected java.lang.String javax.swing.JFrame.paramString()> #<Method public javax.accessibility.AccessibleContext javax.swing.JFrame.getAccessibleContext()> #<Method protected void javax.swing.JFrame.processWindowEvent(java.awt.event.WindowEvent)> ...... |
| 01:41 | Raynes | amalloy: ^ I never did blacklist that, since the package couldn't be found unless it had already been referenced in some way. |
| 01:43 | flognikr | I stand corrected -- the last experience was due to operating in the wrong namespace on the slime repl |
| 01:47 | Raynes | flognikr: Lies. I bet you're sitting down right now, not standing corrected. |
| 01:48 | flognikr | raynes: sort of. |
| 02:33 | Iceland_jack | technomancy: that's part of it |
| 02:34 | Iceland_jack | bah, sorry technomancy |
| 04:02 | Blkt | good morning everyone |
| 04:31 | lnostdal | (eval-after-load 'clojure-mode '(add-hook 'clojure-mode-hook ...)) ;; doesn't seem to get evaluated when clojure-mode is activated anymore |
| 04:32 | lnostdal | not sure when this happened; i'm following clojure-mode via git |
| 06:15 | kzar | couchDB lets you request a continuous feed of changes, http://wiki.apache.org/couchdb/HTTP_database_API#Changes it keeps the socket open to avoid polling and each new line is a new event. I want to turn that feed into a Clojure sequence that I can map over. I'm not sure how to do it in a way that keeps the socket open though, how should I go about it? |
| 06:39 | lucian | kzar: doesn't clutch handle that? |
| 06:46 | kzar | lucian: don't think so |
| 06:47 | lucian | if there's a way to get to the stream, i think there are methods to read a line |
| 06:49 | kzar | lucian: Yea, I can use clojure.java.io/reader for example to open a connection and then line-seq to pull lines off. I'm just not sure how to do it in a way that keeps the connection open and blocks the sequence while we're waiting for new lines to come in |
| 06:49 | cemerick | kzar: clutch supports that very directly |
| 06:51 | lucian | kzar: you could do it with a closure, i think. but if clutch supports that, us eit |
| 06:51 | kzar | cemerick: Oh, yea you're right. In fairness I did google around for the feature but I didn't check clutch.clj myself |
| 06:52 | kzar | cemerick: In hidsight find-doc would have found it I guess |
| 06:52 | cemerick | Yeah, I hear you :-) |
| 06:52 | cemerick | Once I'm done with the current refactoring, I'll put together some comprehensive docs. |
| 06:56 | kzar | cemerick: Cool :) it's great for me anyway, saves me a job. Does it give you access to the full doc of the change (include_docs=true option)? |
| 07:34 | cemerick | kzar: you need to specify that as an option, but yes |
| 08:06 | leo2007 | ,autodoc |
| 08:07 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: autodoc in this context, compiling:(NO_SOURCE_PATH:0)> |
| 08:18 | leo2007 | how to use slime autodoc as shown in this video http://www.youtube.com/watch?v=lf_xI3fZdIg ? |
| 09:12 | dbushenko | hi all! |
| 09:12 | dbushenko | how to generate a class and override a method? |
| 09:13 | Chousuke | gen-class, but it's often not what you want to do. Do you need to subclass a concrete class or are you working with interfaces |
| 09:13 | Chousuke | ? |
| 09:19 | Dranik_ | Chousuke, thanks! |
| 09:19 | Dranik_ | probably, proxy will go there... |
| 09:21 | mindbender1 | when I clojure-jack-in successfully to a project from emacs I always get errors trying to clojure-jack-in to another project after confirming no to emacs request to kill the existing swank buffer |
| 09:33 | stuarthalloway | official pronunciation of "leiningen", anyone? |
| 09:33 | stuarthalloway | hard or soft g? |
| 09:33 | zerokarmaleft | i'd guess hard g |
| 09:33 | stuarthalloway | me too' |
| 09:34 | zerokarmaleft | it's inspired by a story that's germanic in origin isn't it? that's a clue for someone more well-versed in german phonics than me |
| 09:34 | dakrone | stuarthalloway: it's on the FAQ for lein's readme |
| 09:35 | stuarthalloway | dakrone: indeed it is! thanks |
| 09:36 | zerokarmaleft | my linguistic rabbit trail would've been more fun :P |
| 09:38 | davidrupp | Q: How do you pronounce Leiningen? |
| 09:38 | davidrupp | A: It's LINE-ing-en. ['laɪnɪŋən] |
| 09:39 | davidrupp | ^ex https://github.com/technomancy/leiningen |
| 09:42 | stuarthalloway | davidrupp: congrats on new job! |
| 09:51 | fdaoud | davidrupp? of "language war/trolling" fame? |
| 09:54 | technomancy | they actually got the pronounciation wrong in the movie ಠ_ಠ |
| 09:54 | technomancy | but it had charleton heston so I guess that kind of makes up for it? |
| 10:01 | davidrupp | stuarthalloway: thanks, dude! having lots of fun! |
| 10:01 | davidrupp | fdaoud: you remember that?! |
| 10:01 | mdeboard | lol |
| 10:01 | TimMc | technomancy: There was a movie? o.o |
| 10:01 | TimMc | clojurebot: How do you pronounce Leiningen? |
| 10:01 | clojurebot | leiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen) |
| 10:02 | zerokarmaleft | leiningen delivers the dramatic action type of role that won him the Oscar for "Ben-Hur"! |
| 10:02 | dakrone | technomancy: did you ever see the MacGuyver leiningen episode? |
| 10:02 | cemerick | davidrupp: the internets never forget :-) |
| 10:03 | technomancy | TimMc: http://en.wikipedia.org/wiki/The_Naked_Jungle |
| 10:03 | technomancy | dakrone: yeah... that was weird. I mean they are both great, but they, um, don't compose so well. |
| 10:04 | dakrone | technomancy: yea, it was a really strange one-off for MacGuyver |
| 10:04 | fdaoud | darkrupp: of course! it was a blast! I did the Java web framework spinoff, it was an instant success :D |
| 10:04 | cemerick | dakrone: MacGuyver leiningen episode?!? |
| 10:05 | davidrupp | fdaoud: i remember when you posted yours. sincerely flattered, i am. |
| 10:05 | TimMc | Could someone who has Unicode support give Clojurebot a factoid about Leiningen pronunciation? |
| 10:05 | fdaoud | davidrupp: you rock. |
| 10:06 | TimMc | (Unicode support in their client) |
| 10:06 | raek | stuarthalloway: neither hard not soft. the "ng" digraph should be pronounced like "ng" in "sing" (according to the German orthography resources I could find) |
| 10:06 | dakrone | cemerick: https://secure.wikimedia.org/wikipedia/en/wiki/List_of_MacGyver_episodes_(season_1) episode 6: "Trumbo's World" |
| 10:06 | TimMc | pronounced like the letter eng |
| 10:06 | zerokarmaleft | raek: nice :D |
| 10:07 | technomancy | is there a metadata-emitting pr-str? |
| 10:07 | TimMc | https://secure.wikimedia.org/wikipedia/en/wiki/Eng_%28letter%29 |
| 10:07 | raek | the only other plausible pronunciation would be Lein-ing-gen, that is, "ng" plus "hard g" |
| 10:07 | raek | (German does not have the "soft g" of English) |
| 10:08 | raek | TimMc: how do I add the factoid? |
| 10:08 | cemerick | ,(binding [*print-meta* true] (pr-str ^:foo [])) |
| 10:08 | clojurebot | "^{:foo true} []" |
| 10:08 | cemerick | technomancy: ^^ |
| 10:08 | technomancy | cemerick: aha; very handy. thanks. |
| 10:09 | raek | clojurebot: Leiningen pronunciation is LINE-ing-en ['laɪnɪŋən] |
| 10:09 | clojurebot | In Ordnung |
| 10:09 | raek | clojurebot: Leiningen pronunciation? |
| 10:09 | clojurebot | Leiningen pronunciation is LINE-ing-en ['laɪnɪŋən] |
| 10:10 | TimMc | I was thinking more like "How do you pronounce Leiningen?", which is likely to be triggered by the original inquirer. |
| 10:10 | chouser | clojurebot: Lein? |
| 10:10 | clojurebot | lein is http://github.com/technomancy/leiningen |
| 10:10 | chouser | clojurebot: Lein? |
| 10:10 | clojurebot | lein is http://github.com/technomancy/leiningen |
| 10:10 | chouser | clojurebot: Leiningen? |
| 10:10 | clojurebot | http://github.com/technomancy/leiningen |
| 10:11 | chouser | heh |
| 10:11 | TimMc | Might be close enough... |
| 10:11 | raek | TimMc: yes, but I don't know how you make clojurebot react to that... :-) |
| 10:11 | TimMc | clojurebot: How do you pronounce Leiningen? |
| 10:11 | clojurebot | leiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen) |
| 10:11 | TimMc | hrmf |
| 10:11 | TimMc | raek: How do you pronounce Leiningen? |is| <reply>etc. |
| 10:11 | chouser | clojurebot: pronounc Leiningen |
| 10:11 | clojurebot | the leiningen screencast is on full disclojure: http://vimeo.com/8934942 |
| 10:11 | cemerick | TimMc: you'll go mad trying to cover the variations. |
| 10:12 | davidrupp | clojurebot: I am lying. |
| 10:12 | clojurebot | No entiendo |
| 10:12 | davidrupp | curses! |
| 10:12 | raek | clojurebot: How do you pronounce Leiningen? |is| <reply>LINE-ing-en ['laɪnɪŋən] |
| 10:12 | clojurebot | Ack. Ack. |
| 10:12 | raek | clojurebot: How do you pronounce Leiningen? |
| 10:12 | clojurebot | http://github.com/technomancy/leiningen |
| 10:12 | fdaoud | doesn't everybody just say Lein anyway? |
| 10:13 | cemerick | …which also has multiple pronunciations :-P |
| 10:13 | mdeboard | nein |
| 10:13 | TimMc | clojurebot: botsmack |
| 10:13 | mdeboard | lein has ein pronunciation |
| 10:13 | clojurebot | clojurebot evades successfully! |
| 10:14 | raek | English (especially American) really favours one-syllable words... |
| 10:14 | TimMc | Indubitably. |
| 10:14 | fdaoud | "line" or "lane"? |
| 10:15 | mdeboard | line |
| 10:15 | raek | line |
| 10:15 | TimMc | line |
| 10:15 | TimMc | disco ball |
| 10:15 | mdeboard | lein, nein, ein |
| 10:15 | mdeboard | schwein |
| 10:15 | mdeboard | vein |
| 10:15 | mdeboard | :P |
| 10:15 | TimMc | fein(man) |
| 10:15 | mdeboard | feign* |
| 10:15 | TimMc | (feyn) |
| 10:15 | mdeboard | rein |
| 10:16 | mdeboard | but those aren't German like Leiningen is |
| 10:16 | TimMc | clojurebot: what have I done? |
| 10:16 | clojurebot | Pardon? |
| 10:16 | raek | anyone in here who speaks German natively? (mdeboard?) |
| 10:16 | mdeboard | raek: nein |
| 10:17 | fdaoud | I thought it was "Lenin Jen". oh well. |
| 10:21 | fronx | raek: german here! |
| 10:21 | fronx | Lie ning en |
| 10:22 | TimMc | bam, done |
| 10:23 | fronx | so ['laɪnɪŋən] was correct. |
| 10:23 | raek | fronx: terrific. thanks for confirming! |
| 10:29 | fdaoud | so like "silver lining 'n' so on.." |
| 11:11 | kzar | I found clojure.data.json/pprint-json doesn't give me very pretty JSON. Is there an alternative around? |
| 11:23 | leo2007 | why sometimes `swank' is listed in `lein help'? |
| 11:25 | leo2007 | is not* |
| 11:26 | seancorfield | it depends which plugins are installed |
| 11:28 | leo2007 | seancorfield: how to install my own copy of swank-clojure? |
| 11:28 | seancorfield | if you have swank installed globally, it'll show up wherever you run lein help but if you only have it as a dev-dependency, it'll only show up when you run lein help in that project |
| 11:28 | seancorfield | this will install it globally (off the top of my head): lein plugin install swank-clojure 1.3.3 |
| 11:29 | churib | http://clojure.org seems down from here (germany). Anyone else experienced this? |
| 11:31 | redinger | churib: Yep, down for me too, I'll look into it. thanks for the heads up |
| 11:31 | davidrupp | churib: no response here either. |
| 11:32 | fdaoud | what is the conj? clojure conference, with a j as a play on clojure and conj function? |
| 11:34 | redinger | fdaoud: Yep, exactly right |
| 11:34 | mdeboard | I don't approve of that :( |
| 11:34 | mdeboard | Makes it hard to find information about the actuakl function conj :P |
| 11:34 | redinger | my repl knows nothing about the conference. :) |
| 11:35 | flognikr | ,(doc conj) |
| 11:35 | mdeboard | google does |
| 11:35 | clojurebot | "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type." |
| 11:36 | fdaoud | redinger: thanks. found it (http://clojure-conj.org/schedule) man, wish I could be there! |
| 11:36 | redinger | clojure.org is back again |
| 11:37 | churib | redinger: thanks! |
| 11:37 | kzar | cemerick: That watch-changes feature works great thanks, I was in a bit of a rush to get the "web-hook" gizmo working and in the end it came to 20 odd lines of code :) |
| 11:37 | cemerick | kzar: nice! :-) |
| 11:38 | cemerick | That was all Tunde, actually. |
| 11:41 | seancorfield | fdaoud: some of my friends (and one of my colleagues) are at the clojure training ... looking forward to their reports |
| 11:41 | seancorfield | i fly out on wednesday (early - ugh!) so i can be there at a reasonable time in the evening |
| 11:41 | seancorfield | there's always http://clojurewest.org in march! |
| 11:43 | fdaoud | seancorfield: yeah, in my dreams! |
| 11:44 | mdeboard | Anyone know what rhickey's keynote is covering? |
| 11:44 | mdeboard | cemerick: Tunde? |
| 11:45 | redinger | mdeboard: He hasn't shared the details yet. |
| 11:45 | mdeboard | Baratunde? |
| 11:45 | mdeboard | redinger: I see. It'll be hard to top Simple made easy |
| 11:46 | tensorpudding | what's the best clojure tutorial |
| 11:48 | mdeboard | tensorpudding: This is just my opinion but I don't believe there is a really great one out there that you'll find labeled a "tutorial". I highly recommend 4clojure.com |
| 11:48 | mdeboard | It will give you some direction to your reading and whatnot |
| 11:48 | tensorpudding | i tried following it |
| 11:48 | tensorpudding | it seems light on telling you things though |
| 11:49 | mdeboard | There's no "Learn You a Clojure" or "Learn Clojure the Hard Way" |
| 11:49 | jrgarcia | Can any Paredit users help me out... This is driving me nuts. I have a function wrapped with future. (future (fn...)). How do I remove the opening paren before future, future and the paren that matches that opening paren? |
| 11:49 | flognikr | <ctrl -d> |
| 11:49 | flognikr | removes one paren |
| 11:49 | mdeboard | tensorpudding: Well, you have to search for answers for sure. I also recommend picking up Joy of Clojure and/or Practical Clojure. |
| 11:49 | yazirian | i usually just C-u (or is it C-q, my fingers remember but i do not) |
| 11:49 | jrgarcia | Whenever I (C-d) it just goes past the opening paren. |
| 11:50 | tensorpudding | don't like books |
| 11:50 | tensorpudding | they get outdated |
| 11:50 | mdeboard | lol |
| 11:50 | yazirian | but that's "breaking the rules" |
| 11:50 | mdeboard | welp |
| 11:50 | tensorpudding | like every tutorial i find on the internet |
| 11:50 | mdeboard | Everything gets outdated... |
| 11:50 | tensorpudding | unless they get updated regularly |
| 11:50 | mdeboard | Ok |
| 11:50 | mdeboard | Then I don't know what to tell you |
| 11:50 | tensorpudding | 4clojure is fine |
| 11:50 | mdeboard | if you don't want to read and can't research for yourself based on the problems from 4clojure.com then you might as well just give up |
| 11:51 | tensorpudding | all i really need is structure |
| 11:51 | tensorpudding | and api docs |
| 11:51 | TimMc | tensorpudding: Pick a project. Start writing. |
| 11:51 | yazirian | tensorpudding: there's no real substitute for muddling through a first project. the project itself will give your research (googling, etc.) direction |
| 11:51 | tensorpudding | i'm writing a blog webapp |
| 11:51 | yazirian | sounds like a great starting point |
| 11:52 | raek | the menu on the left on clojure.org can serve as a map to what's included in the language |
| 11:52 | tensorpudding | i had a half-working one but i was convinced to rewrite it using noir |
| 11:52 | tensorpudding | but right now i'm working on my model |
| 11:52 | tensorpudding | i still haven't fixed that issue with dates |
| 11:54 | jrgarcia | Ok, I fixed it... I just turned paredit-mode off and back on :) |
| 11:55 | jrgarcia | Not the best way, but the quickest until I understand paredit better. |
| 11:56 | yazirian | jrgarcia: it's C-u that lets you tell it "no really, i meant it, delete this next paren i try to delete" |
| 11:58 | tensorpudding | ugh |
| 11:58 | tensorpudding | i hate being forced to write anonymous functions |
| 11:59 | jrgarcia | yazirian: Oh... I get it. I was just trying C-u. I just realized I needed to add the C-d. (I'm new to emacs/Aquamacs, I'm a Vim guy) |
| 11:59 | clojurebot | Huh? |
| 12:00 | yazirian | yeah its like an escape code :) |
| 12:01 | tensorpudding | you can't use recursion in an anonymous function can you? |
| 12:01 | tensorpudding | is there a way to refer to the calling function? |
| 12:01 | TimMc | tensorpudding: recur |
| 12:01 | tensorpudding | i thought that was a special form that only worked with loop |
| 12:02 | TimMc | It works for tail recursion in functions as well. |
| 12:02 | TimMc | You can also name your inline function: (fn foo [x] ...) |
| 12:05 | tensorpudding | oh |
| 12:05 | tensorpudding | didn't know fn could do that |
| 12:06 | TimMc | ,((fn foo [] (type foo))) |
| 12:06 | clojurebot | sandbox$eval137$foo__138 |
| 12:08 | aaelony | The R statistical language (www.r-project.org) community has the R Journal (http://journal.r-project.org/current.html) that provides refereed articles about using R in practice. Has anyone considered whether a "Clojure Journal" might similarly be a good idea? |
| 12:12 | mdeboard | tensorpudding: There are several good books that describe in great detail and very lucidly exactly how that works. |
| 12:16 | llasram | Reading through the Clojure source code, I noticed that there are a few reader macros I haven't seen documented anywhere: `#!' is a comment, exactly the same as same as `;'; and `#=(...)' does read-time evaluation of the enclosed form |
| 12:17 | llasram | Are these just lesser-known, or should they be avoided as undocumented features? |
| 12:18 | srid | amalloy_: with -Xmx80m, RSS went up to 200M (from 130M) over the course of 2 days. |
| 12:20 | srid | not sure where the memory leak is. i do use `permanent-channel` (from lamina), which is not directly consumed but gets forked to handle websocket connections via aleph. |
| 12:24 | cgray | hi, i just switched to using clojure-jack-in, and it's great, but the eldoc-like functionality seems to be gone... is there any way to get it back? |
| 12:38 | TimMc | llasram: #=() is not well-documented, but should be. |
| 12:39 | TimMc | ,(binding [*print-dup* true] (pr-str (first {:a 1}))) ; llasram |
| 12:39 | clojurebot | "#=(clojure.lang.MapEntry/create [:a 1])" |
| 12:47 | llasram | TimMc: Cool. That is good to know, because that's the one I actually find myself needing right now :-) |
| 12:55 | chouser | ,(read-string "#=(clojure.lang.MapEntry/create [:a 1])") |
| 12:55 | clojurebot | #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.> |
| 12:55 | chouser | #=() is sometimes useful, but can be a bit treacherous. |
| 12:59 | bhenry | if i want to make closurescript tell the browser to change window.location how can i do this? |
| 13:00 | ibdknox | something like (set! (.location js/window) "some location") |
| 13:01 | ibdknox | bhenry, ^ |
| 13:01 | bhenry | ibdknox: i'm trying it out |
| 13:02 | ibdknox | that's assuming that the new property syntax hasn't been merged into master |
| 13:02 | bhenry | is js default? i'm editing someone else's namespace and nothing is required as js |
| 13:02 | ibdknox | js/ means the global namespace |
| 13:02 | ibdknox | in JS terms |
| 13:02 | bhenry | ah |
| 13:03 | bhenry | so something that's new is going to make that moot soon anyway? |
| 13:03 | llasram | chouser: I'm trying to use `extend-protocol' to implement a protocol for native byte arrays, and the only thing I've been able to work is #=(java.lang.Class/forName "[B") |
| 13:03 | ibdknox | bhenry, no, it would just change it to this (.-location js/window) |
| 13:04 | bhenry | okay |
| 13:19 | jonasen | I’m looking for a function like select-keys, but for vectors. (select-keys [:a :b :c :d] [1 3]) returns {1 :b 3 :d} |
| 13:19 | jonasen | Is (vec (vals (select-keys …))) the way to go or is there something more idiomatic? |
| 13:20 | jonasen | i.e., (select-indices [:a :b :c :d] [1 3]) -> [:b :d] |
| 13:20 | jfields | is there a way to provide a default implementation for a protocol, similar to providing a default defmethod for defmulti? |
| 13:24 | devn | Anyone have a place to crash Wed. night before the conj? I made an error when making my reservation and realized I have a room booked for the 10th and 11th, but not the 9th. I will buy you hearty libations and/or split the cost of the room if you have any extra space on your floor/couch/etc. |
| 13:25 | raek | jonasen: I think the closest you'll find in core is something like (vec (keep-indexed (fn [i e] (#{1 3} i)) [:a :b :c :d])) |
| 13:25 | raek | hm, sorry. that gives the wrong result |
| 13:25 | bhenry | jonasen: (defn select-indices [v vi] |
| 13:25 | bhenry | (map #(nth v %) vi)) |
| 13:26 | Squee-D | Wee thoroughly enjoyed hickey's talk on complecting. |
| 13:26 | TimMc | urgh |
| 13:26 | TimMc | stop using that word :-( |
| 13:26 | Squee-D | why? its quite appropriate methinks |
| 13:26 | fdaoud | Squee-D: +1 |
| 13:27 | raek | #(nth v %) can even be written as v |
| 13:28 | Squee-D | Absolutely fascinating that anyone got hoity toity with rich and his guardrail comment. I don't think he drew an appropriate parrallel but man it's funny when the people who have to fight to get others to consider their ideas, then work so assiduously to protect their own in the same closed manner. |
| 13:28 | bhenry | raek: good point |
| 13:28 | raek | ,(let [v [:a :b :c :d], indices [1 3]] (map v indices)) |
| 13:28 | clojurebot | (:b :d) |
| 13:28 | Raynes | redinger: The white horse link in conj email is dead. Throws me at a Forbidden page. |
| 13:29 | raek | jonasen: in case you also have [:b :d], you could represent the collections as sets and use set/difference to pick out the elements |
| 13:29 | fdaoud | Squee-D: that knitted castle vs lego castle image is a nice reminder to think of while coding. |
| 13:30 | raek | ,(clojure.set/intersection #{:a :b :c :d} #{:b :d}) |
| 13:30 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set> |
| 13:30 | TimMc | Squee-D: Where is this talk? |
| 13:30 | raek | ,(require 'clojure.set) |
| 13:30 | clojurebot | nil |
| 13:30 | Squee-D | fdaoud agreed. But don't you think the guardrail's a bit of an oversimplification? |
| 13:30 | raek | ,(clojure.set/intersection #{:a :b :c :d} #{:b :d}) |
| 13:30 | clojurebot | #{:b :d} |
| 13:30 | technomancy | Squee-D: well most people who got upset didn't hear the talk |
| 13:30 | Squee-D | TimMc http://www.infoq.com/presentations/Simple-Made-Easy |
| 13:30 | TimMc | Ah, that. |
| 13:30 | Squee-D | technomancy i'd believe it. |
| 13:31 | technomancy | all the drama predated the availability of the recording |
| 13:31 | fdaoud | Squee-D: well, TDD does give you a safety net (as he mentions later in the talk) but it shouldn't be what leads your design |
| 13:31 | Squee-D | I use integration and functional specs as roadmaps and speak-to-me gps's, not as guardrails :D |
| 13:32 | technomancy | speaking of which, I just discovered that the British call GPSes "satnav" and am jealous. |
| 13:32 | technomancy | it's such a better word |
| 13:32 | Squee-D | No it shouldn't, but in OO laguages i think Unit testing does help detangle inherent, transparent problems with OO design. |
| 13:32 | Squee-D | technomancy true that :D |
| 13:34 | Squee-D | If for no other reason than unit testing is less arduous the moment you reduce responisibility in a class. This gives a developer a more direct, concrete feeling of immediate accomplishement than "not hurting myself later" |
| 13:34 | fdaoud | agree |
| 13:35 | Squee-D | I think Rich is blazing a path that I like the look of, but i figure a lot of what he's talking about is akin to min-maxing. |
| 13:35 | Squee-D | Something that not every person enjoys. |
| 13:35 | fdaoud | min-maxing? |
| 13:35 | redinger | Raynes: Well that's kind of annoying |
| 13:35 | Squee-D | its a game-theory term |
| 13:36 | Squee-D | http://en.wikipedia.org/wiki/Min-maxing |
| 13:36 | Raynes | redinger: Also, are you sure Super Shuttle requires a reservation? I checked a few days ago, and the verbage didn't seem to indicate that. |
| 13:36 | Squee-D | sort of like finding functional minimums and maximums |
| 13:37 | redinger | Raynes: Possibly true, the hotel indicated otherwise |
| 13:38 | TimMc | devn: Sleep in the bushes. I'm sure they won't mind. |
| 13:38 | Squee-D | Put it another way, in his analogy of juggling, i don't _know_ that finding a way to juggle a single ball is necessarily enjoyable or a good roi... unless the tools for acheiving it become popular (which is where i think the path-blazing comes in) |
| 13:39 | Squee-D | fdaoud i have small "classifiers" (modules, classes, interfaces) in my code and i consider them to be sufficient 'three ball juggling' solutions. make sense? |
| 13:39 | fdaoud | Squee-D: yes sir |
| 13:39 | Raynes | redinger: https://www.supershuttle.com/en/howitworks.aspx?Location=howitworks |
| 13:40 | Squee-D | fdaoud all of this in response to feeling challenged by hickey to do better. I'm exhausted by doing better.. but i suspect i'll be happier if i keep digging deepr |
| 13:41 | redinger | Raynes: well there you go |
| 13:43 | Squee-D | is this conj you boys are talking about? |
| 13:43 | Raynes | :) |
| 13:43 | Raynes | Well, not directly. |
| 13:43 | Raynes | We're arguing over transportation to the hotel, I think. |
| 13:43 | Squee-D | Heh |
| 13:43 | devn | And groveling for lodging on the 9th |
| 13:43 | Squee-D | im jelous |
| 13:43 | devn | in my case |
| 13:44 | redinger | My transportation involves a car, that's what I get for trying to help others find transportation. :P |
| 13:44 | Raynes | Heh. |
| 13:44 | Squee-D | I want to be close to or in the US.. where conference and training attendance does not require me or my co to be filthy stinking rich |
| 13:44 | Raynes | I guess I'll take a SuperShuttle. Sounds like fun. |
| 13:45 | Raynes | Mostly because I remember where the booth is. |
| 13:45 | Raynes | ;) |
| 14:12 | jonasen | raek: bhenry: Thanks, I'm going with the (map ...) alternative which seems simple enough |
| 14:14 | technomancy | how would you write something like (update-in x [2] conj :x) where x is a vector that could be empty? |
| 14:14 | amalloy | jrgarcia: ugh people are telling you to C-u C-d to turn (future (fn ...)) into (fn ...)? just put point in front of (fn), and press M-r |
| 14:15 | jrgarcia | amalloy: Thanks! |
| 14:15 | amalloy | srid: that's not necessarily a leak, really. in fact sounds like it isn't, because your app would crash in that case. a 200MB jvm with an 80MB heap is not unreasonable |
| 14:16 | bhenry | technomancy what about turning conj into another function that handles that |
| 14:16 | technomancy | bhenry: I'm thinking of a pad-to function that extends the vector as necessary |
| 14:16 | shadgregory | hideadd |
| 14:16 | srid | amalloy: so the extra memory was not allocated due to objects in my program (heap)? if so, where would that come from? |
| 14:20 | amalloy | srid: the jvm keeps a lot of stuff in memory. jars it memory-maps, maybe files you open to read, i dunno |
| 14:21 | amalloy | RSS for 4clojure is 150MB on an 80MB heap, virtual is 250. larger than i would like but not exorbitant |
| 14:22 | srid | i not totally sure what i'm going to replace clojure/aleph with (which was a pleasure to work with). perhaps python/gevent .... |
| 14:24 | srid | .. or nodeJS? |
| 14:24 | srid | or cljs->nodejs ;-) |
| 14:27 | dnolen | srid: why not, I have the beginnings of ClojureScript Node.js REPL. |
| 14:34 | srid | dnolen: i'm not confident. its seems very new, and not as common in use as cljs->js. |
| 14:36 | dnolen | srid: sure but, Node.js is just JS + using APIs via its require. |
| 14:37 | amalloy | dnolen: nodejurescript? |
| 14:38 | ibdknox | anecdotally node is pretty annoying. |
| 14:39 | srid | ibdknox: because of callbacks? |
| 14:39 | srid | .on(function(... .on(function(..... .on(function(.... |
| 14:39 | djanatyn | What do you think is the best Clojure book for a programmer who has a small amount of experience with common lisp, and a little bit of experience with functional programming? |
| 14:39 | djanatyn | I've been jumping from tutorial to book to tutorial. |
| 14:39 | ibdknox | srid, callbacks, the APIs that exist for it are often ill-conceived, and they have a serious problem with having 50 solutions for the same thing |
| 14:40 | dnolen | heh, it's a much nicer then working against Rhino - very snappy. Feels almost as zippy as the Clojure JVM REPL experience. |
| 14:40 | djanatyn | They Joy of Clojure seemed pretty cool, but I was a little bit intimidated by the amount of code they were throwing at me in the first few pages |
| 14:40 | srid | djanatyn: joy of clojure, if you don't like verbose books |
| 14:40 | djanatyn | like an SQL macro before I even knew what a vector is >_> |
| 14:40 | djanatyn | was that just the first chapter, then? I felt kinda bad that I didn't understand everything that was going on |
| 14:40 | srid | well, you can always come back to it after reading about vectors |
| 14:40 | dnolen | ibdknox: heh, yeah I don't really give two hoots about the Node.js ecosystem. But damn V8 is fast, and having access to common system calls is sweet. |
| 14:40 | davidrupp | djanatyn: I like "The Joy of Clojure". You get rationale as well as code. |
| 14:41 | djanatyn | ah, true. |
| 14:41 | pandeiro | djanatyn: had the same problem, it sorts itself out eventually if you stick with it |
| 14:41 | djanatyn | Okay, I'll keep reading "The Joy of Clojure" |
| 14:41 | dnolen | ibdknox: also V8 start up time w/ even 14000 lines of JS is near instantaneous. |
| 14:41 | djanatyn | vectors are weeeeeeeeeird. |
| 14:41 | djanatyn | are they kind of like a substitute for (quote)? |
| 14:42 | ibdknox | dnolen, V8 is definitely fast, but if the common libs necessary to do anything real with it aren't... |
| 14:42 | djanatyn | I know a little bit about common lisp, and not very much about scheme |
| 14:42 | amalloy | djanatyn: definitely not a substitute for quote |
| 14:42 | ibdknox | dnolen, the difference between sending 5k messages on a socket in nodejs vs 5k on Netty was 2 orders of magnitude |
| 14:42 | joly | djanatyn: no, they still evaluate the values inside before constructing the vector |
| 14:42 | gfredericks | Is there an official term for function arguments and let-bindings? |
| 14:42 | joly | ,[1 (+ 2 3)] |
| 14:42 | clojurebot | [1 5] |
| 14:42 | ibdknox | djanatyn, I'm not sure the JoC is a good book to start from scratch with |
| 14:43 | djanatyn | I've read up to....I guess, chapter 6 of Practical Common Lisp |
| 14:43 | ibdknox | dnolen, and didn't scale linearly |
| 14:43 | amalloy | gfredericks: locals |
| 14:43 | Squee-D | ibdknox im a from-scratcher, i'm finding it pleasant. I'd rather start with a bookt hat takes the time to describe idioms as it goes. |
| 14:43 | gfredericks | amalloy: thanks |
| 14:44 | pandeiro | ibdknox: do you recommend another in particular? i chose it because it was the most recent, and i still think it's not gonna cover protocols (maybe i'm wrong not there yet) |
| 14:44 | davidrupp | djanatyn: vectors are just a data structure, comparable to lists, but with different performance characteristics |
| 14:44 | amalloy | ,(1 (+2 3)) |
| 14:44 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 14:44 | amalloy | ,'(1 (+2 3)) |
| 14:44 | clojurebot | (1 (2 3)) |
| 14:44 | amalloy | ugh i give up. cannot type |
| 14:44 | ibdknox | unfortunately it's the only one I've read |
| 14:44 | djanatyn | davidrupp: cool. so, they just make clojure faster...? |
| 14:45 | ibdknox | but I've done a lot of teaching and I know that for many JoC is not a good starting place |
| 14:45 | dnolen | ibdknox: not surprising, on many operations, V8 is still 3-4X slower then JVM, still that's not exactly "horrible". |
| 14:45 | Squee-D | srid can i ask why you are replacing aleph? |
| 14:45 | ibdknox | dnolen, I have less issue with V8 and more issues with node itself |
| 14:46 | gfredericks | djanatyn: they make certain operations faster than if you did them on lists |
| 14:46 | ibdknox | and the things that were subsequently built based on node's decisions |
| 14:46 | davidrupp | djanatyn: not "just", but yes, when you use them idiomatically they can give you faster access to items than lists. |
| 14:46 | srid | Squee-D: more like I have to rewrite my project from Clojure to something else that would take <100M of resident memory so that it can be put inside a VM of 1G mem. since this project uses lamina/aleph, I need to find an equivalent library/patten in that new language. |
| 14:46 | djanatyn | okay, that makes sense |
| 14:46 | srid | (aleph is used for websocket) |
| 14:46 | djanatyn | when I was reading about them, I thought "well, why not just use a list instead?" |
| 14:47 | Squee-D | srid it's purely a deployment environment limitation then? |
| 14:47 | davidrupp | djanatyn: @see http://clojure.org/data_structures#Data Structures for a discussion of the tradeoffs. |
| 14:47 | djanatyn | can a list be used in every situation a vector can be used? |
| 14:47 | gfredericks | djanatyn: no |
| 14:47 | clojurebot | Gabh mo leithscéal? |
| 14:47 | srid | Squee-D: hmm? clojure has only one deployment/runtime environment, and that is JVM. no? |
| 14:47 | ibdknox | djanatyn, lists are rarely used for data in Clojure |
| 14:47 | Squee-D | srid because i keep looking at clojure as a very good fit for my reactive programming needs. I don't have vm limitations. |
| 14:48 | Squee-D | srid it's also got a cil and javascript env no? |
| 14:48 | ibdknox | djanatyn, the idea was to make things have a single and straight forward purpose. When you see a list, it usually only means execution |
| 14:48 | gfredericks | djanatyn: another distinction is that in code vectors are used for different things, which makes the code more readable |
| 14:48 | ibdknox | djanatyn, while vectors are meant to hold data |
| 14:48 | srid | Squee-D: yes, but regular clojure programs (using libraries like aleph) will not work on anything but JVM |
| 14:48 | Squee-D | srid but what i'm asking is, if you could pop it on a nice big infrastructure, you'd stay put? |
| 14:48 | srid | maybe it will work on clr, but not cljs |
| 14:48 | ibdknox | djanatyn, this allows you to, at a glance, understand more of what is happening instead of parsing through all the different lists to establish which means which |
| 14:50 | srid | Squee-D: i don't understand your last question. we are limited to deploying to a 1G vm (which will be downloaded by users and run on their laptops/desktops). this VM is none another than http://www.activestate.com/cloud .. highest memory consuming process is a ruby program taking 90M RSS |
| 14:51 | djanatyn | okay, thanks for the explanation :D |
| 14:51 | amalloy | srid: i think he's asking: if someone gave you a free 4GB machine for all your deploys would you stay |
| 14:51 | srid | dnolen: i intend to play with cljs->node for sometime to get a feel for it; are you going to clojure/conj as well? |
| 14:52 | Squee-D | So my question is, is the memory limit of your infrastructure requirements the _only_ reason for you to be seeking alternatives? I'm asking because i do not have those limitations and would like to know your anecdotal views on aleph and clojure for reactive programming :D |
| 14:52 | ibdknox | srid, he's presenting :p |
| 14:52 | srid | ibdknox: nice :) |
| 14:55 | srid | Squee-D: the _only_, yes. amalloy: "all your deploys" = all the users downloading the VM from that site. |
| 14:56 | srid | i think the VM is currently configured for 2G memory. about 1G is to be used for the apps to be deployed by the user. the VM is running plethora of services already that running a >200M clojure app would start swapping lot |
| 14:56 | srid | ... sooner than later. |
| 14:57 | cark | i'm coming in late in the discussion, but did you try limiting the memory used by your jvm ? |
| 14:59 | srid | cark: tried passing -Xmx80m to JVM; started with 130M RSS but over 2 days, it went up to 200M. |
| 14:59 | brehaut | "running a >200M clojure app would start swapping lot" is that based on evidence or hypothesis? |
| 14:59 | Squee-D | srid i'm replacing a pointlessly complex reactive architecture written in ruby. I'm thinking of using either a less complicated architecture in ruby, or perhaps something in clojure because of it's elegance and simplicity with thread handling. |
| 14:59 | srid | i was thinking if the app was unnecessary accumulating data (lamina queue?), but amalloy suggested it could be the JVM requring more memory (with 80M heap limit still being respected) |
| 15:00 | cark | srid: but do you need 80m for your application heap ? that's quite a lot |
| 15:00 | cark | you could go as low as 16 |
| 15:01 | Squee-D | brehaut you attending 'the exceptional conference' ? |
| 15:01 | brehaut | Squee-D: if you mean the conj, no |
| 15:02 | Squee-D | no the auckland conf with that name |
| 15:02 | brehaut | i have never heard of it |
| 15:02 | cark | then you have tyhe permgen size which can be tweaked a bit too |
| 15:02 | srid | Squee-D: i'm not too familiar with reactive programming, though I have some idea of it (eg: callback based on variable value change?) |
| 15:03 | Squee-D | brehaut sorry i've got the wrong conf name |
| 15:03 | Squee-D | too many posts in our internal wiki |
| 15:03 | brehaut | codemania? |
| 15:03 | srid | brehaut: shoudln't have mentioned swapping. >200M was found (by the team) to be "too much" for a operations dashboard app when the process with highest memory was just consuming 90M. it was argued that it would leave less memory for the users to deploy their apps too. |
| 15:03 | Squee-D | yeah |
| 15:03 | Squee-D | that one :D |
| 15:03 | brehaut | Squee-D: thought about it. not sure yet. |
| 15:04 | Squee-D | srid "responding to events" in a short form |
| 15:04 | srid | cark: but I don't understand what caused the process consume 200M when 80M was the configured heap limit |
| 15:05 | cark | those 80Mb are only your personal heap |
| 15:05 | Squee-D | srid in essence what linq Reactive extensions, node, eventmachine, etc all try to do, which is come at the problem of evented programming from a non-blocking perspective. |
| 15:05 | cark | there is the permgen, then you need space for the copying garbage collector |
| 15:05 | cark | though i'm not quite sure about the internals of the gc |
| 15:05 | srid | Squee-D: i come from python background, and i found atom/agent/future (and lamina/aleph) to me much pleasant and easier to work with. |
| 15:05 | cark | it includes an overhead |
| 15:06 | cark | the overhead will be proportional to your heap |
| 15:06 | cark | (in some cases) |
| 15:07 | dnolen | srid: I will be at the Conj. Seems like you could build something like Aleph on top of ClojureScript Node.js. |
| 15:07 | nickmbailey | k |
| 15:08 | srid | dnolen: sounds interesting. i hope to meet you there. :-) |
| 15:08 | bhenry | does anyone know of problems using (format) in clojurescript? |
| 15:08 | srid | bhenry: like this? http://cemerick.com/2009/12/04/string-interpolation-in-clojure/ |
| 15:08 | srid | bhenry: oh, nvm. you were referring to its use in cljs |
| 15:09 | Squee-D | srid i don't think the implementation precedes the concept. an agent to me is 'reactive' |
| 15:09 | Squee-D | infact page-serach "reactive" http://clojure.org/agents |
| 15:10 | cark | srid: also there's the stack space for each thread... which can be tweaked, maybe you're leaking threads too |
| 15:10 | srid | ok. not very different from event-based programming ala python twisted? |
| 15:10 | Squee-D | srid yeah i could have included twisted before |
| 15:10 | srid | cark: "leaking threads" as in *number* of threads being out of control? |
| 15:10 | Squee-D | twisted inspired eventmachine afaik |
| 15:10 | amalloy | cark: i would have guessed that thread stacks are allocated from the heap |
| 15:10 | cark | srid: yes |
| 15:11 | cark | amalloy: i don't think so, tho i might be mistaken |
| 15:11 | srid | afaict, i create threads only on program startup ... unless lamina/aleph does something weird under the hood? |
| 15:12 | cark | srid: only a shot in the dark, it just seems crazy that you can't keep your process under 100mb |
| 15:13 | srid | amalloy: cark - silly me! does the ":jvm-opts" in project.clj get passed *only* in "lein run"? |
| 15:13 | ibdknox | yes |
| 15:13 | srid | I run the app using "java -jar" on a uberjar. and I'm not passing this explicitly |
| 15:13 | srid | .. thinking this :jvm-opts would have become effective |
| 15:13 | amalloy | *chuckle* |
| 15:14 | srid | perils of being a noob java programmer |
| 15:14 | cark | i only recently started using lein, so i wouldn't know |
| 15:15 | cark | this jvm-opts thing looks interesting =D |
| 15:15 | amalloy | the jvm options have to get passed to the java process somehow |
| 15:15 | amalloy | either by lein/cake when you run, or by you when you do it manually |
| 15:16 | srid | restarted the process with "java -Xmx80m -jar ..." and it started with 175M RSS. |
| 15:16 | cark | why don't you try something more drastic, like -Xmx16m ? |
| 15:16 | technomancy | it's pretty ridiculous that there's no way on the JVM to distribute a self-contained executable file that contains its own -X arguments |
| 15:17 | adamh | technomancy: why is the ridiculous? |
| 15:17 | adamh | memory requires are a per-computer thing |
| 15:17 | bhenry | srid: looks like format isn't even a part of cljs |
| 15:17 | ibdknox | technomancy, http://skife.org/java/unix/2011/06/20/really_executable_jars.html |
| 15:18 | srid | cark: amalloy using 64m ... I get 130M RSS; using 32m ... I get 123M RSS. I'll leave it running with -Xmx32m for a couple of days. |
| 15:19 | amalloy | -X is also technically non-standard, right? |
| 15:19 | cark | ok now you may start tweaking permgen size, i believe it defaults to 64Mb |
| 15:19 | technomancy | memory is not the only thing -X sets |
| 15:20 | technomancy | ibdknox: spectacular hack, but honestly did the JVM engineers never think people would want to do this? |
| 15:21 | ibdknox | technomancy, oh yeah, it's retarded, no question there. Just thought you might find that useful :) |
| 15:21 | technomancy | nah, just griping today |
| 15:21 | srid | after some lamina/aleph activity, memory went up to 135M |
| 15:23 | cgray | is it possible to do (let [foo (fn [x y z] ...) bar (partial foo 0)] ...) ? or must i use letfn? |
| 15:24 | Apage43 | i think that works |
| 15:24 | brehaut | cgray: yes that should be fine. |
| 15:24 | brehaut | cgray: i dont think you couldnt do that with partial using letfn either |
| 15:24 | amalloy | &(let [foo (fn [x y z] (+ 1 x y z)) bar (partial foo 0)] (bar 6 9)) |
| 15:24 | lazybot | ⇒ 16 |
| 15:27 | cgray | the problem was between the keyboard and monitor :( |
| 15:27 | srid | after much lamina/aleph activity, RSS went up to 173M. i need to inspect the lamina queues. |
| 15:29 | TimMc | cgray: keyboard and chair |
| 15:29 | cgray | TimMc: that too :) |
| 15:29 | TimMc | unless you use your computer in a really weird position |
| 15:29 | ibdknox | I put my keyboard behind me |
| 15:30 | srid | with -XX:MaxPermSize=32m, initial RSS is 108M. but I see "xception in thread "pool-5-thread-1" java.lang.OutOfMemoryError: PermGen space" |
| 15:30 | Squee-D | i watch my monitor in a mirror |
| 15:30 | cgray | i just lean forward really far |
| 15:31 | gtrak | permgen |
| 15:32 | Squee-D | Me, my monitor and keyboard are all energy levels and hide behind Plancks |
| 15:32 | cark | srid : allright, one last thing, are you sure that java won't reduce its memory footprint under pressure ? |
| 15:32 | adamh | srid - if your permgen is filling up you might want to try CMSClassUnloadingEnabled |
| 15:32 | adamh | -XX:+CMSClassUnloadingEnabled |
| 15:32 | Squee-D | (Plancks make it har dfor you to observe our position and vector) |
| 15:35 | srid | adamh: that lead OutOfMem... error as well. |
| 15:35 | srid | right now, I have "Xmx32m -XX:MaxPermSize=64m -XX:+CMSClassUnloadingEnabled" with 111M as initial RSS that is gradually growing up |
| 15:36 | adamh | here's my memory line... haven't run into any memory problems with it yet: |
| 15:36 | adamh | -Xmx5000M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m |
| 15:36 | cark | adamh: the goal here is to have a low footprint |
| 15:37 | srid | <100M would be optimal |
| 15:37 | adamh | ah |
| 15:40 | cark | srid: maybe you can play with the amount of free heap size to maintain |
| 15:40 | cark | -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 |
| 15:42 | adamh | that isn't going to help if you're having permgen issues though |
| 15:43 | cark | permgen issues were created while trying to reduce its size |
| 15:43 | srid | I notice memory usage for the app to be growing from 111M (minutes ago) to currently 139M. |
| 15:45 | amalloy | hah, i love the suggestion to give it 5GB just in case |
| 15:46 | srid | cark: those two arguments caused the app to start at 180M RSS |
| 15:47 | cark | haha ok =) |
| 15:47 | srid | specifically: java -Xmx32m -XX:MaxPermSize=64m -XX:+CMSClassUnloadingEnabled -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 |
| 15:47 | adamh | amalloy: just in case I have to fire up SBT to do scala dev. you can never have enough memory :/ |
| 15:47 | amalloy | MinHeapFreeRatio doesn't seem like it's doing much good here |
| 15:48 | amalloy | but if you give your app 96MB of heap+perm, there's no way you'll get under 100MB |
| 15:48 | cark | yes 32Mb is still a lot of heap |
| 15:49 | cark | have you tried playing with -XX:ThreadStackSize=256 ? |
| 15:49 | amalloy | FWIW lazybot's resident-set size is just 76MB, so it should be possible |
| 15:49 | cark | default is 1024 i think |
| 15:50 | srid | i'm trying 16m heap now; started with 107M ... seems to stay close to that now. |
| 15:50 | brehaut | srid: are you running a 32bit or 64bit jvm ? |
| 15:50 | cark | lazybot is too lazy to use more memory, gc is exhausting |
| 15:50 | srid | brehaut: how do I find out? :-) i'm running openjdk on a 64-bit ubuntu 10.04 vm |
| 15:50 | amalloy | java -version |
| 15:50 | amalloy | i think |
| 15:51 | srid | 1.6 --- Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) |
| 15:54 | srid | interesting. mem usage hasn't fluctuated much yet. will give it some more time. |
| 15:54 | brehaut | srid: try putting -d32 in your args |
| 15:55 | Squee-D | theres a really good free tool for this kind of tweaking isn't there? |
| 15:55 | amalloy | yeah, that could help quite a bit if he has a lot of small objects |
| 15:55 | Squee-D | visualvm? |
| 15:55 | amalloy | Squee-D: last i checked irc is free |
| 15:56 | Squee-D | in addition to |
| 15:56 | Squee-D | http://visualvm.java.net/features.html |
| 15:56 | ibdknox | that will be $0.25 per question |
| 15:56 | amalloy | ibdknox: who does the money go to? |
| 15:56 | amalloy | are there any subsidies? |
| 15:57 | brehaut | thats the value of irc, you ask one 25 cent question and get 100 different answers |
| 15:57 | amalloy | er those don't count as questions, do they? |
| 15:57 | ibdknox | amalloy, money goes to the let Chris work on Clojure all day fund. |
| 15:57 | Squee-D | that'll be 75cents please amalloy |
| 15:57 | ibdknox | amalloy, I will collect at the end of the month. |
| 15:57 | brehaut | Squee-D: make sure he pays in US cents |
| 15:57 | amalloy | noooo, now i can't afford the conj |
| 15:58 | Squee-D | brehaut aud cents |
| 15:59 | ibdknox | Payment must be made in wampum |
| 15:59 | ibdknox | based on the average calculated exchange rate for the month :D |
| 16:00 | amalloy | man, even though i know what git reset does, i get nervous every time i type it in. what if it throws away some changes? |
| 16:01 | ibdknox | rhetorical questions are discounted to $0.15 |
| 16:01 | amalloy | i'm glad you've got my back |
| 16:01 | ibdknox | amalloy, :D |
| 16:01 | arkh | Does anyone know of any clojure-y ways to sanity check the syntax of an email address? |
| 16:01 | brehaut | lol |
| 16:01 | amalloy | arkh: (.contains % "@") |
| 16:01 | ibdknox | lol |
| 16:01 | ibdknox | regex! |
| 16:01 | srid | cark: amalloy: switching from "-Xmx32m" to "-Xmx16m" made the difference as in RSS stays constant at 108M. i will now give it more than a day of time. |
| 16:02 | arkh | amalloy: hoping for something a little more ; ) |
| 16:02 | brehaut | ibdknox: (inc lol) |
| 16:02 | srid | though i don't understand why this is so. |
| 16:02 | amalloy | arkh: you should probably not bother for much more |
| 16:02 | ibdknox | arkh, https://github.com/ibdknox/noir/blob/master/src/noir/validation.clj#L37 |
| 16:02 | amalloy | you could check for . too, but email addresses are insanely hard to validate without being over-aggressive |
| 16:02 | amalloy | easiest way is to send an email to the address and see if it bounces |
| 16:03 | brehaut | arkh: alternatively if you know a parser lib (such as fnparse or what have you) the spec should only talk maybe half a day to port to a simple validator |
| 16:03 | arohner | amalloy: no . is legal if you're sending to a local server |
| 16:03 | amalloy | $google email rfc regular expression validate |
| 16:03 | lazybot | [How to Find or Validate an Email Address - Regular-Expressions.info] http://www.regular-expressions.info/email.html |
| 16:03 | arohner | but the spec isn't really relevant, because nothing that matters follows the spec precisely |
| 16:03 | amalloy | arohner: nice. i didn't think of that |
| 16:04 | arkh | thanks all |
| 16:04 | amalloy | arohner: so what? if my mail server follows the spec, and your webapp refuses to send me mail, that's a broken webapp |
| 16:04 | amalloy | #"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]" |
| 16:04 | arohner | amalloy: yes, but the calculation is different if my webapp is say, gmail or hotmail |
| 16:04 | amalloy | is apparently the RFC-compliant regex |
| 16:05 | cemerick | and a shirt with </opinion> at the conj. :)" |
| 16:05 | brehaut | amalloy: i presume that means that it accepts everything the RFC does |
| 16:05 | brehaut | amalloy: plus some more |
| 16:06 | amalloy | brehaut: i think the claim is that it's a bijection, but i don't really know |
| 16:06 | amalloy | man. bijection is the wrong word there, but it's such a good word |
| 16:11 | zerokarmaleft | devn, Raynes: ping |
| 16:11 | zerokarmaleft | where are you guys staying the 9th? |
| 16:13 | TimMc | zerokarmaleft: devn is sleeping in the lobby |
| 16:14 | TimMc | (he's still looking for a room to share for that night) |
| 16:19 | Raynes | zerokarmaleft: I'M |
| 16:20 | Raynes | I'm staying at the Sheraton. |
| 16:20 | Raynes | I'm also experiencing great difficulty typing on my phone. ;) |
| 16:20 | zerokarmaleft | ah ok, so the shuttle talk was simply from the airport to the sheraton |
| 16:21 | Raynes | Yeah. The Hilton that the conference was at last year had a complementary shuttle service. |
| 16:22 | Raynes | Not so much with this one. But it is understandable. The airport is like 15 miles away. |
| 16:24 | zerokarmaleft | doh, ~$12 for parking each day |
| 16:26 | srid | manning clojure folks here? |
| 17:28 | tensorpudding | i wish i could figure out the source of this korma psql date issue |
| 17:29 | tensorpudding | i suppose some conversion is necessary but i surely don't know which layer is involved, or how to do it |
| 17:41 | tensorpudding | ERROR: column "time" is of type time without time zone but expression is of type character varying |
| 17:42 | brehaut | im guessing here, but are you passing strings ? |
| 17:42 | tensorpudding | yes, i am |
| 17:42 | tensorpudding | but i was told that worked with mysql |
| 17:42 | brehaut | its telling you not to do that |
| 17:42 | tensorpudding | mdeboard showed me code, which i tried and didn't work |
| 17:42 | tensorpudding | in any case, i don't know what type it ought to be |
| 17:43 | cark | try passing a java.sql.Date ? |
| 17:43 | mdeboard | tensorpudding: No, I used type timestamp |
| 17:43 | brehaut | have you tried creating a java.sql.Date or java.sql.Time ? |
| 17:43 | tensorpudding | i'm not using jdbc directly |
| 17:43 | mdeboard | tensorpudding: and passed a regular string |
| 17:43 | tensorpudding | mdeboard, huh? |
| 17:43 | mdeboard | the type ofthe column I showed you was timestamp |
| 17:43 | mdeboard | and I passed a regular string |
| 17:44 | mdeboard | It works in MySQL, didn't test in pg |
| 17:44 | tensorpudding | you showed me a function which produces a string, i replicated the code |
| 17:44 | tensorpudding | and passed korma the results of the function |
| 17:44 | brehaut | tensorpudding: korma uses JDBC under the hood; its a thin layer on top |
| 17:44 | tensorpudding | yes, that's what i said |
| 17:45 | tensorpudding | you showed me code which you said worked in mysql which doesn't work for me |
| 17:45 | tensorpudding | it's still strings |
| 17:45 | tensorpudding | i assume that jdbc turns time format strings into java.sql.Date/Time junk |
| 17:45 | tensorpudding | i wonder why it isn't working |
| 17:45 | brehaut | tensorpudding: perhaps you should stop assuming |
| 17:46 | tensorpudding | is there something special i have to do in the defentity to let it know this field is a time field? |
| 17:46 | amalloy | (inc brehaut) |
| 17:46 | lazybot | ⇒ 6 |
| 17:46 | cark | why wouldn't you pass a java.sql.Date ? |
| 17:47 | brehaut | tensorpudding: pass in a time object. stop bashing strings together and hoping to start a fire |
| 17:47 | tensorpudding | i don't know what a time object is |
| 17:47 | tensorpudding | well |
| 17:47 | brehaut | tensorpudding: its a java.sql.Time instance |
| 17:47 | brehaut | or alternatively a java.sql.Date instance |
| 17:47 | tensorpudding | technically i have timestamp columns |
| 17:47 | tensorpudding | which are both |
| 17:48 | tensorpudding | what jdbc class corresponds to that |
| 17:48 | brehaut | then use a java.sql.Timestamp |
| 17:48 | brehaut | perhaps you could try googling jdbc timestamp and see what comes up |
| 17:48 | tensorpudding | i don't know what you mean by "use" that |
| 17:48 | tensorpudding | i did |
| 17:48 | tensorpudding | it didn't make sense to me because i don't know java |
| 17:48 | brehaut | (java.sql.Timestamp. year month date hour minute second nano) |
| 17:48 | brehaut | or |
| 17:48 | tensorpudding | yech |
| 17:48 | brehaut | (java.sql.Timestamp. long) |
| 17:49 | tensorpudding | are some of those fields optional? |
| 17:49 | brehaut | no |
| 17:49 | tensorpudding | i don't think clj-time can produce times with nanoseconds |
| 17:49 | brehaut | infact, javadoc tells me that that constructor is deprecated |
| 17:49 | brehaut | and that you should use the milliseconds constructor |
| 17:50 | tensorpudding | what do i have to do to be able to use that |
| 17:51 | tensorpudding | does just having the jdbc driver in my project give me java.sql.Timestamp. |
| 17:51 | brehaut | (java.sql.Timestamp. ^long (clj-time.coerce/to-long jodatime)) |
| 17:52 | brehaut | http://download.oracle.com/javase/6/docs/api/java/sql/Timestamp.html it appears to be part of the standard library |
| 17:52 | tensorpudding | is that the one with or without timezones |
| 17:52 | brehaut | im going to leave that as an exercise for the reader |
| 17:53 | tensorpudding | ah man |
| 17:53 | tensorpudding | having to read javadoc? |
| 17:53 | tensorpudding | that's a bummer |
| 17:53 | tensorpudding | what is that syntax by the way |
| 17:53 | tensorpudding | ^long |
| 17:53 | tensorpudding | is that for specifying a java type |
| 17:57 | tensorpudding | hooray |
| 17:57 | tensorpudding | it works now |
| 17:57 | tensorpudding | thanks brehaut |
| 18:00 | brehaut | does anyone have a decent java2d quickstart link? there seems to be a lot of crap on the tubes |
| 18:00 | choffstein | If I want to create a sequence of calling a function (that has side-effects) n times, is there a more clojure-esque way than: (map #(fn) (range 1 n)) |
| 18:01 | brehaut | (doc repeatedly) |
| 18:01 | clojurebot | "([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it" |
| 18:01 | brehaut | still lazy though, so not ideal |
| 18:01 | cark | (doc dotimes) |
| 18:01 | clojurebot | "([bindings & body]); bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1." |
| 18:02 | brehaut | dotimes doesnt create a sequence though :/ |
| 18:02 | cark | ah indeed |
| 18:03 | brehaut | perhaps doall repeatedly ? |
| 18:03 | cark | i guess that's the way |
| 18:04 | choffstein | repeatedly might work... |
| 18:05 | choffstein | thanks |
| 18:05 | amalloy | choffstein: #(f) is just f |
| 18:05 | choffstein | amalloy -- it won't call f? |
| 18:05 | amalloy | #(f) is a function that, when called, calls f |
| 18:05 | amalloy | and f is...a function that, when called, calls f |
| 18:06 | cark | ,(repeatedly 3 #(println 2)) |
| 18:06 | clojurebot | (2 |
| 18:06 | clojurebot | 2 |
| 18:06 | clojurebot | nil 2 |
| 18:06 | clojurebot | nil nil) |
| 18:06 | cark | looks like it's the one =) |
| 18:06 | brehaut | amalloy: but it calls it with no arguments |
| 18:07 | amalloy | brehaut: i guess it's not a useful point to make, because (map #(f) foo) is incorrect for any value of f. thus he must have been eliding some details |
| 18:07 | choffstein | Right, yeah, I meant just (map f (range 1 n)) |
| 18:07 | brehaut | amalloy: fair point |
| 18:08 | brehaut | choffstein: its probably good form to wrap it in doall so that your side effects occur predictably |
| 18:08 | choffstein | brehaut: ah, right. I'll keep that in mind. |
| 18:08 | choffstein | gotta jet. thanks for the quick tips. I'll probably be back to ask more when I have more time :) Thanks! |
| 18:18 | moogatronic | Anyone flying in to Raleigh Wednesday evening, and looking for Food / Beer? |
| 18:21 | danlarkin | there'll be lots |
| 18:21 | moogatronic | unfortunately, i had to book at an alternate hotel... |
| 18:22 | zerokarmaleft | moogatronic: same :-/ |
| 18:22 | moogatronic | zero: where you staying? |
| 18:22 | zerokarmaleft | moogatronic: by the airport, everywhere else downtown was full too |
| 18:22 | moogatronic | Oh wow. that's farther than me! |
| 18:23 | moogatronic | I'm right near NC State at a holiday inn. |
| 18:23 | moogatronic | the 100 bus runs every hour from RDU to downtown though. |
| 18:23 | moogatronic | so you should be set as far as to and from goes. |
| 18:24 | moogatronic | i'm currently plotting my google maps points of interest for food options. =) |
| 18:25 | technomancy | wow, JSR 310 accepts pull requests. |
| 18:25 | moogatronic | for the specification itself? |
| 18:25 | technomancy | for the reference implementation |
| 18:25 | zerokarmaleft | moogatronic: i'll be able to get around with a rental |
| 18:26 | moogatronic | very modern of JSR310. =) |
| 18:26 | technomancy | ibdknox: so are there any restaurants near the Conj hotel that serve Korma? |
| 18:26 | moogatronic | zerokarmaleft: ah, good call. too poor for rental, so i'm rollin' large with the $2 bus rides. =) |
| 18:27 | ibdknox | technomancy, haha unfortunately, despite going to UNC, I don't know downtown raleigh very well :p |
| 18:28 | moogatronic | i'm trying to find the good non-chain places... |
| 18:28 | moogatronic | priority #1: good microbrew |
| 18:28 | technomancy | I'm actually not sure if I've had Korma; I have had lots of Indian food but have been fairly lax at identifying it |
| 18:29 | danlarkin | technomancy: so far we've found sandwiches and shish kabob |
| 18:29 | moogatronic | technomancy: i spotted an indian place right up the street from me. |
| 18:29 | technomancy | danlarkin: I expect a full report. =) |
| 18:29 | moogatronic | "India Mahal" but it's pretty far from Sheraton |
| 18:29 | zerokarmaleft | technomancy: http://bukuraleigh.com/buku/ |
| 18:29 | moogatronic | for some defintions of far |
| 18:30 | zerokarmaleft | that's only a couple blocks away |
| 18:30 | technomancy | sounds expensive |
| 18:30 | moogatronic | everyone names their menu Dinner.pdf |
| 18:30 | zerokarmaleft | and they don't have korma |
| 18:31 | moogatronic | Looks both tasty and expensive. |
| 18:31 | moogatronic | Ethiopian Lentil Wat potato, swiss chard, carrot, red onion, berberé spice, injera flatbread $18 |
| 18:31 | moogatronic | ther are about $3 worth of ingredients in that. |
| 18:31 | moogatronic | But i love that stuff. |
| 18:31 | technomancy | moogatronic: http://en.wiktionary.org/wiki/mahal |
| 18:31 | moogatronic | lol. |
| 18:32 | moogatronic | makes the name even worse than I thought. |
| 18:36 | moogatronic | The Pit has a menu item labeled "Barbecue & Booze"... |
| 18:37 | ibdknox | welcome to the south. |
| 18:37 | cemerick | The pit is good |
| 18:37 | moogatronic | ibdknox: Lol. I'm in Indiana... |
| 18:37 | moogatronic | Yeah, i meant that in a good way. |
| 18:37 | moogatronic | (the menu item thing) |
| 18:37 | cemerick | It's the man v. food tour. :-P |
| 18:37 | moogatronic | Isn't NC bbq a specific sytle of BBQ? |
| 18:38 | ibdknox | depends on which part of NC you're in :) |
| 18:38 | moogatronic | what is time out? |
| 18:38 | moogatronic | ibdknox: Are you a NC 'native' ? |
| 18:38 | cemerick | fried chicken sandwich dive near either UNC or Duke (can't remember) |
| 18:39 | ibdknox | moogatronic, I lived most of my life in Charlotte |
| 18:39 | ibdknox | the moved to Seattle |
| 18:39 | ibdknox | now in San Francisco |
| 18:39 | moogatronic | cemerick: looks like chapel hill |
| 18:42 | technomancy | ibdknox: east side seattle? |
| 18:43 | ibdknox | technomancy, yeah |
| 18:43 | ibdknox | technomancy, downtown redmond |
| 18:44 | moogatronic | I have always loved the PacNW> |
| 18:44 | moogatronic | all of the geographic features are there… (for the most part) ocean, mountains, forest... |
| 18:46 | ibdknox | moogatronic, Seattle has been by far my favorite place to live |
| 18:46 | moogatronic | I've not been to Seattle, but i've been to Vancouver. |
| 18:46 | moogatronic | It was really nice. |
| 18:48 | chewbranca | ibdknox: same here, I've been up and down the west coast and settled in seattle |
| 18:48 | tolstoy | Not Portland? |
| 18:48 | ibdknox | yeah, Ive been wondering about Portland |
| 18:48 | moogatronic | Everyone seems to love Portland as well. |
| 18:48 | tolstoy | I'd say it's really great, but I don't have much to compare it to. It's nicer than Dallas! ;) |
| 18:49 | chewbranca | I prefer the feel of seattle to portland, portland is more industrial, whereas seattle has more of a forest feel to it, and I absolutely love the seattle waterfront, the different communities on the hills that you can see from any side of the lake are pretty stunning |
| 18:49 | moogatronic | Doesn't seem like your bar is very high tolstoy, though, I've never been to texas at all, except as an airport stop-over |
| 18:50 | chewbranca | I definitely like portland, and portland has a number of pros, including the much much better transit system than seattle |
| 18:50 | tolstoy | Portland feels (to me) like it's a really big town, instead of a city. |
| 18:50 | chewbranca | and portland is a very progressive city, I've actually personally talked to the mayor of portland about open data, as opposed to seattle where I've had little progress in getting data from the city |
| 18:51 | chewbranca | ie compare http://pdxapi.com/ to my port to seattle: http://seaapi.com/ |
| 18:51 | moogatronic | i've pretty much only lived in college towns as an adult. |
| 18:51 | moogatronic | they all feel like small towns with a proportionately large number of things to do given the population |
| 18:52 | seancorfield | the docs seems to say that (require 'something :reload-all) will reload the something namespace _and all the namespaces it uses_ (transitively) but that doesn't seem to happen (clojure 1.3.0)... anyone seen anything like that? or am i doing something dumb? |
| 18:52 | amalloy | '[something :reload-all] |
| 18:55 | seancorfield | really? doh! |
| 18:56 | ibdknox | ,(doc require) |
| 18:56 | clojurebot | "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents... |
| 18:57 | ibdknox | amalloy, how is one supposed to know that? |
| 18:57 | amalloy | &(doc require) |
| 18:57 | lazybot | ⇒ "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Us... https://gist.github.com/1346590 |
| 18:58 | ibdknox | it doesn't include the brackets bit |
| 18:58 | ibdknox | at least not from my reading |
| 18:58 | ibdknox | and (require 'blah :reload) works fine |
| 18:58 | seancorfield | a libspec has [ ] but i wasn't sure whether :reload was an option or part of a libspec |
| 18:58 | amalloy | well, i could well be wrong here |
| 18:58 | seancorfield | yeah, that was where i'd got to (require 'blah :reload) |
| 18:59 | seancorfield | and that works |
| 18:59 | seancorfield | ,(require '[example.controllers.user :reload]) |
| 18:59 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: true> |
| 18:59 | ibdknox | yeah |
| 18:59 | ibdknox | fails |
| 18:59 | seancorfield | so, nope, ain't that |
| 19:00 | seancorfield | but :reload-all does not seem to work transitively :( |
| 19:00 | ibdknox | it does in 1.2 |
| 19:00 | seancorfield | that maybe... |
| 19:00 | ibdknox | (require 'something :reload-all :verbose) |
| 19:00 | seancorfield | i'll try that, thanx |
| 19:01 | ibdknox | I actually didn't know about reload-all lol |
| 19:02 | ibdknox | I've wanted that many times |
| 19:02 | seancorfield | interesting... it shows the full transitive calls to load... but doesn't seem to actually reload / pick up changes... |
| 19:04 | seancorfield | i have a println in each of my files and that runs when each is loaded for the first time but not when the require :reload-all is invoked... |
| 19:04 | ibdknox | even in 1.2? |
| 19:06 | seancorfield | my code won't run on 1.2... but a bit of println debugging suggests a possible issue... |
| 19:07 | seancorfield | so if i have a (def foo (atom {})) and i reload the namespace that's in, should i expect foo to be reset? or do i need an explicit (reset! foo {}) in the file? |
| 19:07 | ibdknox | foo should be reset |
| 19:07 | amalloy | seancorfield: you should expect a reset |
| 19:08 | seancorfield | that's what i would have thought... |
| 19:08 | cemerick | seancorfield: :reload-all worksforme? |
| 19:08 | cemerick | (require 'com.foo.ns :reload-all) |
| 19:09 | seancorfield | ok, bizarreness... now it's working for me too... *sigh* |
| 19:09 | ibdknox | if there's a compile error, it possible the reload is failing |
| 19:10 | seancorfield | that may have been the problem... i had a reference to an unbound variable... it had been declared (and bound) but then i moved it to another ns and reloaded and got an error and fixed the error but things wouldn't reload properly... |
| 19:11 | seancorfield | dagnabbit! now it won't transitively reload :( |
| 19:13 | seancorfield | well, it seems i _do_ need the reset! in that namespace for some reason |
| 19:14 | seancorfield | i'm dynamically creating the symbol in the (require .. :reload-all) call |
| 19:15 | amalloy | seancorfield: shouldn't matter |
| 19:15 | alexbaranosky | is there some community place to throw utility functions? |
| 19:16 | alexbaranosky | I know amalloy has his repo for 'useful' functions |
| 19:17 | alexbaranosky | I find myself wanting to share functions across projects |
| 19:18 | seancorfield | amalloy: i know but... |
| 19:19 | ibdknox | alexbaranosky, create your own util |
| 19:19 | ibdknox | amalloy has an article about that somewhere |
| 19:20 | brehaut | http://amalloy.hubpages.com/hub/Build-your-own-Clojure-toolkit |
| 19:21 | seancorfield | hmm, if i modify the file, load will really reload it... but if i haven't modified it, load seems to do nothing... *puzzled* |
| 19:21 | seancorfield | it certainly isn't behaving how i expect... |
| 19:22 | alexbaranosky | ibdknox: seems more productive to have a community util though, otherwise everyones stuff is spread all over the place |
| 19:22 | alexbaranosky | and there'll be a lot of duplication as everyone reinvents the wheel in their own personal util libraries |
| 19:23 | ibdknox | I think part of the point is to use it as a learning function |
| 19:23 | ibdknox | the common util is essentially clojure contrib in its new form |
| 19:24 | alexbaranosky | ibdknox: were you talking to me? |
| 19:24 | ibdknox | alexbaranosky, yeah |
| 19:24 | alexbaranosky | I'm trying to get stuff done though, not LEARN ;) |
| 19:24 | ibdknox | haha srsly |
| 19:25 | ibdknox | learning is for noobs. |
| 19:25 | ibdknox | :-p |
| 19:25 | alexbaranosky | for example I'm lookingat noir, and playing with refactoring some of it... A function I wrote to use on MIdje, would be usefl in one spot |
| 19:25 | alexbaranosky | but I have no easy way to share that dependency between both projects |
| 19:25 | alexbaranosky | I could make my own project, lik eyou said.... |
| 19:26 | alexbaranosky | f it, maybe I'll just create the worlds most massive compendium of Clojure util functions |
| 19:26 | ibdknox | that's what useful basically is :) |
| 19:27 | alexbaranosky | yeah I wonder if the function I'm using is hiding in there |
| 19:28 | alexbaranosky | ibdknox: you seem to have a knack for color schemes. |
| 19:28 | ibdknox | alexbaranosky, years of pretending I can design things ;) |
| 19:29 | alexbaranosky | fake it til you make it |
| 19:30 | alexbaranosky | I have lack of knack for color schemes it seems |
| 19:33 | ibdknox | I worked at a world class design firm for a while, so I cheated |
| 19:33 | alexbaranosky | amalloy: does useful have a function to return the first truthy function from a sequence such that (find-first-truthy [?string ?odd] 5) ]) ;;=> odd? |
| 19:34 | alexbaranosky | ibdknox: best way to cheat is to work with awesomely skilled people |
| 19:34 | ibdknox | ,(filter #(% 5) [string? odd?]) |
| 19:34 | clojurebot | (#<core$odd_QMARK_ clojure.core$odd_QMARK_@5bfb7d>) |
| 19:35 | ibdknox | ,(some #(% 5) [string? odd?]) |
| 19:35 | clojurebot | true |
| 19:35 | ibdknox | hm |
| 19:35 | alexbaranosky | second one |
| 19:35 | ibdknox | stupid some |
| 19:35 | alexbaranosky | first one, but wrapped in first |
| 19:35 | chouser | ((some-fn string? odd?) 5) |
| 19:35 | chouser | ,((some-fn string? odd?) 5) |
| 19:35 | clojurebot | true |
| 19:36 | chouser | yeah, I guess if you want it to return the function, you need something more like filter |
| 19:38 | ibdknox | I thought there was a some that returned the first true element |
| 19:39 | ibdknox | a some-like function that is |
| 19:39 | gfredericks | like (partial some identity)? |
| 19:40 | gfredericks | $findfn [nil false false 42 :false] 42 |
| 19:40 | lazybot | [clojure.core/rand-nth] |
| 19:40 | gfredericks | pfft |
| 19:40 | ibdknox | lol |
| 19:40 | gfredericks | (inc lazybot) |
| 19:40 | lazybot | ⇒ 0 |
| 19:40 | gfredericks | he has a sense of humor |
| 19:40 | gfredericks | also acceptable would have been clojure.core/fourth |
| 20:02 | brehaut | how awesome would findfn be if it ran the queries through the every fun, (map #(apply comp %) (cross every-fn every-fn)) and (map #(apply partial %) (cross every-fn every-fn)) |
| 20:09 | amalloy | brehaut: wth is cross |
| 20:09 | brehaut | (defn cross [A B] (for [a A b B] [a b])) |
| 20:10 | tensorpudding | getting null pointer exceptions in a functional language is the height of my day |
| 20:10 | seancorfield | if i have a library and a bunch of example code showing how to use it, is it considered "good practice" to publish it as part of the project JAR or not? (to clojars) |
| 20:10 | tensorpudding | noir conveniently gives me a backtrace, but i can't really figure out why it's failing |
| 20:10 | brehaut | seancorfield: i would say or not? |
| 20:10 | seancorfield | right now the example code has no external dependencies but that might change as i expand the examples... |
| 20:11 | brehaut | seancorfield: theres always dev-dependancies for that sort of thing too |
| 20:11 | seancorfield | yeah, i was wondering about that... are dev-dependencies pulled in for lein run? |
| 20:11 | tensorpudding | the function works fine when i call it from slime |
| 20:12 | brehaut | seancorfield: i *think* so, but only for the specific project (not when its a dependancy itself) [caveat: guessing based on experience] |
| 20:12 | tensorpudding | what does a null pointer exception mean anyway? |
| 20:12 | brehaut | it means a nil has found its way into your program when your program didnt expect it |
| 20:13 | seancorfield | brehaut: thanx... i'll experiment... |
| 20:13 | amalloy | alexbaranosky: i used to have around a function (defn validator [f] (fn [x] (when (f x) x))) |
| 20:13 | technomancy | seancorfield: dev-deps are included in lein run |
| 20:13 | technomancy | unless you set the LEIN_NO_DEV environment variable |
| 20:14 | tensorpudding | huh |
| 20:14 | amalloy | and then you could use (some #(% 5) (map validator [string? odd?])) |
| 20:14 | tensorpudding | i don't know how that's possible |
| 20:14 | technomancy | seancorfield: it's pretty common to just plop an "examples" dir in the project root |
| 20:14 | brehaut | ,({:a 1} :b) ; tensor pudding - numerous expressions can evaluate to nil |
| 20:15 | clojurebot | nil |
| 20:15 | seancorfield | technomancy: perfect! thanx for the confirmation! |
| 20:15 | seancorfield | and that examples folder would be a full lein project too? |
| 20:15 | seancorfield | just trying to get a sense of how best to develop / publish FW/1 |
| 20:16 | technomancy | that's less common, but it makes sense |
| 20:16 | technomancy | especially if you need more than a single file to demo functionality |
| 20:16 | alexbaranosky | what's wrong with my second implementation of first-truthy-fn ? https://gist.github.com/1346666 |
| 20:16 | seancorfield | right now I do lein run -m example.main to fire up the example app |
| 20:16 | tensorpudding | the error is supposedly in a let statement |
| 20:16 | tensorpudding | where i run a SELECT query |
| 20:16 | seancorfield | so src/example/main.clj is that file |
| 20:16 | tensorpudding | but this function works fine in the repl |
| 20:17 | brehaut | tensorpudding: due to the magic of referential transparency it shouldnt be hard to isolate it |
| 20:17 | tensorpudding | i think it's due to the input |
| 20:17 | brehaut | (and by magic i mean no magic at all) |
| 20:17 | amalloy | alexbaranosky: you left out the & |
| 20:17 | alexbaranosky | where? |
| 20:17 | clojurebot | where is your source code |
| 20:17 | amalloy | ie, you were relying on destructuring in the loop, to pull apart the predicate list one by one |
| 20:17 | seancorfield | but i'd want to pull the examples out of the JAR for publishing so... move it to the root of the project? and then... lein run -m example.main wouldn't work directly, right? |
| 20:18 | tensorpudding | sending the function nil doesn't give a null pointer exception |
| 20:18 | amalloy | your second version destructures in the function args, but only recurs to the loop head |
| 20:18 | tensorpudding | it gives an index out of bounds exception |
| 20:18 | alexbaranosky | wait, I think I left out 'args' |
| 20:18 | amalloy | no |
| 20:19 | alexbaranosky | amalloy: ahh i see |
| 20:19 | technomancy | seancorfield: you could set :test-resources "examples" |
| 20:19 | technomancy | tiny bit of a hack, but it shouldn't be bad |
| 20:19 | amalloy | alexbaranosky: https://gist.github.com/1346739 is a simple change, but untested |
| 20:20 | ibdknox | what was wrong with the version I did with filter? |
| 20:20 | seancorfield | technomancy: thanx! |
| 20:21 | amalloy | ibdknox: he's not here to get things done, he wants to LEARN |
| 20:21 | ibdknox | amalloy, hahaha... well done :D |
| 20:21 | tensorpudding | here's my code https://gist.github.com/1346742 |
| 20:21 | tensorpudding | the error is seemingly in get-post |
| 20:21 | alexbaranosky | hehe |
| 20:22 | amalloy | seriously though this is just a special-cased re-implementation of filter |
| 20:22 | ibdknox | tensorpudding, you're executing the result of the query |
| 20:22 | alexbaranosky | amalloy: yes, because it has to be lazy |
| 20:22 | tensorpudding | huh? |
| 20:22 | ibdknox | tensorpudding, if that result is nil |
| 20:22 | ibdknox | kaboom |
| 20:23 | alexbaranosky | amalloy: got it fixed it without looking your solution!... now time to see what you did :) |
| 20:23 | brehaut | alexbaranosky, amalloy: if you are going to do that, you should at least start from (defn cons [h t] (fn [accessor] (accessor h t))) |
| 20:23 | tensorpudding | okay |
| 20:23 | tensorpudding | but that doesn't change the fact that it shouldn't be nil |
| 20:23 | ibdknox | tensorpudding, btw it's idiomatic to put the first line of your code on its own line, instead of after the args vector |
| 20:24 | ibdknox | tensorpudding, you can also just do (where {:pid pid}), you don't need the vector |
| 20:24 | amalloy | alexbaranosky: filter is already lazy...? |
| 20:24 | tensorpudding | oh |
| 20:24 | seancorfield | technomancy: that would be dev-resources-path i presume? :) |
| 20:24 | alexbaranosky | hmmm, wonder what I was doing wrong then. My filter version was failing my "lazy" test |
| 20:25 | amalloy | alexbaranosky: chunked seqs, probably |
| 20:25 | tensorpudding | but why is it nil? |
| 20:25 | amalloy | you'd do better to use a generic un-chunk-ifier and then filter that, than to reinvent every lazy sequence to make them explicity skip chunking |
| 20:26 | ibdknox | tensorpudding, I'm not sure that it is, I'm just looking at places that will blow up |
| 20:26 | ibdknox | if you put the stacktrace up I can probably tell you |
| 20:28 | tensorpudding | okay |
| 20:28 | tensorpudding | handling the nil now brings up the correct 404 page |
| 20:28 | alexbaranosky | amalloy: chunking, ey? |
| 20:28 | technomancy | seancorfield: oh, right |
| 20:28 | tensorpudding | but i can't figure out why it's coming up nil |
| 20:28 | ibdknox | tensorpudding, because that pid doesn't exist in your db |
| 20:28 | tensorpudding | but it does |
| 20:29 | amalloy | &(first (map prn (range))) ;; prints 32 in a big chunk for efficiency |
| 20:29 | lazybot | ⇒ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 nil |
| 20:29 | alexbaranosky | amalloy: ah yes I've heard of this |
| 20:29 | tensorpudding | running get-post in the repl brings it up |
| 20:29 | ibdknox | call it with a string of pid |
| 20:30 | alexbaranosky | so you if I instead came up with a generic way to unchunk things, it'd be applicable to any function that evaluated to a lazy seq |
| 20:30 | ibdknox | tensorpudding, "13" vs 13 |
| 20:30 | tensorpudding | ugh |
| 20:30 | alexbaranosky | amalloy: any code to point me to? |
| 20:30 | tensorpudding | you seriously need to pass it as a string, even though the data type is an int in the table? |
| 20:30 | ibdknox | tensorpudding, no |
| 20:30 | tensorpudding | oh wait |
| 20:30 | ibdknox | tensorpudding, I was saying that you're passing it a string |
| 20:30 | tensorpudding | oh right |
| 20:30 | ibdknox | tensorpudding, not an int |
| 20:30 | tensorpudding | the route matched it as a string |
| 20:30 | tensorpudding | dang |
| 20:31 | tensorpudding | except when pid is string when i call the function i don't get a null pointer exception |
| 20:31 | tensorpudding | wait, nevermind, i do |
| 20:31 | amalloy | (defn unchunk [s] (lazy-seq (when-let [s (seq s)] (cons (first s) (unchunk (rest s)))))) |
| 20:32 | alexbaranosky | is that in 'useful' ? |
| 20:32 | tensorpudding | okay so what's the coercion function |
| 20:32 | ibdknox | tensorpudding, you should use (first) instead of (coll 0) |
| 20:32 | tensorpudding | i changed that already |
| 20:32 | leo2007 | what exactly is reference type? |
| 20:32 | ibdknox | tensorpudding, also (:time result) instead of (result :time) will help prevent nil explosions |
| 20:34 | gfredericks | leo2007: kinda like a mutable pointer? |
| 20:34 | amalloy | alexbaranosky: no, i just slapped it together |
| 20:35 | amalloy | i've never really had to care about chunking, so it's not in useful |
| 20:35 | leo2007 | gfredericks: I know no java but some C. I haven't heard of mutable pointer. |
| 20:35 | gfredericks | leo2007: I think it normally comes up when you want to distinguish references from values, which functional programmers like to do |
| 20:35 | tensorpudding | how can i turn the string into an int? |
| 20:35 | tensorpudding | is it a read function or something |
| 20:36 | ibdknox | tensorpudding, (Integer. my-str) |
| 20:36 | ibdknox | ,(Integer. "12") |
| 20:36 | brehaut | leo2007: ##(let [v 1, r (atom 2)] (prn v) (prn (deref r))) |
| 20:36 | lazybot | ⇒ 1 2 nil |
| 20:36 | clojurebot | 12 |
| 20:36 | gfredericks | leo2007: then maybe just saying "pointer" is a simpler way to explain it |
| 20:36 | amalloy | (inc lazybot) ; supa-fast |
| 20:36 | lazybot | ⇒ 1 |
| 20:36 | tensorpudding | ah, no wonder i didn't guess it |
| 20:36 | tensorpudding | java... |
| 20:37 | gfredericks | leo2007: probably "value" would be the more foreign concept for you |
| 20:37 | brehaut | leo2007: above, r is an atom, thus a reference type, and v is just a plain value. you have to dereference r to get at the value it holds |
| 20:37 | gfredericks | leo2007: "reference types" aren't all that special unless your language emphasizes values |
| 20:37 | tensorpudding | it didn't work |
| 20:38 | tensorpudding | No matching field found: Integer for class java.lang.String |
| 20:38 | alexbaranosky | (defn first-truthy-fn [preds & args] |
| 20:38 | alexbaranosky | (first (filter #(apply % args) (unchunk preds)))) |
| 20:38 | ibdknox | lol |
| 20:38 | tensorpudding | oh wait |
| 20:38 | tensorpudding | i totally did .Integer |
| 20:38 | ibdknox | tensorpudding, Integer. not .Integer |
| 20:41 | tensorpudding | now it works, i guess |
| 20:42 | alexbaranosky | chunking is a weird feature of Clojure; I bet it bites a lot f people in the rear |
| 20:43 | brehaut | alexbaranosky: only once per person ;) |
| 20:44 | amalloy | alexbaranosky: everyone (including me) says that, but i don't think it has ever been an actual issue for me |
| 20:45 | amalloy | wait, i tell a lie. it has |
| 20:45 | amalloy | but since i knew about chunking it was pretty easy to find/fix |
| 20:46 | aperiodic | chunking? |
| 20:46 | technomancy | the fact that you notice chunking is usually a sign you're mixing side-effects and laziness in a sloppy way |
| 20:46 | alexbaranosky | it just means that if you need laziness in the micro, you'll need to unchunk |
| 20:46 | technomancy | in my experience |
| 20:46 | tensorpudding | hooray, i have a webapp that can display pages |
| 20:46 | goodieboy | anyone here have experience setting up tomcat for a clojure web app? |
| 20:49 | alexbaranosky | amalloy: any chance I could pull request a `first-truthy-fn` and a `unchunk into useful?` |
| 20:49 | amalloy | you can get unchunk in if you want, but i don't want first-truthy |
| 20:49 | alexbaranosky | amalloy: correction -> `unchunk` into useful :) |
| 20:50 | gfredericks | goodieboy: if by "setup" you mean "deploy a warfile", then "maybe, I can't remember actually" |
| 20:50 | alexbaranosky | hmmmmm... you're driving a hard bargain |
| 20:50 | goodieboy | gfredericks: ha ha, well I'm going to be fronting it with nginx, so I'm curious about proxying and "connectors" |
| 20:51 | gfredericks | goodieboy: alright let's pretend I never said anything then |
| 20:51 | goodieboy | :) |
| 20:51 | amalloy | alexbaranosky: if it'll encourage you to start your own utils lib, i could reject unchunk as well |
| 20:55 | tolstoy | ,(doc partition) |
| 20:55 | clojurebot | "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items." |
| 20:56 | alexbaranosky | I like `first-truthy-fn` for cases like this: (when-not (some true? (map #(% cur) [vector? map? symbol?])) |
| 20:56 | tolstoy | Hm. Doc doesn't work in slime? |
| 20:56 | tolstoy | Eh, no matter. |
| 20:56 | alexbaranosky | Instead you'd have: (when-not (first-truthy-fn [vector? map? symbol?] cur) |
| 20:57 | alexbaranosky | which seems to come up fairly often |
| 20:58 | amalloy | www.clojars.org/alexbaranosky/my-awesome-utils <= dooooo it |
| 20:59 | alexbaranosky | amalloy: it does have a nice ring to it |
| 21:00 | brehaut | alexbaranosky: ring is a seperate library |
| 21:00 | amalloy | alexbaranosky: before the Borg sucked me up i had amalloy/utils. it builds character |
| 21:01 | alexbaranosky | amalloy: ok you got me, I'm calling it Utilize, and it is going to rock |
| 21:01 | amalloy | sweet |
| 21:02 | alexbaranosky | my character's going to be a level 20 wizard |
| 21:02 | brehaut | alexbaranosky: no epic tier ? |
| 21:02 | alexbaranosky | not a high enough level? |
| 21:03 | brehaut | alexbaranosky: depends on the edition i guess :P |
| 21:03 | amalloy | seancorfield: sounds kinda like formula-one. intentional? |
| 21:03 | gfredericks | okay from now on all new libraries must have names that pass (partial re-matches #"lib-\d{4,8}") |
| 21:05 | seancorfield | FW/1 (Framework One) has been this framework's name since the middle of 2009... |
| 21:05 | alexbaranosky | brehaut: when I was a kid (the 80s) I remember level 20 being pretty dang high |
| 21:05 | amalloy | gfredericks: how about sha-1 hashes? |
| 21:05 | brehaut | alexbaranosky: that would have been the case in the 80s |
| 21:06 | amalloy | then i can brute-force it until i get lib-DEADBEEF |
| 21:06 | gfredericks | amalloy: if they're truncated to be short enough to memorize, that's fine |
| 21:06 | gfredericks | amalloy: what would they be hashes of? |
| 21:06 | amalloy | anything |
| 21:07 | amalloy | the projects' real names, which everyone but you uses |
| 21:07 | gfredericks | me as the author or me as gfredericks? |
| 21:07 | amalloy | you as gfredericks, the library-name complainer |
| 21:08 | gfredericks | gotta have _some_ super power |
| 21:08 | brehaut | gfredericks: i need a name for an image thumbnail library |
| 21:08 | gfredericks | brehaut: imudge |
| 21:08 | brehaut | hmm |
| 21:08 | gfredericks | nevermind that looks like apple |
| 21:09 | gfredericks | I pronounced it different in my head |
| 21:09 | amalloy | climj-magic |
| 21:09 | brehaut | amalloy: *groan* |
| 21:09 | seancorfield | lein has me puzzled... i have a project that depends on a library, let's call it X... lein deps pulls it in, lein repl finds it - i can do (use 'X) just fine, but if i have src/some/file.clj that tries to require or use X, when try to pull in some.file, it complains that it can't find X... |
| 21:09 | amalloy | brehaut: couldn't think of anything worse in a hurry, sorry |
| 21:09 | gfredericks | brehaut: clumbnail |
| 21:10 | seancorfield | i assume i'm doing something dumb with leiningen but... |
| 21:10 | amalloy | YOUR_NAME_HERE_FOR_500$ |
| 21:10 | brehaut | gfredericks: you arent even adhering to your own rules‽ |
| 21:10 | gfredericks | brehaut: ##(str "lib-" (rand-int 100000)) |
| 21:10 | lazybot | ⇒ "lib-28012" |
| 21:11 | brehaut | done |
| 21:11 | gfredericks | has a nice ring to it |
| 21:11 | amalloy | reminds me of a passage in REAMDE |
| 21:11 | brehaut | reminds me of THX-1138 |
| 21:11 | amalloy | roll a D100, call that the name of your company. then you can stop arguing about the stupid shit and get to work |
| 21:12 | brehaut | 1d100 |
| 21:13 | clojurebot | 15 |
| 21:13 | amalloy | D10000, i guess. the company wound up being called Corporation 9592 |
| 21:13 | brehaut | thats not a very exciting library or company name |
| 21:13 | brehaut | haha |
| 21:14 | amalloy | &(apply str "lib" (repeatedly 2 #(format "%02d" (rand-int 100)))) |
| 21:14 | lazybot | ⇒ "lib4787" |
| 21:15 | goodieboy | i'm using noir for a web app, anyone know if there is a way to execute a function when the app initializes? |
| 21:15 | gfredericks | goodieboy: does running it at the top level of your ns not work? |
| 21:16 | amalloy | gfredericks: it probably wouldn't work if you AOT-compiled, for example |
| 21:16 | gfredericks | goodieboy: tomcat has some hooks for that, if you don't find any better way |
| 21:16 | hiredman | goodieboy: depending on what you are doing there are a number of ways |
| 21:17 | leo2007 | brehaut and gfredericks: many thanks for the explanation. |
| 21:18 | goodieboy | gfredericks hiredman good to know. the problem now is that when I try to run "lein ring uberwar", the code I have executing in my server.clj file makes the process hang (starting up an embedded solr instance) |
| 21:18 | goodieboy | since solr doesn't need to be running when i build the war, i need a way to prevent that from happening |
| 21:19 | amalloy | goodieboy: it's a good practice, in general, to make loading-a-namespace not cause side effects |
| 21:19 | goodieboy | exactly |
| 21:19 | amalloy | aside from, obviously, def-ing some functions |
| 21:19 | amalloy | a simple way to do this is to add a level of indirection |
| 21:20 | amalloy | instead of (def server (start-server)), you can (def server (memoize #(start-server))) |
| 21:20 | amalloy | and then code that needs to actually use the server can use (server) instead of server |
| 21:20 | leo2007 | I am trying to build a website using noir. when I run 'lein swank' in the project root, nothing from the project seems to be loaded. |
| 21:20 | leo2007 | ideas? |
| 21:21 | goodieboy | amalloy: yeah i see, i'll give that a shot |
| 21:21 | goodieboy | amalloy: is memoize built in? |
| 21:22 | amalloy | yes. though it may not be the best tool for the job, it's the simplest |
| 21:22 | amalloy | probably better would be (def server (delay (start-server))), and then use @server instead of (server) |
| 21:22 | allhands55 | bye |
| 21:22 | allhands55 | exit |
| 21:22 | amalloy | allhands55: /quit |
| 21:23 | allhands55 | sorry |
| 21:23 | brehaut | amalloy: what about defonce ? |
| 21:23 | amalloy | brehaut: not a solution to his problem |
| 21:24 | amalloy | his concern is to avoid def-ing anything side-effecty at compiletime |
| 21:24 | brehaut | ah, i missed the compile time part |
| 21:24 | gfredericks | goodieboy: if you're going the way of amalloy's delay, you can confine it to one location with (def real-app (delay ...)) (def app #(@real-app %)) |
| 21:25 | gfredericks | although I suppose you probably don't end up referring to the app more than once anyhow, so that's probably not very helpful |
| 21:26 | goodieboy | ok good, thanks! i'l try that too. |
| 21:26 | spoon16 | possible to use byte-array-type as a type hint (def byte-array-type (class (make-array Byte/TYPE 0)))? |
| 21:26 | amalloy | gfredericks: makes the assumption that his app is a function of one argument, which is pretty limiting |
| 21:27 | hiredman | the default noir skeleton uses a -main, I believe, so you can just put init code in there, or if you are generating a war using lein ring, it has some options you can set in project.clj |
| 21:27 | amalloy | spoon16: no |
| 21:27 | amalloy | not doing it that way |
| 21:27 | spoon16 | thanks |
| 21:33 | gfredericks | amalloy: I assumed it was ring, since he said noir. |
| 21:34 | amalloy | gfredericks: he mentioned that what he was starting up (unintentionally) was an embedded solr instance |
| 21:35 | gfredericks | ah ha |
| 21:35 | gfredericks | so he did |
| 21:50 | ieure | Is there a formal name for a function f such that ((f n) g) -> (g n) ? |
| 21:50 | ieure | I guess this would be the thing in Clojure: (defn f [&rest n] (fn [g] (apply g n))) |
| 21:51 | ieure | Er, [& n] |
| 21:51 | ieure | (defn f [& n] (fn [g] (apply g n))) |
| 21:51 | cemerick | it's so strange to me that you can conj and map into a map |
| 21:51 | cemerick | ,(conj {:a 5} {:b 6 :c 7}) |
| 21:51 | clojurebot | {:b 6, :c 7, :a 5} |
| 21:51 | amalloy | cemerick: i know, right? similarly for a seq of pairs |
| 21:52 | amalloy | &(conj {:a 5} (seq {:b 6 :c 7})) |
| 21:52 | lazybot | ⇒ {:b 6, :c 7, :a 5} |
| 21:52 | cemerick | amalloy: no, *not* just a seq of pairs |
| 21:52 | cemerick | must be a seq of map entries |
| 21:52 | cemerick | ,(conj m '([:c 7] [:k 6] [:z 0])) |
| 21:52 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: m in this context, compiling:(NO_SOURCE_PATH:0)> |
| 21:52 | cemerick | (conj m m2) implies (seq m2) |
| 21:53 | amalloy | cemerick: that's definitely untrue |
| 21:53 | amalloy | &(conj {} [1 2]) |
| 21:53 | lazybot | ⇒ {1 2} |
| 21:53 | amalloy | &(conj {} (seq [1 2])) |
| 21:53 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry |
| 21:53 | cemerick | amalloy: implies (seq m2) only if m2 is a map |
| 21:54 | amalloy | that i can beliece |
| 21:56 | cemerick | it's even stated as intentional in the docs http://clojure.org/data_structures#Data%20Structures-Maps%20%28IPersistentMap%29 |
| 21:56 | cemerick | amalloy: have you ever seen any rationale for that? |
| 21:56 | amalloy | nothing explicit |
| 21:56 | cemerick | (actually, this particular behaviour is implemented in APersistentMap) |
| 22:08 | hiredman | ,(contains? (supers (class [1 2])) java.util.Map$Entry) |
| 22:09 | clojurebot | false |
| 22:09 | hiredman | ah |
| 22:09 | hiredman | right |
| 22:25 | tensorpudding | does clojure have a compose function? |
| 22:25 | gfredericks | comp |
| 22:27 | spoon16 | what is the best way to include an external clojure project in my own via LEIN? I have cloned https://github.com/alexott/clj-tika locally, but am not sure how to reference it from my lein project. |
| 22:38 | amalloy | don't bother cloning, just declare it as a dependency in project.clj |
| 22:47 | tensorpudding | ugh |
| 22:47 | tensorpudding | comp isn't working |
| 22:48 | tensorpudding | i don't know how to combine two of these things |
| 22:48 | alexbaranosky | you may have the backwards order |
| 22:48 | tensorpudding | well |
| 22:48 | tensorpudding | it's doing the first one |
| 22:48 | tensorpudding | but not the last |
| 22:49 | tensorpudding | none of the examples have them using more than one transformation at once |
| 22:49 | tensorpudding | they're functions, according to the repl |
| 22:49 | brehaut | (comp f g) ; g is called first whith whatever arguments are passed to it. the result of g is passed to f, the result of f is returned |
| 22:50 | brehaut | ,((comp inc {:a 1 :b 2}) :b) |
| 22:50 | clojurebot | 3 |
| 22:50 | tensorpudding | meh, nevermind |
| 22:50 | tensorpudding | i passed a map intead of a list of maps |
| 23:33 | alexbaranosky | amalloy: thanks for the push. Started my util library, with yours as the base I forked off. |
| 23:34 | alexbaranosky | https://clojars.org/utilize |
| 23:34 | amalloy | alexbaranosky: cool! just want to be sure you're aware most of the good stuff in amalloy/utils has been folded into useful now |
| 23:36 | amalloy | oh, yes. i see you forked useful, not amalloy-utils. good good |
| 23:37 | cemerick | Anyone know of a "rich irc" (not campfire!) that doesn't suck? |
| 23:37 | seancorfield_ | does clojars only allow you to push up from one machine? |
| 23:37 | amalloy | seancorfield_: if your ssh key matches, you can do whatever you want |
| 23:38 | tensorpudding | swank-clojure is sure confusing the heck out of emacs |
| 23:38 | seancorfield_ | hmm, i didn't realize you could just copy ssh keys around like that... when you generate one on a machine, it includes the machine name...? |
| 23:38 | technomancy | I think I'm almost ready for a 1.0 of https://github.com/technomancy/die-roboter, but I don't really like how its `send-off' makes you think of agents |
| 23:39 | cemerick | seancorfield_: that's just a convenient comment |
| 23:39 | cemerick | can be any text AFAIK |
| 23:39 | technomancy | cemerick: isn't the richness a function of the client? there are clients that embed images, gists, &c. |
| 23:39 | tensorpudding | technomancy, gave you a new bug |
| 23:39 | technomancy | tensorpudding: bring it on =) |
| 23:39 | tensorpudding | now swank-clojure really doesn't start at all |
| 23:39 | cemerick | technomancy: That's interesting. Example(s)? |
| 23:40 | tensorpudding | slime-face-inheritance-possible-p is void |
| 23:40 | seancorfield_ | cemerick: ok, well then, i'll update my local file to match what's already on clojars :) |
| 23:41 | cemerick | Having everything archived serverside for later access anywhere (i.e. avoiding link-rot for many things) is the only killer feature of campfire AFAICT. |
| 23:41 | technomancy | cemerick: don't know of any specifics, outside emacs but I've heard a couple people mention tweaks to mac clients that could do it |
| 23:41 | technomancy | maybe limechat? it's been a few years. |
| 23:41 | cemerick | Yeah, I keep meaning to give that a serious try again. |
| 23:41 | hiredman | https://github.com/danlarkin/subrosa |
| 23:41 | technomancy | cemerick: yeah, at sonian we used subrosa which could catch you up on what you missed like campfire |
| 23:42 | seancorfield_ | cemerick: ah, i need to copy the id_rsa folder as well as the .pub right? |
| 23:42 | cemerick | hrm |
| 23:42 | technomancy | tensorpudding: very strange; I'm not sure how that could happen nondeterministically |
| 23:42 | hiredman | meh, the real solution is never disconnect |
| 23:42 | technomancy | naturally |
| 23:42 | tensorpudding | i'd do an emacs -Q but i don't know how i'd get clojure-mode working since it's a package |
| 23:42 | cemerick | seancorfield_: Yes, you need your private key around. Sounds like you might want to read up on key management before you do something that compromises you though. |
| 23:43 | technomancy | tensorpudding: you can just M-x eval-buffer on the file inside ~/.emacs.d/elpa |
| 23:43 | technomancy | hiredman: well IIUC the use case with campfire is mostly for communicating with muggles who can't be expected to know how tmux works |
| 23:43 | cemerick | maybe I should see where the open-sourcing of wave has gone…though I hate having stuff like irc/chat in browser windows. |
| 23:44 | tensorpudding | slime-connect is void now |
| 23:44 | technomancy | tensorpudding: right; it should be bootstrapped when you do a jack-in |
| 23:44 | tensorpudding | i guess i have to eval all the slime packages |
| 23:45 | tensorpudding | it didn't start though |
| 23:46 | tensorpudding | maybe it's still trying |
| 23:46 | tensorpudding | i can't tell |
| 23:46 | technomancy | so, any suggestions for a function name to replace die.roboter/send-off? basically "go eval this form remotely for side-effects" |
| 23:46 | seancorfield_ | cemerick: don't worry, my hamfisted attempt to simply copy the key stuff around didn't work so i haven't done myself any harm |
| 23:47 | technomancy | preferably one that has a matching "go eval this form remotely for the return value" name |
| 23:47 | technomancy | tensorpudding: jack-in should load the slime packages for you |
| 23:47 | technomancy | there shouldn't be any need to load any elisp apart from clojure-mode |
| 23:47 | seancorfield_ | the only reason i created a key was for github... i'd never needed one before then |
| 23:47 | tensorpudding | well it didn't |
| 23:47 | cemerick | send-for / send-do! |
| 23:47 | cemerick | ? |
| 23:48 | cemerick | seancorfield_: I smell windows. ;-) |
| 23:48 | technomancy | send-for isn't bad |
| 23:48 | technomancy | as long as it doesn't make people think of clojure.core/for |
| 23:49 | cemerick | send-eval, then |
| 23:49 | technomancy | yeah, that's probably best |
| 23:49 | technomancy | do makes me think of progn |
| 23:49 | cemerick | seancorfield_: in short, if you copy your entire ~/.ssh dir to the other machine, you'll be right (assuming there's nothing interesting in the other machine's .ssh |
| 23:49 | tensorpudding | grr |
| 23:49 | technomancy | which is related to side-effects, but not quite in the way I want |
| 23:49 | tensorpudding | lein run doesn't work either |
| 23:50 | tensorpudding | i do not understand why it refuses to believe i have this namespace |
| 23:50 | cemerick | technomancy: don't set up a bikeshed and then be sad about the colors you get. ;-) |
| 23:50 | tensorpudding | i've compiled this file a dozen times |
| 23:50 | technomancy | cemerick: heh =) |
| 23:50 | technomancy | what if I just make it a require-only namespace and use die.roboter/eval and die.roboter/exec? |
| 23:51 | technomancy | exec makes me think of shelling out |
| 23:51 | cemerick | if that's the semantics you want to evoke |
| 23:51 | tensorpudding | what would cause java to think that a namespace doesn't exist, even though there's a file for it |
| 23:51 | technomancy | but I think since it's not in clojure.core it's less of an issue |
| 23:51 | cemerick | hardly require-only; there's :refer-clojure |
| 23:51 | technomancy | cemerick: true, but I rarely use that outside of namespaces designed to be consumed via require |
| 23:52 | technomancy | maybe that's just me |
| 23:52 | tensorpudding | java.lang.Exception: namespace 'blog.views.user' not found after loading '/blog/views/user' |
| 23:53 | tensorpudding | wait, i'm dyslexic |
| 23:53 | technomancy | tensorpudding: typo in the ns form? |
| 23:53 | cemerick | technomancy: I agree, I rarely use :refer-clojure. I don't think the library author is making that determination for the user though. |
| 23:53 | tensorpudding | i wrote blob |
| 23:53 | technomancy | tensorpudding: clearly it should be blaugh |
| 23:53 | cemerick | Clojure should be smart enough to figure that out. ;-) |
| 23:54 | tensorpudding | okay, getting blank pages for my user screen, that's a bit weird |
| 23:54 | seancorfield_ | cemerick: cheeky git! i don't use windows! :) |
| 23:55 | cemerick | No windows, but you've managed to avoid ssh keys all this time? Talent, that. |
| 23:55 | seancorfield_ | i'd just never needed ssh keys until recently... and my solution was simply to ssh from my ubuntu netbook to my imac desktop and push the library from there without getting out of my chair! |
| 23:55 | cemerick | Here I thought I was on the pinnacle of terminal avoidance. :-) |
| 23:56 | cemerick | hah |
| 23:57 | tensorpudding | is there a built-in length function for collections... |
| 23:57 | brehaut | (doc count) |
| 23:57 | clojurebot | "([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps" |