#clojure logs

2011-05-27

00:12JulioBarrosI'm trying to :use the webmine jar (not just infer now) but I get the message -- java.lang.IllegalAccessError: silent does not exist (message.clj:1)
00:15tomojdid you build a webmine jar manually or something?
00:16tomojor did you just add webmine to your lein/cake deps
00:16tomoj/maven/whatever
00:16JulioBarrosBoth ways.
00:17tomojdo you have "silent" in your message.clj?
00:17JulioBarros:) I don't know what that means ... let me check.
00:18JulioBarrosits essentially a blank lein project with a couple of dependencies added so i can play with the repl
00:18tomojwell where is message.clj?
00:18JulioBarrosI don't think I have a message.clj
00:18tomojI don't see one in webmine
00:19tomojyou're using lein?
00:19tomojoh, yes
00:19JulioBarrosyes. there were some other deps.. let me remove them.
00:19tomojwell, if you leave them you can find which has message.clj
00:20tomojls lib/*.jar | xargs -n 1 jar tf | grep message.clj
00:20tomojseems to work
00:22amalloytomoj: neat, i didn't know about the -n option
00:23amalloyi'd have written it as $ find lib -name '*.jar' -exec jar tf '{}' \; | grep message.clj
00:23JulioBarroshmm didn't find anything. But removed the lib dir, did a lein deps and seems to be happy now. Thanks. Did not understand the error message
00:24tomojI never learned find
00:24amalloyJulioBarros: that's often the case with Errors. Exceptions usually mean "you should have been ready for this or could have prevented it", while errors are "holy cow wut is going on here"
00:24amalloytomoj: a nice pair to xargs. i learned xargs because it was useful for find
00:25amalloybut the syntax is arcane and verbose
00:25amalloyfind . -name '*.svn' -prune -or -type f -print0 | xargs -0 grep 'testing'
00:26amalloyavoids including files under .svn in your grep results
00:27amalloy(and also works for filenames that have whitespace in them, thanks to -print0 and -0)
07:21fliebelDoes anyone know if its possible to send a CA via telefax?
07:23ejacksonwhat is this telefax of which you speak ?
07:25fliebelejackson: It's like snailmail, only faster. ;)
07:26fliebelBut, I just noticed my CA did came through. After over a month, I'm suddenly listed on the contributing page!
07:27fliebelmanutter: It's just the full name, like a piano is actually called a piano-forte.
07:28manutterAh, I suspected. Around here the full name is "facsimile"
07:28manutterwhich nobody *ever* uses
07:30manutterback to debugging php (sigh)
07:30fliebel$mail dnolen wee, I showed up on the CA page. Patch coming soon.
07:30sexpbotMessage saved.
07:34fliebel$mail dnolen You said you had a branch with a project.clj. can haz?
07:34sexpbotMessage saved.
07:42jochenhi, I have a question about jline - it does not work on my mac in console as it always scrambles edits of history values. Any idea how to fix this?
07:45fliebeljochen: Install readline?
07:46fliebelI've had the same problem in 3 places now, installing readline solves them all.
07:46fliebel(3 places, Clojure, Python, Ruby)
07:47jochensounds good. I'll give it a try...
07:49fliebelHm, okay, let me see... a protocol. Does I define the 'this' argument? What's up with varargs?
07:52tsdhIs it required (or good practice) to line up namespaces with files and directories, or is that arbitrary?
07:53clgvfliebel: protocols do not support varargs - I tried unknowingly and failed with strange errors ;)
07:54fliebelclgv: That's what I thought, but since varvargs are implemented as an array in java land anyway, I thought maybe the implementations could do it.
07:54clgvfliebel: I didnt find the place were I could put a ticket for it, since I thought that error message had to be fixed to be more explicit
07:55manuttertsdh: I believe the reader parses the namespace notation to get the file path for loading the file (in use/require), so I'd say yes, it's mandatory
07:55clgvthe & of the varargs declaration was interpreted as a parameter symbol '&
07:55tsdhmanutter: Ok, thanks.
07:58fliebelclgv: I know, but if you define [x y] and implement [x & y] the java is going to look like [x OBject...] I think.
07:59clgvfliebel: you can try. make a blog post in case you succeed ;)
08:00fliebelclgv: will do :)
08:00tsdhShould namespaces better use _ or - for compound words? It seems that both work...
08:01fliebelfail
08:01fliebeltsdh: -, but _ in filenames
08:01manuttertsdh: use -- doh, fleibel is too quick
08:01manutterwhat he said.
08:01tsdhAllright, thanks.
08:02fliebelmanutter: Practice your ninja skills, even I am to slow most of the time.
08:03manutterThe dash is good practice in clojure, but Java requires underscores, which is reflected in the file names. So clojure does the dash-to-underscore mapping automatically in namespaces and filenames
08:03manutterfliebel: :)
08:04fliebelmanutter: Hehe, the StackOverflow rule also applies here. Deep answers beat quick ones.
08:07manutterWell, there's a place for both
08:07fliebel:)
08:08fliebelAnyone knows how to get a quick repl in a clojure project using maven?
08:10fliebelhm, seems `rlwrap mvn clojure:repl` works, but... hm, I don't know.
08:12clgvrlwrap is great :D
08:15crystalblue66www.xxxlivecam.info
08:19jochenyea, just dropped jline and used readline/rlwrap and everything is working greate. thanks!
08:32manutterwow, installing readline just made jark repl work for me, cool
08:32manutterIt worked before, but no cursor key functions
08:32fliebelmanutter: I told you, it makes everything work :)
08:32manutterNow if it would just fix this php bug, which unfortunately has nothing whatsoever to do with command histories...
08:38fliebel$mail dnolen Done! http://dev.clojure.org/jira/browse/LOGIC-2
08:38sexpbotMessage saved.
08:39fliebelmanutter: I bet it's dynamic scope or weak typing :)
08:39manutternot a bad bet, under the best of circumstances :)
08:51_fogus_fliebel: You kinda just did. :-)
08:51fliebel_fogus_: meh, that's contrib, right?
08:52fliebel_fogus_: Now that you're here. What's up with your Forht? You said something about JVM bytecode.
08:52_fogus_fliebel: the core.logic stuff has great potential for eventual inclusion IMHO
08:52_fogus_(don't quote me)
08:52manutter,(quote _fogus_)
08:52clojurebot_fogus_
08:52clgvlol!
08:52manutterHah, couldn't resist
08:53clgv&(don't quote me)
08:53sexpbotjava.lang.Exception: Unable to resolve symbol: don in this context
08:53clgv;(
08:54manutterSo "Forht" -- typo for "Forth"?
08:54fliebel_fogus_: Really? For the dispatch and type stuff? Because logic programming is not something everyone in here is using, it seems.
08:54fliebelmanutter: yea, I do typos ;)
08:54manutterjust wondering
08:54manutteron a commodore 64 no less
08:55`fogusfliebel: That is a long way off, so it's hard to say exactly how it might fit
08:55`fogusbut that is a good bet
08:56fliebel`fogus: Okay, cool :) Right now I'm giving IAtom a try. If I remember correctly, rhickey was at least not against the idea.
08:56`fogusfliebel: Hmmm, I'm not familiar
08:57fliebel`fogus: Basically Atoms does not have an interface, and I found a valid usecase for wanting one.
08:57`fogusOh. Do you have a repo?
08:58fliebel`fogus: repo? why? clojure doesn;t do pull request, right?
08:58`fogusOh, I just meant if you had a branch to look at I would like to see. :-)
08:59fliebel`fogus: nothing yet. But uhm, did you read my Forth question?
08:59`fogusfliebel: I'm sorry I missed it I think
09:00fliebel`fogus: You tweeted about JVM bytecode for your Forth. What was that about, I could only find Ruby.
09:00`fogusOh right!
09:01`fogusI was just playing around. Gen'ing JVM bytecode requires you juggle the stack, so I made an awkward parallel to Forth. I guess the joke was not very funny
09:03fliebel`fogus: Hm, I thought you where writing a Forth in Java :(
09:03`fogusnah
09:04manuttertoo bad, I used to love Forth
09:04manutterMy copy of the Forth Encyclopedia got destroyed by a leaky basement wall :(
09:04`fogusI keep playing with the idea of a froth in Clojure, but that is around #1000000 on my priority list
09:05`foguss/froth/forth/
09:05sexpbot<> I keep playing with the idea of a forth in Clojure, but that is around #1000000 on my priority list
09:05manutterwow, you've discovered how to anonymize yourself to sexp!
09:06manutterForth in clojure, now that would be fun
09:09fliebelWhen I asked the Forht people, they said that wasn't fun at all and assembly was the only fun way to do it :)
09:11clgvhumm forth seems to be pretty hard to be spelled correctly, as one can observe here ;)
09:11manutterWell, yeah, they WOULD say that, they're Forth people
09:11manutter:)
09:12tufflaxHm, what is wrong here? http://pastebin.com/AnuuKxGd
09:12fliebelclgv: meh, it's just a few things I keep writing wrong.
09:13clgvfliebeL: just noticing, not complaining at all ;)
09:13fliebelclgv: it;s true. ;)
09:16tufflaxeww
09:16PiskettiJava pays the rent
09:16PiskettiAs sad as it may sound
09:17jolyIt's a really annoying tenant though
09:23abedra`fogus, Fjorth
09:24`foguscljoy
09:24raektufflax: have you compiled the namespace?
09:24fliebelabedra: I love that!
09:25fliebelPostClojure ;)
09:25fliebelWe had Lisp machines, but do we have Lisp printers as well?
09:25jweissanyone here use clj-http? looking for a way to get the response body for error statuses like 500. the client just throws Exception
09:31tufflaxraek yes i think so, anyway it worked when i restarted the repl, don't know exactly what happened :p
09:33tsdhIf (class x) returns foo.bar.Baz, how is it possible that (Class/forName "foo.bar.Baz") throws a ClassNotFoundException?
09:38raektufflax: gen-class doesn't work well with interactive development in the repl. once the class has been compiled, it can never be changed (due to how the JVM works)
09:39raektufflax: gen-class is designed to be used when you need an interface to your code that a Java program can hook into
09:39tufflaxraek oh, yeah im noticing more problems now
09:40raektufflax: I would recommend using proxy if you can. it is completely dynamic
09:40raekit's built for the reverese situation: when you want clojure code to hook into java code
09:40tufflaxok i was about to ask that. but you kind of saw what i was doing, do you think proxy is the right move?
09:41tufflaxoh, ok then
09:41tufflaxthat sounds right
09:41tufflaxthank you
09:42raekI recall that there are certain things proxy cannot do, but in those cases you can always make a thin wrapper class in java that is more proxy-friendly
09:42tufflaxok
09:43fliebelI'm sure I wrote down the IAtom problem down somewhere before, but I can't find it. Can someone who understand Jira make sure I don't create a duplicate issue?
09:43fliebelThis thing doesn't work for me: http://dev.clojure.org/jira/secure/IssueNavigator.jspa
09:44manutterjweiss: I think you can use core/request instead of client/request to get the basic functionality without the built-in error-status->exception stuff.
09:44manutteryou can add in the appropriate client/wrap-X functions if you need them for like redirects and stuff
09:45raektufflax: but yes, I recommend proxy over gen-class in general, unless you are designing a java api to your project
09:45manuttershould be able to anyway, never tried it myself.
09:45jweissmanutter: actually it looks like in the latest ver you can put the entry :throw-exceptions false in the req map
09:45jweisshaven't tried yet, but i see it in the source.
09:45manuttersounds promising
09:46tufflaxraek: thanks again, this made my life much easier :)
09:47fliebel~logs
09:47clojurebotlogs is http://clojure-log.n01se.net/
09:51raektufflax: just remembered the limitation: proxy can't access protected members of its superclass
09:58fliebelIAtom issue created: http://dev.clojure.org/jira/browse/CLJ-803
10:08tsdhArgh, how do I call invoke(Object, Object...) on a java.lang.reflect.Method object?
10:08mefestotsdh: i think you need to pass your params as a java array
10:08tsdhThe signature of the method is foo(String, int, int).
10:09tsdhI've tried (.invoke m receiver "foo" 1 1) ==> No matching method found.
10:09mefesto(.invoke method target (into-array [p1 p2]))
10:10tsdh(.invoke m receiver (into-array Object ["foo" 1 1])) ==> argument type mismatch
10:16tsdhOh, it's a static method. So in fact I should call (.invoke m nil (into-array Object ["foo" 1 1])), but that doesn't change anything.
10:17tsdhIn Java, the call is graphCreateMethod.invoke(null, "foo", 1, 1) which works fine...
10:20mefestohmmm it seems to work for me using String.indexOf
10:20mefestoi'll gist it
10:22tsdhHm, I'm even not able to get the Method Long.parseLong(String, int).
10:22mefestohttps://gist.github.com/995339
10:22tsdh(.getMethod (class Long) "parseLong" (into-array Class [String Integer/TYPE]))
10:22tsdh==> NoSuchMethodException
10:22mefestooops
10:23mefestorevised: https://gist.github.com/995339
10:24tsdhAh, yeah. s/(class Long)/Long in my code..
10:26tufflaxraek: yeah i noticed. Hmm, what if I wanted something like proxy but that could access protected members? Am I out of luck?
10:26tsdhmefesto: Hm, but somehow, that doesn't do the trick for static methods...
10:28tsdhmefesto: http://pastebin.com/sWi8VJL4
10:35Luytheh, I was installing SLIME at work today, and wanted to know more of SWANK... If you search WikiPedia for 'swank', you'll get something else than you expect!
10:36tsdhLuyt: Haha, but looks good, too. ;-)
10:36LuytMy coworkers thought I was browsing porn instead of getting stuff working
10:37mefestotsdh: get static method working?
10:37mefestoLong/valueOf => https://gist.github.com/995369
10:37tsdhmefesto: Nope, do you?
10:38tsdhmefesto: Yeah, that works. But not the one with the 2-args signature.
10:38ilyakI have a value and I want to do various things depending on that value
10:38ilyakLike java switch, without creep
10:38ilyakWhat's the best way to do that in clojure?
10:38mefestotsdh: in your example, you should pass the class as the target and not nil
10:39fliebelilyak: creep? there's just switch in clojure as well. or you can do... moment
10:39ilyakCan't find switch in http://clojure.org/cheatsheet
10:40ilyakcreep is break;
10:40mefestotsdh: (.invoke m Long (into-array Object ["111" 2]))
10:40tsdhmefesto: Yes, just checked, same error.
10:40fliebel&(case :a :b 1 :c 2 :a 2)
10:40sexpbotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry
10:41fliebel??? works in my repl
10:41tsdh&(let [m (.getMethod Long "parseLong" (into-array Class [String Integer/TYPE]))] (.invoke m Long (into-array Object ["111" 2])))
10:41sexpbotjava.lang.SecurityException: You tripped the alarm! package java.lang.reflect, Java Platform API Specification, version 1.6 is bad!
10:42ilyakAnd I also can't find case in http://clojure.org/cheatsheet
10:43fliebel$doc case
10:43tsdhmefesto: That's what I get (clojure 1.3) http://pastebin.com/02AmhKFW
10:43fliebel&(doc case)
10:43sexpbot⟹ "Macro ([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need no... http://gist.github.com/995384
10:43mefestotsdh: https://gist.github.com/995383
10:44mefestotsdh: oh, I'm on clojure 1.2
10:44fliebelPython-style switch: ##(({:a #(+ 1 %) :b #(* 2 %) :c identity} :b) 3)
10:44sexpbot⟹ 6
10:45bsteubertsdh: try ["111" (Integer. 2)]
10:46bsteuberbtw. (into-array Object …) == (to-array …)
10:48tsdhbsteuber: Oh, that does the trick. Thanks!
10:49bsteubertsdh: yeah, Java-interop got a bit ugly with clojure's new "tread all ints as long" policy
10:50bsteuberso you have to explicitly cast everything where java expects an int
10:58ilyakcase doesn't work on me
10:58ilyakit seems to always invoke the first branch
11:00ilyakNever mind
11:00ilyakI'm an idiot
11:11tsdhIs there a way to enable assertions in a repl session?
11:17dnolenfliebel: thx for the patch! I'll try to take a closer look at it in the next day or so.
11:17fliebeldnolen: cool
11:21fliebeldnolen: I discovered I have the same thing for macros as you have for performance. This makes me vurnerable to amalloy's strategy as well :(
11:22ilyakDoes clojure have continuations passing in the form of lazy list constructed with yield?
11:22fliebelilyak: It has neither first class continuations nor a yield statement.
11:22dnolenilyak: no, but I wrote something more powerful than that, delimc, https://github.com/swannodette/delimc
11:23dnolenfliebel: amalloy's strategy?
11:23fliebeldnolen: Have an idea, and tell you it can be done faster in Java so that you'd write it for him.
11:23ilyakfliebel: sad
11:24ilyakdnolen: Any cookbook?
11:24fliebelilyak: Why do you need them?
11:25fliebeldnolen: The same could be done by writing a broken macro for said idea and tell me it can;t be done with functions.
11:25TimMcfliebel: Similarly, the fastest way to get help in Linux is to loudly proclaim "$FOO cannot be done in Linux!" :-)
11:28dnolenilyak: cookbook?
11:30dnolenfliebel: ah yes :) yeah it's nice how you got rid of macros.
11:30dnolenfliebel: making fact a function is very useful.
11:31tsdhWhat's the right way to set *print-length* (or any other global var)?
11:32fliebeldnolen: Maybe it should return the new set, not the index... And yea, useless macroes in libs annoy me endlessly.
11:34dnolenfliebel: heh, I try to keep my macro usage quite low, but I was too busy thinking about other things to see the advantage of using protocols/types here. That's the beauty of open source, other people see things you don't and fix them.
11:41fliebeldnolen: What where the args in defrel originally used for?
11:42dnolenfliebel: nothing really, was a half-baked step towards allow indexing any element of the rel tuple.
11:43fliebeldnolen: Ah, okay. Because, after I was done writing my version, I found nowhere to put them.
11:44dnolenfliebel: in hierarchy you'd want to be able to efficiently calculate the reverse direction. you want to index a *and* b.
11:47tsdhHm, I have test/a.clj and test/b.clj, where b has (:use [test.a]) in its ns definition. But I cannot refer to the functions of test.a from b. Why?
11:48manuttertsdh: heh, been there
11:48manutterwait, no I read that wrong
11:48tsdhmanutter: Argh, in the REPL it works. But not with cake test or lein test.
11:49manutterhad my "to" and "from" reversed . Yes, you should be able to (:use [test.a]) in test.b and have access to a's functions
11:50manutterkill your repl and restart? Maybe there's some other problem masquerading as a missing function
11:51ilyakdnolen: Examples of doing useful things
11:52LeonidasI am using pcalls but the program acts strange: http://paste.pocoo.org/show/396267/
11:52Leonidasit displays "running" 3x and 42 which is fine
11:52Leonidasbut then it just hangs
11:53dnolenilyak: I have no such cookbook, but there is a lot of Scheme literature, FP literature, and much of the descriptions about yield apply.
11:54tsdhmanutter: I'll try that.
11:55tsdhmanutter: Ok, then I get that error there, too.
12:02dnolenthis would be fun to port to core.logic, http://stackoverflow.com/questions/3702855/typing-the-y-combinator/4962741#4962741
12:19ilyakIs it possible to call an anonymous function from itself not from the tail position and without resorting to Y combinator?
12:19dnolenhmm 1.3.0 alphas no longer support unsynchronized primitive fields - also transient field support would be nice.
12:19ilyak(mistyped "from the fail position")
12:24hugod&((fn f [x] (println x) (if x (f false))) true)
12:24sexpbot⟹ true false nil
12:34jarpiainwoot, my compiler patch was committed :)
12:37chouserjarpiain: Congrats! are you going to present your compiler at ClojureConj
12:37chouser?
12:38jarpiainchouser: (that was the fix for CLJ-671)
12:41jarpiainchouser: btw, did you get the reply to the mail you sent some 2 weeks ago?
12:43jsandahi all, is there a way to make one protocol extend another?
12:45dnolenjsanda: not really.
12:45jsandaok, thanks. wasn't sure
13:00robonobois there any way using pprint in the main method won't work after you generate an uberjar with lein?
13:00ataggartstuarthalloway: anything need working on?
13:02robonobo%
13:05stuarthallowayataggart: caught in meeting, may have something shortly, and/or check with redinger
13:09edwI feel the need to share: I just built a program to create a Markov model of incoming keywords and then used it to create a list of all (finite) vaguely-human seeming possible keywords. Woot!
13:23raektufflax: the easiest way is probably to write a helper class that can access them and let it have methods that delegate to the protected members
13:43amalloyfliebel, ilyak: in 1.2.x, case has a bug that makes (eval (macroexpand `(case ...))) not work
13:47amalloyedw: shamboogle. wzinlcbq
13:49manutter~botsnack
13:49clojurebotthanks; that was delicious. (nom nom nom)
13:49manutterwell, he's taking something anyway...
14:03edwamalloy: I hear you.
14:03tufflaxraek: Yes perhaps. In that case, can I have the java files in a lein project and have lein compile and load them?
14:11raektufflax: yes. if you add :java-source-path "src/" to your project.clj, Leiningen will compile .java files there when you run lein compile
14:11redingerataggart: Any chance you could write a small test case for CLJ-801 that actually demonstrates the problem?
14:11raekthe generated .class files will also be on the classpath
14:12tufflaxnice
14:12technomancyredinger: heyyyy, could I get the sonian blurb on the clojure wiki fixed?
14:12redingertechnomancy: yeah
14:12raek(loading is done automatically by the JVM when the class is fist used)
14:12raek*first
14:12redingertechnomancy: What's the fix?
14:12tufflaxoh ok
14:12ataggartredinger: I tested it manually by altering MethodImplCahe to accept Objects instead of only Classes, but I didn't want to check in that change. It's fairly difficult to find classes that result in a hash collision.
14:13ataggartredinger: if Rich et al. are okay with MethodImplCache being defined as accepting Objects, then I can write a permanent test case.
14:13technomancyredinger: could you replace the second sentence with "Sonian deploys large clusters running Clojure to perform parsing, archival, and indexing of many terabytes of email and other documents."?
14:13redingerataggart: Do you have your manual test hanging around? Even getting that in the ticket would be helpful
14:15redingertechnomancy: done
14:17ataggartredinger: I don't. I just used the values from the case tests and called expand-method-impl-cache. I could write the tests, but they wouldn't break if run. I'm open to suggestions.
14:17technomancyhmm; that chance appears to have taken confluence down.
14:17technomancy*change
14:17technomancyeep
14:18technomancyah ok, it's back
14:18technomancythanks!
14:38zakwilsonhttp://correlate.googlelabs.com/search?e=clojure&amp;t=weekly <-- Clojure is evidently correlated with porn (SFW unless you have an overzealous keyword-based web filter)
14:39manutterzakwilson: heh, now try that with Compojure
14:40zakwilsonmanutter: the assortment of things is near random
14:40manutteryeah, but it's STATISTICALLY SIGNIFICANT!!
14:41manutterI mean, hey, it's from Google, right?
14:41manutter:)
14:42zakwilson"When machine learning attacks", featuring cancerous neural networks and support hostile-vector machines
14:42TimMczakwilson: And "Python" with "cancerous tumor". :-D
14:43ataggartredinger: I'm writing a separate test patch that alters MethodImplCache. It probably shouldn't be committed, though.
14:43`fogusataggart: I will not be. :-)
14:43`fogusIt that is
14:44`fogusataggart: Anything that would shed some light on the problem being addressed would be a huge help
14:45ataggart`fogus: ah, I wasn't aware there wasn't clarity on the nature of the bug itself.
14:46__name__is writing an alpha-beta pruning AI in clojure sane or will i run into performance issues?
14:48`fogusataggart: The problem makes sense, but when I screen a ticket I like to create regressions. In this case, (as you said) it's tough to find a case to illustrate the problem, especially as some who has not experienced the problem and did not write the patch.
14:48redingerataggart: Yeah, I was just looking for an example rather than necessarily a test we need to commit
14:49redingerI was hoping we could pull something from Tassilo's code, but it wasn't immediate obvious how to grab something small
14:49ataggartcan someone remind me of the trick to call a private defn
14:50ataggartfrom outside that ns
14:50`fogus(#'foo)
14:50ataggartthx
14:51edwInternal DEFNs: Considered harmful or OK?
14:51dnolenedw: undiomatic, defs are always top level.
14:52dnolenedw: so no point really.
14:52manutterthere's always letfn if you need it
14:52edwJust trying to group my procs so people understand what's going on.
14:55manutterby "internal defn" I'm assuming you mean defining a function inside a function definition?
14:56edwYes. (My native language is Scheme.)
14:56amalloyyeah, considered harmful
14:56raekedw: in the aspaect of scoping, def in clojure does not work like define in scheme at all
14:57amalloyin particular, (defn foo [x] (defn foo* [x y z]...)...) would put both of them in the global scope anyway
14:57edwraek: Right, I just picked that up from dnolen.
14:58edwDEF is dynamically scoped... That didn't quite sink in when someone wrote that the other day.
14:59edwLETFN successfully deployed: thanks manutter.
15:00manutterI never used to use letfn, then I started doing the 4clojure exercises :)
15:00lucianedw: def being dynamically scoped seems very odd to me
15:00manuttervery handy there
15:00lucianit seems like the entirely wrong and surprising thing to do
15:01dnolenlucian: edw: what is meant by dynamically scoped in this context ? certainly not what dynamic scope generally means in Clojure.
15:02edwlucian: Yeah, "Never put a DEFx form *anywhere* but the top level of a source file" seems like correct advice to a third or fourth approximation.
15:02luciandnolen: uh, globally scoped it seems, not dynamically
15:02edwlucian: I used that word--repeating what I read the other day.
15:03luciani don't get why *anything* in clojure would be dynamically scoped
15:03edwSaying "dynamic scoping" just makes it seem more horrible.
15:04gfrloglucian: did you just make a pun out of asterisks?
15:04lucianalso, i don't get why anything would be global by default. i'd expect the reverse for everything
15:04luciangfrlog: uh, not really :)
15:04gfrloglucian: all the more clever then
15:04dnolenedw: lucian: even 'global scope' is inaccurate since you have namespaces.
15:04TimMcgfrlog: :-D
15:05raekalso, in 1.3 a re-def will cause recompilation of all functions
15:05luciandnolen: sure. still not lexical & local
15:05raek(not at once, but when they are called)
15:05dnolenraek: not true, I mistakenly thought that as well. caches get reloaded.
15:05raekaha.
15:05edwraek: I'm trying to wrap my head around the implications of that.
15:07raekmy understanding was that if foo v1.0 call bar v1.0, foo v1.0 will have a hardcoded reference to v1.0
15:07raekand when bar changes to v2.0, foo v1.0 needs to be recompiled
15:07dnolenraek: yeah that's not true.
15:07raekbut this is probably not quite what happens
15:08dnolenraek: there's a lot of implementation details - but the only real difference for 1.3.0 users is that vars are not dynamically rebindable by default.
15:09raekI guess I was conflating this with the old :static thing
15:10edwdnolen: That doesn't apply to the REPL though, right?
15:11dnolenedw: ? why should it not apply? The REPL is really all of Clojure.
15:12gtrak``Raynes, know what's up with tryclojure? i get 'Permgen Space'
15:13Raynesgtrak``: That's something that happens occassionally when people breakify it. I'll restart it. Thanks for letting me know.
15:13TimMcdnolen: Because rebinding in the REPL is... handy.
15:13edwdnolen: Umm, I must be misinterpreting what "rebinding vars" means, as the REPL is all about re-defining the same var over and over.
15:13dnolenTimMc: do we understand what 'rebinding' means in this context ?
15:13TimMcprobably nto
15:14dnolenyou can (def x 1) (def x 2) all you want, just as you always could.
15:14dnolenI'm talking about (binding [foo 1] ...)
15:14TimMcarg, right
15:15TimMcdnolen: So (def x 1) (def x 2) would still work in programs, and still be frowned upon.
15:16dnolenTimMc: frowned upon in completed programs, not during development.
15:16TimMcrigth
15:18Raynesgtrak``: Up again.
15:46ataggart`fogus redinger: test patch on CLJ-801
15:50`fogusataggart: Thank you sir
16:16`fogusdnolen: When should I see the validation error in your :unsynchronized-mutable example?
16:19dnolen`fogus: checking.
16:27dnolen`fogus: blarg, sorry turns out this in fact a issue w/ numerics, but the behavior is as expected.
16:29`fogusdnolen: So is this not a bug?
16:30dnolen`fogus: 1.3.0 defaults to long, but if you want int you have to remember to coerce.
16:30`fogusdnolen: The verify error that you mentioned was not a JVM bytecode verification error ?
16:31dnolen`fogus: I had something like (set! x 1) in my code, which was fine. But whenever I set the type of the field, the compiler would complain, so I thought the problem was a mutable field + type hint in 1.3.0. It was a JVM byte code error. Expecting I() on stack.
16:32`fogusdnolen: That error could probably stand to be more graceful
16:39`fogusdnolen: Thanks for posting about it.
16:40dnolen`fogus: any thoughts about the transient bit?
16:41`fogusdnolen: Not at the moment, but I will meditate on it this long weekend. :-)
16:44hugoddnolen: is there a pattern matching example for core.logic?
16:45dnolenhugod: yes it one of the first examples on the github landing page show that in action.
16:46dnolenhugod: apologies for the state of the documentation. I've created a wiki on the project page, I'll try to flesh it out with some examples.
16:48hugoddnolen: thanks for what there is; I know what a headache documentation can be when things are still moving fast
17:25crowbarI'm running swank-clojure connected to an emacs session. When I run a evaluate some code that opens a JFrame which has an EXIT_ON_CLOSE associated it ends up killing me slime repl. Is there a way to keep the swank/slime repl alive?
17:37amalloycrowbar: don't use System.exit if you don't want the system to exit :P
17:38amalloyDISPOSE_ON_CLOSE is more flexible for an app that might have other threads running that you care about (for example, your swank server)
17:38crowbarYou win this round.
18:38Crowb4rhey the real crowbar
18:38Crowb4rlol
18:39Crowb4rwell other crowbar
18:51devnhello
18:52devnhello folks
18:52devnwhoops -- making the rounds this afternoon and doubled up on #clojure :)
19:44Null-Ahow do I slurp lazily?
19:44Null-A(line-seq (slurp ..)) ?
19:49Null-Anvm
20:51crowbar(clojure.core/max (list 1 2 3 4)) I'm getting (1 2 3 4) as a result. I was expecting 4. What should I be doing?
20:52tomojamalloy: how would you write (map (juxt (comp f first) (comp g second)) c)
20:52crowbarI see. passing it a list is incorrect. I should break it into atoms.
20:53offby1crowbar: if this were #scheme, I'd suggest you use "apply". But I don't know what clojure's equivalent is
20:53technomancyoffby1: no, that's right for clojure too
20:53crowbaroffby1: reduce worked, but is apply better?
20:54offby1crowbar: dunno if it's better; it's just the first thing that popped into my head :)
20:54offby1actually, apply _might_ have the disadvantage of not working if the list is very long
20:54offby1in which case "reduce" would win.
20:54offby1not sure if clojure has a limit to the number of args a function can take.
20:55offby1s/not sure/no effing clue/
20:55sexpbot<offby1> no effing clue if clojure has a limit to the number of args a function can take.
20:55offby1that was ... moderately useless :)
20:55tomojreduce and apply seem to have equal performance to me
20:55crowbargreat help to me though. thanks.
20:56offby1tomoj: it's not a question of performance; it's a question of utter failure. Some lisps -- I forget which -- indeed have a limit to the number of arguments you can pass to a function
20:56tomojnot clojure :)
20:56offby1there ya go, then.
20:56crowbarso apply will break a list into atoms and pass to a function vs reduce which will keep falling first on a list until down to one item as a result?
20:56tomoj&(take 10 (apply (fn [& args] args) (range)))
20:56sexpbot⟹ (0 1 2 3 4 5 6 7 8 9)
20:57tomojapply is defined up to [f a b c d & args]
20:57tomojhmm
20:58tomojthat isn't relevant is it
21:00offby1I assume that (range) returns an infinite sequence
21:00tomojyeah
21:01tomojin 1.2.0 it looks like apply helpers are defined up to 20 arguments
21:02tomojalso (RT/boundedLength seq limit) to return length of a seq up to a limit
21:02technomancyreduce involves calling max many times; apply is a single call
21:03tomojhuh, I'm confused
21:04tomojapplyToHelper in the default case converts the remaining arguments to an array
21:04tomojso that must not be called for the above example
21:05crowbarhey technomancy, thanks for your help on news.yc today. happily learning clojure now.
21:05tomojah, because it's the function doing it, and a function with [& args] can know not to bother?
21:06tomojoh, _that's_ what RestFn is for
21:07tomojI've seen that in stack traces all the time but never understood what it meant
21:07technomancycrowbar: cool
21:13wastreli saw an email about gui stuff
21:14technomancycrowbar: the "Let's just use Emacs" thread?
21:14crowbar<- parfe here.
21:15Null-Ais there an easy way to get the index while iterating of a vec? like (for [[k v] (zipmap (range (count my-vec) my-vec ))] ... )
21:15crowbaryeah, I was complaining about how too much is broke, but luckily your stuff all works for me now.
21:15crowbarclojure-jack-in works wonders.
21:15technomancysweet
21:15technomancyyeah... too many moving parts before that
21:16Null-Aah map-indexed
21:16technomancyI contacted tromey to get some deprecation warnings on the old elpa stuff; hopefully that will clear things up.
21:16crowbardo you have control of marmalade-repo.org? They're missing a snippet to load package.el
21:17crowbarnevermind. I'll email the guy in the about section.
21:17technomancyI've been opening issues at http://code.google.com/p/marmalade/
21:18technomancyhe's pretty responsive
21:18crowbareven better. thanks.
21:23tomoj(defmacro fn-> [& more] `(fn [x#] (-> x# ~@more)))
21:46cnd_~+ 1 2)
21:46clojurebot,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")), :else("nao eh") )] (testar 10 25))
21:46cnd_~(+ 1 2)
21:46clojurebot,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 11 25))
21:46cnd_~(or (> 1 java.lang.Double/NaN ) (= 1 java.lang.Double/NaN ))
21:46clojurebot<monads> is "yea, though I should walk in the valley of imperative code, I shall fear no evil, for your monad comforts me" - seen in #haskell
21:47cnd_,~(or (> 1 java.lang.Double/NaN ) (= 1 java.lang.Double/NaN ))
21:47clojurebotjava.lang.IllegalStateException: Var clojure.core/unquote is unbound.
21:47cnd_,(or (> 1 java.lang.Double/NaN ) (= 1 java.lang.Double/NaN ))
21:47clojurebotfalse
21:47cnd_,(>= 1 java.lang.Double/NaN )
21:47clojurebottrue
21:49cnd_hello?
21:49clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline cnd_
21:51tomojsuppose you use xml/parse to parse an entire document into a tag structmap. then you create an xml-zip and start grabbing references to locs
21:51tomojthe zippers along the way will share lots of structure with your original tag structmap, right?
21:54devntomoj: my gut tells me yes since structmaps are simply maps
21:55tomojinteresting
21:55devnmy gut or my answer?
21:55devnor that it can talk?
21:55tomojthe answer
21:55tomojthat too is interesting
21:55devn:)
21:56tomojunfortunately since clojure.zip implements zippers as 2-vectors, they don't work with cascalog
21:56devntomoj: although maybe not
21:56devnsince "most uses of structmaps would not be better served by records"
21:57tomojshoot, I need record zippers
21:57devni've been casually following the changes in 1.3 to defrecord -- but in general i've heard generalizations like: "records are fast"
21:57devnwhich would lead my gut to tap me on the shoulder and suggested shared structure might be one benefit of records over structmaps
21:58tomojI don't really need fast here, just need to not use tooo much memory
21:58devnreading the documentation on clojure.org i see that "The only restriction is that you cannot dissociate a struct map from one of its base keys. A struct map will retain its base keys in order."
21:58devnon the other hand: "StructMaps are in all ways maps, supporting the same set of functions, are interoperable with all other maps, and are persistently extensible (i.e. struct maps are not limited to their base keys)."
21:59devntomoj: I believe you are just fine with structmaps in this case -- but profile if you're writing this code to support a life support mechanism of some kind before trusting some fool on irc. ;)
22:00tomojI don't plan to change the xml structmaps
22:01devntomoj: the end goal is always good to know when discussing this sort of thing
22:01devndo you have a problem statement that is beyond implementation details?
22:02tomojcrawl and process markup
22:02tomojbut I'd really like to do it with cascalog and zippers
22:02devnmmm
22:03devnthat would be cool
22:03clojurebotHuh?
22:03devnclojurebot: that
22:03clojurebotPardon?
22:03devnclojurebot: what tomoj said... it would be cool.
22:03clojurebotI don't understand.
22:03devnbots...
22:03tomojclojurebot: botsnack
22:03clojurebotThanks, but I prefer chocolate
22:04devnsee -- not only is he ignorant, he's picky!
22:08tomojI can just macro my way out of boilerplate for dealing with 2-vectors and not have to rewrite clojure.zip :)
22:11gfrlogI would like to see a saturday morning cartoon where every week the characters have to macro their way out of some crazy situation.
23:03zakwilsonAre there open source web apps of significant size written in Clojure that I can read? I'm trying to get a feel for how best to structure things.
23:09gfrlogzakwilson: I take no responsibility for the following suggestion:
23:09gfrloghttps://github.com/dbyrne/4clojure
23:10zakwilsongfrlog: thanks
23:10bpris there a way to get lein to load your project into a running repl?
23:11bpror do you have to load all the files and dependencies yourself?
23:11bprI was thinking of common lisp's asdf as a model for this
23:15crowbaris there an issue with using hyphens in namespaces?
23:21crowbarlooks like by renaming my namespace to explude a hyphen my problem is resolved. perhaps because the file system was using an underscore?