#clojure log - Jun 20 2010

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:47 defn: trptcolin: thanks

0:48 trptcolin: np

0:48 defn: #question: How can I split a string at the occurrence of a character?

0:48 for instance: "foo," => "foo" ","

0:54 technomancy: ,(seq (.split "hey,there" ","))

0:54 clojurebot: ("hey" "there")

0:54 technomancy: it gets rid of the seporator

0:55 defn: yeah, i want to keep the separator

0:55 technomancy: could use interpose

0:55 defn: oh yeah! thanks

0:56 technomancy: sure

0:56 defn: err damn, still not gonna do it for me im afraid

0:56 I need to have something that will go across: ["foo" "bar," "baz!"]

0:57 and give me ["foo", "bar", ",", "baz", "!"]

0:57 DarthShrine: defn: re-partition?

0:57 defn: you guys are saints

0:57 thanks

1:10 trying to write me first markov :X

1:10 s/me/my

1:10 $s/me/my

1:10 sexpbot: Command not found. No entiendo lo que estás diciendo.

1:11 DarthShrine: Hah :)

1:11 defn: I'm probably going about it completely wrong

1:12 for instance using str-utils and company when I should probably be composining words from groups of chars

1:12 this thing will tank on any sufficiently large input

1:17 bah im doing this all wrong

1:17 * defn sighs

1:43 defn: ahh, there it is

1:47 DarthShrine: What is where now?

1:47 defn: heh, just saying "ahhh, now i see what i was doing wrong..."

1:47 My First Markov(tm)

2:51 * defn wonders if he's the only one awake

2:52 DarthShrine: You are.

4:06 LauJensen: Morning all

4:07 DarthShrine: Morning LauJensen

4:07 LauJensen: DarthShrine, welcome to Clojure :)

4:07 DarthShrine: Thanks :)

4:29 Moominpapa: Still wrestling with labrepl on Windows.

4:29 I've managed to get to the following command line:

4:29 http://pastebin.com/kwus6Vdi

4:29 Which at least boots.

4:29 But when I run it, I get:

4:29 user=> (require 'labrepl)

4:29 WARNING: spit already refers to: #'clojure.core/spit in namespace: compojure.enc

4:29 odings, being replaced by: #'clojure.contrib.duck-streams/spit

4:29 WARNING: spit already refers to: #'clojure.core/spit in namespace: compojure.htt

4:29 p.helpers, being replaced by: #'clojure.contrib.duck-streams/spit

4:29 WARNING: spit already refers to: #'clojure.core/spit in namespace: compojure.htt

4:29 p.request, being replaced by: #'clojure.contrib.duck-streams/spit

4:29 java.io.FileNotFoundException: Could not locate clojure/string__init.class or cl

4:29 ojure/string.clj on classpath: (util.clj:1)

4:30 The warnings don't both me. The absence of a string class does... :)

4:41 Chousuke: you probably need to use 1.1 of Contrib and Clojure

4:50 Moominpapa: Sadly, that doesn't work for other reasons...

4:51 Equally, IntelliJ gets further, but then it turns out it's destroyed the windows environment variables so can't start the web server.

4:52 LauJensen: Ah I remember when I was a young pup, attempting to be serious on Windows... :)

4:52 Moominpapa: lol :)

4:54 DarthShrine: Heh :)

5:13 vIkSiT: hello all

5:13 hey Chousuke

5:13 around?

6:01 DarthShrine: Hmm, lein repl is being crazy slow o.o

6:03 LauJensen: DarthShrine: I recently heard of a bug being ironed out in lein repl- Ive never used it myself

6:03 DarthShrine: LauJensen: Ah, thanks.

6:04 The repl is doing stuff like hanging on (doc foo)

6:07 LauJensen: You 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

6:08 DarthShrine: I'm not an emacser.

6:10 LauJensen: Ok - You could become one in a few minutes though if you want - I have a few blogposts on getting up I think

6:12 DarthShrine: Or check this out http://www.assembla.com/wiki/show/clojure/Getting_Started

6:12 There are guide for all IDEs

6:12 s/guide/guides/

6:13 DarthShrine: Yeah, I have a vim + screen setup on another computer. Wanted to try lein so I didn't have to install Clojure manually.

7:20 ragnard: Hello folks

7:21 Question: 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?

7:21 ie: [identity inc] and [1 1] would give [1 2]

7:22 hoeck: ,(map #(%1 %2) [identity inc] [1 1])

7:22 clojurebot: (1 2)

7:23 ragnard: hoeck: Thank you. Very simple, of course... :)

7:24 hoeck: ragnard: thanks to clojure for being so simple :)

7:33 AWizzArd: ,(.getBytes "0;0;abcde")

7:33 clojurebot: #<byte[] [B@ff8839>

7:33 AWizzArd: ,(vec (.getBytes "0;0;abcde"))

7:33 clojurebot: [48 59 48 59 97 98 99 100 101]

7:34 AWizzArd: ,(vec (.getBytes "0;0;abcde" "LATIN1"))

7:34 clojurebot: [48 59 48 59 97 98 99 100 101]

7:34 AWizzArd: ,(vec (.getBytes "0;0;äöü" "UTF-8"))

7:34 clojurebot: [48 59 48 59 -61 -92 -61 -74 -61 -68]

7:34 AWizzArd: ,(vec (.getBytes "0;0;äöü" "LATIN1"))

7:34 clojurebot: [48 59 48 59 -28 -10 -4]

7:35 LauJensen: AWizzArd: Just in case you didnt know, the same works in a query with clojurebot

7:35 AWizzArd: indeed, I did not know this

7:35 thx

7:35 But in this specific case I wanted to show these results to someone else ;)

7:36 LauJensen: Sure - Its not causing any problems when there's no chatter and I personally enjoy seeing other peoples experiments as well :)

7:37 AWizzArd: The thing is that it seems that such very small strings eat 50 bytes in memory or so

7:37 LauJensen: yea, Java spends 2 bytes per 1 byte of data, keeping charset info

7:38 I hit that wall when I did the Global Warming post, because on a 350Mb file, it would hog 700+Mb memory

7:38 AWizzArd: *sigh*

7:39 Well, one can do in-memory-compression of strings by not storing the strings but instead their (.getBytes s "LATIN1") representation

7:39 LauJensen: Yea thats a very simple way to work around it

7:39 AWizzArd: I am thinking about this because I would like to store nearly 2,5 million texts in ram :-)

7:40 LauJensen: hehe

7:40 AWizzArd: this "trick" already got me down from about 11 GB to +/- 4 or so

8:09 LauJensen: AWizzArd: Would be crazy if you could get it down to -4 GB :)

8:15 AWizzArd: That would be shockingly crazy.

8:21 LauJensen: if 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

8:28 Fossi: well, in german, you say "plus/minus" for "about"

8:28 LauJensen: AWizzArd: Oops, in my rush I read 'that would' as 'what would' :)

8:28 Fossi: Yea, its the same in Danish actually

8:31 Joreji: Anyone here knows of a fnparse mailing list?

8:36 Licenser: I 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

8:38 LauJensen: Joreji: Not that Im aware of

8:44 AWizzArd: Joreji: please have a look into your private chat windows

9:08 Joreji: LauJensen: Hmm thanks. I'll look for an email or something like that.

9:24 wlr: Licenser: I refer you to the paragraph beginning "I want it to be perfectly clear..." in http://groups.google.com/group/clojure/msg/6e987f49d54db3d4

9:25 Licenser: wlr: I know

9:56 candera: Happy Fathers Day to those in countries where it's celebrated today!

14:07 Moominpapa: '(->> (java.lang.System/getProperty "java.class.path") (re-seq #"[^;]+") (map println) dorun)

14:15 LauJensen: Moominpapa: Doesnt look much different w/w/o the regex

14:17 Moominpapa: Hmm... I was expecting that to do more :)

14:17 I was curious.

14:17 LauJensen: like a monkey

14:17 :)

14:17 Sorry, you just reminded me of a song I heard long ago, "Curious George" I think

14:17 Moominpapa: Curiosity killed the cat, but it's usually regarded as a positive trait in coders ;)

14:18 LauJensen: $(-> (System/getProperty "java.class.path") (.split ":") (->> (map println)))

14:18 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: ()

14:18 LauJensen: ,(-> (System/getProperty "java.class.path") (.split ":") (->> (map println)))

14:18 clojurebot: (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:18 Moominpapa: I finally got labrepl working, with the assistance of that incantation.

14:23 I gather clojurebot doesn't redirect prn then :)

14:23 ,(seq (.split (System/getProperty "java.class.path") ";"))

14:23 clojurebot: ("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:30 Blackfoot: is there something like eval that uses the current context to resolve symbols?

14:32 LauJensen: Blackfoot: Not sure, but its not a difficult macro to write out yourself

14:33 Blackfoot: LauJensen: 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:34 but running (eval) on the form does not resolve the symbols in it

14:34 LauJensen: Blackfoot: try working out from something like this

14:34 (defmacro locals [] (vec (mapcat (fn [k] [(list 'quote k) k]) (keys &env))))

14:34 (let [x 5 y 10] (locals))

14:35 I have to duck out

14:35 Blackfoot: ok, thanks

15:02 revertTS: so I'm considering pre-ordering Joy of Clojure; anyone read the chapters available? recommended/not recommended?

15:07 Licenser: revertTS: I read some of them and I find it a very good book

15:13 revertTS: Licenser: 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:14 Licenser: revertTS: 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:19 Raynes: revertTS: The book seems to address pretty much everything.

15:56 mcav: if 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:59 technomancy: there's only one guy from clojars, and he hasn't been here in months. =(

18:19 Licenser: Okay 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:19 revertTS: I've seen 3ish

18:24 seancorfield: Licenser: i've seen several, all but one used by consumers rather than techies

18:25 mostly used for reading books / magazines (primarily) with some email / web browsing

18:25 the techie used it primarily for email / browsing with note taking (via Pages)

18:26 Licenser: seancorfield: you know you're the second person that actually caimed he saw them :P that is carry

18:26 I say they doN#t really exist!

18:26 hanDerPeder: seancorfield: how long does it take you to identify a person as a techie?

18:27 revertTS: the people I've seen with them would qualify as 'techies', I guess; CS profs and grad students

18:31 seancorfield: the ppl i've seen have been mostly retired dads who otherwise hardly use a computer

18:31 the techie was at a user group so that was easy :)

18:55 * dnolen ,(= (+ nginx clojure) :tasty) => true

21:38 seths: so I've read through http://clojure.org/datatypes but am still confused on something simple:

21:38 how do I access the value of a field defined via deftype?

21:38 defrecord I get, works fine, but

21:38 ,(deftype Foo [bar])

21:38 clojurebot: sandbox.Foo

21:38 seths: ,(:bar (Foo. 123))

21:38 clojurebot: nil

21:43 seths: (get (Foo. 123 :bar))

21:43 er

21:43 ,(get (Foo. 123 :bar))

21:43 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class sandbox.Foo

21:43 seths: durrrr

21:43 ,(get (Foo. 123) :bar)

21:43 clojurebot: nil

23:43 mae: haha

23:43 fucking awesome nick dude

23:44 OK

23:44 You may call me a mad scientist if you like

23:44 but I have a BATTLE CRY:

23:45 "port javac to clojure" ! ! !

23:45 LeNsTR: oO

23:45 mae: 1. What would it take (in terms of lines of code).

23:45 2. What libraries would we have to port to pure clojure for low level shit that is currently written in java?

23:46 2a. 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:47 Answer 1, 2, and 2a in LOC.

23:47 [ legend: LOC = lines of code ]

23:48 HA 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:48 3. 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:50 4. Referencing the HA HA HA: please disregard this as it was a stupid-assed declaration and I will take my punishment... later.

23:50 5. Is it always this quiet?

23:50 6. BBL

23:53 7. P.S. Feedback welcome, should I take this to the mailing list????

Logging service provided by n01se.net