#clojure log - Oct 12 2011

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

1:20 qed: He had to modem in to the agency and say that there was an emergency and that he was posting an e-note on a colleague's TP asking her to cover his calls for the rest of the week because he'd be out of contact for several days due to this emergency. He had to put an audio message on his answering device saying that starting that afternoon he was going to be unreachable for several days.

1:21 Expressivity is nebulous.

1:26 pdk: i'm reading proust in 2 lines

1:27 jli: well then

1:30 qed: pdk: I don't follow

1:31 jli: not sure how I FEEL about this http://www.kk.org/thetechnium/archives/2011/04/born_digital.php

1:32 qed: jli: your emphasis on "FEEL" worries me

1:32 I ranted on HN the other day about the reactions to Dart -- so superficial and full of emotion

1:33 "feel" is a recipe for poor decision-making

1:33 unless it is well-tempered by reality

1:34 jli: what were the reactions? something along the lines of "WHY BOTHER WE HAVE JAVASCRIPT"?

1:35 qed: jli: to respond to that link: I think the only reason we wonder is because we're secretly afraid we're dinosaurs

1:35 and the truth is: we are.

1:36 by the same token, we're just getting warmed up

1:36 ivan__: im sure this arguement is made every generation

1:36 about different stuff

1:37 qed: ivan__: indeed. it is an age-old argument.

1:37 ivan__: i rofl when people say that creativity is dying

1:37 jli: I accept being a 20-something grouchy old man

1:37 qed: jli: if you were truly grouchy you couldn't type that with confidence

1:37 clearly you *aren't* a grouchy old man

1:38 ivan__: Books! Print is dead! Long live the web! (btw, I like physical copies of books, do you have XYZ?)

1:38 (I'll pay for it)

1:39 ivan__: they had it so good in the olden days, what with much lower life expectancies, no real medical knowledge, having to hand wash clothes etc etc

1:40 qed: Anyway, this rant brought to you by: people's reaction to Dart, the sorry state of communication in our communities, and lack of personal responsibility

1:40 ivan__: heh -- I MISS OUTHOUSES! OH BOY WE HAD IT SO GOOD WITHOUT PLUMBING!

1:41 ivan__: how about lead piping :)

1:41 jli: temperments are remarkably robust

1:42 todun: srid: ok.

1:47 brehaut: require what?

2:15 lnostdal: i'm not sure where to begin looking, but perhaps someone already knows how to go about getting Meta-Point (Alt-. or "slime-edit-definition") to lead to the actual source files of some dependency and not just the (read-only) contents of .jar files?

2:42 tomoj: lnostdal: I think you want checkout dependencies?

2:43 e.g. in leiningen create a checkouts directory in the root of the project and put symlinks in it to other leiningen projects you depend on

2:43 todun: finally got emacs for clojure up and running.

2:43 thanks for all the help.

2:44 tomoj: then M-. will go to the source file in the other project because lein has put the symlinked code on the classpath

2:45 lnostdal: cool, will try that, tomoj .. thanks :)

2:45 clojurebot: thanks for your suggestion, but as usual it is irrelevant

2:45 tomoj: note you still need to explicitly include the dep in your project.clj

2:45 lnostdal: clojurebot, be quiet you

2:45 clojurebot: I don't understand.

2:45 lnostdal: ok

2:45 amalloy: (inc clojurebot)

2:45 lazybot: ⟹ 5

2:46 todun: I'm following the steps for newbies at http://dev.clojure.org/display/doc/Getting+Started

2:46 I'm trying to do https://github.com/relevance/labrepl

2:46 do I just download it into some folder then

2:46 at the repl do lein ?

2:47 tomoj: seems strange that the readme doesn't say how to use it

2:48 todun: tomoj: I didn't quite follow the readme. sorry about that.

2:49 tomoj: all I really see is that I should run the test with lein test...not sure what tests or why

2:50 tomoj: no clue, sorry, never used it

2:51 just seems like a funny readme for a project for people new to clojure.. :)

2:51 maybe they're supposed to find it some other way?

2:51 todun: tomoj: oh ok. I linked to it from the newbie page I listed above.

2:52 tomoj: http://foognostic.net/labrepl-summary/

2:52 looks like there are some working instructions there

2:52 todun: tomoj: thanks. checking it out now..

2:52 tomoj: of course, if you're set up with swank.. :/

2:53 todun: tomoj: swank...how do I do so, what can it do for me?

2:53 I just finished with leiningen, emacs start kit

2:53 tomoj: hmm

2:53 todun: I dont mind throwing in swank in there if it's useful

2:53 tomoj: have you got a clojure repl inside emacs?

2:54 todun: tomoj: how do I check if I do?

2:55 tomoj: uhh, dunno

2:55 you'd have to have set something up

2:55 dunno what you've done already

2:55 todun: tomoj: ok.

2:56 tomoj: did you set up marmalade like it says at http://dev.clojure.org/display/doc/Getting+Started+with+Emacs ?

2:56 todun: yes

2:56 tomoj: think you should be able to install slime, slime-repl, clojure-mode from it

2:56 todun: ok. how so?

2:57 to what end?

2:57 ibdknox: todun: what editor do you normally use? I'm not sure that trying to learn emacs while also trying to learn Clojure is a wise decision

2:57 tomoj: https://github.com/technomancy/swank-clojure

2:57 readme here is helpful too

2:59 todun: ibdknox: I'm trying to get more comfortable with emacs. so I'll be using emacs. Everything about emacs I'm familiar with, it's just that using M-x as a way to install stuff is so cool and new to me that I'm curious to know more.

2:59 anyways, using it for typing and such I'm familiar with

2:59 ibdknox: righto

3:00 tomoj: slime is an emacs package for working with lisps

3:01 swank-clojure provides clojure support, the readme there describes setup

3:01 just need to `M-x package-install` slime-repl and clojure-mode I think

3:01 plus the lein plugin in the readme there

3:02 maybe clojure-mode depends on slime now, dunno..

3:03 todun: tomoj: it's installing with lein now..

3:04 tomoj: so I imagine script/swank in labrepl is what you want, then M-x slime-connect to get into the repl

3:04 todun: tomoj: what do I do after I start the swine sever?

3:04 tomoj: or maybe you can just jack in to labrepl..?

3:04 todun: tomoj: when I try to start the swine server, I get the following error:

3:04 Debugger entered--Lisp error: (error "Could not start swank server: Couldn't find project.clj, which is needed for jack-in

3:04 ")

3:04 signal(error ("Could not start swank server: Couldn't find project.clj, which is needed for jack-in\n"))

3:04 error("Could not start swank server: %s" "Couldn't find project.clj, which is needed for jack-in\n")

3:04 clojure-jack-in-sentinel(#<process swank> "exited abnormally with code 1\n")

3:04 amalloy: heehee. swine server. a lovely combination of swank/slime

3:05 todun: oops! sorry people, I should have pastebined that

3:05 amalloy: haha. actually that was a typo. but it's all good.

3:05 tomoj: hmm, I dunno anything about jack-in..

3:06 if you're running script/swank in labrepl I think you'd want to M-x slime-connect, not use jack-in. if you're jacking in I guess you need to do it while visiting a file in labrepl's project directory

3:08 todun: tomoj: I don't follow. I'm using the instructions at https://github.com/technomancy/swank-clojure

3:09 tomoj: doing it with your suggestion, where do I get to labrepl for instance?

3:09 tomoj: that is, you're running M-x clojure-jack-in ?

3:10 todun: yes

3:10 tomoj: hmm

3:11 don't know how that would work

3:11 todun: tomoj: dont know what it does. you're suggesting I try labrepl.

3:11 how so?

3:12 tomoj: the only easy way I see is to download labrepl and run script/swank

3:12 then in emacs do `M-x slime-connect` instead of `M-x clojure-jack-in`

3:13 just curious, what platform are you on?

3:14 todun: osx

3:14 tomoj: whew

3:14 todun: tomoj: I should follow the instructions here http://dev.clojure.org/display/doc/Getting+Started+with+Emacs ?

3:14 tomoj: whew?

3:15 tomoj: all of the instructions there up to "... install clojure-mode by pressing M-x package-install and choosing clojure-mode."

3:16 then download labrepl and run script/swank inside it, and M-x slime-connect from emacs

3:16 nybbles: anyone know how i can get sort and floor functions? i gather than i have to install math.numeric-tower, but not sure how to do that using leiningen

3:18 todun: tomoj: downloading labrepl by zip? if so, then what? https://github.com/relevance/labrepl

3:19 ibdknox: ,(doc sort)

3:19 clojurebot: "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."

3:19 ibdknox: ,(doc floor)

3:19 clojurebot: Pardon?

3:19 ibdknox: ,(Math/floor 3.12434545)

3:19 clojurebot: 3.0

3:19 ibdknox: nybbles: ^

3:19 tomoj: todun: do you know how to use the terminal?

3:20 ibdknox: nybbles: you don't need anything special for sort or floor

3:20 tomoj: ,*clojure-version*

3:20 clojurebot: {:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}

3:21 tomoj: ,(require 'clojure.math.numeric-tower)

3:21 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/math/numeric_tower__init.class or clojure/math/numeric_tower.clj on classpath: >

3:21 nybbles: ibdknox: ahhhh okay i'll try it out

3:21 tomoj: the floor there just behaves differently than the regular one?

3:22 ibdknox: huh?

3:22 todun: tomoj: yes. I'm using it now.

3:22 ibdknox: how can floor behave differently?

3:22 todun: tomoj: but I'm no terminal guru or anything like that.

3:22 tomoj: todun: ok, you just need to unzip labrepl, cd into it, and you will find a script/swank inside it, run that

3:23 todun: tomoj: ok. will do. apprise you of my progress..

3:25 tomoj: all I did was double click it. will that give the same effect?

3:27 tomoj: maybe.. I don't remember osx very well

3:27 if it works, http://localhost:8080/ should have clojure stuff on it

3:28 todun: tomoj: I ask because I get this error when I run it from terminal like so

3:28 http://pastebin.com/S4kvEg49

3:28 tomoj: localhost is error for me

3:29 tomoj: run `lein deps` in labrepl first

3:31 todun: tomoj: but I dont have labrepl, or I thought I didn't hence all this.

3:31 tomoj: hmm

3:32 where'd script/swank come from?

3:32 ibdknox: todun: he means in the project directory

3:32 todun: tomoj: the download of labrepl

3:32 tomoj: right.. where you typed `script/swank` type `lein deps` first

3:33 todun: ibdknox: oh ok.

3:33 tomoj: k..

3:33 downloading..

3:34 then do 'script/swank' ?

3:34 tomoj: yep

3:35 todun: uhm ok. nice. it started another repl.

3:35 thanks guys.

3:35 tomoj: what does this do for me? how does it differ from lein's repl?

3:36 which should I use now that I have this setup?

3:36 tomoj: by "lein's repl" do you mean something you got by running `lein repl`?

3:37 script/swank just starts up labrepl, so you can get to it at http://localhost:8080/ and connect from emacs with M-x slime-connect

3:37 todun: tomoj: yes

3:37 tomoj: normally you can just jack-in to your project or run `lein swank` in the project directory

3:37 once you start building your own projects

3:38 Blkt: good morning everyone

3:38 tomoj: it differs from `lein repl` because you can connect to it in slime to have the repl in emacs

3:39 then you get code completion and lookup and macroexpansion etc in emacs too

3:39 as opposed to trying to balance parentheses on a repl in some terminal

3:40 todun: tomoj: I tried M-x, slime-connect...that didn't work.

3:41 tomoj: it seems you're saying that I can use emacs to write my code then M-x slime-connect to sort of "compile" it?

3:41 tomoj: when you ran `script/swank`, did it say "Starting swank..."

3:41 and perhaps "Connection opened on local port 4005" ?

3:42 ..or did it just give you a repl in the terminal there?

3:42 I guess it starts a repl in the terminal too

3:44 M-x slime-connect hooks slime up to a running jvm with the project's code (in this case, the labrepl code), so you get a repl inside emacs

3:44 then you can also load files you're working on in that running jvm once connected, with C-c C-k

3:44 among other things, I think summarized in the swank-clojure readme

3:44 ejackson: morning all

3:44 todun: tomoj: I said that, yes. Clojure 1.3.0-beta1 Starting swank...

3:45 tomoj: then the repl

3:45 in terminal

3:46 tomoj: hrmm

3:46 todun: tomoj: ok. now I have the option of doing M-x, clojure-jack-in

3:47 should I do it?

3:47 tomoj: well

3:47 you could

3:47 do it starting from a file in the labrepl project directory

3:47 the problem is, labrepl has some extra startup code sitting off in script/run.clj

3:48 this is what script/swank is supposed to run, but yours apparently fails to start swank

3:48 if you C-x C-f to, say, project.clj in the labrepl directory, and run M-x clojure-jack-in, it should start swank and give you a repl

3:49 todun: tomoj: oh ok. my next question answered. don't delete the zip folder downloaded from labrepl, it will break everything, yes?

3:49 tomoj: yeah you need that to use labrepl

3:51 todun: does it matter if I move the dir i dowloaded?

3:52 tomoj: you can move it, but don't move it while you're connected with jack-in or slime-connect or editing files in it

3:54 todun: tomoj: dont have slime-connect in emacs just jacked-in

3:55 tomoj: ah, right

3:55 todun: tomoj: when I do jack-in I get a similar error like before...

3:55 tomoj: jack-in sends slime over the wire

3:55 todun: http://pastebin.com/TSagcJr0

3:55 tomoj: you could do M-x package-install slime-repl

3:55 then you should have M-x slime-connect

3:55 dunno how to get jack-in working, I never use it

3:56 todun: tomoj: I have slime-(stuff) not connect though

3:56 tomoj: weird

3:56 todun: tomoj: oh. so I dont need jack-in

3:56 just slime?

3:56 tomoj: jack-in is the currently recommended method I think

3:56 I just do it the old way because I haven't figured jack-in out yet

3:57 todun: tomoj: what is this old way, if you dont mind my asking(I just want to get this up and running so I can write beautiful clojure)?

3:57 tomoj: the old way, you install slime-repl (and slime, slime-repl depends on slime, so you can just install slime-repl) with package-install, run `lein swank` (`script/swank` for labrepl), and M-x slime-connect

4:00 todun: tomoj: ok, trying that now..

4:00 btw, all I need is the script/swank dir, right?

4:01 that is to say, I can get rid of everything else....

4:04 tomoj: no

4:05 certainly some of the stuff in there you don't need, but just keep it all

4:08 todun: tomoj: ok. will try all you said and let you know asap

4:11 tomoj: when I launch emacs, must I be in script/ ?

4:13 tomoj: doesn't matter

4:19 todun: k. I'm guessing because of the setup at path, yes?

4:22 tomoj: dunno what you mean

4:22 emacs is happy to run from anywhere

4:23 it's common to only run one emacs

4:28 amalloy: chouser: i see you finished all of our dang problems. mission accomplished?

4:30 todun: tomoj: ok.

4:31 tomoj: Ok I tried the following : install slime-repl (and slime, slime-repl depends on slime, so you can just install slime repl) with package-install, run `lein swank` (`script/swank` for labrepl), and M-x slime-connect

4:31 install slime-repl works.

4:31 lein-swank says...

4:31 Couldn't find project.clj, which is needed for swank

4:31 that was step 2.

4:32 step 3 is M-x slime-connect

4:32 tomoj: if you want to run labrepl, run `script/swank` in the labrepl dir

4:32 todun: it asks for port localhost etc, then says...

4:32 tomoj: don't run `lein swank`

4:32 todun: make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service,\

4:32 4005, :nowait, nil

4:33 tomoj: oh ok. why not though?

4:33 tomoj: it fails to run extra labrepl startup code

4:33 which will make things easier when using labrepl

4:35 todun: tomoj: that's 'lein swank' I presume.

4:35 tomoj: as per the slime-connect issue, what's up with that error?

4:36 tomoj: you didn't start swank

4:37 todun: I thought I did as per your instructions.

4:37 tomoj: you either have to run script/swank in the labrepl dir or `lein swank` in any lein project dir to start swank first

4:37 when it said "Couldn't find project.clj, which is needed for swank", it meant that it failed to start, I believe

4:38 probably because you weren't in a project directory when running `lein swank`

4:39 todun: tomoj: what is a project dir then? I have a folder that I've been dumping all the stuff into.

4:39 tomoj: the labrepl zip you downloaded contained the labrepl project dir

4:40 if you cd into it, and run `script/swank`, it should start swank for the labrepl projec

4:40 a project dir is just a dir that contains a project.clj file

4:46 todun: tomoj: ok will try that. thanks.

5:23 eiro: hello

5:25 (line-seq (slurp "http://khatar.phear.org")) doesn't work because slup returns a string, not a reader

5:25 any function to return http flow line by line ?

5:25 raek: eiro: you probably want to use clojure.java.io/reader here

5:26 slurp is an alternative to line-seq + reader for the case when you want one big string

5:28 eiro: actually i don't want a big stream but i thought everything was lazy so slurp read my http flow line by line

5:28 i investigate reader

5:29 raek: line-seq reads lines lazilly

5:29 in clojure only seqs are lazy so slurp has to be strict since it returns a (java) string

5:31 so to print each line in the stream: (let [stream (reader url)] (doseq [line (line-seq stream)] (println line)) (.close stream))

5:31 the (let [x ...] ... (.close x)) thing can be replaced by (with-open [x ...] ...)

5:32 (which additionally makes sure that .close is called even when an exception is thrown)

5:44 eiro: i tried slurp* from contrib.io but it doesn't work

5:44 it seems i have a classpath pb: i can't figure out where contrib is installed :)

5:46 raek: eiro: you don't need contrib for this. the stuff in contrib.io became clojure.java.io in clojure 1.2

5:46 and slurp is now in clojure.core

5:46 eiro: slurp* isn't :)

5:46 raek: eiro: http://clojuredocs.org/clojure_core/clojure.java.io

5:47 eiro: what was the difference from slurp?

5:47 some functions was refactored in the process. the "new way" is the recommended one

5:48 eiro: raek, it seems to me that slup returns a string when slurp* returns a "stream"

5:48 ok so with-open is my friend

5:48 i want to fix my classpath pb anyway :)

5:48 raek: eiro: ah. originally clojure.core only accepted a filename as a string as its argument

5:48 but since clojure 1.2 it calls clojure.io.reader to open the stream

5:49 eiro: oh

5:49 ok

5:49 raek: so it accepts streams just like clojure.contrib.io/slurp*

5:49 slurp* accepted a stream. it did not return one

5:50 eiro: for the classpath problems, use a build tool like Leiningen to manage dependency libraries (e.g. contrib) and the classpath for you

5:51 if you just want to learn the language, you don't gain much by managing the classpath yourself

5:55 eiro: it seems i'll be hooked to closure soon :)

5:58 raek: eiro: http://pastebin.com/xKzVnmTX

6:00 eiro: thansk

6:00 raek, i use lein but it's boring when you have lot of scripts you want to launch

6:01 (or i missed something)

6:01 you have to file project.clj:main and test/script1.clj-main constantly

6:03 it seems i just have to put a jar in $CLOJURE_HOME :)

6:15 dbushenko: what's the most idiomatic way to write to file with clojure 1.3?

6:16 clgv: dbushenko: clojure.java.io

6:17 dbushenko: are there any examples? bcs I just don't understand this API

6:19 clgv: dbushenko: you can do something like (with-open [w (writer "my-file.txt)] (binding [*out* w] (print "My data text line")))

6:19 s/txt/txt"/

6:19 lazybot: <clgv> dbushenko: you can do something like (with-open [w (writer "my-file.txt")] (binding [*out* w] (print "My data text line")))

6:19 dbushenko: oh, this is great!

6:19 and how about reading?

6:19 what it could look like?

6:20 clgv: humm that depends what you write. do you write text lines like above?

6:20 dbushenko: yep

6:20 I know about slurp

6:20 but how to do that with clojure.java.io?

6:21 clgv: clojure.java.io is the namespace that contains reader and writer

6:22 for reading lines you can do: (with-open [r (reader "my-file.txt")] (line-seq r))

6:22 dbushenko: thanks!

7:20 raek: dbushenko: you need to force the whole seq inside the with-open form some how. either do the procedding there or add a doall: (with-open [r (reader "my-file.txt")] (doall (line-seq r)))

7:21 dbushenko: raek: thanks!

7:22 raek: also, reader/writer are for text. for binary data, use input-stream/output-stream. you might need to use java interop for those (see the javadoc for InputStream and OutputSteam for the methods)

7:25 eiro: you can use lein run like this: "lein run some.other.namespace"

7:26 eiro: sorry, that should be "lein run -m some.other.namespace"

7:27 see "lein help run". it also explains how you can give the namespaces shorter aliases

7:30 todun: when I run 'lein swank' from a directory with project.clj in it, I get the following exception trace: http://pastebin.com/u6CwMWza

7:30 am I doing something wrong?

7:31 raek: I think that happens when you have two versions of swank-clojure on the classpath at the same time

7:31 todun: the goal is to use emacs to write clojure.

7:31 raek: for instance one as a :dev-dependency and one as a leiningen plugin

7:31 todun: raek: oh ok. how do I remove it?

7:31 raek: I first installed leiningen then emacs starter kit

7:32 then I tried jack-in from emacs

7:32 that didn't work

7:32 then I installed labrepl

7:32 then swine as per the recommendations of tomoj

7:32 raek: jack-in didn't work for a clean new project?

7:32 todun: raek: yes. hence the swine suggestion

7:32 raek: swine?

7:33 todun: raek: slime

7:33 raek: swank-clojure?

7:33 clojurebot: see swank

7:33 todun: raek: sorry. been making that mistake throughout the installation.

7:33 raek: yes. swank

7:33 raek: sometimes a dependency brings in an old version of swank-clojure, and that can mess everything up

7:34 todun: did you try jack-in for a clean leiningen project?

7:34 todun: raek: after all those installations, these are the steps I've taken to try to get this off the ground: -install slime-repl (and slime, slime-repl depends on slime,

7:34 so you can just install slime-repl) with package-install,

7:34 -run `lein swank` (`script/swank` for labrepl),

7:34 and M-x slime-connect

7:34 raek: todun: also: do you want to work on your own project or someone else's?

7:34 todun: raek: on my own project.

7:35 raek: if a clean project means, have I written any clojure code/script, no! I've been trying to make this work.

7:36 raek: all the code I've done so far is in the repl so I can follow along the docs. will this make leiningen "unclean"?

7:36 raek: if you make a clean new project (lein new), remove everything in ~/.lein/plugins, install the swank-clojure plugin (lein plugin install swank-clojure 1.3.1) and then try jack-in, what happens?

7:37 by "clean" I meant a project with no :dependencies declared in its project.clj file

7:38 also, labrepl is a tutorial, I think. it will certainly not make it simpler to set up your IDE.

7:39 todun: raek, translating what you're saying to this. lein new, rm -rf ~/.lein/plugins, M-x install-package swank-clojure

7:40 raek: from where in my dir should I run lein new?

7:40 raek: is it from the place where I have my project.clj ?

7:41 raek: no, not M-x swank-clojure

7:41 that is a deprecated elisp package that predates leiningen

7:42 lein new myproject && rm -rf ~/.lein/plugins && cd myproject && lein plugin install swank-clojure 1.3.1

7:42 then C-x C-f myproject/src/myproject/core.clj

7:42 then M-x clojure-jack-in

7:42 todun: raek: myproject?

7:43 raek: the name you give to the project

7:43 todun: raek: I don't have a project. Do I need one?

7:43 raek: the project is the set of source files the clojure instance will have access to and the libraries it will use

7:43 yes

7:43 todun: raek: what I mean is that I'm not sure what a project means here.

7:44 raek: so is it like a java project?

7:44 raek: yes, the JVM doen't really like the "current working directory" approach

7:44 todun: raek: so I cannot have a folder for all my stuff.

7:44 raek: when you use lein to start the swank server, it will make sure that the source directories and all jars of the dependencies are on the classpath

7:45 well, the project is a folder

7:46 todun: raek: will it allow me to have a "workspace" then separate folders in that workspace representing separate projects?

7:46 raek: sure

7:47 a project is just a directory with a project.clj file in it and some other dirs (src/, lib/, test/, etc...)

7:48 you can put the project folder in any other folder you like

7:48 todun: raek: can I use lein to create a new project then? so lets say I'm in some folder, I call 'lein make-project'. will it generate all that for me?

7:49 raek: todun: yes, calling "lein new myproject" will create the myproject/ folder in the current folder

7:50 todun: raek: now the folder it creates it in will be like my "workspace", correct?

7:50 raek: I guess. that folder does not have any special meaning for Leiningen, though

7:50 todun: raek: ok. just trying to wrap my mind around this all.

7:51 raek: put in Eclipse terms, that would be the Workspace

7:51 todun: raek: I'm trying the commands now...

7:51 raek: inside the project folder, you can use "lein repl" to get a repl in the terminal

7:52 that repl can access the source files in src/ and all the dependencies of the project

7:53 you use swank-clojure (indirectly, if you are using jack-in) when you want a repl in Emacs

7:53 todun: raek: ok. everything done. what is and where do I do then C-x C-f myproject/src/myproject/core.clj ?

7:53 raek: in emacs

7:53 raek: while in the /myproject ?

7:54 raek: todun: you need to open some file that belongs to the project. myproject/src/myproject/core.clj is a good place to start

7:55 when you have that file opened (assuming you did the "lein plugin instal..." step) you should be able to do "M-x clojure-jack-in"

7:55 and then a repl should pop up

7:56 todun: raek: all in emacs?

7:58 raek: ok. doing that in emacs. It says starting swank server...

7:58 raek: do I have to do all these steps for each project I make?

7:59 can I not just have one universal project with the core.clj?

7:59 raek: you need to run "lein new ..", open a file in the project and invoke clojure-jack-in, yes

7:59 todun: raek: I get error in process filter: Symbol's value as variable is void: Copying

7:59 raek: sure. I think it's pretty common to have a "scratch" project

8:00 todun: when I do jack-in

8:00 raek: todun: that probably means you have installed an incompatible slime version in emacs

8:00 try to remove all slime, slime-repl, swank-clojure, slime-clj and swank-clj packages

8:00 only keep clojure-mode

8:01 swank-clojure comes with a compatible version which clojure-jack-in uses

8:01 todun: raek: how do I remove all those?

8:01 raek: so you don't need to install slime

8:02 M-x package-list-packages

8:04 then you should be able to mark a package for deletion by pressing "d", I think

8:04 and then "x" to apply

8:05 if you don't have any important packages installed, maybe it's simpler to just wipe ~/.emacs.d/elpa/ and reinstall clojure-mode

8:07 todun: raek: trying all that now..

8:07 raek: I have quite a few things there so I'll keep elpa

8:08 so I should delete anything that has slime on it?

8:08 raek: yes

8:08 and anything that mentions swank

8:09 todun: raek: I see these for slime: slime-clj 0.1.6 available Slime extensions for swank-clj

8:09 slime-fuzzy 20100404 available Fuzzy symbol completion for Slime

8:09 slime-ritz

8:10 raek: so I move the cursor to the same line as 'slime-clj' press d and then x...

8:11 emacs indicates I've selected nothing.

8:12 raek: for swank, this is all I find: swank-cdt

8:24 raek: todun: if those are installed, remove them

8:24 todun: raek: yes. the d then x doesn't work for me though

8:26 jcromartie: hm, so you can't attach metadata to a ref huh

8:26 raek: I guess you can remove them from ~/.emacs.d/elpa/ manually

8:26 jcromartie: alter-meta!

8:26 duck1123: I've never had much luck deleting packages through elpa

8:26 todun: raek: in there, I have slime-20100404.1 slime-repl-20100404

8:26 delete those two folders?

8:27 raek: ok, delete those

8:27 todun: raek: ok. done.

8:27 jcromartie: interesting, thanks raek

8:27 raek: jcromartie: with-meta returns a new object, but for a ref you want to change the meat for *the* ref

8:27 jcromartie: ah ha... that makes sense

8:28 raek: todun: restart emacs and try clojure-jack-in again

8:28 jcromartie: this is perfect :) thanks

8:29 todun: raek: ok. it seems to work. I get this: ; SLIME 20100404

8:29 user>

8:29 raek: todun: congratulations!

8:30 todun: raek: how do I write clojure code

8:30 I'm guessing you just run your code in that repl

8:30 raek: you can evaluate expression in the repl directly

8:30 yes

8:30 quickly on how to use source files:

8:31 add (defn hello [] (println "Hello, world!")) below the (ns ...) line in myproject/core.clj

8:31 press C-c C-k in that buffer

8:32 and then C-c M-p <RET> (after this, the repl should change to myproject.core>)

8:32 then you can eval (hello) in the repl

8:32 when you make changes to a defn or a def, press C-M-x inside it to reload that def

8:32 press C-c C-k to reload the whole file

8:33 todun: raek: I get the following error http://pastebin.com/GypgAceq

8:34 raek: todun: you accidentally copied the word "below" too

8:34 press 0 to close that window

8:34 todun: raek: oops. it looked like clojure code :-P

8:34 ok. closed

8:35 raek: write that in the file, not in the repl

8:35 todun: raek: but how do I get to the file?

8:35 raek: todun: change to that buffer

8:35 the usual way

8:36 C-x b

8:36 or maybe you already have it in split screen. it depends on your emacs setup

8:37 todun: raek: ok.

8:37 using C-x b gets somewhere I can type into.

8:37 Ive pasted it in there. now what?

8:37 duck1123: C-x C-b brings up a nice list

8:38 C-x b is faster if you know the name of the buffer

8:38 raek: todun: save the file (C-x C-s) and load it (C-c C-k)

8:38 and then enter its namespace (C-c M-p <RET>)

8:39 todun: raek: I can give it any name, right?

8:39 raek: give whay any name?

8:39 todun: I'm going with one.clj

8:39 it says save in path..

8:39 raek: as long as you put it inside the src/ directory

8:39 todun: no file name?

8:40 raek: you didn't open the src/myproject/core.clj file?

8:40 Zolrath: same filename as its ending namespace

8:40 If the project is hellokitty and the filename is socute.clj

8:40 todun: so core.clj?

8:40 Zolrath: the namespace would be (ns hellokitty.socute)

8:41 raek: if the top of the file says (ns myproject.core) the file should be in src/myproject/core.clj

8:41 todun: this is the path I have

8:41 "/src/first_project/core.clj"

8:41 raek: dots becomes slashes, hyphens become underscores

8:42 ok

8:42 then there should be a (ns first-project.core) in the top of that file

8:42 (note the hyphen)

8:43 todun: this is the new file:

8:43 (ns first_project.core)

8:43 (defn hello [] (println "Hello, world!"))

8:44 Zolrath: the underscore from the file is a dash when in the namespace

8:46 todun: Zolrath: oh ok.

8:46 do I overwrite core.clj?

8:46 that was generated by lein

8:47 raek: todun: if that file is called src/first_project/core.clj, then yes

8:47 todun: (ns first-project.one)

8:47 (defn hello [] (println "Hello, world!"))File to save in: ~/Dropbox/CLOJURE/first_project/src/first_project/one.clj

8:48 sorry about that...

8:48 I meant to type this.

8:48 (ns first-project.one)

8:48 (defn hello [] (println "Hello, world!"))

8:48 File to save in: /first_project/src/first_project/one.clj

8:48 Zolrath: correct

8:49 todun: so this means in reality all I need is to save the files in /src/

8:50 just so I understand the steps:

8:51 1.) connect to swank server: M-x, clojure-jack-in

8:51 2.) C-x b to leave the repl to a place I can input my code.

8:52 3.) C-x s save the file to some place in /src/

8:52 4.) ?

8:52 1 - 4) must I have a split screen?

8:52 makes it impossible to write a full length app

8:52 raek: no, but I personally find it convenient

8:52 duck1123: C-x C-s saves a file

8:53 raek: to split the emacs frame vertically

8:53 I usually have the file I'm working on the one side and the repl on the other

8:54 todun: raek: how do I split vertically?

8:54 duck1123: C-x 3

8:54 raek: todun: C-c C-k to load the file. C-c M-p to make the repl be in the namespace of the file

8:55 then you have a repl in the right namespace and you can evaluate code that uses the functions that you have defined in the file

8:55 duck1123: I have (global-set-key (kbd "C-c s") 'slime-selector) so that I can hit C-c s r to get to my repl

8:55 todun: when I do C-x b to get to repl, I fall into oblivion.

8:56 duck1123: sounds like a good idea. how did you set that up?

8:57 duck1123: I have ~/.emacs.d/duck.el just pasted that there

8:57 todun: should I make mine duck.el?

8:58 duck1123: I don't use jack in, so I also have a fn to connect to slime on 127.0.0.1/4005 that I've bound to a handy key combo

8:58 no, whatever your username is

8:58 todun: ok

8:58 how do I find out my user name or it that of my computer?

8:58 duck1123: you login name for the computer

8:59 near the end of starter kit's setup it looks for a file with your username and loads that

9:03 todun: how to un-split screens?

9:04 duck1123: C-x 1

9:04 or C-x 0 to just remove a split

9:05 todun: so there is a repl, then are namespaces and something else.

9:05 how do I move through all of them?

9:06 my last attempt sent me somewhere else.

9:07 duck1123: all of your open buffers? C-x b if you want to type a name, C-x C-b if you want to pick from a list, C-x [right] if you just want to cycle

9:09 todun: duck1123: what is a name and/or name space in clojure?

9:09 what is a list?

9:10 duck1123: todun: I'm not sure I understand your question

9:10 todun: when I split the screen, I don't get the repl and I cannot switch between the split screens.

9:10 you mentioned I use C-x b if I want to type a name

9:10 duck1123: C-x [right] should allow you to cycle through the buffers

9:11 todun: I'm guessing that's the same as name space.

9:11 Fossi: todun: you want windmove

9:11 todun: I was not sure what a name space is in clojure

9:11 right is the cursor?

9:11 duck1123: each buffer has a name, if you know the buffer is "core.clj" you can start typing that to jump to it

9:13 by C-x C-b will bring up the list of buffers that you can choose from

9:13 todun: each buffer as in each file?

9:14 duck1123: each open file (and some other things) each have a "tab" that emacs calls buffers

9:14 todun: Fossi: what is windmove?

9:15 Fossi: where to download it from.

9:15 duck1123: If you have the starter kit, you should be able to shift + arrow to move to other sides of the split

9:15 easier than C-x o

9:15 todun: Fossi: http://www.emacswiki.org/emacs/WindMove just describes.

9:16 duck1123: you mean the app version?

9:16 duck1123: are you using emacs in a terminal?

9:16 todun: yes

9:17 duck1123: If so, shift + arrow might not work

9:17 C-x o it is then

9:17 Fossi: ah, okay

9:19 todun: I'm perfectly willing to try the app

9:19 in fact I'm there now. shift arrow sets a mark

9:20 duck1123: Ok, if you have windmove, that binds to windmove down. It's part of the v1 of starter kit, so I don't know where you get it

9:21 todun: duck1123: I did 24 nightly as suggested by raek

9:21 will this give me windmove?

9:22 also, the split is always between one name-space and another.

9:22 duck1123: couldn't say. I'm still on 23.2.1 and starter-kit v1

9:22 todun: so I do C-x 2 when I'm in clooj.clj. I get two windows of this

9:23 duck1123: how do you do it with your version?

9:23 duck1123: now you can take one of those sides an switch to a different buffer

9:24 todun: how do I switch between split screens?

9:24 duck1123: todun: I just delete my existing ~/.emacs.d and then checkout the starter kit to that location. I believe things may have changed with the newer verson

9:25 M-x next-buffer or C-x <right> to cycle

9:26 raek: todun: with emacs-starter-kit, use Shift + arrow key

9:26 duck1123: sorry, raek's right

9:27 C-x o if you don't have windmove or you're in a terminal

9:27 todun: shift arrow-key doesn't work for me.

9:28 also, I only seem to be switching between scratch, GNU emacs, Completions, one.clj

9:28 using C-x left/right arrow keys

9:29 duck1123: Those are probably the only files you have open. C-x C-f to open a new file

9:29 todun: duck1123: but how do I switch to the repl?

9:30 duck1123: Try M-x clojure-jack-in or start swank and M-x slime-connect

9:31 Personally, I prefer the latter because I always have a screen session running in Guake.

9:32 todun: duck1123: had to remove slime because it was messign with jack-in

9:32 *messing

9:32 raek: todun: actually, you can have slime installed. it's just that you must have the right version

9:32 which can be tricky

9:33 todun: raek: ok. at this point I just want to understand all this so I can begin developing like a clojurian!

9:33 duck1123: I have only slime and slime-repl installed. Some of the other slime* packages cause me problems

9:34 todun: so I have it such that there are two screens. one with the repl, the other with the .clj

9:34 now what?

9:35 duck1123: code in the clj file. C-c C-k to load it, C-c M-p to set the namespace of the repl, run the function

9:37 todun: raek: doing C-c C-k to load the file. C-c M-p to make the repl be in the namespace of the file doesn't make the repl in my namespace...or am i missing something?

9:39 duck1123: if your point is in the file, C-c M-p should populate the namespace, otherwise you might need to type it. This assumes you're connected, of course

9:40 And if you haven't required the namespace in any way, C-c M-p won't work. C-c C-k in that file first and you'll be all set

9:40 raek: todun: what duck1123 said. When you press C-c M-p it will diplay the namespace of the file in the minibuffer. press return to accept it.

9:40 todun: duck1123: what is a point ?

9:41 duck1123: your cursor

9:41 todun: ok. yes I'm connected.

9:41 duck1123: A lot of emacs stuff uses it's own names for things.

9:41 todun: required the namespace?

9:42 C-c C-k === Cntrl + c Cntrl + k ?

9:42 duck1123: yes, do that in the file

9:42 todun: C-c M-p == Cntrl + c Meta + p ?

9:43 duck1123: Meta is either alt+p or esc p.

9:44 todun: duck1123: how to make alt the meta?

9:44 Cntrl + c doesn't work for me. it instead puts in the character c and does nothing.

9:45 raek: todun: "meta" is the name emacs uses for the key that is called "alt" on PCs

9:45 todun: ok. can you change the meta ?

9:45 or you're stuck with esc?

9:46 duck1123: If emacs accepted the C-c, you should see "C - c -" at the bottom left

9:46 raek: todun: you can't use the alt key?

9:46 lucian: what's the standard for clojure package management (like python's pip, or ruby's gems)

9:46 todun: raek: yes. my meta is esc

9:46 raek: todun: you can use both

9:47 duck1123: most terminals won't send your alt commands, so you're stuck with esc.

9:47 tdrgabi: lucian: leiningen

9:47 todun: raek: just tried

9:47 didn't work

9:47 raek: lucian: packages = maven artifacts. build tools to make packages: Leiningen, Cake or Maven: repository: Clojars and Maven central

9:48 duck1123: I've gotten to the habit of always using esc w for kill-ring-save. I've been bitten by OSX to many times. Want to copy text and end up closing the window

9:48 raek: well, you use the build tools to "consume" packages too

9:48 todun: C-c doesn't seem to be working for me.

9:49 raek: lucian: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md

9:49 duck1123: C-c doesn't do anything on it's own, It's a prefix for multiple key commands

9:50 lucian: raek: hmm. is there a way to install things system-wide?

9:50 * lucian reads lein docs

9:50 lucian: thanks raek tdrgabi

9:51 duck1123: lucian: it's really not encouraged

9:51 raek: lucian: cake has a "global project" which kind of works like that

9:51 lucian: duck1123: i know, but i want to do it anyway

9:51 i'd rather not make a project just for playing around with things

9:51 raek: with lein you need to make a "scratch project"

9:52 there's also Cljr

9:52 lucian: right, i'll have a look

9:53 raek: lucian: https://github.com/liebke/cljr

9:53 lucian: raek: ah, awesome. precisely what i want

9:53 todun: got C-c M-p to work. it displays: Package: first-project.one

9:53 raek: todun: press return

9:54 todun: raek: I see a bunch of files.

9:57 perhaps I should get cljr?

9:58 will this help a newbie?

9:58 clgv: todun: you could try eclipse with ccw or similar plugin for netbeans ;)

9:58 duck1123: perhaps in the short term, but if you're serious about clojure, you're going to need to know lein/maven/cake anyway

9:59 todun: clgv: ok. try that. but sine I've gone down this wabbit hole, might as well finish..

9:59 xkb: hi #clojure

10:00 I am trying to get the first 100 entries from a stream. I get the stream trough async-http: (string stream-seq client ....) and I'd like to just do (take 100 stream)

10:01 however this doesnt work (looks like it blocks)

10:01 any idea how I should handle this?

10:01 clgv: xkb: then you might have not enough data in there ;)

10:01 xkb: I can continually print the seq by using doseq

10:01 * andrewclegg hey... does anyone have experience of including a few ad-hoc clojure source files in a java project?

10:01 xkb: (its a twitter stream)

10:01 andrewclegg: I keep running into little things that would be easier in clojure but not worth starting a separate project for

10:02 clgv: and remember take is lazy and wont do anything unless you access does elements

10:02 xkb: is take allowed/working on a stream-seq?

10:02 hmm

10:02 clgv: *those

10:02 andrewclegg: is there a best-practice/least-friction way to do that?

10:02 mikera: @andrewclegg works fine for me with Eclipse / Maven in a Java project

10:02 andrewclegg: mikera: just have a separate src/main/clojure dir and add the clojure nature?

10:03 mikera: yep. also I use Maven for the clojure dependency but you don't have to

10:03 andrewclegg: do you have to do anything funky to make sure the clojure stuff gets compiled before the java code that references it?

10:03 I think I stumbled on that last time I tried

10:03 mikera: No - the clojure files get compiled on demand

10:03 andrewclegg: cool thanks, will try again and see how I get on

10:04 cemerick: andrewclegg: Do you need to distinctly compile the clojure stuff? Unless you're referring to types defined in Clojure, you can just ship the source .clj

10:04 andrewclegg: cemerick: I'm generally making jars to deploy to a repo for use by other java projects

10:05 can you just bundle the source .clj in the jar?

10:05 cemerick: andrewclegg: absolutely

10:05 andrewclegg: and that gets compiled when the clojure rt first needs it?

10:05 cemerick: If your clients only touch the Java API, then there's no need to AOT-compile the clojure sources.

10:05 andrewclegg: this is sounding better all the time :-)

10:06 cemerick: In that scenario, you do need to load the Clojure sources at runtime (in a static init block, or somesuch), but you're otherwise golden.

10:06 Again, this is the case if you're not referring to Clojure-defined types from Java.

10:06 mikera: I never used AOT compilation either, just bundles the .clj files in the jar

10:07 cemerick: You can just put your .clj files in src/main/resources (if you're using maven), and they'll get rolled into the jar automatically.

10:08 todun: raek: so to develop in emacs, what steps should I take from M-x, clojure-jack-in...? thanks.

10:08 andrewclegg: what I'm thinking is: I provide a library jar which has interfaces defined in java, that my consumers speak to. the implementation classes in my jar delegate some of their work to clojure functions. my consumers never speak to the clojure functions directly

10:08 so my impl. classes have to do something in static blocks to bring up clojure?

10:09 I don't suppose anyone knows of a blog post with an example :-)

10:09 cemerick: andrewclegg: Sounds beautiful; yes, just require the relevant namespaces from Java, and invoke the functions you want.

10:09 andrewclegg: nice -- I'll try and see where that gets me

10:09 thx

10:10 xkb: is there someway to "disconnect" from a stream?

10:10 cemerick: andrewclegg: There's extensive examples in my book (sorry for the self-promotion). In short:

10:10 private static IFn requireFn = RT.var("clojure.core", "require").fn()

10:11 requireFn.invoke(Symbol.intern("your.namespace"));

10:11 Then use RT.var to get access to the functions you defined in your namespace.

10:12 andrewclegg: sweet, thanks for summarizing

10:14 rafl: so i implemented a library that provides a bunch of java classes and interfaces and i'd like to hand that off to the java people to write applications with

10:14 for that, i'd like to provide them with documentation for the java api

10:14 should i be looking at any tools to generate docs targetted at java people from doc strings or whatever?

10:14 andrewclegg: rafl: sounds like you just volunteered to write such a tool :-)

10:15 clgv: I want to implement a custom serializer for kryo in clojure. unfortunately "Serializer" is an abstract class and not an interface. is the only clojure way to use a genclass or what other options do I have?

10:15 I cant use a deftype, can I?

10:16 rafl: andrewclegg: fair enough. i might as well :)

10:17 raek: clgv: you can only use proxy or gen-class in that case

10:17 clgv: ok deftype does not work

10:17 raek: well then it's genclass since I do not need to proxy any of the methods

10:17 cemerick: rafl: I looked at generating javadoc from Clojure sources a long time ago.

10:17 javadoc is *not* easy or simple to extend

10:18 raek: or make a adapter class in java that delegates to something more clojure-friendly

10:18 rafl: cemerick: actually, that's the route i was going to try first. did it turn out to be particularly impossible?

10:18 cemerick: The general consensus we reached then was that generating dummy Java source files from Clojure-defined types and running Javadoc over that was the most reasonable path.

10:19 raek: yuck

10:19 cemerick: rafl: Yeah, it's *really* gnarly.

10:19 rafl: *nod*

10:19 cemerick: raek: That's what I thought at first. Then I looked at javadoc.

10:20 clgv: raek: hm right I could make a wrapper class that uses an interface

10:20 rafl: cemerick: any chance of finding your clojure types -> fake java code stuff somewhere public?

10:20 raek: how about the other way? is it simple to extract javadoc data from java source?

10:20 cemerick: rafl: Oh, I never actually implemented that! :-P

10:20 rafl: marvellous!

10:20 cemerick: Wouldn't be super-difficult, but never hit the top of my priority list.

10:21 raek: No. I don't recall the details.

10:21 rafl: it seems quite doable, really. just a little unsure about how many yaks i want to shave today.

10:21 * cemerick is always helpful.

10:33 emil`: does anyone know why the clojurescript repl sample doesn't respond after the second post is sent to the server?

10:33 mikera: @andrewclegg - you're not the Andrew Clegg from RGS Guildford by any chance?

10:37 andrewclegg: mikera: yeah, from like 20 years ago!

10:46 wjlroe: How do I check if an atom is defined?

10:46 jingguo: Hi, All. Is tools.logging is a replacement of clojure.contrib.logging?

10:47 pyr: wjlroe: (if @atom) ?

10:48 wjlroe: pyr: just says Unable to resolve symbol

10:49 pyr: wjlroe: well then that's something else entirely

10:49 wjlroe: it's not specific to an atom, you just have a symbol that's not declared

10:49 wjlroe: pyr: I want to define an atom if it hasn't already been defined

10:50 pyr: i'm not sure you're doing it right

10:50 (def foo (atom nil))

10:50 (when-not @foo (reset! foo some-val))

10:50 wjlroe: pyr: ok, I'll try that

10:51 pyr: or you can use memoize

10:51 raek: pyr: there is a race condition in that piece of code

10:52 pyr: raek: how so

10:52 zoldar: (swap! foo #(when-not % some-val)) ?

10:52 clgv: zoldar: thats it

10:53 raek: pyr: the atom can change between the deref and the reset!. swap! should be used here

10:53 pyr: ah, of course

10:57 wjlroe: raek: thanks! I wouldn't have spotted that. makes the code much better implementing that

10:57 pyr: thanks for your help

11:11 ljos: Hi - If i want to do this in clojure how would I do it? frame.getContentPane().add(comp) I'm pretty new to clojure...

11:11 jcromartie: (.. frame (.getContentPane) (.add comp))

11:11 I think

11:11 (is ".." deprecated?)

11:12 http://clojure.org/java_interop

11:12 ljos: wait.. I wrote the wrong thing. It should be frame.getContentPane().add(comp, BorderLayout.CENTER)

11:12 clgv: jcromartie: idk, but you can also use (-> frame .getContentPane (.add comp))

11:13 ljos: Can I do it in a doto.. I have some other things I need to do to the frame as well..

11:14 jcromartie: clgv: ah yes, -> is more idiomatic

11:14 I am dipping into interop right now too

11:14 using doto at the moment

11:16 duck1123: ljos: If you're using Swing, I'm pretty sure there's one or more libs that abstract away most of the nastiness

11:18 ljos: duck1132: probably, but there is very little swing I need to do. I just wanted the frame up and running.

11:19 clgv: ljos: yes you can

11:19 ljos: Most of the swing stuff is in java. I just needed to start it properly.

11:19 clgv: Ty for your help, I just managed to make it work. This is sweet!

11:20 Thanks to everyone who answers as well :D

11:21 todun: what's the difference between def, defn, clojure ?

11:22 duck1123: defn is a function, def is any var.

11:22 (defn foo [x] x) vs (def foo (fn [x] x))

11:23 jcromartie: and defn supports a bit more than def, too

11:23 like comments

11:23 and pre/post-condition maps

11:24 clgv: duck1123: defn is a macro ;)

11:25 duck1123: Yes, there are more differences than what I showed, but that's the imortant part he needs to know

11:26 if you're ever in the situation where you're trying to take the value of defn, you're probably doing something wrong anyway

11:30 chrido: hi, i want to insert a joda-datetime thing with clojure.java.jdbc into the database, which format string do i have to use?

11:31 YYYY-MM-DD HH:MM:SS behaves quite funny, i get Incorrect datetime value: '2011-10-285 15:10:54' for column 'lastUpdate' at row 1

11:32 duck1123: chrido: I believe sending the time as a number works

11:33 andrewclegg: ljos: are you doing swing? would this help? https://github.com/stathissideris/clarity

11:33 duck1123: 285 days in October?

11:35 chrido: duck1123: do you know mean as timestamp?

11:35 yyyymmddhhmmss also doesn't work

11:37 duck1123: chrido: right, if you can get it as a timestamp, this should eliminate parsing issues

11:38 but your real issue is your date is malformed

11:38 '2011-10-285'

11:41 chrido: duck1123: this is what bothers me most, this is the code which prints "2011-10-285 17:10:14"

11:41 (. (org.joda.time.format.DateTimeFormat/forPattern "YYYY-MM-DD HH:MM:SS") print (new org.joda.time.DateTime))

11:42 duck1123: I don't know if it's the same as the java string, but try "yyyy-MM-dd hh:mm:ss"

11:42 todun: duck1123: ok. so def is like 'var ?

11:43 duck1123: todun: def defines a var, yes

11:44 chrido: duck1123: with "yyyy-MM-dd hh:mm:ss" i get "2011-10-12 05:43:16",

11:46 duck1123: "yyyy-MM-dd HH:mm:ss" is OK, gives 24hours

11:46 todun: duck1123: when I do this (def var 12) => 12, ('v 12) => nil, 'v => v

11:46 chrido: duck1123: thanks a lot! but will try to convert it to timestamp

11:47 duck1123: todun: v => 12

11:49 'v gives you the quoted symbol. #'v gives you #'user/v (or whatever ns you're in) v gives the value pointed at by #'v

11:50 clgv: &#'v

11:50 lazybot: java.lang.Exception: Unable to resolve var: v in this context

11:50 clgv: &#'map

11:50 lazybot: ⇒ #'clojure.core/map

12:01 llasram: OOC, why are their multiple evaluation bots hanging out here, and are their interfaces documented anywhere?

12:01 s,their,there,

12:02 jcromartie: what's a good way to get a lazy seq of forms from a file

12:02 I'm trying to whip it up myself

12:02 but if there's an example

12:02 duck1123: bots become smug when there's no cometition. It keeps them honest

12:03 ejackson: duck1123: they're lispbots, its in their nature.

12:19 galderz1: hi all

12:19 have a question about the move of contrib to separate git repos

12:19 does anyone know where http://richhickey.github.com/clojure-contrib/string-api.html lives now?

12:20 it's not clear from looking at http://dev.clojure.org/display/doc/Clojure+Contrib

12:23 seems like i'm not the only one asking: http://groups.google.com/group/clojure/browse_thread/thread/973fae166ba4121d?pli=1

12:24 duck1123: clojure.string

12:25 most of the string stuff come with clojure now

12:25 galderz1: duck1123 but grep is not there for example

12:25 ^^

12:25 in particular, i wanted to grep a pattern in a file

12:25 there might be easier ways to do it of course

12:35 srid: (apply merge (for [] ...)) <- the for returns a list of maps that needs to be merged. is there a better way?

12:37 jkkramer: srid: you could use reduce to work with one map from start to finish

12:37 srid: reduce seems conceptually over-complicated for implemented 'set comprehensions' though

12:38 todun: duck1123: ok. I'll have to read up some more. thanks.

12:39 duck1123: srid: looks like merge uses reduce1, so you're probably better off with apply

12:40 srid: seems so. {for [] ...} would have been better ;-)

12:40 duck1123: since there's no special case for different # of args

12:40 jkkramer: srid: (into {} (for [] ...)) may also work, depending on what you produce with for

12:41 duck1123: if you can produce only the sets of keys you want, you could (into {})

12:41 srid: ,(into {} (for [x (range 5)] {x (* x x)}))

12:41 clojurebot: {0 0, 1 1, 2 4, 3 9, 4 16}

12:41 srid: ok

12:42 jkkramer: ,(into {} (for [x (range 5)] [x (* x x)])) ;also common

12:42 clojurebot: {0 0, 1 1, 2 4, 3 9, 4 16}

12:43 todun: how to quit out of a clojure repl

12:45 trptcolin: todun: ctrl-d will do it

12:45 todun: trptcolin: ok. no special "quit" or other?

12:45 trptcolin: nope

12:46 todun: trptcolin: thanks.

12:46 jcromartie: please critique my lazy form sequence function: https://gist.github.com/1281781

12:46 I'm a lazy-seq noob

12:46 trptcolin: sure thing. lein repl has a fancy command: (exit), but nothing built-in

12:47 todun: trptcolin: that didn't work for me though,

12:47 trptcolin: using which version of lein?

12:47 todun: 'lein repl' user=> exit

12:47 #<core$exit leiningen.core$exit@4b17b450>

12:47 trptcolin: (exit)

12:47 it's a function call

12:47 todun: ha. like all of closure :)

12:47 *clojure

12:49 jcromartie: seems to work well enough

12:49 srid: lamina question: i defined a second filtered/mapped channel like this: (defonce event-queue (->> sink-queue (map* foo) (filter* identity))) ... but this would run in module load. what if I wanted to define this only when a function (eg: "initialize") is called?

12:51 duck1123: srid: [shameless plug] you could try definitializer in Ciste. https://github.com/duck1123/ciste

12:51 srid: which file?

12:51 \

12:51 duck1123: But that also hooks into the config and environment system

12:52 it's in ciste.config

12:55 todun: I'm about to write my first clojure in emacs now. but I'm a bit hazy as to some of the details. First I have to create a project(still not sure if I have to do this all the time like eclipse workspace). Then I know I have to open emacs in /src. Then connect to some swank server using M-x, clojure-jack-in. Then be in a name-space....etc. Does anyone know where I can find steps to do all this? thanks.

13:01 technomancy: todun: your patience is remarkable =)

13:01 dnolen: todun: if you just want to learn Clojure it seems like you're going thru a lot of trouble.

13:01 jcromartie: todun: might I recommend 4clojure?

13:01 technomancy: I signed off irc last night when you were figuring out clojure-mode and the first thing I see when I sign back on is that you're finally ready to code =)

13:02 jcromartie: http://www.4clojure.com/

13:02 duck1123: todun: have faith. It gets better.

13:03 cemerick: todun: I have to check: did you try the eclipse plugin, and find it not to your liking (I'm assuming here you are more familiar with eclipse…)?

13:03 technomancy: todun: the steps you've listed are correct. for starters it's simpler if you stay in one namespace/file

13:04 todun: thanks all.

13:04 I'm interested in emacs so that I can know what to do whatever the platform. in other words, I want to be platform agnostic when learning clojure.

13:05 cemerick: carry on, then :-)

13:05 todun: cemerick: sure.

13:05 technomancy: so the steps are correct.

13:06 technomancy: should I have to create a project each time I start?

13:06 technomancy: todun: no need; if you're doing experimentation you can re-use a scratch project

13:06 todun: can I just have one folder which has /src in it. then from there have all my .clj in /src ?

13:07 technomancy: scracth project?

13:07 technomancy: will this let me save the work into a file?

13:08 technomancy: right; just do "lein new scratch" and work in the src/ dir of that project; that's probably the simplest for just experimentation

13:09 you can get standalone sessions outside a project, but for learning's sake it's quicker to just get accustomed to a project-centric approach

13:09 todun: ok. trying that now...

13:10 duck1123: sooner or later you're going to want a library outside of clojure, and it's easiest if you can just add it to the project file

13:10 todun: I cd scratch

13:10 clojurebot: No entiendo

13:11 todun: duck1123: meaning?

13:11 duck1123: as in which is the project file?

13:11 duck1123: is there a main project file?

13:11 technomancy: todun: project.clj in scratch defines your project settings including dependencies

13:11 duck1123: when you do "lein new scratch" it will create a "project.clj" file

13:12 todun: duck1123: I though scratch of anything I do with 'lein new project' is a project file

13:12 duck1123: that's how lein knows what libraries you're using

13:12 technomancy: at some point you should read "lein help tutorial" though I hate to distract you from actually writing code.

13:12 * technomancy doesn't understand why the download numbers for outdated lein versions still continue to rise.

13:13 todun: technomancy: this doesn't cover dev in emacs though : https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md

13:14 duck1123: ok.

13:15 after creating, opening a file first-project.clj(in /src), connecting to server, then what?

13:15 technomancy: todun: open the file in src/scratch/core.clj and do C-c C-k; that will compile it in the repl

13:15 write some code in there, and then recompile to see its effects

13:16 then C-c M-p to switch the namespace repl buffer to match the file you're currently in

13:17 todun: technomancy: so I should keep the name of core.clj?

13:17 technomancy: if it's just for experimentation it doesn't matter

13:17 duck1123: for now, unless you have a better name

13:18 todun: oh I see. core.clj doesn't exist yet.

13:18 duck1123: it should be in src/scratch/core.clj

13:19 in the scratch directory that lein new made

13:19 todun: actually it does at sractch/src/scratch/core.clj

13:20 duck1123: cd into the scratch folder and work from there

13:20 then do a git init and make your initial commit

13:20 todun: ok. I have it open with (ns scratch.core) as its sole content

13:20 duck1123: magit is an awesome git client

13:21 todun: so it allows me to make commits directly from emacs?

13:21 I actually have an idea of a group of functions I want to write.

13:21 duck1123: C-x g (assuming you're using starter kit)

13:22 todun: yes

13:22 technomancy: duck1123: in v2 it's actually C-c g if you're using the bindings module; M-x magit-status if not

13:22 todun: do I write my code before I connect to the swank server?

13:23 duck1123: technomancy: Not sure how I feel about that. My fingers are too trained

13:23 technomancy: todun: doesn't really matter, but you can't try it out until you're connected

13:23 duck1123: trying to be a little better about followin gconventions

13:26 todun: technomancy: ok. let me write something quick and test it.

13:28 how to undo in emacs starter-kit? I've always used C - ?

13:29 duck1123: C-_

13:29 or C-/ or C-x u

13:30 TimMc: todun: M-x undo and then look at the hint that appears in the minibuffer.

13:30 It should tell you a keybinding.

13:30 todun: TimMc: thanks.

13:30 duck1123: C-h f undo <ret>

13:31 TimMc: :-)

13:39 todun: does anyone get a weird indent when using emacs starter kit?

13:39 I get it whenever I comment out a line.

13:39 and hit return.

13:41 technomancy: duck1123 ok. I have my function written in scratch. what next?

13:41 connect to swank?

13:42 duck1123: connect to swank, switch to that ns, run the fn and make sure it works

13:43 then write a unit test for it.

13:45 todun: connecting to swank...switch to ns ?

13:53 dnolen: so any opinions on the ClojureScript string/keyword patch? http://dev.clojure.org/jira/secure/attachment/10382/84-str-on-symbol-keyword.patch

13:55 todun: my comments in emacs-starter-kit seem to be right-justified. is this normal?

13:55 duck1123: if you do ;; then emacs will keep them in line with the code

13:56 todun: duck1123: ok. thanks.

13:56 I had to go back to the cli. emacs app was acting funny

13:56 so I'm connected. what did you mean by switch to the ns?

13:56 ibdknox: dnolen, what's the practical implication of that change?

13:57 todun: duck1123: I thought I was already in the ns

13:57 dnolen: ibdknox: (str :foo) -> ":foo"

13:57 ibdknox: currently (str :foo) -> :foo

13:57 todun: duck1123: when I start in core.clj

13:57 dnolen: ibdknox: same for symbols

13:57 duck1123: You start off in the user ns, the repl will show your current ns

13:57 jkndrkn: hey all. i'm working with a multi-threaded webservice. we want to collect timing information for a request. we'd like to avoid making ad-hoc changes to our existing code in order to pass in and pass out a map that will accumulate timing information.

13:58 ibdknox: dnolen, the same for symbols?

13:58 dnolen: (str 'foo) -> 'foo in CLJS

13:58 ibdknox: ,(str 't)

13:58 duck1123: todun: if you C-c C-k the core.clj file, the C-c M-p it'll switch you to the right ns)

13:58 clojurebot: "t"

13:58 ibdknox: dnolen, why the difference?

13:58 dnolen: ibdknox: exactly, patch aligns CLJS w/ Clojure

13:59 ibdknox: gotcha

13:59 duck1123: todun: alternately (do (require 'scratch.core) (in-ns 'scratch.core))

13:59 jkndrkn: however, if we were to create some kind of global state (a map) that could instead be passed timing information from within arbitrary parts of our system, we would still need to pass around some kind of request-id in order to assign timing data to the global map in a way that it uniquely identifies timing information for a given request

14:00 unfortunately, we don't already pass the same data structure to all corners of our request, otherwise we would simply accumulate performance data on that data structure via metadata.

14:00 have any ideas?

14:00 ibdknox: dnolen, looks fine to me

14:01 jkndrkn: we're using compojure (jetty), if that helps

14:01 todun: C-c C-k then C-c M-p ==== (do (require 'scratch.core) (in-ns 'scratch.core))

14:02 ibdknox: jkndrkn, middleware + an atom + thread binding

14:02 todun: duck1123: where do I put (do (require 'scratch.core) (in-ns 'scratch.core)), before (ns scratch.core) ?

14:02 duck1123: essentially. C-c C-k reloads the current file, C-c M-p switches the repl's ns

14:03 todun: in your repl

14:03 You could do it as two commands, the do is so it's a single command in your history

14:04 todun: duck1123: so they're equivalent at least in action?

14:05 duck1123: todun: right. You can't switch to the namespace until it's loaded. That's what require does. The in-ns changes the repl's ns

14:06 jkndrkn: ibdknox: we've considered an atom and thread binding. could you clarify as to how you would use middleware?

14:07 todun: duck1123: this is what my emacs stuff looks like: http://pastebin.com/AxVUq9Cg

14:07 ibdknox: jkndrkn, you need your atom to be specific to each request. if you bind at the level of middleware, it will be. Take a look at the session implentation in ring or noir

14:08 jkndrkn, https://github.com/ibdknox/noir/blob/master/src/noir/session.clj#L49

14:09 jkndrkn, then you just need to make sure other threads that are spawned from that request use bound-fn

14:09 ,(doc bound-fn)

14:09 clojurebot: "([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."

14:09 todun: duck1123: after putting the line of code, what next? did I put the line of code in correctly?

14:09 ibdknox: actually.. there was talk at some point of having threads automatically pick up the bindings of whatever called them, did that ever happen?

14:10 jkndrkn: thanks, i'll look into that

14:10 duck1123: ibdknox: that's cool, didn't know that one. Have some code to simplify

14:10 mabes: ibdknox: in 13 the bound-fn would not be needed

14:10 ibdknox: er.. 1.3

14:10 ibdknox: mabes, k, so it does it by default in 1.3 then?

14:11 that would be the desired behavior in my mind

14:11 mabes: ibdknox: that is my understanding yes, you need to declare the var as dynamic though

14:11 ibdknox: yep yep

14:11 duck1123: todun: try calling your function. Does it work?

14:11 todun: duck1123: so I just call it from the repl?

14:13 duck1123: I get the following error: http://pastebin.com/iWj6BNuU

14:14 duck1123: todun: what does your repl prompt say? If it still says "user>" then you didn't change the ns correctly

14:14 mabes: So I had to do something like https://github.com/duck1123/ciste/blob/master/src/ciste/triggers.clj#L33 are you saying that's no longer required?

14:16 mabes: duck1123: that is what I'm saying, but I haven't actually updated my apps to 1.3 yet.. so I may be incorrect, but that is what I remember from Rich's keynote at the last conj and other readings

14:16 somone with actual 1.3 experience may want to confirm the thread local bindings queustion...

14:17 duck1123: I vaguely remember hearing that, but I wrote this well before that feature would've been put in

14:17 todun: duck1123: this is what it says. ; SLIME 20100404

14:17 user> greeting

14:18 duck1123: todun: you're still in the default user ns. Try switching the ns again

14:18 todun: duck1123: I changed to it and pressed enter. It then changed to this: http://pastebin.com/TXXAygzp

14:19 duck1123: I thought that the line of code I put in my app did that on my behalf, no?

14:19 duck1123: put it in the repl, not the code

14:19 amalloy: ,(future (println "1"))

14:19 clojurebot: #<core$future_call$reify__5733@1d4e606: :pending>

14:19 amalloy: ,@(future (println "1"))

14:19 clojurebot: 1

14:20 mabes: ,*clojure-version*

14:20 clojurebot: {:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}

14:20 amalloy: duck1123, mabes: this works only because clojurebot is on 1.3. lazybot, on 1.2, should behave differently: ##@(future (println "1"))

14:20 lazybot: ⇒ nil

14:20 todun: duck1123: ok..

14:21 duck1123: amalloy: good to know. I use a bound var to represent some things and I needed those things to still be bound in my triggers

14:24 todun: duck1123: ok. I think that worked. is that all I do?

14:25 duck1123: yep, code some more, C-c C-k in that file, then run it again from the repl

14:29 todun: duck1123: anytime I try to load a new function, the old one persists.

14:29 do I have to restart eclipse over again ?

14:30 duck1123: todun: Oh, you're on eclipse now? I think there's an option to reload the repl

14:50 daniel___: https://github.com/danielstockton/evolve/blob/master/src/evolve/core.clj can anyone point out a method to println each generation?

14:51 i've seen you can use do to execute side effects, but the problem is the important statement is the return statement

14:51 i can't println until it's been evaluated

14:52 line 26 is the one i need to modify, so for each iteration i can log whats going on

14:56 amalloy: &(doto (inc 5) println)

14:56 lazybot: ⇒ 6 6

14:56 ipostelnik: daniel___, look at clojure.contrib.trace

14:57 daniel___, returned value of a do is the last form executed

14:57 amalloy, that's a clever trick

14:58 duck1123: daniel___: Here's the macro I use https://github.com/duck1123/ciste/blob/master/src/ciste/debug.clj#L5

15:03 Raynes: dakrone: Ping.

15:03 TimMc: amalloy: Huh, kind of acts like a begin0

15:06 ibdknox: or just use a let?

15:13 amalloy: TimMc: i think you mean a prog1, you crazy schemer

15:14 daniel___: doto does the reverse order of do?

15:14 so the first is returned

15:14 Raynes: Do does something completely different, but sure, the first is returned.

15:15 &(doto "hi" println)

15:15 lazybot: ⇒ hi "hi"

15:15 daniel___: ah ok

15:15 llasram: daniel___: doto evalutes it's first argument, and embeds the evaluated value as the first argument in the subsequent forms. Check the macroexpansion

15:15 Raynes: &(macroexpand '(doto "hi" println))

15:15 lazybot: ⇒ (let* [G__15133 "hi"] (println G__15133) G__15133)

15:15 daniel___: ok, will do...it's jsut what i wanted

15:19 one more thing, with vimclojure when i launch the repl \s....should the file be loaded so i can call functions in it's namespace? or do i have to explicitly load it? because at the moment it cannot resolve symbols i've defined

15:23 dakrone: Raynes: pong

15:24 Raynes: dakrone: How much trouble would it be to release some sort of alpha or something of clj-http? I'd like to have something non-snapshot and running on 1.3 to depend on.

15:24 Assuming that it isn't currently broken or something.

15:25 dakrone: Raynes: the current release "0.2.1" runs completely fine on 1.3, or did you need some feature in master that hasn't been released?

15:25 Raynes: Oh, it does? Awesome. In that case, nevermind.

15:26 dakrone: I've been testing with 1.2.1 and 1.3 since I took it over to make sure it's always compatible with both

15:31 TimMc: amalloy: More of a Racketteer, really.

15:32 zakwilson: ,(format "%x" (- (BigInteger. "4e95d6b5975a97db24369193", 16) (to-long (now)))) ; is there an easy way to do this?

15:32 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: to-long in this context, compiling:(NO_SOURCE_PATH:0)>

15:32 zakwilson: Oh, right.

15:32 ,(format "%x" (- (BigInteger. "4e95d6b5975a97db24369193", 16) 1318447929255))

15:32 clojurebot: #<IllegalFormatConversionException java.util.IllegalFormatConversionException: x != clojure.lang.BigInt>

15:33 technomancy: TimMc: not a raconteur?

15:33 TimMc: hmm

15:34 zakwilson: ,(format "%x" 10000000000000000000000000000000) ; reduced to the simplest version

15:34 clojurebot: #<IllegalFormatConversionException java.util.IllegalFormatConversionException: x != clojure.lang.BigInt>

15:34 TimMc: mouseketeer

15:34 technomancy: TimMc: http://www.penny-arcade.com/comic/2007/03/23

15:35 daniel___: is there anything i can call within an iterate to give me the number of the iteration?

15:35 llasram: zakwilson: clojure.core/format is thin wrapper around java String.format(), which doesn't know about the Clojure 1.3 BigInt type

15:37 zakwilson: http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics

15:47 wiseen: ClojureScript doesn't seem to support docstring in ns macro ? Is this true/intentional or a bug ?

15:49 (ns test "DocString?") -> java.lang.AssertionError: Assert failed: Only :refer-clojure, :require, :require-macros, :use and :use-macros libspecs supported

15:50 duck1123: we need a clojurescript bot in here

15:51 wiseen: duck1123: Think it's my install ? I'll pull the latest but I think I'm only a few days behind ... and it works otherwise

15:54 nope, same thing ... will submit a bug report then

15:56 zakwilson: Ok, maybe I'm just dumb, but I'm not seeing a simple way to format a BigInt as a hex string without going Bigint -> String -> BigInteger -> String.

16:02 alpheus`: Heh. I needed to look at some vectors of maps so I'm emitting orgtbl-mode format for easy viewing in Emacs.

16:20 todun_: duck1123: just got your message. not on eclipse I mis-typed(was obviously nodding off). still emacs.

16:20 duck1123: if I make a change, do I reload the namespace somehow?

16:21 duck1123: C-c C-k in the changed file will reload it in the current vm

16:22 todun_: duck1123: after I use those commands, I get this Compilation finished. (No warnings) [0.01 secs]

16:22 duck1123: then I switch wondows.

16:22 duck1123: todun_: that means it's working :)

16:22 todun_: then I get an exception when I call the function with args.

16:23 duck1123: I call the function like so: (greeting "work")

16:24 duck1123: What does the exception say? If it compiles but does not run, there's probably some logic error

16:24 todun_: duck1123: (defn greeting "'Hello, username.' This is tough, but fun." [username] (str "hello, " username))

16:25 duck1123: that's the function.

16:25 duck1123: I already suspected it didn't compile because it doesn't let me tab complete.

16:26 duck1123: exception is http://pastebin.com/RtJGp3Av

16:27 duck1123: todun_: you're in the user ns again

16:29 todun_: duck1123: phew. I think I'm certifiably confused.

16:29 duck1123: shouldn't have that line of code in repl be equivalent to compiling it like we did using C-c C-k?

16:30 duck1123: C-c C-k compiles the line, but it does not change your repl's namespace

16:31 that's what C-c M-p is for or in-ns

16:31 The prompt in the repl shows your current ns, so if you see "user>" then you need to change

16:32 todun_: duck1123: so that changes it to a name space called scratch.code, right?

16:33 duck1123: thanks! it now works. it all does makes sense now, finally.

16:33 duck1123: C-c M-p will auto populate the ns associated with the current file. (whereever your pointer is)

16:34 todun_: duck1123: C-c C-k to compile ; C-c M-p to switch namespace. Then, like a script, call functions.

16:35 if I were using lein as 'lein repl', will I have to do all this?

16:35 duck1123: If you're using lein repl, then you don't have the fancy emacs commands

16:35 todun_: could I just emacs my thing then open a new repl in the same folder and do my testing?

16:35 duck1123: yeah, but I'll have another window.

16:36 duck1123: and perhaps achieve the same results, no?

16:37 zerokarmaleft: lein repl isn't quite as nice as slime/swank

16:37 raek: todun_: in lein repl you type (require 'scratch.code :reload) instead of C-c C-k and (in-ns 'scratch.code) instead of C-c M-p

16:37 duck1123: it's all the same in the end, you just won't have any of the features that slime provides. (ie. you can't C-c C-k to reload the file)

16:37 todun_: duck1123: if I wanted to use this scheme, how will I load my core.clj into the lein namespace which seems to be eternally 'user'

16:37 ?

16:38 zerokarmaleft: todun_: what raek said

16:38 raek: todun_: for future reference http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

16:38 todun_: raek: should I have it like so (do require 'scratch.code :reload) (do in-ns 'scratch.code)

16:39 raek: todun_: no. why the "do"?

16:39 todun_: zerokarmaleft: sorry was typing out of sync with them. got it.

16:39 duck1123: raek: I posted an example with do earlier

16:39 todun_: raek: didn't work the first time. I thought I saw duck1123 do that earlier.

16:39 raek: todun_: (do a b c) is not the same as (a b c).

16:40 duck1123: The do was only so both commands were the same command so you can pull it up from your history

16:40 ibdknox: oo

16:40 I wonder if that's a 1.0 of ring

16:40 raek: todun_: another neat trick is (doto 'scratch.code (require :reload) (in-ns))

16:41 todun_: duck1123: I see.

16:41 raek: that's the same as calling (let [x 'scratch.code] (require x :reload) (in-ns x) nil)

16:41 ...or (let [x 'scratch.code] (do (require x :reload) (in-ns x) nil))

16:41 duck1123: raek: should return x actually

16:41 raek: but let has an "implicit do" so you don't need to write it

16:41 duck1123: correct. my bad.

16:42 ibdknox: lol

16:42 todun_: raek: do I run them on the same line like so (require 'scratch.code :reload) (in-ns 'scratch.code)

16:42 ibdknox: doto twice in one day

16:42 todun_: raek: or line by line?

16:42 raek: todun_: doesn

16:42 todun_: doesn't matter

16:42 amalloy: raek: the nil at the end of your doto/let/do doesn't make any sense

16:42 raek: amalloy: yes, I know. I meant (let [x 'scratch.code] (require x :reload) (in-ns x) x)

16:43 todun_: raek: this is the output I get.

16:43 http://pastebin.com/ZEd69Fm4

16:43 ibdknox: lol

16:43 todun_, it has to be the name of your namespace

16:44 raek: todun_: I think you called in-ns by accident before you called require

16:44 todun_: that way you are now in an empty namespace with nothing in it. not even 'require'.

16:44 duck1123: todun_: isn't is 'scratch.core or did you rename?

16:44 raek: todun_: enter (in-ns 'user) to get back, and then call (doto 'scratch.code (require :reload) (in-ns)) again

16:45 cgray: it seems like my -main function is not exiting immediately when it's done running code... is there anything i can do to make it exit?

16:45 ibdknox: ,(= 'scratch.code 'scratch.core)

16:45 raek: (I think in-ns is hard-coded into the repl)

16:45 clojurebot: false

16:45 amalloy: yes, in-ns and several other things

16:45 raek: cgray: sometimes you need to run (shutdown-agents)

16:47 cgray: raek: thanks, that worked

16:47 todun_: duck1123: I didn't rename it.

16:47 amalloy: raek: fwiw you don't have to get back to the user ns to do this; you could instead (clojure.core/require ...) from inside the "broken" ns

16:47 todun_: ibdknox: should I space out in-ns to in - ns ?

16:47 raek: ok. let me try that.

16:48 ibdknox: I think there are too many people telling you what to do :)

16:48 duck1123: todun_: unlike most languages, - is legal in variable names. The proper name is "in-ns"

16:49 todun_: raek: I get this error. http://pastebin.com/FpKqSk4V

16:49 ibdknox: amalloy, what triggers injecting clojure.core into a namespace?

16:49 todun_: duck1123: oh ok. thanks.

16:50 amalloy: ibdknox: nothing does. you can reference anything that's been loaded by fully-qualifying it

16:50 or do you mean, in the non-broken case? like (ns foo)?

16:50 ibdknox: amalloy, yes

16:50 duck1123: todun_: you still have the namespace wrong. 'scratch.core

16:50 todun_: duck1123: I cd like so : http://pastebin.com/NEAY7T7C

16:51 amalloy: the ns macro has an implicit (refer 'clojure.core), whose parameters you can modify with the :refer-clojure directive

16:51 todun_: duck1123: yes. .core NOT .code! thanks

16:51 ibdknox: I see

16:51 amalloy: ,(macroexpand '(ns test))

16:51 clojurebot: (do (clojure.core/in-ns (quote test)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core))))

16:52 todun_: duck1123: raek thanks all!

16:52 amalloy: ,(macroexpand '(ns test (:refer-clojure :only [inc])))

16:52 clojurebot: (do (clojure.core/in-ns (quote test)) (clojure.core/with-loading-context (clojure.core/refer-clojure (quote :only) (quote [inc]))))

16:52 amalloy: i think

16:52 todun_: duck1123: is this all I need to know to begin developing using emacs and 'lein repl' ?

16:52 ibdknox: haha I like the quote of a keyword

16:52 ,(= :test ':test)

16:52 clojurebot: true

16:53 amalloy: ibdknox: just in case some future version of clojure makes keywords not self-evaluating, i'm sure...

16:54 ibdknox: amalloy, Planning for the future is important ;)

16:54 zerokarmaleft: todun_: that's a good start

16:54 duck1123: todun_: keep in mind, the emacs stuff isn't going to work if you're using lein repl

16:54 zerokarmaleft: todun_: you may find the cycle of reloading source files after you've changed them so you can test in your REPL to be a PITA

16:55 hence the keybinding in slime/swank for that sort of thing

16:55 amalloy: ibdknox: macros write all kinds of silly code that programmers never would, of course

16:55 (do (do (do (inc 1)))) :P

16:55 ibdknox: haha

16:55 yeah

16:56 I still love dnolen's first impl of match and the code it spit out

16:56 it was like 18 nested fn's

16:56 todun_: zerokarmaleft: oh ok. I wanted to know of the option just in case I needed to work without need of a text editor.

16:56 duck1123: emacs wont work if in lein repl, meaning?

16:57 technomancy: todun_: you can use it with lein repl, but it's kind of dumbed-down compared to swank

16:57 duck1123: C-c C-k and C-c M-p are swank commands

16:57 todun_: technomancy: use what with 'lein repl'?

16:58 amalloy: ibdknox: really? if you nest too many fns you actually get something that won't AOT-compile because the classfile's name is too long to write to disk

16:58 ibdknox: haha

16:58 amalloy, it is *much* better now

16:58 amalloy: &(class (for [_ [1] _ [1] _ [1] _ [1] _ [1] _ [1] ] (fn [])))

16:58 lazybot: ⇒ clojure.lang.LazySeq

16:59 amalloy: &(class (first (for [_ [1] _ [1] _ [1] _ [1] _ [1] _ [1] ] (fn []))))

16:59 ibdknox: last I saw it generated some very reasonable code

16:59 lazybot: ⇒ sandbox12208$eval15263$iter__15244__15264$fn__15265$iter__15246__15266$fn__15267$iter__15248__15268$fn__15269$iter__15250__15270$fn__15271$iter__15252__15272$fn__15273$iter__15254__15274$fn__15275$fn__15276$fn__15286

16:59 raek: whoa

16:59 technomancy: todun_: there's rudimentary emacs integration that works with lein repl

17:00 (setq inferior-lisp-program "lein repl") ; in Emacs lisp, followed by M-x run-lisp

17:00 amalloy: and even that filename is less than 256 characters, i guess. but you can see how if you nested things too deep you could run into trouble

17:00 technomancy: that should probably be set by default

17:01 todun_: technomancy: oh ok. interesting. that way I wouldnt have to connect to a server.

17:01 right?

17:02 clojurebot: to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks

17:02 zerokarmaleft: haha

17:02 amalloy: clojurebot: i officially reject your code

17:02 clojurebot: code-review is <rhickey> yikes

17:02 technomancy: todun_: right. it's not as fancy, but it's easier to set up

17:02 ibdknox: lol

17:02 feisty little bastard

17:02 todun_: technomancy: ok. thanks for that.

17:03 amalloy: clojurebot: someone oughta teach you to respect your betters

17:03 clojurebot: Hello, wiseen

17:03 ibdknox: rofl

17:03 duck1123: todun_: really though, stick with swank until you get the hang of the basics

17:03 todun_: duck1123: how do I use the labrepl now that I have all this setup?

17:04 duck1123: It's good to know how to drive a stick shift, but when you're just learning to drive, an automatic is easier

17:05 ibdknox: &(println "clojurebot is annoying")

17:05 lazybot: ⇒ clojurebot is annoying nil

17:06 ibdknox: I was hoping he might respond

17:06 it's not clear to me what gets clojurebot to say things

17:06 I guess I should look at the code sometime

17:06 amalloy: haha good luck with that

17:07 Raynes: I'm still trying to figure out what makes lazybot say things.

17:07 amalloy: from experience, though: (1) messages starting with ~ or clojurebot: (2) messages ending with ? (3) occasionally just for fun

17:07 todun_: duck1123: ok will do. thanks again.

17:07 thanks all.

17:07 technomancy: ibdknox: there's like a 1% chance he'll interpret any given line as being addressed to him

17:07 ibdknox: ~hey

17:07 clojurebot: what's up

17:07 technomancy: (sorry to spoil the magic)

17:08 ibdknox: lol

17:08 aw

17:08 amalloy: though he's obviously pickier about (2) since he diesn't answer all questions

17:08 zerokarmaleft: only the questions where the answers are snarky

17:08 amalloy: haha

17:08 clojurebot: are you a snark bot?

17:08 clojurebot: Thanks! Can I have chocolate next time

17:08 ibdknox: lol

17:08 amalloy: wow, really? snark<=>snack?

17:08 ibdknox: snark != snack

17:09 I wonder if it just matches first and last or something haha

17:09 Raynes: That's strange.

17:09 ibdknox: clojurebot, sna

17:09 clojurebot: Thanks! Can I have chocolate next time

17:09 ibdknox: clojurebot, s

17:09 clojurebot: lisp is the red pill

17:09 ibdknox: clojurebot, sn

17:09 clojurebot: I don't understand.

17:09 ibdknox: clojurebot, snalfgd

17:09 clojurebot: I don't understand.

17:09 ibdknox: hm

17:10 amalloy: clojurebot: ibdknox doesn't understand

17:10 clojurebot: Titim gan éirí ort.

17:10 ibdknox: haha

17:11 amalloy: clojurebot: you're not helping

17:11 clojurebot: Huh?

17:12 ibdknox: clojurebot, snamp

17:12 clojurebot: Pardon?

17:12 ibdknox: clojurebot, snam

17:12 clojurebot: Pardon?

17:12 ibdknox: wpw

17:12 wow*

17:12 wtf is the code that matches that

17:12 amalloy: ibdknox: in fairness you don't make any sense to me either

17:12 ibdknox: haha

17:13 amalloy, I'm talking gibberish most of the time, so that's fair

17:40 alpheus`: does vals return things in the same order as keys does or is the order undefined for both keys and vals

17:40 TimMc: ,(doc vals)

17:40 technomancy: alpheus`: order is guaranteed to be the same if called on the same map.

17:40 clojurebot: "([map]); Returns a sequence of the map's values."

17:40 TimMc: ,(doc keys)

17:40 clojurebot: "([map]); Returns a sequence of the map's keys."

17:41 TimMc: Should be doc'd, really.

17:41 technomancy: I think there's an open issue for it?

17:42 TimMc: Oh yeah, and how long does it usually take for a CA to get entered?

17:42 brehaut: TimMc: its not a short process

17:42 TimMc: :-/

17:43 alpheus`: technomancy: same map means *identical* map? or a map with the same keys?

17:43 amalloy: alpheus`: i think it has to mean identical

17:43 brehaut: TimMc: i think if you send one in, and then have some work you'd like to contribute and say you've sent one in, it'll get done as sooner

17:43 alpheus`: that's what I would have guessed.

17:44 brehaut: TimMc: call by need ;)

17:44 amalloy: since a given impl of IPersistent map can do whatever it wants for keys/vals, and can return a different impl of IPersistentMap for any call

17:44 &(class (dissoc (hash-map :x 1) :x))

17:44 lazybot: ⇒ clojure.lang.PersistentHashMap

17:45 TimMc: brehaut: Lazy loading? :-P

17:49 bsod1: I can't run example in this page of clojurescript https://github.com/clojure/clojurescript/wiki/Quick-Start , I'm getting `cljs is not defined` error in chromium, any ideas?

17:49 amalloy: &(zipmap (keys {:a 1 :b 2}) (vals {:b 2 :a 1})) ;; alpheus`

17:49 lazybot: ⇒ {:b 1, :a 2}

17:49 amalloy: i guess is the easiest proof that it doesn't hold for arbitrary maps

18:15 hiredman: "Using it as a library from Clojure apps is likely a minority case." <-- does this seem ridiculous to anyone else?

18:16 brehaut: hiredman: context?

18:16 ibdknox: hiredman, yes

18:17 that thread made me sad

18:17 hiredman: brehaut: rich talking about clojurescript

18:19 brehaut: its curious given that clojure itself is a library as much as it is a language tool

18:25 technomancy: rich criticizing imprecise use of the term "language tool" without actually defining it himself was kind of irritating

18:26 hiredman: rich … is kind of irritating

18:37 amalloy: i wonder what the majority case is supposed to be

18:39 hiredman: how dare anyone assume you can use clojure and clojurescript together

18:40 ibdknox: well, I think we're missing what matters

18:40 there won't be a majority case if it's not easy to use lol

18:41 * brehaut remembers cobbling together bash scripts based on the getting started wikibook page.

18:41 technomancy: people are going to use maven releases of clojurescript; it's just a question of whether there will be an official one or if it'll be community-driven

18:41 brehaut: i would rather not return to that

18:41 technomancy: much like the entire CLI experience, actually

18:41 deja vu

18:42 ibdknox: technomancy, yeah, and I'd rather it be official just to prevent us from having 30 cljs jars around

18:43 technomancy: ibdknox: as long as there's a strong community consensus I think that can be avoided

18:43 ibdknox: technomancy, fair enough

18:44 * Raynes puts a cljs jar on clojars.

18:44 ibdknox: lol

18:44 hiredman: technomancy: https://twitter.com/#!/aemoncannon/status/124252083477155841 so when can we get this from slime?

18:45 technomancy: hiredman: heh; vals vs vars? so like ... clojure.lang.IRefs are all blue? =)

18:46 hiredman: lexical vs. global bindings

18:46 technomancy: ah! now there's a thought.

18:46 M-. working on locals would be 100% badass

18:46 hiredman: uh, I don't care about that

18:47 just make them different colors

18:47 technomancy: well, if you can tell the difference, you might as well offer nav aid too

18:47 but yeah, both would be rad

18:47 hiredman: I guess

18:47 technomancy: I guess if you need M-. on locals you probably have functions bodies that are way too long for your own good

18:48 ibdknox: waaaaay too long

18:49 brehaut: ie core :P

18:49 todun: how to quit out of emacs nicely when using swank?

18:50 technomancy: todun: C-x C-c

18:51 todun: technomancy: but that doesn't work cleanly in that swank is still running.

18:52 technomancy: just tell it yes

18:52 hiredman: technomancy: depends how he is running swank

18:53 todun: hiredman: I'm running it with split window

18:53 brehaut: todun: the question is are you starting it from emacs (e.g. clojure-jack-in) or from lein

18:53 hiredman: using lein swank? clojure-jack-in? other?

18:54 technomancy: either way exiting emacs will not be harmful

18:55 duck1123: I've found that if I run swank in a terminal, when I kill emacs I get an exception in the terminal window, but it doesn't harm the app

18:55 todun: hiredman: clojure-jack-in

18:55 clojurebot: http://paste.lisp.org/display/74305

18:55 todun: technomancy: ok.

18:55 duck1123: uhm. ok

18:56 hiredman: duck1123: right, it's just swanking complaining

18:57 todun: hiredman: ok. thanks.

18:57 how do I get back to using labrepl?

18:57 hiredman: ugh

18:58 todun: I want to do its exercises but my local host can't connect t o it anymore

18:58 hiredman: does anyone maintain that?

18:58 todun: *clojure labs

18:58 hiredman: clojure labs. sorry about that.

18:59 duck1123: hiredman: last activity 25 days ago

19:01 todun: actually I was right. it is called labrepl http://foognostic.net/labrepl-summary/

19:01 it shows up in your local host as Clojure labs

19:04 ibdknox: the koans might be more interesting

19:04 todun: ibdknox: referring to me?

19:05 ibdknox: todun, yeah

19:05 easier to start with too

19:05 though the easiest is still try-clojure

19:05 or just messing around in clooj

19:06 todun: ibdknox: this https://github.com/functional-koans/clojure-koans ?

19:06 ibdknox: yep

19:06 todun: ok. thanks.

19:34 mabes: where does -?> live? I can never remember.. or is it ->?

19:34 brehaut: -?> is clojure.contrib.core i think

19:35 mabes: brehaut: thats it, thanks!

19:45 Viluin: hey guys

19:45 could anyone help me out with a small problem?

19:46 TimMc: Viluin: Just go ahead and ask your question; if someone can help they will answer.

19:46 Viluin: clojure is really weird to me

19:47 amalloy: i don't think that's a question yet

19:47 Viluin: getting there :P

19:47 http://pastebin.com/SfS1yRMy I was hoping this would return true if integer n was larger than the amount of characters in string s

19:47 but it doesn't compile at all

19:47 ;x

19:48 TimMc: needs [] around the args

19:48 amalloy: prefix functions

19:48 (< x y), not (x < y)

19:48 Viluin: oooh

19:48 TimMc: that too

19:48 Viluin: forgot about that

19:49 TimMc: I sometimes do that still. >_<

19:50 Viluin: (defn big [s n] ( < (count s) n)) just seems to return n, not a boolean

19:50 err

19:50 sorry, that wasnt true

19:51 that was me failing to run it correctly

19:51 TimMc: ,((fn [s n] (< (count s) n) "1234" 12)

19:51 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

19:51 TimMc: ,((fn [s n] (< (count s) n)) "1234" 12) forgot a paren

19:51 clojurebot: true

19:51 Viluin: it seems to work

19:52 TimMc: Viluin: While we're on the topic, ##(< 1 2 3 4) is a way to check if a series of numbers is in increasing order.

19:52 lazybot: ⇒ true

19:52 TimMc: (## is the bot trigger)

19:53 Viluin: I'm using ClojureBox on Windows, this is really cumbersome to work with

19:53 TimMc: and Clojure predicates don't always use true and false -- they may return logical false (nil or false) or logical true (everything else.)

19:53 Viluin: the REPL doesn't seem to support trivial things like copy-paste and pressing uparrow for the previous command

19:54 hmm

19:54 TimMc: ,(or nil 5 false)

19:54 clojurebot: 5

19:55 Viluin: if there's only 1 arg does it still need [] around it?

19:55 amalloy: isn't clojurebox basically emacs? it supports all of those things, but in less-crazy ways than you might expect

19:55 Viluin: emacs, yes

19:55 never used it before

19:55 TimMc: Viluin: Yes, it needs the []/

19:55 .

19:55 amalloy: M-p and M-n do the actions you expect from the up/down arrows

19:56 Viluin: I have no idea what that means :|

19:56 amalloy: alt-p/n

19:56 TimMc: M-p = Alt+p

19:56 blah

19:56 Viluin: oh

19:57 sometimes I wonder.. why?!

19:57 uparrow works.

19:57 why make it alt+p

19:57 duck1123: up arrow moves up, which is more what people expect

19:57 hiredman: because it's a text buffer like anyother, so you can use up/down to scroll around

19:57 TimMc: Viluin: For hysterical raisins.

19:58 (historical reasons)

19:58 hiredman: find some old output, copy and paste it, etc

19:58 TimMc: Arrow keys and such do not always transmit well in terminals.

19:58 amalloy: TimMc: that is not true at all

19:58 TimMc: amalloy: Really?

19:58 amalloy: i mean, yes, they often don't transmit well in terminals

19:58 but your claim that it's historical is nonsense

19:59 it's because, as hiredman says, you want to be able to edit text in the buffer

20:00 Viluin: if I have a collection, how do I check to see if it's a map, list or vector?

20:00 TimMc: Viluin: You usually don't care.

20:00 Viluin: I really don't, just doing some practice assignments to get to know this thing

20:01 duck1123: ,((juxt map? list? vector?) {})

20:01 clojurebot: [true false false]

20:03 Viluin: it's unclear to me what juxt does

20:03 amalloy: &(doc juxt)

20:03 lazybot: ⇒ "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to t... https://gist.github.com/1282995

20:04 amalloy: &((juxt inc dec) 1)

20:04 lazybot: ⇒ [2 0]

20:04 Viluin: so it applies all the functions to the arg and returns all the results?

20:05 amalloy: well, it returns a function which, when called, will do that

20:05 clojurebot: anonymous functions are functions with no names

20:05 amalloy: good call, clojurebot

20:05 &(let [do-math (juxt + - * /)] (do-math 10 20))

20:05 lazybot: ⇒ [30 -10 200 1/2]

20:07 Viluin: hmm

20:07 so if I want to write a function that determines the type of a collection

20:07 can I just make three if statements that go like if (map? collection) "map" etc?

20:08 TimMc: You might look at cond or condp.

20:10 Viluin: what's the difference?

20:10 wouldn't if statements work?

20:10 TimMc: Sure.

20:10 Viluin: coljure compiler errors are really good at providing absolutely no info about the error

20:10 lol

20:23 amalloy: clojurebot: juxt is usually the right answer

20:23 clojurebot: Ok.

20:24 ibdknox: amalloy, what does that enable you to do?

20:24 amalloy: ibdknox: hm?

20:25 ibdknox: does telling clojurebot let you trigger him somehow?

20:25 amalloy: *nod*

20:25 ibdknox: ~juxt

20:25 clojurebot: juxt is usually the right answer

20:25 ibdknox: I see

20:25 amalloy: amalloy: what's a good way to perform two functions on the same input?

20:25 juxt?

20:25 clojurebot: juxt is usually the right answer

20:25 ibdknox: lol

20:25 fun

20:26 amalloy: ibdknox: this one's just for fun, of course, but in general it's a useful way to create canned replies

20:26 clojurebot: where can i find zipWith?

20:26 clojurebot: It's greek to me.

20:26 amalloy: damn

20:26 ibdknox: haha

20:26 amalloy: clojurebot: zip?

20:26 clojurebot: zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))

20:26 brehaut: amalloy: why sporks?

20:26 ibdknox: ~contrib

20:26 clojurebot: contrib is http://github.com/richhickey/clojure-contrib/tree/master

20:26 amalloy: brehaut: because you said it yesterday and i thought it was funny

20:27 Viluin: well I've had enough for tonight, heading off to bed, thanks for the help guys!

20:27 brehaut: fair enough

20:27 amalloy: clojurebot: forget contrib |is| http://github.com/richhickey/clojure-contrib/tree/master

20:27 clojurebot: I forgot that contrib is http://github.com/richhickey/clojure-contrib/tree/master

20:28 brehaut: clojurebot: tell me about contrib

20:28 clojurebot: contribute is http://clojure.org/contributing

20:30 ibdknox: contrib?

20:30 clojurebot: contribute is http://clojure.org/contributing

20:30 amalloy: clojurebot: where did contrib go?

20:30 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

20:31 ibdknox: ah

20:31 that's the one

20:31 duck1123: clojurebot: where's contrib?

20:31 clojurebot: http://clojure.org/contributing

20:31 ibdknox: I assume it's just a string match

20:32 amalloy: i think there is some fairy dust involved

20:32 duck1123: One of these days I want to try getting an Alicebot working in Clojure

20:32 amalloy: specifically he has some kind of database of "things", with a full-text index of all "things"

20:32 and i don't understand full-text indexes, but i understand that he can look for "whatever is close to X"

20:33 * brehaut guesses that stemming of words may be involved

20:33 amalloy: duck1123: is that different from eliza?

20:34 duck1123: amalloy: quite a bit more advanced, but same idea. A chat bot

20:34 it used a XML language to define the bot's knowledge. Perfect job for a Clojure DSL

20:35 brehaut: duck1123: port it to core.logic

20:37 amalloy: mehhhhhh. the LA clojure usergroup made some desultory collaborative effort in this direction at https://github.com/Factual/eliza but it never really went anywhere. i think having a canonical way to represent the bot's knowledge isn't as interesting/flexible as having a ring-wrapper sort of architecture for it to make it more pluggable

20:37 * ibdknox agrees with amalloy

22:08 zakwilson: A potential client just asked for examples of sites built with Clojure. While I think the question is stupid, I have to humor him. Any good examples I can use?

22:11 chouser: zakwilson: I'm sure there are many. 4clojure.com is one

22:12 zakwilson: chouser: I'm aware there are likely hundreds. I just want a couple I can point at and say "See? These are nice and professional-looking.".

22:23 jkkramer: zakwilson: http://dev.clojure.org/display/community/Clojure+Success+Stories might help

22:23 zakwilson: jkkramer: thanks

22:40 darevay: For those that have been frustrated by vimclojure, here's my attempt at a "base" configuration that people can build from or sanity check: https://github.com/daveray/vimclojure-easy

23:06 srid: zakwilson: heroku uses clojure. checkout github.com/heroku/pulse which is their internal real-time operations dashboard

23:07 * srid is also writing something similar for activestate's http://stackato.com/

23:07 zakwilson: srid: thanks.

23:08 srid: dell uses clojure http://groups.google.com/group/clojure/browse_thread/thread/d1b77050260340f6

23:53 brehaut: amalloy: how are passwords stored on 4clojure?

23:53 amalloy: $google jasypt

23:53 lazybot: [Jasypt: Java simplified encryption - Main] http://www.jasypt.org/

23:54 amalloy: brehaut: that is, we one-way hash them and store the hash. we don't do any salting afaict, so a replay attack would probably work? i'm not an expert in the area

23:55 brehaut: amalloy: cool, thats all i really wanted to know :)

23:55 * brehaut signs up for 4clojure

23:55 amalloy: sweet

23:55 technomancy: clojurebot: how do you safely store passwords?

23:55 clojurebot: Gabh mo leithscéal?

23:56 technomancy: clojurebot: how do you safely store passwords is <reply>bcrypt. http://codahale.com/how-to-safely-store-a-password/

23:56 clojurebot: Ok.

23:56 technomancy: but to be fair jasypt probably gives you a better deal than sha1

23:56 brehaut: that article must have insane google juice by now

23:58 technomancy: googlebot crawls our logs, right? =)

23:58 brehaut: its the primary source

23:59 technomancy: jkkramer: did you get my privmsgs?

23:59 dsantiago: This is probably a really dumb question, but why does (type '(+ 1 2)) return a PersistentList and (type `(+ 1 2)) return a Cons?

23:59 duck1123: ~passwords

23:59 clojurebot: bcrypt. http://codahale.com/how-to-safely-store-a-password/

23:59 amalloy: dsantiago: ` does a lot of stuff

23:59 technomancy: dsantiago: basically you're never supposed to know there's a difference between the two classes

23:59 amalloy: &''(+ 1 2)

23:59 lazybot: ⇒ (quote (+ 1 2))

23:59 technomancy: whatever you do, don't use the list? predicate

23:59 amalloy: &'`(+ 1 2)

23:59 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/+)) (clojure.core/list 1) (clojure.core/list 2)))

Logging service provided by n01se.net