#clojure logs

2009-01-15

03:21Lau_of_DKGood morning gents
03:31jomais there a clojure command for writing to file or i have to go to Java?
03:33yangsxjoma: clojure.contrib.duck-streams/spit
03:38jomagod
03:38jomaspit slurp etc, please stop
03:53jomaif i need to do : (if (action) then action else something_else
03:53jomahow can I write that without a let
03:54jomaand without doing the action 2 times?
03:54jomalike in python
03:54jomano not like in python
03:57rottcodd(or (action) (something-else))
04:01slevenI mean break a string and keep intendation
04:04bergermeister(first (filter apply [action something-else])
04:20AWizzArdclojurebot: max people
04:20clojurebotmax people is 127
04:21hiredman /list #clojure
04:21hiredmaner
04:58blackdogi just upgraded to HEAD and my clj script doesn't want to find my -cp classpath anymore anyone else with this?
05:09Lau_of_DKyour clj script ?
05:10blackdogmy bash starting script
05:10blackdogit hasn't changed, points to the same places
05:10blackdogi'll try going back in svn a bit see if it starts working again
05:13hiredmando you use clojure.main?
05:13blackdogyes
05:13blackdogstarted last week or so, but it's been fin
05:13blackdoge
05:14karmazillamy script works fine: http://gist.github.com/47350
05:14hiredmanhave you checked the --help output recently? the options may have changed
05:14blackdogchecking
05:48mikem`hi, is there a way to obtain the current version (ie: the SVN build) of clojure at the REPL?
05:49dhayamikem`: No way currently.
05:50mikem`dhaya: thanks. not a problem :) just wanted to double-check it's running the latest SVN
06:45mikem`i'm having trouble with chapter 9 of Programming Clojure, in the function create-snippets on page 209, create-table is not found. do I somehow need to require/use hsqldb first?
06:49dhayamikem`: create-table is in clojure.contrib.sql
06:52Lau_of_DKmikem`: Do your self a favor and get familiar with: http://github.com/Lau-of-DK/clojureql/tree/master
06:52mikem`dhaya: ok, that was easy. thanks :)
06:53mikem`Lau_of_DK: looks interesting. i'll bookmark that and take a look again when i'm doing some real work
06:53mikem`thanks
06:54Lau_of_DKnp
07:05slevenis Programming Clojure available for free as pdf or soemthing?
07:06Fibsleven: There's a beta PDF but it's not free
07:08Fibhttp://www.pragprog.com/titles/shcloj/programming-clojure
07:12mikem`Lau_of_DK: just got to a mention of clojureql in the book :)
07:44blackdoginteresting when i have clojure.jar in my -Djava.ext.dirs path, HEAD svn does not find my other classes on the -cp classpath, if I add clojure.jar to -cp too everything works fine
07:45blackdogit used to work with all the jars including clojure.jar in -Djava.ext.dirs
07:46AWizzArdAnd for me it's even more strange. In Slime I have to put everything that I already have on my classpath also into swank-clojure-extra-classpaths, because my classpath itself is completely ignored.
07:47rhickeyblackdog: "does not find" mean import doesn't work?
07:47blackdogmmm, i mention this as it was a breaking change for me
07:47blackdogyes
07:47rhickeyblackdog: what OS/JVM?
07:47blackdogimport fails when clojure.jar is in -Djava.ext
07:48blackdog(build 1.6.0_11-b03)
07:48blackdogubuntu
07:48blackdogi don't know what svn version i had that was working
07:49blackdogi probably updated about 2 weeks ago
07:49blackdogtoday it failed
07:51blackdogthat's import on other .clj files fail, clojure itself loads fine
10:01durkawhat does clojure.xml/startparse-sax do?
10:02durkait has no documentation and looks like it could call any of four methods on SAXParser
10:03durkais the idea to proxy DefaultHandler and pass that?
10:05drewolsonhey all, should the "Getting Started" page on clojure.org be updated to show launching the repl with clojure.main?
10:18Chouserdurka: the idea is to you to provide some other sax-compatible parser
10:18Chouserdurka: I use it for tagsoup
10:22Chouseras I understand it, it's currently impossible to create a class with genclass that calls its own (or its super-classes') methods when it is constructed.
10:22durkabecause genclass doesn't look for an implementation until runtime?
10:22Chouserno, because the init function is called without access the 'this'
10:23durkathat seems unhelpful
10:26jomaif i want to do something sideeffectful X times, what do I use?
10:26rhickey(doc repeatedly)
10:26clojurebotTakes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it; arglists ([f])
10:27rhickey(doc dotimes)
10:27clojurebotbindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1.; arglists ([bindings & body])
10:28ChouserI've claimed before that this is because 'init' is run before any 'this' object has been created. But upon further reflection, I don't think that's possible.
10:29ChouserSo now I'd guess that providing 'this' would be a mis-feature in some way, or that it was simple overlooked.
10:29Chousersimply
10:30waltersChouser: in the JVM the constructor is restricted to only calling code without reference to "this" before invoking the superclass constructor
10:30waltersChouser: typically though what i do in Java at least is define a private static method which does all the computation, and just call that
10:31Chouserhm, that's interesting.
10:31waltersChouser: maybe genclass could be split into pre-init and post-init?
10:32Chouserthat's what I was thinking originally. :init could be left as-is, but there could be a new :post-init function
10:32rhickeyChouser: init is called before ctor, and provides args for it
10:32Chousercalled before the super's ctor, but from inside the gen'ed class's ctor, right?
10:33Chouserthe problem is if there is stateful initialization required by the superclass for which it has only methods, not ctor args.
10:33Chouserpoorly designed superclass if you ask me, but they exist.
10:34dhaya,(if (Boolean. "false") "true" "false")
10:34clojurebot"true"
10:34dhayaThat looks like a bug.
10:34ChouserCurrently the only solution is to have a fn that you must always use to 'new' your gen'ed class, so that it can do some init after 'new'. Seems dangerous.
10:36rhickeyChouser: post-init is possible, but there's no safe-to-use this to pass to init, since the object is allocated but not yet constructed (init being one step in that construction)
10:37Chouserok. I was about to post a :post-init feature request to the issues page.
10:37rhickeygo for it
10:37durka,(Boolean. "false")
10:37clojurebotfalse
10:37durka,(Boolean. "true")
10:37clojurebottrue
10:41rhickeydhaya: any object that is not nil or Boolean.FALSE is true. Sometimes there will be a conversion for you, but if you are dealing with boxed Booleans not coming from Clojure or known to come from Boolean.valueOf, then you'll need to call .booleanValue on them
10:52dhayarhickey: Ok. I take it there is some reason that clojure itself cannot do that for me?
10:58dhayaIt also seems to me to be inconsistent with (= (Boolean. "false") false) returning true.
10:58rhickeydhaya: yes, the rest of the planet doesn't want if (and everything built on if) slowed down for that special case
10:59rhickeydhaya: is this a real problem or a theoretical one?
10:59dhayarhickey: I just stumbled on it while taking input from stdin and passing it directly to a if after boxing.
11:00rhickeyhow did you get a Boolean ?
11:00Chousereval?
11:00rhickeyyou are boing yourself?
11:00dhayayes.
11:01dhayaI was boxing myself.
11:01rhickeypublic Boolean(boolean value)
11:01rhickey Allocates a Boolean object representing the value argument.
11:01rhickey Note: It is rarely appropriate to use this constructor. Unless a new instance is required, the static factory valueOf(boolean) is generally a better choice. It is likely to yield significantly better space and time performance.
11:01rhickeypublic static Boolean valueOf(boolean b)
11:01rhickey Returns a Boolean instance representing the specified boolean value. If the specified boolean value is true, this method returns Boolean.TRUE; if it is false, this method returns Boolean.FALSE. If a new Boolean instance is not required, this method should generally be used in preference to the constructor Boolean(boolean), as this method is likely to yield significantly better space and time performance.
11:01rhickeyfrom the JavaDocs, please use valueOf
11:02rhickeythis will return Boolean.FALSE, which will test consitional false in if
11:02rhickeyconditional
11:02dhayaAh. I see the distinction now. Thanks.
11:02rhickeynp
11:03asbjxrnHow can I from an agent action run two calculations in parallell?
11:03rhickeyasbjxrn: send to 2 other agents
11:04asbjxrnbut I want to wait for them to finish before eg. adding them again, and I can't run await?
11:05Chousergot an assert, did you? :-)
11:06Chouserasbjxrn: 'send' called in an agent action is held until the action completes and the agent has gotten its new value.
11:09asbjxrnRight. So if what I want to do is ((task 1) (in parallel (task 2) (task 3)) (task 4)) How would I do that? Not sure I understand.
11:11rhickeyasbjxrn: you could write an in-parallel fn using executors and futures, a la: http://clojure.org/concurrent_programming
11:12ChouserI guess you'd have to use something other than agents or await for one of thse steps.
11:13Chouseryour main task could be a regular Thread instead of an agent, or task 4 could wait on some blocking object rather than using 'await'
11:13asbjxrnBut they're so nice. :)
11:16Chouserwould pmap be appropriate for tasks 2 and 3?
11:16asbjxrnThat test-stm function from the concurrent_programming page looks promising. Is there a lot of overhead in setting up/tearing down such a pool?
11:20Chouseris clojurebot pointing at the wrong repo? or is that feature just not working at the moment?
11:20Chouserclojurebot: latest?
11:20clojurebotlatest is 1207
11:21rhickeyhttp://code.google.com/p/clojure/source/list
11:22Chouserclojurebot: latest is 1215
11:22clojurebotAlles klar
11:22Chouserheh. hm.
11:22karmazillaclojurebot: latest?
11:22clojurebotlatest is 1215
11:36cgrandHello! format, name and namespace are not hinted {:tag String}. Do I open an issue for this?
11:37rhickeycgrand: sure
11:38cgrandok
11:53lisppaste8rhickey pasted "call-par" at http://paste.lisp.org/display/73650
11:54asbjxrn:)
11:57rhickeybetter name needed
11:57danlarkinpapply? you'd have to change it a little though
11:59rhickeydanlarkin: requiring the last arg be a seq would also require it be realized (i.e. not parallel)
12:00cgrandhmm... should force be made to work on Futures?
12:00Chousukeso it evaluates the arguments in parallel and applies op to them... hmm.
12:00rhickeycgrand: I would worry about the possibly hidden blocking
12:01Chouserpinvoke
12:02rhickeyhttp://en.wikipedia.org/wiki/Platform_Invocation_Services
12:03ChouserMmm... DLLs
12:03Chouserso yummy
12:04rhickeyI don't want MS to sue me
12:05Chouserseque only uses one worker thread.
12:05rhickeysomething indicating that the args are parallel would be good
12:05Chousukeparallel-eval-args is too long :(
12:06Chousernm, I was thinking there was more similarity between call-par and seque than there is.
12:07Chouserit could return a vector, in which case 'peval' is pretty close.
12:07danlarkinbut is that too close to peeval?
12:30sp00oonhow about simply: parallelize
12:32sp00oonI'm new to lisp & concurrent mind spaces so not sure if that has other connotations...
12:35Chousukesp00oon: that sounds like a higher order function that takes a function and returns a parallelised version of it.
12:35shoover``is it a side-effects thing? doparallel
12:37lisppaste8rhickey annotated #73650 with "pvals, pargs, using pool" at http://paste.lisp.org/display/73650#1
12:37rhickeyshoover``: no, not side effects, collecting results
12:39danlarkinit's sortof reduce-like behavior
12:42cgrandSlighty different: par-args (or par-list or par-seq or...) and (apply f (par-args (expr 1) (expr 2))?
12:52shoover``cgrand's approach seems more general. it's an apply, and the args are eval'ed in parallel. (apply f (peval a b c))
13:04danlarkinnooo not peeval
13:06rhickeycgrand: are you talking about: http://paste.lisp.org/display/73650#1 ?
13:08rhickeypvals fn, could do plist as macro, leaving applying out of it
13:11jkantzin clojure, what's the idiomatic equiv of common lisp case?
13:12ChouserI don't know CL, but you might look at cond or condp
13:21jkantzok thanks, condp will work
13:32cgrand1rhickey: I'm sorry I didn't see your annotation. pvals (fn) and plist (macro) are fine. My point was to leave apply out of teh macro.
14:28hiredmanyou guys see the "Problem using fn macro" thread?
14:28hiredmanXD
14:31hiredmanI think the reply "if this gets fixed" really makes the thread
14:35bitbckthiredman: "you're doing it wrong"
14:35hiredmanbitbckt: yeah
14:38gnuvinceThis Mark Volkmann is... weird.
14:42gnuvinceDo you guys refer to x as in (let [x 0] x) as a variable or as a binding?
14:43bitbcktgnuvince: binding
14:44bitbcktas in, "x is locally bound to..."
14:45gnuvinceThanks
14:46gnuvinceWhen I speak of Clojure (or Haskell for that matter) to people used to languages like C or Java, they always ask "why is it called a variable if it can't change?"
14:46gnuvinceI just realized that binding is probably a better term that would also be less confusing
14:46bitbcktI think it's easier when discussing such things with them to use "variable."
14:46bitbcktthat's the term their used to
14:47bitbcktbut binding is more accurate, I think
14:47gnuvinceBut like I said, they buck at the "you can't modify it?" part
14:47bitbcktyeah... that's a pain ;-)
14:47rhickeygnuvince: I've been saying a "local"
14:48bitbcktrhickey: that's a solid alternative
15:01drewrHow do you get to a static member in an inner class?
15:01walters$
15:01drewrFoo$Bar/baz => No such namespace: Foo$Bar
16:00danlarkindrewr: you have to import Foo$Bar
16:00danlarkinsorry for being an hour late
16:01drewrdanlarkin: Yeah. Strange that having the package doesn't work for me. E.g., clojure.lang.LispReader$RegexReader/stringrdr
16:04Lau_of_DK /query chouser
16:16Lau_of_DKAnybody know what the maximum filesize is, that I can upload view a HTML-form ?
16:18danlarkindepends on the server
16:18danlarkinI think
16:18danlarkinwhich probably means it doesn't depend on the server, since I seem to be wrong more than right
16:19drewr:-)
16:21Lau_of_DKHmmm Dan :)
16:21Lau_of_DKSo its a matter of setting some MAX_FILE_SIZE var somewhere, and then its up to the server after that?
16:39grosourshi
16:39Lau_of_DKyo
16:40durkaLau_of_DK: are you using apache?
16:40Lau_of_DKYep
16:41durkaas i remember there is max_file_size, but also max_upload_size and max_post_size
16:41durkasince files are uploaded by POST requests
16:42Lau_of_DKThere is - I just couldnt work out if the system gave an upper limit - which I think it does, just dont know what that is
16:46stuhoodhey gang
16:46Lau_of_DKHey Stu
16:47stuhoodis it necessary to add type hints to the 'this' parameter for functions used in gen-class?
16:47danlarkinhints are never necessary :)
16:48danlarkinAlthough! going by the rule I've set out, they are indeed necessary
16:48stuhoodhaha
16:49hiredmanLau_of_DK: clojureql do postgres yet?
16:49Lau_of_DKhiredman: I suspect that it does, but I have not tested yet.
16:54danlarkinLau_of_DK: how's the create-table stuff handled, since there's :mysql and :sqlite specific handlers
16:54Lau_of_DKsqllite doesnt have type for columns, it has types for cells
16:55Lau_of_DKMysql, postresql, mssql all have one type per column
16:55danlarkinah mmhmm
17:00stuhoodthe trouble i'm running into with hints is that if you hint the 'this' parameter, the compiler cannot find the class definition, since it hasn't been gen-class'd yet... chicken and egg?
17:01Chouserthat's not right. The class fully exists before you get to the method function definitions.
17:01stuhoodi'm declaring the functions before executing gen-class... is that wrong?
17:01hiredmanpostgresql's alter table has a slightly different syntax than what clojureql is generating
17:01Chouserdoesn't mean the classname is imported yet though -- have you tried using the full package and class name.
17:02stuhoodyes, full package and class name
17:02Chouserstuhood: oh, yep. that's backwards. (ns my.package.fooclass (:gen-class ...)) (defn -mymethod ...)
17:02stuhoodgotcha. because gen-class is just creating stubs, right?
17:02stuhoodcool beans... thanks.
17:03Chouseryep, the gen'd class doesn't go looking for method implementations until as demanded at runtime.
19:00rhickeyanyone on 1215 yet?
19:02hiredmanI have a jar built, but I haven't done anything with it
19:03hiredmanI think I used the 1215 jar file when I was trying to talk to postgresql with clojureql
19:17durkawhat hiredman said
19:41durka_is anyone using yourkit on a >1 cpu machine?
19:41durka_i'm trying to figure out why activity monitor reports a 2x higher cpu usage than yourkit does, for the same clojure program at the same time
19:44burkelibbeyProbably activity monitor goes up to 200% for what I presume is a Core 2 Duo.
19:44burkelibbey</guess>
19:47durka_well, it only goes up to 102% or so, but i am wondering if that is more-or-less evenly split across the core 2 duo
19:47durka_and if that was the case i would wonder why yourkit only looks at one cpu
19:52pjb3rhickey: I'm interested in learning more about how Clojure works under the hood, any recommendations on things to read to learn about the JVM, JIT, Classloaders, etc.?
19:53rhickeypjb3: I don't know that there's a single place with all this stuff - Java Concurrency in Practice is a must read, though
19:55pjb3rhickey: Yeah, I have JCIP, only read the first few chapters, I suppose I should get through that
20:00Carkhow do i replace an item in a list based on some predicate ?
20:00Carkthere must be some way
20:00durkamap?
20:01Carkmhh yes that's what i'm doing right now
20:01Carklet's say i have a list of users like this {:name "cark" :foo "bar"}
20:02Carkand i only need to change the user "cark in that list"
20:02Carkor update its value :foo from "bar" to "baz" really
20:03Carklisppaste8 : url
20:03lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
20:03ChouserCark: assoc ?
20:03Chouser(doc assoc)
20:03clojurebotassoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector).; arglists ([map key val] [map key val & kvs])
20:04Carklet me prepare an example =P
20:05Chousersure
20:07lisppaste8cark pasted "untitled" at http://paste.lisp.org/display/73679
20:08Carksee the map form, i wonder if there is some library function to do that
20:09Chouserdo you always look things up by :name ?
20:09Carkwell in this case yes
20:10Chouseror to head in a different direction, are your hashes unique and their order in the list unimportant?
20:10Carkbut this cold be a more general function
20:10Carkthe order in the list is important
20:10Chouseryeah, I think it's not all that "general" anymore, but we may be able to tighten up that example a bit...
20:11durkaperhaps an "assoc-if"?
20:11Carkah that sounds promising =P
20:12durkai wasn't saying that exists, i was suggesting that someone write one :p
20:12Chouserbut that really assumes an ordered seq of hashes -- not something I've seen very often.
20:12durkawell, isn't that what defstruct is designed for
20:12durkawhich would imply that it is expected
20:13Carkwhat i'm using it for : i have a list of column in a csv file, and the cv-import stuff needs to assign column numbers with field names
20:13Carkcsv-import
20:14Chouserdurka: structs are just maps, and maps are supported. There's a library of functions to work with unordered sets of maps, but not ordered seqs of them.
20:14durkai see
20:14Carkanyways if you guy can't tell me about this function, that means it doesn't exist, and it's trivial to write one ...thanks !
20:15Chouserhm, and since the list itself changes, we can't use an array-map.
20:17Chouser(map second (vals (assoc-in (zipmap (map :name users) (indexed users)) ["rick" 1 :foo] "baz")))
20:17lisppaste8durka annotated #73679 with "untitled" at http://paste.lisp.org/display/73679#1
20:18durkaeek
20:18Chouserhm. durka's is better than mine.
20:18durkabut pretty specific to this example
20:19durkayours looks like it adds a lot of complexity, but maybe because i don't know what a zipmap is
20:19Chouseryeah, just a failed approach.
20:19Chouserhm, not even correct. It needs a 'sort' in there somewhere. skip it.
20:20Chouserdurka: your solution is better in every way
20:20durkai think the more general answer to this question is "sql"
20:20Chouseror would be if at least one of the argument names wasn't a builtin function.
20:21durkaactually all of them are
20:21durkai think
20:21Chouseryeah, I know. don't do that.
20:21Chouser,[test map key val]
20:21Chouser,(prn [test map key val])
20:21clojurebot[#<core$test__4053 clojure.core$test__4053@1fd9b49> #<core$map__3371 clojure.core$map__3371@fee225> #<core$key__3235 clojure.core$key__3235@c57f88> #<core$val__3238 clojure.core$val__3238@de6570>]
20:22durkaof course, core/assoc names it params map/key/val too
20:22Chousershame on it, too, then. :-)
20:29lisppaste8cark annotated #73679 with "untitled" at http://paste.lisp.org/display/73679#2
20:29Carkthere you go !
20:30lisppaste8Chouser annotated #73679 with "map-if" at http://paste.lisp.org/display/73679#3
20:30Chouserhey!
20:31ChouserI still screwed up the usage, though. sheesh.
20:32Carkahyes, stay consistent put the coll param at the end
20:38Chouserwell, if there's a simpler approach, I'm not seeing it.
20:38Carkyep that's good enough =P
20:38Carkthanks !
20:45Chouser(assoc-in (vec users) [((apply hash-map (mapcat reverse (indexed (map :name users)))) "rick") :foo] "baz")
20:47Carki'm not sure i would understand the meaning of that after a couple of days
20:47Carkor minutes even
20:58durkaso we take the names out, number them in order and reverse those so there is a list of name/number pairs. then flatten that out with the mapcat so there is a list of name, #, name, #, etc. we make a hash-map out of that, which is keyed by names and valued with numbers, and then look up "rick" to get the index of rick's record in the original list. with that index in hand, we create a vector (which is like a hashmap from indices to s
20:58durkawell, now i understand it
20:59lisppaste8Chouser annotated #73679 with "indexed seq" at http://paste.lisp.org/display/73679#4
20:59durkanot sure my brain dump is coherent for anyone else
20:59Chouser:-)
20:59Chouserdurka: you got it.
20:59durkadoes that end up turning the original list into a vector
21:00durkaor does assoc-in return a list
21:02Chousera vector
21:03Chouserso, not strictly the same as the rest.
21:03ChouserAll these are making the original change-rick-to-baz look pretty good. :-)
21:03durkaheh
21:08Carknow i'll feel responsible for any delay in textjure =(
21:18Chouserheh. no, I'm pretty sure I'm resposible for any dealys in textjure.
21:48danlarkinle sigh
21:49danlarkinCaused by: java.io.FileNotFoundException: Could not locate calliope/conf/urls__init.class or calliope/conf/urls.clj on classpath
21:49danlarkinbut it _is_ on my classpath
22:00danlarkinHm. very tricky, it was running with -Djava.ext.dirs
22:00danlarkinI guess changes how classpath look ups work? who knows
22:01durkathat's strange...
22:01durkaclasspath magic is black magic indeed
22:02KevinAlbrechtI have a program which uses "require" to include another clojure file, but when I use (load-file) from the Repl, it won't load the required file... what's the solution?
22:04danlarkinKevinAlbrecht: what's the exception it throws?
22:04danlarkinlikely the file isn't on your classpath
22:04durkasounds like the opposite problem
22:04durkaif require works
22:04KevinAlbrechtIt throws a not on classpath exception
22:05danlarkinoh, right.. wait so which one works, KevinAlbrecht, require or load-file?
22:05KevinAlbrechtAh, I get it now... so you need to add the current directory to your classpath
22:06KevinAlbrechtrequire works when I'm running the program as a script, but when
22:06KevinAlbrechtI load the program on the Repl, the require fails
22:09KevinAlbrechtthanks, danlarkin
22:10KevinAlbrechtI really hate classpath nonsense
22:11durkait seems like a great idea -- you just import packages, and java translates the names into directories and magically finds the class files
22:11durkabut... it doesn't seem to work in practice
22:12durkait's the portable equivalent of dll hell
22:12banisterfiendYo dawg, I heard you like recursion so we put a Yo dog, I heard you like recursion so we put a Yo dog, I heard you like recursion so we put a Yo dog, I heard you like recursion so we put a Yo dog...
22:13durkaStackOverflowError
22:14durkaat: net.freenode.irc.clojure
22:14durkaCaused by: banisterfiend
22:15banisterfiendhehe
22:15durka... ? more
22:16durkabut apparently it is option-5
22:16danlarkin?
22:16danlarkinoooo
22:16danlarkinfun
22:16banisterfienddo you know of any programming langauges that use unicode in their keywords etc?
22:16banisterfiendi heard some functional languages are thinking about using an actual lambda symbol
22:16danlarkinfortress
22:16danlarkinGuy Steele's new language
22:17hiredmanbanisterfiend: there is a hack where you can use '?' for 'lambda' in ruby
22:18banisterfiendhiredman: really? how do i find out about it?
22:18hiredmanhttp://www.oreillynet.com/ruby/blog/2007/10/fun_with_unicode_1.html
22:18hiredmanvery simple
22:18hiredman(very silly)
22:19durka,(let [? 3.14] (* 2 ?))
22:19clojurebot6.28
22:20hiredman? shoudl be a lazy seq of the digits of ?
22:20arohnerThere's a scheme hack for emacs that replaces (lambda with (<lambda symbol>
22:21arohnerit's display only, but still cool
22:21banisterfiendhiredman: is that just ruby 1.9 or 1.8 too?
22:21hiredmanbanisterfiend: 1.8
22:22hiredmandunno if it even works on 1.9
22:22banisterfiendcool
22:22banisterfiendwell proc in 1.9 is actually a Proc.new so should probably change the alias to a lambda
22:24hiredman,(let [f (? [x] x)] :a)
22:24clojurebot:a
22:26hiredmanoh
22:26hiredmanduh
22:26hiredmanthe nyquil is kicking in
22:26hiredman,(let [f (? [x] x)] (f :a))
22:26clojurebot:a
22:33hiredman,(((S K) K) :a)
22:33clojurebot:a
22:35durkaoh no not that language :(
22:40drewrdanlarkin: http://groups.google.com/group/clojure/msg/f65dd874f779b15c
22:40drewrNot sure how much that's related to your classpath issue.
22:40danlarkinahh ha
22:40danlarkininterestingk
22:42durka(defn sgn [x] (if (>= 0 x) 1 -1))
22:42durka(defn ? [n] (.doubleValue (apply + (take n (map #(/ 4 %) (iterate #(* (sgn %) (+ 2 (Math/abs %))) 1))))))
22:42durka(? 359)
22:42durka3.14437816350691
22:43durkaabove that Doubles don't cut it
22:44lisppaste8durka pasted "pi" at http://paste.lisp.org/display/73683
22:44durkaRatios seem to be rather higher precision ^
22:45durkahiredman: you may consider your ? lazy seq request beaten to death
22:45Carkhey ... (float your-very-long-number) returns NaN
22:46hiredmanthat's not a lazy-seq of digits
22:46durkaCark: yeah, float can't hold that many digits
22:46durkaabove (? 359) it does that
22:47Carkthat's the problem with not having the full numeric tower
22:47durkahiredman: true. but it is a sum of a lazy seq of the terms of 4*arctan(1) :)
22:49Carklispworks says your approximation is 3.1405926
22:49Carkbetter but not quite it yet
22:57durkais it a bug that take seems to hang on exceptions?
23:06yangsxwhat is the perl equivalent for s/ab([0-9]+)cd/[\1]/ ? I mean how to refer to the captured group in re-gsub, for instance
23:06yangsxequivalent for the Perl*
23:07danlarkinyou can use re-seq
23:07danlarkinor re-groups
23:08yangsxcan re-seq or re-groups be used in re-gsub's replacement?
23:10hiredmanyangsx: java has its own back reference syntax
23:10hiredman$1
23:12yangsxhiredman: thanks, exactly what I'm looking for. I'm very unfamiliar with Java.
23:12hiredman,(.replace "123nd" "(\\d+)nd" "$1ND")
23:12clojurebot"123nd"
23:12hiredmaner
23:13hiredman,(.replaceAll "123nd" "(\\d+)nd" "$1ND")
23:13clojurebot"123ND"
23:21durkahiredman: if lazy hexadecimal digits are satisfying enough, http://en.literateprograms.org/Pi_with_the_BBP_formula_(Python) should suffice. i don't understand it, but maybe i'll come back to it later if i'm bored again...
23:56durkaChouser: i just wrote a function with a parameter named "key", and tried to call clojure.core/key in the function, and it took me about 15 minutes to find the cause of the exception
23:57durkaso there i am
23:57durkalet this be a lesson to me
23:59Chouser:-) yes