2012-07-30
| 00:00 | ivan | right, it's ported from http://en.literateprograms.org/Fibonacci_numbers_%28Haskell%29#Infinite_Lists |
| 00:00 | ivan | the Clojure version is made of lies, though, because it creates tons of lazy-seqs |
| 00:01 | ivan | &(take 40 ((fn fibs [] (concat '(1 1) (lazy-seq (map +' (fibs) (drop 1 (fibs)))))))) |
| 00:02 | lazybot | Execution Timed Out! |
| 00:02 | uvtc | Crazy. :) But seems to follow that same pattern of a function returning the value you want, cons'd/concat'd with the rest... |
| 00:03 | Frozenlock | ivan: I did exactly the same thing in my REPL |
| 00:03 | Frozenlock | Still waiting... |
| 00:03 | uvtc | The repl just really wants to make you happy and show you results. :) |
| 00:04 | Frozenlock | Yeah... I didn't think that through before hitting enter |
| 00:04 | Frozenlock | Silly me |
| 00:04 | Frozenlock | Still waiting |
| 00:04 | uvtc | Yup. I've done it a bunch of times too. |
| 00:04 | muhoo | what's the most recent version of lein-cljsbuild that'll work with clojure 1.4, i.e. that doesn't require clojure/instant__init.class ? |
| 00:04 | uvtc | Frozenlock: sounds like your terminal is either frozen, or locked, or both. |
| 00:05 | ivan | 40 will never finish in reasonable time |
| 00:05 | uvtc | Frozenlock: Perhaps some sort of "frozen-lock", if you will. ;) |
| 00:05 | Frozenlock | Oh snap |
| 00:06 | muhoo | emezeske: actually i should have slung that question over your direction |
| 00:07 | Frozenlock | Well, I think I will need to kill it. Any shortcut to kill the java instance from emacs? (And only this one, I have other java stuff running) |
| 00:07 | muhoo | ps fax |grep java |grep clojure , pull out the process id, then kill that? |
| 00:08 | ivan | Frozenlock: ctrl-\ |
| 00:08 | Frozenlock | Oh wait : GC overhead limit exceeded |
| 00:08 | ivan | er, never mind, I didn't read |
| 00:08 | Frozenlock | java.lang.OutOfMemoryError |
| 00:10 | Frozenlock | muhoo: yep, that would have worked, thanks |
| 00:13 | muhoo | Raynes: have you any interest in the ability to have comments/discussions on refheap pastes? |
| 00:15 | muhoo | just saw a gist where someone posted a stacktrace, and in the comments, was the solution how to fix the damn thing. it was a lot more helpful than just a lonely paste with no solution, which is unfortunatley what google turns up too often these days. |
| 00:16 | emezeske | muhoo: I don't know what clojure/instant__init.class is. |
| 00:16 | emezeske | muhoo: You should be fine with clojure 1.4 if you just use the latest lein-cljsbuild. |
| 00:29 | muhoo | emezeske: thanks, works with 1.4, great |
| 00:32 | emezeske | muhoo: Sweet. |
| 00:35 | muhoo | Successfully compiled "resources/public/main.js" in 29.359273107 seconds. :-) |
| 00:35 | emezeske | muhoo: Hah, is that with :advanced optimizations? |
| 00:36 | muhoo | :whitespace :-P |
| 00:36 | emezeske | muhoo: Wow! Big project? |
| 00:36 | muhoo | (.log js/console "hello world") |
| 00:36 | muhoo | on a eee netbook |
| 00:36 | emezeske | Ahhh |
| 00:36 | emezeske | If you do "lein cljsbuild auto", subsequent compiles should be a bit faster |
| 00:37 | muhoo | yes, that's very awesome. i've got lein cljsbuild auto, trampoline repl, and it works |
| 00:37 | emezeske | nice! |
| 00:37 | muhoo | emezeske: thanks again for this lein-cljsbuild! |
| 00:48 | muhoo | pretty cool. hello world is 126kb in advanced mode. holy crap, i'm using cljs now. |
| 00:52 | Raynes | muhoo: Not particularly, no. But if someone else implemented it then I'd accept that patch (you know, as long as the patch didn't suck of course). |
| 00:53 | Raynes | muhoo: Only for logged in people though. I don't need more spambait. :p |
| 00:53 | muhoo | Raynes: yeah, that'd be included under "not suck" |
| 00:54 | muhoo | does lein support multiple parallel tasks? |
| 00:54 | Raynes | Parellel? No. |
| 00:54 | Raynes | You could easily add that functionality, I do believe. |
| 00:54 | Raynes | Just add a parallel version of its 'do' task. |
| 00:54 | muhoo | it'd sure be nice to do "lein cljsbuild auto & trampoline repl " or similar |
| 00:54 | muhoo | and have both run |
| 00:55 | Raynes | Well, you can do 'lein do cljsbuild auto, trampoline run" I think |
| 00:55 | Raynes | But they'll run one at a time and not at the same time (parallel). |
| 00:55 | muhoo | i can, but the trampoline repl blocks until auto completes, which is never |
| 00:56 | Raynes | Then yeah, you want parallel. |
| 00:56 | muhoo | i'll put it on my list of things to do |
| 00:56 | Raynes | muhoo: I bet technomancy would accept a patch to add that functionality. Not sure if it should be a new task, or... |
| 00:56 | Raynes | Probably just want to make an issue about it and see what he says. |
| 00:56 | Raynes | I think it'd be great. |
| 00:56 | muhoo | thanks, will do. it'd come in handy for cljs hacking |
| 00:57 | Raynes | I'd even go so far as to do it myself if he says he wants it. |
| 00:57 | muhoo | ok, will see what he says |
| 00:58 | muhoo | 0 open issues on leiningen :-O |
| 01:00 | Raynes | muhoo: Closer to 31. |
| 01:01 | muhoo | ah, i had some kind of filter on, apparently |
| 01:01 | muhoo | 32 now :-P |
| 01:21 | jcao219 | bah, i can't install swank-clojure on windows |
| 01:22 | jcao219 | i came across https://github.com/technomancy/swank-clojure/issues/98 |
| 01:37 | emezeske | muhoo: You don't actually want to be able to run the auto build in the background of your repl |
| 01:37 | emezeske | muhoo: Imagine having a form half-typed-out in the repl, and then the auto build triggers and spits out a bunch of warnings |
| 01:37 | emezeske | muhoo: Or even just the "Completed in ..." message |
| 01:38 | emezeske | muhoo: Having stuff asynchronously barf into your repl is not fun, and you don't want to just hide the auto build output |
| 01:39 | emezeske | muhoo: I suggest just running autobuild in one terminal tab, and the repl in another (or separate windows, etc) |
| 02:24 | muhoo | well, actually, i don't type in the same terminal |
| 02:24 | muhoo | so i'd rather have them both in the same terminal. i access the repl using telnet via emacs (and eventually nrepl once i get that set up) |
| 02:24 | muhoo | i generally run the repl headless. |
| 02:25 | Raynes | muhoo: There is no set up. |
| 02:25 | muhoo | set up? |
| 02:25 | Raynes | up set. |
| 02:25 | emezeske | muhoo: But, how does the telnet do I/O with the REPL? |
| 02:25 | emezeske | muhoo: AFAIK the REPL is just stdin and stdout |
| 02:25 | muhoo | there's a repl-port |
| 02:26 | muhoo | in lein2, it's nrepl. in lein1, it's just telnet |
| 02:26 | emezeske | Uh, I mean the clojurescript repl |
| 02:26 | muhoo | that part i'm still figuring out. looks like it runs on port 9000 |
| 02:26 | emezeske | No, that's not what that port does |
| 02:27 | emezeske | That's the port that talks to the browser and sends javascript off for evaluation |
| 02:27 | emezeske | The clojurescript REPL is stdin, stdout. |
| 02:30 | muhoo | ah, i see, when run from lein cljsbuild repl-foo. hmm |
| 02:30 | emezeske | muhoo: It is a totally different thing than "lein repl" |
| 02:30 | emezeske | muhoo: Related only in name |
| 02:30 | muhoo | well THAT repl i'd probably want to run from somewhere else, true, and i'll have to figure out how to connect that to emacs. hmm. |
| 02:31 | emezeske | Yep. |
| 02:31 | emezeske | I have no emacs experience, unfortunately |
| 02:31 | emezeske | I think I've heard about people getting that to work, though |
| 02:31 | muhoo | i'll play around with it. this week is cljs week for me, it seems. |
| 02:33 | emezeske | :) |
| 02:33 | muhoo | i've been running the cljs repl from inside the project, via that (repl-env) stuff |
| 02:34 | brainproxy | muhoo: the cljs repl can be used in emacs via inferior lisp |
| 02:34 | muhoo | great, that's good to know |
| 02:35 | brainproxy | https://github.com/michaelsbradleyjr/prelude/blob/master/personal/cljs-repl-in-emacs.txt |
| 02:35 | brainproxy | ^ I use the "lein trampoline cljsbuild repl-listen" option |
| 02:35 | brainproxy | don't forget to put the quotes around it |
| 02:40 | muhoo | this is interesting. i end up with 3 java processes running: one for my project repl, one for the cljsbuild auto, and one for the cljs repl |
| 02:41 | muhoo | i still would personally rather have the cljs repl running headless and connect to it via nrepl rather than running it as an inferior lisp, but that'd work for now. |
| 02:41 | emezeske | muhoo: I'd gladly accept a pull request for something like that |
| 02:42 | emezeske | muhoo: The existing repl stuff for clojurescript is *very* basic. |
| 02:46 | muhoo | cool |
| 03:34 | guns | I am trying to play with core.reducers, but my copy of Java 7 SE (from Oracle) doesn't include jsr166y.jar |
| 03:34 | guns | but it does seem to be in ~/.m2 |
| 03:34 | guns | How do I get leiningen to load the jar on jvm boot? |
| 03:34 | hiredman | guns: the jsr166y jar is for backwards compat |
| 03:35 | hiredman | java 7 includes the forkjoin framework |
| 03:35 | guns | hiredman: hmm. core.reducers fns are returning java.lang.NoClassDefFoundError: jsr166y/ForkJoinPool |
| 03:35 | hiredman | guns: I suggest making sure you are actually using java 7 |
| 03:35 | hiredman | java -version |
| 03:35 | guns | java version "1.7.0_05" |
| 03:35 | guns | I know very little about java tbh |
| 03:36 | guns | I thought I could make it through life without looking at Java class docs, but here I am |
| 03:37 | hiredman | guns: and what does (System/getProperty "java.version") say from the same place you are trying to load the reducers framework from |
| 03:37 | guns | "1.7.0_05" |
| 03:37 | guns | I downloaded the Oracle version for OS X. |
| 03:38 | hiredman | how recent is your clojure jar? |
| 03:38 | guns | 1.5.0-alpha3 |
| 03:38 | guns | Should I be on a SNAPSHOT build or something? |
| 03:38 | hiredman | that is effectively a snapshot |
| 03:39 | hiredman | are you trying to use some other clojrue library? |
| 03:39 | guns | I am in a bare leiningen project with no extra deps |
| 03:40 | hiredman | what happens if you run (Class/forName "java.util.concurrent.ForkJoinTask") ? |
| 03:40 | guns | java.util.concurrent.ForkJoinTask |
| 03:40 | guns | that's something eh |
| 03:41 | hiredman | what does `lein version` say? |
| 03:41 | guns | Leiningen 2.0.0-SNAPSHOT on Java 1.7.0_05 Java HotSpot(TM) 64-Bit Server VM |
| 03:41 | hiredman | guns: yeah, reducers checks for the existence of that class when deciding to use the backwards compat jar or not |
| 03:42 | guns | So my java claims to have the class, but doesn't actually? |
| 03:42 | hiredman | no it does |
| 03:43 | guns | This is opaque to me. Is there something I can grep in java home? |
| 03:44 | hiredman | guns: the class is there, but the detection in reducers is failing for some reason |
| 03:45 | guns | hiredman: Ah, that's more clear. I'll dive into the reducers source then |
| 03:45 | guns | hiredman: thanks for the help |
| 03:47 | guns | hiredman: It seems to work from a source-built clojure jar. Guess it was a bug in alpha3 |
| 03:50 | hiredman | guns: looks like alpha3 is broken |
| 03:51 | hiredman | the compiled code has a hard coded reference to the classes from the fall back jar |
| 03:51 | clojure-newcomer | oh dear, lein/mvn seems completely borked today, working fine till now… OverConstrainedVersionException on pretty much all my projects… can anyone help ? |
| 03:52 | hiredman | the decision to use the fallback jar or not is happening at compile time, so if you compile your own version of clojure you won't need the jar |
| 03:53 | guns | hiredman: I see. Can I install a clojure version locally and use it from leiningen? |
| 03:53 | hiredman | yes |
| 03:53 | guns | This is some kind of maven incantation I imagine... |
| 03:54 | hiredman | if you checkout the source from github you can run 'mvn install' and it will installing something like clojure-1.5.0-master-SNAPSHOT in to your ~/.m2 |
| 03:54 | hiredman | and if you change your clojure version in your project.clj to 1.5.0-master-SNAPSHOT it will use your snapshot |
| 03:55 | guns | hiredman: Oh that's quite easy. I thought it would be one of those 200 character mvn install commands |
| 03:56 | clojure-newcomer | I'm guessing something's corrupted in either my local mvm or lein settings, but unsure where |
| 04:05 | muhoo | clojure-newcomer: clean 'em both out and try over? |
| 04:06 | muhoo | clojure-newcomer: local mvn is in ~/.m2 and lein is in ~/.lein |
| 04:06 | clojure-newcomer | muhoo: I tried that… guessing a proxy somewhere is in a borked state ? can I avoid connecting to 'central' for example ? |
| 04:08 | muhoo | what exactly is it telling you? |
| 04:10 | clojure-newcomer | muhoo: I've pasted it in here : http://pastebin.com/aZDaYAEK, but its happening across all my projects atm, different libraries, and versions etc |
| 04:11 | muhoo | oh! |
| 04:11 | muhoo | the version spec may not be right in your project file |
| 04:11 | muhoo | can you paste your project.clj ? |
| 04:12 | clojure-newcomer | muhoo: this is just the standard noir-blog project.clj : http://pastebin.com/2ZCDXg1w |
| 04:13 | muhoo | looks ok |
| 04:14 | muhoo | why is it looking for version 1.2.0 of clojure (if i'm reading that error right)? |
| 04:14 | clojure-newcomer | muhoo: I was guessing it must be a transitive dependency |
| 04:16 | clojure-newcomer | muhoo: hoping its not a Mountain Lion upgrade related problem :-) |
| 04:17 | muhoo | no, but it also doesn't look the same as my Noir-blog |
| 04:18 | clojure-newcomer | muhoo: so yours runs fine |
| 04:18 | clojure-newcomer | tempted to go run it on my parallels partition |
| 04:18 | muhoo | ah, no it's the same. i'd added something to mine |
| 04:19 | clojure-newcomer | yes, think I will go try it on a different machine |
| 04:19 | clojure-newcomer | muhoo: right, ok, so your noir blog is borked in the same way ? |
| 04:19 | muhoo | nope, i just ran lein deps on mine, no problems |
| 04:19 | muhoo | then again, i already have all that stuff in my cache |
| 04:19 | muhoo | so lein/mvn isn't going to try to download it from clojars/central/etc |
| 04:20 | clojure-newcomer | muhoo: yeah, I think somethings broken in one of those, so the proxy is poisoning my dependencies |
| 04:21 | muhoo | if you have a totally clean vm to try on, that seems like a good idea |
| 04:21 | clojure-newcomer | muhoo: yeah, I've got something I can use |
| 04:21 | clojure-newcomer | will have a go |
| 04:21 | clojure-newcomer | thanks for trying to help |
| 04:22 | muhoo | np. it may be a strange central borkage, so if you still have trouble, quite a few people will notice |
| 04:23 | muhoo | there was one a month or so ago at central. |
| 04:24 | muhoo | http://grokbase.com/t/gg/clojure/126bx7z0jy/central-screwup |
| 04:24 | muhoo | but that doesn't appear to be the problem now |
| 04:28 | clojure-newcomer | muhoo: the suggestion detailed in the link you gave has fixed my issues : :repositories {"sonatype" "https://oss.sonatype.org/content/groups/public/"} |
| 04:34 | muhoo | weird. central has some problem then. |
| 04:38 | muhoo | nice, i have a working cljs browser repl |
| 04:40 | clojure-newcomer | muhoo: sounds cool, how capable is it ? |
| 04:52 | muhoo | clojure-newcomer: it's an interesting hack, https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments |
| 04:57 | clojure-newcomer | muhoo: thanks, just reading now |
| 05:05 | muhoo | nice, the cljs compiler also translates clojure function comments into javascript comments |
| 05:27 | ro_st | what's the right way to do indexed array access in cljs? |
| 05:27 | ro_st | i have a NodeList with one element in it that i need to get |
| 05:27 | ro_st | (first nl) ain't doin' it |
| 05:28 | clgv | ro_st: `nth` like in clojure? |
| 05:29 | ro_st | it says it's not ISeqable |
| 05:30 | clgv | ro_st: a javascript array? |
| 05:30 | ro_st | yes, pretty much |
| 05:31 | clgv | something like `aget` in clojure? |
| 05:32 | ro_st | ah i found a util in enfocus |
| 05:32 | ro_st | https://github.com/ckirkendall/enfocus/blob/master/project/cljs-src/enfocus/core.cljs#L37 |
| 05:39 | ro_st | i'm trying to scroll the body element to the bottom. therefore, i need to set .scrollTop on the body element in the DOM. how do i do this? |
| 05:40 | ro_st | nothing in http://himera.herokuapp.com/synonym.html is jumping out at me |
| 05:41 | ro_st | found it, sorry |
| 06:19 | jaley | reducers are awesome. deleted 30 lines of code, 25% performance improvement |
| 06:25 | hyPiRion | jaley: The new ones? |
| 06:29 | eml | Noir question: Can I somehow add attributes to the <script> tag that (include-js) generates? Actually a hiccup question. :) |
| 06:30 | ro_st | eml: looking at the src, probably not directly |
| 06:30 | jaley | hyPiRion: err yes, quite new. in 1.5.0-master |
| 06:31 | tzar | what's a fun problem to think about/learn from in clojure? I'm trying to get more familiar with the language, last thing I messed around with was chess (not chess ai, just chess) |
| 06:31 | ro_st | eml: https://github.com/weavejester/hiccup/blob/master/src/hiccup/page.clj#L71 |
| 06:31 | jaley | tzar: have you tried 4clojure? |
| 06:31 | eml | ro_st: Dang.. thanks for the help though! :) |
| 06:32 | tzar | jaley: I have not! Will have a look |
| 06:32 | jaley | tzar: http://www.4clojure.com/ |
| 06:32 | jaley | tzar: you can create a login, solve problems, then see other people's solutions as you solve them |
| 06:32 | jaley | tzar: this has the inevitable drawback of descending into code-golf |
| 06:33 | jaley | tzar: but it's a good learning tool |
| 06:34 | tzar | jaley: yep found it through google :) sounds good. I've got my intro so far by reading "Programming Clojure" + I used to do common lisp, do you think it's still a good level? I guess I'll try it and find out |
| 06:34 | ro_st | eml: nothing stopping you using [:script {:type "text/javascript", :src (to-uri script)}] and adding your own sprices |
| 06:34 | bj0ern | tzar: www.projecteuler.net |
| 06:35 | jaley | tzar: the problems are organized by difficulty, so you might find it super-easy to start with but could skip ahead |
| 06:35 | tzar | jaley: cool, thanks for the help |
| 06:36 | jaley | tzar: no problem |
| 06:39 | tzar | bj0ern: messed around with project euler before in other languages, never really got the same moments of clarity from it that I have from building larger things or tools - engineer mind deficiency maybe? But thanks for the suggestion |
| 06:40 | tzar | bj0ern: could also be that I lost interest before I got to the more interesting problems as there are so many of them |
| 06:42 | bj0ern | tzar: I know what you mean :) |
| 06:42 | ro_st | tzar: what manual process in your own work env/toolchain can benefit from automation? start there |
| 06:42 | ro_st | or improvement or reworking |
| 06:42 | ro_st | because it's a jar, it's trivial to put into place on a machine you control |
| 06:43 | ro_st | i did this, it worked out really nicely for me. wrote a schema+data conversion tool for a mid-sized mysql to mongo. |
| 06:44 | ro_st | and after that, a publishing tool that takes content (xml+html) source docs from git and packages them up for production. this was a reworking of an ant/ruby/php lashup |
| 06:45 | tzar | ro_st: I like to do that too - my last (and only clojure) one of those was something to work out my tax year accounts, but that was when I was still in early stages of book so struggling greatly |
| 06:45 | tzar | now I'm struggling to find something that I haven't already hacked together in ruby, and it's hard to justify the jvm startup time when you're talking about simple scripts which are launched a bunch so refactoring those maybe not |
| 06:46 | ro_st | next we have a ruby json api + resque messaging system to rework |
| 06:46 | eml | On second thought I don't think Hiccup will do for me. Which template libraries would you recommend if I want to write my templates in .html with some sort of template language mixed in? |
| 06:47 | tzar | it sounds silly, but back when I was learning lisp, one of my biggest "oh" moments was when I was messing around with queues and trying to apply C pointer type thinking to lists, and someone told me to try make a queue built only out of lists |
| 06:47 | ro_st | yes. i ran into that issue too. it made me think about how to keep a jvm warm when using these tools. db conversion can be easily compiled and run from the repl, and the publishing one is part of a jenkins job, where it doesn't matter |
| 06:47 | tzar | or rather, out of stacks |
| 06:47 | ro_st | eml: check out enlive |
| 06:48 | ro_st | you make .html files, and then read them in at runtime and apply transformations using a [css-selector] (transforms) pattern |
| 06:48 | ro_st | tranforms occur on-demand as you call for templates. you can opt to compile the html in at compile time if you prefer |
| 06:49 | tzar | it's that kind of thing that I'm thinking about here - it really helped expand the way I think a lot and get the language, and it's not the kind of thing you'd find for example on project euler because it's not i/o related |
| 06:49 | ro_st | we don't, so that we can continue to do static-file markup work in chrome dev tools easily |
| 06:50 | eml | ro_st: Cool! Thanks :) |
| 06:50 | ro_st | the project euler/4clojure etc stuff is fun for stretching your brain |
| 06:50 | ro_st | and you need that |
| 06:50 | ro_st | but for me, i need it to be applicable *now* |
| 06:50 | ro_st | so that i give it the proper attention it deserves |
| 06:50 | tzar | with the chess example, I got to think about how I'd model the different pieces + board in clojure, I ended up with something quite odd and javascripty using multimethod dispatch and the clojure set library, it was a lot of fun |
| 06:51 | ro_st | i can well imagine |
| 06:51 | tzar | ro_st: yeah, I like applicable too :) |
| 06:53 | hyPiRion | jaley: Ah. I like it from a performance point of view, but I wonder how similar it is to normal reducing and mapping. Would code need major refactoring to use the new reducers? |
| 06:54 | clgv | hyPiRion: 0-arg and 1-arg implementations for used functions are needed |
| 06:54 | jaley | hyPiRion: for my problem I literally deleted a a pma- |
| 06:54 | jaley | hyPiRion: gah, new keyboard |
| 06:55 | jaley | hyPiRion: deleted a pmap-partition trick, which was bad, and replaced with (r/fold merge-function (r/map worker-function (vec data))) |
| 06:56 | jaley | hyPiRion: my merge function didn't have identity forms, which was arguably a bug anyway, so i added one, which was simple |
| 06:57 | hyPiRion | So it's not too much of a hassle to go from one to another then. That's great, though I would love it if you could switch the namespace and get the new function. |
| 06:57 | hyPiRion | /s/function/functionality |
| 06:58 | hyPiRion | But I suppose that's like wishing for a sufficiently smart compiler :( |
| 07:02 | jaley | hyPiRion: heh. i think it's already about as close to that as you'd want |
| 07:02 | jaley | hyPiRion: probably not a good idea to just replace every map with r/map |
| 07:09 | clgv | jaley: that rule already applied to pmap ;) |
| 07:12 | jaley | clgv: heh, i don't think it would take long to realize that's a bad idea with pmap |
| 08:27 | XPherior | Has anyone ever used Lein with multiple projects under the same project root? |
| 08:29 | ro_st | XPherior: you mean multiple project.clj files? |
| 08:30 | XPherior | ro_st: Hm, not really. We're refactoring a PHP project and phasing in Clojure as restful web services. |
| 08:30 | XPherior | Some of the services aren't really related, but they might share common code and so should probably be in the same project |
| 08:31 | XPherior | Also, ro_st. Turns out that with-redefs-fn, you can assoc a new test database with a defentity. |
| 08:38 | ro_st | ah nice |
| 08:39 | ro_st | a blog post / tut i'd LOVE to see is how to do code sharing between clj projects using git |
| 08:39 | ro_st | it's probably really easy, but it'd be nice to see an end-to-end how to |
| 08:39 | Horofox | good morning everyone. |
| 08:42 | ToxicFrog | lein git-deps? |
| 08:45 | XPherior | I'll give it a go soon, @ro_st. |
| 08:53 | cshell | ro_st: arent' you supposed to share code dependencies via artifacts rather than code sharing? |
| 08:54 | ro_st | probably :-) |
| 08:54 | cshell | :) |
| 08:54 | cemerick | ro_st: read about lein's checkout dependencies. |
| 08:54 | ro_st | but when you're working on both in parallel, that can become tedious quickly |
| 08:54 | cshell | You reminded me of the old ant days when everything was in one big source tree |
| 08:54 | dnolen | cemerick: btw, what were you using the core.logic unifier for the other day? |
| 08:54 | ro_st | be nice to be able to temporarily drop to code, do your work, and then switch back to artifacts and pushall |
| 08:55 | ro_st | cemerick: will do |
| 08:57 | cemerick | dnolen: generating sane test queries for a datalog impl. |
| 08:57 | cshell | ro_st: can't you just depend on a snapshot dependency? |
| 08:57 | cshell | and build it when you switch? |
| 08:58 | ro_st | cshell: i've not actually tried to do this yet, so i'm not clear on what you're suggesting |
| 08:59 | goodieboy | anyone here familiar with deploying a clojure app to tomcat? |
| 09:00 | dnolen | cemerick: cool - something you'll be putting out? |
| 09:00 | cshell | ro_st: Basically, in your lein file you have it generate A-0.0.1-SNAPSHOT.jar, then in Module B, you have a dependency on A-0.0.1-SNAPSHOT.jar - when you build A, it will be installed in your local repository, then when you build B, it reads the dependency from there as well |
| 09:01 | ro_st | ah that sounds good. does this local repo automatically exist as a consequence of using lein? |
| 09:02 | ro_st | so building stuff with lein makes it available in a local repo somehow |
| 09:02 | cshell | ro_st: yes, but it's the .m2 repository, which is the same one that maven uses - typically ~/.m2 |
| 09:02 | cemerick | dnolen: Probably not, at least not soon. It's in the bowels of a new service I'm working on. |
| 09:02 | cshell | if you've built anything with maven/lein you should have it |
| 09:03 | cemerick | dnolen: You probably hear that a lot; I'll bet it gets mighty frustrating. :-( |
| 09:03 | ro_st | that's clever |
| 09:03 | cshell | ro_st: you'll have to run lein install in your A directory |
| 09:03 | cshell | and it will do it |
| 09:03 | ro_st | so i guess to replicate that whole lot on a build server, that build server would have to be building all the deps that are private in this manner, in order? |
| 09:04 | dnolen | cemerick: haha pretty much :) |
| 09:05 | dnolen | cemerick: though the number of open source projects using core.logic may be approaching 5 :) So I'm hopeful. |
| 09:05 | cshell | ro_st: Typically, on a build server you publish your artifacts to repository other than the local (in case of build servers on different machines) |
| 09:06 | cshell | ro_st: so, a shared repository - the build tools (ie Teamcity and maybe Jenkins) can detect when snapshot dependencies have changed and start building any dependent projects |
| 09:09 | ro_st | awesome. i hope to hire a tame java developer shortly who can make all this work nicely |
| 09:09 | ro_st | he's very happy he'll be doing clojure instead of java |
| 09:10 | cshell | I can imagine so :) |
| 09:10 | cshell | ro_st: the dependency management paradigm is very common nowadays, so he should be familiar with it |
| 09:11 | cshell | ro_st: unless he's been stuck in academia |
| 09:12 | ro_st | nope. he's just got out of a job with a bank-owned company here in SA |
| 09:12 | ro_st | where they prefer to hire deployment engineers rather than automate builds |
| 09:12 | ro_st | *barf* |
| 09:12 | cshell | lol |
| 09:12 | cshell | What's SA? |
| 09:12 | ro_st | github.com is blocked on their firewall. end-of-discussion, so long and thanks for all the fish. |
| 09:12 | Hodapp | Something Awful? |
| 09:12 | ro_st | south africa |
| 09:12 | cshell | ah, cool |
| 09:33 | wmealing__ | ive got an odd question, maybe because I dont entirely understand the scope of what i'm asking. I'm currently building a lot of the page via html and then acting on decisions made to do further json requests which then javascript ends up building more of the page, can i perverse clojurescript on the server side to pass down js ( for the browser to run ?) or am i looking at it wrong ? How should I be doing it ? |
| 09:40 | hyPiRion | wmealing__: So you want to write cljs instead of js? |
| 09:40 | wmealing__ | i think so |
| 09:40 | wmealing__ | if i can get away with it, i dont want to write any js at all |
| 09:41 | hyPiRion | Well, this looks highly relevant: http://cemerick.com/2011/10/11/writing-couchdb-views-using-clojurescript/ |
| 09:42 | wmealing__ | i will take a look |
| 09:43 | hyPiRion | I don't know too much about it though, but it seems like you want some couchdb-functionality. |
| 09:44 | hyPiRion | So if you're searching for "couchdb clojure" or something, I believe that should give you something (?) |
| 09:45 | wmealing__ | ideally my plan was validation server side, along with the same (duplicated ) validation code client side. |
| 09:45 | wmealing__ | and also some basic dom manipulation |
| 09:45 | wmealing__ | hide this, fetch this json, do x with it |
| 09:48 | cshell | are there any libraries for removing html markup (ie to stop cross site scripting attacks)? |
| 09:49 | wmealing__ | could you just escape it ? |
| 09:49 | cshell | by doing just a replace on < with \<? |
| 09:52 | wmealing__ | or whatever the > or what have you |
| 09:52 | wmealing__ | for html |
| 09:53 | wmealing__ | i think there is a good doc on taking input from users |
| 09:53 | wmealing__ | but in short, i pretty much reject it if it contains anything that i consider special characters |
| 09:53 | wmealing__ | other than what i expect |
| 09:59 | goodieboy | is there something in clojure, that is similar to Ruby's "ensure"? |
| 10:00 | craigbro | (try ... (finally ...) |
| 10:01 | goodieboy | craigbro: ahh right, thanks |
| 10:03 | cshell | wmealing_: that sounds like a good approach, thanks! |
| 10:37 | acheng | partial works on fns with more than one arg list i.e. [a b] and [a b c] ... nice! |
| 10:43 | babilen | acheng: Think of it as (partial (partial (partial f first_arg) second_arg) ... |
| 10:56 | mdeboard | How would I add a dependency for a package that doesn't have, that I can find, a maven repo? ghost4j specifically |
| 10:57 | michaelr525 | hello! |
| 11:01 | duck11231 | mdeboard: that's annoying, especially since they're obviously using maven to build it |
| 11:01 | mdeboard | I agree |
| 11:02 | ohpauleez | mdeboard: You can add it to a local repo, and add the local repo to your list of repos for your project |
| 11:02 | ohpauleez | Or, build the package, release it on clojars |
| 11:02 | ohpauleez | and then you'll be all set |
| 11:02 | mdeboard | ohpauleez: That's what I'm looking at doing right now (clojars), just not sure how to go about doing that. No experience with poms etc, seems easy to screw up. |
| 11:03 | ejackson | mdeboard: you need to install the jar into your local maven repo (or something like nexus, if you havet it) |
| 11:03 | ejackson | 16:02 |
| 11:04 | ohpauleez | You grab the pom, grab the jar, and scp them to your clojars account. You'll want to change the name of the project a little so it goes to your clojars group-name |
| 11:08 | mdeboard | ohpauleez: When you say 'the pom' are you presupposing the download of the jar itself comes with a POM? Because it doesn't. |
| 11:08 | ohpauleez | mdeboard: No you'll have to grab the pom from the source tree |
| 11:08 | ohpauleez | it'll be in the top level |
| 11:09 | mdeboard | I see |
| 11:09 | ohpauleez | you'll want to grab the source, change the pom, build the jar, and then scp the pom and the jar over to clojars |
| 11:09 | duck11231 | if you just checkout that particular tag, and do mvn install, it should install for you, but that's not good fot repeatability |
| 11:09 | ohpauleez | or you can just install the jar as is into a local maven repo |
| 11:11 | pendlepants | does anyone know how to use jmagick in a leiningen project? I've got [jmagick/jmagick "6.2.4"] in my dependencies, but am getting an UnsatisfiedLinkError when I try to import anything that inherits from magick.Magick. |
| 11:11 | pendlepants | though I can import magick/ImageMagick just fine. |
| 11:14 | mdeboard | Ok, I'll give this a go |
| 11:18 | mdeboard | hey I did it https://clojars.org/net.sf/ghost4j |
| 11:20 | ohpauleez | mdeboard: congrats! |
| 11:22 | antares_ | pendlepants: JMagick needs imagemagick installed |
| 11:23 | antares_ | pendlepants: possibly a particular version. That's why the Java part loads but then fails to link against the native code it relies on. Maybe check that you have imagemagick installed? |
| 11:23 | antares_ | sorry if JMagick is something pure Java, I am under the impression it is imagemagick bindings |
| 11:24 | Frozenlock | mdeboard: you can do PDFs with ghost4j? |
| 11:26 | pendlepants | antares_: thanks. I've got imagemagick installed, but JMagick not finding it makes sense. I'll start looking at that. |
| 11:35 | michaelr525 | pendlepants: when i needed to manipulate an image i just ran the imagemagick cmd utils from clojure by executing an external program |
| 11:36 | pendlepants | michaelr525: sorry for being dumb, but how you do you do that from clojure? |
| 11:38 | nDuff | pendlepants: Runtime/exec is the traditional approach |
| 11:38 | nDuff | pendlepants: ...I vaguely recall seeing a friendlier Clojure library for running external tools (w/ support for pipelines and such), but don't recall its name offhand. |
| 11:38 | michaelr525 | pendlepants: first you need to add conch to your project |
| 11:39 | michaelr525 | pendlepants: then check this https://www.refheap.com/paste/3883 |
| 11:41 | gtrak | apache commons exec and wrappers were pretty ok for me |
| 11:41 | pendlepants | thanks nDuff/michaelr525. |
| 11:42 | Frozenlock | Is there a way to make an alert popup with only clojure? (no seesaw and alike) |
| 11:42 | gtrak | Frozenlock: from http://clojure.org/getting_started (javax.swing.JOptionPane/showMessageDialog nil "Hello World") |
| 11:43 | gtrak | you can also sometimes do something with command-line utilities, like kdialog on kde |
| 11:46 | augustl | perhaps there's an applescript/clojure bridge around for OS X ;) |
| 11:47 | Frozenlock | gtrak: Nice! Thanks! The ~9mo "hello world" from seesaw was scary :) |
| 11:49 | gtrak | np |
| 12:16 | edw | technomancy: Thanks for turning me on to nrepl. Have you noticed that it seems to have broken Paredit's '{' treatment? |
| 12:22 | technomancy | edw: yeah, there's an open ticket for it |
| 12:23 | technomancy | edw: it's due to the fact that clojure-nrepl-mode is a major mode instead of a minor mode; I think there's actually an open pull request fixing that |
| 12:25 | technomancy | edw: in the mean time there's (define-key clojure-nrepl-mode-map "{" 'paredit-open-curly) |
| 12:26 | mdeboard | Frozenlock: I guess so |
| 12:31 | edw | technomancy: Ah, thanks. |
| 12:32 | cch1 | Quiz: why doesn't this work: |
| 12:32 | cch1 | (defmacro d [a] (let [b (into clojure.lang.PersistentQueue/EMPTY a)] `~b)) |
| 12:32 | cch1 | (d #{:a}) |
| 12:33 | cch1 | Hint: I've just had my mind blown by the dependency of macros on literal representation of data. |
| 12:40 | ToxicFrog | cch1: absent the `~, I'd say "because the macro needs to return an AST and instead it's returning a PersistentQueue" |
| 12:40 | ToxicFrog | But I'm not clear on how they interact when conjoined like that. |
| 12:41 | cch1 | ToxicFrog: you can change the macro to |
| 12:41 | cch1 | (defmacro d [a] (let [b (into clojure.lang.PersistentQueue/EMPTY a)] `(list ~b))) |
| 12:41 | cch1 | with the same result |
| 12:41 | michaelr525 | hello! |
| 12:42 | ToxicFrog | cch1: in that case, I've got nothing |
| 12:44 | ToxicFrog | I would expect (and macroexpand confirms) that it expands into (list <value bound to b>) |
| 12:44 | cch1 | ToxicFrog: I'm pretty sure the root of the problem is in the fact that there is no literal syntax for a PersistentQueue. |
| 12:44 | cch1 | ToxicFrog: the expanded macro can't be processed by the reader perhaps... |
| 12:44 | ToxicFrog | Oh. |
| 12:45 | ToxicFrog | I wouldn't have expected that it would need one. |
| 12:45 | cch1 | ToxicFrog: me either, but I have no other explanation. The same macro structure works fine for any "supported" data structure -but not PQs |
| 12:45 | edw | Has it occurred to anyone to have nrepl-mode insert accurate lineno and filename metadata into forms when they're evaled in a buffer? That seems like it might be a fun weekend project for me if no one else has taken it. |
| 12:47 | gfredericks | cch1: whatever a macro returns is supposed to be eval'd |
| 12:47 | gfredericks | or compiled rather |
| 12:47 | gfredericks | and there's no reason that the compiler should know what to do with a queue |
| 12:47 | gfredericks | also `~b could be simply b |
| 12:47 | technomancy | edw: that'd be great |
| 12:47 | cch1 | gfredericks: yes, I think that sums it up nicely |
| 12:47 | technomancy | edw: personally I've been conditioned to only use C-c C-k |
| 12:48 | edw | technomancy: I was about to say the same thing. |
| 12:48 | technomancy | region-level eval isn't worth the trouble |
| 12:48 | technomancy | so far anyway; no reason it couldn't be made to work |
| 12:48 | edw | C-x C-e and C-M-x would be at least 90%. |
| 12:49 | edw | I get so sick of NO SOURCE FILE in stacktraces. |
| 12:49 | technomancy | so I told the barista I was programming and he was all "you mean you're like ... making programs yourself? wow." |
| 12:50 | ToxicFrog | gfredericks: the bit that surprised me is that I would have expected the RV from the macro to bypass the parser entirely, being a raw AST, and thus it wouldn't matter if values with no text representation are "directly" bound into it. |
| 12:50 | technomancy | do you actually use C-x C-e on defns? |
| 12:50 | ToxicFrog | technomancy: occasionally I wonder where most people think programs come from, if not programmers. |
| 12:51 | gfredericks | ToxicFrog: it bypasses the reader |
| 12:51 | gfredericks | but the reader never returns a queue |
| 12:51 | gfredericks | so the compiler isn't equipped to deal with them |
| 12:52 | edw | If one more person says, "Oh, like IT?" I will kill them when I tell them that I am a programmer/program. |
| 12:53 | edw | No, NOT like Geek Squad, no, not like Geek Squad at all. |
| 12:54 | gfredericks | edw: throughout my undergrad years in CS, my dad (a quasi-programmer) repeatedly asked me if they were teaching me to build my own computer |
| 12:54 | technomancy | edw: I don't know about you, but I travel exclusively by B&W volkswagen |
| 12:54 | cch1 | gfredericks ToxicFrog: I'm wondering if a nice workaround can be constructed in 1.4 with homegrown literal support for PQs |
| 12:54 | gfredericks | cch1: a workaround? what on earth would you need this for? |
| 12:55 | ToxicFrog | gfredericks: fun thing, I actually did that |
| 12:55 | ToxicFrog | (CPU design course) |
| 12:55 | ToxicFrog | Loads of fun. |
| 12:55 | gfredericks | ToxicFrog: oh I think he meant physically |
| 12:55 | cch1 | gfredericks: I want to write a macro that constructs a PQ at expansion time and provides it into some more complex form to be evaluated at runtime. |
| 12:56 | cch1 | (defmacro d [a] (let [b (into clojure.lang.PersistentQueue/EMPTY a)] `(complex-stuff ~b))) |
| 12:57 | gfredericks | cch1: is this a performance concern or a code-simplicity concern? |
| 12:57 | cch1 | gfredericks: If I create the PQ at runtime, I can get around the problem.... |
| 12:57 | cch1 | (defmacro d [a] `(let [b# (into clojure.lang.PersistentQueue/EMPTY a)] (list b#))) |
| 12:57 | cch1 | gfredericks: performance -because I can work around the problem as above |
| 12:57 | gfredericks | cch1: if you create the queue at the top level, it should only get created once at compile-time |
| 12:58 | cch1 | gfredericks: ewww |
| 12:58 | gfredericks | e.g., (let [my-queue (into ...)] (defn my-func ...)) |
| 12:58 | edw | Of course, I'm all over the "yeah, I can fix your computer" if it's an attractive, intelligent girl. |
| 12:58 | gfredericks | cch1: or you could complect compilation with data-structure caching O_O |
| 12:58 | gfredericks | def a gensym! :) |
| 12:59 | gfredericks | that's the first compelling use for def-nesting I've heard of |
| 12:59 | cch1 | gfredericks: I've spent the last six months at my job convincing everyone else that def-within-def is evil -I'll be damned if I'll ever admit to there being even one valid use case. |
| 13:00 | cch1 | ever |
| 13:01 | edw | cch1: How about for defining a sentinal value for identifying missing values in a map? |
| 13:01 | edw | Sentinel, even. |
| 13:01 | cch1 | edw: let works in all the contexts I can think of off the top of my head... |
| 13:02 | cch1 | (feeling nervous having dogmatically staked out an extreme position :)) |
| 13:02 | edw | But why LET for every invocation? You only ever want one of them? |
| 13:03 | cch1 | edw: depending on where the map comes from, there's a context around it that is a nice place for a let. And if the map is top level, then a surrounding let is only going to be evaluated once anyway. |
| 13:05 | ToxicFrog | edw: yeah, for me...if they aren't (a) family, (b) romantically involved with me or (c) running linux and willing to pay, no tech support. |
| 13:06 | cch1 | edw: (let [sentinel :a] (defn myfun1 [] ..work-with-map..) (defn myfun2 [] ..work-with-map-some-more)) |
| 13:07 | edw | cch1: I mean something like this: https://gist.github.com/3208379 |
| 13:08 | edw | The metadata shouldn't be there: I just moved that DEF inside the DEFN. |
| 13:09 | cch1 | edw: https://gist.github.com/3208387/931db496276133009887aabc5ae1cac158cf61be |
| 13:11 | edw | That seems a bit unnatural. Yes, you can do that, but you have a nested DEFN! |
| 13:11 | edw | Or a non toplevel one. |
| 13:11 | edw | Which is really the stylistic "problem" IMO. |
| 13:12 | cch1 | edw: I most definitely do not have a nested defn -I have a let-over-lambda -a beautiful more-private-that-private closure |
| 13:13 | edw | I'm all about the LET over LAMBDA--love the book too--but this is a LET over a DEF you're showing me. |
| 13:13 | cch1 | edw: the problem with the nested def is that you leave top-level residue in the namespace instead of encapsulating the local (!) concept of a sentinel |
| 13:14 | edw | I hear you. |
| 13:14 | cch1 | edw: (defn is a macro that writes lambdas) |
| 13:14 | cch1 | cch1: edw (just had to double check that...) |
| 13:14 | edw | Among other things. |
| 13:15 | edw | And those other things are what make nesting it a stylistic "problem." |
| 13:16 | edw | I've read SICP, Scheme is my preferred language, I know what you're saying. |
| 13:17 | edw | I'm just too old for religion. |
| 13:18 | edw | Seen too much. |
| 13:18 | uvtc | Added a non-clever iterative solution to the end of http://rosettacode.org/wiki/Fibonacci_sequence#Clojure . |
| 13:18 | cch1 | edw: sounds reasonable. I can appreciate a preference for having a top-level defn of your function. |
| 13:20 | edw | That said I wish there were an idiomatic to define something a la C's function-scoped static vars. |
| 13:20 | edw | s/an idiomatic/an idiomatic way/ |
| 13:43 | hugod | wrapping a fn definition with with-local-vars might come close, but is still not idiomatic |
| 13:44 | llasram | I think (let [...] (def/n ...)) is perfectly idiomatic |
| 13:51 | jtoy | how do I add a change (if (nil? json) [] ( map json ["id" "description"])))) to (if (nil? json) [] ( vector( map json ["id" "description"]))))) if I am at here: (if (nil? json) [] ( HERE map json ["id" "description"])))) with paraedit? |
| 13:53 | raek | "(vector <C-right> <C-right> <C-right>" is one way |
| 13:54 | raek | sorry, that's not right. |
| 13:54 | ejackson | yup, you said it was C-right |
| 13:55 | raek | C-b (vector <C-right> |
| 13:56 | raek | ejackson: hm? |
| 13:56 | jtoy | control-right ? |
| 13:56 | raek | yes |
| 13:56 | ejackson | sorry, long day, poor jokes :| |
| 14:00 | jtoy | rabbler: how do I know what c-right is? I've never really understood paraedit, trying to learn it now |
| 14:01 | rabbler | jtoy, what made you ask me? I haven't a clue as to anything about paraedit. |
| 14:01 | metellus | C-thing means ctrl+thing |
| 14:01 | mattmoss | http://emacswiki.org/emacs/PareditCheatsheet |
| 14:01 | jtoy | raek: how do I know what c-right is? I've never really understood paraedit, trying to learn it now |
| 14:01 | jtoy | oh |
| 14:01 | raek | jtoy: use C-h k <some key> to leatn what it does |
| 14:01 | jtoy | I'm on vim though, sorry, forgot to mention that |
| 14:02 | raek | jtoy: and use "C-h m" to learn about the key bindings of the current buffer (as well as other mode documentation) |
| 14:02 | raek | jtoy: oh. my utterances were for emacs. |
| 14:02 | technomancy | it seems like a bit of a problem that all these alternate paredit implementations self-describe as simply "paredit" |
| 14:02 | jtoy | raek: cool, i heard they are almost the same, ill try to figure it out.. |
| 14:03 | emezeske | jtoy: You should call it "paredit.vim" when you ask questions, to avoid confusion |
| 14:03 | raek | (I thought "paraedit" was just a misspelling of "paredit") |
| 14:03 | jtoy | sorry, i thought everyone uses vim :) |
| 14:04 | raek | http://chart.apis.google.com/chart?chxl=0:%7C0%7C81%7C162%7C243%7C324%7C405%7C1:%7COther+%E2%80%94%C2%A05%25%7CCommand-line+REPL+%E2%80%94+20%25%7CVim+%2B+vimclojure+%E2%80%94+21%25%7CTextmate+%2B+textmate-clojure+%E2%80%94%C2%A05%25%7CNetBeans+%2B+Enclojure+%E2%80%94%C2%A05%25%7CIntelliJ+%2B+La+Clojure+%E2%80%94%C2%A09%25%7CEmacs+%2B+SLIME+%E2%80%94+61%25%7CEmacs+%2B+inferior-lisp+%E2%80%94%C2%A07%25%7CEclipse+%2B+Counterclockwise+%E2%80%94%C2%A |
| 14:04 | raek | yikes, what an URL... |
| 14:04 | scriptor | doesn't work :/ |
| 14:04 | emezeske | jtoy: So, if you moved your cursor on top of the paren just to the left of "HERE", and typed "<LocalLeader>W" in normal mode, you would wrap the whole (map ...) form in new parens, then you could add vector |
| 14:04 | scriptor | LocalLeader? |
| 14:05 | raek | http://goo.gl/BDfk4 |
| 14:05 | raek | source: http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ |
| 14:05 | emezeske | scriptor: Type ":help LocalLeader" into your vim. |
| 14:06 | scriptor | oh, vim |
| 14:06 | jsabeaudry | raek, only 61%... can't wait to see the result for 2012 |
| 14:06 | technomancy | I wonder if there's still anyone using textmate |
| 14:09 | jtoy | emezeske: that worked! i need to read the doc a couple more times, i don't really get it when I read it before |
| 14:11 | emezeske | jtoy: It takes a while to get it into your fingers. I definitely recommend just playing with the various commands; sometimes they don't make sense from their descriptions, but once you try them it all comes together. |
| 14:14 | technomancy | seancorfield: late to the party, but I just noticed jsql and the notion of a compiler that targets SQL here: http://dev.clojure.org/display/design/java.jdbc and am very interested in where this is going |
| 14:15 | technomancy | is jsql still too experimental for general consumption? |
| 14:16 | scriptor | so, I'm going through the arguments to a function call and building a new list out of it |
| 14:17 | scriptor | would it be better to use a regular list, conj onto it, and then reverse that (to preserve the original order of the arguments) |
| 14:17 | scriptor | or try to append to a vector so there's no need to reverse it at the end? |
| 14:19 | S11001001 | scriptor: are you using map? |
| 14:19 | scriptor | S11001001: reduce, because it's not really a 1-to-1 mapping from the original arguments to the new one |
| 14:20 | scriptor | some of the args need to be specially processed and then aren't included |
| 14:20 | S11001001 | scriptor: is each output element built from knowledge garnered from only one element of the input? |
| 14:20 | scriptor | S11001001: yep |
| 14:20 | scriptor | each output element is directly tied to only one input element |
| 14:20 | S11001001 | scriptor: are said output elements in the same order as the relevant input elements? |
| 14:21 | scriptor | S11001001: they should be, yes |
| 14:21 | S11001001 | scriptor: then you can use mapcat, which is simply map followed by apply concat |
| 14:22 | S11001001 | ,clojure.pprint/cl-format |
| 14:23 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.pprint, compiling:(NO_SOURCE_PATH:0)> |
| 14:23 | S11001001 | ,(require 'clojure.pprint) |
| 14:23 | clojurebot | nil |
| 14:23 | S11001001 | ,clojure.pprint/cl-format |
| 14:23 | clojurebot | #<pprint$cl_format clojure.pprint$cl_format@2410a383> |
| 14:24 | S11001001 | ,(mapcat (fn [n] (if (odd? n) [n (cl-format nil "~R" n)] [])) (range 10)) |
| 14:24 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cl-format in this context, compiling:(NO_SOURCE_PATH:0)> |
| 14:24 | S11001001 | ,(mapcat (fn [n] (if (odd? n) [n (clojure.pprint/cl-format nil "~R" n)] [])) (range 10)) |
| 14:24 | clojurebot | (1 "one" 3 "three" 5 ...) |
| 14:25 | S11001001 | scriptor: in that example some inputs produce 2 outputs, some produce 0 |
| 14:25 | scriptor | S11001001: yep, so just return [] if you want the element to be ignored? |
| 14:26 | S11001001 | indeed; in fact, if your problem is more constrained than my example above, there are yet more alternatives |
| 14:26 | S11001001 | ,(doc keep) |
| 14:26 | clojurebot | "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects." |
| 14:30 | scriptor | hmm, f might print stuff, so I probably can't use keep |
| 14:30 | S11001001 | scriptor: don't worry too much about it; if you need strictness, use doall |
| 14:31 | S11001001 | scriptor: regardless it might be worthwhile to arrange things such that prints are encoded in the resulting list |
| 14:31 | S11001001 | which would make the decisions about what to print pure, and thereby trivially subject to unit testing |
| 14:31 | scriptor | S11001001: what do you mean by encoded? So that it won't immediately print them? |
| 14:32 | S11001001 | scriptor: your result is a list, right? Well, some elements look some way, and elements that look like, say, [::print "blah"] encode a request to print "blah" followed by a newline |
| 14:33 | scriptor | S11001001: right, so that it doesn't use an actual call to print, but can be processed later on? |
| 14:33 | S11001001 | scriptor: indeed |
| 14:34 | scriptor | well, the tool is a basic debugging helper, so that it prints certain values when the specific line is reached |
| 14:34 | S11001001 | yes? |
| 14:34 | clojurebot | yes isn't is |
| 14:34 | S11001001 | thanks clojurebot |
| 14:35 | scriptor | something like (debug + 1 :dbg-print 2) where 1 would be printed |
| 14:35 | scriptor | so the resulting list should be just (+ 1 2) |
| 14:36 | scriptor | but in the repl or whatever environment it's run in, it would print 1 before it is evaluated |
| 14:36 | scriptor | so the printing can't be done lazily, I think |
| 14:36 | S11001001 | don't you want, then, to insert the prints into the generated code? |
| 14:37 | scriptor | S11001001: but that'd result in something like (+ 1 (prn 1) 2) or (+ 1 [::print "blah"] 2) wouldn't it? |
| 14:37 | scriptor | which would result in an error |
| 14:38 | S11001001 | (+ 1 (do (prn 1) 2)) |
| 14:38 | scriptor | ah |
| 14:38 | scriptor | does do not return anything, not even null? |
| 14:39 | ToxicFrog | scriptor: check the parens - it evaluates all of its args and returns the last |
| 14:39 | S11001001 | ,(do 1 2) |
| 14:39 | ToxicFrog | ,(do 1 2 3) |
| 14:39 | clojurebot | 2 |
| 14:39 | clojurebot | 3 |
| 14:39 | ToxicFrog | ,(do (prn 1) 2 3) |
| 14:39 | clojurebot | 1 |
| 14:39 | clojurebot | 3 |
| 14:39 | scriptor | oh, dammit |
| 14:40 | ToxicFrog | Also, totally stealing this idea for debug tracing in my lexer |
| 14:40 | scriptor | ToxicFrog: help me make it somewhat decent first :) https://github.com/Scriptor/clj-here |
| 14:40 | clojurebot | eg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging |
| 14:41 | ToxicFrog | scriptor: is it slime-specific as the readme impies? |
| 14:41 | scriptor | ToxicFrog: yep |
| 14:41 | scriptor | ToxicFrog: well, break is |
| 14:42 | scriptor | :dbg-prn-last isn't |
| 14:42 | ToxicFrog | I may have some difficulty helping given that I don't use slime, then :P |
| 14:42 | scriptor | inferior-lisp? |
| 14:42 | clojurebot | inferior-lisp is a lot like http://www.penny-arcade.com/comic/2011/09/28 |
| 14:43 | scriptor | also, S11001001: what happens if there aren't any arguments after the print, so (foo 1 (do (prn 1))) |
| 14:43 | scriptor | where you only want to call foo with one parameter |
| 14:44 | S11001001 | (foo (do (prn 1) 1)) |
| 14:44 | S11001001 | or (do (prn 1) (foo 1)) |
| 14:44 | scriptor | hmm, so it'd have to detect when there aren't any arguments left |
| 14:45 | scriptor | otherwise it can just put the next argument in the do |
| 14:45 | scriptor | although, this is still assuming mapcat wouldn't work, which I think it would |
| 14:47 | ToxicFrog | scriptor: inferior-lisp? |
| 14:48 | scriptor | ToxicFrog: what do you use instead of swank-clojure? |
| 14:48 | ToxicFrog | IDEA. |
| 14:48 | scriptor | ah |
| 14:48 | ToxicFrog | + lein for build and dependency management. |
| 14:49 | scriptor | is there any way to manually invoke the debugger in iDEA? |
| 14:51 | ToxicFrog | Probably, but to be honest, I've never tried |
| 15:21 | eggsby | hey clojurites, I'm having trouble with a transformation: https://www.refheap.com/paste/3894 |
| 15:21 | eggsby | I feel like I want to partition by some function, but I can't quite understand what the function should look like |
| 15:23 | joegallo | you can do it with reduce, and a vector of vectors serving as an accumulator. |
| 15:24 | hiredman | (fn f [es] (lazy-seq (when (seq es) (cons (cons (first es) (take-while #(.startsWith % "\t\t") (rest es))) (f (drop-while #(.startsWith % "\t\t") (rest es))))))) |
| 15:24 | joegallo | are you only worried about two levels of nesting? |
| 15:24 | scriptor | eggsby: also look into http://clojuredocs.org/clojure_core/clojure.core/partition-by |
| 17:21 | Raynes | muhoo: https://github.com/Raynes/lein-pdo |
| 17:22 | Raynes | muhoo: Seems to work for your cljsbuild auto case. |
| 17:23 | emezeske | Raynes: I actually talked to muhoo a bit more and I think I convinced him that running cljsbuild auto and repl in the same terminal is a bad idea. |
| 17:23 | akhudek | The Java VisualVM sampling feature sure can give misleading results compared to doing full sampling. |
| 17:23 | akhudek | err profiling. |
| 17:23 | Raynes | emezeske: Why is that? |
| 17:23 | emezeske | Raynes: He was under the impression that the repl listened for telnet connections on some port |
| 17:24 | emezeske | Raynes: But really it just talks to stdin/stdout, and so it will be clobbered by the auto build output |
| 17:24 | emezeske | Raynes: (telnet or nrepl or something) |
| 17:25 | Raynes | emezeske: It would be useful to be able to run cljsbuild auto and a headless repl to connect to from nrepl.el. |
| 17:25 | Raynes | Pretty sure input and output of leiningen is irrelevant in that case. |
| 17:25 | emezeske | Raynes: Most definitely. I told muhoo that I'm very receptive to pull requests to that effect :) |
| 17:25 | Raynes | I'm not sure what you would need to do. |
| 17:25 | Raynes | It works fine with pdo, doesn't it? |
| 17:26 | Raynes | Anyways, pdo seems useful in general. |
| 17:26 | emezeske | The clojurescript repl? |
| 17:26 | emezeske | Yeah I agree that pdo is cool in general, I can think of a couple uses for it |
| 17:26 | Raynes | I guess I just don't know what you're saying you'd accept a pull request for. |
| 17:26 | emezeske | The clojurescript repl talks to stdin and stdout, and that's it |
| 17:27 | Raynes | I was under the impression that his use case was to run cljsbuild auto and start a headless nrepl server in one go, which should be completely fine with pdo. |
| 17:27 | Raynes | I probably just misunderstood him. |
| 17:27 | emezeske | I believe that his particular use case was "cljsbuild auto, cljsbuild repl-listen", but he probably was running an nrepl server as well, so pdo would help with that |
| 17:28 | hiredman | https://github.com/hiredman/nrepl-cljs-middleware |
| 17:28 | Raynes | That wasn't the example he gave me when I talked to him. His example was a trampolining repl. |
| 17:28 | Raynes | He is a complex man, that guy. |
| 17:29 | emezeske | Heh, it sounds like there's some confusion in general. Anyway, pdo is cool for sure. |
| 17:29 | Raynes | I'm sure at least one person will find a use for it some day. |
| 17:29 | Raynes | :p |
| 17:29 | akhudek | has anyone ever seen sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run() while profiling? |
| 17:30 | akhudek | it somehow always crops up and ends up taking 95% of the cpu time |
| 17:30 | akhudek | even though this application doesn't do any TCP |
| 17:30 | emezeske | hiredman: That is interesting; I'm not sure if that would integrate with the command line repl, though (based on my cursory glance) |
| 17:30 | akhudek | also, sun.* is in the do not profile list |
| 17:30 | akhudek | drives me crazy |
| 17:46 | muhoo | this guy? |
| 17:46 | emezeske | muhoo: We've been talking about you :) |
| 17:46 | muhoo | my ears been a-burnin |
| 17:47 | muhoo | looks like you made a thing, and it is good |
| 17:48 | muhoo | that's pretty amazing, and fast! |
| 17:49 | Raynes | muhoo: wut |
| 17:50 | muhoo | pdo, fantastic, thanks |
| 17:50 | muhoo | once i get through with today's chores, i'll have a look at a headless cljs nrepl |
| 17:50 | muhoo | which, would require me understanding and possibly doing a lot of copy/pasting from your repl.clj in leiningen |
| 17:51 | pandeiro_ | is it possible to use phantomjs/casperjs through clojurescript? |
| 17:51 | emezeske | pandeiro_: You mean to write the driver script for phantomjs? |
| 17:51 | pandeiro_ | emezeske: yeah, write it in cljs? |
| 17:52 | emezeske | pandeiro_: I expect that it might be possible, although I haven't tried it |
| 17:52 | emezeske | pandeiro_: The interop stuff should all just work |
| 17:52 | pandeiro_ | emezeske: yeah i know those use require('stuff') semantics... |
| 17:53 | emezeske | pandeiro_: It would definitely need to have the minimum :optimizations turned on so that it was one file |
| 17:53 | emezeske | pandeiro_: *at least the minimum |
| 17:53 | muhoo | my ultimate use case is this: a one-liner leiningen invocation, that can launch my noir project as a headless nrepl, the cljsbuild as a bg task, and a cljs repl as headless nrepl. |
| 17:53 | pandeiro_ | ah so it's all just right there |
| 17:53 | muhoo | pdo gets me 60% there. now i just have to deal with that nrepl cljs bit |
| 17:53 | emezeske | pandeiro_: It should be pretty easy to get a "hello world" compiled with ":optimizations :whitespace" and throw that at phantomjs |
| 17:54 | pandeiro_ | emezeske: gonna try that one of these days, i'll report back |
| 17:54 | emezeske | pandeiro_: Awesome! In the lein-cljsbuild advanced example project, I use regular javascript to drive the tests |
| 17:55 | emezeske | pandeiro_: I want to change that to clojurescript eventually; if you're successful I'll be more motivated |
| 17:55 | emezeske | nDuff: This is something else |
| 17:55 | pandeiro_ | emezeske: cool, let me take a stab at it |
| 17:57 | nDuff | hrm. |
| 17:58 | muhoo | emezeske: just to be clear, yes, i understand why i don't want to run a repl in the same terminal as the auto cljsbuild, but i *do* want to run my repl headless, along with the noir project, and the cljsbuild auto, all in the same terminal and in the same process if possible. |
| 18:00 | emezeske | muhoo: Yeah, we're on the same page. Obviously that's ideal. |
| 18:00 | emezeske | muhoo: All I wanted to communicate is that it's not possible without some elbow grease, which you seem to be ready to supply :) |
| 18:00 | augustl | is there a generic library for recursively watching for changes in the file system in a certain directory? |
| 18:01 | muhoo | emezeske: i'm game for trying. i'll probably be annoying Raynes with lots of questions along the way. |
| 18:01 | emezeske | muhoo: :) |
| 18:01 | Raynes | Whoa, what do I have to do with anything cljs related? |
| 18:02 | muhoo | not cljs related, but nrepl/lein related |
| 18:02 | muhoo | i'm reading lein-pdo, it's like one function, and it looks like complete magick and wizardry to me |
| 18:02 | Raynes | Whoa, what do I have to do with nrepl and lein? |
| 18:02 | Raynes | :p |
| 18:03 | Raynes | Oh, you must have seen me commit some headless server stuff to lein. Damn it! I should do my work under assumed names. |
| 18:03 | muhoo | heh. there's no faking it. i see yer name all over repl.clj :-) |
| 18:03 | Raynes | I wrote the original version of it. |
| 18:03 | Raynes | It has since been heavily modified, but I generally know how it works. |
| 18:03 | Raynes | So I'll help you as much as possible. |
| 18:04 | muhoo | thanks, i'll try to puzzle out as much of it as i can on my own |
| 18:15 | muhoo | Raynes: might might to mention in pdo docs that it requires lein2. |
| 18:15 | muhoo | on lein 1.7.1: leiningen.pdo Problem loading: java.io.FileNotFoundException: Could not locate leiningen/do__init.class or leiningen/do.clj on classpath: (pdo.clj:1) |
| 18:15 | Raynes | I like surprises. |
| 18:18 | _zach | Anyone have any tips on debugging clojurescript macros? |
| 18:18 | emezeske | _zach: I tend to use a regular-clojure repl to macroexpand them |
| 18:18 | muhoo | Raynes: surprise! https://www.refheap.com/paste/3899 |
| 18:18 | emezeske | _zach: And then you can look at that output to see if it is what you expect |
| 18:19 | _zach | emezeske: That's what I've been doing, but I've run into the problem of everything working in clojure-jvm, but failing to compile in cljs |
| 18:19 | _zach | emezeske: The expanded version of a form, however, will analyze and compile without error |
| 18:19 | _zach | so something in cljs.analyzer/macroexpand-1 (I think?) is causing me trouble. |
| 18:19 | emezeske | _zach: What kind of error are you seeing? |
| 18:20 | _zach | emezeske: something along the lines of "multimethod |
| 18:20 | _zach | "multimethod 'emit-constant' doesn't know how to dispatch on value: class clojure.lang.LazySeq" |
| 18:21 | emezeske | _zach: Interesting, I guess your macro returns a lazy-seq? |
| 18:21 | emezeske | _zach: Sounds like returning a non-lazy list might work around the problem |
| 18:22 | emezeske | _zach: And it sounds like the compiler needs to have support added for emitting lazy-seqs |
| 18:22 | _zach | emezeske: That's the confusing part, though... the macro isn't explicitly returning a lazy-seq |
| 18:22 | emezeske | _zach: Can you paste it? |
| 18:23 | augustl | how do I fix this? "Exception in thread "main" java.lang.IllegalStateException: Compiler already refers to: class clojure.lang.Compiler" |
| 18:23 | augustl | it happens when I import com.google.javascript.jscomp.Compiler |
| 18:23 | _zach | emezeske: Give me a couple minutes and I'll ping you |
| 18:23 | emezeske | _zach: Sure. |
| 18:26 | Cheiron | Hi, when defining an anonymous function with #() , is it ok to write #(and () ()) or we have to #((and () ())) ? |
| 18:27 | augustl | apparently "ns-unmap" is a way to fix it |
| 18:28 | _zach | Cheiron: The first version is okay. #(form) expands to something like (fn [..args] (form)) |
| 18:28 | augustl | any suggestions? |
| 18:28 | _zach | Cheiron: Notice that it wraps the form in a set of parens |
| 18:28 | Cheiron | eye c |
| 18:29 | _zach | augustl: I'm trying to do some research. The problem is that you can't have two Compiler's in the same namespace, so you have to somehow either unmap it (which you did), or alias the import |
| 18:29 | _zach | I'm not sure if the latter is possible |
| 18:29 | Cheiron | any quick function to check that something isn't nil? |
| 18:29 | emezeske | Cheiron: You can just use if or when |
| 18:30 | emezeske | ,(when 42 (println "not nil")) |
| 18:30 | clojurebot | not nil |
| 18:30 | Cheiron | i need it with and form |
| 18:30 | metellus | emezeske: won't that kind of thing also catch false? |
| 18:30 | emezeske | mattmoss: Derp. Yes it would. |
| 18:30 | Cheiron | (and (not-nil) (another condition)) |
| 18:31 | metellus | ,(nil? nil) |
| 18:31 | clojurebot | true |
| 18:31 | augustl | _zach: how do I alias an import? |
| 18:31 | metellus | Cheiron: (not (nil? foo)) |
| 18:31 | _zach | You can just say (and value (another condition)) |
| 18:31 | _zach | and if the value is nil, it wont execute (another condition) |
| 18:32 | _zach | ,(and nil (println "not printed")) |
| 18:32 | clojurebot | nil |
| 18:32 | _zach | Cheiron: ^ |
| 18:33 | _zach | emezeske: https://www.refheap.com/paste/3900 |
| 18:33 | metellus | ,(and false (println "not printed")) |
| 18:33 | clojurebot | false |
| 18:33 | Cheiron | _zach: I see, thank you :) |
| 18:34 | _zach | emezeske: umm... let me post an example of its use as well |
| 18:34 | Cheiron | clojurebot: (or 'iOS 'android') |
| 18:34 | clojurebot | No entiendo |
| 18:34 | _zach | Cheiron: I recommend using http://tryclj.com/ to test stuff out |
| 18:35 | _zach | emezeske: https://www.refheap.com/paste/3901 |
| 18:36 | Cheiron | _zach: cool! |
| 18:36 | _zach | emezeske: forms are executed after all continuations have been called by the binding forms |
| 18:36 | emezeske | _zach: Maybe syms is the problem? |
| 18:36 | emezeske | _zach: It is built from map, and then unquoted into the let form later |
| 18:37 | _zach | emezeske: Yeah, this is the thing we had the most trouble with... |
| 18:38 | emezeske | _zach: try changing it to "syms (vec (map first bindings))" -- any difference? |
| 18:39 | _zach | emezeske: that sounds like a great idea... trying now |
| 18:45 | _zach | emezeske: That worked! Thank you for taking a look! |
| 18:46 | emezeske | _zach: Great! That is definitely a bug in the clojurescript compiler; could you open a case on the clojurescript jira, with the details about your problem and the workaround? |
| 18:46 | emezeske | _zach: The fix is probably pretty easy |
| 18:46 | augustl | how do you create "JSSourceFile[]" from clojure with java interop? More specifically, what do you do with a JSSourceFile to make it into JSSourceFile[]? |
| 18:47 | xeqi | &(doc into-array) |
| 18:47 | lazybot | ⇒ "([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class ... https://www.refheap.com/paste/3902 |
| 18:47 | _zach | emezeske: Yes, I will open a ticket later :). Thanks for the support. |
| 18:48 | augustl | seems like passing a vector works too |
| 18:48 | emezeske | _zach: Yeah, no problem, I'm happy to see bugs like that get caught before they bite me. :) |
| 18:49 | _zach | augustl: Native clojure data structures implement a lot of java interfaces |
| 18:49 | _zach | augustl: If you can, use the clojure structures. |
| 18:52 | augustl | and how do you access fields from Clojure? :) foo.bar type fields, not a method call. |
| 18:52 | augustl | _zach: I see, thanks |
| 18:54 | xeqi | augustl: (foo/bar) |
| 18:54 | xeqi | &(System/out) |
| 18:54 | lazybot | ⇒ #<PrintStream java.io.PrintStream@1f9ef0c> |
| 18:55 | augustl | I'm getting "no such namespace foo" for (foo/bar) |
| 18:55 | augustl | foo is an instance, if that matters |
| 18:57 | xeqi | oh, then I think (.bar foo) should work |
| 18:58 | augustl | what if there's a method with the same name? |
| 18:58 | _zach | augustl: http://clojure.org/java_interop explains a lot of this, if that helps |
| 18:59 | aperiodic | unless the method doesn't take any args, the compiler will be able to figure out which thing you want |
| 18:59 | _zach | augustl: what do you mean by a method with the same name? |
| 18:59 | aperiodic | if it's a no arg-method, you'll need to use the explicit field access in 1.4 (.-bar foo) |
| 19:01 | augustl | _zach: can't there be methods and fields with identical names? |
| 19:01 | augustl | aperiodic: ah, I see |
| 19:02 | _zach | augustl: I see what you're saying now. refer to aperiodic :) |
| 19:20 | aphyr | Neat, so clj-http.client/get on a uri that takes a long time to respond will spike *all 8 cores* of the repl to 90% |
| 19:20 | aphyr | looks like jline.internal.nonBlockingInputStream.read() and Reflector.getMethods() |
| 19:23 | technomancy | aphyr: ouch! can you report that as an issue on the reply project? |
| 19:24 | aphyr | Sure |
| 19:24 | aphyr | Uh... actually, where? Github? |
| 19:24 | aphyr | Think this is the first bug I've caught in clojure, haha |
| 19:24 | technomancy | yeah, here we go: https://github.com/trptcolin/reply/issues/new |
| 19:25 | technomancy | assuming it's from `lein repl` |
| 19:25 | aphyr | Awesome. Yeah. |
| 19:26 | technomancy | cool |
| 19:33 | antares_ | aphyr: you are using preview6, any reason to not use preview7? |
| 19:33 | antares_ | aphyr: I believe there were reply bugs fixed between preview6 and 7 |
| 19:34 | aphyr | Uh, I just wasn't aware preview7 was out. lemme upgrade. |
| 19:35 | antares_ | technomancy: this reminds me, we need a twitter account for leiningen. seriously. |
| 19:35 | technomancy | but https://mobile.twitter.com/leiningen is taken =\ |
| 19:37 | antares_ | technomancy: yup, but we can use clojureleiningen |
| 19:37 | antares_ | it sucks a bit but will be easier to google and there are far worse usernames on twitter |
| 19:37 | Raynes | God no. |
| 19:37 | casion | has or does anyone here use clojure on android? |
| 19:38 | casion | I'm curious how viable it is in general |
| 19:38 | antares_ | whoops, Raynes is unhappy :) (doall (map abandon plans)) |
| 19:38 | gfredericks | (doseq [plan plans] (abandon plan)) |
| 19:39 | technomancy | I'd rather just publish http://leiningen.org/news.atom or something |
| 19:39 | technomancy | people are probably just interested in seeing a link to NEWS.md every time there's a release |
| 19:40 | emezeske | technomancy: What about making lein occasionally check for updates and print out a message if a newer version is available? |
| 19:40 | emezeske | technomancy: (or maybe it already does that?) |
| 19:41 | technomancy | it does that if you install via apt-get =) |
| 19:41 | emezeske | haha |
| 19:41 | emezeske | do you have a PPA set up (or whatever)? |
| 19:41 | antares_ | Raynes: what about leiningenreleases? |
| 19:41 | antares_ | or leinreleases |
| 19:42 | technomancy | emezeske: no, it just goes straight into sid |
| 19:42 | emezeske | technomancy: ah, nice |
| 19:42 | technomancy | I guess a PPA would be nice for backports |
| 19:42 | technomancy | but 2.x is still a long way away from being packaged |
| 19:42 | emezeske | sure |
| 19:43 | technomancy | maybe once we have something ready I'll see if anyone can help with the Ubuntu side |
| 19:43 | emezeske | maybe I'll create an AUR PKGBUID eventually for those rare arch users out there :) |
| 19:44 | technomancy | emezeske: 9% according to http://lein-survey.herokuapp.com/results |
| 19:44 | technomancy | there's an arch package out there, but it's pretty broken IIRC |
| 19:45 | emezeske | technomancy: 9%! whoa! |
| 19:46 | aphyr | Can confirm CPU spin is still present in preview7 |
| 19:46 | aphyr | Though it appears reduced to 60% |
| 19:47 | technomancy | emezeske: well compared to 62% for apt-get |
| 19:48 | emezeske | technomancy: I was expecting like <1%, so 9% is a win. |
| 19:48 | technomancy | it's ... higher than fink I guess |
| 19:49 | technomancy | and gentoo |
| 20:08 | augustl | how do you set the value of a field on an Java object instance? |
| 20:12 | xeqi | (doc set!) |
| 20:12 | clojurebot | Cool story bro. |
| 20:12 | xeqi | &(doc set!) |
| 20:12 | lazybot | java.lang.SecurityException: You tripped the alarm! set! is bad! |
| 20:12 | xeqi | blah |
| 20:12 | technomancy | hehe |
| 20:12 | xeqi | &(doc (symbol "set!")) |
| 20:12 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol |
| 20:12 | emezeske | augustl: A lot of java interop questions are answered here: http://clojure.org/java_interop |
| 20:13 | emezeske | augustl: Search that page for set! |
| 20:13 | aphyr | Is there a recommended way to include data files in clojure programs? |
| 20:13 | antares_ | augustl: https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/core.clj#L143-170 |
| 20:14 | antares_ | aphyr: resources |
| 20:14 | aphyr | Like, I know jars have space for arbitrary resources, just haven't figured out what part of clojure exposes it |
| 20:14 | antares_ | and then clojure.java.io/resource that shit |
| 20:14 | antares_ | and you can slurp resources, for example |
| 20:15 | aphyr | Oh, sweet. Ugh, can't wait until the clojure 1.2 results disappear from google, haha |
| 20:15 | antares_ | aphyr: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L61, typically I use src/resources for all resources |
| 20:15 | i_s | anyone know how to insert default values into a table using clojure.java.jdbc? |
| 20:16 | antares_ | aphyr: and if you have src/resources/csv/1.csv, load it as (slurp (io/resource "csv/1.csv")), that's about it |
| 20:18 | augustl | emezeske, antares_: thanks |
| 20:21 | antares_ | aphyr: we now have @leinreleases for announcements ;) |
| 20:21 | i_s | ah, you just dont include it in the insert statement. never mind. |
| 20:21 | aphyr | antares_: woot |
| 20:56 | pandeiro | best way to remove an item from a vector by index? |
| 20:56 | gfredericks | can't be done efficiently unless it's at the end |
| 20:57 | gfredericks | thus there's no convenient API for it in clojure.core, because by doing that you make your explicit use of vectors questionable |
| 20:57 | gfredericks | but you can whip it up yourself with (vec (concat (take (dec n) v) (drop (inc n) v))) |
| 20:58 | gfredericks | maybe something cleverer |
| 20:58 | gfredericks | but definitely first question whether you really need vectors |
| 20:59 | gfredericks | ,`[~@(range 3) ~@(range 5 7)] |
| 20:59 | clojurebot | [0 1 2 5 6] |
| 20:59 | gfredericks | and there's that if you want to be really goofy |
| 20:59 | pandeiro | whoa |
| 21:00 | pandeiro | i am modeling ordered pages in a collection and i want to be able to insert and delete by index... is there something better than vector to hold them? |
| 21:00 | emezeske | pandeiro: Sounds like a possible use for a map |
| 21:01 | emezeske | pandeiro: (Or perhaps a sorted-map if that's important) |
| 21:02 | pandeiro | huh, and the keys would just be the indices? |
| 21:02 | emezeske | Yeah |
| 21:02 | pandeiro | in my head i thought that's kind of what vectors were (javascript background rears its head) |
| 21:02 | gfredericks | yeah, that doesn't give you the shifting behavior you may or may not have wanted |
| 21:02 | emezeske | gfredericks: good point |
| 21:02 | gfredericks | vectors are like maps from ints to things, but with very specific performance constraints |
| 21:03 | gfredericks | you can update anywhere, but can only add/remove at the end |
| 21:03 | pandeiro | hmm, filterv |
| 21:04 | emezeske | gfredericks: I think that you're right about the vector performance contract |
| 21:04 | emezeske | gfredericks: But, I think that in practice they are more efficient at middle insert than you'd think based on the contiguous-array model |
| 21:05 | gfredericks | emezeske: afaik it should be at best linear in the number-of-things-to-the-right |
| 21:05 | emezeske | pandeiro: There's also subvec, which is maybe faster than take/drop for vectors |
| 21:05 | pandeiro | ,(filterv (complement nil?) (assoc [:a :b :c :d :e] 2 nil)) |
| 21:05 | clojurebot | [:a :b :d :e] |
| 21:05 | emezeske | gfredericks: I think vectors are actually implemented as trees in clojure |
| 21:05 | emezeske | gfredericks: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/ |
| 21:05 | emezeske | gfredericks: Although that article is old |
| 21:05 | gfredericks | emezeske: yes but everything lives in a length-32 array |
| 21:06 | gfredericks | where its position corresponds to its absolute position in the vector & 31 |
| 21:06 | emezeske | gfredericks: Ah, I reread your last comment, it makes sense |
| 21:21 | pandeiro | emezeske: hello world with casperjs driven by cljs successful, as you predicted. now to the fun stuff :) |
| 21:33 | Frozenlock | Taking a chance here: anyone knows if it's possible to get `every other' item in a mongodb collection? (With congomongo or directly with the shell) |
| 21:34 | ThatOneGuy | does (take-nth) work on the return seq from queries? |
| 21:35 | Frozenlock | Well, yes, but I want this to occur on the server. For example, take every 1/100th of a collection with thousands of items. |
| 21:36 | Frozenlock | What I'm trying to do here is to avoid filling my jvm when I really don't need everything. |
| 21:47 | dnolen | k core.logic seems like it can solve sudoku problems nearly as fast as Norvig's very clever custom Python solution ... |
| 21:50 | ohpauleez | dnolen: Sick! |
| 21:51 | ohpauleez | I just made an async bus (re: reactive - rfp) - it's wins all around tonight |
| 21:51 | dnolen | ohpauleez: haha, cool :) |
| 22:51 | brainproxy | neat ... just realized I can have mutliple repls open in emacs to the same/one swank server embedded in my project |
| 22:51 | brainproxy | don't know why I didn't try that before :p |
| 22:53 | kwertii | brainproxy: how do you open the additional ones? |
| 23:04 | dnolen | pretty darn succinct sudoku solver, http://gist.github.com/3213107 |
| 23:04 | uvtc | Where can I find the source for Rich's "ants" demo? Did not see a repo for it at https://github.com/richhickey . |
| 23:04 | uvtc | ~ants |
| 23:04 | clojurebot | ants is http://clojure.googlegroups.com/web/ants.clj |
| 23:04 | uvtc | {sigh} |
| 23:04 | uvtc | Oh, that's not it, actually. |
| 23:05 | uvtc | Clojurebot, do you have a newer link for that? |
| 23:05 | shoky | uvtc: https://gist.github.com/1093917 |
| 23:06 | uvtc | Oooh. Thanks a bunch, shoky. :) |
| 23:07 | uvtc | ~ants-demo |
| 23:07 | clojurebot | I don't understand. |
| 23:07 | uvtc | ~ants-demo is https://gist.github.com/1093917 |
| 23:07 | clojurebot | In Ordnung |
| 23:07 | uvtc | ~ants-demo |
| 23:07 | clojurebot | ants-demo is https://gist.github.com/1093917 |