2012-02-07
| 00:00 | seancorfield | oh, and i added (:use [jayq.core :only [$ css inner]]) even tho' i'm not actually referencing any of those in my code yet :) |
| 00:04 | seancorfield | ah, just using jayq seems to be causing the compiler to munge my code... |
| 00:10 | seancorfield | ok, i swapped the order of the (:use) clauses and my code started working... |
| 00:10 | seancorfield | but the compiler seems to get pretty confused about the namespaces of symbols |
| 00:11 | seancorfield | at least, if i have more than one (:use) in a .cljs file... |
| 00:13 | seancorfield | i removed (:use [example.util :only [..]]) and tried to use the jayq stuff... now i get an error that $elem has no function innerHTML on it... i hate javascript :( |
| 00:13 | dnolen | seancorfield: innerHTML is not a property |
| 00:13 | dnolen | seancorfield: er I mean not a function, it *is* a property |
| 00:14 | dnolen | (.innerHTML $elem) now always means call a method in CLJS |
| 00:14 | seancorfield | i didn't write that - it's something in ibdknox jayq library... |
| 00:16 | seancorfield | jayq.core.inner is defined to call (.innerHTML $elem v) which is indeed what the compiled code does |
| 00:16 | seancorfield | so the problem is $elem is not what i think it is i guess... |
| 00:18 | dnolen | seancorfield: $elem probably needs to be an element wrapped by jQuery |
| 00:18 | dnolen | you can't pass in a raw element |
| 00:18 | oakwise | seancorfield: possibly a bug from before the cljs property syntax change |
| 00:20 | oakwise | jQuery objects don't have an innerHTML method afaik |
| 00:20 | dnolen | oakwise: ah you're right, so a bug in jayq |
| 00:20 | dnolen | it should be (.html $elem v) |
| 00:22 | cemerick | ibdknox: jayq looks nice :-) |
| 00:22 | seancorfield | yeah, it looks great... i'd be happier if i could get it to work |
| 00:23 | cemerick | I've been maintaining sanity by keeping my cljs bits out of browsers. ;-) |
| 00:23 | oakwise | seancorfield: are you using advanced compilation? |
| 00:23 | seancorfield | the docs say to call ($ :#foo) and then pass that into (inner .. "html") and that's where i hit the innerHTML call problem... |
| 00:24 | seancorfield | oakwise: no, not until the basic code works first! i'm not daft :) |
| 00:24 | oakwise | try another non-buggy function :) |
| 00:24 | seancorfield | :p |
| 00:25 | seancorfield | but, yup, you guys seem to be spot on - it should be (.html .. "stuff") instead |
| 00:29 | seancorfield | ok, happy dance... it works now :) |
| 00:30 | seancorfield | i'll create an issue on jayq for ibdknox |
| 00:32 | ibdknox | seancorfield: it's weird that that works for me |
| 00:32 | ibdknox | lol |
| 00:33 | seancorfield | ah, there he is! :) |
| 00:33 | seancorfield | which version of jquery are you using? |
| 00:34 | ibdknox | 1.7 |
| 00:34 | seancorfield | i pulled in 1.7 too |
| 00:34 | ibdknox | anyways, it *should* be html |
| 00:36 | seancorfield | what's the /deps.js that it tries to pull in? |
| 00:36 | ibdknox | hm? |
| 00:36 | seancorfield | i ended up creating an empty file there to get rid of that warning |
| 00:36 | ibdknox | what mode are you using? |
| 00:36 | ibdknox | I always use simple |
| 00:36 | ibdknox | it seems to be better that way |
| 00:36 | ibdknox | just pushed an update for the innerHTML thing |
| 00:37 | ibdknox | cemerick: I think there's a lot more that can be done with it :) I've just added the things I've needed as I've gone |
| 00:37 | seancorfield | i'm using :optimizations :whitespace |
| 00:38 | ibdknox | try :optimizations :simple |
| 00:41 | ibdknox | the other way seemed convoluted to me |
| 00:49 | seancorfield | heh, ok, i'll try that too |
| 00:53 | ibdknox | the advantage is that if you do it that way you only need to include the final output file |
| 00:53 | ibdknox | here's what my options look like: |
| 00:54 | ibdknox | https://refheap.com/paste/658 |
| 00:57 | seancorfield | i don't have output-dir (and i'm using cljsbuild btw) |
| 00:57 | seancorfield | but otherwise the sample |
| 01:00 | seancorfield | looks like :simple does more optimization than :whitespace (renaming variables) so that makes it a bit harder to debug |
| 01:01 | seancorfield | ibdknox: when will a new version be available on clojars? |
| 01:02 | seancorfield | out of curiosity, having forked jayq, how would i actually build and install it locally to test? |
| 01:08 | ibdknox | seancorfield: it's already up, but you'll need to remove your cached .m2 version of it |
| 01:08 | ibdknox | and you can just add it to checkouts |
| 01:09 | ibdknox | that was also my params for cljsbuild |
| 01:09 | ibdknox | for the :compiler directive of it |
| 01:14 | rads | ibdknox: do you plan to improve the jquery api with jayq, or is it just a thin wrapper? for example, it makes more sense to me to have separate attr and set-attr! functions like domina |
| 01:15 | seancorfield | i'm getting jayq-0.1.0-20120207.003002-3.jar - is that the new version? |
| 01:19 | seancorfield | i'm still seeing a call to .innerHTML |
| 01:19 | ibdknox | rads: why is that better? |
| 01:20 | rads | I prefer the smaller functions and the separation between reading an attribute and mutating it |
| 01:21 | rads | not to mention some functions like val conflict with clojure.core. the domina api feels more tailored to clojure than jquery's |
| 01:23 | seancorfield | hmm, ok, verified the jar has the right code in it |
| 01:23 | seancorfield | wonder whether the cached code in coming from? |
| 01:25 | ibdknox | rads: sure, mostly I'm going for a thin wrapper that better things can be built on top of. |
| 01:25 | ibdknox | seancorfield: make a change in one of your files to get it to recompile |
| 01:25 | seancorfield | i did that... several times... |
| 01:25 | seancorfield | i even deleted the .js file and forced a recompile |
| 01:26 | rads | ibdknox: I see. does that mean the api will stay somewhat consistent with jquery? |
| 01:28 | amro | seancorfield: I had an issue once where part of a file wasn't being compiled because of a syntax error, the file just cut off after the namespace stuff. check the compiled .js for a clue |
| 01:28 | seancorfield | the .js file is complete and "works" except that the version of jayq.core.inner is the old version |
| 01:29 | cemerick | no xpath is enough to predispose me to jayq, if I were to get into the client-side stuff |
| 01:30 | ibdknox | rads: not necessarily, when there's gains to be had I'll definitely take them :) |
| 01:32 | seancorfield | i've deleted the .js file, i'm doing a lein clean, deps, run again and then i'll do lein cljsbuild once to see if that clears it... *sigh* |
| 01:33 | oakwise | don't forget `git clean` for completeness :) |
| 01:34 | ibdknox | seancorfield: I always have to save again once cljsbuild starts |
| 01:34 | ibdknox | otherwise it doesn't seem to pick up the change |
| 01:34 | ibdknox | for what that's worth |
| 01:35 | seancorfield | i deleted classes, lib and the .js and restarted everything and i'm still getting the old function even tho i double-checked the jayq jar and it has the fixed .cljs code |
| 01:35 | seancorfield | is there anywhere else it could be caching stuff?? |
| 01:35 | lazybot | seancorfield: Definitely not. |
| 01:36 | seancorfield | lazybot: you're not helping! |
| 01:37 | ibdknox | your browser might have it cached |
| 01:38 | seancorfield | nope |
| 01:39 | seancorfield | i checked the generated source on disk |
| 01:39 | seancorfield | i don't know whether something in cljsbuild has cached the old jayq.core or ...?? |
| 01:39 | lazybot | seancorfield: What are you, crazy? Of course not! |
| 01:42 | ibdknox | that seems unlikely |
| 01:43 | seancorfield | i'm going to upgrade lein-cljsbuild - i'm on 0.0.10 and 0.0.11 is out - maybe i'm running into a bug there |
| 01:49 | seancorfield | ok, i have _no_ idea why this isn't working... the jayq jar in lib definitely has the right inner fn defn |
| 01:49 | seancorfield | i deleted everything i can think of locally and re-gen'd |
| 01:50 | seancorfield | something, somewhere is either caching the .cljs or some pre-gen'd .js code |
| 01:50 | seancorfield | i'll look at the source of cljsbuild |
| 01:50 | ibdknox | there should be some out directory somewhere |
| 01:51 | ibdknox | that has .js in it |
| 01:53 | seancorfield | i looked in cljsbuild - it uses the parent folder of the output-to file as the output-dir folder and that was clean |
| 01:54 | seancorfield | what about the closure compiler? could it be stashing things somewhere? |
| 01:55 | ibdknox | I don't believe so |
| 01:55 | ibdknox | is there an older version of jayq hanging around in lib? |
| 01:56 | seancorfield | nope, i've deleted lib and re-run deps |
| 01:56 | seancorfield | and then un-jar'd the jayq jar it puts there - that's how i know the fixed version of inner is in there! |
| 01:56 | amalloy | aw, seancorfield, you're so unkind to lazybot. sounds like he was right |
| 01:57 | seancorfield | wanna slap too buddy? :) |
| 01:58 | ibdknox | lol |
| 01:58 | seancorfield | looking at the cljsbuild source, you can specify output-dir in the compiler options... it's used for some things... didn't see what it does for a default |
| 01:59 | ibdknox | try using my settings |
| 01:59 | ibdknox | https://refheap.com/paste/659 |
| 01:59 | ibdknox | minus those externs |
| 02:00 | seancorfield | oh great, now i have a SEGv from java... *sigh* |
| 02:00 | franks | amalloy: if you got a minute, would you mind to take a look at "https://gist.github.com/1757862", which is an implementation of inheritable-thread-local, a modified version of your useful.utils/thread-local... (it's tricky stuff with all those macros and threads...) |
| 02:04 | amalloy | looks a bit rubbish, tbh. only works for values which are atoms, for starters. the evals all over the place absolutely must be wrong, too |
| 02:04 | amalloy | i think if you start with a clearly-defined goal of how you want these to behave there's a pretty clear/concise implementation to make it happen |
| 02:05 | seancorfield | ibdknox: somehow, it recompiled things properly this time! |
| 02:05 | ibdknox | score |
| 02:06 | seancorfield | i added :output-dir so i'm wondering if the closure compiler had cached something in its default place? |
| 02:06 | ibdknox | maybe.. I'm not sure where that would be |
| 02:06 | ibdknox | I've only ever run it with an output dir |
| 02:06 | seancorfield | i shall make sure i keep it that way now :) |
| 02:07 | ibdknox | sorry it ended up eating so much time :( |
| 02:08 | seancorfield | np, it's all bleeding edge tech |
| 02:08 | seancorfield | there's definitely a cache at play... when i added :output-dir the first compile spat out two warnings like this: |
| 02:08 | seancorfield | WARNING: The form (. $elem remove) is no longer a property access. Maybe you meant (. $elem -remove) instead? |
| 02:08 | seancorfield | |
| 02:09 | seancorfield | (the other one was about -empty |
| 02:09 | seancorfield | i hadn't seen those warnings since the first compile of jayq - even with the jar updates inbetween |
| 02:09 | seancorfield | so g-closure had not been recompiling jayq |
| 02:11 | seancorfield | yeah, now i have an :output-dir i can see all the cached files there... |
| 02:11 | amalloy | it occurs to me that the (. obj -member) form is a lot less convenient to generate from macros - you have to do nonsense like `(. ~obj ~(symbol (str "-" (name member)))) |
| 02:12 | seancorfield | true |
| 02:12 | amalloy | which is about as inconvenient as trying to generate (.member obj) |
| 02:13 | ibdknox | yeah it sucks |
| 02:13 | ibdknox | luckily I haven't had a need to do that yet :p |
| 02:14 | seancorfield | at least now i know i can just delete the :output-dir if things don't seem to be compiling right |
| 02:16 | ibdknox | yeah |
| 02:20 | franks | amalloy: ok - i'll take another look |
| 02:37 | ibdknox | hm |
| 02:37 | seancorfield | ibdknox: i switched to :advanced mode and things fail |
| 02:37 | ibdknox | seancorfield: you'll need to add the extern for jquery |
| 02:37 | seancorfield | ah... how/where do i do that? |
| 02:37 | ibdknox | technomancy: I ended up with lein 1.7 somehow and now anytime I try to run a lein command it eats all available cpu |
| 02:37 | seancorfield | (and why isn't that picked up automatically from the jayq jar) |
| 02:38 | ibdknox | you have to specify it in the compiler options |
| 02:38 | seancorfield | oh, like you had in your options? |
| 02:38 | ibdknox | yeah sort of, except mine is from a checkout |
| 02:39 | ibdknox | it's supposed to work from resources with the latest cljs |
| 02:39 | ibdknox | so I think it'd just be externs/jquery.js? |
| 02:39 | ibdknox | I'm not sure |
| 02:39 | seancorfield | 'k |
| 02:39 | emezeske | seancorfield: Hey, I am back, reading the hilighted text :) |
| 02:39 | ibdknox | worst comes to the worst, just download the file stick it in your project somewhere |
| 02:40 | emezeske | seancorfield: Regarding the cached jayq stuff, I have been feeling that pain too |
| 02:40 | ibdknox | as long as you use an output dir, I've not seen any issues |
| 02:41 | emezeske | seancorfield: Since the resource is coming out of a jar, I don't think there's any good way for cljsbuild to see a timestamp that says it changed |
| 02:41 | seancorfield | ugh, i hope this sort of stuff gets cleaned up in cljs soon... it's a real drawback to actually trying to use it for anything real :) |
| 02:41 | emezeske | seancorfield: The compiler does try to be smart with files in the :output-dir; as in it doesn't recompile things if they are up to date (supposedly) |
| 02:42 | emezeske | seancorfield: That's why lein cljsbuild clean fixes it; it removes the :output-dir |
| 02:42 | seancorfield | ah, good to know... i was manually deleting that folder :) |
| 02:43 | seancorfield | ibdknox: externs/jquery.js doesn't work - it's looking for a physical folder in my project, not within the jar |
| 02:43 | ibdknox | hm |
| 02:43 | seancorfield | so i guess i have to pull it out of the jar and put it in my project... yuk :( |
| 02:43 | ibdknox | :( |
| 02:43 | seancorfield | emezeske: is the 0.0.11 cljsbuild using the latest cljs compiler? |
| 02:43 | ibdknox | I know some work was done at some point to make externs available from the classpath |
| 02:44 | emezeske | seancorfield: yeah, as of a couple days ago |
| 02:44 | emezeske | r971 |
| 02:44 | ibdknox | seancorfield: what if you just do jquery.js? |
| 02:44 | seancorfield | ok, lemme try that |
| 02:45 | seancorfield | this netbook's real slow so bear with me... |
| 02:45 | seancorfield | nope, still looking for a physical file |
| 02:46 | ibdknox | I'm afraid pulling it out is the solution for now then :( |
| 02:49 | seancorfield | ok, pulling out the externs does seem to work... just restarting everything with a clean set of directories to be sure... |
| 02:50 | seancorfield | success! |
| 02:50 | seancorfield | thank you for your patience gentlemen |
| 02:51 | seancorfield | at this point, i'm off to bed |
| 02:52 | seancorfield | but at least i can now use jquery with clojurescript and not have to bother with my slightly jerry-rigged utility script to manipulate the DOM (as shown in my blog post about clojurescript and fw/1) |
| 02:55 | emezeske | seancorf`: wooo! |
| 03:02 | emezeske | ibdknox: BTW, thanks for all your cool cljs jars |
| 03:03 | emezeske | ibdknox: I'm almost done changing my project from a bunch of ad-hoc stuff to fetch, crate, and jayq, and a LOT of code has gone away |
| 03:30 | mada | I just fscked up and checked out code from RCS, overwriting my working copy. |
| 03:30 | mada | my last hope is that I can extract the code some way from the running clojure instance |
| 03:30 | mada | is it possible? |
| 03:31 | Raynes | Is it git and was the code that you overwrote ever committed? |
| 03:31 | mada | now, it's not git... RCS. old stuff... :( |
| 03:32 | Raynes | Oh, you mean actual RCS? |
| 03:32 | mada | I am so used to SVN and git and was just thinkinh I should commit... |
| 03:32 | Raynes | Holy crap, man. |
| 03:32 | mada | yes :) |
| 03:32 | Raynes | I'm more interested in why you were using that than getting your code back now. |
| 03:32 | Raynes | :p |
| 03:32 | mada | It's default in Emacs if you have no other VCS installed. |
| 03:33 | mada | that's why |
| 03:33 | gf3 | good morning, all |
| 03:33 | gf3 | I am writing some middleware for ring, is there a common way to search for resources on the classpath? |
| 03:33 | mada | so, I have a running clojure instance with the correct code, and an emacs buffer with the checked out older code |
| 03:33 | amalloy | emacs, you have betrayed us all |
| 03:33 | raek | gf3: yes, clojure.java.io/resource |
| 03:33 | mada | and emacs seems to record no undo history for operations like this |
| 03:34 | mada | so... should I just rewrite it all or is the code deep down in clojure? |
| 03:34 | mada | the clojure verson is a bit old as well so the source function does not seem to exist... |
| 03:34 | raek | the clojure compiler does not store the original code |
| 03:34 | amalloy | if the files have been checked out, the running clojure instance doesn't have the code |
| 03:35 | mada | ok |
| 03:35 | raek | mada: the source function just looks up the file and number, opens that file and extract the relevant lines |
| 03:35 | mada | ah |
| 03:36 | mada | also, I keep most of my code synced with Dropbox but this file happened to be in another place :) |
| 03:36 | mada | so no help from Dropbox either |
| 03:38 | aperiodic | man, that would be the worst disassembly task ever. bytecode -> decompiled java -> clojure? |
| 03:39 | mada | aperiodic: are u up for the challenge? ;-) |
| 03:39 | aperiodic | no way |
| 03:39 | mada | :) |
| 03:39 | aperiodic | not at all |
| 03:39 | mada | I'm so angry with the C-x v v right now! |
| 03:39 | mada | How can it just overwrite my file?! |
| 03:40 | mada | okay, I was careless, but... |
| 03:40 | mada | grr...... |
| 03:40 | amalloy | actually going from decompiled java to clojure usually isn't that hard. it's mostly a bunch of "load constant (clojure.core$map), invokevirtual (invoke(Object, Object[]))" |
| 03:41 | mduerksen | mada: i don't know emacs very well, but couldn't there by some temporary backup/buffer files flying around somewhere? |
| 03:41 | mada | mduerksen: it is a good question :) |
| 03:41 | mduerksen | by->be |
| 03:42 | mada | time to google a bit... |
| 03:45 | amalloy | it's hard to believe you wrote this much code without committing. like, the amount of time you've spent hoping there might be some magic seems like it must be less than the time it woudl take to re-do it |
| 03:46 | mada | amalloy: I have a copy from yesterday so it's not that much. |
| 03:46 | mada | in an hour it will be back again, working approximately like now |
| 03:56 | muhoo | firefox10 has crashed one too many times. off with its head! |
| 03:58 | Raynes | muhoo: Poppycock! Firefox never crashes. ever. |
| 04:04 | tsdh | mada: You might have luck and emacs kept some backups somewhere. If you didn't configure anything, there should be a backup file foo.clj~. If you configured version-control to t, then there are even more than one old version around (~1,~2,...). Maybe, they go into some central backup directory, depending on the value of backup-directory-alist. |
| 04:05 | mada | tsdh: Thanks, there is a backup file in the directory, but it is not my working version. It looks like it is... I don't know. But I have accepted my fate now and am rewriting it. |
| 04:06 | mada | I have been bitten by this once before but it seems my memory it too short to learn from it... |
| 04:06 | mada | I think now is the time to do something about it. |
| 04:06 | mada | The setting you mention above sounds promising. |
| 04:06 | mada | If I would keep, say, three old versions, problems like this should be possible to solve. |
| 04:33 | tsdh | mada: Yeah, I also have (setq version-control t) (setq backup-directory-alist '("." "~/.backups")) (setq kept-new-versions 10). |
| 04:45 | osa1 | what are points of :dynamic and :static metadata? |
| 04:47 | raek | osa1: :static does not exist anymore |
| 04:47 | echo-area | Is :dynamic for dynamic binding? |
| 04:50 | tsdh | echo-area: Yes. Only vars declared as (def ^:dynamic *foo* ...) can be bound dynamically using `binding' from Clojure 1.3 on. |
| 04:59 | echo-area | tsdh: Okay, thanks |
| 05:00 | echo-area | Didn't know the "Only" part before |
| 05:07 | jaley | can anyone tell me what I *should* be doing to download a binary file with clojure.java.io? This produces a corrupt file; (io/copy (io/reader url) (File/createTemporaryFile "tmpzip" ".zip")) |
| 05:07 | raek | jaley: you should use binary streams, not text streams |
| 05:08 | raek | (io/copy (io/input-stream url) (File/createTemporaryFile "tmpzip" ".zip")) |
| 05:09 | jaley | raek: that's a text stream? oh... didn't see anything in the docs. thanks, I'll try that. |
| 05:10 | raek | Readers work on chars, InputStreams work on bytes |
| 05:10 | raek | clojure uses the java primitives for file io |
| 05:10 | raek | jaley: also, you need to close the streams |
| 05:10 | jaley | raek: got it, with-open? |
| 05:11 | raek | (with-open [in (io/input-stream url), out (io/output-stream (File/createTemporaryFile "tmpzip" ".zip"))] (io/copy in out)) |
| 05:11 | raek | jaley: yes |
| 05:13 | raek | ok, I now saw in the docs for copy that you don't need to manage the closing of the File (since copy would open it itself) |
| 05:13 | jaley | raek: that works - thanks for the help! |
| 05:13 | raek | (with-open [in (io/input-stream url)] (io/copy in (File/createTemporaryFile "tmpzip" ".zip"))) |
| 05:13 | raek | should work too |
| 05:14 | jaley | raek: that's fine, having two streams in with-open kinda feels symmetric :-) |
| 05:14 | raek | yes, I totally agree... :-) |
| 05:48 | otfrom | anyone know how to reset a password on clojars.org? |
| 07:54 | cran1988 | is there any book to teach you not to use recursions , but data stractures only ? |
| 07:55 | cran1988 | i mean clojure has fabulous data stractures ... but my head can not work with them and my head gets confused with easy solutions such as recursions |
| 08:12 | osa1 | is there a way to specify default values of slots in defrecords? |
| 08:13 | llasram | osa1: You can create own Clojure constructor/factory functions, but you can't change the generated class's JVM-level constructor |
| 08:13 | osa1 | ok, thanks |
| 08:24 | lnostdal | ouh, new version of lein? .. what's new? :) |
| 08:34 | clgv | lnostdal: https://github.com/technomancy/leiningen/blob/1.x/NEWS.md |
| 08:36 | lnostdal | ah, nice .. tiered |
| 10:55 | TimMc | Raynes: You can tell BrowserID is evil because when I finally signed up, the paste number I got was... https://refheap.com/paste/666 |
| 11:01 | muhoo | wow, that's extremely useful: https://refheap.com/paste/666 |
| 11:01 | muhoo | beats reading javadocs |
| 11:02 | TimMc | muhoo: Hmm? |
| 11:03 | muhoo | oh, this: ##(filter #(= (.getName %) "abs") (.getMethods Math)) |
| 11:03 | lazybot | java.lang.SecurityException: You tripped the alarm! package java.lang.reflect, Java Platform API Specification, version 1.6 is bad! |
| 11:03 | muhoo | ok whataver |
| 11:03 | muhoo | also, i find that function interesting because it's using ` and ~ but it's not a macro |
| 11:03 | TimMc | muhoo: There used to be a utility that presented this info really nicely. |
| 11:04 | TimMc | muhoo: It's part of a macro, actually. But yeah, some people use them all the time in regular functions *cough* amalloy *cough* |
| 11:05 | TimMc | and the macro is broken -- note the "# #" at the end. |
| 11:16 | muhoo | TimMc: do you remember what the name of the utility is or how i could find it? |
| 11:16 | muhoo | no need to reinvent the wheel if someone's already done it |
| 11:16 | TimMc | It was called "show" and was in contrib. |
| 11:16 | TimMc | clojure.java.reflect or whatever just doesn't cut it. |
| 11:17 | clgv | muhoo: clojure.contrib.repl-utils had the show |
| 11:17 | TimMc | A really good utility would grab local javadocs. |
| 11:17 | muhoo | past tense? |
| 11:17 | clgv | clojure.contrib is deprecated |
| 11:17 | muhoo | :-/ |
| 11:17 | muhoo | but i thought all the stuff from contrib got broken out into separate packages? |
| 11:17 | clgv | but you can safely use it with clojure 1.2 and try to do so with 1.3 |
| 11:18 | TimMc | muhoo: Monolithic conrib is deprecated, but you can actually use pieces of it just fine. |
| 11:18 | clgv | muhoo: maybe it has. but you have to look where... |
| 11:18 | muhoo | ok |
| 11:18 | clgv | TimMc: yeah but namespaces in monolithic contrib are not necessarily available as standalon projects now... |
| 11:22 | muhoo | i keep reading pom as porn |
| 11:22 | muhoo | in helvetica/ariel |
| 11:22 | clgv | haha |
| 11:25 | lynaghk | Watch your keming. |
| 11:26 | muhoo | ,rimshot |
| 11:26 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: rimshot in this context, compiling:(NO_SOURCE_PATH:0)> |
| 11:26 | muhoo | &rimshot |
| 11:26 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: rimshot in this context |
| 11:26 | muhoo | damn you |
| 11:27 | Fossi | almost as good XD |
| 11:28 | mintsoup | has anyone here used korma? do you like it better than using an orm? are there any alternatives to consider? |
| 11:30 | muhoo | what?? why?? "Migrated to clojure.repl and clojure.java.javadoc, except: show, expression-info, run, run*" |
| 11:30 | muhoo | why did show get kicked to the curb? |
| 11:31 | TimMc | haha, that's awful |
| 11:35 | kcinvres | g'day |
| 11:35 | kcinvres | any logic programmers in here? |
| 11:36 | clgv | ~any |
| 11:36 | clojurebot | Cool story bro. |
| 11:36 | kcinvres | I just watched Ambrose's talk on core.logic |
| 11:37 | clgv | kcinvres: cool some of the talks are available as videos... thx for that notice |
| 11:38 | kcinvres | it seems like you give the evaluator things that match the inputs and outputs and provides programs that solve for those |
| 11:39 | kcinvres | And he describes how the evaluator/program is actually traversing search trees to find each answer. |
| 11:39 | kcinvres | If I understand correctly. |
| 11:39 | clgv | kcinvres: do you have prolog knowledge? |
| 11:40 | kcinvres | what I don't understand is what makes up that search space. |
| 11:40 | kcinvres | clgv: no |
| 11:40 | clgv | ah, so you are completly new to logic programming |
| 11:41 | kcinvres | yes |
| 11:42 | kcinvres | Like, in the process of solving, does it say "okay, I'll try putting values in here and see if any of them return true" |
| 11:43 | clgv | as far as I remember the basic idea is that you describe your problem and the solver searches the tree of possibilities |
| 11:43 | kcinvres | but does it have a predefined range of inputs it can use? like numbers, strings, and the types available at run-time? |
| 11:43 | kcinvres | as inputs to test for? |
| 11:43 | clgv | oft (if not always) you start by writing facts and then more advance rules that use those facts with variables where the solve can try to unify values |
| 11:44 | clgv | *often |
| 11:44 | clgv | the range is usually defined by facts. but I dont know specifics from core.logic (yet) ;) |
| 11:45 | kcinvres | ok |
| 11:45 | muhoo | is there a way to add a jar to a clj project while it is running, without restarting the jvm? |
| 11:46 | kcinvres | add-classpath... but it is deprecated |
| 11:46 | clgv | kcinvres: someone published a tutorial/guide on logic programming with core.logic. sadly I dont remember the URL |
| 11:47 | clgv | muhoo: you can copy the add-classpath code. I did so for an experiment |
| 11:47 | kcinvres | muhoo: but this attempts to be the non-deprecated solution: https://github.com/cemerick/pomegranate |
| 11:47 | kcinvres | clgv: reading it now :) https://github.com/frenchy64/Logic-Starter/wiki |
| 11:49 | clgv | kcinvres: I am not entirely sure whether this was the one I meant. but looks good as well |
| 11:49 | muhoo | kcinvres: thanks, that's great! |
| 11:50 | kcinvres | muhoo: np |
| 11:50 | kcinvres | as an example... |
| 11:50 | kcinvres | (run* [q] (== q 1)) |
| 11:50 | kcinvres | ;=> (1) |
| 11:51 | kcinvres | So, core.logic starts guessing at values of q, right? |
| 11:51 | kcinvres | and presumably it would guess some numbers |
| 11:51 | kcinvres | and presumably it would guess 1 |
| 11:52 | kcinvres | but does it start at 0 and work it's way up? |
| 11:52 | clgv | kcinvres: I believe it is not guessing but unification |
| 11:52 | kcinvres | does it start with ints, then longs, then doubles? |
| 11:52 | kcinvres | well, what about: (run* [q] (== q "1")) |
| 11:53 | kcinvres | does it ispect the type of the "1"? |
| 11:53 | kcinvres | and say, okay, now let me start iterating over a range of strings? |
| 11:54 | clgv | kcinvres: I think the unfication inspects both sides sees one constant and one variable. hence the result is the substitution of the variable by the constant |
| 11:54 | clgv | kcinvres: if it's not explained in the tutorial you should read about unification in logic programming |
| 11:54 | kcinvres | well, what about: (run* [q] (== q (str "1" "unlinkely"))) |
| 11:55 | kcinvres | presumably, q would be "1unlikely" |
| 11:55 | clgv | kcinvres: depends how core.logic and plain-clojure work together... |
| 11:55 | kcinvres | well, however that might be written |
| 11:56 | clgv | maybe plain clojure without logic variabls is just evaluated and handled as a constant. |
| 11:56 | kcinvres | can you not use clojure functions? |
| 11:56 | clgv | doesnt the tutorial explain it? |
| 11:56 | kcinvres | I think I know what you mean |
| 11:56 | kcinvres | clgv.. no in detail. I'm going to reread unifications |
| 11:57 | kcinvres | but I think you're right.. I think the "(str " part of the form would need to be a predefined logic "relation" |
| 11:57 | clgv | well you can write books about that topic although many are written already ;) |
| 11:58 | kcinvres | and then it could _derive_ "1unlikely" based on the relation |
| 11:58 | kcinvres | clgv: are you implying that I'm longwinded ;) |
| 11:59 | clgv | lol I am not implying anything. I just remembered that the professor I had in logic programming has written one ;) |
| 12:00 | muhoo | wooww. aether is huge |
| 12:01 | muhoo | i didn't realize that a little (i thought) library to allow me to add-classpath in a non-depreciated way would require so much heavy dependencies |
| 12:02 | clgv | kcinvres: no it does not guess |
| 12:02 | clgv | lol oops |
| 12:02 | clgv | scrolled back ;) |
| 12:02 | clgv | ok gotta go home now^^ |
| 12:05 | kcinvres | muhoo: yea, it's pretty serious hardware |
| 12:12 | muhoo | hmm, comp is a brainmelter. i so am using the wrong language for someone without a MSCS |
| 12:13 | technomancy | ibdknox: wait what? |
| 12:16 | TimMc | muhoo: Augh, I figured out the # in the macro expansion. I'm sucha dunce. |
| 12:16 | dnolen | composition via delegation when using protocols seems like an interesting discussion ... |
| 12:16 | muhoo | TimMc: what was it? |
| 12:17 | TimMc | muhoo: I've set *print-depth* in my REPL. That's how it indicates a depth limit. >_< |
| 12:17 | muhoo | ah |
| 12:17 | muhoo | overloaded ascii characters |
| 12:17 | TimMc | fml |
| 12:18 | muhoo | i'm staring at this like a phish phan at a water pipe: https://refheap.com/paste/670 |
| 12:18 | muhoo | and going, "whoooaaaaa..." |
| 12:19 | TimMc | Heh, point-free style. |
| 12:21 | muhoo | i've decided to try to not be so terrified, and jump in writing shitty, inefficient, non-idiomatic clojure, and not worry about the fact that so much of it is over my non-cs-degree'ed head. |
| 12:21 | muhoo | like, if i wait to understand stuff like when to use comp, for instance, i'll never actually start writing anything. |
| 12:23 | muhoo | actually i think i'm kind of grokking comp. it seems like -> to me a bit |
| 12:24 | technomancy | you don't need comp or ->; they are just conveniences |
| 12:24 | technomancy | just write code without them until it bothers you, then you'll be better-suited to understand the problems they address |
| 12:24 | muhoo | excellent, thanks. |
| 12:25 | muhoo | yeah, that's what i'm kind of arriving at. there's no need for me to try to use or even understand these advanced features, until i've written enough stuff where i start thinking, "gawd, there has got to be an easier, cleaner way to do this" |
| 12:26 | muhoo | then of course, i'll write macros to do it. then i'll discover that the feature is already in clojure.core somewhere :-) so, 3 iterations really: one without the abstractions, one with my own crappy ad-hoc abstractions, and one finally doing it The Right Way. |
| 12:28 | oakwise | that sounds like as good a plan as any |
| 12:28 | TimMc | after you start using macros, you'll learn when not to use macros :-) |
| 12:28 | muhoo | well, maybe not macros, but functions/libraries of my own, before discovering someoen has already done it better |
| 12:29 | muhoo | i am not a macro-fetishist. not yet, anyway. |
| 12:42 | muhoo | hmm, what's this: FileNotFoundException Could not locate ring/middleware/content_type__init.class or ring/middleware/content_type.clj on classpath: clojure.lang.RT.load (RT.java:430) |
| 12:43 | oakwise | muhoo: I've seen that when cleaning/changing libs and forgetting to restart my ring server |
| 12:46 | muhoo | this is what caused it to break: https://refheap.com/paste/671 |
| 12:47 | muhoo | then, trying to load necessary-evil gives me this: CompilerException java.lang.IllegalStateException: Can't dynamically bind non-dynamic var: clojure.contrib.macro-utils/protected-symbols, compiling:(clojure/contrib/monads.clj:195) |
| 12:47 | muhoo | that's a real kick in the monads. |
| 12:47 | oakwise | looks like it's using old 1.2 code |
| 12:48 | muhoo | what is? |
| 12:48 | muhoo | necessary evil depends on clj 1.2? |
| 12:49 | muhoo | ah |
| 12:49 | muhoo | yes. |
| 12:49 | oakwise | try the latest snapshot |
| 12:49 | muhoo | i need 2.0.0 |
| 12:49 | oakwise | looksl ike it's 1.3-friendly |
| 12:51 | muhoo | silly debian user i am, always going for the "stable" version of packages :-) |
| 12:54 | kcinvres | muhoo: I barely ever use advanced functions like comp. And I've never written a macro. |
| 12:54 | kcinvres | but I get stuff done in clojure regularly |
| 12:55 | kcinvres | My sister has this telework job where she operates a web interface all day. |
| 12:55 | kcinvres | In a day I wrote a script to automate a quarter of her job for her. |
| 12:56 | kcinvres | I used clj-webdriver (selenium) to automate some of the repetitive actions. |
| 12:56 | kcinvres | I've also written a few scripts for work. |
| 12:57 | muhoo | cool! |
| 12:57 | muhoo | hmm, i keep getting kicked in the monads: https://refheap.com/paste/672 |
| 13:01 | muhoo | works now, not sure what that error was |
| 13:01 | enrico1 | hello |
| 13:02 | muhoo | kcinvres: yep. i'm kind of through with being intimidated by the CS geniuses. there's lots of stuff i use other languages for, that i could use clj for instead, and enjoy it. |
| 13:02 | muhoo | even if i don't understand half the code i read, i can still write stuff that *i* understand. |
| 13:03 | muhoo | yay, necessary evil is loaded. i'm now on my way to writing something useful and pedestrian :-) |
| 13:04 | enrico1 | I almost finished reading "the joy of clojure", and willing to start my first clojure experiments |
| 13:05 | enrico1 | however my head is going to explode around an issue I'm trying to solve about java interoperability |
| 13:06 | kcinvres | I pretty much brute-force all my projects. They say work smart not hard, but but if you can't work smart, clojure makes still makes it easier |
| 13:06 | muhoo | cool. i'm about halfway through joy. if i can make it all the way through, it'll be a triumph. |
| 13:07 | muhoo | yep, i've decided i'm a brute-force kind of guy too. |
| 13:07 | enrico1 | for what I realized, it's idiomatic, in clojure, to implement "with" macros in order to use "closeable" resources |
| 13:07 | kcinvres | I think it may have something to do with the fact that I never fully indoctrinated into the object oriented mindset |
| 13:07 | muhoo | much as i love and admire elegance. |
| 13:07 | cran1988 | can I ask why set and vector have different value with partition-by ? |
| 13:07 | muhoo | i *hate* OOP, or, as the french more accurately call it, POO |
| 13:07 | kcinvres | set is not ordered |
| 13:07 | cran1988 | ,(partition-by type [:a "foo" "bar" :b]) |
| 13:07 | clojurebot | ((:a) ("foo" "bar") (:b)) |
| 13:08 | cran1988 | ,(partition-by type (set [:a "foo" "bar" :b])) |
| 13:08 | clojurebot | (("foo") (:a :b) ("bar")) |
| 13:08 | cran1988 | weird! |
| 13:08 | enrico1 | the problem I'm unable to solve is the following: |
| 13:08 | TimMc | muhoo: And {:a 1 :b 2} isn't an object? |
| 13:08 | muhoo | it's a map, no? |
| 13:09 | kcinvres | oh my bad |
| 13:09 | enrico1 | imagine you have to implement a java class (with clojure) that have some "service"-like interface, with start() stop(), and, maybe a process() method |
| 13:09 | kcinvres | enrico: I'd use an agent |
| 13:10 | TimMc | muhoo: It's an object! |
| 13:10 | enrico1 | if in this class you have to access a resource at initialization and release it when the service is shut down, you stick the resource in the object state and open/close it in the start and stop methods, that's all. |
| 13:10 | kcinvres | ,(set [:a "foo" "bar" :b]) |
| 13:10 | clojurebot | #{"foo" :a :b "bar"} |
| 13:11 | TimMc | muhoo: I'm being a brat -- I think "OOP" is a bad term. Should be "method-oriented programming". :-P |
| 13:11 | dsabanin | hey guys! |
| 13:11 | muhoo | TimMc: i get your point, and i probably should be less doctrinaire, especially since i don't actually know WTF i'm doing yet anyway |
| 13:11 | enrico1 | now, I was thinking about using a var to keep a thread-local value of the resource |
| 13:12 | dsabanin | total clojure newbie here. Can I somehow override function defined in another namespace, so that other functions from that namespace will start using the updated version of it too? |
| 13:12 | enrico1 | and the idea wat to (def *mystuff* nil) in the class module |
| 13:12 | enrico1 | (oops ^:dynamic needed too) |
| 13:12 | dsabanin | basically, I need to patch a function in a 3rd party library for which I have no access to source code |
| 13:12 | muhoo | i have caveman-level opinions. "grog like beating on rocks with functions! grog no like beating on rocks with objects! grooooookggggn!" |
| 13:13 | enrico1 | but then, to rebind its value, I have to "surround" it with a "binding" form |
| 13:14 | enrico1 | the idea is to stick the resource in a var in the start method, use it in the process and close it in the stop() |
| 13:15 | enrico1 | but it doesn't seem to cope well with the binding form or the "with" macros |
| 13:15 | enrico1 | any clue? |
| 13:16 | kcinvres | dsabanin: maybe in-ns |
| 13:16 | enrico1 | kcinvres: ? |
| 13:18 | muhoo | dsabanin: i remember seeing several ways to do it, http://clojure.org/java_interop |
| 13:18 | muhoo | dsabanin: "Clojure supports the dynamic creation of objects that implement one or more interfaces and/or extend a class with the proxy macro" |
| 13:18 | enrico1 | kcinvres: with an agent I'd basically delegate the process() to another thread, and this is anynchronous isn't it? What if I need a return value? |
| 13:18 | kcinvres | enrico1: you want the starting, running, and stopping to all be called within a 'with' form? |
| 13:18 | muhoo | haven't actually tried it yet though, sorry :-( |
| 13:19 | dsabanin | kcinvres, thanks! looks like it doesn't work though, seems other functions from that namespace still use old version |
| 13:19 | kcinvres | enrico1: I think it is something like (let [a (agent ...)] (await a)) |
| 13:19 | dsabanin | muhoo, I don't actually have some object, it's a configuration setting that's being applied to random strings that are passed to the function |
| 13:20 | enrico1 | kcinvres: I would't, but it seems the only option (if I exit the context, the resource is released) |
| 13:20 | enrico1 | kcinvres: uhm… let me look at the docs about await :) |
| 13:22 | kcinvres | enrico1: I would think you would want to implement a function that closes over a ref type of some type and then have that function take arguments that affect the running resource in that ref |
| 13:22 | kcinvres | like (service :start) |
| 13:23 | kcinvres | (service :stop) |
| 13:24 | enrico1 | kcinvres: oh yes, and this closure could placed in the object's state, and adapted fia start() stop() process() to the class interface |
| 13:25 | enrico1 | kcinvres: I'll try |
| 13:25 | enrico1 | kcinvres: thanks |
| 13:25 | kcinvres | (defn service [k] (let [a (make-service (atom ...))] (cond (= key :start) (swap! a #(srv-start %))))) |
| 13:26 | kcinvres | or something like that |
| 13:26 | enrico1 | kcinvres: yup |
| 13:26 | kcinvres | wait |
| 13:28 | kcinvres | more like (defn make-service [a] (fn [k] (cond (= k :start) (swap! a #(srv-start %)))) |
| 13:29 | kcinvres | and then (def myservice (make-service (atom asdf))) |
| 13:29 | kcinvres | and then (myservice :start) |
| 13:29 | kcinvres | etc |
| 13:30 | enrico1 | kcinvres: yes, I'll try this path. closing over a ref seems the way to go, thanks for the hint |
| 13:31 | kcinvres | np |
| 13:32 | kcinvres | dsabanin: this is a third party clojure namespace that you don't have access to? |
| 13:33 | enrico1 | kcinvres: I've been puzzled because, for example, in wabbitmq (a rabbitmq client library) there's no way to directly access a resource: you implicitly use it via "with" macros. however in interoperability scenarios like the ones above (think about implementing an amqp logget for log4j or something like that it seems to me you can't |
| 13:33 | kcinvres | dsabanin: http://clojuredocs.org/clojure_contrib/clojure.contrib.with-ns/with-ns |
| 13:34 | enrico1 | kcinvres: here's an example https://github.com/mefesto/wabbitmq/blob/master/src/com/mefesto/wabbitmq.clj |
| 13:34 | kcinvres | "with" is an implementation detail, usually, I believe |
| 13:34 | enrico1 | kcinvres: no way to access *connection* or *channel* from the outside |
| 13:35 | kcinvres | enrico1: that's probably how the others intended |
| 13:35 | kcinvres | s/others/authors |
| 13:36 | enrico1 | kcinvres: but this sounds strange, you don't cover many use cases... |
| 13:36 | kcinvres | using "with" allows you to have implicit things going on |
| 13:36 | enrico1 | kcinvres: yup, it's actually very handy |
| 13:36 | kcinvres | so it saves some typing and boilerplate, in some cases |
| 13:39 | enrico1 | kcinvres: I'm leaving, thanks for chatting |
| 13:39 | enrico1 | kcinvres: bye |
| 13:40 | kcinvres | too bad. This would have answered all his questions: http://cemerick.com/2011/10/17/a-la-carte-configuration-in-clojure-apis/ |
| 13:42 | muhoo | kcinvres: that is awesome, thanks |
| 14:02 | dEPyHome | someone can help me with setting up emacs for clojure? :) |
| 14:02 | dEPyHome | I've installed the packages: clojure-mode, slime, slime-repl, swank-clojure, paredit |
| 14:04 | dEPyHome | Now I have no idea how to tell the path to my clojure.jar |
| 14:04 | jsabeaudry | dEPyHome, have you installed leiningen? |
| 14:04 | dEPyHome | if I try to run slime and tell it to download clojure it fails |
| 14:04 | jkkramer | dEPyHome: using leiningen is the way to go. see http://dev.clojure.org/display/doc/Getting+Started+with+Emacs |
| 14:04 | dEPyHome | have lein.. but not sure if I have paths set up |
| 14:05 | jsabeaudry | dEPyHome, echo $PATH will tell you |
| 14:05 | dEPyHome | windows <- unfortunatelly :P |
| 14:05 | dEPyHome | sec.. let me check paths |
| 14:06 | technomancy | swank-clojure.el and M-x slime are deprecated; definitely use the wiki directions |
| 14:06 | dEPyHome | am.. is that why I try to do M-x slime the command is not found? |
| 14:07 | technomancy | yeah, that only works for common lisp; you want M-x clojure-jack-in |
| 14:08 | dEPyHome | so I dont need all of those packages? :) |
| 14:09 | ibdknox | technomancy: it's either during clean or deps, but it will use unbounded CPU the first few times I work with a fresh project |
| 14:09 | technomancy | dEPyHome: no, you must have found some documentation that was badly out of date |
| 14:10 | dEPyHome | technomancy: I'm pretty good at that.. :) |
| 14:10 | technomancy | ibdknox: ouch. is this a mac thing then? |
| 14:10 | kcinvres | I thought of a neat use for core.logic, if I understood the presentation correctly, where they were automatically generating programs that satisfied input and output parameters. |
| 14:10 | dEPyHome | So basically I just need to instal swank-clojure plugin in lein and in emacs? |
| 14:10 | ibdknox | technomancy: possibly, I *am* on a mac |
| 14:11 | kcinvres | maybe a profiler could be built in and it could return you the most efficient implmentations of programs. |
| 14:12 | technomancy | ibdknox: can't repro here; not sure what's up. can you try moving ~/.lein out of the way? |
| 14:20 | ibdknox | technomancy: it seems like that made it better |
| 14:21 | technomancy | can you gist ~/.lein/init.clj and a listing of ~/.lein/plugins? |
| 14:24 | ibdknox | technomancy: no init.clj, here's plugins https://refheap.com/paste/674 |
| 14:25 | ibdknox | anytime I do deps it spikes the CPU |
| 14:26 | technomancy | ibdknox: you have swank installed‽ |
| 14:26 | ibdknox | I installed emacs a while back |
| 14:26 | ibdknox | got annoyed being at 10% efficiency (just because I didn't know it) and went back to vim |
| 14:27 | technomancy | so I guess my next advice would be to bisect that list of plugins |
| 14:27 | ibdknox | I bet it's swank! ;) |
| 14:27 | technomancy | which is kind of annoying, but I'm not sure how else to isolate the problem |
| 14:27 | technomancy | dude. it's always swank. |
| 14:27 | technomancy | yeah, just rm all the ones you're not using |
| 14:27 | ibdknox | well, if no one else has reported such a thing, I'll assume it some weird combination of the plugins I have |
| 14:28 | ibdknox | yeah |
| 14:28 | technomancy | well... I haven't even announced lein 1.7 yet |
| 14:28 | technomancy | so it's no surprise nobody's reported anything |
| 14:29 | technomancy | anyway well-behaved plugins don't even activate when you do lein deps |
| 14:41 | clows | hi… when I use ring… am I seeing this correctly… when using the params middleware since it slurps the request body to parse the params… the body will then be empty? |
| 14:48 | tmciver | clows: I believe the params middleware pulls the params out of the url; the body should be empty unless the request was a PUT or POST. |
| 14:49 | dEPyHome | strange.. |
| 14:50 | dEPyHome | getting:" clojure-eval-bootstrap-region: Non-hex digit used for Unicode escape " when i try to clojure-jack-in |
| 14:50 | dEPyHome | any idea? |
| 14:50 | clows | @tmciver in my case it's a post and … i'm fairly sure it's empty… and the content-length is > 0 |
| 14:51 | hiredman | dEPyHome: there was a bug sometime ago, upgrade |
| 14:51 | ibdknox | hm is there a way to write the following without eval? https://refheap.com/paste/676 unfortunately all the routing stuff in compojure is macros so I can't just call a function :( |
| 14:51 | dEPyHome | bug in what? emacs, swank, .. ? |
| 14:52 | clows | https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/params.clj line 50 does slurp the body |
| 14:52 | tmciver | clows: Yes, I was just looking at: http://clojuredocs.org/ring/ring.middleware.params/wrap-params |
| 14:52 | ibdknox | I guess I could try to resolve the symbol |
| 14:52 | hiredman | dEPyHome: it might have been in swank-clojure, but I don't recall |
| 14:52 | tmciver | Looks like the body of the post gets put into :form-params |
| 14:53 | clows | makes sense i guess |
| 14:53 | clows | in my case i just need to get rid of the params wrapper i guess … |
| 14:54 | tmciver | clows: I wouldn't. You should just be able to pull the data you want out of :form-params |
| 14:54 | tmciver | clows: otherwise, you'll have to parse them out of the body yourself... but that's what the wrap-params middleware does for you. |
| 14:55 | clows | i don't have a form sent to the server but a url called from a different system that sends some json as a post request |
| 14:55 | clows | i just have the wrap-params enabled because noir adds it by default … |
| 14:55 | alexyk | what's the ternary comparison function? -1/0/+1 |
| 14:56 | alexyk | compare |
| 14:57 | tmciver | alexyk: ##(< -1 0 1) |
| 14:57 | lazybot | ⇒ true |
| 14:57 | alexyk | huh |
| 14:57 | alexyk | &(1 0 -1) |
| 14:57 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 14:57 | alexyk | &(< 1 0 -1) |
| 14:57 | lazybot | ⇒ false |
| 14:58 | tmciver | clows: hmm, if it's supposed to be json in the body the...I don't know. I wouldn't expect wrap-params to be doing anything with that. |
| 14:58 | tmciver | s/the/then |
| 14:58 | clows | so was I … |
| 14:58 | ibdknox | clows: sorry wasn't paying attention, what's going on? |
| 14:59 | ibdknox | if it sends the information as the body with a content-type of url-form-encoded |
| 14:59 | ibdknox | wrap-params will pick it up |
| 14:59 | ibdknox | if it doesn't, which I think is your case, it will be the body itself |
| 15:00 | ibdknox | in which case, use noir.request/ring-request, get the body, and parse it as json |
| 15:00 | ibdknox | and the equivalent would be true in ring/compojure/whatever |
| 15:00 | ibdknox | clows: ^ |
| 15:00 | clows | yeah i thought so … but (:body ring-request) is "" … |
| 15:01 | clows | maybe the client sends the wrong content-type … |
| 15:01 | ibdknox | dump the request and take a look :) |
| 15:01 | ibdknox | if you gist it |
| 15:01 | ibdknox | I can help |
| 15:03 | ibdknox | btw :body should be a stream of some kinda that you'll need to slurp |
| 15:03 | clows | yep… something jettysomething.input… |
| 15:05 | ibdknox | 80.55 |
| 15:05 | ibdknox | whoops |
| 15:05 | franks | amalloy: I gave it another shot for that inheritable-thread-local - see https://refheap.com/paste/673 |
| 15:05 | clows | @ibdknox: https://gist.github.com/1761662 |
| 15:06 | amalloy | much nicer, franks |
| 15:06 | clows | :content-type "application/x-www-form-urlencoded" .. seems… wrong |
| 15:06 | amalloy | though it looks like you got the argument order wrong in your (def counter ...) example |
| 15:06 | franks | amalloy: if I understand it well, you can maintain references to var/atom/ref/? but you cannot come up with a "generic" copy function for all - is that correct? |
| 15:07 | amalloy | yeah, probably true |
| 15:09 | ibdknox | clows: looks correct, but the body is empty? that means they're not sending you anything |
| 15:09 | franks | amalloy: arguments of inheritable-thread-local* and inheritable-thread-local seem mixed up - let me fix that |
| 15:10 | ibdknox | slurping the body results in an empty string? |
| 15:10 | raf_ | Hi all, I have a simple question. I can't figure out how to use the contrib library in 1.3. I want to use strint which was contrib.strint |
| 15:10 | ibdknox | ~contrib |
| 15:10 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 15:11 | clows | ibdknox: yes |
| 15:11 | dEPyHome | hallelujah |
| 15:11 | dEPyHome | I made lein swank and emacs work |
| 15:11 | clows | ibdknox: shouldn't the content-length be 0 then? or is the header included? |
| 15:11 | raf_ | oh perfect, thanks ibdknox |
| 15:12 | franks | amalloy: just a bit confused about how you would use a var as thread-local - could you give an example? |
| 15:12 | amalloy | me? when did i say you should do that? |
| 15:13 | ibdknox | clows: no, you're right. it should be 0 if it's truly empty |
| 15:13 | dEPyHome | So, clojure-jack-in connects to localhost? What if I wanted to connect to remote swank? |
| 15:13 | amalloy | it seems pretty nuts to use a var as a thread-local - just use a plain old var and bindings/set! |
| 15:14 | ibdknox | do you know exactly what the other service is sending? |
| 15:14 | clows | I'll try ring/compojure without any wrappers and check the body… just to make sure they don't send a crappy message … |
| 15:14 | clows | nope :) |
| 15:15 | franks | amalloy: i had the feeling that you could use thread-local in those cases where you cannot easily wrap yourself in a binding |
| 15:15 | clows | ibdknox: i can't just disable the middleware for a particular route in noir can I? |
| 15:15 | ibdknox | no |
| 15:15 | clows | kk |
| 15:16 | ibdknox | Though, noir doesn't really mess with anything at that level, so I'd be a little surprised if it was screwing this up. |
| 15:16 | ibdknox | try it with just straight compojure and let me know what what you see |
| 15:16 | clows | i don't think it's noirs fault … but it's easy to just use a dummy with ring only to test what i get sent |
| 15:16 | clows | did |
| 15:16 | clows | idd |
| 15:17 | ibdknox | yep yep :) |
| 15:17 | amalloy | perhaps you can. but that isn't really how i use thread-local myself |
| 15:17 | franks | amalloy: for example, if the thread you are in was started elsewhere, and you wanted to use the same vars as thread-local - wouldn't that be a use case? or are there better ways to do that? |
| 15:18 | amalloy | i don't really understand the question. but it seems like you know as much about thread-local as i do at this point, so you can answer it yourself |
| 15:18 | franks | (still learning...) |
| 15:20 | raek | franks: 'binding' will stack away any previous value of the var and restore it later, so you can always wrap _your_ code in binding and use the var as a thread local |
| 15:21 | raek | (if I understood your statement correctly) |
| 15:23 | franks | amalloy: real example: i'm trying to turn the repl-prompt on/off depending on the session i have, where session is really identified with the threadID - but I do not have access to the original binding call when the respl-session was started - how can I change prompt-funtion var for only one session/thread? |
| 15:23 | alexyk | how do we flip two args again? |
| 15:24 | franks | couldn't figure out how to do that with binding... ended up maintaining a map of threadId-prompt-fun... |
| 15:26 | franks | raek: would my example be applicable to the use of binding? |
| 15:27 | raek | ideally, you'd want to be able to insert code at the place where the binding form needs to be |
| 15:28 | raek | in that case you can use clojure.main/with-binding |
| 15:28 | raek | *with-bindings |
| 15:30 | franks | raek: ... but in the repl, I cannot easily wrap any future read-eval interaction in a binding if I'm already inside of that session... unless I miss something... |
| 15:32 | franks | this "inheritable-thread-local" would give me what i need with atoms... but those feel like overkill as it feels like i could use vars - just not sure how ;-) |
| 15:33 | clows | ibdknox: i sent a few bytes with curl now … the content-length matches the characters i sent … but the :body is empty |
| 15:35 | ibdknox | clows: yeah, the body will get parsed as url-form-encoded. are you sending it encoded correctly? |
| 15:36 | franks | btw - i'm getting a flood of "Activating Flood Protection"/"Deactivating Flood Protection" messages in my IRC-client - which started a day ago or so - did anything change on the irc-server? or more important how do I get rid of those? |
| 15:37 | ibdknox | clows: although looking at this: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/params.clj, it doesn't seem to be destroying the body, so I'm not sure why it would end up empty |
| 15:37 | Raynes | franks: What IRC client? |
| 15:37 | clows | ibdknox: must be me messing something up… |
| 15:37 | franks | Raynes: Linkinus |
| 15:37 | Raynes | I've had that before. |
| 15:38 | Raynes | Seems like it just stopped happening eventually. Perhaps there is a setting. |
| 15:38 | ibdknox | clows: it was messed up at the ring level too? |
| 15:39 | franks | Raynes: there is a setting but I'm pretty sure I didn't change anything on the client... |
| 15:39 | dEPyHome | where the f*** shoul I put init.el on windows |
| 15:40 | Raynes | On a Linux partition. |
| 15:40 | Raynes | ~rimshot |
| 15:40 | clojurebot | Badum, *tish* |
| 15:41 | gtrak | dEPyHome: like Users/Me/AppData/Roaming/.emacs.d or something, emacs creates it on startup |
| 15:43 | benares_98 | lol |
| 15:49 | clows | ibdknox: yes with only ring it's empty as well … which is a good indicator that I'm doing something wrong |
| 15:52 | TimMc | The hell... how am I managing to segfault the JVM? |
| 15:53 | ibdknox | TimMc: skill. |
| 15:54 | aphyr | TimMc: https://refheap.com/paste/677 |
| 15:54 | aphyr | I hit that sometimes when I've *just* written a file. |
| 15:56 | TimMc | I should probably do a RAM check on this machine, actually. |
| 15:57 | amalloy | TimMc: issue could be you're using a mac? i know when lion came out some people were finding the 64-bit jvm segfaulted |
| 15:57 | TimMc | nah, Thiunkpad |
| 15:58 | TimMc | *<whichever spelling makes you happier> |
| 15:58 | amalloy | thankpod |
| 15:59 | TimMc | I got a freeze in Linux, a brief bluescreen in Windows, and several anomalous Firefox crashes, all today |
| 15:59 | amalloy | TimMc: stay away from hospitals today |
| 16:00 | amalloy | and datacenters |
| 16:00 | TimMc | I try to stay away from hospitals in general. :-) |
| 16:26 | ibdknox | ~contrib |
| 16:26 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 16:29 | clows | ibdknox: https://gist.github.com/1762137 so when send anything to this one… shouldn't the body contain something? |
| 16:29 | technomancy | ibdknox: any progress on hunting down the responsible plugin? |
| 16:30 | clows | ibdknox: i tried curl with various different Content-Types … like: curl --data-binary @project.clj localhost:8081 |
| 16:30 | ibdknox | technomancy: no idea, I removed most of them, it still seems to spike when I do deps. I'll continue my hunt later |
| 16:31 | hiredman | clows: that is all wrong |
| 16:31 | hiredman | (the gist) |
| 16:32 | clows | good |
| 16:32 | hiredman | I would read the docs and look out how other people use it |
| 16:32 | ibdknox | curl -d "bar" --header "Content-Type: text/text" http://localhost:8080/foo |
| 16:32 | technomancy | ibdknox: sure; let me know if you find anything |
| 16:32 | arohner | is there a way to get around the 1.3 ^:dynamic thing in testing, without declaring the var dynamic? |
| 16:32 | ibdknox | technomancy: we'll do |
| 16:32 | ibdknox | will* |
| 16:32 | ibdknox | lol |
| 16:32 | arohner | I seem to remember discussion about this a year ago |
| 16:33 | amalloy | arohner: with-redefs |
| 16:33 | alexyk | I have a vector which I want to turn into a map. I restructure it with named elements and I want the same names as keys. Any magic to not repeat myself? E.g. (fn [[a b]] {:a a :b b}) |
| 16:33 | ibdknox | {:keys [a b]} |
| 16:33 | ibdknox | oh sorry |
| 16:34 | ibdknox | misread |
| 16:34 | raek | alexyk: (fn [coll] (zipmap [:a :b] coll)) |
| 16:35 | arohner | amalloy: thanks |
| 16:35 | ibdknox | clows: actually that thread might be useful: https://groups.google.com/forum/#!searchin/clj-noir/backbone/clj-noir/INqvBo6oXIA/cHUbSnfJRtAJ |
| 16:36 | amalloy | alexyk: http://stackoverflow.com/questions/8999794/map-restructuring |
| 16:36 | alexyk | raek: cool! |
| 16:37 | alexyk | amalloy: thx! |
| 16:43 | clows | ibdknox: thanks… that does help |
| 16:47 | dEPyHome | any way to enable rainbow parens in clojure? |
| 16:47 | dEPyHome | emacs |
| 16:48 | dEPyHome | ah rainbow-delimiters-mode probably ye? :) |
| 16:50 | clows | is it possible that org.mortbay.jetty.HttpParser$Input is not valid once the response has been sent? |
| 16:51 | clows | because i tried to access it through an atom from the repl and it would always be empty … which would explain why i failed so miserably (apart from me doing it all wrong ofc) |
| 16:51 | ibdknox | that's entirely possible |
| 16:52 | ibdknox | just print it out within the handler |
| 16:52 | clows | yeah thats what i do now and now it works |
| 16:58 | clows | ibdknox: works fine in noir as well ofc … as expected … thanks for your help :) |
| 17:06 | dEPyHome | ah |
| 17:07 | dEPyHome | had .elc file there |
| 17:07 | dEPyHome | ups wrong window |
| 17:46 | ihavequestions | hey all, would anybody be able to help a newb with a project setup related issue? |
| 17:48 | amalloy | ~anyone |
| 17:48 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 17:49 | ihavequestions | well, I'm trying to get the lwjgl library setup, but I'm running into an issue where it's not finding classes in the lib |
| 17:50 | ihavequestions | what's odd is that lein seems to have downloaded everything, including the native dependencies |
| 18:09 | samaaron | how do I access a java field when there also exists a no-arg method of the same name? |
| 18:09 | hiredman | samaaron: reflection |
| 18:09 | yoklov | ouch |
| 18:10 | amalloy | surely that's not the only option. (. obj field) probably works, and if it doesn't then wasn't the (. obj -field) syntax ported from cljs? |
| 18:10 | ibdknox | in 1.4-beta the property syntax would work |
| 18:10 | ibdknox | amalloy: yes |
| 18:11 | hiredman | come to think of it, (. obj :field) might work too |
| 18:11 | samaaron | i'll give them both a go :-) |
| 18:13 | ihavequestions | so, is there a better channel to direct questions regarding setting up a project so classes in libraries are found, or is this pretty much it? |
| 18:14 | ibdknox | ihavequestions: this or #leiningen would be it, but your main barrier here is that I'd be surprised if many people have even heard of the library you referenced |
| 18:15 | ihavequestions | ah, ok, I guess I didn't realize it was so rarely used. thank you |
| 18:16 | oakwise | ihavequestions: afaik there isn't a lot of active/open gl development in clojure right now. You might want to take a look at penumbra, which wraps LWJGL, but is not longer actively maintained. I have no idea of the project files there will help or not. |
| 18:17 | samaaron | hiredman: (. obj :field) seems to work :-) |
| 18:18 | hiredman | samaaron: right, but I don't think that will work in 1.4 |
| 18:18 | ihavequestions | I don't want to actually use penumbra given it's no longer really being maintained, but I guess I could see if I can glean anything from their setup |
| 18:20 | konr | should I use any specific format for docs? is "foo\n does this" preferable to "foo: does this"? |
| 18:20 | amalloy | ihavequestions: you also haven't given enough information for anyone to be able to help yet. "some classes can't be found" isn't actionable; you could, for example, make your project into a git repo and put it on github so someone can see what's going wrong |
| 18:20 | konr | I mean, to document the arguments of functions |
| 18:21 | ihavequestions | that's a good idea, I'll check that out |
| 18:22 | ihavequestions | I'll be back later on with some stuff on git, thanks everyone |
| 18:24 | weavejester | Does anyone know if mocking functions is possible in a post-:dynamic world? |
| 18:24 | ibdknox | weavejester: with-redefs |
| 18:25 | weavejester | ibdknox: Perfect. Thanks! |
| 18:25 | ibdknox | weavejester: actually, I have a question for you. Would you consider having non-macro versions of GET/POST/etc in Compojure? |
| 18:26 | weavejester | ibdknox: For what reason? |
| 18:26 | ibdknox | I was trying to create some routes dynamically and it required a very convoluted solution as it was macros inside of macros |
| 18:28 | weavejester | ibdknox: I guess I'd have to see the use-case, but you don't need macros to create routes dynamically. |
| 18:28 | weavejester | ibdknox: The GET/POST/etc macros are essentially just specialized forms of fn |
| 18:28 | ibdknox | I'm translating (some-macro [:post "/somdomf"] ...) into a route |
| 18:31 | weavejester | Hmm... I guess it might be an idea to factor out some of the macro code into functions |
| 18:31 | ibdknox | weavejester: here's what I ended up having to do: https://github.com/ibdknox/noir/blob/1.3/src/noir/core.clj#L207 |
| 18:31 | ibdknox | weavejester: I might be missing something obvious though |
| 18:32 | ibdknox | I would've called the functions you were directly, but they're private |
| 18:34 | ibdknox | the use-case is a little REST api generator that handles versioning things and such |
| 18:34 | ibdknox | and generates most of the parts of the route dynamically |
| 18:36 | weavejester | ibdknox: Hm, it kinda looks like you want the compile-route function to be public? |
| 18:36 | ibdknox | basically |
| 18:36 | ibdknox | :) |
| 18:36 | weavejester | Or, wait, something more fundamental than that... |
| 18:37 | weavejester | It might be an idea to factor out some of the routing logic into public functions. |
| 18:38 | mebaran151 | I'm using seesaw, and just wondered if anybody knew the best way to update the contents of a listbox |
| 18:39 | weavejester | ibdknox: Let me think about it a little... |
| 18:40 | weavejester | ibdknox: It might take a little while to come up with a good design though |
| 18:40 | ibdknox | weavejester: no worries. I got it working, but eval makes me sad :( |
| 18:41 | weavejester | ibdknox: Yeah. It's not ideal. |
| 18:41 | ibdknox | weavejester: I'm also happy to help however I can |
| 18:41 | weavejester | ibdknox: Well, I'm kinda running out of names for things :) |
| 18:42 | weavejester | Clout has routes, which are strings that match URIs |
| 18:42 | weavejester | But Compojure also has its routing macros |
| 18:42 | weavejester | I'm kinda stuck what to call the different parts :P |
| 18:43 | weavejester | Maybe I need something like: (request-matches? [:get "/foo"] request) |
| 18:44 | weavejester | Or... (make-route :get "/foo" func) |
| 18:45 | weavejester | I could also use (route :get "/foo" (fn [req] ...)) |
| 18:45 | weavejester | But that's too similar to "routes" |
| 18:45 | weavejester | (->route :get "/foo" (fn [req] ...)) ? |
| 18:45 | weavejester | To borrow from the record syntax, but that could be misleading... |
| 18:47 | weavejester | make-route is probably sufficient, I guess, and it goes with compile-route. |
| 18:47 | amalloy | ibdknox: i had an issue yesterday that i just realized is related to the .-foo member syntax being ported to clj. seems like the sort of thing you might be interested in: http://dev.clojure.org/jira/browse/CLJ-929 |
| 18:52 | seancorfield | i just added swank-clojure 1.4.0 to my project and it seems to have highjacked C-c C-z to be something to do with ClojureScript? |
| 18:53 | seancorfield | hmm, no, now it's run-lisp ... i swear a minute ago i got a minibuf warning about CLOJURESCRIPT_HOME not being set |
| 18:53 | seancorfield | C-c C-z used to switch to the slime repl - which is what the swank-clojure docs say it should do |
| 18:56 | amalloy | seancorfield: C-c C-z is generally bound buffer-locally. so in a .clj file it should switch, but what it does in a .cljs (or non-clojure) file i wouldn't expect to be the same |
| 18:58 | ibdknox | weavejester: make-route seems reasonable to me |
| 18:59 | ibdknox | amalloy: I see |
| 18:59 | ibdknox | amalloy: I was surprised when they said that it wouldn't affect anything |
| 19:00 | amalloy | well, i confess i was taken in - i didn't consider the case of members starting with - or _ |
| 19:00 | seancorfield | amalloy: yeah, i was in a .clj file - i was just surprised the binding had changed |
| 19:00 | seancorfield | if i knew what it used to be bound to, i could set it back! :) |
| 19:00 | hiredman | I still think prefixing field names with - is the ugliest thing they could have done |
| 19:01 | seancorfield | i may just restart emacs - i think i've had the same instance running for a couple of weeks now... |
| 19:01 | ibdknox | hiredman: I tried :( |
| 19:01 | hiredman | and to force it back on to clojure on the jvm :( |
| 19:02 | ibdknox | woah, alex payne just followed me on twitter lol |
| 19:02 | ibdknox | I wonder if they're using Clojure |
| 19:02 | hiredman | (. foo -bar) from the guy who upvoted json literals in clojure |
| 19:02 | amalloy | haha |
| 19:03 | gfredericks | is there anything needed to make JSON literals valid clojure beyond counting ":" as whitespace? |
| 19:04 | gfredericks | oh and null |
| 19:04 | hiredman | gfredericks: a strong stomache |
| 19:04 | gfredericks | :) |
| 19:04 | hiredman | I don't think I could do it, the vomit would interfere with my typing |
| 19:04 | gfredericks | hiredman: that's a hardware limitation |
| 19:07 | amalloy | counting : as whitespace is an idea that isn't internally-consistent |
| 19:07 | gfredericks | it's used for something else? |
| 19:08 | hiredman | ,:foo |
| 19:08 | clojurebot | :foo |
| 19:08 | gfredericks | pfha |
| 19:08 | gfredericks | strange the things I'm blind to |
| 19:09 | seancorfield | odd, a restart of emacs seems to have fixed my C-c C-z woes... for now, at least... |
| 19:10 | adiabatic | I wonder how easy it is for emacs instances to get up to 8 or 80 GB of RAM usage now. |
| 19:12 | seancorfield | emacs never seems to consume much memory on my mac... even after being open for days... |
| 19:12 | ibdknox | not like browsers :D |
| 19:12 | ibdknox | which are the most memory efficient pieces of software ever created |
| 19:12 | seancorfield | not like leaky ol' rockmelt, certainly :) |
| 19:20 | dnolen | hmm seems CLJ/CLJS protocols support delegation and component oriented design pretty well |
| 19:24 | stevelew | i've watched a few of the recent videos coming out of clojure/conj |
| 19:59 | timvisher | hey all |
| 20:00 | samaaron | can anyone tell my why this throws an error: (.remove (proxy [java.util.concurrent.ConcurrentHashMap] [] (remove [a b] (println "hiya" this))) "foo" "bar") |
| 20:00 | timvisher | i'm trying to write a templating system that uses clojure.walk/prewalk-replace iteratively on a heterogenous template vector that can include calls to functions |
| 20:01 | timvisher | The substitution map is a basic map with keywords as keys |
| 20:01 | hiredman | samaaron: what exception does it throw? |
| 20:01 | timvisher | the problem is that the functions are being evaluated during the walk |
| 20:01 | timvisher | or at least that's what it appears to be doing |
| 20:02 | timvisher | any way that I can walk the entire tree without triggering the evaluation? |
| 20:02 | ibdknox | timvisher: sounds like you're not using a macro |
| 20:02 | timvisher | trying to not use macros :) |
| 20:02 | samaaron | hiredman: a null pointer |
| 20:02 | ibdknox | timvisher: you'll have to if you want the args unevaluated |
| 20:03 | timvisher | i suppose i could quote the whole thing and then unquote when I need to use it? |
| 20:03 | samaaron | hiredman: user.proxy$java.util.concurrent.ConcurrentHashMap$0.remove(Unknown Source) |
| 20:03 | hiredman | that is a method, not an exception |
| 20:04 | hiredman | a npe, huh |
| 20:04 | samaaron | hiredman: yeah, that's the top of the stacktrace |
| 20:05 | timvisher | i feel like this is exposing a hole in my understanding of lazy evaluation... |
| 20:06 | hiredman | samaaron: seems to go away if I put a true after the println |
| 20:06 | samaaron | hiredman: I'm trying to figure out how to override a no-arg version of a method only, and leave the other overloaded fns intact |
| 20:07 | dgrnbrg | Is a map different than a vector indexed by the value's hash with a small cache? |
| 20:07 | hiredman | or if I wrap the body in a (boolean ...) |
| 20:07 | dgrnbrg | timvisher |
| 20:07 | hiredman | samaaron: you have to overload them all and forward other calls on via proxy-super |
| 20:07 | dgrnbrg | I just wrote this library, but using clojure zippers and building a lazy-evaluation dsl |
| 20:07 | samaaron | hiredman: oh really? |
| 20:07 | samaaron | that's a pain |
| 20:08 | timvisher | dgrnbrg: meaning the library i'm building right now? |
| 20:08 | dgrnbrg | approximately, yes |
| 20:08 | timvisher | lol |
| 20:08 | timvisher | love to hear that |
| 20:08 | dgrnbrg | i'm writing a compiler in clojure, so I needed it |
| 20:08 | timvisher | published it at all? |
| 20:08 | hiredman | samaaron: what version of clojure are you using? |
| 20:08 | samaaron | hiredman: 1.3 |
| 20:08 | dgrnbrg | but it's got a lot of extra features you won't need |
| 20:08 | dgrnbrg | the zippers give the ultimate in flexibility |
| 20:08 | hiredman | I'd try that proxy line on 1.2, it seems like a regression in proxy |
| 20:08 | timvisher | it'd be interesting to see at least |
| 20:09 | dgrnbrg | although I haven't tested editing extensively |
| 20:09 | hiredman | (not matching up return values from methods properly) |
| 20:09 | dgrnbrg | https://github.com/dgrnbrg/piplin/blob/master/src/piplin/modules.clj#L180 |
| 20:09 | samaaron | hiredman: that line isn't anything i want to work though - it was just an example |
| 20:09 | dgrnbrg | starting there and going down I develop a zipper that works on maps |
| 20:09 | dgrnbrg | and write comprehensions on trees |
| 20:10 | dgrnbrg | https://github.com/dgrnbrg/piplin/blob/master/src/piplin/types.clj#L49 -- these 3 macros do various kinds of lazy/deferred evaluation |
| 20:10 | timvisher | very cool |
| 20:10 | dgrnbrg | And I have been working on a monadic interface |
| 20:10 | dgrnbrg | I think it's superior to the macro system I have |
| 20:11 | timvisher | i've still managed to never implement a macro so they still scare me. ^_^ |
| 20:11 | dgrnbrg | It's a function that gets a piece of code in |
| 20:11 | dgrnbrg | and returns a new piece of code to get pasted in instead |
| 20:11 | timvisher | Oh I get them |
| 20:11 | timvisher | it's a little like recursion |
| 20:11 | dgrnbrg | with some syntactic sugar :) |
| 20:12 | dgrnbrg | it's not really like recursion |
| 20:12 | dgrnbrg | although macros can be recursively expanded |
| 20:12 | timvisher | i'm not the sharpest guy in the world, and it took me a long time before i was able to see cases where recursion would be an elegant solution |
| 20:12 | dgrnbrg | have you ever used C+ |
| 20:12 | dgrnbrg | ? |
| 20:12 | timvisher | i don't mean technically, i mean perceptively |
| 20:12 | dgrnbrg | with #define macros? |
| 20:12 | timvisher | i get what macros are technically |
| 20:12 | timvisher | their application still is something that hasn't clicked for me yet |
| 20:12 | timvisher | i don't yet see a problem and go 'ah! macros would help here' |
| 20:12 | timvisher | know what i mean? |
| 20:13 | dgrnbrg | Think of it like this: they reduce boilerplate |
| 20:13 | timvisher | i'm slow like that. :) |
| 20:13 | dgrnbrg | if you just try to think of it like "if only I could add this repeated pattern to these codes, it'd be much cleaner looking" |
| 20:14 | timvisher | yep |
| 20:14 | dgrnbrg | do you want to get the entire tree through the call graph, or just the code that's immediately visible? |
| 20:14 | timvisher | the tricky part here is that i wouldn't be avoiding boilerplate, i'd simply be forcing things not to be evaluated |
| 20:14 | timvisher | which a mocro would do, but again, it's not the first thing i thought of |
| 20:15 | timvisher | you mean in my templating system? |
| 20:15 | dgrnbrg | yes |
| 20:15 | dgrnbrg | is it as simple as quoting the contents? |
| 20:15 | timvisher | i basically want to be able to pass something like `[:foo-part :bar-part]` into my `expand-template` function and have it recursively expand out |
| 20:15 | timvisher | every part that gets dropped into place can also have more expansions inside of it |
| 20:15 | dgrnbrg | you don't need macros |
| 20:15 | timvisher | the code iterates over that recursively looking for more things to expand |
| 20:16 | dgrnbrg | just funtions |
| 20:16 | dgrnbrg | I see |
| 20:16 | timvisher | until finally it says that the expanded version is the same as the non-expanded version and quits |
| 20:16 | dgrnbrg | I'm not sure I'd use walk |
| 20:16 | timvisher | that all works |
| 20:16 | timvisher | until I throw in function calls |
| 20:16 | timvisher | and now i'm here. :) |
| 20:16 | timvisher | what would you use? |
| 20:16 | dgrnbrg | I think I might use a plain recursive function |
| 20:17 | dgrnbrg | suppose all the templates are in a map with {:name '(the-part)} pairs |
| 20:17 | timvisher | The code as i have it implemented is actually extremely concise |
| 20:17 | timvisher | https://gist.github.com/1764009 |
| 20:17 | timvisher | which they are |
| 20:18 | dgrnbrg | how is expand-template implemented? |
| 20:18 | timvisher | ah |
| 20:18 | timvisher | lol |
| 20:18 | timvisher | wrong part |
| 20:18 | timvisher | sorry |
| 20:18 | timvisher | https://gist.github.com/1764014 |
| 20:18 | timvisher | there ya go! |
| 20:19 | timvisher | so you see i can extend my expansions at call time by simply passing a map |
| 20:19 | timvisher | there are all sorts of potential gotchas but i've been at this for all of an hour or two at this point so i figure robustness can come later |
| 20:20 | timvisher | first make it work, then make it right and all |
| 20:20 | dgrnbrg | I think you can avoid the loop/recur |
| 20:20 | dgrnbrg | using iterate |
| 20:21 | dgrnbrg | that repeats a function |
| 20:21 | timvisher | good point |
| 20:21 | timvisher | hadn't thought of that |
| 20:22 | timvisher | I guess i would take until = next current ? |
| 20:22 | dgrnbrg | hang on, let me come up w/ something clever |
| 20:22 | timvisher | lol |
| 20:23 | amalloy | https://github.com/AlexBaranosky/Utilize/blob/master/src/utilize/fn.clj#L114 |
| 20:23 | amalloy | (timvisher, dgrnbrg) |
| 20:24 | amalloy | i don't really like his implementation, but you get the idea |
| 20:24 | timvisher | ah the inimitable amalloy :) |
| 20:24 | timvisher | amalloy: his = mine? |
| 20:25 | amalloy | his. that's alex baranosky's fork of useful |
| 20:25 | timvisher | gotcha |
| 20:25 | amalloy | i suggested he add the general steady-state instead of a special-case version for macroexpand, but it's a lot nicer with lazy seqs instead of a vector |
| 20:26 | dgrnbrg | I made this one: https://gist.github.com/1764040 |
| 20:26 | dgrnbrg | I tried to be clever ;) |
| 20:27 | dgrnbrg | it seems like there should be a fixed-point function in core |
| 20:27 | TimMc | amalloy: The JVM segfaults I had earlier? Bad RAM. |
| 20:27 | TimMc | Probably the best possible thing to go wrong. |
| 20:28 | TimMc | Unlike other components, I don't need all of it, and unlike software, it can be fixed. :-P |
| 20:28 | TimMc | (or replaced) |
| 20:28 | amalloy | (for [[x y] (partition 2 (iterate f x)) :while (not= x y)] x), dgrnbrg |
| 20:28 | dgrnbrg | ah |
| 20:29 | dgrnbrg | I never use for |
| 20:29 | amalloy | uuuuse it. it's the best |
| 20:29 | TimMc | (juxt for fnil) |
| 20:29 | TimMc | hrm |
| 20:29 | amalloy | (let [nuts fnil] (nuts for juxt)) |
| 20:30 | TimMc | ha! |
| 20:30 | dgrnbrg | I don't get it. |
| 20:30 | dgrnbrg | I think it's a joke? |
| 20:31 | TimMc | There's not much to get. |
| 20:31 | TimMc | except that Raynes says that amalloy is nuts for juxt |
| 20:31 | dgrnbrg | and fnil is like for in its utility? |
| 20:31 | amalloy | and fnil, for, and juxt are pretty good |
| 20:31 | TimMc | It wouldn't even run; 'for is a macro. |
| 20:31 | dgrnbrg | that's what I thought |
| 20:31 | amalloy | i don't think fnil is anywhere near as useful but it's more overlooked |
| 20:31 | dgrnbrg | I didn't know about these functions |
| 20:31 | dgrnbrg | how useful |
| 20:32 | TimMc | fnil really shines when you're using update-in |
| 20:32 | dgrnbrg | my code will become simpler now :) |
| 20:32 | dgrnbrg | although it has a dreadful abomination of a double macro that expands another macro beneath it |
| 20:32 | dgrnbrg | I don't understand what it does, and it's got terrible bugs due to when names get resolved |
| 20:32 | dgrnbrg | ~'~x lol |
| 20:32 | clojurebot | Excuse me? |
| 20:32 | TimMc | dgrnbrg: ~' |
| 20:33 | dgrnbrg | https://github.com/dgrnbrg/piplin/blob/master/src/piplin/types.clj#L87 |
| 20:33 | dgrnbrg | that is confusing |
| 20:33 | dgrnbrg | to me |
| 20:33 | dgrnbrg | I find it unclear what I did |
| 20:33 | TimMc | I believe you, but I can't open a browser right now. |
| 20:33 | dgrnbrg | `(defmacro ~name [& ~param-sym] |
| 20:33 | dgrnbrg | `(apply (fn [~@'~params] ~@'~body) |
| 20:33 | dgrnbrg | (join-errors |
| 20:33 | dgrnbrg | ~@~param-sym))))) |
| 20:33 | TimMc | heh |
| 20:34 | dgrnbrg | I think param-sym is a gensym, params is a list, and body is a list |
| 20:34 | TimMc | I was just dealing with one of those. Luckily, I was converting it *away* from producing macros. |
| 20:34 | dgrnbrg | I want to remove it |
| 20:34 | dgrnbrg | I'm trying to figure out a monad to do it |
| 20:34 | dgrnbrg | along with a simple lazy-eval macro |
| 20:35 | dgrnbrg | that piece of code has given me a lot of problems |
| 20:37 | timvisher | dgrnbrg: so as clever as that is it still doesn't seem to allow me to have unquoted functions in my templates |
| 20:37 | timvisher | for that i guess i'm doomed to the world of macros? |
| 20:37 | dgrnbrg | Think of it like this |
| 20:37 | dgrnbrg | if you want the argument to be quoted, then put a ' in front of it |
| 20:37 | dgrnbrg | but maybe that's ugly as sin |
| 20:37 | ibdknox | timvisher: macros aren't evil |
| 20:38 | timvisher | ibdknox: i know they're not evil. they just scare me. ;) |
| 20:38 | dgrnbrg | so instead, use a syntax-quotes and write a doit-impl function to go with the doit macro |
| 20:45 | timvisher | what's the function equivalent of `~`? |
| 20:48 | TimMc | timvisher: Do you mean (syntax-quote (unquote (syntax-quote ...))) ? |
| 20:48 | timvisher | TimMc: something like that |
| 20:48 | timvisher | a la elisp (quote |
| 20:48 | timvisher | may not exist here |
| 20:48 | timvisher | figured it would as ' is just reader syntax |
| 20:49 | timvisher | at least irrc |
| 20:49 | amalloy | `~` is just ` |
| 20:49 | hiredman | https://github.com/hiredman/syntax-quote |
| 20:50 | samaaron | how do i turn off auto-ns-qualification for a given symbol within a ` quote? |
| 20:51 | timvisher | any way to cancel an evaluation at the slime repl? |
| 20:51 | timvisher | other than killing the whole buffer? |
| 20:51 | TimMc | samaaron: ~' |
| 20:51 | samaaron | TimMc: awesome, thanks |
| 20:51 | TimMc | &`[a ~'b c] |
| 20:51 | lazybot | ⇒ [clojure.core/a b clojure.core/c] |
| 20:51 | samaaron | I knew it was something fiddly :-) |
| 20:52 | TimMc | You unquote from the syntax-quote's scope and then return a literal symbol. |
| 20:52 | timvisher | Ah. `C-c C-c` |
| 20:52 | TimMc | Totally didn't make sense to me for at least 3 months after seeing it the first time. |
| 20:55 | dgrnbrg | I recently grokked nested syntax-quotes |
| 20:55 | dgrnbrg | the unquotes match outwards in to which level of syntax quoting |
| 20:58 | beffbernard | Hi, is it possible to have clojure/tools.logging log when evaluating in slime or inferior-lisp? |
| 20:59 | timvisher | beffbernard: what behavior are you seeing? |
| 21:00 | timvisher | if you call log then they should write out |
| 21:00 | timvisher | possible that you're not looking in the right buffer or file? |
| 21:01 | beffbernard | timvisher: it just returns nil |
| 21:01 | beffbernard | I have something like this |
| 21:01 | beffbernard | (defn -main [] (info "Hello, World!")) |
| 21:01 | beffbernard | it works if I lein run |
| 21:01 | timvisher | how are you connecting to swank? |
| 21:01 | timvisher | clojure-jack-in? |
| 21:01 | beffbernard | yup |
| 21:04 | beffbernard | does it make a difference if I have org.slf4j/slf4j-api as the dependency and slf4j-simple as the dev-dependency? |
| 21:05 | timvisher | well, i've duplicated your results over here. :) |
| 21:05 | timvisher | though that doesn't really get us any closer to a solution |
| 21:05 | timvisher | i'm not sure where slime redirects standard out to |
| 21:05 | timvisher | it shouldn't |
| 21:05 | beffbernard | if I println it goes to stdout |
| 21:12 | timvisher | beffbernard: sorry, i've got nothing. :( |
| 21:12 | beffbernard | Well I appreciate your help |
| 21:26 | echo-area | Has clojure.contrib been deprecated? And why? |
| 21:27 | technomancy | clojurebot: what happened to contrib? |
| 21:27 | clojurebot | Well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 21:27 | echo-area | Oh, thank you technomancy |
| 21:27 | technomancy | oh, don't thank me, thank clojurebot =) |
| 21:31 | beffbernard | technomancy: I noticed you're on the contributors list for tools.logging. Do you mind if I ask you a question regarding it? |
| 21:40 | technomancy | I am? |
| 21:40 | technomancy | I guess I contributed to a few threads about it on the mailing list. |
| 21:40 | technomancy | anyway, never hurts to ask |
| 21:42 | beffbernard | technomancy: Opps.. You are thanked in the README |
| 21:43 | beffbernard | I'm unable to get tools.logging to log to stdout in slime |
| 21:43 | beffbernard | although it works in inferior-lisp |
| 21:43 | beffbernard | and lein run |
| 21:43 | technomancy | hm; IIRC *out* gets rebound by swank, but System/out might not |
| 21:43 | technomancy | have you checked the *swank* buffer? |
| 21:44 | beffbernard | :O nope |
| 21:44 | beffbernard | one sec |
| 21:45 | beffbernard | technomancy: no dice |
| 21:46 | technomancy | hm; that should be hooked up to standard out |
| 21:47 | beffbernard | Is there anyway to see what's in the classpath? |
| 21:47 | technomancy | sure; "lein classpath" |
| 21:48 | beffbernard | I mean what's in process |
| 21:48 | technomancy | should be the same |
| 21:48 | technomancy | but you can check (System/getProperties) |
| 21:54 | technomancy | http://p.hagelb.org/lein-classpath.html <- why is my shell being a smartass? |
| 21:54 | technomancy | latter works, former doesn't |
| 21:55 | beffbernard | Well the appropriate jars are loaded |
| 21:58 | beffbernard | technomancy: so how do I use that info? You said the latter works? Where do I put that? |
| 21:59 | technomancy | beffbernard: I meant of the two expressions in the link I pasted, the second one works |
| 21:59 | technomancy | it has nothing to do with logging; this is a problem with leiningen's shell script |
| 22:00 | beffbernard | I got that but I don't know where to put it |
| 22:00 | beffbernard | Also, thanks for the help. It's much appreciated |
| 22:00 | technomancy | sure... gotta jet now though |
| 22:00 | technomancy | ...literally |
| 22:01 | beffbernard | ok, safe travels |
| 22:18 | TimMc | technomancy: I find myself wanting to run `lein trampoline multi test` o.O |
| 22:20 | TimMc | I believe I'm getting insufficient isolation in my multi-deps. |
| 22:31 | murm | . |