#clojure log - Mar 08 2010

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

0:21 Knekk: sorry, was afk

0:58 ha, figured it out

1:00 , (.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 50 java.math.RoundingMode/HALF_UP))

1:00 clojurebot: "0.14285714285714285714285714285714285714285714285714"

1:00 Knekk: dang

1:00 that wasn't at all obvious

1:01 (.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 100 java.math.RoundingMode/HALF_UP))

1:01 ,(.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 100 java.math.RoundingMode/HALF_UP))

1:01 clojurebot: "0.1428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571429"

1:01 Knekk: tomoj, hiredman: (.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 100 java.math.RoundingMode/HALF_UP))

1:02 thanks for the help

1:06 ,(doc drop)

1:06 clojurebot: "([n coll]); Returns a lazy sequence of all but the first n items in coll."

1:13 tomoj: Knekk: wow

1:13 Knekk: yeah

1:13 tomoj: Knekk: I'd prefer doing it myself with long division to figuring that out

1:15 Knekk: :) call me srubborn

1:15 stubborn

1:49 Raynes: HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();

1:49 What is the (HttpsURLConnection) bit doing there (for the Java guys in here).

1:57 Oh, a typecast I believe.

2:14 derefed: how do I convert from a string to a symbol? that is, how do I turn "foo" into 'foo ?

2:14 hiredman: ,(doc symbol)

2:14 clojurebot: "([name] [ns name]); Returns a Symbol with the given namespace and name."

2:14 derefed: oh wait--

2:15 yeah lol I just realized when I tried (symbol) before I screwed up the parens ;)

2:15 that was dumb of me

6:36 mozinator: hi everyone, I am working on a cool library

6:36 http://github.com/mozinator/clj-scenegraph

6:36 its a sort of wrapper over sun's scenegraph project, which is the foundation of javafx

6:38 I got a little problem though, I cant get autodoc to work, when I execute lein autodoc, it does not generate proper documentation ( the function docs are missing )

7:01 hoeck: mozinator: from what I can see in you source, you're swapped the docstrings of the first macros in clj-scenegraph/core.clj with the arglist

7:01 in clojure, docstring comes before the arglist

7:02 like (defmacro my-macro "my-macro-doc" [arglist] body)

7:02 mozinator: hoeck, thanks for the pointer, going to look at it

7:03 hoeck, that fixed it ! :)

7:03 hoeck, thanks :)

7:04 hoeck: mozinator: np, thats a little bit confusing at first

7:04 the arglist-after-docstring thing

7:05 btw, interesting library!

7:06 mozinator: hoeck, thanks !, when I finish testing the basics, I will start making some nice widgets!

7:07 AWizzArd: mozinator: when you say it is the foundation of javafx, does this then mostly mean that you want to allow to write JavaFX applications in Clojure (with your lib)?

7:07 mozinator: AWizzArd, exactly I would like to use Clojure instead of the Javafx language

7:08 AWizzArd: Right. Well yes, then this indeed sounds good.

7:08 mozinator: AWizzArd, and I want to add some nice goodies :)

7:08 AWizzArd, like a LWJGL backend

7:08 AWizzArd, and use penumbra'

7:08 to make cool GUI effects

7:09 AWizzArd: Ah, penumbra to allow fast GPU calculated effects?

7:09 mozinator: exactly !

7:10 at the moment scenegraph uses it's own effects compiler, but I like penumbra's effects much beter :)

7:11 and if the computer does not understand GLSL the effects are just basic clojure :)

7:11 AWizzArd: Yes, sounds really nice.

7:11 mozinator: and nothing is generated to disc, just generated GLSL in-memory

7:11 AWizzArd: Lots of GUI people could be very interested in that.

7:12 mozinator: AWizzArd, way more intuitive to make a GUI with Clojure !

7:12 Everything you do is immediatly applied

7:12 So its more like designing a GUI then programming

7:13 AWizzArd: How complete is the JavaFX support so far?

7:14 mozinator: AWizzArd, at the moment clj-scenegraph is just syntactic sugar for the scenegraph project https://scenegraph.dev.java.net/

7:14 Project Scene graph is not publicly developed by sun anymore

7:14 since 2008

7:15 AWizzArd: oh, too sad

7:15 mozinator: So I took the liberty to make a fork of it, and extended it with maven support

7:15 AWizzArd: But can you still use new features of JavaFX?

7:15 mozinator: btw, look into your private messages.

7:15 mozinator: AWizzArd, I dont think so, only the 2008 features

7:18 But for my purposes the Scenegraph project is complete enough

7:18 AWizzArd: I see.

7:18 Will it allow to add several "modern widgets" for applications?

7:18 Like password input fields, tab panes, etc.?

7:19 mozinator: You can embed the swing widgets

7:19 Or make your own widgets

7:20 AWizzArd: But into the swing widgets I can't embed JavaFX widgets right? For example, when I use a swing tab pane, then I can not put JavaFX widgets into it.

7:21 mozinator: You can put a JSGPanel into a Swing tab plane

7:21 and put a Swing tab plan into a JSGPanel

7:21 plan -> pane

7:21 AWizzArd: I see.

7:21 mozinator: You can some examples here: https://scenegraph-demos.dev.java.net/demos.html

7:22 AWizzArd: Is SceneGraph basically a lib to paint vector graphics?

7:22 mozinator: yes, based on the scenegraph "pattern"

7:23 which gives all kinds of benefits

7:23 AWizzArd: k

9:36 astoddard: I am looking at pre/post conditions on functions. I was expecting them to be metadata but apparently not. Is it intended to be able to add, alter or query conditions after function definition?

9:41 chouser: astoddard: there's not an API for it afaik, but you can query them if you really want to.

9:42 the original forms provided for :pre/:post are metadata on the arglists, which are metadata of the function's var

9:42 (map meta (:arglists (meta #'foo)))

9:43 They're implemented by inserting code directly in the function body at compile time, so I wouldn't expect there to be any way to add or alter them without redefining the whole function.

9:47 astoddard: chouser: thanks, very interesting, (and deep for me.) Seems counter-intuitive to have a post condition be metadata on an arglist.

9:48 chouser: hm, that's an interesting point.

9:49 pre-conditions of course pretty much have to be per-arglist, but I can certainly see an argument for a single set of post-conditions.

9:50 astoddard: Yes, as I am getting out of my depth anyway, I can envisage wanting a single set of post conditions on a multimethod.

9:56 chouser: yeah, I think pre/post on multimethods is vaguely planned. Certainly sounds useful.

9:59 astoddard: My idea about wanted to change/add conditions came from thinking about iterative development at the REPL.

10:00 I may not have established what all my assumptions are and adding some conditions later would be a QC check. (It would also let me assert assumptions about others code).

10:01 If I wanted to do this now I would need to get a function's source, redefine it and then rebind it?

10:03 a_strange_guy: astoddard: you could build a HOF that wraps an existing function with pre/post-condition checking

10:04 there was a Screencast (Full Disclojure) on that

10:05 {:pre ... :post} is just the most primitive building block for design by contract

10:06 Chousuke: aren't arglists attached to the vars of functions? you can change the metadata of those without redefining their value

10:06 chouser: Chousuke: yes, but that metadata isn't consulted when the function is run

10:07 :pre/:post is consulted when the function is compiled -- changing the metadata afterwards won't do anything useful.

10:07 Chousuke: hm, right, so the pre/post info is only considered at compile-time

10:08 a_strange_guy: chouser: it's actually never considered, :pre/:post works on anonymous functions

10:08 chouser: a_strange_guy: right. I meant that the :pre/:post are considered, not the metadata.

10:10 a_strange_guy: now with metadata for fn's you could attach :pre:post to the fn's directly

10:10 but I don't see any added value in overly strict design by contract

10:13 ,(> "interactive developement" "design by contract")

10:13 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

10:13 a_strange_guy: damn ^^

10:15 astoddard: a_strange_guy: (if (= "developer" "consumer of API") true "maybe")

10:43 chouser: rhickey: will mix-ins work for reify as they will for deftype?

10:43 I guess closures complicate things a little.

11:19 crowbar7: I just ordered both of he clojure books. hope they are both good reads.

11:19 the*

11:21 lancerx: I have to say I'm usually leary of programming books (although I _do_ have a Safari Bookshelf subscription), but I've found SH's book a very good investment

11:22 crowbar7: I like most of the apress books

11:22 I pre-ordered that one.

11:22 stuartsierra: yay!

11:22 crowbar7: I ordered the other one "programming clojure"

11:22 stuartsierra: boo!

11:22 :)

11:23 lancerx: stuartsierra: wasn't sure if that nick was you, but I decided I'd compliment you anyway :)

11:23 crowbar7: you a fan of the apress one I take it?

11:23 stuartsierra: I'm writing half of it.

11:23 crowbar7: LMAO

11:23 awesome.

11:24 lancerx: which means he'll have more of a love/hate relationship than fanish-ness :)

11:24 stuartsierra: you got it

11:25 crowbar7: stuartsierra: I'm new to clojure, but not as much to java or common lisp.

11:25 SynrG: programming clojure is my current "bus read" on my eee

11:25 nice to have repl right there at my fingertips as i read

11:25 lancerx: so if basic "white belt" is mastering the syntax, java interop and dev environment, then "green belt" must be starting to think in terms of "functional design"

11:25 the-kenny: Chousuke: Ha! Found you in http://www.flickr.com/photos/franck_/4414287310/in/photostream

11:25 SynrG: i'm quite enjoying it

11:26 the apress books will be next

11:26 lancerx: SynrG: heck yeah, I was REPLing on my flight Thursday, it was great

11:26 SynrG: also i have netbeans and enclojure on my eee model 4G (ouch)

11:27 works well enough. it's just that netbeans wants a display larger than 800x480. heh

11:27 lancerx: I actually went with emacs for dev after being a 20yr vi-guy and I'm in love

11:27 crowbar7: I have the pdf of programming clojure. it seems pretty good, but most books I prefer in print to be honest. Programming books especially, because I like to just be ale to flip it open and I seem to be able to read it better.

11:27 SynrG: xrandr --output LVDS1 --panning 1024x768

11:28 crowbar7: You use Graphiz for that graph generation?

11:28 SynrG: i'm using netbeans at work with ruby, so it's a natural choice

11:28 lancerx: oh so back to the green belt question: I totally grok the decomposition of functions (at least at my beginner level), but I'm struggling in thinking about complex data structures

11:29 crowbar7: lancerx: Such as b-trees?

11:29 lancerx: is there a good book, reference, etc for thinking about data structures in lisp/FP?

11:29 crowbar7: ummm hold on

11:29 lancerx: my working example is JCR (Java Content Repository), which is a hierarchical tree of content nodes

11:30 crowbar7: http://www.cs.sfu.ca/CC/310/pwfong/Lisp/3/tutorial3.html

11:30 maybe

11:30 lancerx: crowbar7: awesome man, thanks

11:31 crowbar7: yeah a quick skim says this is gonna be very helpful

11:32 wthidden: can you use a reader macro splice in a function?

11:33 crowbar7: lancerx: I used that to learn some common lisp data structs.

11:36 stuartsierra: wthidden: no

11:36 lancerx: stuartsierra: my input on next-gen clojure books would be a section on how to think about traditional data structures like tree/graphs, maybe a bit more on relational db graphs, etc

11:37 stuartsierra: yeah, that'd be nice

11:39 Which functions are primitive-aware?

11:40 I've got ==, <, <=, >, >=, pos?, neg?, zero?, +, -, /, *, inc, dec, and the unchecked-* functions.

11:40 Not the = function.

11:52 cemerick: Destructuring is not supposed to look ahead in lazy seqs, right?

11:52 Chousuke: I think it does, by one

11:52 cemerick: e.g. (let [[a & b] (foo)] ...) should only make the first item in the (foo) seq concrete

11:53 Chousuke: looks like it does, by two here

11:53 but I actually didn't think it looked ahead at all

11:55 Chousuke: I vaguely remember Rich mentioning that destructuring has "next" semantics, but you should confirm that.

11:57 cemerick: even seq appears to look ahead by one here, which definitely shouldn't happen IIUC

11:59 Chousuke: hm, seq has to, so it knows whether to return a seq or nil

12:00 cemerick: yeah, right, nm

12:00 I ran out of tea :-/ ;-)

12:10 defn: morning all

12:10 err nearly afternoon i guess

12:10 :X

12:11 <---awfully lazy

12:31 hmmm -- how do i use 1.2.0 with lein

12:31 nteon: defn: 1.2.0-master-SNAPSHOT ?

12:32 defn: thats only an educated guess

12:32 defn: does that work for contrib also?

12:32 technomancy: contrib is just 1.2.0-SNAPSHOT IIRC

12:33 defn: master-SNAPSHOT worked also

12:34 i thought duck-streams got renamed to .io

12:34 hm

12:34 nteon: cool, about the master-SNAPSHOT

12:46 stuartsierra: defn: it did

12:48 I think if you use contrib "master-SNAPSHOT" you'll only get old builds

12:49 fanatico: build.clojure.org only lists 1.2.0-SNAPSHOT

12:49 stuartsierra: that is correct

13:07 LauJensen: Anybody got the URL of that example Rich posted of using Cells ?

13:08 fanatico: LauJensen: http://gist.github.com/311542 <- this?

13:10 duncanm: boo, i have this stupid API that i have to use and it uses bit masks

13:10 i never remember to how set it up

13:10 LauJensen: fanatico: Dont think that was it

13:14 Still, that example does seem to show off all the stuff, its cool

13:30 triyo: whats the easiest way to transform a seq of [& :key val] into a map strucutre?

13:30 chouser: (apply array-map the-seq)

13:30 triyo: thx

14:33 Raynes: I wish ioke-mode.el wasn't (slightly) broken. :\

14:34 You have to start your code on the second line of every file because if you type an opening paren (and you almost surely will), it indents that line. :\

14:34 * Raynes needs to learn elisp so he can fix it. Or pay technomancy to do it. :p

14:36 technomancy: Raynes: sorry, my 2010 language is Duby. and 2011 is Factor.

14:36 so you'll have to wait a few years.

14:37 Raynes: Duby? That sounds interesting.

14:37 Though I don't think you'll need an entire year with Factor.

14:38 technomancy: well I'm not planning on stopping with Clojure... =)

14:38 Raynes: I didn't figure you would. Nobody can stop once they've started.

14:39 Aw, no wikipedia page for Duby. :(

14:39 ned: technomancy, just popping in to say thanks for your emacs repo ;)

14:39 Raynes: I am disappoint.

14:39 technomancy: Raynes: Duby has like ten users. ={

14:39 ned: cool!

14:39 Raynes: So does Ioke, but it has a wikipedia page.

14:40 Albeit a small and insignificant one, but one nonetheless.

14:40 Members: 40

14:40 * technomancy gets into a "my language is more obscure than yours" fight with Raynes

14:40 Raynes: The number of members on Kenai are exactly the number of members in the Ioke mailing list as of today.

14:40 :)

14:52 defn: 2010 is my Limbo year

14:52 (kidding..kidding..)

14:53 rsenior: I'm having some difficulty getting lein swank (and swank-clojure-project has the same problem) to recognize that my

14:53 files are in src/, it seems like I'm probably missing something

14:53 basic since I have a very small build etc but the namspaces that I

14:53 have in src/ aren't showing up in swank

14:54 oops, sorry that broke into multiple messages

14:56 I've seen a few things out there with regard to the leiningen swank version, I'm currently using 1.1.0 and have tried building what's out of the git repo, with the same results

14:57 defn: rsenior: what specifically are you trying to do

14:57 rsenior: I just have two clojure files, one references the other

14:57 defn: in new builds of lein you need to specify namespaces

14:57 hiredman: only for compiling

14:57 rsenior: that's what I was thinking

14:57 hiredman: not for classpath stuff

14:57 defn: *nod* -- im just not clear on what rsenior's problem is

14:58 rsenior: ok, I'll layout what I have

14:59 com/my/package/swank-project-test.test namespace

14:59 and a com/my/package/swank-project-test.test-common namespace

14:59 defn: the -'s might be your problem

14:59 rsenior: ok

14:59 let me pull them out

15:00 from the directory names as well?

15:00 defn: yeah

15:00 for the purposes of testing it anyway

15:00 i remember you needed to call -'s _'s in your project.clj

15:00 in order for it to work

15:02 hiredman: rsenior: com/my/package/swank-project-test.test-common is not a valid namespace

15:03 defn: hiredman: for the reason im describing or other?

15:03 hiredman: defn: other

15:03 namespaces don't contain '/'

15:04 defn: hiredman: oh yeah, i thought he was referring to his directory structure

15:04 but that makes sense

15:04 hiredman: in that case it is wrong too

15:04 defn: either way that would be incorrect

15:04 yeah

15:04 com.my.package.swank_project_test.test_common

15:04 arohner: When using clojure-mode in emacs, there is too much indentation when a function is continued to the next line

15:05 rsenior: I'm not using slashes, just .

15:05 yeah, that's how I've got it

15:05 arohner: i.e. (foo \n bar) indents like 6 spaces, when I want it to be 2. How do I fix that?

15:05 defn: arohner: on defs or on defn's?

15:05 arohner: defn: when calling functions

15:05 defn looks fine

15:06 (defn foo \n bar) indents 2 spaces, but (foo \n bar) indents 8 spaces

15:06 defn: arohner: hmm -- i think that's something you'd need to edit the clojure-mode.el to change, but there might be something to setq

15:09 arohner: clojure-mode uses lisp-indent-function it looks like

15:09 rsenior: defn: removed the - stuff and still the same result

15:09 defn: rsenior: something you might want to ask technomancy about -- i dont know :\

15:10 hiredman: rsenior: do your namespaces and directory structures match?

15:10 rsenior: yes

15:10 hiredman: how do you know?

15:11 defn: src/com/my/package/swank-project-test/test-common.clj

15:11 hiredman: no

15:12 - needs to be _ in filenames

15:12 rsenior: I got rid of all -

15:13 hiredman: so what is your namespace now?

15:13 defn: hiredman: right, but dont you still refer to them in the project.clj as -'s? i avoid them just because of that weirdness

15:13 rsenior: so now I have srcsrc/com/company/swanktest/squaretest.clj with a namspace of com.company.swanktest.squaretest

15:14 I don't reference any namspace in my project.clj, I'm just using the src/ default directory, so I figured it wasn't necessary

15:15 srcsrc above should just be src

15:15 hiredman: and what is the code that is failing?

15:15 rsenior: I'm not even to the code failing part

15:15 I run lein swank and run (all-ns) and don't even see the namespace in there

15:15 _ato: ah

15:15 there's your problem

15:15 hiredman: why would it be?

15:16 _ato: (all-ns) won't show namespaces until they're loaded

15:16 defn: bingo

15:16 _ato: it doesn't walk the classpath

15:16 rsenior: so just lein swank isn't aware of my source files?

15:16 per the docs, I thought it added src to the classpath

15:17 _ato: correct, but all-ns doesn't show you what's in the classpath

15:17 it shows you all the loaded namespaces

15:17 just try (require 'com.company.swanktest.squaretest)

15:18 rsenior: oh, I see what you're saying, the source is there, but needs to be included via use/require

15:18 ok

15:20 that was it

15:20 _ato: yep, that could be better documented. Clojure doesn't know a namespace exists until it's been loaded with use/require/load. The reason is that listing all the namespaces by searching for files could be very slow or even impossible: if it's loading classfiles from the web into an applet for example.

15:20 rsenior: wow, totally missed that one

15:21 so how do users of lein swank typically get that loaded

15:21 _ato: the way I usually work with lein swank is to open the file I want to edit and hit C-c C-k (compile file)

15:22 which will compile/execute it and hence pull in all the require/uses at the top of the file

15:22 rsenior: that's how I work with swank when I launch it inside of emacs

15:22 ok, I understand

15:22 thanks so much for the help

15:49 Scriptor: hey everyone, got a question about macros

15:50 Raynes: EVIL!

15:50 Scriptor: since Clojure is compiled, does that mean that the compiled code for a macro is run *during* compile-time when it's called?

15:50 Raynes: BEGONE!

15:50 Scriptor: heh

15:50 it's just an implementation question!

15:51 Raynes: ;)

15:51 That's an interesting question that I don't know the answer to. Sadly, I'm not going to be here to see the answer. Shower time.

15:52 LauJensen: Raynes: Shower time? Oh its monday already? :)

15:52 hiredman: Scriptor: yes

15:52 macro expansion happens before compilation

15:52 Raynes: LauJensen: :p

15:52 Hey! I did get to see the answer.

15:52 Scriptor: yay!

15:52 * Raynes hugs hiredman

15:54 Scriptor: that's cool, I'm writing my own lisp and just wanted to know whether my method was a horrible hack or a slightly-not horrible hack

15:54 hiredman: it has to run before compilation because macros operate on datastructures(code) and after compilation you just have bytecode

15:55 triyo: I'd like to have my macro expand into a (defn make-~name ... But the make-~name part doesn't do exactly what I want. (Puts a space between make- and the name)

15:55 hiredman:

15:55 triyo: macros are not operations on strings

15:56 (x y z) is a list

15:56 stuartsierra: triyo: you probably want ~(symbol (str "make-" name))

15:56 hiredman: (defn make- whatever) is also alist

15:56 Scriptor: hiredman: right, that seems to be the only way to run the logic inside a macro

15:56 triyo: stuartsierra: thats exactly it

16:14 hiredman: http://writequit.org/blog/?p=365 oooh, clojure-opennlp

16:15 clojurebot definitely needs

16:21 caljunior: java interop question: shoppingBasket.set(new NumberOfPotatoes(3))

16:22 how could I clojurize this?

16:22 I tried: (. shoppingBasket (NumberOfPotatoes. 3))

16:22 not good

16:22 hiredman: uh

16:22 caljunior: Also: (set! (. shoppingBasket (NumberOfPotatoes.)) 3)

16:22 no dice

16:22 hiredman: so what is shoppingBasket.set()?

16:23 caljunior: instance

16:23 instanceMember rather

16:24 hiredman: are you sure? because static calls look exactly the same in java

16:24 caljunior: correction: instance.

16:24 final answer

16:24 hiredman: caljunior: how can that be an answer?

16:24 caljunior: it's a joke

16:25 hiredman: caljunior: do you know how to write a clojure call to a method on an instance of an object?

16:26 caljunior: yes: (. instance-expr (method-symbol args*))

16:26 dakrone: hiredman: hurray, I'm glad you like my post :)

16:26 hiredman: :D

16:27 caljunior: that will work but more common these days is (.method instance args*)

16:28 caljunior: so then how would you write shoppingBasket.set() in clojure?

16:28 derefed: I have the following ns at the top of a file: (ns foo (:use [module-handler :only (process-message)])) But when I load this file, I get the exception "process-message is not public". process-message is defined in module-handler with defn, not defn-, so how could this be?

16:28 caljunior: (.set shoppingBasket)

16:28 nDuff: Why is this wrong? (ns com.example.test (:use clojure.contrib.duck-streams :only [reader to-byte-array])) yields java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean

16:29 kotarak: ,(.toString "Hooray")

16:29 clojurebot: "Hooray"

16:29 hiredman: caljunior: and now new NumberOfPotatoes(3)

16:29 kotarak: nDuff: (:use [clojure.contrib.duck-streams ...])

16:29 note []

16:29 S11001001: derefed: even with defn it could still be marked private, this is determined by metadata, not the defining macro

16:29 caljunior: (.set shoppingBasket (NumberOfPotatoes. 3))

16:29 derefed: S11001001: is it just arbitrary?

16:30 caljunior: :-O

16:30 S11001001: derefed: never

16:30 caljunior: it's so simple, it hurts.

16:30 nDuff: kotarak, ahh; thanks.

16:30 derefed: hmm... but other functions aren't being marked private

16:31 how can I force it to be public?

16:31 S11001001: do you control the module you are importing?

16:31 derefed: and how can I know ahead of time which things are public/private

16:31 yeah

16:31 kotarak: derefed: no. that's the default. you have to force it to be private. Do you have a rogue def after the one you believe to be the right one?

16:32 hiredman: derefed: regardless of your current issue you are asking for problems using single segment namespaces

16:32 derefed: kotarak: doesn't seem to be

16:32 hiredman: what do you mean?

16:33 hiredman: ~namespaces

16:33 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

16:33 derefed: oh

16:33 why is that a bad thing

16:33 hiredman: because of the way clojure compiles namepsaces single segment namespaces end being classes in what is called the default package in java

16:34 derefed: so should I stuff all these into a folder to get a second segment and declare it in ns?

16:34 or can I do without the folder

16:35 hiredman: your namespaces and directory/file structure must match

16:35 kotarak: derefed: some kind of quasi-standard which arose lately seems to be foo.core. If you would normally call it foo.

16:35 derefed: okay

16:35 I'll do that

16:35 do you think that'll solve my other problem or is that unrelated?

16:36 * kotarak just hacked some C and fells really dirty now…

16:36 derefed: lol

16:38 hiredman: derefed: I think it might, but regardless it will put you in well used code path which makes for easier debugging

16:38 derefed: okay

16:38 I'll give it a shot

16:43 technomancy: kotarak: according to fogus: "whenever I solve a hard problem with C++ I feel like I've won a bar fight."

16:44 kotarak: hehe

16:44 dnolen: Clojure on Linux Journal cover, nice, http://www.linuxjournal.com/on-newsstands

16:45 kotarak: technomancy: Well, C is not thaaat bad. I like. In general. It's just a tool which has its applications. But compared to Clojure.... Well. Let's say, you get used to it. :)

16:45 stuartsierra: I like C much better than C++

16:46 * kotarak too

16:46 technomancy: yeah, they're definitely different levels of ick. =)

16:46 stuartsierra: C is great if you care about things like bit sizes and memory layout.

16:48 derefed: ah I think I got it figured out... earlier I had named it module-handler.clj but renamed it to module_handler.clj so it would work, but for some reason my versioning system kept the old one around and as such caused massive confusion for me ;)

16:48 thanks for the tip about namespaces hiredman

16:48 Licenser: hi people, I finally got something nice and shiny working in clojure :D yay for this, but now I'm at a point where I'm not entirely sure what is the best way to go. Let me explain, I wrote a little engine that simulates space combat (as in a game) now I want people to be able to customize the AI of the units. I got the good advice to use snadboxing like done in the clojurebot (which is pretty cool) but I am not entirely sure yet what would be

16:48 best way to go on passing information, as in how to publish an interace to the AI scripts that allow them to work but prevent them from messing with other data they should not.

16:49 caljunior: thanks for helping me answer my own question hiredman :-)

16:49 hiredman: :)

16:50 derefed: what is sandboxing?

16:50 Licenser: derefed: preventing code from things like rm -rf /

16:50 derefed: oh

16:50 Licenser: which is pretty cool if you have publically editabile code (as in clojurebot or my project for example)

16:51 * derefed nods

16:51 hiredman: dakrone: it might be neat to have pos-tag use keywords as tags and then define a hierarchy so all the V* stuff would be isa? :VERB or something

16:51 Chousuke: you could of course just define your own language for the AIs, but that's rather limiting :/

16:51 dakrone: hiredman: that's a good idea

16:52 I'll check it out

16:52 Licenser: Chousuke: that was my first idea, but it seems that the scripting frameowk for java is pretty cool

16:52 Chousuke: Licenser: you don't need a scripting framework when you have clojure, anyway. :)

16:53 Licenser: mainly I want that people can use functions like move-to, fire-at, go through their weapons and evealuate them, but not just set the enemy to destroyed status :P

16:53 Chousuke: Licenser: but sandboxing Clojure isn't easy to do perfectly, so... :/

16:53 hiredman: you can white list functions, but that might be painful

16:53 Chousuke: Licenser: I think then you should probably just define your own language and write an interpreter for it

16:53 Licenser: of course, since you'll be writing an interpreter for a *data structure* it won't be so bad. :)

16:54 Licenser: Did that last time :P I ended up with AmberVM :P a huge construct slow as hell and nearly as unsecure as the original

16:54 hiredman: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj

16:55 Chousuke: well, all you really need are some primitives and a way to define functions

16:55 Licenser: hiredman: I know ^^ I looked at that, that covers system level securty I think but will it coer things as (alter the-game-ref remove enemie-unit?) I didn't understood it as that

16:55 Chousuke: the clojurebot sandbox won't really help you.

16:56 hiredman: well

16:56 ,alter-var-root

16:56 clojurebot: #<core$alter_var_root__6210 clojure.core$alter_var_root__6210@1998f48>

16:56 hiredman: :|

16:56 * Licenser compforts hiredman

16:56 hiredman: ,(alter-var-root foo)

16:56 clojurebot: DENIED

16:56 Licenser: ah well not that bad

16:57 hiredman: clojurebot has a blacklist, which is full of holes

16:57 Licenser: well ideally I wanted to allow people to write the AI scripts in any java scripting framework compatible language :P

16:57 Chousuke: You probably won't be able to allow the users access to clojure.core though :/

16:57 Licenser: hmm complicated

16:57 hiredman: you would want a combination interpreter/whitelist

16:58 Chousuke: or you can trust your users not to do silly things, but...

16:58 hiredman: hohoho

16:58 nDuff: ...well, you could put the AIs in their own processes, sandbox those to prevent anything but reading from stdin / writing to stdout, and use a control protocol over that line

16:58 Licenser: Chousuke: that line is nearly worth a quote :P

16:59 nDuff: at that point you can do OS-level sandboxing, java security framework sandboxing, put them inside of qemu VMs, or pretty much anything else

16:59 Chousuke: Licenser: indeed, it's like trusting fish not to swim

17:00 Licenser: nDuff: the systm level security isn't that much of an issue, I wonder about in application security

17:00 hiredman: and can you trust the AIs?

17:00 nDuff: Licenser, yar, but using a serial line (stdin/stdout protocol which only has primitives for things you wish to allow) buys you application security too.

17:00 Licenser: hiredman: they might try to achieve world domunation one day

17:00 nDuff: that isn't a dumb idea actually

17:00 jasapp: queue skynet comment

17:01 hiredman: for the interpreter/whitelist approach the interpreter would be more of a deep inspecter, but it would have the form of an interpreter

17:02 jasapp: hiredman: I might have missed it, are you happy with the sandboxing you've done for clojurebot?

17:02 hiredman: meh

17:03 jasapp: I see him broken every now and then, is that because of people breaking him intentionally?

17:03 hiredman: not that I am aware of

17:03 when is it broken?

17:04 Licenser: I think people here are OK enough not to make stupid things

17:04 jasapp: I can't remember the last time I saw him broken, actually

17:04 hiredman: :D

17:04 five nines dude

17:04 jasapp: heh

17:04 bsteuber: how about the JVM's sandboxing abilities? I would have guessed they solved that issue somehow

17:05 hiredman: ~sandboxing

17:05 clojurebot: excusez-moi

17:05 hiredman: ~sandbox

17:05 clojurebot: sandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html

17:05 hiredman: clojurebot: dork

17:05 clojurebot: It's greek to me.

17:05 crowbar7: hiredman: do you actually mean Nine Fives?

17:05 p

17:05 :p

17:05 hiredman: ~words

17:05 clojurebot: These words are razors to my wounded heart

17:06 Licenser: so the jvm sandboxing does not allow in application sadnboxing :( so no luck for me

17:07 bsteuber: how about the &env stuff and eval - never gotten into this stuff..

17:07 of how about eval'in stuff in a namespace you set up for them?

17:08 Licenser: hmm I am note sure

17:09 I havent yet done much or anything with sandboxing. Before I take that stuff I first wont to have AI scripts that have a clean seperation between what they do and the game (as in not working on game data) and I'm not sure how to implement the interface there

17:11 in ruby I'd do something like an isntance eval that gives something like an DSL to the code but I an not sure what would be the most clojurey way to do this

17:12 bsteuber: and before eval you can let clojure resolve all symbols and make sure nothing is used that resolves to the outside

17:14 technomancy: hugod: you work on the jclouds library?

17:14 Licenser: hrm that all sounds not nice

17:14 bsteuber: I think it's still way easier that rolling an own DSL

17:15 well, the namespace setup isn't even necessary

17:15 Licenser: bsteuber: I'm not sure, I can see so many things go wrong

17:16 bsteuber: so I just picture some white- oder blacklists or a combination

17:16 you need to specify what you want users to have of have not - whichever method you use

17:17 Licenser: *nods*

17:17 hiredman: pure functions you can whitelist like +

17:17 you won't want to allow restruicted calling to java

17:18 hugod: technomancy: yes

17:18 bsteuber: and then, you just (read user-code) and recursively check for violating symbols

17:18 should be an easy algorithm

17:18 Licenser: hmm hmm

17:18 technomancy: hugod: cool; sent a pull request for a few cosmetic things

17:18 hiredman: ,(doc tree-seq)

17:18 clojurebot: "([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."

17:19 technomancy: hugod: also I noticed "mvn test" runs the tests for clojure itself, but I'm not maven-savvy enough to fix it

17:19 hiredman: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj#L59

17:19 technomancy: hugod: assuming you have commit rights?

17:19 Licenser: ah nice

17:19 technomancy: tree-seq is awesome

17:19 hugod: technomancy: great - the clojure binding is pretty new - the blobstore will be improved later today

17:19 technomancy: I do

17:19 technomancy: oh nice

17:20 we've been rolling our own jets3t wrapper and will have to expand to rackspace soon, so this looks perfect.

17:20 hugod: I've been mainly working on the compute side, to support my pallet project

17:20 technomancy: right; that looks cool

17:20 hugod: technomancy: excellent

17:21 Licenser: hmm so if I whitelist it should be quite secure, as in allowing only things like fn, if, map, reduce ... + custom functions

17:22 bsteuber: my feeling is that you want to have a whitelist of namespaces

17:22 and each of those might have a blacklist of symbols

17:22 hiredman: bsteuber: no

17:23 bsteuber: hiredman: explain plz :)

17:23 Licenser: yes plese please :D I want to learn

17:23 hugod: technomancy: i'll look at the tests - I'm not a maven expert either..

17:24 hiredman: you generally don't have namespaces on the symbols of forms (if a b), and special forms like . don't have namespaces to ebgin with

17:24 miltondsilva: Hello. Is there any clojure networking library? I need to transfer packets from various clients to a server. What are my options?

17:26 bsteuber: hiredman: okay, there are some edge cases - especially about java interop

17:27 but is it that awful?

17:27 hiredman: would you white list clojure.core?

17:27 bsteuber: miltondsilva: you can use any java networking lib

17:27 Licenser: well whitelisting would only make it horrible on the users right?

17:27 hiredman: it has eval, it has alter-var-root, etc

17:27 bsteuber: dunno about clojure specific libraries

17:28 hiredman: Licenser: depends on what you white list

17:28 and how far you are willing to go

17:28 Licenser: functions I'd say

17:28 bsteuber: I'd blacklist some symbols from clojure.core

17:28 Licenser: or forms for that matter

17:28 bsteuber: but allow for the rest

17:28 hiredman: bsteuber: and when you upgrade clojure? do you go throw clojure.core everytime doing an audit?

17:29 bsteuber: ok, it has to be updated with each clojure version

17:29 Chousuke: allowing clojure also allows java

17:30 which means you need to blacklist most of java

17:30 blacklists don't work ;P

17:30 Licenser: so whitelist is it

17:30 Chousuke: though you could get pretty far by disallowing .

17:31 bsteuber: yes, but inside of whitelisted namespaces I'd use blacklisted symbols

17:32 I think this could be a nice library - clj-sandbox maybe

17:32 Licenser: bsteuber: yes

17:32 bsteuber: but if it is done once and has some configuration possibilities, anyone could use it

17:32 though I don't know of more users than Hiredman and Licenser at this point :)

17:33 but I guess you never know them in advance

17:34 Licenser: a good sandboxing would be great

17:34 bsteuber: yeah, there would be many uses

17:34 hiredman: bsteuber: add as I have said your whitelisting namespaces is a bad idea I doubt I'd use it

17:34 and

17:34 bsteuber: user supplied agents running on arbitrary servers have great potential, I guess

17:35 S11001001: Is clojure.core/compile allowed to compile and save class output for modules used by the given module?

17:36 Licenser: I think a good sandbox should allow: white and blacklisting forms and namespaces allowing library users to customice as they see fit

17:36 hiredman: S11001001: it's hard to figure out what you mean by that, give that neither clojure nor the jvm have something called a "module" but my guess would be no

17:36 but I can't really tell what you are asking

17:36 bsteuber: hiredman: I see that this is not a silver bullet - but I think a usable clj-sandbox should offer the ability to whitelist or partially whitelist namespaces

17:37 for example the namespace you wrote just for the users to have

17:37 hiredman: *shrug*

17:37 code away

17:37 duncanm: what's the way to update the clojure and clojure-contrib jars that's used by SLIME?

17:37 hiredman: bsteuber: that namespace has almost no functions in it

17:37 S11001001: if I have two files a.clj and b.clj reachable as (use 'a) and (use 'b) where the top of b.clj is (ns b (:use a)), and I call (compile 'b), is it possible that a.clj will be compile to a__init.class etc?

17:37 duncanm: i tried putting 1.2 jars in .swank-clojure and it didn't work

17:39 bsteuber: hiredman: how would you specify what users ARE allowed to use, then?

17:39 technomancy: duncanm: did you remove the old jars from there?

17:39 duncanm: probably easier to create a project-specific repl and upgrade your project

17:39 Licenser: I'll go with form whitelisting for now

17:39 it sounds as the most secure way to me

17:40 hiredman: bsteuber: I would use a whitelist of symbols combined with an interpreter/inspector

17:40 so a graylist

17:40 bsteuber: yeah, I agree about the interpreter

17:40 Licenser: what exactly do you mean with an interpreter

17:40 bsteuber: I guess something like disallowing .

17:40 so some form-checker

17:41 hiredman: S11001001: those namespace names are just an example right, you aren't actually using single segment names, yes?

17:41 S11001001: hiredman: yes

17:41 bsteuber: licenser: hope you do your stuff in a separate library

17:41 chouser: why not run the whitelist against the results of the compiler analysis.

17:41 ?

17:42 Licenser: what is acompiler analysis?

17:42 duncanm: technomancy: i did remove them, and i got an error saying it couldn't find clojure.main

17:42 chouser: that way your code is compiled and executed by the standard clojure subsystems, but you get a chance to check every form against the particular java interop call or other special form as needed.

17:43 the compiler has two steps -- analyze and emit bytecode. ClojureScript for example does the normal analysis, but then uses it's own emit to generate javascript instead of java bytecode.

17:43 bsteuber: hiredman: maybe we got each other wrong at first - I just believe the additional option to whitelist a whole package might be helpful sometimes - e.g. for a library in your own hands

17:43 but I don't know

17:43 chouser: for whitelisting you wouldn't emit anything, just check the tree generated by analysis to make sure it's ok, then do the normal emit

17:44 duncanm: technomancy: is there a reason why i'd see that? java.lang.NoClassDefFoundError: clojure/main

17:44 technomancy: duncanm: works for me

17:45 duncanm: java -jar clojure.jar clojure.main should work, right?

17:45 Licenser: chouser: you scare me o.O

17:46 chouser: Licenser: you can look at clojurescript to see how it does it -- it's all clojure code (no java) and right there in contrib. :-)

17:46 bsteuber: chouse: great stuff

17:47 +r

17:47 chouser: it probably only works on older versions of clojure, unfortunately.

17:47 Licenser: chouser: just that I still don't undestand some aspects in clojure and looking in the inner working I am really afirght

17:48 technomancy: duncanm: actually I think it's getting stuck with the old classpath

17:48 avar: I finally got clojure working with swank but now I get this error on slime runtime: http://paste.scsys.co.uk/40449

17:49 duncanm: technomancy: sounds right, but how do i fix that?

17:49 technomancy: duncanm: try resetting swank-clojure-classpath to nil and it will try to autodetect it again

17:49 avar: "Caused by: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.io.Writer"

17:49 chouser: Licenser: well, maybe it would be easier to implement a full Clojure interpreter, but I'm don't think that's an obvious conclusion.

17:50 Licenser: why every time quiestions here end in the suggestion to to write clojure in clojure? :P

17:50 chouser: Actually, I think I'm suggesting that you *not*. But anyway...

17:50 technomancy: Licenser: because it's inevitable!

17:51 Licenser: oh

17:51 avar: technomancy: Why does HEAD of your clojure-mode (require) swank-clojure-autoload but HEAD of swank-clojure doesn't contain it? I had to downgrade the latter to an earlier version

17:51 duncanm: technomancy: i dunno how to tell M-x set-variable to let me type nil

17:51 technomancy: duncanm: M-: (setq swank-clojure-classpath nil) should do it

17:51 avar: M-x clojure-install has been deprecated for some time now

17:52 see the swank-clojure readme for updated instructions

17:53 avar: This is (clojure-slime-config), but yeah it's really hard to find some proper documentation for this ;/

17:54 technomancy: avar: I think the swank readme is actually pretty thorough

17:55 clojure-slime-config is part of M-x clojure-install, it's deprecated

17:55 it does display a warning that it's deprecated when you use the old install method

17:55 but I should just remove it.

17:57 avar: The swank readme tells you to use clojure-install if you don't want to use ELPA

17:59 Anyway I'd prefer to to use ELPA at all or something magical which auto-downloads .jar files over the Internet so I was trying to set it up to use my local .jar files I compiled from source. It looks like that was pretty succesful.

18:00 S11001001: I think it compiles other stuff, which makes lein jar put dependent classes in jars. Later all

18:00 technomancy: avar: must have a pretty old readme then

18:03 hiredman: I updated swank by making a jar of the ./src (no compiling) then making the clojure and contrib jars in .swank-clojure links to the right jars in ~/.jars/

18:04 avar: Oh right, I was looking at the sep 29 version because of the swank-clojure-autoload issue (since I'm calling (clojure-slime-config)). But I read the master one too.

18:04 Maybe I'll send you a documentation patch with some explicit examples once I get this running right :)

18:05 technomancy: that'd be great

18:05 out-of-date documentation is a big problem with swank

18:05 Licenser: hmm okay I found one problem with the tree-seq, it seems that whitelistig won't work exactly since they turn up the entire local variables and symbols too

18:05 avar: Finding out what e.g. swank-clojure-classpath should be set to (the docs just say "set swank-clojure-classpath to a list of paths to the jars you want to use") took some time to figure out

18:07 technomancy: maybe an elisp example would be appropriate

18:08 avar: yeah

18:14 technomancy: So how do you set your slime-lisp-implementations? They're set by (clojure-slime-config) but that calls swank-clojure-autoload right after setting the classpath to something I don't want: http://pastie.org/860476

18:14 technomancy: avar: if you want a standalone repl just to screw around with, put jars in ~/.swank-clojure. otherwise use "lein swank" or M-x swank-clojure-project

18:14 like it says in the readme

18:15 you don't set slime-lisp-implementations unless you want to use CL and clojure together

18:17 avar: That's what I want. I'm trying to figure out how I set this up so that 1) I don't clobber CL 2) I don't have to drop files in random hardcoded places I don't usually put things in 3) Don't have to use ELPA

18:18 nteon: whats the best way to join a number of sets?

18:18 technomancy: hm; sorry... I don't know how to use it with CL

18:19 avar: That's easy, you just set slime-lisp-implementations to include both e.g. '(sbcl and '(clojure

18:19 hiredman: nteon: have you looked in clojure.set?

18:20 nteon: hiredman: yes, and I want to use union, but union doesn't want to work with me.

18:21 hiredman: nteon: how so?

18:21 avar: I'm really just wondering why swank-clojure is set up like it is. Why it has all these hardcoded paths and why it has this method of dumping .jar files into $yourproject/src, is there a reason for that? is it some java thing to ship clojure when you build with ant in that directory?

18:21 Anyway I'm asking too much, I'm just going to sleep and look at this tomorrow :)

18:21 hiredman: avar: uh, it's yourproject/libs/

18:21 not src

18:22 technomancy: swank-clojure will only download jars when it hasn't been configured

18:22 because if you haven't told it where your own jars are, it's useless

18:26 defn: god im sick of people who ask me to start "fun" projects with them, and then i set up a repository, start coding on it, and ask for them to hop in and check it out, and then they never touch it

18:28 Licenser: defn: I know the feeling

18:31 nteon: hiredman: I have some functions with overloads; when passed no args they return a map, and when passed one arg they return the result of some function. I'm trying to do (union (a) (b)), and its failing with Wrong number of args passed to: Symbol

18:33 hiredman: nteon: that has nothing to do with union

18:33 you are trying to call a Symbol as a function somewhere

18:34 nteon: hiredman: yea, I realize its my fault and not the set libraries, I just don't know why yet.

18:34 (a) returns the set when I execute it at the repl, but (union (a)) throws that error

18:35 hiredman: and (a)?

18:56 duncanm: what's the way to go from a 2D java array to a nice Clojure seq?

18:56 (seq x) only seqifies the outer array

18:57 hiredman: why?

18:57 clojurebot: why not?

18:57 duncanm: i was seeing this #<double[][] [[D@2206270b>

18:58 then i added a seq call, and it only turned into this: (#<double[] [D@19aa5882> #<double[] [D@7e98cbf7>)

18:58 hiredman: if it is just for printing I think pprint will print arrays nicely

18:58 duncanm: ahh

18:58 okay

18:58 hiredman: or at least has an option to

18:58 if you *really* want seqs you can just map seq

19:03 nteon: okay, I know what I'm doing wrong, I just don't know why its wrong http://fpaste.org/uTxk/

19:04 control in that case refers to a function that accepts no args

19:05 I want to call it like (defmodel a :control some-fn)

19:31 dnolen: nteon: what do you want the result to look like?

19:36 nteon: dnolen: i want it to expand to (def a #{...}), given my example input above

19:37 dnolen: nteon: and what is in the set?

19:37 nteon: dnolen: some keywords

19:38 dnolen: and it works as pasted, but I don't understand why the commented out part doesn't work

19:38 dnolen: nteon: because control is not a function at, it's just a symbol at macroexpansion time

19:39 not a function at -> not a function at that point

19:39 if you really want to call that function you'll need to resolve that symbol or use eval.

19:41 rickmode: Question: in Compojure's compile-route, is there some magic to the post-# names like matcher# and request#? I'm trying to understand this function.

19:43 nteon: dnolen: of course! thanks.

19:45 dnolen: nteon: np

19:46 nteon: that makes sense, and the error makes sense in this context. I just didn't fully get (probably still don't) macro-expansion time

19:54 bsteuber: how would you assoc a list of keys to the same value in the most elegant way?

19:57 like that?

19:57 ,(apply assoc {} (interleave [1 2 3] (repeat 42)))

19:57 clojurebot: {3 42, 2 42, 1 42}

20:14 _ato: ,(zipmap [1 2 3] (repeat 42))

20:14 clojurebot: {3 42, 2 42, 1 42}

20:14 _ato: bsteuber: ^

20:28 bsteuber: _ato: thx, I always forget about zipmap

20:29 I also don't remember the f for (f cons) -> #(cons %2 %1)

20:29 haskells swap, I think

20:41 _ato: bsteuber: I didn't know there was a function like that, I just use #(cons %2 %1) as it's pretty concise and readable just like that

20:46 bsteuber: I think I've seen one here before

20:46 but yeah, I was just curious

20:54 shrughes: haskell's is called flip, but i don't know if clojure has one

21:08 nteon: what is the best way to load a file of clojure code into a particular namespace at runtime?

21:08 bsteuber: ,(doc load-file)

21:08 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

21:08 bsteuber: nteon: probably this

21:08 qbg: Just bind *ns* around load-file

21:09 nteon: qbg: okay, thats along what I was thinking. wasn't sure if there was a better way to do it

21:09 bsteuber: sorry, got the "particular" wrong :)

21:10 qbg: Come up with a more elegant design?

21:11 bsteuber: ,`with-ns

21:11 clojurebot: sandbox/with-ns

21:12 bsteuber: I guess it's not officially allowed to rebind *ns* on your own

21:12 at least that's how I understand http://clojure.org/namespaces

21:13 nteon: bsteuber: what do you mean allowed?

21:14 bsteuber: well that you shouldn't use (bindung [*ns*] ..) on your own, but rather call functions like in-ns

21:14 I guess there was a with-ns macro somewhere for that?

21:14 but I might be completely wrong :)

21:16 http://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/with_ns.clj#L20

21:16 psykotic: http://gist.github.com/326073

21:16 bsteuber: this does something special, at least

21:17 anyways, I'm going to bed - cu

21:18 nteon: bsteuber: thanks! thats what I was just about to write, but most likely not quite as nicely as stuart

21:32 defn: anyone have any experience connecting to an SSL secured https site?

21:46 mikem: hi, my leiningen project.clj file has the a dependency on org.clojure/clojure-http-client "1.0.0-SNAPSHOT" which exists on clojars: http://clojars.org/org.clojure/clojure-http-client -- when I run `lein deps` I get this error: http://pastebin.com/zNDsBTck -- what's the issue? have I forgotten to configure something in lein to check clojars.org?

21:47 the error trace does indicate that it checked clojars.org/repo/ and build.clojure.org/releases...

22:13 brandonw: i don't quite understand what is going on here:

22:13 ,(map #(println %1 %2) (range 1 5) [:1 :2 :3 :4])

22:13 clojurebot: (nil nil nil nil)

22:13 Scriptor: does Clojure's 'or' compile down to the same bytecode as or in Java?

22:13 brandonw: ,(map #(println %1 %2) (range 1 5) [:1 :2 :3 :4])

22:13 clojurebot: (nil nil nil nil)

22:13 brandonw: err, that didn't help much

22:13 Scriptor: brandonw: println just prints it, but it returns nil

22:14 brandonw: oh right, that would be a bad example

22:14 let me use what i originally wrote before i started trying to debug

22:14 hiredman: Scriptor: how could it?

22:15 clojure's truth table is not the same

22:15 Scriptor: hiredman: not sure at all, it just seems to be less efficient though

22:15 brandonw: ah, got it

22:15 my problem was i was using #([%1 %2]) as an fn for map, instead of #(vector %1 %2)

22:16 Scriptor: hmm, why wouldn't that work?

22:16 hiredman: brandonw: just call vector

22:16 brandonw: it tries to call the resulting vector

22:16 as a function

22:16 hiredman: ,(map vector [1] [2])

22:16 clojurebot: ([1 2])

22:16 brandonw: oh right

22:16 haha

22:16 hiredman: ,(macroexpand-1 '#([%1 %2]))

22:16 clojurebot: (fn* [p1__11865 p2__11866] ([p1__11865 p2__11866]))

22:17 brandonw: ,([1 :1])

22:17 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentVector

22:17 brandonw: doesn't work :)

22:17 as smart as clojure is, it can't quite read your mind, haha

22:18 that will be in 2.0

22:39 Raynes: Oh my God. Twitter is down.

22:43 tomoj: it's just you

22:44 Raynes: Not the website; the API.

22:44 icey: Raynes: seems to be working for me

22:44 or rather, my client is connecting fine

22:44 Raynes: Oh. That's just great.

22:45 Oh joy, now it's working.

23:01 rads: mikem: try [clojure-http-client "1.0.0-SNAPSHOT"]

23:50 slyphon: so, what do people use for templating w/ compojure?

23:51 technomancy: slyphon: HTML or general?

23:51 slyphon: HTML, i guess

23:51 technomancy: I really like enlive for that

23:51 slyphon: i'm a little lost w/o ERb

23:51 technomancy: but it's not really well-documented

23:51 enlive is much better than ERb for HTML/XML

23:51 slyphon: i want to avoid anything like jsp or "struts" or that crazy bullshit

23:52 oh?

23:52 is it clojure?

23:52 technomancy: yeah

23:52 ~enlive

23:52 clojurebot: Excuse me?

23:52 slyphon: oh, maybe i'll check it out

23:52 technomancy: ,google enlive clojure

23:52 clojurebot: java.lang.Exception: Unable to resolve symbol: google in this context

23:52 technomancy: ~google enlive clojure

23:52 clojurebot: First, out of 514 results is:

23:52 Clojure and me: Enlive: yet another HTML templating library

23:52 http://clj-me.blogspot.com/2009/01/enlive-yet-another-html-templating.html

23:53 slyphon: technomancy: is leingen easy enough where a maven neophyte like me will be able to use it?

23:53 i've been using rake so far, and just checking all my jars into the repo

23:53 because that's how i *roll*

23:53 technomancy: clojurebot: enlive is for generating HTML from pure-markup templates: http://wiki.github.com/cgrand/enlive/getting-started

23:53 clojurebot: You don't have to tell me twice.

23:54 technomancy: slyphon: dude. git is astonishingly bad at tracking jar files.

23:54 go right now and rewrite your history to cut them out

23:54 quickly, before anyone notices.

23:54 slyphon: heh

23:54 technomancy: slyphon: yeah, anyway you should be fine using leiningen with no maven knowledge. it's designed for that exact use case.

23:54 slyphon: ah, good

23:55 technomancy: if it weren't from the overly-verbose log output when it runs, you would never know maven was involved.

23:55 _ato: I found this quite handy as well for enlive: http://github.com/swannodette/enlive-tutorial

23:55 slyphon: technomancy: heh

23:57 wow, this looks...different

23:57 technomancy: if you're used to systems that mix presentation and logic, it's quite a change

23:57 but a refreshing one, I think.

23:57 slyphon: yeah

23:58 well, i used haml for my last project

23:58 which i thought was quite nice

23:59 hugod: technomancy: what would you recommend for the general (non-html/xml) case?

23:59 technomancy: hugod: there was an interesting looking string interpolation macro discussed a few months ago, and there was also a templating library announced called fleet

23:59 but I haven't used either

Logging service provided by n01se.net