#clojure logs

2008-12-23

00:08replacaQ: Is there a way to call clojure functions from Java without :gen-class?
02:40bOR_24th on the mud connector really isn't bad =)
02:41bOR_geas, for example, is also a small mud.
02:41bOR_with fanatical players :)
02:41bOR_and that's 16th
02:41bOR_we should be able to get to sub20's as well
02:46bOR_eek.
02:46bOR_wrong channel. sorry!
03:59hmldoes clojure have opengl bindings?
03:59hmlon ubuntu linux amd64
04:18hoeckhml: you would use the bindings from https://jogl.dev.java.net/
05:25bOR_downloaded the cvs version, but when i try to ant it, I run into the following error
05:25bOR_[javac] Compliance level '1.4' is incompatible with target level '1.5'. A compliance level '1.5' or better is required
05:26bOR_the internets are a bit vague about it. they suggest either to change some things in the build.xml (but that just generates a new error), or do something different with eclipse
05:26bOR_which I'm not using.
05:26bOR_any ideas? :)
05:33hoeckbOR_: an old java version??
05:34bOR_1.6.0_11
05:34bOR_not sure if that is old, actually.
05:35bOR_ah. that seems to be the latest version
06:14hoeckbOR_: and ant -diagnostics points to the right java version??
06:16bOR_hah. thanks, will check.
06:16bOR_(also busy with lunch)
06:16leafwbOR_: echo $JAVA_HOME ... may be set to somewhere else.
06:17bOR_that seems to be the problem indeed.
06:17bOR_java.runtime.version : 1.4.2
06:17bOR_it's pointing to that.
06:19bOR_no explicit java_home set.
06:20koguhi, is there a limit to memoize caching?
06:22kogumemoize does not seem to be working if argument is a list
06:24dhayakogu: No restrictions as far as I can see. what does the error say?
06:24koguthere is no error, but there is no speed improvement
06:25kogui have a function which accept a list argument, the list has 216 diffrent possibilites,
06:25koguand that function will be called a lot, but with only with those 216 diffrent possibilites
06:25koguofcourse the list is created everytime
06:27hoeckkogu: can you paste your code to lisppaste?
06:27kogusure thing
06:28lisppaste8kogu pasted "untitled" at http://paste.lisp.org/display/72562
06:28dhayaorder is important for lists. if you try sets as arguments it might work like you expect.
06:29koguin the code, im creating a new list with 3 items, each of them ranging from 0-5, so total possible combinations is 6*6*6
06:29kogufrom (0 0 0) -> (5 5 5)
06:37kogudo the refs have to be same?
06:37dhayaWell, memoize does work on lists. I tried by adding a (Thread/sleep 2000) in one of the return values in the function. It could be that difference in memoized speed is not noticeable in your case?
06:39koguhmmm, perhaps
06:40koguty for your time
06:40dhayanp
06:41kogu:)
06:47hoeckit seems that eval-roll just isn't expensive enough to be worth memoized
06:54koguyep, seems that way
06:54kogui need to find something else then
06:54dhayaanybody has any experience using redshank? does it work with clojure-mode?
06:58dhayawell, i am not even sure if i want that. seems too specific to CL.
07:19bOR_nice. got ant compiling the latest version of clojure, after adding a path and a java_home to my .cshrc
07:20bOR_time to simulate :)
07:21rhickeybOR_: when you get a chance, could you run your original, repeatably failing code, with svn 1181?
07:22bOR_just about to do so.
07:23rhickeygreat - it sure looks like you were just hitting the 32-bit limit
07:23bOR_thanks for the help there indeed.
07:23bOR_was there any way I could have avoided hitting that limit?
07:24bOR_Timothy is after it.
07:24bOR_reading his post now.
07:25rhickeyIt shouldn't have been AtomicInteger - all variables for timestamps are longs. It was left over from some old testing of Terracotta, which at the time supported AtomicInteger but not AtomicLong
07:25bOR_my atypical use of keeping track of a years.
07:28bOR_nice to have contributed in some way to clojure :).
07:37Chousukerhickey: did you notice Meikel's revised patch for the with-open binding issue?
07:38rhickeyChousuke: not yet
08:26gnuvinceGood morning
08:29rhickeyhi
08:29gnuvinceLast day before vacations
08:29gnuvinceI'm gonna need to find something to do
08:36gnuvinceI was asking yesterday, is there a Java library to unpack binary data? Similar to Python's struct.unpack?
08:40bOR_http://code.google.com/p/javastruct/
08:40bOR_that one?
08:42gnuvinceSeems like it could work.
08:42bOR_no experience with it, just a google.
08:42bOR_but it does have an unpack in it.
08:42gnuvinceyeah
08:45bOR_good luck with it :)
08:53leafwrhickey: a few months back you added float/vmean etc for numeric primitives. Where are they now?
08:54rhickeyleafw: in svn history, replaced by more generic primitive support, areduce/amap
08:55leafwrhickey: thanks.
08:58leafwrhickey: by the way, the clojure book by Stu is freakin' great. If there is currently an explosion of beginners, it's bound to get exacerbated.
09:27Chouserleafw: hopefully after reading the book, they'll be well-informed beginners
09:27rhickeywhere is clojurebot? relying on it to broadcast commits here
09:30RSchulz,(println "Who, me worry?")
09:30Chousukerhickey: hiredman said the computer hosting clojurebot had a HD crash
09:30RSchulzOuch.
09:31RSchulzI guess we'll find out if he keeps good backups...
09:31duck1123didn't he say that was on slicehost?
09:35RSchulzI don't know what that is. A Java hosting service?
09:36duck1123I know he said clojurebot was running on his webserver, and I think he said he was using slicehost to host webpages.
09:37duck1123I assume they would keep backups,
09:43RSchulzIf it's running on a commercial hosting service, how did a drive failure bring it down? Surely they have redundancy as well as backups?
09:49duck1123I don't understand why, if memory is so cheap, that heap space for jvm application hosting should be so expensive.
09:52ChouserSVN 1182: with-open accepts multiple bindings, patch from Meikel Brandmeyer
09:53Chousernice.
10:04Chousukeit accepted them before too; it just never closed them :)
10:05duck1123Would that perform better than simply nesting with-open forms?
10:06duck1123or is it just that it looks better?
10:07Chouserlooking at the patch, it appears to expand to identical (or nearly) code as nested with-open forms.
10:07lisppaste8drewr pasted "i/o in a transaction" at http://paste.lisp.org/display/72568
10:08drewrThis might be a stupid thing to do, but I don't understand this error.
10:09Chouserbut as Chousuke said, it silently closing only the first.
10:09drewr"foo" gets written to the log, so w is obviously the right type when the macro is expanded.
10:09Chouserit WAS silently closing only the first. now it's all better.
10:09drewrBut then (.close <String>) happens?
10:09Chousukedrewr: all bindings in with-open have to be closeable
10:09Chousukedrewr: use let for normal bindings.
10:09drewrAh, the timestamp is the issue here?
10:09Chousukeyeah
10:10drewrDid that change with the patch you guys were just talking about?
10:10Chouserdrewr: heh,yeah.
10:11ChouserI really hadn't thought of it as a breaking change.
10:11drewrI updated clojure this morning, made a change to my code, then got the error. :-)
10:11drewrWrong order there.
10:11Chousukeyou're supposed to use with-open only to bind closeable stuff.
10:12Chouserand now that's enforced.
10:12Chousukecode like that worked just fine with the old version, but it still is a bug
10:13rhickeyif you were calling with-open in the past with more than one name and init, your program had a bug
10:13drewrGood to know.
10:13rhickeythis is not a breaking change
10:14rhickeythis might be a broken code revealing change :)
10:14bOR_Chouser - about send vs send-off. the latter is for potentially blocking events.. I guess that anyplace where I alter a ref needs a send-off then.
10:15drewrbOR_: How right you are. Learned that the hard way yesterday.
10:15ChouserbOR_: nope, altering a ref doesn't block
10:15Chouserhm
10:15drewrI wasn't agreeing with the ref part necessarily, but the "potentially blocking" part, yes.
10:16Chouseroh, ok.
10:16bOR_I got different results when using send vs send-off where each agent was an event + location -> (send (agent nil) (birth 23))
10:16drewrI changed some sends to send-offs yesterday with my socket code, and poof, things started working.
10:16bOR_vs (send-off ...)
10:16bOR_hmm.
10:16bOR_fun thing about this is that I can change the whole mode of concurrency without touching 90% of my code. It's just the way I invoke it.
10:17drewrI still don't understand *why* they behave differently though.
10:17bOR_I'll put a note to myself to look into send vs send-off again.
10:17Chousukedrewr: that append-file in dosync looks suspicious. aren't transactions supposed to be side-effect free?
10:18Chouserdrewr's case makes sense to me, because if all of the send-pools threads are busy blocked on IO, another 'send' will just queue up and may never exectue.
10:18drewrChousuke: Good point.. they might be retried.
10:18Chousukethough I guess that particular transaction should never get restarted.
10:18Chousukesince all it does is read the value once.
10:19drewrIt might be moot to put it in a transaction anyway since the file is opened, written, and closed in one function.
10:19Chouserdidn't notice that -- yeah, there's no need for dosync in that log function at all.
10:19Chouseroh!
10:19Chousergah, sorry.
10:19drewrI just didn't know how atomic that was and whether threads could ever block because of it.
10:20drewrChouser: Yeah, that was the change I was playing with when the with-open semantics side-tracked me :-)
10:20drewrI couldn't figure out how adding dosync now messed up my bindings.
10:20Chouserok, it would be fine with no dosync -- do a flying read on *logfile*, and you should be fine.
10:21gnuvince~later tell *Gonzo* http://img116.imageshack.us/img116/6320/1229995264818rm4.png
10:21gnuvinceoops
10:21gnuvincewrong channel, sorry
10:22Chousukeyou might still have multiple threads calling log simultaneously though
10:22Chouserif you wanted to update the value of *logfile* to indicate what had been written, then you might need a dosync.
10:22ChouserChousuke: but a dosync wouldn't prevent that.
10:22Chousuketrue
10:22Chousukean agent could be useful
10:24Chousukesend all log requests to an agent and let it take care of opening and closing the file.
10:24drewrInteresting.
10:27ChouserChousuke: that's perfect. I'd pondered a similar loggin problem before, and using an agent hadn't occured to me.
10:29bOR_ah. that's because a single agent just has a queue of tasks that it works through, right?
10:29bOR_nice.
10:34drewrSweet fancy moses, that works like a charm!
10:35drewrNothing is blocking now. Ah, glory.
10:36Chouserdrewr: are you opening the file each time you have something new to log?
10:37drewrChouser: Yep. (defn log [s] ... (send-off (agent *logfile*) append-file s)), where append-file does (with-open ... (.write ...)).
10:38drewrThose threads could probably pile up on a busy server though.
10:39drewrBut maybe not any worse than logging on a busy server anyways.
10:41bOR_is there any way from within the repl to see what version of clojure I am using?
10:41ChouserbOR_: no
10:42Chouserdrewr: that's not right -- you're creating multiple agents -- they could open the file at the same time, and then ... havoc. :-)
10:42bOR_either I by accident used the old version of clojure, or the AtomicLong didn't stop the problem.
10:42drewrChouser: Hm.
10:43Chouserdrewr: I think you want *logfile* to be an agent instead of a ref
10:43drewr(It's not a ref anymore, btw, just a string.)
10:43drewrIt was only a ref while I played with dosync.
10:44drewr(def *logger* (agent *logfile*)) ... (defn log ... (send-off *logger* ...)) ?
10:45rhickeybOR_: what version did you think you were running?
10:46bOR_I've the last release and the svg installed.
10:46bOR_svn
10:46bOR_when the bug came back, I wanted to make sure that I am running the svn version
10:46bOR_and not by accident the old version.
10:47bOR_not sure if my run-lisp in emacs caught the new version, or called the old version.
10:47rhickeywhat was the old version?
10:47bOR_clojure_20081217.zip
10:48rhickeyso, wouldn't have had condp - you can check for that at the repl
10:48bOR_'k
10:48bOR_good call
10:49bOR_(doc condp) should work then?
10:49rhickeyyup
10:49bOR_(it doesn't)
10:49bOR_ok.
10:50bOR_so then it's just me making a silly mistake.
10:50bOR_next update in a few hours :)
10:51drewrChouser: That doesn't work.
10:52drewrMultiple calls to log get hung somehow.
10:53drewrThe new-agent-per-write method works great though. I'm not sure how they would clobber each other in that scenario.
10:53drewrThings get logged out of order sometimes, but that happens anyway.
10:55Chouserdrewr: I'm afraid if two things try to log at the same time, one might get lost entirely.
10:55rhickeydrewr: why don't you send-off an agent to read from a blocking queue?
10:56drewrrhickey: Yeah, I could mimic the way I'm interacting with the socket.
10:57drewrMakes sense too since it's all i/o.
10:57Chouseror use 'send' to append to the agent string, and 'send-off' on a timer to flush it do disk.
10:58rhickeywait, you just want async, in-order, non-overlapping logging?
10:58rhickeyjust send-off agt log
10:58drewrrhickey: Essentially, yes. I want the stuff to show up in the file at some point and not block anything.
10:58rhickeyto the same agt
10:59drewrThat's what Chouser suggested, but I can only get it to work by creating a new agent each write.
10:59rhickeywhy?
10:59drewrI'm not sure. :-)
11:00drewrOption 1: (send-off (agent "/tmp/foo.log") append-file _str)
11:00drewrOption 2: (def *logger* (agent "/tmp/foo.log")) .. (send-off *logger* append-file _str)
11:01drewrFor me, 1 writes, 2 doesn't.
11:01rhickeydrewr: does append-file return "/tmp/foo.log"
11:02drewrWell, 2 writes, but only the first time.
11:02rhickeyright, becuae your action trashes your agent state
11:02rhickeymust return new state
11:02rhickey(can be same as old)
11:02drewrAhhhh, yes. I had left the string as the return state.
11:02drewrMuch better. :-)
11:05rhickeyChouser: svn 1184: ~x not in syntax-quote yields (clojure.core/unquote x)
11:05rhickeyclojure.core/unquote has no root binding
11:07Chouserrhickey: cool
11:07Chousernow when someone gets around to writing a nice sql-query builder, they can have a tidy syntax for it.
11:09rhickeyChouser: did you ever need it for your xml stuff?
11:11rhickeyhttp://code.google.com/p/clojure/source/list
11:11ChouserI haven't yet, no. zip-filter ended up not even needing any macros, much to my surprise.
11:14duck1123I wonder if unquote will prove to be useful in the SPARQL DSL that's being discussed.
11:15Chouserduck1123: I think it came up there.
11:15RSchulzduck1123: What's unquote?
11:16rhickeyunquote is undefined
11:16RSchulzThis is the stuff about "quasiquote"
11:16rhickeyhttp://code.google.com/p/clojure/source/detail?r=1184
11:17RSchulzSounds dangerously close to a read-time hook...
11:18RSchulz(I like it.)
11:18duck1123RSchulz: I still don't see why you think clojure keywords would work so badly in sparql. The sparql variable, afaik, is a fairly simple thing. Unless there are some edge cases I don't know about.
11:18duck1123It's been a while since I read the spec
11:19RSchulzI think one aspect is that keywords should not be invented dynamically, but rather be defined in Clojure source code.
11:19RSchulzAlso, I'm not sure what problem they solve for this particular use case.
11:28RSchulzIs the intention that the programmer supplies a definition of clojure.core/unquote to control what happens when unquoted forms appear outside of a syntax-quote?
11:30duck1123hmm... can you bind a fn to a var in a different namespace inside a let?
11:31duck1123you would only want clojure.core/unquote to mean something inside your macro (or whatever)
11:34RSchulzI read the entire "A quasiquote for Clojure?" thread, but I don't think I get the utility of this change. In particular, I don't see how it achieves the results he suggests for his (then impossible) example from SQL and scsh.
11:36Chouserif you want your own meaning for ~ outside of ` you can either use binding or a macro.
11:38Chouserthe idea is that I could write a sql-building macro now that would be called like: (let [x 55] (select a, b (from tblc) (where (= a ~x))))
11:39Chouserbefore 1184 there would be no way to make this work.
11:39Chousereven better (where (= (+ a 1) ~(- x 1)))
11:40Chouser...clearly indicate which expressions should be translated to SQL and sent over, and which should be evaluated as Clojure code locally instead.
11:41RSchulzBut the burden remains upon the macro writer to do something (eval, in these examples?) things wrapped in (clojure.core/unquote ...)?
11:42duck1123right
11:42ChouserRSchulz: yes, but now it's possible. previously it generated an error at read time, before the macro writer could do anything with it.
11:42RSchulzRight.
11:44duck1123It's a runtime error if ~ is used a c.c/unquote is not defined?
11:44RSchulzBut the Scheme quasiquote that Meikel described would just eval those forms unconditionally in the global environment? Or did it preserve control of their dispensation, too?
11:45Chouserduck1123: yes, now it's a runtime error
11:46Chouserit's interesting to me that rhickey bound c.c/unquote at all, allowing the use of 'binding' to define it.
11:46Chousernot bound, but interned I guess.
11:47RSchulzIt's just a (def unquote) in clojure/core.clj
11:47RSchulz(Plus minor changes in LispReader.java)
11:47Chouserwithout the (def unquote) it could still be used by macros, but would generate a compile-time error if used incorrectly
11:48Chouser...and 'binding' wouldn't be an option.
11:52RSchulzSo if you wanted to support the Scheme behavior in one of your macros, you could wrap its expansion in (binding clojure.core/unquote #(eval %) ...) ???
11:52ChouserI don't know how Scheme behaves.
11:53ChousukeRSchulz: #(eval %) == eval :)
11:53RSchulzLet's say it does what I suggested / asked above: Evaluates in the global env.
11:53RSchulzChousuke: Right (D'Oh!)
11:54Chouser(binding [unquote inc] ~5)
11:55Chousukethat's just evil
11:55RSchulzLet me guess... 6? ... OK. I cheated and evaluated it...
11:55Chouseryes. don't do it.
11:55RSchulzAh, yes. And I see you have to use (binding ...) correctly. So many rules...
11:55Chousukebut at least it's explicitly evil
11:56Chouserhm, is it? as I said, I'm a bit surprised it's allowed.
11:56RSchulzYou could use it composing inc and dec to ensure that you got a number. That would be implicitly evil, rigth?
11:56Chouserit may be a really pleasant way to write some non-evil functionality, but I'm not sure.
11:57ChousukeI mean, it requires teh (binding) form
11:57Chouseryeah, but 'binding' is not explicitly evil.
11:57Chouserthough I guess it does stand out a bit.
11:57RSchulzConsider the shell case (I wrote some stuff like that as an excersize and for its mild utility). In this context, they become like $foo shell variables.
11:57Chousukethough I suppose it's easy to hide all that inside a macro.
11:58RSchulz(given the (binding [unquote eval] ...) interpretation.
11:59Chousukebut clojure already gives more than enough abusable tools. I don't think being able to rebind unquote will make much of a difference.
11:59rhickeyChouser: being a var is irrelevant, if not, (let [unquote inc] ~5)
11:59RSchulzI'm sure people will find creative uses and abuses of it.
11:59Chousukeat least it'll always work as expected inside a ` form
11:59Chouserrhickey: ah! of course.
11:59ChouserChousuke: heh. yes.
12:00rhickeyactually, not true, if I use clojure.core/unquote
12:00ChouserChousuke: my point is that for a macro, 'binding' probably wouldn't be used at all.
12:00rhickeywould get Can't let qualified name
12:02rhickeyIt's certainly not my intention that binding be used, you just get unbound error instead of no var error, and would be harder for macros to get at unquote with namespaces, since no corresponding var
12:03Chouseryou mean you'd need the whole symbol name since it wouldn't resolve the namespace for you?
12:03rhickeyuser=> clojure.core/bogus
12:03rhickeyjava.lang.Exception: No such var: clojure.core/bogus (NO_SOURCE_FILE:0)
12:03rhickeyuser=> clojure.core/unquote
12:03rhickeyjava.lang.IllegalStateException: Var clojure.core/unquote is unbound. (NO_SOURCE_FILE:0)
12:03rhickeyuser=> `bogus
12:03rhickeyuser/bogus
12:03rhickeyuser=> `unquote
12:03rhickeyclojure.core/unquote
12:04Chousukecouldn't you for example bind unquote to some custom function so that all forms passed to the macro with unquotes in them would become calls to that function.
12:06rhickeyChousuke: I'm interested to see if people could do that usefully, certainly easier than tree-walking for substitution, but either is possible right now
12:09rhickeyso, for now I'm not trying to disallow it, nor require it (binding)
12:17duck1123would it be possible to make mention of *compile-files* on the compilation page? I had a hard time trying to remember what it was called. (had to go to clj-doc then to the email thread)
12:23rhickeyduck1123: http://code.google.com/p/clojure/issues/detail?id=9 - patch welcome
12:26duck1123does documentation enhancements require a CA? (bringing the form home tonight so I can finally send it in)
12:28rhickeyduck1123: documentation for *vars* will go into the code
12:34lisppaste8Chouser pasted "example of using ~ in macro calls" at http://paste.lisp.org/display/72572
12:35rhickeyneat
12:37Chouseryou have to choose your test expressions very carefully to maintain the illusion that 'where' produces valid SQL. :-)
13:01lisppaste8RSchulz pasted "Broken use of "unquote"" at http://paste.lisp.org/display/72574
13:01RSchulzHowdy. What's wrong with this ^^^
13:02RSchulzThe "shf" function to which these macros delegate works, as does the "sh" macro.
13:03lisppaste8RSchulz annotated #72574 with "Explanation" at http://paste.lisp.org/display/72574#1
13:13hoeckRSchulz: there is no unqote function
13:14RSchulzI'm running SVN 1184
13:17hoeckim on 1160 but i suspect that unquoting implementation has changed
13:17RSchulzThis is about http://code.google.com/p/clojure/source/detail?r=1184
13:18hoeckah, guess i have to update and look before making more noise
13:21ChouserRSchulz: http://localhost/proj/clojure-log/macro.html
13:21RSchulzLocalhost??
13:21Chouseroh, sorry
13:21RSchulzhoeck: It started here: http://groups.google.com/group/clojure/browse_thread/thread/6d0c5f7e37909055
13:22ChouserRSchulz: http://clojure-log.n01se.net/macro.html
13:22RSchulzYou can't tell my looking at the (defmacro ...) for shq I pasted? It's self-contained.
13:23ChouserRSchulz: did you try macroexpand?
13:23RSchulzYes.
13:23RSchulzShall I annotate my paste with the result?
13:24lisppaste8RSchulz annotated #72574 with "Example expansion" at http://paste.lisp.org/display/72574#2
13:24Chouserclojure.core/unquote appears within a (quote ...), so it gets passed literally to shf
13:24RSchulzWhat's that phrase? ... Oh, yeah: D'Oh!
13:25Chouser:-)
13:25Chouserit's hardly proof, but may be an indication that 'binding' isn't a useful way to use unquote
13:26bOR_while we're on the topic of D'Ohs, there must be a hundred simpler ways to get the number of different letters between two strings than the one I made now.
13:26bOR_(count (filter #(= (count (set %)) 1) (seq (zipmap (vec string1) (vec string2)))))
13:26bOR_I sort of grabbed whatever function brought me closer to the end-goal.
13:27bOR_but as I still only know a fraction of the functions that clojure has, I am probably missing something simple.
13:27RSchulzChouser: Perhapsibly. I'll keep poking at it to see if I can come up with an elegant way to achieve that effect.
13:29Chouser(count (filter true? (map = string1 string2))) ?
13:30Chouserhm, that's not quite the same
13:31ChouserbOR_: well, at the very least I don't think 'vec' is buying you anything
13:32bOR_ah. right.
13:33bOR_thanks :).
13:34bOR_I tried to do something like #(= %1 %2), but that didnt work.
13:35Chouserdo you really want different answers for ["abb" "abc"] than for ["abc" "abb"] ?
13:35bOR_hmm? no.
13:35ChouserI get 1 for the first, 2 for the second.
13:36bOR_I just want abcdefg aaadefg to report a difference of 2.
13:36Chouseroh, ok. then what I posted above should work.
13:36bOR_ah. great :). I'll go and learn to understand it.
13:36Chouserthe problem is zipmap is not commutative
13:38bOR_the problem is that I think I know how map works, based on ruby, and then see it do marvellous things in clojure.
13:38bOR_;)
13:38Chouseryeah, clojure's map has this magical multiple-collection feature.
13:41RSchulzI don't think it'll ever work to try to get unquote to selectively add a level of evaluation in a syntax-quoted form in one-shot style, since the syntax quoting happens at the outside, and once you eval that outer syntax-quote away, you _then_ must get the unquote to act as eval, but that means everything around it will get eval'ed, too.
13:42hoeckRSchulz: thanks for the pointer to the unquote post, the list really too big to keep an eye on all posts
13:42RSchulzIn other words, I think a tree-traversal with selective treatment of (unquote ...) -ed sub-forms will always be required.
13:42RSchulzHas someone concocted "tree-map" yet? Presumably it could be built upon the Zipper in a straightforward manner.
13:42ChouserRSchulz: excellent -- that's a useful position. Thanks for reaching it.
13:42rhickey:)
13:45rhickeyprops to Chouser for his help on the docs: http://clojure.org/space/changes - hope everyone's been refreshing and reading
13:47bOR_noticed a lot of the changes :). Thanks Chouser!
13:48ChouserI'm getting mixed reviews on the no-longer-inline function docs.
13:48rhickeyChouser: they simply can't be maintained
13:49bOR_we can't get like world of warcraft - hovering descriptions?
13:49rhickeyWhen I get time I'll add more prose and examples
13:49ChouserbOR_ suggests an option I'd considered.
13:49bOR_http://www.wowdb.com/search.aspx?search_text=sword#items
13:49ChouserI could probably cobble together some javascript to provide that.
13:50Chouserrhickey: we also might want to find a way to deal with currently un-linkable function names.
13:50rhickeyChouser: as long as derived from API page, sure
13:51rhickeyas far as unlinkables, would just be mod to that wikigen script I pasted, with some munging convention right?
13:51Chouserscript tags can be added to the wiki template or something? I wasn't sure.
13:52Chouseryeah -- munging convention of the anchor itself, but I think there may still be problems with the visible text.
13:53ChouserI guess this might be acceptible: [[api#not_EQUAL_|not]]=
13:54rhickeysome is just wiki problems, for instance http://clojure.org/api#instance? works
13:54rhickeybut that link didn't in the wiki markup
13:54danlarkinwhat about the clojure naming scheme itself... not= can be not_EQ___
13:55danlarkinor something like that
13:55danlarkinswap! == swap_BANG
13:55rhickeyuser=> (clojure.lang.Compiler/munge "not=")
13:55rhickey"not_EQ_"
13:56rhickeyuser=> (clojure.lang.Compiler/munge "swap!")
13:56rhickey"swap_BANG_"
13:56rhickeyuser=> (clojure.lang.Compiler/munge "instance?")
13:56rhickey"instance_QMARK_"
13:56rhickeysolved problem
13:56danlarkinthere we go, that's got my vote
13:59bOR_rhickey 127000 living: 888 infected: 865
13:59bOR_ok. sim now happily runs past 126600
13:59rhickeywoo hoo
13:59bOR_you nicely spotted the problem from my description
14:00rhickey:)
14:05RSchulzhttp://clojure.org/other_functions page led me to (partial ...) ... So, how is partial application different from currying? Where might one learn such things? Google's not helping...
14:07Lau_of_DKHas anyone made a really easy script for updating clojure+clojure-mode+swank-mode all in one?
14:08danlarkincd clojure-dir && svn up && cd clojure-mode-dir && svn up...
14:08danlarkin:-)
14:10ChouserRSchulz: my (weak) understanding of currying is such that 'partial' provides explicit currying.
14:15RSchulzChouser: Thanks. Does that suggest that Clojure's (partial ...) is a misnomer? Or that Clojure as a language negates the distinction between the two concepts?
14:17Chouserare the concepts distinct?
14:17RSchulzFolks in the Haskell world seem to think so.
14:18Chouserok, I think I'm my lack of knowledge about currying is showing.
14:18RSchulzhttp://lambda-the-ultimate.org/node/2266 for example.
14:19RSchulzBut I doubt I know more than you about this stuff.
14:19Chouserwith a bit of reading it looks like if you curry a function, you get a new one that can take some args but if it's not complete you get a new function instead of the final result.
14:21gnuvinceFrom my understanding, currying is when *all* functions take just one argument and multi-arg functions are actually a function that returns a function that returns a function...
14:22RSchulzOK. I guess I can see the distinction there.
14:23RSchulzI was thinking, one is about function composition, the other about a kind of "placeholder" function that keeps and supplies a fixed set of arguments. I guess that's consistent.
14:23Chouserman. Python resolutely refuses to evaluate my clojure forms.
14:23gnuvinceHow surprising
14:25Chouserif my understanding of currying is correct (now), then for curry to work it has to know how many arguments the real function wants, while 'partial' doesn't.
14:25gnuvinceCurrying knows how many arguments a function wants: one.
14:26gnuvincetake 3 [1,2,3] in Haskell is interpreted as (take 3) [1,2,3] where (take 3) returns a function that takes one argument
14:27gnuvinceSo if a Haskell function takes "4" arguments, it will accept to be passed none, one, two, three or four arguments.
14:27rhickeya curried function is one that, when called with fewer than ll of its args, returns a partially applied version of itself, i.e. if + were curried: ((+ 1) 2) == 3
14:28rhickeypartial is not currying, in that it doesn't curry a function
14:29rhickeyif Clojure had curry, then (((curry +) 1) 2) == 3
14:30RSchulzSo currying applies to functions per se and in isolation, while partial application applies to functions and (some of) their arguments.
14:30rhickeybut variadics mess with currying pretty bad
14:30Chouserand in that case, 'curry' would have to use knowledge of how many args + wants, in order to know when to return a partial function vs. when to call +
14:30rhickeythe above presumes binary +
14:30RSchulzDo what prolog does, and tack on the arity as an implicit name suffix.
14:30Chousergak
14:30RSchulzSo there aren't any variadic functions.
14:30RSchulzIn reality.
14:31RSchulzJust a punning scheme.
14:31ChouserRSchulz: probably doesn't handle infinite lazy args, though, eh?
14:31RSchulzProbably not...
14:32RSchulzOK. Well, thanks for the information. Some of the fog has cleared.
14:32rhickeysvn 1185 - added release-pending-sends
14:33rhickey(just call me clojurebot)
14:33RSchulzHas anyone heard from hiredman today?
14:34duck1123rhickey: botsnack
14:34rhickeycrunch
16:14duck1123Does anyone know if that *compile-path* bug could also possibly cause classpath issues where a class is compiled, jarred, then moved to a different location?
16:15duck1123I'm getting a class not found error on a class that's in another jar in the same directory as this jar. $CATALINA_BASE/lib
16:21Lau_of_DKI just upgraded to the latest REV of Clojure, and upon starting the Repl, I get this error, then the Repl proceeds
16:21Lau_of_DKuser=> Exception in thread "Call-on-write Stream" java.lang.RuntimeException: java.lang.IllegalArgumentException: No matching method found: sleep for class java.lang.Class
16:21Lau_of_DK at clojure.lang.AFn.run(AFn.java:42)
16:21Lau_of_DK at java.lang.Thread.run(Thread.java:619)
16:21Lau_of_DKCaused by: java.lang.IllegalArgumentException: No matching method found: sleep for class java.lang.Class
16:32karmazillaLau_of_DK: the repl started from clojure.main seems to work
16:32hoeckLau_of_DK: your're using slime??
16:33Lau_of_DKYes sir
16:33hoeckhad the same error a few days ago, they are calling (.sleep Thread) instead of (Thread/sleep)
16:33Lau_of_DKoh ok
16:34hoeckdon't worry, this happens upon startup, maybe to wait for slow emacsens
16:34Lau_of_DKOk, I'll leave it then
16:34hoeckor pull a new swank clojure version
16:34Lau_of_DKI just did, its all brand new
16:36hoeckaha, well, i fixed it myself to ged rid of this errormessage
16:36Lau_of_DKI'll just leave it, it causes no trouble
17:04lisppaste8drewr pasted "str -> var" at http://paste.lisp.org/display/72589
17:05drewrHow can I eliminate having to specify *this-ns* here?
17:06Lau_of_DKYou're asking how to query the name of the currently used namespace ?
17:06hiredman*ns*
17:07drewrWhat if you call str->var from foo.quux?
17:08drewrLau_of_DK: Yes, but the one the fn is bound in.
17:09hiredmanI not 100% (no clojure repl running) but I think namespace stuff is included in the metadata
17:09hiredmanI am not
17:10Lau_of_DKdrewr: Using a macro you can toggle it with ~
17:10Lau_of_DKSo using ~ it will also be bound in the namespace where first call, w/o it will be dynamic, if I understood that operator correctly
17:10Lau_of_DKThat is, if you call your macro from some defined function
17:11hiredman(def kludge)
17:11hiredman(:namespace (meta #'kludge))
17:11hiredmaner
17:11hiredman(:ns (meta #'kludge))
17:12drewrIs it really this obscure to call a function from a string?
17:13hiredmanyes
17:13drewrThen why does every other dynamic language I've worked with make it trivial?
17:14Lau_of_DKGet Rich on the line, he'll have to explain himself
17:14danlarkindrewr: how is it any easier in python
17:15danlarkingetattr(module,'function_name')()
17:15danlarkinthat's basically equivalent to what was pasted
17:15drewrdanlarkin: I can dispatch getattr without having to know the name of the module or class.
17:17danlarkinhow do you need to know that here?
17:17drewrThat's my question. How do I do it otherwise?
17:17hiredmandanlarkin: he wants the strings to call functions from a specific namespace
17:18drewrWhy can't find-var search the enclosing ns first?
17:18danlarkin(defn getattr [ns, name] (find-var (symbol (format "%s/%s" ns name))))
17:18danlarkinoops ignore that comma, was thinking in python
17:18drewrdanlarkin: How do I know what to pass in for ns?
17:18drewrClojure doesn't care. :-)
17:19drewr(about the comma)
17:19danlarkinbut in python how do you know what to pass for the first arg of getattr?
17:19hiredmanI think you two are having a failure to communicate
17:20drewrdanlarkin: I can pass in self, for example.
17:20hiredmanit is kind if funny to watch
17:20danlarkinprobably my fault, I will admit
17:20drewrI don't have to care that self is an instance of Foo.
17:21danlarkindrewr: so you would like a getter function that works on namespaces and java classes, is that it?
17:21hiredmanhe has a name space "foo" and would like his function to call functions in the namespace "foo" even if it is called in another namespace
17:22hiredmandrewr: does that sound correct?
17:22drewrhiredman: Yep.
17:23hiredmanso you could just hard code the namespace part, bacause you hardcode the namespace in the top of the file anyway
17:23hiredmanor you could do the kludge thing I mentioned
17:23danlarkinah, and *ns* will be user (for instance) and not org.drewr.foo
17:23drewrdanlarkin: Yes.
17:24hiredman(def kludge) (:ns (meta #'kludge))
17:24hiredmanit maybe be more idiomatic these days to use something like (declare ...) for that
17:26drewrhiredman: OK, now I see what you mean.
17:26drewrOf course, now I have to duplicate the name of #'kludge :-)
17:27hiredmanmazal tov
17:34Lau_of_DKhiredman: Are you planning to implement a seen? function in the bot? So I could say seen chouser? And I'd say Chouser was last active 5 hours ago
17:34Lau_of_DKOr seen rhickey? and It'd say Rich was last online 2 hours ago, something like that?
17:34hiredmanthat would be nice
17:36hiredmanthere are many features the bot needs
17:38danlarkinhiredman: have you made it a proper github project yet?
17:38hiredmanno
17:38hiredmanlazy lazy man that I am
17:39danlarkinclojurebot: hiredman?
17:39danlarkin<clojurebot> hiredman has too much free time
17:41hiredmanthe machine that runs clojurebot is in pieces on the floor
17:41hiredmana hard drive died so I need to rebuild it
17:41Lau_of_DKrebuild it = ?
17:42hiredmangot the new drives last night
17:42hiredmanwell the data drive is fine
17:42hiredmanthe drive with the OS on it is toast
17:43danlarkinah I was wondering where clojurebot ran from
17:44Lau_of_DKhiredman: I think keeping /home on a seperate partition/drive saves alot of headaches when having to 'rebuild', then it only takes ~10 minuz
17:46hiredmanit runs on a webserver that I thought was in southern washington, but when it died I found it was here in seattle somewhere
17:48danlarkinbut now is on your floor?
17:48hiredmanat home :P
17:52karmazillaso... clojurebot is built on a solid foundation of wooden planks?
17:54hiredmancement covered some kind of padding with carpet on top, I believe
17:55hiredmanthere are wooden planks around, but not in, on, or constrituting the floor
18:03Chousukecan't you use resolve to find a var?
18:05Chousukeyou could use (resolve (symbol string)) and if the string is unqualified it'll find the var using the normal resolution rules; and same as find-var for qualified symbols
18:09hiredmanyeah, but he wants his function (call it A) to call functions in the namepsace that A is defined in
18:09hiredmannot the namespace A is called from
18:09hiredmanwell
18:10hiredmanwait
18:10hiredmanI dunno
18:10hiredmanand no repl
18:10hiredman*sigh*
18:12Chousukethat happens by default, doesn't it.
18:13ChousukeI guess if you want to look up fns by strings you might get the wrong functions :/
18:13hiredmanyes, but function A actually takes a string and creates a new symbol
18:16danlarkinI like the #'kludge method
18:16danlarkinit's a kludge for sure, but a pretty good one
18:16hiredmanI need to start using the word "kludge" more often
18:17yldophmm is jdbc an ORM?
18:17hiredmanNo.
18:17Lau_of_DKWhat is kludge?
18:17yldopbut it abstracts away the specifics of the database you use...
18:17hiredmana navy term from what I hear
18:18hiredmanhttp://en.wikipedia.org/wiki/Kludge
18:18danlarkinhttp://www.ccil.org/jargon/jargon_26.html#TAG1000
18:18yldopif i write a wrapper for jdbc like: (defn make-table [name & vars]...), is that an orm?
18:18hiredmanugh
18:18hiredmanI was just going to say "I am sure it must be in the jargon file"
18:19Lau_of_DKIs it clojure-mode which handles highlighting in emacs or are there other modes infererring?
18:19hiredmanyldop: ORM -> Objec Relational Mapping
18:20hiredmanunless you are mapping objects to a relational database, you are just muddying an already muddied term
18:20yldoplol
18:21yldopso is there some fancy term for wrapping sql-queries in a langauge
18:21RSchulzLINQ?
18:21hiredmandatabase abstraction
18:22Lau_of_DKyldop: You and I are working on the same project essentially
18:22hiredman"glazing over shit"
18:22yldopLau_of_DK: are you working on the contrib-sql?
18:22hiredmannot that I would call sql shit mind you
18:23Lau_of_DKyldop: No, Kotarak and I started our own ClojureQL on Github, which is Sql queries as higher order functions, seamlessly integrated in your lisp code
18:23yldopi made/make my own simple wrapper over derby/jdbc
18:23Lau_of_DKcool, got it posted anywhere public?
18:23hiredmanLau_of_DK: url?
18:23yldoplau: address?
18:23Lau_of_DKhttp://github.com/Lau-of-DK/clojureql/
18:23yldopno mine is very small, not that much to it yet
18:24yldopmaybe i better contribute to yours
18:24Lau_of_DKWe are also just booting, but we have basic functionality working now, like (sql (query [developer id] table_developers (= id 15)))
18:24Lau_of_DKThat will query as SELECT (developer, id) FROM table_developers WHERE id = 15
18:24hiredmancute
18:25hiredmantake that, read table griefers
18:26RSchulzNever forget http://xkcd.com/327/
18:26hoeckhey, i have (select (project table-developer '(id developer)) (= id 15))
18:29danlarkinI bet you can make jdbc handle escaping for you
18:29danlarkinyou want to parameterize your SQL queries, makes them (much) faster and safer too!
18:30Lau_of_DKdanlarkin: Can you give an example
18:31RSchulzCheck out the XKCD!
18:31Lau_of_DKAlright already :)
18:31RSchulz"Little Bobby Tables" I still laugh every time I read that one.
18:31Lau_of_DKRSchulz: HAHAHAA
18:31hoeckxkcd rules :)
18:32Lau_of_DKThats the funniest ever, naming your kid after an SQL injection
18:33danlarkinLau_of_DK: well for instance in python I can do cursor.execute("select * from users where name = 'dan'") or cursor.execute("select * from users where name = %s", ('dan',))
18:34Lau_of_DKOh ok, thats what were going for, ultimately to use dynamic statements including math/clojure code
18:34RSchulzIs the notion of a Prepared Statement a JDBC thing or an SQL thing?
18:34danlarkinthe second is a parameterized query, the database can say "Oh, I am going to get a lot of queries where only the %s will change so I can make this faster" versus having to parse the whole statement each time it gets the query
18:35danlarkinRSchulz: it's an SQL thing
18:35danlarkinRSchulz: that is to say, it's not part of the SQL specification or anything, but it isn't limited to JDBC
18:36RSchulzOK. So it's available in any decent SQL access library. I would never consider constructing queries by string synthesis.
18:37danlarkinRSchulz: right... not only is it much harder to guard against SQL injections that way but it's also way slower for hot queries
18:37RSchulzWin/Win vs. Lose/Lose. Isn't that what's called a "no-brainer?"
18:37danlarkinJeff Atwood (I'm not a huge fan, but when he's right he's right) has a good short explanation, http://www.codinghorror.com/blog/archives/000275.html
18:38ChousukeLau_of_DK: I noticed one of the clojureql functions has a misspelled name. patch to fix: http://www.modeemi.fi/~oranenj/typo-fix.patch
18:38Lau_of_DKThanks Chousuke
18:38Lau_of_DKMy kinda guy
18:38Lau_of_DK:)
18:39ChousukeI kind of wanted to do my own fork of that thing and have you use git to merge my clone, but that would've been overkill :P
18:39Lau_of_DKhehe, yes it would :)
18:39Chousukeeven though it would've taught me how to do such things with github
18:40Lau_of_DKGit has some great tutorials online
18:40Chousukeyeah, I've read through them
18:42Lau_of_DKhehe
18:42Lau_of_DKI hope people can see the fun in all that truth
18:44RSchulzYou mean the spelling error?
18:44RSchulz(OK. Typo.)
18:45Lau_of_DKArent language-wars encouraged anymore?
18:45karmazillaRSchulz: you mean the I CAN HASMAP ;p
18:46RSchulzYes. That's the one.
18:46Lau_of_DKHehe
18:48karmazillaLau_of_DK: I thought language war => mock the VB people. Also, DataSource > DriverManager.
18:49Lau_of_DKLanguage wars are usually incredibly boring, but somehow making fun of the python-crowd just never gets old
18:49danlarkinI really like python :-/
18:50Lau_of_DKThe language itself has some pros, but it just draws an unfortunate crowd, hence the IQ joke in the docs
18:50bOR_I liked ruby, but I grew out of it, it seems.
18:50Lau_of_DKIve seen sooo many posts on various code-forums like "How can I best design this OOP structure in C++" and the first 3 replies will be something like "Well, you should code it in Python bla bla", and it just gets old real quick
18:51bOR_eventually, you head for a lisp-thing :)
18:52Chousukelisp people will just mutter something about OOP and chuckle.
18:52Lau_of_DKmaybe...
18:52bOR_at one point in time, the model that now is also in clojure was in ruby.. and was full of objects.
18:52bOR_dropping all the structure saved soo much time and code.
18:52Lau_of_DKI just see a real problem, when the #1 criteria for choosing a given language, is the fact that you cant figure out C and you think PHP is too complicated... But that might be a way too broad generalization :)
18:52bOR_the middle way was that I did leave the host class in there.
18:53bOR_but could just as well have done it with a single array being the host object ;).
18:54bOR_I don't think I want to figure out C anymore. Coded in it for my masters, partially ported the model to it during my phd before I lost the motivation to do so.
18:54bOR_hooked onto arc for half a year or something.
18:54bOR_didn't like the absent dictator thing,
18:55bOR_and headed for clojure :).
18:55bOR_it is sort of nice to work parttime by choice, so that you've time to muck around looking at other languages and things.
18:55danlarkinI feel bad for the poor programmers pg hooked on to arc with his lofty statements and failure to deliver
18:55danlarkin*BURN*
18:55bOR_nah.
18:55bOR_everybody has a free will.
18:56Lau_of_DKdanlarkin: What is really that bad?
18:56bOR_at least, I spend some time coding another pet project in arc.
18:56bOR_Lau - this one was the bad thing for me.. lemme drag it up.
18:58danlarkinwell it's just that if anyone else had "released" what he did they wouldn't have gained much attention at all
18:58bOR_can't find it.. don't want to read through the whole thing
18:58danlarkinbut a lot of people respect and trust him so they tried to improve it
18:58danlarkinbut then he kinda... gave up?
18:59bOR_sort of.. he just comments once every 2 months.
18:59bOR_and is just putting almost no effort into it.
18:59bOR_people try to improve on the language, but get no feedback.
18:59Lau_of_DKSounds sad
18:59Lau_of_DKWhat he planning to deliver a boat load of libs himself ?
18:59bOR_that's the post I'm trying to recover.
19:00bOR_he's planning to have a decent language in about 10 years or so.
19:00bOR_so he's not in a hurry.
19:00danlarkinhis "100 year language" thing is what gets me
19:00danlarkinto me it's just an excuse to shrug off the difficult thing about building a new language
19:01Chousukea language can and should be an evolving entity
19:02Lau_of_DKIm kinda glad I jumped from SBCL to Clojure :)
19:02Lau_of_DK(taking the good advice of a Python guru)
19:02bOR_clojure pops up on a lot of forums as an interesting thing.
19:02Chousukeand I think gradual evolution is especially easy if you have something simple and flexible like a lisp. the only problem setting the initial direction.
19:02danlarkinLau_of_DK: who?
19:03Lau_of_DKDavy Wybiral
19:03Lau_of_DKDavvy
19:03Lau_of_DKQuite a character, he actually wrote a Lisp wrapper for Python. Slow, but quite nice
19:04Chousukebecause once you have momentum changes are going to take time; that's why it's pretty difficult to affect common lisp or scheme anymore
19:04Lau_of_DKChousuke: Lisp is ever so simple in its construct, the deal-breaker is the libraries I think
19:05Chousukein the short term, yeah
19:05danlarkinI think having a strong leader does a lot for a language, see Python/Ruby/C# versus Scheme/CL/C++
19:06Chousukeright.
19:07danlarkinand of course Rich
19:07danlarkinclojure, I mean
19:07Lau_of_DKnetsplit?
19:08karmazillaonly you
19:08Lau_of_DKbad enough
19:22Lau_of_DKhas try/catch been changed in the latest rev?
19:23Chousukethe SVN log doesn't say anything about that. so no?
19:23Lau_of_DKbut my code broke
19:24Chousukeusing with-open?
19:24Lau_of_DKyes
19:24Chousukesome broken code may have been further broken by a certain with-open change.
19:24Chousukenamely, it now works with multiple bindings.
19:25Chousukeearlier it accepted them, but didn't work right :/
19:25Lau_of_DKhmm
19:25Lau_of_DKHow do I need to rework my code?
19:25Chousukewell, my crystal ball is an old model, so it would help if you'd paste the code that breaks :)
19:28Lau_of_DKhehe, so nasty
19:29Lau_of_DK (try
19:29Lau_of_DK (with-open [con# (DriverManager/getConnection jdbc-url#
19:29Lau_of_DK ~(:username @*connection*)
19:29Lau_of_DK ~(:password @*connection*))]
19:29Lau_of_DK ~@body
19:29Lau_of_DK (catch SQLException exceptionSql#
19:29Lau_of_DK (println exceptionSql#)))))))
19:29Chousukeuse lisppaste, please
19:29Chousukebut hm
19:30Chousukethat looks like it should work
19:33Lau_of_DKI'd say so
19:33Lau_of_DKBut it crashes with "catch is uknown bla bla"
19:34Chousukeis that from clojureql?
19:34Lau_of_DKyes
19:35Chousukeis it in the github version?
19:36Lau_of_DKIm not sure
19:36Chousukecan't find it
19:36Lau_of_DKAnd Im not in a position to push atm, so we can have a look tomorrow, Ive got to get some shuteye
19:36Lau_of_DKThen its a local thing, sorry
19:37Lau_of_DKI got, syntax error on my part, appologies for the noise
21:29joha1what is the standard clojure way of doing a switch-case structure, something like (case ...) in CL?
21:32Chouserthere's cond, condp (brand new), and clojure.contrib.fcase
21:34joha1thanks
22:48hiredmanso, if I want to deny access to a function, for example 'println', I can (binding [println nil] dowhatever) but what about for "primitives" or whatever like 'def'?
22:50gnuvince_(defmacro def [])
22:50gnuvince_wait, that doesn't work
22:53hiredmandef is not a macro
22:53hiredmandef is magic
22:53hiredman:(
22:53Chouseryes
22:53Chouseryou're not going to get around it like that.
22:53hiredman*sigh*
22:54Chouseryou do 'read' and then 'eval', right?
22:54hiredmanany suggestions?
22:54hiredmanyes
22:54hiredmanwell, this is entirely theoretical :P
22:54Chouseryou could search the tree returned by 'read' and just disallow it if any list starts with a symbols whose name starts with 'def'
22:55gnuvince_hiredman: what are you working on? an eval IRC bot?
22:55hiredmanhmm
22:55hiredmanyeah, for clojurebot
22:55hiredmanit has it
22:56hiredmanbut it should be better
22:56hiredmanand someone was able to break it using try/catch so I need to disallow those
22:56gnuvince_I guess you'll have to check all the cars (sorry, firsts) and reject the expression if there is a special form, macro or function that you don't want to allow
22:58hiredmanI disallowed try/catch by just filtering out strings that contained them, but he started trying stuff with (symbol (str "ca" "tch")) don't know if that would work though
22:58hiredmanof course I also blocked input from him by nick :P
22:58hiredmanbut he TRIED it
23:01hiredmanif I disallow eval that doesn't seem to work
23:04gnuvince_Is it just me or is tree-seq really awkward to use?
23:12danlarkinhiredman: I'm not sure it's possible, you'd have to hook in at the compiler level or something...
23:13danlarkinbecause you can't just check firsts
23:14Chouserdanlarkin: oh?
23:16danlarkinright? because of stuff like (symbol (str "ca" "tch"))?
23:16danlarkinand apply, map
23:26Chouserhm, that's a good point.
23:26Chouserbut macros and special forms can't be passed to apply or map
23:27Chouserand after you've built a symbol named 'catch' what will you do with it? you'd have to define it as a macro or pass it through eval, I think.
23:27danlarkinbut #(def % "foo") can be passed to map
23:27Chouserdefmacro and eval would both have to go first
23:28Chouser'def' is the first of a list there.
23:28hiredmanwhoops
23:28hiredmansorry, stopped paying attentio
23:28hiredmann
23:28danlarkinI don't think #() forms are iterable
23:28danlarkiner ISeq I mean
23:30Chouserit expands at read time to (fn [...] (def ...))
23:30danlarkinalthough '#(def % "foo") returns (fn* [p1__287] (def p1__287 "foo"))
23:30hiredman(-> "#(def % foo)" java.io.StringReader. java.io.PushbackReader. read)
23:30danlarkinso perhaps you can check firsts
23:30hiredman^- very instructive
23:31hiredmanI can check the data structure returned by read
23:36arbscht_Chouser: do you mind if I publish your edition of snake.clj in place of the old one?
23:37Chouserarbscht_: go right ahead. I'm not sure it's better.
23:38ChouserI replaced your nice readable :x and :y map with a vector -- sometimes that makes programs smaller, but it didn't really here
23:38Chouserrather less readable with a vector
23:38arbscht_dropped by 1 line, by my count :)
23:39Chouserheh
23:41hiredmandanlarkin: I can run tree-seq on the output of read before I send it to eval
23:46ChouserI bet this has been researched for other lisps
23:46hiredmanof course it has
23:47hiredmanman, I wish just turning on java's sandbox stuff made it all ok
23:47hiredmanbut people can still pee in the sandbox