#clojure logs

2011-10-23

00:09Raynescemerick: You should see the edits No Starch is giving me. I'm contemplating suicide.
00:10cemerickut-oh
00:10cemerickRaynes: so, not measured, sensible stuff that doesn't impact the thrust of the book?
00:10RaynesIt's mostly "you should talk more about this" and "maybe we could reword this".
00:10cemerickah
00:11cemerickO'Reilly has been very hands-off so far. We'll see what November brings.
00:11RaynesI mean, he isn't unreasonable with his edits. I didn't mean to come off like that.
00:11RaynesIt's just… so many...
00:12RaynesLike, 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:12RaynesIt's my first book and I'm not an English major.
00:13RaynesSo how things are presented really *does* need to addressed significantly.
00:13cemerickall content has that problem to some degree
00:14cemerickShow it to 10 people, you'll get 11 suggestions for how it might be clearer.
00:15RaynesYeah, 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:16symboleSeems 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:16RaynesYou can clear the buffer, but I can't remember the command. It should be in the SLIME menu.
00:18symboleM-x slime-repl-clear-output
00:18symboleC-c M-o
00:19symboleRaynes: Good stuff. Thanks.
00:19cemerickRaynes: did vim take?
00:19RaynesGod no.
00:20cemerickhah
00:20RaynesI just use cake repl from the command-line these days. Not purposely. I just stopped using slime at some point.
00:20RaynesI didn't even notice it until someone asked me.
00:22cemerickcopy/paste from your editor, then? 0.o
00:22cemerickThat sounds like how chouser works, so presumably it works.
00:22RaynesFor the most part, yes. But I can just run inferior lisp on cake.
00:22RaynesIf I need to eval from a buffer, I mean.
00:23cemerickHow is cake these days? It seems to have gone a bit quiet, though that may be bias on my part.
00:23RaynesSilent revolution.
00:23cemerickheh
00:24RaynesI do quite a bit of work on it for real work these days.
00:24RaynesWe mostly just don't talk much about it.
00:24cemerickI can appreciate that.
00:24zakwilsonI 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:25Rayneszakwilson: That's interesting. It shouldn't need a network connection for… non-networky things.
00:25cemerickThe whole build tool morass is a morass.
00:26zakwilsonRaynes: 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:26zakwilsonAnd rather than procede as if there were no updates, it failed to build the jar.
00:26RaynesThat makes sense. You're right that it shouldn't fail in that case though.
00:27RaynesDid you make an issue about it?
00:27RaynesIf not, could you?
00:27zakwilsonNo. I was a passenger in a car when it happened, and I didn't really think about it again until now.
00:27zakwilsonI will attempt to reproduce and post an issue about it.
00:28RaynesThanks.
00:41zakwilsonRaynes: couldn't reproduce.
00:42RaynesAwesome
00:43zakwilsonIt was a while ago. I'm just going to assume it was fixed unless I see it again.
00:44zakwilsonI 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:22ozatamanis there a good doc facility for clojure, similar to haskell's haddock, pythong's sphinx or ruby's rdocs?
01:24cemerickozataman: http://clojure.github.com/clojure/ or http://clojuredocs.org or http://clojureatlas.com (self-plug on the last)
01:24ozatamancemerick: thank you
01:25nappingare those documentation generators, or documentation?
01:30cemericknapping: documentation; the only documentation generator is autodoc
01:30nappingSo that's what it's called. Thanks
01:30amalloycemerick: marginalia?
01:31cemerickamalloy: good point :-(
01:31cemericknapping: see also marginalia as amalloy points out. Much less commonly-used, but very different.
01:31amalloymarginalia makes us frown?
01:31cemerickme forgetting it makes me frown :-(
01:32amalloyah
01:32amalloyi'm vaguely familiar with marg, but know nothing about autodoc
01:32cemerickIf I hadn't said "only", I wouldn't have felt bad about it.
01:32nappingbut this way amalloy pointed another out
01:33RaynesI use marginalia for everything. I even work on it occasionally.
01:33amalloyRaynes: you're a real american hero
01:33RaynesI know, man.
01:34nappingreminds me of this story http://journal.stuffwithstuff.com/2010/07/24/killing-primitive-loops-and-conditionals/
01:39duck1123I'd like marginalia more if it worked for me
01:43amalloynapping: that's an entertaining read
02:32zakwilsonUsing Rails after spending so much time in Clojure, I find myself not liking it much.
02:45RaynesGood.
02:45RaynesYou've assimilated.
02:46RaynesYou're now simplicity's slave.
06:58ziltiHow 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:13babilenHi 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:14babilenAnd 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:55etoschin 1.3, is there a way to define a a value as a primitive?
09:55etoschas in, defining (def n 10) to be an int?
11:16leafwhi 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:16leafwbut lein complains that it cannot find the class or the file
11:17leafwanyone using lein and records would like to comment?
11:17leafwwould be appreciated
11:20jlihuh, weird. does it work without the ":only MyRecord" bit?
11:20leafwwould 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:20leafwjli: I tried importing the whole namespace, to no avail
11:21Apage43leafw: you'll want to :import it it, not :use it
11:21leafwis there any known public project out there, that declares defrecord somewhere and uses them from other files?
11:21leafwApage43: thanks. Is this an undocumented feature?
11:22Apage43leafw: nah, defrecord actually creates a -class-
11:22leafwI understand defrecord ends up creating a class, so import makes sense. But I naively thought that importing the whole namespace would do that.
11:22llasramleafw: It's kind of wacky. I've actually been meaning to ask about it
11:23Apage43not sure about that. I don't really know how imports work vs the require/use space.
11:23leafwllasram: it would be ok if it was documented. Indeed the error just went away.
11:23clojurebothmm… sounds like your out of heap space
11:23llasramleafw: 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:24leafwit 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:24leafwllasram: I get it, thanks for the explanations.
11:24babilenleafw: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
11:24llasramleafw: But the name it creates in the defining namespace is private, so you can't resolve it via a namespace-prefixed symbol
11:25llasramleafw: Cool, glad could help
11:26llasramThe last part (ns name is private) is the part I don't quite get. I was pretty surprised by it
11:26leafwwhat a pity that defrecord ends up being special.
11:26leafwllasram: I will keep it in mind case it bites later on.
11:26leafwthanks
11:27leafwwhile at it: can lein be setup to spit stack traces without anything not in my own code?
11:27leafwthat is, the part of the stack traces that are relevant.
11:31ozatamanduck1123: 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:02etoschI'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:03etosch*port
12:03iris1Dear 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:03iris1maybe a ref is correct, but it could be an agent??
12:03lazybotiris1: Uh, no. Why would you even ask?
12:04iris1(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:06babileniris1: It is a bot (disregard it)
12:13llasramiris1: 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:14llasramiris1: As long as you expose it to the REPL, you can deref it to get at a consistent snapshot of that state
12:14llasrams,need deform,need to deform,
12:19iris1llasram: 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:19iris1inaccessible 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:24llasramiris1: 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:25TimMcetosch: You'll probably need to be more specific.
12:27etoschTimMC: I just figured out the issue; I had the wrong thing in my project.clj
12:27etoschThanks, though!
12:29babilenquit
13:05lynaghkDoes anyone know the state of atom validators in ClojureScript? In particular, how to handle the exceptions they throw?
13:06lynaghkAs 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:07iris1llasram: 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:08lynaghkThe 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:41leafwsomething 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:42mindbender1please I have been with struggling for days with error related to slime when connecting to a clojure project
13:42leafwis there any IDE that a clojure power user would recommend as "fully working, no irks" ?
13:44leafwI would pay good money for an IDE for clojure that handled all the non-obvious plumbing necessary that lein only half-heartedly handles.
13:44k9quaintif only everything supported lisp natively :(
13:45raekleafw: to use a record type from another namespace, you first need to require it, then import the record class
13:46mindbender1slime 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:47raekbut 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:47leafwraek: ok, I'll try that. Is it documented somewhere?
13:47leafwraek: I am using 1.3, and it doesn't work anyway.
13:47leafwso first I require, then I import.
13:48raekI think that if the record type is called Foo, the constructor function is called ->Foo or something
13:48raekleafw: does the namespace contain any dashes in the name?
13:48leafwnope
13:49raekyou need to do (ns ... (:require foo.bar-baz) (:import foo.bar_baz.TheRecordType))
13:49leafwraek: your require + import, in this order, did the trick. Thanks! Now if only this was documented.
13:49raekbut these details don't seem to be documented on the official site...
13:50leafwthe clojuredocs.org quotes defrecord as: "Alpha - subject to change"
13:50raekit 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:50mindbender1noboby here on emacs-clojure?
13:51raekwhen a (defrecord ...) form is evaled, a new class is created dynamically
13:51raekyou have to do the import after that, since before the namespace is loaded, the class didn't exist
13:51leafwraek: 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:52raekleafw: yeah, that's one of the weird things about this
13:52leafwclojure 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:52raekleafw: 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:53leafwwhatever, at least I am glad you knew the solution. I hope it goes online somewhere.
13:53raekleafw: yeah, they have been there since 1.2
13:53leafwraek: one could do that, but then records cannot be used outside that namespace without reflection warnings
13:54raekif you interpret "alpha" as "I will change this whenever I feel like, because noone is using it yet", then records are not alpha
13:54raekleafw: ah, you need them for jvm interop?
13:54leafwraek: I agree. The doc is misleading.
13:54raekor why did you get the reflection warnings?
13:55leafwraek: yes, interop, but also just for plain separation of data vs GUIs.
13:55raek(:foo x) shouldn't give any reflection warning
13:55raekbut I guess (.foo x) will
13:55leafwwell: iterating a list of records gives a warning
13:56leafwso (:foo x) is the same as (.foo x), but without warnings? Aren't both, in the end, just calling the field anyway?
13:56raek(:foo x) is more abstract than (.foo x)
13:57leafwtrue, it uses the record as a map
13:57raek(: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:58leafwI 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:58leafwwell at least I am glad there is a solution. Thanks a lot raek.
13:59raekI get the impression that certain details are a bit crude since they are "not done yet"
14:00leafwthe most promising language in the world. We can wait.
14:00raek:-)
14:02mindbender1noboby here on emacs-clojure?
14:03mefestomindbender1: is that the same as emacs + clojure-mode or is that something else?
14:04mindbender1yes emacs clojure-jack-in problems
14:04raekmindbender1: I haven't seen that problem myself, but it looks like the problem happens in emacs somewhere
14:05mindbender1I have been looking around for a solution
14:05raekmindbender1: could it be another conflicting slime version installed?
14:05mefestomindbender1: are you using marmalade repos for your slime?
14:05mindbender1probably cos I have more than 1 slime version
14:05raekmindbender1: if you use clojure-jack-in, you don't need to have slime installed at all
14:05raekmindbender1: so you could try to remove everything that looks slime-related
14:06mefestomindbender1: i was having problems also (not the same as yours though) which were resolved when i switched to the version in marmalade
14:06raekwhen you call clojure-jack-in, it actually evals a slime.el file that is bundled with the swank-clojure lein plugin
14:07mindbender1raek: but there are times when you need slime for other purposes
14:07mindbender1but if there is a way to temporarily disable slime?
14:08mindbender1so I don't have to download it again when I need it
14:08raeksure. it would be nice if slime version compatibility would have worked better
14:09mindbender1mefesto: did you have to remove the other version you were using before you switched?
14:09raekmindbender1: 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:10mefestomindbender1: yea
14:10mindbender1raek: I have one version triggered in .emacs
14:11mindbender1mefesto: how did you remove it? did you just delete folder or through some other process?
14:11mefestomindbender1: yeah removed any setup i had for it in my .emacs file and removed it from ~/.emacs.d/elpa or whereever it was
14:12raekmindbender1: 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:12mindbender1raek: so I believe
14:13mindbender1but my experience is proving otherwise especially without adequate documentation
14:13raekbut the error you get seems to debunk that theory
14:13mindbender1exactly
14:14raekyes. this is a mess.
14:14leafwraek: I've put up an example in clojuredocs.org: http://clojuredocs.org/clojure_core/clojure.core/defrecord#example_753
14:14mindbender1so frustrating on occasion I had even resorted to praying:)
14:16mefestomindbender1: is it known that the version of slime in marmalade will *not* work with your non-clojure use cases?
14:16raekmindbender1: maybe you can set up a different .emacs file for clojure dev
14:17mindbender1raek: how do I manage that?
14:17mefestomindbender1: 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:17mefestoor what raek said
14:17mindbender1mefesto: ok I'll try that first
14:18raekmindbender1: I don't know :-) I just assumed you could do that somehow...
14:19raekseparate environments seems to be a standard solution to dependency hell kind of problem
14:19raeks
14:19mindbender1ok
14:21raekor 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:22mindbender1ok
14:23mefestofor 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:26mindbender1raek: do you know where the swank files clojure-jack-in uses are located?
14:27raekmindbender1: the slime files are inside the swank-clojure jar file
14:28mindbender1so it uses nothing outside of those related to swank and slime?
14:29raekall you need in emacs when you use clojure-jack-in is clojure-mode.el
14:29mindbender1ok
14:29raekthe slime stuff is bundled with swank
14:29mindbender1ok
14:30raekand swank is handled by leiningen outside emacs
14:30mindbender1so clojure-jack-in just calls leiningen to do its work
14:30raekyes
14:30mindbender1ok
14:31mefestomindbender1: what version of the swank-clojure plugin do you have installed?
14:31raekwell, it also gets some .el file from leiningen and load them
14:32mindbender1mefesto: that's 1.3.3
14:32mindbender1is that ok?
14:32mefestoyeah that's the latest afaik
14:32mindbender1ok
14:33mindbender1but I see 1.4.0 -SNAPSHOTS lying around somewhere on my .m2 repos
14:34raekmindbender1: one thing that's important is that you only have one swank-clojure version in the ~/.lein/plugins/ directory
14:35mindbender1raek: yes I do and that's 1.3.3
14:35robermannI 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:36raekmindbender1: any success with disabling "the other slime" in your .emacs?
14:38robermannit looks for a slime.el under ".emacs.d\elpa\clojure-mode-1.11.1\, but it is not there
14:38mindbender1raek: 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:39mindbender1and this error happens when i clojure-jack-in
14:43robermannmindbender1: 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:45raekmindbender1: 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:45mindbender1robermann: I on debian linux but I'll check it out to get some idea
14:46mindbender1raek: emacs needs more docs on that
14:47raekmindbender1: IIRC, until version 24 emacs didn't have any official package system
14:47robermannif it can help, my file system sniffing tells me that clojure-jack-in is not using an embedded slime.el version
14:47raekall these things are just conventions, afaik
14:48raekclojure-jack-in uses the bundled version for me
14:48raekI don't have any slime version installed what so ever
14:49mindbender1robermann: I suspect same on my system
14:51robermannraek, where is your slime.el version? inside the clojure-mode directory?
14:51raekhrm, wait. there seems to be one there...
14:52simardHow 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:52raek(in the elpa/ dir)
14:52raeksimard: repeatedly
14:52mindbender1raek: really?
14:52simardraek: thank you
14:55robermannraek, so you have something as .emacs.d\elpa\slime-20100404.1
14:56raekrobermann: ye
14:56raeks
15:04mindbender1seems there's is success here
15:05mindbender1raek: what version of slime is your repl showing?
15:17robermanni have to correct myself: clojure-jack-in is using the slime version inside swank-clojure-1.4.0-SNAPSHOT.jar\swank\payload
15:18robermannif check the *swank* buffer, it says: ;;; Bootstrapping bundled version of SLIME; please wait..
15:23simardwhat is the function that returns the combination of N functions ? ie.: (combine F G H) => (fn [x] (F (G (H x))))
15:23amalloycomp
15:23simardmeuh
15:24simardmeh*
16:06simardis there an inverse to function (char) ?
16:07simardint..
16:26ziltiI 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:28ziltiAs in it has to be done over 100 times a second
16:28amalloyvectors 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:29ziltiamalloy: In the end it's not particularly important for my use case if it's a vector or a list
16:31amalloywell. lists and seqs aren't the same thing, but close enough. just use map
16:32ziltiSo I'd do a (update-in mp [:key] map #(update-in % [:otherkey] newvalue))
16:33amalloywrong argument order to map, but right general idea
16:34amalloy(update-in m [k] (fn [v] (map #(assoc % j x) v)))
16:54RaynesClojure-contrib is dead, long live clojure-contrib.
17:06TimMc$findfn complement = not= ; :-P
17:06lazybot[]
17:07TimMcor s/complement/not/ I suppose
17:07gfredericksTimMc: if functions were values I guess you'd get comp
17:07TimMcyeah
17:08gfrederickswould haskell do that?
17:08gfredericksI don't even know if haskell has any kind of comparison for functions...
17:09Raynes$he head == head
17:09RaynesDamn it.
17:09gfredericksthat bot so lazy
17:10Raynes$kill
17:10lazybotKILL IT WITH FIRE!
17:10gfredericks(dec lazybot)
17:10gfredericksthere needs to be a backup karma system so we can penalize lazybot when the karma doesn't work.
17:10Raynes$tryhaskell head == head
17:10lazybot⟹ 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:10RaynesGoody. At least that works.
17:10TimMc,(= inc inc)
17:10clojurebottrue
17:11gfredericks,(= (comp inc inc) (comp inc inc))
17:11clojurebotfalse
17:11Raynesamalloy: 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:12gfredericksRaynes: what about the broke karma?
17:12amalloycall it 11.04, just in case it's full of bugs
17:12gfredericks~rimshot
17:12clojurebotBadum, *ching*
17:12Raynesgfredericks: It was probably already fixed at some point.
17:13Raynesamalloy: The current (pointless) version number is 0.6.2. Why not hop up to 0.7.0-alpha1?
17:14amalloyup to you. i'm not some kind of version-number connoisseur, cracks at ubuntu notwithstanding
17:30amalloyhuh, looks like ints will go back to boxing as Integers
17:33TimMcamalloy: So int will return Integer?
17:34TimMcMailing list stuff?
17:34amalloyTimMc: the function int? no, it will still return int :P. but when that gets boxed, you'll get an Integer
17:34TimMcgot it
17:34amalloyand yeah, rich just posted about some commits he made
17:35duck1123so is that going to mean that all the math stuff is going to have to change?
17:43Raynes&(clojure-version)
17:43lazybot⇒ "1.3.0"
17:43Raynesamalloy: ^ Success.
17:48duck1123(inc lazybot)
17:48lazybot⟹ -1
17:49amalloypoor guy
17:51llasramduck1123: 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:53llasramHuh. I wonder why rhickey indents his Java with tabs
17:53duck1123eclipse default?
17:54amalloyllasram: investigating rhickey's java style can only lead to sadness
17:55duck1123I have emacs set to always show tabs. I have a little OCD twitch whenever I open any java file.
17:55llasramamalloy: heh. I guess that's why he wrote Clojure?
17:56llasramduck1123: 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:58amalloyfor 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:58duck1123it'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:40eyerisIn 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:40eyerisWhat am I missing here?
18:46eyerisI can also successfully eval that ns form inside a repl started by vimclojure
18:52amalloyeyeris: i think the gen-class is irrelevant. you're likely to have the same problem without it?
18:54eyerisThat's true. I just tested to confirm.
18:55amalloyin 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:56eyerisIt is src/yummm/yummm.clj, so I guess I will look into ng
18:59eyeriseek laptop battery is dying
18:59eyeristhanks for the direction amalloy
18:59eyerisbbl
19:14simard(clojure.string/split-lines (apply str (map char '(49 50 51 52 13 53 54 50 51 49 13)))) => ["1234\r56231\r"]
19:14simardwhat's wrong with this ? shouldn't it separate the strings ?
19:14amalloy\r isn't \n
19:16simardhum.. correct. it's funny that pressing enter gives \r and not \n
19:16simard(I'm using lwjgl)
19:17simardor it's probably just normal and I'm naively expecting "enter" to map to a unix line terminating character
19:18amalloy$google lwjgl
19:18lazybot[lwjgl.org - Home of the Lightweight Java Game Library] http://lwjgl.org/
19:18amalloy\r is nuts. \n would be normal in most circumstances, and \r\n acceptable in others
19:19TimMcMac used to be \r
19:20TimMciirc
19:20amalloyTimMc: i think that's true, but for years
19:24TimMcMac is \n now, right?
19:25gfredericksI'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:26gfredericksthe 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:27gfredericksif the java interface exists in two different jars (I'm deploying an uberjar...), could that cause it to exist twice in some sense?
19:28gfredericksI don't know how the jvm handles duplicate classes...
19:29gfredericksshallow googling suggests that shouldn't be the explanation
19:32amalloygfredericks: do you control the java code?
19:33gfredericksamalloy: 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:33amalloyif 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:34amalloygfredericks: probably doesn't even have to be the same java code that's using it; anything in the same classloader would suffice
19:34gfredericksamalloy: okay, I suppose I will try that next
19:37amalloyat 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:37gfredericksditching the uberjar doesn't seem to have changed anything
19:38gfrederickswell I did still copy the...hrm
19:40gfredericksoh interesting. I removed the jar containing the extra copy of the interface and now the classloader complains the interface doesn't exist.
19:40gfredericksguess I'll investigate if the compile-jar and the runtime-jar mismatch
19:43gfredericksand they're all identical :/
19:44gfredericksI bet tomcat does some crazy witchcraft with classes
20:06jrabbithttps://gist.github.com/1308102 what data type is that :|
20:08dnolenjrabbit: ?
20:08gfredericksit's a list with a map with ...
20:09jrabbitoh its a map ok I wasn't really sure how to muck with it
20:09gfredericksbut as dnolen pointed out, the more appropriate response is '?'
20:10dnolen,(first '({:foo 'bar}))
20:10amalloyare you sure it's badly made? it seems kinda reasonable, given that i don't know much about css
20:10dnolen&(first '({:foo 'bar}))
20:10lazybot⇒ {:foo (quote bar)}
20:10dnolen&((first '({:foo 'bar})) :foo)
20:10lazybot⇒ (quote bar)
20:11jrabbitamalloy: well its not really documented :P
20:11dnolenjrabbit: which Clojure project is that?
20:11jrabbithttps://github.com/simonhicks/css-parser
20:11jrabbitSingle commit -> shitty project in my book :p
20:12dnolenjrabbit: that is awesome, someone needs to port that to ClojureScript
20:12amalloyi 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:12jrabbithehe
20:13jrabbitdnolen: I've been looking at css parsers and thats the best one
20:13clojurebot{:foo (quote bar)}
20:13jrabbitunless theres a good java one
20:14dnolenjrabbit: ah uses fnparse, wonder when that'll see an update.
20:15daakuanyone know how to have moustache locals passed thru to a handler function? this might explain the question better: https://gist.github.com/ce36c961df4587749fa3
20:15jrabbitdnolen: I'm really sad to see clojurescript so young :\
20:15dnolenjrabbit: ?
20:15jrabbitdnolen: I really want to play with clojure on my hp touchpad
20:15jrabbitdnolen: its kind of hard to use :p
20:16dnolenjrabbit: yes it needs more tool support, I take it you don't use Emacs?
20:17jrabbitNo :\ Textmate and Clooj
20:18dnolenjrabbit: Clooj is pretty good, wouldn't take much work to get Clooj to work with ClojureScript.
20:18jrabbitdnolen: 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:20jrabbitdnolen: like see what lein-ring does for a nice experince
20:40jrabbitCan toy search by values?
20:40jrabbit*you
20:40jrabbitinside a map?
20:40gfredericksjrabbit: you want all the keys that map to a value?
20:41gfredericks&(let [m {:foo 12 :bar 14 :baz 14}] (filter #(= 14 (m %)) (keys m)))
20:41lazybot⇒ (:bar :baz)
20:42jrabbitoh you can call a hashmap?
20:42gfredericksyep
20:43gfredericksyou pass it a key and it gives you a value: ##({:foo 'bar} :foo)
20:43lazybot⇒ bar
20:43gfredericksanother thing you might find useful: ##(let [m {:foo 12 :bar 14 :baz 14}] (group-by m (keys m)))
20:43lazybot⇒ {12 [:foo], 14 [:bar :baz]}
20:43duck1123it's handy in situations, but more often you'll see it written the other way
20:43gfredericksI suppose that effectively inverts the map
20:43jrabbitnice.
20:44gfredericksduck1123: it's particularly handy in that group-by I just wrote :)
20:44amalloygfredericks: (filter (comp #{14} m) (keys m)) is more fun
20:45amalloythough (group-by m (keys m)) is pretty slick
20:45gfredericksamalloy: (apply filter ((juxt (partial comp #{14}) keys) m))
20:45amalloytouche
20:45jrabbitconfusing.
20:46duck1123no solution is valid unless it uses juxt
20:46gfredericksjrabbit: we're not suggesting anything serious
20:46amalloyclojurebot: make a note of it
20:46clojurebotmake 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:46jrabbitis there any way to run a command in shell simply?
20:46amalloygfredericks: well, i am. (comp #{x} f) is a great idiom
20:46jrabbitor a generic executable?
20:47duck1123lein repl is pretty quick
20:47gfredericksamalloy: but it sounds so violent
20:47jrabbitduck1123: huh?
20:47amalloyeh?
20:47amalloyjrabbit: clojure.java.shell/sh
20:47duck1123jrabbit: nvm, I misread your question
20:47gfrederickscomp is like 'chomp', and #{} has lots of sharp pointy teeth
20:48jrabbitalso shell-out apperantly
20:48duck1123There's some code in pallet that I've been using for one of my projects to shell out
20:48gfredericksamalloy: it's the most reasonably objection I could come up with
20:48amalloygfredericks: it's function-composing two non-functions! best thing ever! but i do love the violent imagery
20:49amalloyfortunately my functions wear (armor)
20:49simardI'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:49gfredericksamalloy: I guess that is kind of fun. Reminds me of the time I juxt'd a bunch of maps together
20:49duck1123My midje tests carry swords. (foo) =>
20:51amalloysimard: it doesn't work because $ only matches at end of string? so replace $ with (?!\n)
20:53simardwell, that works, thank you again, amalloy
20:54gfredericksI'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:54gfredericksnevermind I just remembered I'm doing this in ruby not clojure
20:55gfrederickswhat a weird thing to forget...
20:59duck1123gfredericks: I have that happen to me all the time. I've caught myself typing "lein spec" before
21:00gfredericksoh I bet that didn't make lein very happy.
21:08amalloyall 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:09technomancyamalloy: I was thinking when it detects you've checked a jar file into git
21:10amalloydon't make me wear my fingers down to nubs typing (inc technomancy) over and over
21:11technomancynot my idea, sorry
21:11technomancyI think maybe I stole it from ieure?
21:49simard,(map println (range 3))
21:49clojurebot(0
21:49clojurebot1
21:49clojurebot2
21:49clojurebotnil nil nil)
21:49simardhum..
22:04scottjit would be funny if minikanren added "ero" instead of just "o" to function names
22:04scottjsome of the names do still look spanish though
22:44archaici've never used java before, I need to use an external jar file to
22:44archaic read .mat files, I have the jar -- and used 'lein localrepo install
22:44archaic jmatio-1.1.0.jar jmatio 1.1.0' so its in m2 and I can get it with
22:44archaic lein deps.. so I need to use com.jmatio.io.MatFileReader: (import
22:44archaic 'com.jmatio.io) fails.. do i need to rename jmatio com.jmatio? or
22:44archaic something entirely different?
22:57technomancyarchaic: hard to say without seeing the jar. you need to restart the process after adding a jar though
22:59duck1123If you want to use a class, you need to import that full classname
23:00technomancyoh right duh
23:02archaicsomething like (import 'com.jmatio.io.MatFileReader) where MatFileReader is a public class in package com.jmatio.io ?
23:03duck1123archaic: you'll need to import every class you explicitly refer to
23:05archaicduck1123: the problem is i'm getting ClassNotFoundException
23:06duck1123archaic: verify that that jar is in your lib/ directory, and you need to restart the process if you're changing up deps
23:11archaicahh, that was really stupid was using- (import 'foo..) instead of (import foo..)
23:11archaicthanks for help
23:11duck1123it's best to keep it in your ns form and use (:import foo)
23:12eyerisI've started a ngserver for vimclojure. How do I tell what the server's classpath is?
23:12eyerisI know what I set it to, but I need to verify that it's actually using that classpath
23:13eyerisA related question -- how can I tell what commands are available to my ng client?
23:14duck1123,(System/getProperty "java.class.path")
23:14clojurebot#<AccessControlException java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)>
23:14duck1123didn't think that would work :)
23:15archaichmm (import 'foo) actually does work - must be something else
23:15duck1123when using (import ) the function, you quote the symbol. When using the ns directive, you don't
23:16duck1123same with use, require, et al.
23:17eyerisOK, 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:17eyerisI get the same behavior if I try (ns yummm.yummm (:gen-class))
23:18duck1123your src directory should be ./src/ if you're using lein
23:19eyerisYes, the cwd of the ngserver is src/..
23:19duck1123ie, {projectroot}/src/yummm.clj
23:19eyerisduck1123: so src/yummm.clj is for the yummm ns?
23:19duck1123also, it's rest to avoid namespaces with only a single part
23:19duck1123s/rest/best/
23:20duck1123if your ns is yummm.yummm then it's ./src/yummm/yummm.clj
23:20eyerisRight
23:20eyerisThat's not working
23:21duck1123eyeris: so your project root is ~/yummm/clojure/
23:21eyerisYes
23:22eyerisNo
23:22eyerisThe project root, being where project.clj is, is ~/yummm/clojure/yummm/
23:22eyeris~/yummm/clojure/yummm/src/yummm/yummm.clj is my src file.
23:22clojurebotIk begrijp
23:23eyerisSomehow if I move yummm.clj to src/, then (ns yummm.yummm) works
23:24duck1123something sounds... off
23:24eyerisYep
23:24amalloyduck1123: maybe it's the huge number of times you saw yummm all in one message :P
23:26duck1123eyeris: does it work in a plain lein repl? I don't know much about VimClojure
23:26amalloyin fairness, though, i have a file with an equally silly path: ~/src/clojure/src/clojure/src/clj/clojure/core.clj
23:26eyerisduck1123: Yes, it does
23:26technomancyamalloy: malkovich malkovich malkovich
23:26amalloyhah
23:31duck1123is there a limit to namespace lengths? I'm sure someone has been that evil
23:44eyerisI found it!
23:44eyerislein nailgun no longer works
23:44eyerisand it was in the classpath before the jar from vimclojure