2011-10-23
| 00:09 | Raynes | cemerick: You should see the edits No Starch is giving me. I'm contemplating suicide. |
| 00:10 | cemerick | ut-oh |
| 00:10 | cemerick | Raynes: so, not measured, sensible stuff that doesn't impact the thrust of the book? |
| 00:10 | Raynes | It's mostly "you should talk more about this" and "maybe we could reword this". |
| 00:10 | cemerick | ah |
| 00:11 | cemerick | O'Reilly has been very hands-off so far. We'll see what November brings. |
| 00:11 | Raynes | I mean, he isn't unreasonable with his edits. I didn't mean to come off like that. |
| 00:11 | Raynes | It's just… so many... |
| 00:12 | Raynes | Like, I'll probably put more work into revising the edits than I will into actually finishing the book. But, that's probably a good thing. |
| 00:12 | Raynes | It's my first book and I'm not an English major. |
| 00:13 | Raynes | So how things are presented really *does* need to addressed significantly. |
| 00:13 | cemerick | all content has that problem to some degree |
| 00:14 | cemerick | Show it to 10 people, you'll get 11 suggestions for how it might be clearer. |
| 00:15 | Raynes | Yeah, his suggestions are usually like "Can this be clearer?" as opposed to "Make this clearer by doing x.". I like it like that. When there is something that he knows can be written in a better way, he simply rewrites it for me. |
| 00:16 | symbole | Seems like if too much stuff is printed in the REPL, scrolling a buffer becomes very slow. Is there a way to clear the buffer, or do I need to restart my SLIME connection? |
| 00:16 | Raynes | You can clear the buffer, but I can't remember the command. It should be in the SLIME menu. |
| 00:18 | symbole | M-x slime-repl-clear-output |
| 00:18 | symbole | C-c M-o |
| 00:19 | symbole | Raynes: Good stuff. Thanks. |
| 00:19 | cemerick | Raynes: did vim take? |
| 00:19 | Raynes | God no. |
| 00:20 | cemerick | hah |
| 00:20 | Raynes | I just use cake repl from the command-line these days. Not purposely. I just stopped using slime at some point. |
| 00:20 | Raynes | I didn't even notice it until someone asked me. |
| 00:22 | cemerick | copy/paste from your editor, then? 0.o |
| 00:22 | cemerick | That sounds like how chouser works, so presumably it works. |
| 00:22 | Raynes | For the most part, yes. But I can just run inferior lisp on cake. |
| 00:22 | Raynes | If I need to eval from a buffer, I mean. |
| 00:23 | cemerick | How is cake these days? It seems to have gone a bit quiet, though that may be bias on my part. |
| 00:23 | Raynes | Silent revolution. |
| 00:23 | cemerick | heh |
| 00:24 | Raynes | I do quite a bit of work on it for real work these days. |
| 00:24 | Raynes | We mostly just don't talk much about it. |
| 00:24 | cemerick | I can appreciate that. |
| 00:24 | zakwilson | I use cake. It seems like a minor improvement over lein most of the time, but sometimes it refuses to work without a network connection when I don't think it should actually need one. |
| 00:25 | Raynes | zakwilson: That's interesting. It shouldn't need a network connection for… non-networky things. |
| 00:25 | cemerick | The whole build tool morass is a morass. |
| 00:26 | zakwilson | Raynes: I don't remember the exact circumstances, but it tried to check for updates to libraries before building a jar - maybe because some libraries were -SNAPSHOT |
| 00:26 | zakwilson | And rather than procede as if there were no updates, it failed to build the jar. |
| 00:26 | Raynes | That makes sense. You're right that it shouldn't fail in that case though. |
| 00:27 | Raynes | Did you make an issue about it? |
| 00:27 | Raynes | If not, could you? |
| 00:27 | zakwilson | No. I was a passenger in a car when it happened, and I didn't really think about it again until now. |
| 00:27 | zakwilson | I will attempt to reproduce and post an issue about it. |
| 00:28 | Raynes | Thanks. |
| 00:41 | zakwilson | Raynes: couldn't reproduce. |
| 00:42 | Raynes | Awesome |
| 00:43 | zakwilson | It was a while ago. I'm just going to assume it was fixed unless I see it again. |
| 00:44 | zakwilson | I think Rich Hickey's concept of simplicity may be more revolutionary than any concrete feature of Clojure itself. That is, I don't know if we'll be using anything that looks like Clojure in its current form in 50 years or if many of its distinctive features will survive that long, but I strongly believe the idea of not interleaving concepts will survive. |
| 01:22 | ozataman | is there a good doc facility for clojure, similar to haskell's haddock, pythong's sphinx or ruby's rdocs? |
| 01:24 | cemerick | ozataman: http://clojure.github.com/clojure/ or http://clojuredocs.org or http://clojureatlas.com (self-plug on the last) |
| 01:24 | ozataman | cemerick: thank you |
| 01:25 | napping | are those documentation generators, or documentation? |
| 01:30 | cemerick | napping: documentation; the only documentation generator is autodoc |
| 01:30 | napping | So that's what it's called. Thanks |
| 01:30 | amalloy | cemerick: marginalia? |
| 01:31 | cemerick | amalloy: good point :-( |
| 01:31 | cemerick | napping: see also marginalia as amalloy points out. Much less commonly-used, but very different. |
| 01:31 | amalloy | marginalia makes us frown? |
| 01:31 | cemerick | me forgetting it makes me frown :-( |
| 01:32 | amalloy | ah |
| 01:32 | amalloy | i'm vaguely familiar with marg, but know nothing about autodoc |
| 01:32 | cemerick | If I hadn't said "only", I wouldn't have felt bad about it. |
| 01:32 | napping | but this way amalloy pointed another out |
| 01:33 | Raynes | I use marginalia for everything. I even work on it occasionally. |
| 01:33 | amalloy | Raynes: you're a real american hero |
| 01:33 | Raynes | I know, man. |
| 01:34 | napping | reminds me of this story http://journal.stuffwithstuff.com/2010/07/24/killing-primitive-loops-and-conditionals/ |
| 01:39 | duck1123 | I'd like marginalia more if it worked for me |
| 01:43 | amalloy | napping: that's an entertaining read |
| 02:32 | zakwilson | Using Rails after spending so much time in Clojure, I find myself not liking it much. |
| 02:45 | Raynes | Good. |
| 02:45 | Raynes | You've assimilated. |
| 02:46 | Raynes | You're now simplicity's slave. |
| 06:58 | zilti | How can I put a reference to an outer map from an inner map? The outer map isn't named. Something like {:name "cdfgs" :innermap {:x 0 :y 5 :outer outer}} ? |
| 09:13 | babilen | Hi all. Which version of lazytest do I need to use if I use clojure 1.3? 1.2.3 seems to depend on 1.3.0-alpha3, or is that >= 1.3.0-alpha3 ? |
| 09:14 | babilen | And what is the general plan for lazytest? Is it meant to replace clojure.test in the future, or will lazytest, clojure.test, midje et. al be maintained in parallel for some time to come? |
| 09:55 | etosch | in 1.3, is there a way to define a a value as a primitive? |
| 09:55 | etosch | as in, defining (def n 10) to be an int? |
| 11:16 | leafw | hi all. Question on using a a record (defined with defrecord) from a different .clj file. I thought I need the following in the ns: (:use [the.other.file :only MyRecord]) |
| 11:16 | leafw | but lein complains that it cannot find the class or the file |
| 11:17 | leafw | anyone using lein and records would like to comment? |
| 11:17 | leafw | would be appreciated |
| 11:20 | jli | huh, weird. does it work without the ":only MyRecord" bit? |
| 11:20 | leafw | would be nice if I knew how to fix or setup clojure to spit more useful error messages, or at least to make lein just work. |
| 11:20 | leafw | jli: I tried importing the whole namespace, to no avail |
| 11:21 | Apage43 | leafw: you'll want to :import it it, not :use it |
| 11:21 | leafw | is there any known public project out there, that declares defrecord somewhere and uses them from other files? |
| 11:21 | leafw | Apage43: thanks. Is this an undocumented feature? |
| 11:22 | Apage43 | leafw: nah, defrecord actually creates a -class- |
| 11:22 | leafw | I understand defrecord ends up creating a class, so import makes sense. But I naively thought that importing the whole namespace would do that. |
| 11:22 | llasram | leafw: It's kind of wacky. I've actually been meaning to ask about it |
| 11:23 | Apage43 | not sure about that. I don't really know how imports work vs the require/use space. |
| 11:23 | leafw | llasram: it would be ok if it was documented. Indeed the error just went away. |
| 11:23 | clojurebot | hmm… sounds like your out of heap space |
| 11:23 | llasram | leafw: It creates a class, which you can access from other Clojure namespaces by either referring to the absolute name of the class, or by pulling it into the local namespace with import |
| 11:24 | leafw | it is unfortunate that clojure's docs focus on defining what each function or macro does, and not how to use it. I hope to upload a more useful example in clojuredocs.org |
| 11:24 | leafw | llasram: I get it, thanks for the explanations. |
| 11:24 | babilen | leafw: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html |
| 11:24 | llasram | leafw: But the name it creates in the defining namespace is private, so you can't resolve it via a namespace-prefixed symbol |
| 11:25 | llasram | leafw: Cool, glad could help |
| 11:26 | llasram | The last part (ns name is private) is the part I don't quite get. I was pretty surprised by it |
| 11:26 | leafw | what a pity that defrecord ends up being special. |
| 11:26 | leafw | llasram: I will keep it in mind case it bites later on. |
| 11:26 | leafw | thanks |
| 11:27 | leafw | while at it: can lein be setup to spit stack traces without anything not in my own code? |
| 11:27 | leafw | that is, the part of the stack traces that are relevant. |
| 11:31 | ozataman | duck1123: ecb seems to mess with magit-status splitting behavior. it creates both a vertical and a horizontal split instead of just a vertical one. have you run into this as well? |
| 12:02 | etosch | I'm trying to powe some code from 1.2 to 1.3 and am having issues switching over to clojure.math.numeric-tower from clojure.contrib.math. Has anyone else had any issues with this? |
| 12:03 | etosch | *port |
| 12:03 | iris1 | Dear experts, I have a basic question about Clojure. I have a long-running single-threaded Clojure program that interacts with the outside world via stdin and stdout. I would like to connect a REPL to the program after it has run a while and built up some interesting state. Apparently, swank/start-repl solves this exact problem, which is great. My question is, how should the state be stored so that it is accessible to the REPL? It seems |
| 12:03 | iris1 | maybe a ref is correct, but it could be an agent?? |
| 12:03 | lazybot | iris1: Uh, no. Why would you even ask? |
| 12:04 | iris1 | (I am confused by the response by lazybot -- I am assuming this is some automated participant in this IRC chat room? Does it serve some useful purpose? Thanks!) |
| 12:06 | babilen | iris1: It is a bot (disregard it) |
| 12:13 | llasram | iris1: I'm not an expert, but I don't think you should need deform your design to allow REPL access, beyond exposing whatever reference type(s) you use to hold your state to the REPL |
| 12:14 | llasram | iris1: As long as you expose it to the REPL, you can deref it to get at a consistent snapshot of that state |
| 12:14 | llasram | s,need deform,need to deform, |
| 12:19 | iris1 | llasram: Thank you! I definitely don't want to deform my design too much but it seems like I need to assign some name to the state that I want to examine via the REPL, otherwise I don't know how it can possibly work. For example, having a program structure that takes the input as a seq and produces output as another seq that is then fed into stdout will probably not work because the state will be kept within some processing function, and |
| 12:19 | iris1 | inaccessible to the REPL. Does this make sense? I feel that this should be a solved problem because it is very similar to the issue of attaching a REPL to a running web server to play around with it (except that my program is single-threaded which the web server probably is not). |
| 12:24 | llasram | iris1: Ah, ok. I see now. Well, this is definitely outside my experience then :-). However, if your program doesn't actually have any mutable state -- if it is a pure functional program entirely determined by its inputs -- what is there to observe by attaching a REPL to a live instance? |
| 12:25 | TimMc | etosch: You'll probably need to be more specific. |
| 12:27 | etosch | TimMC: I just figured out the issue; I had the wrong thing in my project.clj |
| 12:27 | etosch | Thanks, though! |
| 12:29 | babilen | quit |
| 13:05 | lynaghk | Does anyone know the state of atom validators in ClojureScript? In particular, how to handle the exceptions they throw? |
| 13:06 | lynaghk | As far as I can tell, they are just throwing a string, and I can't figure out the appropriate way to catch that in a try/catch |
| 13:07 | iris1 | llasram: the program computes some values that are functions of the inputs (it also writes out some outputs that are functions of the values computed). I would like to observe some of the values that have been computed. no mutating anything is going on |
| 13:08 | lynaghk | The ClojureScript wiki page on exception handling suggests that cljs catch doesn't need an exception type argument, but I can't compile without it. |
| 13:41 | leafw | something is off with lein: one has to enter the lein repl, then call (compile 'some.name.space) that has a defrecord, then "lein run" is able to compile the rest, which have an (ns ... (:import some.record)) declaration. Why are defrecord handled so crudely? Is this by design? What am I missing? |
| 13:42 | mindbender1 | please I have been with struggling for days with error related to slime when connecting to a clojure project |
| 13:42 | leafw | is there any IDE that a clojure power user would recommend as "fully working, no irks" ? |
| 13:44 | leafw | I would pay good money for an IDE for clojure that handled all the non-obvious plumbing necessary that lein only half-heartedly handles. |
| 13:44 | k9quaint | if only everything supported lisp natively :( |
| 13:45 | raek | leafw: to use a record type from another namespace, you first need to require it, then import the record class |
| 13:46 | mindbender1 | slime reports (cl-assertion failed ((keywordp module))) when I try to slime-connect or clojure-jack-in. I have connected successfully in the past I don't know if there is a conflict somewhere.. please help? |
| 13:47 | raek | but I don't know why this was designed the way it was. (but in 1.3, I think, you automatically get "constructor functions" which you can 'use' in the normal way) |
| 13:47 | leafw | raek: ok, I'll try that. Is it documented somewhere? |
| 13:47 | leafw | raek: I am using 1.3, and it doesn't work anyway. |
| 13:47 | leafw | so first I require, then I import. |
| 13:48 | raek | I think that if the record type is called Foo, the constructor function is called ->Foo or something |
| 13:48 | raek | leafw: does the namespace contain any dashes in the name? |
| 13:48 | leafw | nope |
| 13:49 | raek | you need to do (ns ... (:require foo.bar-baz) (:import foo.bar_baz.TheRecordType)) |
| 13:49 | leafw | raek: your require + import, in this order, did the trick. Thanks! Now if only this was documented. |
| 13:49 | raek | but these details don't seem to be documented on the official site... |
| 13:50 | leafw | the clojuredocs.org quotes defrecord as: "Alpha - subject to change" |
| 13:50 | raek | it kind of makes sense if you think about what require and import does: require will cause a namespace to be loaded. to load a namespace each top-level form is evaled in the source file |
| 13:50 | mindbender1 | noboby here on emacs-clojure? |
| 13:51 | raek | when a (defrecord ...) form is evaled, a new class is created dynamically |
| 13:51 | raek | you have to do the import after that, since before the namespace is loaded, the class didn't exist |
| 13:51 | leafw | raek: it makes sense, but it means I have to be aware of the underlying java plumbing. One would have expected that (:use ...) would be enough to do all that: the require and the import, for any defrecords in that namespace. |
| 13:52 | raek | leafw: yeah, that's one of the weird things about this |
| 13:52 | leafw | clojure 1.3.0 has a doc for defrecord as "Alpha - subject to change", but Rich talks about defrecord as if it wasn't alpha. |
| 13:52 | raek | leafw: the most common solution seems to be to not expose the class constructor at all an expose a function that creates the record instead |
| 13:53 | leafw | whatever, at least I am glad you knew the solution. I hope it goes online somewhere. |
| 13:53 | raek | leafw: yeah, they have been there since 1.2 |
| 13:53 | leafw | raek: one could do that, but then records cannot be used outside that namespace without reflection warnings |
| 13:54 | raek | if you interpret "alpha" as "I will change this whenever I feel like, because noone is using it yet", then records are not alpha |
| 13:54 | raek | leafw: ah, you need them for jvm interop? |
| 13:54 | leafw | raek: I agree. The doc is misleading. |
| 13:54 | raek | or why did you get the reflection warnings? |
| 13:55 | leafw | raek: yes, interop, but also just for plain separation of data vs GUIs. |
| 13:55 | raek | (:foo x) shouldn't give any reflection warning |
| 13:55 | raek | but I guess (.foo x) will |
| 13:55 | leafw | well: iterating a list of records gives a warning |
| 13:56 | leafw | so (:foo x) is the same as (.foo x), but without warnings? Aren't both, in the end, just calling the field anyway? |
| 13:56 | raek | (:foo x) is more abstract than (.foo x) |
| 13:57 | leafw | true, it uses the record as a map |
| 13:57 | raek | (:foo x) invokes the keyword as a function, which will delegate the work to a method in the KeywordLookup interface of x, I think |
| 13:58 | leafw | I am reading the emit-defrecord. That seems correct. The ilookup calls valAt, which doesn't seem to be defined within the emit-defrecord function. |
| 13:58 | leafw | well at least I am glad there is a solution. Thanks a lot raek. |
| 13:59 | raek | I get the impression that certain details are a bit crude since they are "not done yet" |
| 14:00 | leafw | the most promising language in the world. We can wait. |
| 14:00 | raek | :-) |
| 14:02 | mindbender1 | noboby here on emacs-clojure? |
| 14:03 | mefesto | mindbender1: is that the same as emacs + clojure-mode or is that something else? |
| 14:04 | mindbender1 | yes emacs clojure-jack-in problems |
| 14:04 | raek | mindbender1: I haven't seen that problem myself, but it looks like the problem happens in emacs somewhere |
| 14:05 | mindbender1 | I have been looking around for a solution |
| 14:05 | raek | mindbender1: could it be another conflicting slime version installed? |
| 14:05 | mefesto | mindbender1: are you using marmalade repos for your slime? |
| 14:05 | mindbender1 | probably cos I have more than 1 slime version |
| 14:05 | raek | mindbender1: if you use clojure-jack-in, you don't need to have slime installed at all |
| 14:05 | raek | mindbender1: so you could try to remove everything that looks slime-related |
| 14:06 | mefesto | mindbender1: i was having problems also (not the same as yours though) which were resolved when i switched to the version in marmalade |
| 14:06 | raek | when you call clojure-jack-in, it actually evals a slime.el file that is bundled with the swank-clojure lein plugin |
| 14:07 | mindbender1 | raek: but there are times when you need slime for other purposes |
| 14:07 | mindbender1 | but if there is a way to temporarily disable slime? |
| 14:08 | mindbender1 | so I don't have to download it again when I need it |
| 14:08 | raek | sure. it would be nice if slime version compatibility would have worked better |
| 14:09 | mindbender1 | mefesto: did you have to remove the other version you were using before you switched? |
| 14:09 | raek | mindbender1: if think it depends on how you have installed slime. is the loading triggered by something in your .emacs file or is it done automatically by package.el or something? |
| 14:10 | mefesto | mindbender1: yea |
| 14:10 | mindbender1 | raek: I have one version triggered in .emacs |
| 14:11 | mindbender1 | mefesto: how did you remove it? did you just delete folder or through some other process? |
| 14:11 | mefesto | mindbender1: yeah removed any setup i had for it in my .emacs file and removed it from ~/.emacs.d/elpa or whereever it was |
| 14:12 | raek | mindbender1: I have heard that clojure-jack-in could work when you have another slime version installed, since it loads its own version and overwrites the definitions (for the rest of the session) |
| 14:12 | mindbender1 | raek: so I believe |
| 14:13 | mindbender1 | but my experience is proving otherwise especially without adequate documentation |
| 14:13 | raek | but the error you get seems to debunk that theory |
| 14:13 | mindbender1 | exactly |
| 14:14 | raek | yes. this is a mess. |
| 14:14 | leafw | raek: I've put up an example in clojuredocs.org: http://clojuredocs.org/clojure_core/clojure.core/defrecord#example_753 |
| 14:14 | mindbender1 | so frustrating on occasion I had even resorted to praying:) |
| 14:16 | mefesto | mindbender1: is it known that the version of slime in marmalade will *not* work with your non-clojure use cases? |
| 14:16 | raek | mindbender1: maybe you can set up a different .emacs file for clojure dev |
| 14:17 | mindbender1 | raek: how do I manage that? |
| 14:17 | mefesto | mindbender1: perhaps just comment out any slime settings in .emacs, restart emacs and try just the marmalade version out (without removing any of your other slime versions) |
| 14:17 | mefesto | or what raek said |
| 14:17 | mindbender1 | mefesto: ok I'll try that first |
| 14:18 | raek | mindbender1: I don't know :-) I just assumed you could do that somehow... |
| 14:19 | raek | separate environments seems to be a standard solution to dependency hell kind of problem |
| 14:19 | raek | s |
| 14:19 | mindbender1 | ok |
| 14:21 | raek | or perhaps you could factor out the non-clojure slime things into a separate file and only load that when you want to use non-clojure slime |
| 14:22 | mindbender1 | ok |
| 14:23 | mefesto | for someone that has never explored logic programming, what would be some good reading material to help get familiar with clojure/core.logic? I see on the project's README that "The Reasoned Schemer" is noted. Is that a good starting point? |
| 14:26 | mindbender1 | raek: do you know where the swank files clojure-jack-in uses are located? |
| 14:27 | raek | mindbender1: the slime files are inside the swank-clojure jar file |
| 14:28 | mindbender1 | so it uses nothing outside of those related to swank and slime? |
| 14:29 | raek | all you need in emacs when you use clojure-jack-in is clojure-mode.el |
| 14:29 | mindbender1 | ok |
| 14:29 | raek | the slime stuff is bundled with swank |
| 14:29 | mindbender1 | ok |
| 14:30 | raek | and swank is handled by leiningen outside emacs |
| 14:30 | mindbender1 | so clojure-jack-in just calls leiningen to do its work |
| 14:30 | raek | yes |
| 14:30 | mindbender1 | ok |
| 14:31 | mefesto | mindbender1: what version of the swank-clojure plugin do you have installed? |
| 14:31 | raek | well, it also gets some .el file from leiningen and load them |
| 14:32 | mindbender1 | mefesto: that's 1.3.3 |
| 14:32 | mindbender1 | is that ok? |
| 14:32 | mefesto | yeah that's the latest afaik |
| 14:32 | mindbender1 | ok |
| 14:33 | mindbender1 | but I see 1.4.0 -SNAPSHOTS lying around somewhere on my .m2 repos |
| 14:34 | raek | mindbender1: one thing that's important is that you only have one swank-clojure version in the ~/.lein/plugins/ directory |
| 14:35 | mindbender1 | raek: yes I do and that's 1.3.3 |
| 14:35 | robermann | I was checking how works my emacs+clojure on win7, and I've seen that when doing clojure-jack-in it uses the mamalade version of slime |
| 14:36 | raek | mindbender1: any success with disabling "the other slime" in your .emacs? |
| 14:38 | robermann | it looks for a slime.el under ".emacs.d\elpa\clojure-mode-1.11.1\, but it is not there |
| 14:38 | mindbender1 | raek: there is a quicklisp directory that I added earlier to my .emacs which I commented out but from the error the slime.el there is still been called |
| 14:39 | mindbender1 | and this error happens when i clojure-jack-in |
| 14:43 | robermann | mindbender1: if you are on windows, this can help: http://sourceforge.net/apps/wordpress/codesounding/2011/09/29/installing-emacs-24-and-clojure-mode-on-windows-7-step-by-step/ |
| 14:45 | raek | mindbender1: I still think the problem is that you other slime version is loaded, but unfortunately my experience with how emacs loads stuff is very limited |
| 14:45 | mindbender1 | robermann: I on debian linux but I'll check it out to get some idea |
| 14:46 | mindbender1 | raek: emacs needs more docs on that |
| 14:47 | raek | mindbender1: IIRC, until version 24 emacs didn't have any official package system |
| 14:47 | robermann | if it can help, my file system sniffing tells me that clojure-jack-in is not using an embedded slime.el version |
| 14:47 | raek | all these things are just conventions, afaik |
| 14:48 | raek | clojure-jack-in uses the bundled version for me |
| 14:48 | raek | I don't have any slime version installed what so ever |
| 14:49 | mindbender1 | robermann: I suspect same on my system |
| 14:51 | robermann | raek, where is your slime.el version? inside the clojure-mode directory? |
| 14:51 | raek | hrm, wait. there seems to be one there... |
| 14:52 | simard | How can I make a seq out of the result of a repeated function call ? (ie.: the function has side effects, and will return a different value each time it's called) |
| 14:52 | raek | (in the elpa/ dir) |
| 14:52 | raek | simard: repeatedly |
| 14:52 | mindbender1 | raek: really? |
| 14:52 | simard | raek: thank you |
| 14:55 | robermann | raek, so you have something as .emacs.d\elpa\slime-20100404.1 |
| 14:56 | raek | robermann: ye |
| 14:56 | raek | s |
| 15:04 | mindbender1 | seems there's is success here |
| 15:05 | mindbender1 | raek: what version of slime is your repl showing? |
| 15:17 | robermann | i have to correct myself: clojure-jack-in is using the slime version inside swank-clojure-1.4.0-SNAPSHOT.jar\swank\payload |
| 15:18 | robermann | if check the *swank* buffer, it says: ;;; Bootstrapping bundled version of SLIME; please wait.. |
| 15:23 | simard | what is the function that returns the combination of N functions ? ie.: (combine F G H) => (fn [x] (F (G (H x)))) |
| 15:23 | amalloy | comp |
| 15:23 | simard | meuh |
| 15:24 | simard | meh* |
| 16:06 | simard | is there an inverse to function (char) ? |
| 16:07 | simard | int.. |
| 16:26 | zilti | I have a map containing a vector of maps. What's the best way to modify each map in the vector? It has to be performant. |
| 16:28 | zilti | As in it has to be done over 100 times a second |
| 16:28 | amalloy | vectors aren't "for" working with things as seqs. they're for (a) fast indexed access, (b) conjing onto the right. the best way is to seq the vector and map over it, but of course you don't get a vector back |
| 16:29 | zilti | amalloy: In the end it's not particularly important for my use case if it's a vector or a list |
| 16:31 | amalloy | well. lists and seqs aren't the same thing, but close enough. just use map |
| 16:32 | zilti | So I'd do a (update-in mp [:key] map #(update-in % [:otherkey] newvalue)) |
| 16:33 | amalloy | wrong argument order to map, but right general idea |
| 16:34 | amalloy | (update-in m [k] (fn [v] (map #(assoc % j x) v))) |
| 16:54 | Raynes | Clojure-contrib is dead, long live clojure-contrib. |
| 17:06 | TimMc | $findfn complement = not= ; :-P |
| 17:06 | lazybot | [] |
| 17:07 | TimMc | or s/complement/not/ I suppose |
| 17:07 | gfredericks | TimMc: if functions were values I guess you'd get comp |
| 17:07 | TimMc | yeah |
| 17:08 | gfredericks | would haskell do that? |
| 17:08 | gfredericks | I don't even know if haskell has any kind of comparison for functions... |
| 17:09 | Raynes | $he head == head |
| 17:09 | Raynes | Damn it. |
| 17:09 | gfredericks | that bot so lazy |
| 17:10 | Raynes | $kill |
| 17:10 | lazybot | KILL IT WITH FIRE! |
| 17:10 | gfredericks | (dec lazybot) |
| 17:10 | gfredericks | there needs to be a backup karma system so we can penalize lazybot when the karma doesn't work. |
| 17:10 | Raynes | $tryhaskell head == head |
| 17:10 | lazybot | ⟹ No instance for (GHC.Classes.Eq ([a] -> a)) arising from a use of `GHC.Classes.==' at <interactive>:1:0-11Possible fix: add an instance declaration for (GHC.Classes.Eq ([a] -> a)) |
| 17:10 | Raynes | Goody. At least that works. |
| 17:10 | TimMc | ,(= inc inc) |
| 17:10 | clojurebot | true |
| 17:11 | gfredericks | ,(= (comp inc inc) (comp inc inc)) |
| 17:11 | clojurebot | false |
| 17:11 | Raynes | amalloy: Speaking of lazy bots, we're officially out of issues stopping us from deploying lazybot. We just need to pick a version number, since we've never actually released real versions before. |
| 17:12 | gfredericks | Raynes: what about the broke karma? |
| 17:12 | amalloy | call it 11.04, just in case it's full of bugs |
| 17:12 | gfredericks | ~rimshot |
| 17:12 | clojurebot | Badum, *ching* |
| 17:12 | Raynes | gfredericks: It was probably already fixed at some point. |
| 17:13 | Raynes | amalloy: The current (pointless) version number is 0.6.2. Why not hop up to 0.7.0-alpha1? |
| 17:14 | amalloy | up to you. i'm not some kind of version-number connoisseur, cracks at ubuntu notwithstanding |
| 17:30 | amalloy | huh, looks like ints will go back to boxing as Integers |
| 17:33 | TimMc | amalloy: So int will return Integer? |
| 17:34 | TimMc | Mailing list stuff? |
| 17:34 | amalloy | TimMc: the function int? no, it will still return int :P. but when that gets boxed, you'll get an Integer |
| 17:34 | TimMc | got it |
| 17:34 | amalloy | and yeah, rich just posted about some commits he made |
| 17:35 | duck1123 | so is that going to mean that all the math stuff is going to have to change? |
| 17:43 | Raynes | &(clojure-version) |
| 17:43 | lazybot | ⇒ "1.3.0" |
| 17:43 | Raynes | amalloy: ^ Success. |
| 17:48 | duck1123 | (inc lazybot) |
| 17:48 | lazybot | ⟹ -1 |
| 17:49 | amalloy | poor guy |
| 17:51 | llasram | duck1123: I don't think so. The commit is pretty tiny. AFAICT, all it does is (a) not convert int return values to longs immediately at the call site, and (b) changes the boxing behavior so ints get boxed as Integers. All the math functions still only return longs etc etc |
| 17:53 | llasram | Huh. I wonder why rhickey indents his Java with tabs |
| 17:53 | duck1123 | eclipse default? |
| 17:54 | amalloy | llasram: investigating rhickey's java style can only lead to sadness |
| 17:55 | duck1123 | I have emacs set to always show tabs. I have a little OCD twitch whenever I open any java file. |
| 17:55 | llasram | amalloy: heh. I guess that's why he wrote Clojure? |
| 17:56 | llasram | duck1123: Me too, although I keep meaning to turn it off. I want to keep unnecessary whitespace out of my diffs, but whitespace-mode just makes me sad whenever I open the code of anyone who doesn't use it |
| 17:58 | amalloy | for clojure projects i have emacs set up to fix whitespace whenever i save a file. anyone who's impacted by that shouldn't be indenting so badly :P |
| 17:58 | duck1123 | it's so hard to avoid wanting to fix any source file I touch, but I know it's just going to make it that much harder to merge |
| 18:40 | eyeris | In a repl (run from lein repl) I can do (ns yummm.yummm (:gen-class)) without error. However if I run lein nailgun to run ng-server, then in Vim with VimClojure if I evaluate the same form I get an error 'Could not locate yummm_init.class or yummm.clj on classpath' |
| 18:40 | eyeris | What am I missing here? |
| 18:46 | eyeris | I can also successfully eval that ns form inside a repl started by vimclojure |
| 18:52 | amalloy | eyeris: i think the gen-class is irrelevant. you're likely to have the same problem without it? |
| 18:54 | eyeris | That's true. I just tested to confirm. |
| 18:55 | amalloy | in that case you probably have the wrong directory structure (this file should be in src/yummm/yummm.clj), or there's something wrong with lein ng |
| 18:56 | eyeris | It is src/yummm/yummm.clj, so I guess I will look into ng |
| 18:59 | eyeris | eek laptop battery is dying |
| 18:59 | eyeris | thanks for the direction amalloy |
| 18:59 | eyeris | bbl |
| 19:14 | simard | (clojure.string/split-lines (apply str (map char '(49 50 51 52 13 53 54 50 51 49 13)))) => ["1234\r56231\r"] |
| 19:14 | simard | what's wrong with this ? shouldn't it separate the strings ? |
| 19:14 | amalloy | \r isn't \n |
| 19:16 | simard | hum.. correct. it's funny that pressing enter gives \r and not \n |
| 19:16 | simard | (I'm using lwjgl) |
| 19:17 | simard | or it's probably just normal and I'm naively expecting "enter" to map to a unix line terminating character |
| 19:18 | amalloy | $google lwjgl |
| 19:18 | lazybot | [lwjgl.org - Home of the Lightweight Java Game Library] http://lwjgl.org/ |
| 19:18 | amalloy | \r is nuts. \n would be normal in most circumstances, and \r\n acceptable in others |
| 19:19 | TimMc | Mac used to be \r |
| 19:20 | TimMc | iirc |
| 19:20 | amalloy | TimMc: i think that's true, but for years |
| 19:24 | TimMc | Mac is \n now, right? |
| 19:25 | gfredericks | I'm using deftype to create a named java class implementing a java interface for some java code to utilize by name. Are there any quirks that would cause the java code to believe, once it's instantiated my class, that the object is not an instance of the interface? |
| 19:26 | gfredericks | the java code does a test with instanceof, and apparently it's coming up false :/ when I do presumably the same thing at the clojure repl, I get true |
| 19:27 | gfredericks | if the java interface exists in two different jars (I'm deploying an uberjar...), could that cause it to exist twice in some sense? |
| 19:28 | gfredericks | I don't know how the jvm handles duplicate classes... |
| 19:29 | gfredericks | shallow googling suggests that shouldn't be the explanation |
| 19:32 | amalloy | gfredericks: do you control the java code? |
| 19:33 | gfredericks | amalloy: erg...it's physically possible to modify it, yes, but it's a dependency of the java code I'm actually working with, so it would be ornery |
| 19:33 | amalloy | if so, you can try getting it to call foo.getClass().getInterfaces() to see if it thinks it implements a different interface with the same name |
| 19:34 | amalloy | gfredericks: probably doesn't even have to be the same java code that's using it; anything in the same classloader would suffice |
| 19:34 | gfredericks | amalloy: okay, I suppose I will try that next |
| 19:37 | amalloy | at any rate that's likely to be the issue. i don't know how this uberjar stuff interacts, but you're probably creating another copy of the interface-classfile, which doesn't match the one your lib is compiled against |
| 19:37 | gfredericks | ditching the uberjar doesn't seem to have changed anything |
| 19:38 | gfredericks | well I did still copy the...hrm |
| 19:40 | gfredericks | oh interesting. I removed the jar containing the extra copy of the interface and now the classloader complains the interface doesn't exist. |
| 19:40 | gfredericks | guess I'll investigate if the compile-jar and the runtime-jar mismatch |
| 19:43 | gfredericks | and they're all identical :/ |
| 19:44 | gfredericks | I bet tomcat does some crazy witchcraft with classes |
| 20:06 | jrabbit | https://gist.github.com/1308102 what data type is that :| |
| 20:08 | dnolen | jrabbit: ? |
| 20:08 | gfredericks | it's a list with a map with ... |
| 20:09 | jrabbit | oh its a map ok I wasn't really sure how to muck with it |
| 20:09 | gfredericks | but as dnolen pointed out, the more appropriate response is '?' |
| 20:10 | dnolen | ,(first '({:foo 'bar})) |
| 20:10 | amalloy | are you sure it's badly made? it seems kinda reasonable, given that i don't know much about css |
| 20:10 | dnolen | &(first '({:foo 'bar})) |
| 20:10 | lazybot | ⇒ {:foo (quote bar)} |
| 20:10 | dnolen | &((first '({:foo 'bar})) :foo) |
| 20:10 | lazybot | ⇒ (quote bar) |
| 20:11 | jrabbit | amalloy: well its not really documented :P |
| 20:11 | dnolen | jrabbit: which Clojure project is that? |
| 20:11 | jrabbit | https://github.com/simonhicks/css-parser |
| 20:11 | jrabbit | Single commit -> shitty project in my book :p |
| 20:12 | dnolen | jrabbit: that is awesome, someone needs to port that to ClojureScript |
| 20:12 | amalloy | i once accidentally wrote a (small) project as a single commit, because my source directory had wound up in .gitignore and all my commits were getting ignored |
| 20:12 | jrabbit | hehe |
| 20:13 | jrabbit | dnolen: I've been looking at css parsers and thats the best one |
| 20:13 | clojurebot | {:foo (quote bar)} |
| 20:13 | jrabbit | unless theres a good java one |
| 20:14 | dnolen | jrabbit: ah uses fnparse, wonder when that'll see an update. |
| 20:15 | daaku | anyone know how to have moustache locals passed thru to a handler function? this might explain the question better: https://gist.github.com/ce36c961df4587749fa3 |
| 20:15 | jrabbit | dnolen: I'm really sad to see clojurescript so young :\ |
| 20:15 | dnolen | jrabbit: ? |
| 20:15 | jrabbit | dnolen: I really want to play with clojure on my hp touchpad |
| 20:15 | jrabbit | dnolen: its kind of hard to use :p |
| 20:16 | dnolen | jrabbit: yes it needs more tool support, I take it you don't use Emacs? |
| 20:17 | jrabbit | No :\ Textmate and Clooj |
| 20:18 | dnolen | jrabbit: Clooj is pretty good, wouldn't take much work to get Clooj to work with ClojureScript. |
| 20:18 | jrabbit | dnolen: well the thing is I'd want to basically deploy to the touchpad or a vm easily, and a lein plugin would work there |
| 20:20 | jrabbit | dnolen: like see what lein-ring does for a nice experince |
| 20:40 | jrabbit | Can toy search by values? |
| 20:40 | jrabbit | *you |
| 20:40 | jrabbit | inside a map? |
| 20:40 | gfredericks | jrabbit: you want all the keys that map to a value? |
| 20:41 | gfredericks | &(let [m {:foo 12 :bar 14 :baz 14}] (filter #(= 14 (m %)) (keys m))) |
| 20:41 | lazybot | ⇒ (:bar :baz) |
| 20:42 | jrabbit | oh you can call a hashmap? |
| 20:42 | gfredericks | yep |
| 20:43 | gfredericks | you pass it a key and it gives you a value: ##({:foo 'bar} :foo) |
| 20:43 | lazybot | ⇒ bar |
| 20:43 | gfredericks | another thing you might find useful: ##(let [m {:foo 12 :bar 14 :baz 14}] (group-by m (keys m))) |
| 20:43 | lazybot | ⇒ {12 [:foo], 14 [:bar :baz]} |
| 20:43 | duck1123 | it's handy in situations, but more often you'll see it written the other way |
| 20:43 | gfredericks | I suppose that effectively inverts the map |
| 20:43 | jrabbit | nice. |
| 20:44 | gfredericks | duck1123: it's particularly handy in that group-by I just wrote :) |
| 20:44 | amalloy | gfredericks: (filter (comp #{14} m) (keys m)) is more fun |
| 20:45 | amalloy | though (group-by m (keys m)) is pretty slick |
| 20:45 | gfredericks | amalloy: (apply filter ((juxt (partial comp #{14}) keys) m)) |
| 20:45 | amalloy | touche |
| 20:45 | jrabbit | confusing. |
| 20:46 | duck1123 | no solution is valid unless it uses juxt |
| 20:46 | gfredericks | jrabbit: we're not suggesting anything serious |
| 20:46 | amalloy | clojurebot: make a note of it |
| 20:46 | clojurebot | make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive |
| 20:46 | jrabbit | is there any way to run a command in shell simply? |
| 20:46 | amalloy | gfredericks: well, i am. (comp #{x} f) is a great idiom |
| 20:46 | jrabbit | or a generic executable? |
| 20:47 | duck1123 | lein repl is pretty quick |
| 20:47 | gfredericks | amalloy: but it sounds so violent |
| 20:47 | jrabbit | duck1123: huh? |
| 20:47 | amalloy | eh? |
| 20:47 | amalloy | jrabbit: clojure.java.shell/sh |
| 20:47 | duck1123 | jrabbit: nvm, I misread your question |
| 20:47 | gfredericks | comp is like 'chomp', and #{} has lots of sharp pointy teeth |
| 20:48 | jrabbit | also shell-out apperantly |
| 20:48 | duck1123 | There's some code in pallet that I've been using for one of my projects to shell out |
| 20:48 | gfredericks | amalloy: it's the most reasonably objection I could come up with |
| 20:48 | amalloy | gfredericks: it's function-composing two non-functions! best thing ever! but i do love the violent imagery |
| 20:49 | amalloy | fortunately my functions wear (armor) |
| 20:49 | simard | I'd like to write a regex that matches everything between the last \n and end of line, but NOT if there is a \n at the very end of the line. ie: (re-seq #"([^\r\n]+)$" "1\n2\n3\n") => nil, but (re-seq #"([^\r\n]+)$" "1\n2\n3") => "3" (obviously that regex there doesn't do that, it's just a first try) |
| 20:49 | gfredericks | amalloy: I guess that is kind of fun. Reminds me of the time I juxt'd a bunch of maps together |
| 20:49 | duck1123 | My midje tests carry swords. (foo) => |
| 20:51 | amalloy | simard: it doesn't work because $ only matches at end of string? so replace $ with (?!\n) |
| 20:53 | simard | well, that works, thank you again, amalloy |
| 20:54 | gfredericks | I've not done hardly anything with clojure and xml -- if I want to take an XML file and make a quick insertion, is there some good clojure libs for that, or should I just do it with strings? |
| 20:54 | gfredericks | nevermind I just remembered I'm doing this in ruby not clojure |
| 20:55 | gfredericks | what a weird thing to forget... |
| 20:59 | duck1123 | gfredericks: I have that happen to me all the time. I've caught myself typing "lein spec" before |
| 21:00 | gfredericks | oh I bet that didn't make lein very happy. |
| 21:08 | amalloy | all in favor of a patch to make lein delete your .git directory when it thinks you might be cheating on it with another build tool? |
| 21:09 | technomancy | amalloy: I was thinking when it detects you've checked a jar file into git |
| 21:10 | amalloy | don't make me wear my fingers down to nubs typing (inc technomancy) over and over |
| 21:11 | technomancy | not my idea, sorry |
| 21:11 | technomancy | I think maybe I stole it from ieure? |
| 21:49 | simard | ,(map println (range 3)) |
| 21:49 | clojurebot | (0 |
| 21:49 | clojurebot | 1 |
| 21:49 | clojurebot | 2 |
| 21:49 | clojurebot | nil nil nil) |
| 21:49 | simard | hum.. |
| 22:04 | scottj | it would be funny if minikanren added "ero" instead of just "o" to function names |
| 22:04 | scottj | some of the names do still look spanish though |
| 22:44 | archaic | i've never used java before, I need to use an external jar file to |
| 22:44 | archaic | read .mat files, I have the jar -- and used 'lein localrepo install |
| 22:44 | archaic | jmatio-1.1.0.jar jmatio 1.1.0' so its in m2 and I can get it with |
| 22:44 | archaic | lein deps.. so I need to use com.jmatio.io.MatFileReader: (import |
| 22:44 | archaic | 'com.jmatio.io) fails.. do i need to rename jmatio com.jmatio? or |
| 22:44 | archaic | something entirely different? |
| 22:57 | technomancy | archaic: hard to say without seeing the jar. you need to restart the process after adding a jar though |
| 22:59 | duck1123 | If you want to use a class, you need to import that full classname |
| 23:00 | technomancy | oh right duh |
| 23:02 | archaic | something like (import 'com.jmatio.io.MatFileReader) where MatFileReader is a public class in package com.jmatio.io ? |
| 23:03 | duck1123 | archaic: you'll need to import every class you explicitly refer to |
| 23:05 | archaic | duck1123: the problem is i'm getting ClassNotFoundException |
| 23:06 | duck1123 | archaic: verify that that jar is in your lib/ directory, and you need to restart the process if you're changing up deps |
| 23:11 | archaic | ahh, that was really stupid was using- (import 'foo..) instead of (import foo..) |
| 23:11 | archaic | thanks for help |
| 23:11 | duck1123 | it's best to keep it in your ns form and use (:import foo) |
| 23:12 | eyeris | I've started a ngserver for vimclojure. How do I tell what the server's classpath is? |
| 23:12 | eyeris | I know what I set it to, but I need to verify that it's actually using that classpath |
| 23:13 | eyeris | A related question -- how can I tell what commands are available to my ng client? |
| 23:14 | duck1123 | ,(System/getProperty "java.class.path") |
| 23:14 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)> |
| 23:14 | duck1123 | didn't think that would work :) |
| 23:15 | archaic | hmm (import 'foo) actually does work - must be something else |
| 23:15 | duck1123 | when using (import ) the function, you quote the symbol. When using the ns directive, you don't |
| 23:16 | duck1123 | same with use, require, et al. |
| 23:17 | eyeris | OK, well I have /home/dvogel/yummm/clojure/yummm/src on my path. I am editing /home/dvogel/yummm/clojure/src/yummm/yummm.clj. It begins with the form (ns yummm (:gen-class)). If I make VimClojure eval that form via nailgun it says "Could not locate yummm__init.class or yummm.clj on classpath" |
| 23:17 | eyeris | I get the same behavior if I try (ns yummm.yummm (:gen-class)) |
| 23:18 | duck1123 | your src directory should be ./src/ if you're using lein |
| 23:19 | eyeris | Yes, the cwd of the ngserver is src/.. |
| 23:19 | duck1123 | ie, {projectroot}/src/yummm.clj |
| 23:19 | eyeris | duck1123: so src/yummm.clj is for the yummm ns? |
| 23:19 | duck1123 | also, it's rest to avoid namespaces with only a single part |
| 23:19 | duck1123 | s/rest/best/ |
| 23:20 | duck1123 | if your ns is yummm.yummm then it's ./src/yummm/yummm.clj |
| 23:20 | eyeris | Right |
| 23:20 | eyeris | That's not working |
| 23:21 | duck1123 | eyeris: so your project root is ~/yummm/clojure/ |
| 23:21 | eyeris | Yes |
| 23:22 | eyeris | No |
| 23:22 | eyeris | The project root, being where project.clj is, is ~/yummm/clojure/yummm/ |
| 23:22 | eyeris | ~/yummm/clojure/yummm/src/yummm/yummm.clj is my src file. |
| 23:22 | clojurebot | Ik begrijp |
| 23:23 | eyeris | Somehow if I move yummm.clj to src/, then (ns yummm.yummm) works |
| 23:24 | duck1123 | something sounds... off |
| 23:24 | eyeris | Yep |
| 23:24 | amalloy | duck1123: maybe it's the huge number of times you saw yummm all in one message :P |
| 23:26 | duck1123 | eyeris: does it work in a plain lein repl? I don't know much about VimClojure |
| 23:26 | amalloy | in fairness, though, i have a file with an equally silly path: ~/src/clojure/src/clojure/src/clj/clojure/core.clj |
| 23:26 | eyeris | duck1123: Yes, it does |
| 23:26 | technomancy | amalloy: malkovich malkovich malkovich |
| 23:26 | amalloy | hah |
| 23:31 | duck1123 | is there a limit to namespace lengths? I'm sure someone has been that evil |
| 23:44 | eyeris | I found it! |
| 23:44 | eyeris | lein nailgun no longer works |
| 23:44 | eyeris | and it was in the classpath before the jar from vimclojure |