#clojure logs

2010-06-20

00:47defntrptcolin: thanks
00:48trptcolinnp
00:48defn#question: How can I split a string at the occurrence of a character?
00:48defnfor instance: "foo," => "foo" ","
00:54technomancy,(seq (.split "hey,there" ","))
00:54clojurebot("hey" "there")
00:54technomancyit gets rid of the seporator
00:55defnyeah, i want to keep the separator
00:55technomancycould use interpose
00:55defnoh yeah! thanks
00:56technomancysure
00:56defnerr damn, still not gonna do it for me im afraid
00:56defnI need to have something that will go across: ["foo" "bar," "baz!"]
00:57defnand give me ["foo", "bar", ",", "baz", "!"]
00:57DarthShrinedefn: re-partition?
00:57defnyou guys are saints
00:57defnthanks
01:10defntrying to write me first markov :X
01:10defns/me/my
01:10defn$s/me/my
01:10sexpbotCommand not found. No entiendo lo que estás diciendo.
01:11DarthShrineHah :)
01:11defnI'm probably going about it completely wrong
01:12defnfor instance using str-utils and company when I should probably be composining words from groups of chars
01:12defnthis thing will tank on any sufficiently large input
01:17defnbah im doing this all wrong
01:43defnahh, there it is
01:47DarthShrineWhat is where now?
01:47defnheh, just saying "ahhh, now i see what i was doing wrong..."
01:47defnMy First Markov(tm)
02:52DarthShrineYou are.
04:06LauJensenMorning all
04:07DarthShrineMorning LauJensen
04:07LauJensenDarthShrine, welcome to Clojure :)
04:07DarthShrineThanks :)
04:29MoominpapaStill wrestling with labrepl on Windows.
04:29MoominpapaI've managed to get to the following command line:
04:29Moominpapahttp://pastebin.com/kwus6Vdi
04:29MoominpapaWhich at least boots.
04:29MoominpapaBut when I run it, I get:
04:29Moominpapauser=> (require 'labrepl)
04:29MoominpapaWARNING: spit already refers to: #'clojure.core/spit in namespace: compojure.enc
04:29Moominpapaodings, being replaced by: #'clojure.contrib.duck-streams/spit
04:29MoominpapaWARNING: spit already refers to: #'clojure.core/spit in namespace: compojure.htt
04:29Moominpapap.helpers, being replaced by: #'clojure.contrib.duck-streams/spit
04:29MoominpapaWARNING: spit already refers to: #'clojure.core/spit in namespace: compojure.htt
04:29Moominpapap.request, being replaced by: #'clojure.contrib.duck-streams/spit
04:29Moominpapajava.io.FileNotFoundException: Could not locate clojure/string__init.class or cl
04:29Moominpapaojure/string.clj on classpath: (util.clj:1)
04:30MoominpapaThe warnings don't both me. The absence of a string class does... :)
04:41Chousukeyou probably need to use 1.1 of Contrib and Clojure
04:50MoominpapaSadly, that doesn't work for other reasons...
04:51MoominpapaEqually, IntelliJ gets further, but then it turns out it's destroyed the windows environment variables so can't start the web server.
04:52LauJensenAh I remember when I was a young pup, attempting to be serious on Windows... :)
04:52Moominpapalol :)
04:54DarthShrineHeh :)
05:13vIkSiThello all
05:13vIkSiThey Chousuke
05:13vIkSiTaround?
06:01DarthShrineHmm, lein repl is being crazy slow o.o
06:03LauJensenDarthShrine: I recently heard of a bug being ironed out in lein repl- Ive never used it myself
06:03DarthShrineLauJensen: Ah, thanks.
06:04DarthShrineThe repl is doing stuff like hanging on (doc foo)
06:07LauJensenYou could clone the lein repo and build it yourself, though I always just run such projects via M-x swank-clojure-project - never had any bugs or breakages that way
06:08DarthShrineI'm not an emacser.
06:10LauJensenOk - You could become one in a few minutes though if you want - I have a few blogposts on getting up I think
06:12LauJensenDarthShrine: Or check this out http://www.assembla.com/wiki/show/clojure/Getting_Started
06:12LauJensenThere are guide for all IDEs
06:12LauJensens/guide/guides/
06:13DarthShrineYeah, I have a vim + screen setup on another computer. Wanted to try lein so I didn't have to install Clojure manually.
07:20ragnardHello folks
07:21ragnardQuestion: I have two vecs, one with functions, one with their arguments. How do I apply the list of functions to the list of arguments in the most functional manner?
07:21ragnardie: [identity inc] and [1 1] would give [1 2]
07:22hoeck,(map #(%1 %2) [identity inc] [1 1])
07:22clojurebot(1 2)
07:23ragnardhoeck: Thank you. Very simple, of course... :)
07:24hoeckragnard: thanks to clojure for being so simple :)
07:33AWizzArd,(.getBytes "0;0;abcde")
07:33clojurebot#<byte[] [B@ff8839>
07:33AWizzArd,(vec (.getBytes "0;0;abcde"))
07:33clojurebot[48 59 48 59 97 98 99 100 101]
07:34AWizzArd,(vec (.getBytes "0;0;abcde" "LATIN1"))
07:34clojurebot[48 59 48 59 97 98 99 100 101]
07:34AWizzArd,(vec (.getBytes "0;0;äöü" "UTF-8"))
07:34clojurebot[48 59 48 59 -61 -92 -61 -74 -61 -68]
07:34AWizzArd,(vec (.getBytes "0;0;äöü" "LATIN1"))
07:34clojurebot[48 59 48 59 -28 -10 -4]
07:35LauJensenAWizzArd: Just in case you didnt know, the same works in a query with clojurebot
07:35AWizzArdindeed, I did not know this
07:35AWizzArdthx
07:35AWizzArdBut in this specific case I wanted to show these results to someone else ;)
07:36LauJensenSure - Its not causing any problems when there's no chatter and I personally enjoy seeing other peoples experiments as well :)
07:37AWizzArdThe thing is that it seems that such very small strings eat 50 bytes in memory or so
07:37LauJensenyea, Java spends 2 bytes per 1 byte of data, keeping charset info
07:38LauJensenI hit that wall when I did the Global Warming post, because on a 350Mb file, it would hog 700+Mb memory
07:38AWizzArd*sigh*
07:39AWizzArdWell, one can do in-memory-compression of strings by not storing the strings but instead their (.getBytes s "LATIN1") representation
07:39LauJensenYea thats a very simple way to work around it
07:39AWizzArdI am thinking about this because I would like to store nearly 2,5 million texts in ram :-)
07:40LauJensenhehe
07:40AWizzArdthis "trick" already got me down from about 11 GB to +/- 4 or so
08:09LauJensenAWizzArd: Would be crazy if you could get it down to -4 GB :)
08:15AWizzArdThat would be shockingly crazy.
08:21LauJensenif you could compress 11 GB into a negative number of Gigabytes - You said +/- 4 Gb... I should have known better than to attempt humor with a German
08:28Fossiwell, in german, you say "plus/minus" for "about"
08:28LauJensenAWizzArd: Oops, in my rush I read 'that would' as 'what would' :)
08:28LauJensenFossi: Yea, its the same in Danish actually
08:31JorejiAnyone here knows of a fnparse mailing list?
08:36LicenserI think our aproach at the whole number thing might be wrong, we should try to get not speed or correctness as default but speed AND correctness as default
08:38LauJensenJoreji: Not that Im aware of
08:44AWizzArdJoreji: please have a look into your private chat windows
09:08JorejiLauJensen: Hmm thanks. I'll look for an email or something like that.
09:24wlrLicenser: I refer you to the paragraph beginning "I want it to be perfectly clear..." in http://groups.google.com/group/clojure/msg/6e987f49d54db3d4
09:25Licenserwlr: I know
09:56canderaHappy Fathers Day to those in countries where it's celebrated today!
14:07Moominpapa'(->> (java.lang.System/getProperty "java.class.path") (re-seq #"[^;]+") (map println) dorun)
14:15LauJensenMoominpapa: Doesnt look much different w/w/o the regex
14:17MoominpapaHmm... I was expecting that to do more :)
14:17MoominpapaI was curious.
14:17LauJensenlike a monkey
14:17LauJensen:)
14:17LauJensenSorry, you just reminded me of a song I heard long ago, "Curious George" I think
14:17MoominpapaCuriosity killed the cat, but it's usually regarded as a positive trait in coders ;)
14:18LauJensen$(-> (System/getProperty "java.class.path") (.split ":") (->> (map println)))
14:18sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
14:18LauJensen,(-> (System/getProperty "java.class.path") (.split ":") (->> (map println)))
14:18clojurebot(nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)
14:18MoominpapaI finally got labrepl working, with the assistance of that incantation.
14:23MoominpapaI gather clojurebot doesn't redirect prn then :)
14:23Moominpapa,(seq (.split (System/getProperty "java.class.path") ";"))
14:23clojurebot("lib/maven-artifact-2.0.10.jar:lib/pircbot-1.4.2.jar:lib/ant-launcher-1.6.2.jar:lib/wagon-http-lightweight-1.0-beta-2.jar:lib/smackx-3.0.4.jar:lib/wagon-file-1.0-beta-2.jar:lib/maven-settings-2.0.10.jar:lib/jtidy-4aug2000r7-dev.jar:lib/xml-apis-1.0.b2.jar:lib/postgresql-8.2-504.jdbc4.jar:lib/lein-swank-1.0.0-20091121.091400-1.jar:lib/plexus-interpolation-1.1.jar:lib/maven-artifact-manager-2.0.10.jar:lib/clojure-json-1.1-2
14:30Blackfootis there something like eval that uses the current context to resolve symbols?
14:32LauJensenBlackfoot: Not sure, but its not a difficult macro to write out yourself
14:33BlackfootLauJensen: i see. actually, this is for a macro. i want to both print out a sequence of forms and show the result of evaluating each
14:34Blackfootbut running (eval) on the form does not resolve the symbols in it
14:34LauJensenBlackfoot: try working out from something like this
14:34LauJensen(defmacro locals [] (vec (mapcat (fn [k] [(list 'quote k) k]) (keys &env))))
14:34LauJensen(let [x 5 y 10] (locals))
14:35LauJensenI have to duck out
14:35Blackfootok, thanks
15:02revertTSso I'm considering pre-ordering Joy of Clojure; anyone read the chapters available? recommended/not recommended?
15:07LicenserrevertTS: I read some of them and I find it a very good book
15:13revertTSLicenser: would you say there's much content for people very familiar with FP and STM, but less so with the JVM and some Lisp family features (eg. macros)?
15:14LicenserrevertTS: since I was or am neither a person who falls in the category of a JVM expert nor a Lisp nor a STM expert, I can't say I found it nice to read from what I've read by now
15:19RaynesrevertTS: The book seems to address pretty much everything.
15:56mcavif anyone from Clojars is here, I accidentally created a group "com.clojars.mcav" (instead of org.clojars.mcav); that can be deleted, sorry about that
15:59technomancythere's only one guy from clojars, and he hasn't been here in months. =(
18:19LicenserOkay a poll: How many of you have seen an iPad in the wield (in a store as an example is not counting, I mean in the street in real use)
18:19revertTSI've seen 3ish
18:24seancorfieldLicenser: i've seen several, all but one used by consumers rather than techies
18:25seancorfieldmostly used for reading books / magazines (primarily) with some email / web browsing
18:25seancorfieldthe techie used it primarily for email / browsing with note taking (via Pages)
18:26Licenserseancorfield: you know you're the second person that actually caimed he saw them :P that is carry
18:26LicenserI say they doN#t really exist!
18:26hanDerPederseancorfield: how long does it take you to identify a person as a techie?
18:27revertTSthe people I've seen with them would qualify as 'techies', I guess; CS profs and grad students
18:31seancorfieldthe ppl i've seen have been mostly retired dads who otherwise hardly use a computer
18:31seancorfieldthe techie was at a user group so that was easy :)
21:38sethsso I've read through http://clojure.org/datatypes but am still confused on something simple:
21:38sethshow do I access the value of a field defined via deftype?
21:38sethsdefrecord I get, works fine, but
21:38seths,(deftype Foo [bar])
21:38clojurebotsandbox.Foo
21:38seths,(:bar (Foo. 123))
21:38clojurebotnil
21:43seths(get (Foo. 123 :bar))
21:43sethser
21:43seths,(get (Foo. 123 :bar))
21:43clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class sandbox.Foo
21:43sethsdurrrr
21:43seths,(get (Foo. 123) :bar)
21:43clojurebotnil
23:43maehaha
23:43maefucking awesome nick dude
23:44maeOK
23:44maeYou may call me a mad scientist if you like
23:44maebut I have a BATTLE CRY:
23:45mae"port javac to clojure" ! ! !
23:45LeNsTRoO
23:45mae1. What would it take (in terms of lines of code).
23:45mae2. What libraries would we have to port to pure clojure for low level shit that is currently written in java?
23:46mae2a. If we need to write more low level java shit then rhickey may need to expand the "clojure the language" in terms of low level jvm capability.
23:47maeAnswer 1, 2, and 2a in LOC.
23:47mae[ legend: LOC = lines of code ]
23:48maeHA HA HA, if we do this, then does that mean that we are basically running clojure directly on top of the hotspot vm without any extra fat? Just THINK OF THE POWER OMGS!
23:48mae3. Would we need to write clojure libraries to support all the fancy ass 6.0 features for I/O like NIO/NIO2/Channels or Handles? Java badasses chime in here please?
23:50mae4. Referencing the HA HA HA: please disregard this as it was a stupid-assed declaration and I will take my punishment... later.
23:50mae5. Is it always this quiet?
23:50mae6. BBL
23:53mae7. P.S. Feedback welcome, should I take this to the mailing list????