2015-01-05
| 00:08 | cfleming | $mail hellofunk To reformat a block, select it and Cmd-Option-L. If you don't select it'll reformat the whole file. |
| 00:08 | lazybot | Message saved. |
| 00:56 | clojer | With all the brilliance in the Clojure[script] community has any thought been given to implementing a native Clojurescript version of React instead of going through react.js? |
| 01:01 | clojer | tavistock: I was thinking of how Clojure[script] might give scope for improving on the ideas behind React. |
| 01:02 | luxbock | clojer: something like this: https://github.com/aaronc/freactive ? |
| 01:03 | clojer | tavistock: For example, could virtual dom diff-ing be more efficient in Clojurescript? |
| 01:04 | clojer | luxbock: Thanks. I missed that one. |
| 01:17 | aaelony | hi, can someone point me to good docs on how to upgrade to that latest cider-nrepl version? I'm getting warnings when I launch that required nREPL ops are not supported... |
| 01:23 | alexyakushev | aaelony: Should be as easy as adding cider-nrepl to your plugins vector in profiles.clj |
| 01:23 | alexyakushev | Did you get no warnings before, but now you do once upgraded? |
| 01:25 | aaelony | alexyakushev: I've been getting them for some time, but didn't have the opportunity to upgrade and put it off. In the setup I'm refering to, there actually isn't a ~/.lein/profiles.clj yet -- maybe that's the problem... |
| 01:26 | alexyakushev | Well, if you have the dependency for cider-nrepl in the project itself, then it shouldn't matter. Now do you? Will be easier if you pasted your project.clj somewhere |
| 01:28 | aaelony | If I recall correctly, I simply installed the latest emacs, hooked up to marmalade, and installed clojure-mode and cider. |
| 01:28 | aaelony | but I'm open to a cider-nrepl dependency in profiles.clj |
| 01:29 | aaelony | since I'd prefer to have it available for all clojure projects |
| 01:30 | aaelony | It's a bit confusing because if I google for "cider-nrepl" I get a hit for clojure-emacs/cider-nrepl and another hit for clojure-emacs/cider |
| 01:31 | aaelony | looks like perhaps cider-nrepl is deprecated |
| 01:31 | luxbock | aaelony: https://github.com/clojure-emacs/cider#cider-nrepl-middleware |
| 01:31 | aaelony | I'll read up on https://github.com/clojure-emacs/cider and cut over |
| 01:31 | aaelony | cool |
| 01:41 | aaelony | I've got cider running now, but it tells me it's not in sync with cider-nrepl: "WARNING: CIDER's version (0.7.0) does not match cider-nrepl's version (0.8.2)" Where do I upgrade cider-nrepl? |
| 01:41 | aaelony | or the reverse, lol |
| 01:41 | aaelony | nevermind.. |
| 01:41 | aaelony | thx |
| 01:43 | alexyakushev | Did the link luxbock shared solve it for you? |
| 01:45 | aaelony | alexyakushev: it helped, yes. However, now that it's installed and in sync with cider and cider-nrepl, it's refusing to acknowledge a simple namespace declaration telling me "Namespace not found" |
| 01:46 | alexyakushev | By simple you mean this namespace of yours doesn't depend upon anything else? |
| 01:47 | aaelony | the dependency is in the project.clj file. By simple, I mean that there is exactly one. |
| 01:49 | aaelony | e.g. (ns blah.core (:require [clj-vw.core :as vw])) ;; Namespace not found. <-- this worked fine before the cider upgrade |
| 01:49 | aaelony | project.clj includes [engagor/clj-vw "1.0.0-RC6"] |
| 01:50 | alexyakushev | Does it complain about "blah.core" or "clj-vw.core"? |
| 01:50 | aaelony | hard to tell. it only says "Namespace not found" |
| 01:50 | alexyakushev | :-/ Those Clojure error reporting |
| 01:50 | aaelony | same for (use 'clj-vw.core) |
| 01:51 | luxbock | aaelony: you can see the stacktrace with C-c C-s |
| 01:51 | alexyakushev | *exceptions |
| 01:51 | aaelony | luxbock: C-c C-s is undefined |
| 01:52 | luxbock | M-x cider-visit-error-buffer then |
| 01:52 | aaelony | "No *cider-error* buffer" |
| 01:52 | aaelony | something is off |
| 01:53 | aaelony | auto-completion works in repl window though... |
| 01:53 | aaelony | ; CIDER 0.8.2 (Java 1.8.0_20, Clojure 1.6.0, nREPL 0.2.6) |
| 01:54 | alexyakushev | Did you launch cider via "cider-jack-in"? |
| 01:54 | aaelony | I did: C-c M-j |
| 01:55 | alexyakushev | And you were in one of your project's files at the time you did it? |
| 01:55 | aaelony | I was in the core.clj file |
| 01:55 | aaelony | relaunching with M-x cider-jack-in |
| 01:56 | alexyakushev | From core.clj it should be fine too |
| 01:56 | aaelony | there may be another mode interfering because I need to M-x clojure-mode first |
| 01:57 | alexyakushev | Hm, that should happen automatically |
| 01:57 | luxbock | aaelony: for me it shows cider[namespace-of-file-i-am-in] in my modeline after I've used cider-jack-in |
| 01:58 | aaelony | For me, it does not happen automatically. Evaluation of the (ns ..) still leads to "Namespace not found" |
| 02:00 | aaelony | luxbock: I do see at the bottom of emacs, below the writing area an area with (Clojure cider[blah.core]) |
| 02:00 | aaelony | nothing evaluates though. not even (range 10) |
| 02:00 | luxbock | aaelony: maybe you can post your project.clj and profiles.clj file to refheap or somewhere else? |
| 02:01 | aaelony | sure, but it is pretty barren |
| 02:01 | luxbock | that's good :) |
| 02:01 | aaelony | https://www.refheap.com/95735 |
| 02:03 | luxbock | what about profiles.clj? |
| 02:03 | luxbock | and what does M-x cider-version tell you? |
| 02:03 | aaelony | profiles.clj: {:user {:plugins [[cider/cider-nrepl "0.8.2"]]}} |
| 02:04 | aaelony | CIDER 0.8.2 |
| 02:05 | aaelony | could there be some mode interfering? |
| 02:06 | alexyakushev | Let's try again. Do "M-x cider-quit", and then just to be sure "killall java" from the shell |
| 02:06 | aaelony | lein repl works fine for the same code, so it's definitely a cider issue |
| 02:06 | alexyakushev | Then do M-x cider-jack-in again |
| 02:07 | aaelony | what does killall java do? I wouldn't want to kill all java progams on the box... |
| 02:08 | alexyakushev | Hm ok, I just usually don't run any |
| 02:08 | alexyakushev | You can do "ps aux | grep java" and verify that no of the running java instances refer to Clojure |
| 02:09 | aaelony | to instances refer to CLojure |
| 02:09 | alexyakushev | ? |
| 02:10 | aaelony | ps aux | grep java simply returns the grep command itself |
| 02:10 | alexyakushev | Good |
| 02:11 | alexyakushev | Now repeat "M-x cider-jack-in", ideally from project.clj file |
| 02:11 | aaelony | ok |
| 02:11 | alexyakushev | Were you thrown into REPL buffer? |
| 02:12 | aaelony | yes |
| 02:12 | alexyakushev | And if you type something there it works? |
| 02:12 | aaelony | with a nice autocomplete functionality |
| 02:12 | aaelony | the REPL buffer works fine |
| 02:12 | alexyakushev | OK |
| 02:12 | alexyakushev | And code buffer still doesn't? |
| 02:12 | aaelony | the trouble is that opening a source file and evaluation of any code block does not work |
| 02:12 | aaelony | correct |
| 02:13 | alexyakushev | Let's check this |
| 02:13 | alexyakushev | Do the following in the code buffer: "F1-k C-x C-e" |
| 02:13 | alexyakushev | And say which function this binding points to |
| 02:13 | rritoch | In a leiningen plugin, what is the best method of attaining the compiled classes folder? I'm using (str (:target-path project) "/classes/") but I'm not sure if that will still work if profiles modify the target-path. |
| 02:15 | aaelony | normally, I evaluate a line with C-x C-e (which currently does not work). Doing F1-k C-x C-e on the ns codeblock opened a window stating "C-x C-e runs the command lisp-eval-last-sexp, which is an interactive compiled Lisp function in `inf-lisp.el'. ..." |
| 02:15 | Viesti | hum, seeing this then using ClojureScript 0.0-2665 and simple-brepl 0.1.2 (which uses piggieback "0.1.3"): java.lang.IllegalArgumentException: No single method: _setup of interface: cljs.repl.IJavaScriptEnv found for function: -setup of protocol: IJavaScriptEnv, compiling:(cemerick/piggieback.clj:149:5) |
| 02:15 | Viesti | s/then/when |
| 02:16 | alexyakushev | aaelony: that's what I was asking. It means that CIDER haven't properly initialized in code buffers |
| 02:16 | alexyakushev | Try doing "M-x cider-mode" |
| 02:16 | aaelony | alexyakushev: I believe it. How to remedy? |
| 02:16 | aaelony | M-x cider-mode: cider-mode enabled |
| 02:17 | alexyakushev | Now try evaluating anything in the buffer |
| 02:17 | aaelony | no change |
| 02:17 | aaelony | "Namespace not found" |
| 02:17 | alexyakushev | But "F1-k C-x C-e" now refers to "cider-eval-last-sexp", right? |
| 02:18 | luxbock | Viesti: it's probably because of the new CLJS REPL changes, that the third party REPL's haven't adapted yet |
| 02:18 | luxbock | https://github.com/clojure/clojurescript/wiki/Custom-REPLs |
| 02:18 | aaelony | alexyakushev: yes |
| 02:19 | aaelony | alexyakushev: cider-eval-last-sexp &optional PREFIX) |
| 02:19 | aaelony | (cider-eval-last-sexp &optional PREFIX) |
| 02:20 | aaelony | alexyakushev: something is still interfering though |
| 02:20 | Viesti | luxbock: yep, piggieback and maybe others need an update |
| 02:20 | Viesti | should look more into it :) |
| 02:21 | Viesti | seems that there is an issue for this already: https://github.com/cemerick/piggieback/issues/35 |
| 02:21 | alexyakushev | aaelony: Well, I don't really know what could be the cause. I would try to reinstall CIDER and restart Emacs, slight chance that would help |
| 02:22 | AWizzArd | I just updated cider to 0.8.2 and now cider-connect does no longer automatically pick up the ports. I guess it still should? |
| 02:23 | alexyakushev | aaelony: Have you maybe tried other REPL stuff, like inf-clojure? That might interfere |
| 02:23 | AWizzArd | The file .nrepl-port is written though. |
| 02:23 | aaelony | alexyakushev: yes, I agree. What is the best way to reinstall CIDER? M-x package-install [ret] cider [ret] ? |
| 02:23 | alexyakushev | aaelony: That, or maybe remove the package first and then install anew |
| 02:24 | aaelony | alexyakushev: ok, will try to remove and reinstall. |
| 02:24 | alexyakushev | AWizzArd: Can't say about 0.8.2, but that thing works for me quite intermittently |
| 02:41 | aaelony | alexyakushev: if I do M-x cider-load-buffer, then things evaluate once again with C-c C-e |
| 02:43 | patrkris | hello people. I've made an uberjar with leiningen, but when I try to run it, I get the following exception: |
| 02:43 | patrkris | Exception in thread "main" java.lang.NoClassDefFoundError: camel_snake_kebab/core$__GT_CamelCaseString (wrong name: camel_snake_kebab/core$__GT_camelCaseString) |
| 02:44 | luxbock | aaelony: are you using some kind of a Emacs starter-kit? |
| 02:44 | patrkris | does this mean anything to any of you? for the camel-case-kebab dependency, I have excluded org.clojure/clojure |
| 02:44 | aaelony | luxbock: I am not. |
| 02:44 | aaelony | luxbock: but there may be other installed packages that interfere with cider somehow |
| 02:44 | luxbock | yeah so it seems |
| 02:45 | alexyakushev | aaelony: I think you should report this issue on Github, in CIDER's repository |
| 02:46 | aaelony | alexyakushev: okay, will do |
| 05:34 | masnun | Can anyone here help me with the lazybot? |
| 05:34 | masnun | .help |
| 05:34 | masnun | -> help |
| 05:34 | masnun | ,help |
| 05:34 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 05:37 | masnun | ,list |
| 05:37 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 05:42 | mearnsh | ,(+ 1 1) |
| 05:42 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 05:42 | mearnsh | hm |
| 05:42 | mearnsh | &(+ 1 1) |
| 05:42 | lazybot | ⇒ 2 |
| 05:43 | luxbock | ##(println "&(+ 1 1)") |
| 05:43 | lazybot | ⇒ &(+ 1 1) nil |
| 05:43 | masnun | ,(+ 1 1) |
| 05:43 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 05:45 | mearnsh | masnun: what do you want to know? it seems clojurebot (, prefix) is broken right now |
| 05:46 | masnun | mearnsh I was trying to setup lazybot for one of my rooms. I couldn't find out what the command character was |
| 05:46 | masnun | mearnsh just found out it's @ |
| 05:47 | masnun | mearnsh configured as "prepend" in the config |
| 05:47 | mearnsh | alright yeah, i see it |
| 06:05 | luxbock | is it cleaner to write (comp (partial = 7) :value) vs. #(= (:value %) 7) ? |
| 06:05 | luxbock | I feel like the first looks prettier but might be harder to parse |
| 06:10 | hellofunk | luxbock: it's a matter of taste in this particular example. but the two approaches are not always interchangable. |
| 06:12 | luxbock | I tend to use comp and partial for all the simple cases, but an anonymous function if I'd need to use them three times or more |
| 06:15 | hellofunk | luxbock: partial locks you into requiring the extra args at the end, hence why an anonymous fn is ultimately more flexible for many situations |
| 07:36 | AWizzArd | core.async + transducers: why the 1 in `(chan 1 (map mouse-loc->vec))`? https://github.com/cognitect/async-webinar/blob/master/src/webinar/core.cljs#L133 |
| 07:36 | AWizzArd | An event gets written into the channel when the mouse moves. There will be one single message in the chan, namely the mousemove event. |
| 07:36 | AWizzArd | mouse-loc->vec extracts the coordinates into a vector. Why does the channel need that extra space for a second object before writing to the chan blocks? |
| 07:54 | AeroNotix | Hmm, I can't seem to deploy to clojars. I get a 401. My login works on the clojars page itself. Just `lein deploy clojars` fails. |
| 08:01 | AeroNotix | and it works |
| 08:20 | zot | not sure whether this belongs more here on #emacs, but will start here. i'm using cider, and working on code that uses threads/agents. from within emacs/cider/repl, is there a way to kill off all of the threads previously spawned, and restart? |
| 08:20 | CookedGryphon | zot: there's shutdown-agents for agents |
| 08:21 | CookedGryphon | and if you start all your threads from a thread pool you could probably shut them down from that |
| 08:22 | zot | CookedGryphon: my memory says that that will leave my repl un-agent-able. i think i just need to add a join bit to his main so that C-c C-c will work; but figured it's good to understand whether i can deal with this gracefully. |
| 08:22 | CookedGryphon | perhaps you should look at using something like component for lifecycle management |
| 08:23 | CookedGryphon | or are you working on a general cider feature? |
| 08:23 | CookedGryphon | if it's your own code, then killing everything is a litte heavy handed and I'd consider trying to capture all the threads/agents you use and shut them down properly |
| 08:24 | zot | this is just for repl debugging — most of our code now uses component, but i'm mucking with old goo :) |
| 08:25 | afhammad | How do I get a static html file to reload without restarting repl when using chestnut? |
| 08:25 | CookedGryphon | fair enough |
| 08:25 | zot | the lein startup times are killing me, so i had crossed fingers that i could make it repl-friendly |
| 08:25 | CookedGryphon | I wonder if you could make something which resets the repl without restarting leiningen... |
| 08:26 | CookedGryphon | just leaves leiningen running in the background at the point it would normally trampoline off your process, and then have the ability to make it kill the current one and quickly fire off another |
| 08:26 | zot | yeah, that's what i was trying to figure out, but i actually haven't used threads directly in clojure — only via core.async. (i'm relatively new to clojure.) |
| 08:27 | CookedGryphon | because you're losing a lot of time in leiningen's own startup/processing etc that isn't directly the running of your own app |
| 08:30 | Frozenlock | b |
| 08:31 | zot | CookedGryphon: i know that leiningen is mostly to blame. i shed a little tear for it already :) |
| 08:32 | AWizzArd | tbaldridge: ping |
| 08:32 | tbaldridge | AWizzArd: morning |
| 08:32 | AWizzArd | Mornin’! I have an async question. |
| 08:33 | AWizzArd | why the 1 in `(chan 1 (map mouse-loc->vec))`? https://github.com/cognitect/async-webinar/blob/master/src/webinar/core.cljs#L133 |
| 08:33 | AWizzArd | An event gets written into the channel when the mouse moves. There will be one single message in the chan, namely the mousemove event. |
| 08:33 | AWizzArd | mouse-loc->vec extracts the coordinates into a vector. Why does the channel need that extra space for a second object before writing to the chan blocks? |
| 08:33 | tbaldridge | AWizzArd: it's due to the way transducers work, they can't be used with a channel without a buffer. |
| 08:34 | AWizzArd | Aah okay, thanks. |
| 08:34 | AWizzArd | I supposed it has something to do with the Transducers. But my guess was more that they would, for some reason, unpack the vector that mouse-loc->vec creates, and put two elements back to the chan or something like that. |
| 09:27 | gfredericks | CookedGryphon: I think there's a lib for that actualy |
| 09:27 | dnolen_ | Bronsa: ping |
| 09:28 | Bronsa | dnolen_: pong |
| 09:28 | gfredericks | CookedGryphon: https://github.com/technomancy/grenchman |
| 09:28 | dnolen_ | Bronsa: https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L125 |
| 09:28 | dnolen_ | Bronsa: is this true of tools.reader ? |
| 09:29 | dnolen_ | Bronsa: the requirement described in the docstring |
| 09:31 | Bronsa | dnolen_: t.r supports *in* (LineNumberingPushbackReader) or a c.t.r.reader-types/PushbackReader, which behaves like LNPR in collapsing CR/LF/CRLF |
| 09:32 | dnolen_ | Bronsa: so LNPR in tools.reader doesn't respect the requirement of the docstring? |
| 09:32 | dnolen_ | Bronsa: or are you saying we're covered |
| 09:33 | Bronsa | dnolen_: we're covered. you can either use LNPR directly or one of the t.r pushback readers, they do the right thing |
| 09:33 | dnolen_ | Bronsa: ok great |
| 09:33 | Bronsa | dnolen_: obviously you can't use .unread, you have to use the t.r unread protocol function |
| 09:34 | Bronsa | dnolen_: as in, the t.r reader won't work with c.c read, but LNPR will work with t.r read |
| 09:34 | daniel`` | libraries like timbre, what technique do they use to allow themselves to be configurable? like timbre/set-config!? |
| 09:35 | daniel`` | im writing a library which i want to be configurable by the consumer |
| 09:35 | Glenjamin | daniel``: timbre uses a single globally referenced atom, but often the best advice is to have functions which take an configuration map as their first argument |
| 09:36 | daniel`` | right, i thought it was an atom |
| 09:36 | daniel`` | Glenjamin: why would that be better, more explicit and easier to test? |
| 09:37 | Glenjamin | roughly, yes |
| 09:37 | daniel`` | monger is an example like that, you have to pass the db to most functions |
| 09:37 | Glenjamin | you can always provide a convenience namespace built on top of the context-as-arg1 functions |
| 09:38 | daniel`` | Glenjamin: i think that's what monger does actually |
| 09:38 | daniel`` | ok, thanks for reassuring me that im not going completely off road |
| 09:45 | Integralist | Hi, I was wondering if anyone knew how many times a transaction retries? Is it only one retry or does it consistenly retry forever, potentially livelocking? |
| 09:45 | Integralist | I'm referring specifically to a changing the value of a Ref within a STM transaction |
| 09:46 | dnolen_ | Bronsa: ok great, thanks! |
| 09:47 | stuartsierra | Integralist: it retries forever, but after the first try Ref transactions wait until their Refs become available, and there are some deadlock-breaking measures in the STM machinery. |
| 09:57 | Integralist | stuartsierra: thanks for that, any chance of a link or "point of reference" I can look up - I stumbled across https://groups.google.com/forum/#!topic/clojure/DBkKs7SiPj4 which suggests Clojure is effectively "deadlock" free. If that's the case then fine, but if it's not deadlock free then it would be good to know where to find information to resolve it :-) |
| 09:58 | stuartsierra | Integralist: Try http://clojure.org/refs |
| 10:06 | vijaykiran | mdrogalis: Hi |
| 10:07 | vijaykiran | mdrogalis: I thought #onyx might be the place :) |
| 10:07 | mdrogalis | vijaykiran: Not quite yet. :P PM. |
| 10:17 | hellofunk | can any heroku users comment on whether it is possible to host more than one root web domain on a single heroku app account? |
| 10:22 | luxbock | how do I tell timbre to stop all logging from the REPL? (timbre/set-level! ??) |
| 10:37 | katratxo | luxbock: set it to a high logging value? e.g. :error :fatal ? https://github.com/ptaoussanis/timbre/blob/master/src/taoensso/timbre.clj#L69 |
| 10:37 | luxbock | katratxo: thanks, I thought I had set it to :error but I think I might've restarted my REPL in between and forgot about it |
| 10:38 | luxbock | almost crashed my Emacs running an operation on 35k items where each function call was print-logging stuff via timbre |
| 10:38 | je | using Weasel to connect a REPL my project in a browser. Switching to my projects namespace I can see and interact with the "things" defined in it ie. an atom, but I don't have access to all the namespaces it requires through the aliases: (:require [retro-fever.asset :as asset]) |
| 10:38 | je | asset (not working), retro-fever.asset (working), anyone have an idea on why and possibly how to solve it? |
| 10:44 | Glenjamin | https://twitter.com/glenathan/status/552127891094650881 |
| 10:46 | Glenjamin | or, just the gif alone: http://i.imgur.com/sEE9DI0.gif |
| 10:47 | AWizzArd | I upgraded from Cider 0.7 or so to 0.8.2. When doing cider-connect the minibuffer shows no longer “127.0.0.1” and not the nrepl port, but it connects correctly. |
| 10:47 | AWizzArd | Is that the normal behaviour? |
| 10:47 | arrdem | Glenjamin: niiiice |
| 10:48 | Glenjamin | even on context, he just goes "grrrr" |
| 10:48 | Glenjamin | *in context |
| 11:18 | Kristien | Does Hickey even like himself? The human body is quite complex. |
| 11:29 | devn | Kristien: complex, eh? imagine if a human designed it. |
| 11:29 | devn | a software engineer |
| 11:30 | Kristien | In a biotechnology industry of only seventy years old. |
| 11:33 | devn | Kristien: i guess my point is that the body might qualify as "simple" by rich's definition |
| 11:34 | Kristien | I guess I'm hungry. |
| 11:34 | devn | I guess you are. |
| 11:34 | Kristien | I guess you're right. |
| 11:35 | devn | I think so. |
| 11:35 | katratxo | Kristien: nice bot |
| 11:35 | Kristien | I implemented protocols in JS. :> Protocols are very nice unlike Boo.prototype.bleh = function(…) { … }. |
| 11:36 | Glenjamin | Kristien: recently? i was looking at a few JS protocols implementations recently |
| 11:36 | Glenjamin | ended up starting a multimethod implementation: https://github.com/glenjamin/defmulti |
| 11:37 | Kristien | Glenjamin: just now, actually. I'm writing a compiler that generates code that uses the library |
| 11:37 | Glenjamin | i realised that because i so rarely use prototypes in JS, type dispatch wasn't useful |
| 11:39 | Kristien | I have only one running JS program and I use prototypes for all data structures except the AST. |
| 11:39 | Kristien | s/program/project/ |
| 11:43 | dweave | anything running on the jvm is garbage collected right? That’s not a language feature |
| 11:43 | dweave | specific to java or clojure |
| 11:43 | justin_smith | yeah, it's a vm level feature |
| 11:44 | dweave | so there’s no operation in java byte code that parallels clearing a memory cell then is that right? |
| 11:44 | justin_smith | you can assign something to nil (null) |
| 11:44 | justin_smith | but usually that isn't needed |
| 11:44 | dweave | but u don’t HAVE to |
| 11:44 | dweave | ok cool just learning me some JVM thanks |
| 11:45 | justin_smith | but assigning something to null is pretty literally clearing a memory cell |
| 11:45 | dweave | yeah |
| 11:45 | dweave | i’m interested in how JVM is different than python’s VM and it’s instruction set |
| 11:45 | dweave | python byte code is more specific to the language it seems |
| 11:46 | justin_smith | I don't know about that. Python's GC is not concurrent, that is probably the biggest difference. |
| 11:46 | dweave | for isntance I don’t think CALL_FUNCTION or anything like that would exist in java byte code |
| 11:46 | justin_smith | but java byte code is full of "create class" and "invoke method" |
| 11:46 | dweave | ah. |
| 11:47 | dweave | not jsut with GC but in general I don’t understand why one is called an interpreter and another is a vm |
| 11:47 | justin_smith | does python have a byte code spec? |
| 11:47 | dweave | not sure it’s a documented spec |
| 11:47 | dweave | that might be the biggest difference |
| 11:48 | dweave | byte code is an implementation detail in python maybe |
| 11:48 | dweave | in java it’s a spec |
| 11:48 | justin_smith | which means something like clojure can create working byte code for the vm, without creating java code. |
| 11:48 | hiredman | virtual machine isn't a very precise term |
| 11:48 | dweave | yeah |
| 11:49 | dweave | yeah hiredman i agree |
| 11:53 | Kristien | justin_smith: python has one |
| 11:53 | Kristien | but it's CPython-specific |
| 11:53 | Kristien | PyPy or Stackless may or may not implement i |
| 11:53 | Kristien | it* |
| 11:53 | Kristien | IronPython and Jython almost certainly don't. |
| 11:54 | stuartsierra | Modern JVMs are typically JIT-compilers rather than bytecode interpreters. |
| 11:55 | Kristien | Implementing bytecode interpreters is a fun exercise. |
| 11:56 | mgaare_ | Is there a rule against pushing all-java projects to Clojars? |
| 11:57 | llasram | mgaare: nope |
| 11:58 | sova | hellofunk: i am going through The Joy of Clojure and destructuring was actually the very next section of the book, haha; thanks for your help earlier with destructuring syntax and :keys (= |
| 12:02 | arrdem | does useful not have a fixed point imp'l? |
| 12:08 | zilti | I have the following annotation for timbre's "info": "(ann ^:no-check taoensso.timbre/info [Any * -> nil])" But despite the :no-check, I get type errors for not annotating the timbre functions running in the background of "info". Solution? |
| 12:09 | arrdem | zilti: isn't info a macro? |
| 12:09 | zilti | arrdem: Hmm. Yes, indeed... Ah, got it. I have to annotate taoensso.timbre/log |
| 12:09 | arrdem | zilti: I'd ask over in #typed-clojure, but my gut is that info is a macro and that you're annotating something that core.typed never checks. |
| 12:09 | arrdem | yep there you go. |
| 12:12 | zilti | arrdem: Doesn't solve the issue though unfortunately... I'll go ask #typed-clojure |
| 13:08 | daniel` | can i force lein to refetch a dependency of the same version? |
| 13:08 | arrdem | daniel`: only by purging ~/.m2 |
| 13:09 | daniel` | arrdem: ok, thanks |
| 13:09 | daniel` | thats what i did |
| 13:09 | justin_smith | arrdem: well you could just remove that one artifact rather than emptying the whole .m2 |
| 13:12 | TimMc | Emptying .m2 is OK until the day you have shitty internet access and need to rebuild something. |
| 13:14 | justin_smith | TimMc: did I ever mention the time I was at Powell's city of books, using their wifi, and I was getting odd errors so I cleared my .m2, then every artifact was corrupt, so I finally looked at the contents of one of the jars, and it was the html for a "click here to use our wifi page", which I was getting instead of any download I attempted. |
| 13:14 | arrdem | justin_smith: nice |
| 13:15 | justin_smith | goddamn them for thinking "using the internet" means "using a web browser" anyway, but I should have known better |
| 13:16 | Aeolus0 | hey guys, i'm new to clojure and can't for the life of me figure out whats wrong in my Fizzbuzz |
| 13:16 | Aeolus0 | can anyone help me? |
| 13:16 | arrdem | ~ask |
| 13:17 | justin_smith | Aeolus0: share a link to a paste of the code, and you'll get way more feedback on your code and style than you would ever want |
| 13:17 | Aeolus0 | justin_smith: https://gist.github.com/Aeolus0/14ddebf48acc22401111 |
| 13:17 | mi6x3m | can I pass arguments from a fixture to a test? |
| 13:17 | Aeolus0 | justin_smith: i know my style is atrocious :( |
| 13:17 | noonian | Aeolus0: people are usually willing to help if you post a code snippet or give more information about your error |
| 13:17 | justin_smith | Aeolus0: I made sure to say that before seeing any of your code :) |
| 13:18 | Aeolus0 | noonian: code snippet here https://gist.github.com/Aeolus0/14ddebf48acc22401111 |
| 13:18 | noonian | ah, nvm |
| 13:18 | mi6x3m-alt | Aeolus0: OK, let's see about that |
| 13:18 | justin_smith | Aeolus0: (= (mod x 5) 0) is the same as (zero? (mod x 5)) |
| 13:18 | mi6x3m-alt | function names are always lower case |
| 13:18 | arrdem | Aeolus0: extraneous () wrapping your outermost if |
| 13:19 | justin_smith | yup - also I think the if conditions are a bit off |
| 13:19 | Aeolus0 | how so? |
| 13:19 | mi6x3m-alt | yes Aeolus0, false ) positioning |
| 13:20 | Aeolus0 | mi6x3m-alt: so what would i remove, i don't see where i used an extra () |
| 13:20 | justin_smith | Aeolus0: oh, the conditions are OK, the formatting threw me off a bit |
| 13:20 | noonian | (+ (str x) " ") will throw an error because + expects a number |
| 13:20 | mi6x3m-alt | Aeolus0: an if has the form (if X Y) |
| 13:20 | noonian | it would probably be cleaner to use a cond instead of the nested ifs also |
| 13:21 | justin_smith | Aeolus0: the erroneous extra brace is on the end of the first line |
| 13:21 | Aeolus0 | noonian: ah, so i can cat two strings just by placing them next to each other right>/ |
| 13:21 | noonian | Aeolus0: the 'str' function will concatenate two strings |
| 13:21 | justin_smith | Aeolus0: () is not for grouping in clojure, ever. It's for calling functions or building list literals |
| 13:21 | Aeolus0 | noonian: thanks |
| 13:21 | Aeolus0 | justin_smith: understood |
| 13:21 | noonian | ,(str "one" 2 "three") |
| 13:21 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 13:22 | noonian | ,(str 1 2 3) |
| 13:22 | mi6x3m-alt | Aeolus0: will paste asap |
| 13:22 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 13:22 | noonian | &(str 1 2 3) |
| 13:22 | lazybot | ⇒ "123" |
| 13:22 | noonian | whats wrong with clojurebot? |
| 13:22 | justin_smith | Aeolus0: also, (FizzBuzz (range 1 100)) will not work because FizzBuzz takes a number, and you pass it a collection of numbers |
| 13:22 | justin_smith | (map Fizzbuzz (range 1 100)) will likely work |
| 13:22 | Aeolus0 | justin_smith: so how do i have it iterate over a range, will map do that? |
| 13:23 | justin_smith | yes, that is what map does |
| 13:23 | noonian | but since you are printing instead of returning a value you probably want (doseq [n (range 1 100)] (Fizzbuzz n)) |
| 13:23 | Aeolus0 | thanks jus |
| 13:23 | Aeolus0 | justin_smith: so how do i have it iterate over a range, will map do that? |
| 13:23 | justin_smith | or you could redefine FizzBuzz to take a collection |
| 13:23 | Aeolus0 | ARGH |
| 13:23 | Aeolus0 | thanks justin_smith |
| 13:23 | justin_smith | np |
| 13:23 | noonian | usually in clojure you would want to return a value of the answer instead of printing it out |
| 13:23 | godd2 | (map f (a b c d ...)) == (f(a) f(b) f(c) f(d) ...) |
| 13:24 | godd2 | oops, thats not correct syntax, but its pseudocode so its okay |
| 13:24 | Aeolus0 | thanks godd2 |
| 13:24 | mgaare | better if fizzbuzz returned a string, and the caller made decisions about how to handle/print |
| 13:24 | Aeolus0 | noonian: i know, i'm just testing for now |
| 13:25 | mgaare | for instance, your code right now isn't putting any newlines between prints, and also isn't showing the number |
| 13:25 | mi6x3m-alt | Aeolus0: is your fn supposed to print from 1 to x? |
| 13:25 | justin_smith | godd2: yeah, more like ##(= (map inc [1 2 3 4]) [(inc 1) (inc 2) (inc 3) (inc 4)]) |
| 13:25 | lazybot | ⇒ true |
| 13:25 | Aeolus0 | mi6x3m-alt: yup |
| 13:26 | Aeolus0 | mi6x3m-alt: more like given number x, find out if it's Buzz, Fizz, FizzBuzz, or none |
| 13:27 | Aeolus0 | justin_smith: one more thing, any idea about this? the output of ls is project.clj, nothing else, but lein run dosent work. Should i make a lein app and then put it in that project.clj? |
| 13:28 | noonian | project.clj is where you project configuration for leiningen goes |
| 13:28 | mgaare | Aeolus0: project.clj is a special file for configuring the project with lein - you shouldn't put application code in there |
| 13:28 | noonian | you should make a new project with lein new my-proj and stick you code in src/my_proj/core.clj |
| 13:28 | Aeolus0 | got it |
| 13:29 | Aeolus0 | done, but lein run now says No :main namespace specified in project.clj. |
| 13:29 | noonian | usually you would test code like this in the repl |
| 13:29 | Aeolus0 | true, and i've gotten it to work in the repl |
| 13:30 | Aeolus0 | but now when it comes down to actually making it |
| 13:30 | AeroNotix | Aeolus0: the project.clj file needs a :main key for lein run to work |
| 13:30 | noonian | to get lein run to work, write a function for your entry point like (defn go [] (doseq [n (range 1 100)] (Fizzbuzz n))) and run with: lein run -m my-proj.core/go |
| 13:30 | Aeolus0 | it's derping hard. Most tutorials don't go into the structure of a formal program |
| 13:30 | Aeolus0 | just how to make it work in the REPL |
| 13:30 | AeroNotix | :main my-proj.core |
| 13:30 | Moses_ | Do people use this IRC for clojurescript, or is there a separate IRC for that? |
| 13:30 | AeroNotix | and in my-proj.core you should have a (def -main [] ) function |
| 13:30 | AeroNotix | Moses_: cljs is fine here |
| 13:31 | noonian | lein run with no options will look for a -main function in the namespace specified with the :main key in project.clj |
| 13:31 | pandeiro | Moses_: there is #clojurescript too |
| 13:31 | noonian | but clojurescript questions are fine here too |
| 13:31 | justin_smith | Moses_: there is also a #clojurescript, but there is plenty of cljs traffic here, and more people |
| 13:31 | alexyakushev | I wonder why default leiningen template creates a scaffolding with -main function and gen-class, but misses :main in configuration |
| 13:31 | AeroNotix | alexyakushev: bollocks it misses it |
| 13:31 | AeroNotix | Source: You know, I use lein. |
| 13:32 | AeroNotix | derp, you're right |
| 13:32 | mi6x3m-alt | Aeolus0: your version fixed http://pastebin.com/K3uCTc7E |
| 13:32 | AeroNotix | I think maybe I have some templates then |
| 13:32 | mi6x3m-alt | but there are probably better ways |
| 13:33 | Aeolus0 | mi6x3m-alt: i'm really sorry to ask this, but can you rehost on gists, as pastebin has been blocked in my country :( |
| 13:33 | AeroNotix | Aeolus0: what country is that? |
| 13:33 | Moses_ | Thanks AroNotix. I have a question regarding project structure and lein in cljs. I have a chess app I'm writing. I have the core chess code in a directory called chessengine. In it I have an engine.cljs file I'd like to reference from the web part of the project. I'm including it using chess-engine.engine :as ce. |
| 13:33 | AeroNotix | Russia? |
| 13:33 | Moses_ | I'm getting nameToPath not found error |
| 13:33 | Aeolus0 | India :| |
| 13:33 | AeroNotix | Moses_: I don't personally do cljs. |
| 13:33 | crash_ep | wasn't GitHub also blocked in India? |
| 13:33 | alexyakushev | Wow that's some really dangerous website to block |
| 13:33 | Aeolus0 | i'm slowly working my way through high school here until i can go back to the USA |
| 13:34 | Aeolus0 | AeroNotix: yup, technically, but it still works for me |
| 13:34 | alexyakushev | All the cool kids access Pastebin from I2P to avoid being SWATed |
| 13:34 | AeroNotix | alexyakushev: Russia tried banning github. |
| 13:34 | noonian | Moses_: you can't use cljs code in clj, if you mean use it from another cljs file you just need it in :source-paths in leiningen |
| 13:34 | alexyakushev | AeroNotix: I know. And Pastebin too |
| 13:34 | AeroNotix | alexyakushev: Don't worry, your third-world countries will catch up soon. |
| 13:35 | Moses_ | Its there noonian |
| 13:35 | Moses_ | Wiat... its not there |
| 13:35 | Aeolus0 | AeroNotix: can you rehost that paste for me please, i'd realy like to see where i went wrong |
| 13:35 | Moses_ | Thanks |
| 13:35 | mi6x3m-alt | Aeolus0: PM'd |
| 13:35 | AeroNotix | Aeolus0: https://gist.github.com/AeroNotix/180fb70487a2a18d6054 |
| 13:36 | noonian | Moses_: you need to make sure the file path matches the namespace declaration also |
| 13:36 | mgaare | good thing India didn't try to ban stackoverflow... whole country would grind to a halt |
| 13:36 | Aeolus0 | mi6x3m-alt: thank you so much :) |
| 13:36 | AeroNotix | mgaare: can u send me a codes |
| 13:36 | mi6x3m-alt | Aeolus0: AeroNotix too, he shared it also |
| 13:36 | Aeolus0 | mi6x3m-alt: yup, thank you too AeroNotix |
| 13:36 | AeroNotix | np |
| 13:36 | alexyakushev | AeroNotix: I live dangerously close to Russia so I may catch up sooner than I want to |
| 13:37 | AeroNotix | alexyakushev: Ukraine? |
| 13:37 | [blake| | Alaska? =P |
| 13:38 | mi6x3m-alt | Finland? |
| 13:39 | arrdem | center of the earth... |
| 13:49 | alexyakushev | AeroNotix: bingo |
| 14:00 | csd_ | How does cider look for lein? It's in my path but cider says it can't find it. |
| 14:01 | amalloy | csd_: i bet you're using mac os |
| 14:01 | nullptr | are you starting emacs from the dock on os x? |
| 14:01 | csd_ | yes |
| 14:01 | csd_ | is it looking within the .app? |
| 14:02 | nullptr | your path is probably your shell path -- you could start from terminal or include this bit of hackery: |
| 14:02 | nullptr | https://github.com/derekslager/dotfiles/blob/master/emacs.d/derek/global.el#L80 |
| 14:02 | amalloy | http://clojure-doc.org/articles/tutorials/emacs.html |
| 14:03 | csd_ | amalloy: I've used emacs + cider for a while, but I just replaced my machine and decided to switch from the terminal to the GUI version |
| 14:03 | nullptr | (inc amalloy) |
| 14:03 | lazybot | ⇒ 211 |
| 14:03 | amalloy | i use linux so can't say which of those options will work; probably both mine and nullptr's are fine |
| 14:04 | csd_ | nullptr: what do you mean by "your path is probably your shell path"? If you mean what's defined in .bashrc, lein is, and I can call `lein` from terminal. |
| 14:04 | l3dx | yesterday I got some suggestions regarding this issue https://gist.github.com/tskardal/4c149a1d8a5050b76a06 but I haven't figured out a solution yet. I would really appreciate it if someone bothered having a look :) all code available here https://github.com/tskardal/clj-snake |
| 14:04 | amalloy | csd_: i think he means that by "in my path" you mean "in my shell path", which the emacs gui doesn't know anything about |
| 14:04 | l3dx | I've tried juggling the dependency version numbers a bit, but without luck |
| 14:05 | csd_ | amalloy: I see, ok. |
| 14:12 | justin_smith | how would I go about never seeing "in /tmp/form-init-{[0-9]+}.clj" as the source of a compiler error? |
| 14:13 | justin_smith | because it is pointing me at a file that lein deletes |
| 14:13 | justin_smith | which is uselss |
| 14:13 | justin_smith | *useless |
| 14:14 | justin_smith | is there some workflow that would instead report an error in the actual source file being compiled? |
| 14:14 | justin_smith | (or in this case it looks like a runtime error, not compilation error, which makes getting the "compiling... " part of the message even more annoying |
| 14:14 | justin_smith | ) |
| 14:15 | amalloy | justin_smith: i think there's generally nothing of interest in those files. like, i have two that managed to avoid getting deleted, and all that's in them is like `(.deleteOnExit (java.io.File. "/tmp/form-init2777354737944781043.clj")) repl` what is it that you're doing that makes these turn up? |
| 14:16 | justin_smith | lein run |
| 14:17 | justin_smith | I know from the stack trace where the actual problem is, but the fact that it is reported as an error in compiling a temp file is distracting |
| 14:17 | justin_smith | also, lein trampoline run doesn't change the message |
| 14:23 | AeroNotix | in a lein template how would I indicate that I want a template to be marked as executable? |
| 14:23 | sdegutis | Hi Patrick. |
| 14:27 | AeroNotix | oh cool, :executable |
| 14:27 | sdegutis | What's some good background music to listen to while writing Clojure code (in either Emacs or IntelliJ)? |
| 14:27 | AeroNotix | sdegutis: di.fm/deep-house soma.fm/spacestation |
| 14:27 | AeroNotix | those are my usual |
| 14:27 | sdegutis | AeroNotix: thanks |
| 14:28 | mi6x3m-alt | silence |
| 14:31 | alexyakushev | di.fm/deephouse no dash |
| 14:32 | sdegutis | mi6x3m-alt: hmm interesting idea... |
| 14:32 | AeroNotix | true |
| 14:32 | sdegutis | mi6x3m-alt: I've tried that and it's not working. |
| 14:33 | mi6x3m-alt | sdegutis: not trying hard enough |
| 14:33 | verma | sdegutis: I listen to sync24 on spotify .. also carbon based lifeforms .. chill music |
| 14:33 | mi6x3m-alt | your code is suffering degraded quality :P |
| 14:33 | alexyakushev | I prefer di.fm/liquiddnb though |
| 14:33 | justin_smith | recommending the music I like to listen to would be indistinguishable from trolling |
| 14:33 | csd_ | nullptr: thanks that gist was just what I needed |
| 14:34 | sdegutis | justin_smith: that is fine |
| 14:34 | mi6x3m-alt | rick roll? |
| 14:34 | verma | AeroNotix: nice, deephouse is sound good :) |
| 14:34 | sdegutis | mi6x3m-alt: I find that listening to certain kinds of non-intensive music my mind to focus much better on coding |
| 14:34 | sdegutis | *help my |
| 14:35 | justin_smith | https://www.youtube.com/watch?v=G4g2Zjolsa0 |
| 14:35 | sdegutis | slagyr: what do you listen to when you code? |
| 14:35 | mi6x3m-alt | sdegutis: do you also support the Ballmer peak theory? |
| 14:35 | mi6x3m-alt | (I am only joking btw) |
| 14:36 | postpunkjustin | Coding on Merzbow: not even once. |
| 14:36 | postpunkjustin | Give me some nice, soothing Glenn Branca |
| 14:36 | justin_smith | haha |
| 14:37 | justin_smith | postpunkjustin: a friend of mine played with Branca, and his hearing never fully reocvered |
| 14:37 | postpunkjustin | I believe it. |
| 14:38 | postpunkjustin | That's cool, though, if you're into permanent hearing damage |
| 14:38 | postpunkjustin | I do love me some Branca, but I usually just listen to Boards of Canada or Autechre or something when I'm coding |
| 14:39 | justin_smith | the most important thing is no lyrics, I can do Beethoven, Merzbow, Ryoji Ikeda, even Coltrane |
| 14:39 | justin_smith | but today is a Merzbow day |
| 14:47 | TimMc | I've been enjoying Kalabi and Superdirt2 for programming recently. |
| 14:55 | adamhiguera | is anyone around to talk me through how, exactly, macros and namespaces interact in Clojure[Script]? |
| 14:56 | adamhiguera | [and would be kind enough to?] |
| 14:56 | mikerod | has anyone ever seen the order of java.lang.Class#getMethods changing during a runtime? |
| 14:56 | mikerod | the docs do say "The elements in the array * returned are not sorted and are not in any particular order" |
| 14:57 | mikerod | however, it always looks like they come out by name and in order of increasing arity |
| 14:57 | mikerod | per method name |
| 14:57 | amalloy | mikerod: this sounds like dangerous talk...why would you care? |
| 14:58 | mikerod | amalloy: yes, I was looking at a third party lib that may have a reflection method selection issue. I think some behavior does depend on this order coming out this way. |
| 14:58 | mikerod | and it does typically when I check. I'm just curious if it could sporadically change. I'm sure this is just JVM impl details though... |
| 15:03 | adamhiguera | I'm getting a bunch of "no such namespace" warnings at compile time, all associated with my macro, and I have no idea why |
| 15:06 | BobSchack | adamhiguera: Are the symbols / keywords you're generating in the macro have namespaces that are defined in your application? |
| 15:06 | adamhiguera | yes |
| 15:07 | adamhiguera | specifically i want my macro to (generate a) call to a function |
| 15:07 | adamhiguera | defined in my application |
| 15:07 | adamhiguera | the macro also contains a let statement |
| 15:07 | adamhiguera | establishing a bunch of bindings |
| 15:07 | adamhiguera | which should be generated |
| 15:07 | adamhiguera | based on calls to functions defined in my application |
| 15:08 | adamhiguera | my macro lives in a namespace |
| 15:08 | adamhiguera | called game.macros |
| 15:08 | adamhiguera | in a .clj jile |
| 15:09 | adamhiguera | which is required in the main file via clojurescript's :require-macro |
| 15:09 | adamhiguera | and at complication i get a bunch of warnings |
| 15:09 | adamhiguera | "no such namespace: game.macros" |
| 15:10 | adamhiguera | which leads me to believe that it's resolving symbols in its own namespace? |
| 15:10 | amalloy | adamhiguera: is there some reason you are writing a bunch of prose for a vague description of what's going wrong, instead of gisting some code and an actual compilation error? |
| 15:10 | adamhiguera | i figured it would be too bereft of context |
| 15:10 | amalloy | like, i have some guesses about what you're doing wrong, but it'd be so much easier with something real to work with |
| 15:10 | adamhiguera | but if that's preferred, i'd be glad to |
| 15:11 | adamhiguera | is gist different from pastebin? |
| 15:11 | amalloy | adamhiguera: no |
| 15:11 | tcrayford____ | it's a different website |
| 15:11 | tcrayford____ | same concept |
| 15:11 | TEttinger | http://gist.github.com allows multiple files |
| 15:12 | TEttinger | refheap is also liked in clojure community |
| 15:13 | alexyakushev | refheap also has a really easy to install Emacs plugin |
| 15:14 | adamhiguera | hopefully relevant snippets |
| 15:14 | adamhiguera | http://pastebin.com/S2zvrZpT |
| 15:14 | adamhiguera | every line |
| 15:14 | adamhiguera | given |
| 15:14 | adamhiguera | is one where i am using the macro |
| 15:14 | adamhiguera | "effect-with-pending-input" |
| 15:15 | adamhiguera | i've also included the require statement in the file where i use the macro |
| 15:15 | mercwithamouth | o_O |
| 15:16 | amalloy | adamhiguera: @state looks like it should be @~'state, right? |
| 15:16 | amalloy | oh nm, i see the ~ around the [] |
| 15:16 | adamhiguera | no, @state is an atom |
| 15:17 | adamhiguera | or rather state is an atom |
| 15:17 | adamhiguera | in the calling file |
| 15:17 | adamhiguera | that i'm derenferencing |
| 15:17 | amalloy | right, i'm just saying i don't think you have the quoting right in all cases |
| 15:17 | adamhiguera | that's definitely possible |
| 15:17 | adamhiguera | also the following macro |
| 15:18 | amalloy | like look at target, in the (if target ...). that should be (if ~'target ...), if you're going to use bare symbols instead of gensyms |
| 15:18 | mgaare | I think you need to do @'~state |
| 15:18 | amalloy | mgaare: no, he's already unquoting the whole let vector |
| 15:19 | amalloy | it's a really weird way to do things, but it's not actually wrong |
| 15:19 | mgaare | amalloy: in line 9-12 I mean |
| 15:19 | amalloy | i'm aware |
| 15:19 | mgaare | oh, yeah, ok |
| 15:19 | mgaare | I see what's happening now |
| 15:20 | mgaare | yeah, that's confusing :D |
| 15:20 | adamhiguera | i'm trying to contribute to someone else's project |
| 15:20 | adamhiguera | and they do it this way |
| 15:20 | adamhiguera | coming from CL |
| 15:20 | adamhiguera | i would just not unquote anything |
| 15:20 | adamhiguera | in the let vector |
| 15:20 | adamhiguera | however i definitely do not want gensyms |
| 15:21 | amalloy | adamhiguera: right, so then you still need to unquote target |
| 15:21 | amalloy | or rather, re-quote it, by taking it out of backquote and into normal quote |
| 15:21 | amalloy | ~'target |
| 15:21 | clojurebot | Cool story bro. |
| 15:21 | adamhiguera | so what's happening is |
| 15:21 | adamhiguera | the "target" in (if target ...) |
| 15:22 | adamhiguera | is being generated as a gensym |
| 15:22 | amalloy | well, not a gensym |
| 15:22 | amalloy | but it's being namespace-qualified |
| 15:22 | mgaare | adamhiguera: no, it's being treated as a symbol in the current namespace, rather than the one in the function |
| 15:22 | amalloy | into (if game.macros/target ...) or whatever |
| 15:22 | adamhiguera | for some reason i was under the impression |
| 15:22 | adamhiguera | that syntax-quoted forms |
| 15:23 | adamhiguera | e.g. `(etc and so on) |
| 15:23 | adamhiguera | would macro-expand into the namespace |
| 15:23 | adamhiguera | where the form is expanding |
| 15:23 | adamhiguera | *with symbols qualified into |
| 15:23 | adamhiguera | is that not happening here for some reaons or do i fundamentally misunderstand backtick? |
| 15:23 | amalloy | adamhiguera: this is basically a mistaken impression |
| 15:24 | mgaare | adamhiguera: you want it to be the local binding, not a namespace qualified symbol |
| 15:24 | amalloy | also, could you stop hitting enter after every four words? a sentence is easier to read on one line than on six |
| 15:24 | adamhiguera | and things in let vectors are not namespace-qualified? |
| 15:25 | mgaare | adamhiguera: no, those are local bindings |
| 15:25 | adamhiguera | sorry, habit i picked up from gchat and other irc channels, where the preference is the opposite. thanks for your patience. |
| 15:27 | amalloy | adamhiguera: so, basically it is like this. ` namespace-qualifies all symbols, using the context of the namespace in which the ` form exists. this is all divorced from macros entirely, but in practice the ` form is usually inside a macro definition, so the context is that of the macro, rather than where it's expanded into |
| 15:28 | amalloy | so in the cases where you want a symbol with no namepsace, typically to name a local, you have to use the basic quote instead, usually via like `(let [~'x ...] (inc ~'x)) |
| 15:29 | amalloy | your code expands to something like this: ##'`(let ~['target 1] (if target ...)) |
| 15:29 | lazybot | ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/let)) (clojure.core/list [(quote target) 1]) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote if)) (clojure.core/list (quote clojure.core/target)) (clojure.core/list (quote ...))))))) |
| 15:29 | amalloy | &`(let ~['target 1] (if target ...)) |
| 15:29 | lazybot | ⇒ (clojure.core/let [target 1] (if clojure.core/target ...)) |
| 15:29 | amalloy | where of course what you really want is ##`(let ~['target 1] (if ~'target ...)) |
| 15:29 | lazybot | ⇒ (clojure.core/let [target 1] (if target ...)) |
| 15:29 | adamhiguera | amalloy: so in my example, e.g. "target" resolves into game.macros/target because that's how backtick works, and then in the expanding context, that namespace doesn't know anything about game.macros, so i have problems. |
| 15:30 | amalloy | yes |
| 15:30 | adamhiguera | aaaahhhh |
| 15:30 | adamhiguera | i begin to understand |
| 15:30 | adamhiguera | i was indeed very mistaken about how syntax-quoting and namespaces interact, and this conversation has been very helpful |
| 15:31 | adamhiguera | do i need to be doing something similar with symbols i expect to be available in the expanding context, e.g. "if"? |
| 15:31 | amalloy | adamhiguera: if is available in every namespace |
| 15:32 | adamhiguera | ok, but in my example, will "if" become a qualified game.macros/if in macroexpansion? |
| 15:32 | amalloy | adamhiguera: i mean, try it and see, right |
| 15:33 | amalloy | &`(if 1 2 3) |
| 15:33 | lazybot | ⇒ (if 1 2 3) |
| 15:33 | adamhiguera | clojurescript adds an extra level of confusion to all of this, since macros have to live in a clojure namespace that none of the clojure code can know about |
| 15:54 | sdegutis | How does Clojure compare to Scala in performance and speed? |
| 15:56 | dnolen_ | sdegutis: http://benchmarksgame.alioth.debian.org/u32q/compare.php?lang=scala&lang2=clojure |
| 15:56 | sdegutis | I never could understand this website |
| 15:56 | stuartsierra | sdegutis: In real-world application code, there is likely no difference. |
| 15:57 | stuartsierra | Both are going to be orders-of-magnitude faster than interpreted scripting languages like Python or Ruby; but slower than hand-tuned C. |
| 15:58 | ToxicFrog | IME, clojure's startup times are worse than Scala's already pretty bad ones |
| 15:58 | ToxicFrog | But once up and running there's not much difference |
| 15:58 | sdegutis | How does Clojure compare to Java 8 in terms of developer-friendliness? |
| 15:58 | TimMc | ~alioth |
| 15:58 | clojurebot | alioth is http://www.ro-che.info/ccc/02.html |
| 15:58 | tcrayford____ | sdegutis: that's a very subjective question |
| 15:59 | sdegutis | (I'm biased towards liking static typing.) |
| 15:59 | TimMc | huh |
| 15:59 | tcrayford____ | depends on your background alot |
| 16:01 | TimMc | CCC is gone? |
| 16:01 | TimMc | Maybe just down. |
| 16:02 | ToxicFrog | sdegutis: I haven't used Java 8, but I'm in favour of Java 7 dying in a fire and if I insisted on static typing on the JVM I'd use Scala instead, or, for simple things, clojure with core.typed |
| 16:02 | TimMc | clojurebot: forget alioth |is| http://www.ro-che.info/ccc/02.html |
| 16:02 | clojurebot | I forgot that alioth is http://www.ro-che.info/ccc/02.html |
| 16:03 | TimMc | clojurebot: alioth |is| https://ro-che.info/ccc/02.html |
| 16:03 | clojurebot | Ok. |
| 16:05 | sdegutis | ToxicFrog: why such contempt for J7? |
| 16:06 | ToxicFrog | sdegutis: because, like J6 and J1.5 before it, it's tedious and unpleasant to use. |
| 16:06 | sdegutis | Is the start-up time of J8 significantly faster than a pure-Clojure project? |
| 16:07 | mgaare | should be |
| 16:07 | ToxicFrog | I don't know about J8, but J7 is dramatically faster. |
| 16:07 | ToxicFrog | Loading the clojure core libraries is cripplingly expensive. |
| 16:07 | sdegutis | Cool, thanks. |
| 16:08 | ToxicFrog | There's some investigation and number crunching from earlier in the year: http://nicholaskariniemi.github.io/2014/03/19/solving-clojure-boot-time.html |
| 16:08 | ToxicFrog | "Simple desktop Clojure programs start about 35x more slowly than their Java counterparts. Clojure Android apps start as little as 6x more slowly than their Java counterparts, but the base start time is much higher so the problem is worse." |
| 16:09 | tcrayford____ | (and clojure programs typically ship code rather than bytecode, so you have too compile it all each time) |
| 16:10 | sdegutis | My Clojure app ships as an uberjar. |
| 16:10 | sdegutis | Leiningen makes that very easy to do. |
| 16:10 | ToxicFrog | tcrayford____: do they? I always ship an uberjar, which I thought contained bytecode. |
| 16:11 | tcrayford____ | yeah, but libs always ship as code |
| 16:11 | tcrayford____ | so every compile you have to compile the world |
| 16:12 | ToxicFrog | tcrayford____: right, but if you're shipping an uberjar, everything is compiled into it. |
| 16:12 | sdegutis | Maybe the uberjar just contains jars containing raw source for each lib? |
| 16:13 | tcrayford____ | it does that too, but if you :aot (which lein does by default), you'll have real bytecode in there |
| 16:14 | gfredericks | I think uberjars have everything at the top level (no nested jars) and if you're AOTing your own code then that applies to the libraries too |
| 16:14 | gfredericks | AOT is transitive whether that's your own namespaces or the lib's |
| 16:15 | tcrayford____ | yeah, it does |
| 16:15 | tcrayford____ | and yeah, no nested jars |
| 16:16 | tcrayford____ | reminder that jar files are just zip files and emacs/vim can explore them |
| 16:16 | tcrayford____ | (or you can just unzip em) |
| 16:26 | celwell | Hi, my project runs well with 'lein ring server', but when I 'lein beanstalk deploy development' I get: Exception in thread "main" java.lang.NullPointerException, compiling:(auth.clj:1:1) |
| 16:26 | celwell | It was deploying fine until I added clj-facebook-graph to the project |
| 16:27 | celwell | Any ideas? |
| 16:27 | celwell | I'm seeing this in the stacktrace: clj_facebook_graph.auth$loading__4958__auto__.invoke(auth.clj:1) |
| 16:27 | Atarian | Anyone familiar with the Cider package for Emacs? |
| 16:28 | celwell | Atarian: somewhat. |
| 16:29 | Atarian | Every time I try to run cider-jack-in, it fails with " Unable to resolve var: cider.nrepl.middleware.apropos/wrap-apropos in this context" |
| 16:29 | celwell | Atarian: hmm idk |
| 16:29 | Atarian | I'm using 0.9.0-SNAPSHOT from MELPA |
| 16:30 | llasram | Atarian: And do you have the 0.9.0-SNAPSHOT plugin middleware in your profiles.clj? |
| 16:31 | Atarian | This is my line in profiles.clj: {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]}} |
| 16:31 | Atarian | I'm afraid I'm a complete clojure noob, just trying to set up my env |
| 16:31 | llasram | Yeah, that should do it |
| 16:31 | Atarian | Bah |
| 16:32 | llasram | Well, unfortunately MELPA's "build any old commit" policy makes it difficult to be certain things are synced up |
| 16:32 | llasram | I'd recommend using MELPA stable instead -- I can verify that 0.8.2 works |
| 16:32 | Atarian | IC, I'll delete my .emacs.d and start again, thanks |
| 16:33 | llasram | I don't know if you need to go that far... |
| 16:33 | llasram | But whatever you find easiest |
| 16:33 | llasram | If you're a new Emacs user, you might find it easier to use Lighttable or Cursive instead, and tackle Emacs later |
| 16:34 | Atarian | I use Emacs quite alot, but for builtin stuff (C / LaTeX etc) |
| 16:34 | llasram | Gotcha |
| 16:35 | Atarian | I've never had to use the packages before... right, gotta quit emacs, tnx for your help |
| 16:35 | llasram | np |
| 16:35 | llasram | good luck |
| 16:36 | Atarian | Chrs |
| 16:37 | celwell | I can't figure out why 'lein uberjar' would work but 'lein beanstalk deploy' get NullPointerException when presumably building the jar/war. |
| 16:38 | TEttinger | celwell, sounds like a problem with the beanstalk plugin |
| 16:38 | celwell | It worked perfectly until I added clj-facebook-graph into the mix |
| 16:38 | celwell | currently runs fine with 'lein ring server' |
| 16:38 | TEttinger | maybe the version you're using of that is incompatible with... what even is beanstalk... |
| 16:39 | celwell | it handles upload / environment build of elastic beanstalk apps on AWS |
| 16:39 | celwell | it's a nice plugin overall |
| 16:40 | weavejester | celwell: clj-facebook-graph has some pretty old dependencies. It may be that dependencies from clj-facebook-graph are overriding later ones |
| 16:40 | celwell | when i lein ring server I do get: WARNING: get already refers to: #'clojure.core/get in namespace: clj-facebook-graph.client, being replaced by: #'clj-facebook-graph.client/get |
| 16:41 | weavejester | That indicates sloppy design, but it probably isn't the cause of your problem. |
| 16:41 | weavejester | Make sure that clj-facebook-graph isn't overriding any later dependencies. |
| 16:43 | celwell | I don't understand why it would override anything. Even if it uses the same packages but different versions, isn't the newer one used? this is its dependencies: https://github.com/maxweber/clj-facebook-graph/blob/master/project.clj |
| 16:43 | celwell | As I said, it runs fine with 'lein ring server' so I don't know what would be different from 'beanstalk deploy' |
| 16:44 | amalloy | celwell: the newer one is not necessarily used. dependency versions are a giant hairball |
| 16:45 | celwell | A google api lib I'm using always throws the same warngin (for the same function name); that lib loads fine though: WARNING: get already refers to: #'clojure.core/get in namespace: clj-oauth2.client, being replaced by: #'clj-oauth2.client/get |
| 16:45 | celwell | WARNING: get already refers to: #'clojure.core/get in namespace: clj-facebook-graph.client, being replaced by: #'clj-facebook-graph.client/get |
| 16:45 | celwell | That first one is that google api |
| 16:45 | arrdem | yeah that's just library maintainers being sloppy and not using exclusions to escape warnings |
| 16:46 | weavejester | celwell: Lein/Maven uses the version "closest" to your project file. So any dependencies in your project file take priority, followed by dependencies of dependencies, and so forth. |
| 16:48 | justin_smith | celwell: that clojure version? I have had issues with lein beanstalk and the 1.7 snapshots |
| 16:48 | celwell | The only conflicts I see are [org.clojure/clojure "1.3.0"] in the fb library, and [org.clojure/clojure "1.6.0"] in my project.clj. And also 'compojure' 0.6.4 vs. 1.1.8 |
| 16:49 | celwell | justin_smith: sorry what';s your question "that clojure version?" |
| 16:49 | justin_smith | sorry s/that/what |
| 16:49 | justin_smith | that answered it |
| 16:50 | weavejester | celwell: There's likely a lot more than that. The Ring versions will be different, and the AWS SDK shares some dependencies with clj-http IIRC. |
| 16:50 | Atarian | Sorry to interrupt again, same issues with cider/cider/nrepl, error: "java.lang.RuntimeException: Unable to resolve var: cider.nrepl.middleware.apropos/wrap-apropos in this context" Anybody else had this? emacs24, cider 0.8.2, cider-nrepl 0.8.2 java.lang.RuntimeException: Unable to resolve var: cider.nrepl.middleware.apropos/wrap-apropos in this context |
| 16:50 | weavejester | celwell: lein deps :tree will give you a more detailed overview. |
| 16:51 | celwell | lein deps gives me: (Possibly confusing dependencies found:) |
| 16:51 | celwell | ([org.clojars.freeagent/clj-facebook-graph "0.4.0"] -> [org.clojure/data.json "0.1.3"]) |
| 16:51 | celwell | ( overrides) |
| 16:51 | celwell | ([gapi "1.0.1"] -> [org.clojure/data.json "0.2.3"]) |
| 16:51 | celwell | ( |
| 16:51 | celwell | Consider using these exclusions:) |
| 16:51 | celwell | ([gapi "1.0.1" :exclusions [org.clojure/data.json]]) |
| 16:51 | celwell | nil |
| 16:51 | celwell | ([org.clojars.freeagent/clj-facebook-graph "0.4.0"] -> [ring/ring-core "1.1.6"]) |
| 16:51 | celwell | ( overrides) |
| 16:51 | celwell | ([compojure "1.1.8"] -> [ring/ring-core "1.2.2"]) |
| 16:51 | celwell | ( |
| 16:51 | sdegutis | oh hi #clojure |
| 16:51 | arrdem | refheap pls <3 |
| 16:51 | sdegutis | nice to see you're extremely active suddenly |
| 16:53 | celwell | oops, got throttled in irc. basically i got some messages about "Consider using these exclusions" |
| 16:53 | celwell | Is there something I can read about exclusions I'm not sure how they work and if they would help me here |
| 16:53 | TimMc | celwell: Yes, IRC is not a pastebin. :-) |
| 16:54 | celwell | Here is the dump of lein deps :tree, thanks for any insight: https://gist.github.com/celwell/ab210910c531b56dc314 |
| 16:55 | celwell | I still don't see why it would work in lein ring server and not when deploying, but oh well |
| 16:55 | weavejester | celwell: Both lein-ring and lein-beanstalk inject dependencies into the project map |
| 16:56 | weavejester | celwell: It's possible they're conflicting in some manner |
| 17:00 | Atarian | brb |
| 17:04 | matt` | Think I got it btw, project was created using an OLD version of leiningen, created a new project and the nrepl ran! |
| 17:04 | Atarian | Oops, that was me |
| 17:07 | celwell | I've added a bunch of exclusions (at the advice of :pedantic? :warn). Not more overrides it seems. But same NullPointerException... |
| 17:44 | csd_ | Clojure is complaining because I have `def a (foo)` before `foo` is defined, although I do a `declare foo`. The error goes away if I wrap in an anonymous function: def a ((fn [] (foo))). Is there a better way to get around this error? |
| 17:44 | sdegutis | csd_: are you using that library that lets you take away the top-level parens? |
| 17:45 | ticking_ | sdegutis: don't tell me something like that exists? |
| 17:45 | AeroNotix | Yeah it does |
| 17:45 | csd_ | sdegutis: omitted due to my own sloppiness |
| 17:45 | ticking_ | urgh |
| 17:45 | sdegutis | ticking_: it's simple, yet powerful |
| 17:46 | ticking_ | sdegutis: sounds braindead to me :P |
| 17:46 | ticking_ | csd_: when you're not defining foo before the def I'm actually surprised the second one works |
| 17:46 | csd_ | I didnt verify that it gives the correct value, but the error goes away |
| 17:47 | csd_ | I thought declare was supposed to fix this sort of problem though |
| 17:47 | ticking_ | csd_: I think the code get's actually evaluated multiple times |
| 17:47 | ticking_ | during compile time to see if it creates a function that has to be compiled |
| 17:47 | ticking_ | and during runtime to initialize up to date values |
| 17:47 | sdegutis | csd_: declare is meant for when you use the thing in the body of an anonymous function |
| 17:47 | sdegutis | csd_: so you actually found the correct way to use declare by accident |
| 17:48 | ticking_ | sdegutis: hum? |
| 17:48 | hiredman | csd_: declare just creates the var, which still has no value until def'ed, so (foo) is trying to invoke the value of a var that has no value |
| 17:48 | sdegutis | csd_: it's there for the compiler, so it knows it's going to be defined later in the program's source code but will exist before that code runs at runtime |
| 17:48 | hiredman | csd_: your anonymous function likely works only because you haven't restarted your repl |
| 17:48 | hiredman | in a clean repl it would not work either |
| 17:49 | csd_ | I'm guessin it's better practice to just rearrange the code rather than to try to use something like promises? |
| 17:49 | hiredman | definitely |
| 17:49 | hiredman | promises won't work either |
| 17:49 | csd_ | whys that |
| 17:49 | ticking_ | sdegutis: why anonymous function? declare should be there to allow for correct recursive function resolving in a single pass compiler world |
| 17:49 | hiredman | you will just lock up |
| 17:49 | hiredman | csd_: you will be derefing a promise before it is delivered to |
| 17:50 | hiredman | (which blocks) |
| 17:50 | csd_ | ok |
| 17:50 | csd_ | thanks all |
| 17:51 | sdegutis | ticking_: the entire file executes in order at runtime |
| 17:51 | sdegutis | ticking_: so you cant use something before it exists, thats why you cant use foo before defining it, even if you declare it first, because declaring it doesnt make it exist |
| 17:52 | ticking_ | sdegutis: yeah, but I'm not shure I get what anonymous functions have to do with it |
| 17:52 | hiredman | nothing |
| 17:52 | sdegutis | ticking_: but if you use foo from within a closure before defining it, then declare tells the compiler that it will probably exist before it is defined, since the closure will probably be executed after foo is defined |
| 17:52 | sdegutis | hiredman: am i mistaken? |
| 17:53 | hiredman | once you are confused it is very easy to confuse yourself further |
| 17:53 | ticking_ | sdegutis: could you explain what you mean bu that |
| 17:53 | sdegutis | gtg |
| 17:53 | ticking_ | sdegutis: I think the functionality you want is this (fn foo [] (foo)) |
| 17:54 | sdegutis | sorry i got myself all confused |
| 17:54 | amalloy | (inc hiredman) |
| 17:54 | lazybot | ⇒ 65 |
| 17:54 | dnolen_ | ToxicFrog: I haven't been able to reproduce those claim on my OS X machine |
| 17:54 | dnolen_ | s/claim/claims |
| 17:56 | dnolen_ | ToxicFrog: and loading Clojure programs isn't crippling expensive - startup time for AOTed Clojure is ~750ms on my machine, ~8X slower than HelloWorld.java, not 35X |
| 17:57 | rberdeen | is there a convenient way to bind a dynamic var for the lifetime of a repl session? |
| 18:00 | rberdeen | i'd like to do something like this: https://gist.github.com/also/682bf3d3e0b0a9d7134c |
| 18:02 | justin_smith | rberdeen: in other words you want a dynamic var to act like a regular one, where you redefine it and the new definition is used in all places |
| 18:03 | rberdeen | justin_smith: just in the repl, so that I don't have to wrap everything with (binding [*dynamic* 1] ...) |
| 18:06 | postpunkjustin | rberdeen: if it's in the REPL then can't you just use def? |
| 18:07 | rberdeen | postpunkjustin: i'd like to bind a var in an existing namespace that i'm interacting with in the repl |
| 18:08 | EvanR-work | ,(range) |
| 18:08 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")> |
| 18:08 | postpunkjustin | Right, but I suspect that you can switch to that ns, def the dynamic var with whatever value you want, then switch back |
| 18:09 | postpunkjustin | Or just in the one ns if that's all you have going on |
| 18:10 | postpunkjustin | I haven't tried that myself, I usually just write a macro with a one-letter name |
| 18:11 | postpunkjustin | like (defmacro c [& body] `(binding [*foo* ~fooval] ~@body)) |
| 18:13 | aaelony | if I define a function in a repl long session and want to re-visit it's definition, why won't clojure.repl/source find it? Is there a better way to view the current definitions of functions? |
| 18:13 | aaelony | e.g. https://www.refheap.com/95769 |
| 18:16 | postpunkjustin | aaelony: check the docstring for that macro -- it says the .clj file has to be in the classpath |
| 18:16 | postpunkjustin | I don't think that's the case for functions that you're defining at the REPL |
| 18:16 | aaelony | postpunkjustin: I realize that. I'm looking for the functionality. |
| 18:17 | postpunkjustin | Ok, I was answering your question about why clojure.repl/source can't find the definition |
| 18:18 | aaelony | postpunkjustin: I understand. I think it used to work a long time ago. thanks for kindly responding though. |
| 18:18 | csd_ | How can I interact with a system library such as libpcap with Clojure? Would I need to use FFI, or can I use Java to make the library calls? |
| 18:18 | aaelony | it's a handy thing to have that I've grown accustomed to from R |
| 18:21 | amalloy | aaelony: functions don't know their source code. if you have a decent repl it should have history search, so you can search for (defn foo |
| 18:22 | zilti | csd_: You'll have to use JNI for that |
| 18:22 | csd_ | zilti: not familiar with that. sounds like a bag of worms |
| 18:22 | aaelony | amalloy: thanks. I'm spoiled because in R every object prints itself or its definition (unless it's buried in an environment). |
| 18:23 | zilti | csd_: Neither am I, and I guess there also aren't any Clojure wrappers for it... |
| 18:27 | zilti | Is there a way to tell core.typed the types of record methods? |
| 18:30 | bridgethillyer | We did some cleanup of the Clojure user group page this weekend: http://dev.clojure.org/display/community/Clojure+User+Groups |
| 18:30 | bridgethillyer | If anyone has a group that is not listed, please add it, or let me know, and I will add it for you. |
| 19:05 | toxmeister | happy 2015 clojurians! :) |
| 19:06 | godd2 | I thought we were Clojans |
| 19:06 | toxmeister | unfortunately am having once more deploy trouble w/ clojars, any one else experienced hickups in past couple of days? |
| 19:07 | toxmeister | godd2: that sounds like trojans... |
| 19:07 | grayston | @toxmeister I was just about to ask about that |
| 19:07 | godd2 | yea, they were a mighty army |
| 19:07 | godd2 | er navy? |
| 19:07 | grayston | I have a bunch of dependancies, lein deps :tree shows the jar is loaded |
| 19:07 | grayston | but try to use it and I get the FileNotFoundException, like it isn't even there |
| 19:07 | zilti | toxmeister: Yesterday morning deploying to clojars worked fine for me |
| 19:08 | grayston | was wondering is there was a way to debug lein dependancies? |
| 19:09 | zilti | grayston: You can activate the pedantic mode, then it tells you when weird stuff is going on |
| 19:10 | toxmeister | zilti: my last deploy was around 2 days ago also fine, this time it asked me for my gpg key twice, then first got a checksum validation error and later (2nd attempt) the dreaded "forbidden" again |
| 19:19 | grayston | @zilti ok, I was including an older version of the dep in project.clj. Updated the version number and lein decides to download everything |
| 19:19 | grayston | bit of a newb, but what if I had specifically wanted that older version? |
| 19:50 | david987654345 | Sorry for a newbie question, but I'm having trouble getting my clojure program to uberjar. I have two files in the src/projectname folder: core.clj and sieve.clj. I import sieve.clj into core.clj where my -main function is. When trying to uberjar it can't find sieve.clj on classpath |
| 19:51 | postpunkjustin | david987654345: does it work with "lein run"? |
| 19:54 | david987654345 | oh, it gives me this error: No :main namespace specified in project.clj. |
| 19:54 | david987654345 | |
| 19:54 | david987654345 | oh wait |
| 19:54 | david987654345 | nevermind, wrong folder (oops) |
| 19:55 | zilti | Yes, you also have to define :main in your project.clj, e.g. ":main 'projectname.core" |
| 19:56 | david987654345 | Ok, I had that and "lein run" tells me it can't find symbol s (I import sieve.core :as s) |
| 19:57 | zilti | david987654345: :import is for classes, you have to use :require |
| 19:57 | zilti | (:require [projectname.sieve :as s]) |
| 20:00 | david987654345 | Ok, I get this: " namespace 'mail-sieve-e.sieve' not found after loading |
| 20:00 | david987654345 | '/mail_sieve_e/sieve" |
| 20:04 | justin_smith | david987654345: do you define a namespace in that file? |
| 20:05 | david987654345 | At the top of my file is: (ns sieve.core) (plus all of the imports/requires) |
| 20:07 | andyf | Namespaces and file names they are defined in must "match" each other |
| 20:07 | andyf | Where I put match in quotes because dashes in namespace names must be changes to underscores in file names. |
| 20:08 | andyf | Eastwood lint tool can help you catch such mismatches in a project |
| 20:09 | justin_smith | david987654345: if the file is in ie. src/mail_sieve_e/sieve.clj it must define the namespace mail-seive-e.sieve |
| 20:09 | andyf | https://github.com/jonase/eastwood |
| 20:09 | justin_smith | if you want it to define sieve.core it should be in src/sieve/core.clj |
| 20:09 | justin_smith | and yeah, use eastwood |
| 20:10 | justin_smith | (inc eastwood) |
| 20:10 | lazybot | ⇒ 6 |
| 20:10 | justin_smith | also, consider not doing sieve.core - the .core thing is not very useful |
| 20:11 | david987654345 | That worked perfectly! I changed the sieve.clj ns to (ns mail-sieve-e.sieve) |
| 20:11 | david987654345 | Thank you all! |
| 20:11 | david987654345 | /quit] |
| 20:31 | warz | what services out there offer managed clojure app hosting, similar to something like azure or something |
| 20:32 | zilti | warz: Heroku does afaik |
| 20:33 | justin_smith | warz: a ring webapp can be deployed as a war file, which has nice automation and management and automatic scaling via eg. amazon elastic beanstalk |
| 20:33 | justin_smith | the tooling around jvm webapps is actually pretty slick when you get it sorted out |
| 20:45 | warz | ive actually been in a funk for the past few months, and havent thought of anything to code on |
| 20:46 | warz | ive had this urge for a few years to give clojure a year or more of my time, and im trying to use that to get out of this funk. haha. |
| 20:47 | warz | im close to defaulting to the real hello world, an irc client |
| 20:48 | warz | but was also trying to find something that i could incorporate clojurescript into |
| 20:51 | rritoch | warz: There are lot's of unfilled niche's available in clojure. If your looking to work with clojurescript and clojure why not build a cross-platform web browser plugin development framework? |
| 21:01 | warz | so that browser plugins can be written with clojure? |
| 21:02 | rritoch | warz: Yes |
| 21:03 | rritoch | warz: I believe firefox and chrome both facilitate javascript plugins already, Ie. may be a bit of a challenge to integrate in since you need to deal with .NET, I'm not sure if there are any .NET resources for clojure either. |
| 21:07 | dustingetz | I am having a lot of trouble defining pedestal routes; here i try to define a dynamic route and I get “200 OK: exception route not found“ or some such, can anyone spot the error? https://gist.github.com/dustingetz/15a5eda645df9694fea7 |
| 21:08 | rritoch | warz: I don't think it would be too difficult to build a .NET API though, I imagine you could develop a leiningen plugin which could generate C# code, compile it, and wrap it in Java using SWIG so you can access it from clojure. |
| 21:09 | rritoch | warz: I'm not entirely sure since it's been years since I did any Ie. plugin development. |
| 21:09 | TEttinger | IKVM should be fairly good at getting the JVM on MS .NET, it has issues with mono |
| 21:17 | rritoch | TEttinger: Did you see my latest project, lein-sablecc? Version 1.1.0 is fully functional, I've successfully generated a Lexer and AST with it, right now I'm working on "compiling" an AST into java objects so the resulting interpreted language can be accessed from clojure. |
| 21:18 | TEttinger | nice! |
| 21:18 | TEttinger | what is sable? |
| 21:18 | rritoch | SableCC is a compiler compiler, it takes a grammar file and generates java source code for the lexer and AST generation. |
| 21:19 | TEttinger | woah |
| 21:19 | TEttinger | nice work |
| 21:19 | rritoch | The plugin I built integrates SableCC with leiningen, automating the compilation and integration with leiningen projects. |
| 21:20 | lasergoat | rritoch: i spend a good chunk of my day writing browser plugin code in CLJS, and yeah, more tooling there would be amazing. I may eventually get to make some |
| 21:21 | cljsn00b | is there a way to do a blocking read similar to <!! in cljs.core.async? afaik <!! doesn't exist.. |
| 21:21 | amalloy | cljsn00b: is there a way to block in javascript? |
| 21:22 | cljsn00b | amalloy, honestly I don't really know, I'm a js n00b too :) |
| 21:22 | amalloy | there's not |
| 21:22 | cljsn00b | amalloy: good, then I don't have to try |
| 21:23 | amalloy | you should probably learn the basics of the platform you're trying to run clojure on (here, javascript), or you will be constantly surprised by simple stuff. clojure is a hosted language, so features of the host language will show through |
| 21:24 | rritoch | amalloy: You can block from javascript, but it makes the browser non-responsive if you block for too long. |
| 21:24 | cljsn00b | amalloy: you're absolutely right.. I'm trying to pick up things as I go |
| 21:25 | cljsn00b | rritoch: I wouldn't mind if my go block gets stalled until it gets input |
| 21:25 | cljsn00b | I was just wondering if there's any way at all or whether I should do it using a go-loop |
| 21:25 | rritoch | cljsn00b: It isn't that simple, I'm not joking about the browser going non-responsive |
| 21:26 | rritoch | cljsn00b: To do it safely you'll need a timeout |
| 21:26 | cljsn00b | actually that would be fine, I want to wait at most a second for response |
| 21:26 | rritoch | cljsn00b: And put the timeout token on the channel so the code knows it needs to retry |
| 21:27 | cljsn00b | can you give me a hint at which commands I should look at to achieve something like that |
| 21:27 | rritoch | cljsn00b: In that case, just do a loop that checks for input, and checks the time on every iteration. |
| 21:27 | rritoch | cljsn00b: The loop should end when you get input, or when the timeout occurs. |
| 21:28 | rritoch | cljsn00b: I only know how to do it from javascript, I haven't yet had an opportunity to use cljs. |
| 21:28 | cljsn00b | hm a go-loop with alts! might work |
| 21:28 | cljsn00b | okay, I'll try that |
| 21:28 | rritoch | cljsn00b: Just remember, the GUI thread won't be running, so all of your input will come during timeouts |
| 21:29 | cljsn00b | as I do timeouts in each loop cycle? |
| 21:29 | dnolen_ | rritoch: you cannot block JS outside of doing something computational intensive, which isn't what was meant |
| 21:30 | dnolen_ | cljsn00b: <!! is not possible, but you don't really need it anyway |
| 21:31 | cljsn00b | dnolen_: I agree, there's an ugly to get done what I need, but I was hoping for something simple |
| 21:32 | rritoch | dnolen_: Incorrect. You can block javascript with ... var data; var t = new Date().getTime(); while('undefined' == typeof data && (Date().getTIme() - t) < 1000) {}; |
| 21:32 | dnolen_ | rritoch: what is that ... doing something computational intensive |
| 21:32 | rritoch | err, the laast Date is missing a new |
| 21:32 | dnolen_ | rritoch: you're just pegging the CPU |
| 21:33 | dnolen_ | rritoch: again not what was meant |
| 21:36 | cljsn00b | "otherwise alts! will park until the first operation to become ready completes" |
| 21:36 | cljsn00b | hm, I guess blocking means blocking the entire process and parking means just blocking the go block? |
| 21:38 | dnolen_ | cljsn00b: that's right |
| 21:39 | cljsn00b | dnolen_: ok that makes sense, thanks |
| 21:43 | rritoch | dnolen_: It should also be possible to block until input is available if you use HTML5 web workers |
| 21:44 | dnolen_ | rritoch: except it isn't, the interface is only async |
| 21:49 | rritoch | dnolen_: So your saying it isn't possible to run CLJS in a worker... If you don't know the technology yourself, why do you try to teach it? |
| 21:50 | rritoch | dnolen_: I assure you that you can block using the technique I mentioned, and I believe you don't even need the timeout if you block in a worker. |
| 21:52 | lasergoat | is there some simple gotcha about classpaths and mains in lein? I have a project that works great from the repl, but when I create an ns with a -main and :gen-class and then run it via lein run, it can't find my dependencies |
| 21:53 | lasergoat | i'm sure it's something ridiculous, but i'm not sure where to look |
| 21:53 | dnolen_ | rritoch: I assure you are incorrect |
| 21:53 | dnolen_ | rritoch: having used WebWorkers before |
| 21:54 | rritoch | dnolen_: Why not try it before making yourself look stupid |
| 21:54 | justin_smith | lasergoat: your dependencies, or your namespaces in your project? |
| 21:54 | dnolen_ | rritoch: lol |
| 21:54 | dnolen_ | rritoch: successfully ignored |
| 21:54 | justin_smith | ~gentlemen |
| 21:54 | clojurebot | You can't fight in here. This is the war room. |
| 21:55 | lasergoat | justin_smith: i get an error from one of my namespaces about a dependency it can't find |
| 21:55 | lasergoat | justin_smith: so i guess it can find at least that one namespace |
| 21:55 | justin_smith | one of the dependencies from your project.clj? |
| 21:56 | lasergoat | right |
| 21:56 | justin_smith | lasergoat: are you requiring the namespace explicitly, or just using it fully qualified? |
| 21:56 | justin_smith | (for the dependency that is) |
| 21:56 | lasergoat | requiring it explciitly |
| 21:57 | lasergoat | (the require is what fails) |
| 21:57 | justin_smith | so the error is on the require, OK |
| 21:57 | lasergoat | yeah |
| 21:57 | justin_smith | can you share the namespace, or at least the ns block in a paste? |
| 21:57 | lasergoat | sure, one sec |
| 22:06 | lasergoat | justin_smith: actually, i think i figured it out, that dependency is just wrong. the real question is how it seemed to working in the repl |
| 22:06 | lasergoat | justin_smith: i'll ask again if there's anything interesting in follow up; thanks either way for your help |
| 22:06 | justin_smith | lasergoat: likely you previously loaded or required the right thing, and that doesn't go away even if you break it later |
| 22:07 | justin_smith | unless you start from scratch or use tools.namespace/refresh or whatever that is |
| 22:09 | wei | java.jdbc question, is there a good way to do string / enum interop when using postgres? |
| 22:09 | wei | I heard about using :stringtype "unspecified" in the db-spec, but it’s not working for me |
| 22:10 | lasergoat | justin_smith: yeah, i make liberal use of that |
| 22:10 | lasergoat | justin_smith: but yeah, it was probably something like that |
| 22:12 | lasergoat | wei: this should help: http://naiquevin.github.io/using-postgresqls-enum-types-with-korma.html |
| 22:13 | rritoch | Does anyone know of a clojure library that provides name value lists? I'd like to convert these AST's directly into clojure persistent data. The only thing I can think of right now is to output the AST as XML and parsing it with enlive, but that seems like overkill. |
| 22:14 | lasergoat | wei: you can ignore the korma stuff and skip down to the str->PgObject thing |
| 22:14 | lasergoat | you can take those pg objects and stuff them in the maps that you insert into pg |
| 22:14 | lasergoat | wei: and it just works |
| 22:14 | wei | lasergoat: thanks for the forward. sounds like it will work, though converting on read/write is a hassle |
| 22:15 | lasergoat | wei: it is, but it's all i got :) |
| 22:24 | toxmeister | dnolen_: thx sooo much for all the recent cljs improvements!!! not to tease, but so excited to share this v.soon - an interactive cljs/webgl viz of github commits for multiple projects: http://dev.thi.ng/20150107/0317-commits.png - doesn't show actual data yet, but v.close & can't wait! :) |
| 22:48 | luxbock | would it be possible to write a tool that walks an expression and replaces each call of a function / macro with the symbols replaced with the source code for the symbol? |
| 22:49 | luxbock | it would make interpreting stacktraces a lot easier if you could see the whole code that was getting executed |
| 22:53 | TEttinger | luxbock, that's not a bad idea, but it would need all source available to it, and once you drop into javaland... |
| 22:54 | luxbock | TEttinger: I was thinking you'd probably only want to expand symbols defined in Clojure, and not expand any of the clojure.core functions |
| 22:54 | luxbock | seeing everything expanded to the max would be interesting, but even just what I proposed would be a big help for debugging |
| 22:56 | luxbock | I'm looking at riddley's walk-exprs which takes a predicate, a transformation handler and an expression |
| 22:58 | rritoch | luxbock: In any form the first item is always the function, once you have the function you should be able to use something like the following... ##(read-string (with-out-str (clojure.repl/source into))) |
| 22:58 | lazybot | java.lang.SecurityException: You tripped the alarm! push-thread-bindings is bad! |
| 22:58 | rritoch | luxbock: I don't think that will dump any macro's though, macro's are evaluated at compile time |
| 22:58 | luxbock | rritoch: I think clojure.repl/source only works for core functions though? |
| 22:59 | luxbock | but I could create my own source function that checks the :file and :line tags in the meta-data of the symbol and read the next form there |
| 23:00 | luxbock | rritoch: thanks for your help the other day btw |
| 23:01 | rritoch | luxbock: The documentation for source says it works as long as it can find th source .clj file |
| 23:01 | clojurebot | I don't understand. |
| 23:02 | rritoch | luxbock: I assume that means it will work as long as the source wasn't produced via an eval, including entered in a REPL so it may be difficult to test. |
| 23:03 | luxbock | rritoch: yeah that appears to be the case |
| 23:05 | lasergoat | justin_smith: after all that, it just turned out to be a runaway undo of a bunch of code changes between my last repl reset and my trying out the main |
| 23:35 | patrickgombert | ,(binding [*assert* false] (assert false)) |
| 23:36 | clojurebot | #<AssertionError java.lang.AssertionError: Assert failed: false> |
| 23:36 | patrickgombert | that doesn’t seem to jive with https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L4420 |
| 23:36 | patrickgombert | I think I might be missing somthing |
| 23:40 | rritoch | patrickgombert: I think your problem is that this is a macro which means it gets evaluated at compile time. The assert isn't bound when the macro was expanded. |
| 23:41 | patrickgombert | right, thanks |
| 23:41 | rritoch | ,(do (set! *assert* false) (assert false) (set! *assert* true)) |
| 23:41 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *assert* with set> |
| 23:41 | rritoch | Hmm, well that works in my repl |