#clojure logs

2010-03-08

00:21Knekksorry, was afk
00:58Knekkha, figured it out
01:00Knekk, (.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 50 java.math.RoundingMode/HALF_UP))
01:00clojurebot"0.14285714285714285714285714285714285714285714285714"
01:00Knekkdang
01:00Knekkthat wasn't at all obvious
01:01Knekk(.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 100 java.math.RoundingMode/HALF_UP))
01:01Knekk,(.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 100 java.math.RoundingMode/HALF_UP))
01:01clojurebot"0.1428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571429"
01:01Knekktomoj, hiredman: (.toPlainString (.divide (java.math.BigDecimal. "1") (java.math.BigDecimal. "7") 100 java.math.RoundingMode/HALF_UP))
01:02Knekkthanks for the help
01:06Knekk,(doc drop)
01:06clojurebot"([n coll]); Returns a lazy sequence of all but the first n items in coll."
01:13tomojKnekk: wow
01:13Knekkyeah
01:13tomojKnekk: I'd prefer doing it myself with long division to figuring that out
01:15Knekk:) call me srubborn
01:15Knekkstubborn
01:49RaynesHttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
01:49RaynesWhat is the (HttpsURLConnection) bit doing there (for the Java guys in here).
01:57RaynesOh, a typecast I believe.
02:14derefedhow do I convert from a string to a symbol? that is, how do I turn "foo" into 'foo ?
02:14hiredman,(doc symbol)
02:14clojurebot"([name] [ns name]); Returns a Symbol with the given namespace and name."
02:14derefedoh wait--
02:15derefedyeah lol I just realized when I tried (symbol) before I screwed up the parens ;)
02:15derefedthat was dumb of me
06:36mozinatorhi everyone, I am working on a cool library
06:36mozinatorhttp://github.com/mozinator/clj-scenegraph
06:36mozinatorits a sort of wrapper over sun's scenegraph project, which is the foundation of javafx
06:38mozinatorI 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 )
07:01hoeckmozinator: 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
07:01hoeckin clojure, docstring comes before the arglist
07:02hoecklike (defmacro my-macro "my-macro-doc" [arglist] body)
07:02mozinatorhoeck, thanks for the pointer, going to look at it
07:03mozinatorhoeck, that fixed it ! :)
07:03mozinatorhoeck, thanks :)
07:04hoeckmozinator: np, thats a little bit confusing at first
07:04hoeckthe arglist-after-docstring thing
07:05hoeckbtw, interesting library!
07:06mozinatorhoeck, thanks !, when I finish testing the basics, I will start making some nice widgets!
07:07AWizzArdmozinator: 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)?
07:07mozinatorAWizzArd, exactly I would like to use Clojure instead of the Javafx language
07:08AWizzArdRight. Well yes, then this indeed sounds good.
07:08mozinatorAWizzArd, and I want to add some nice goodies :)
07:08mozinatorAWizzArd, like a LWJGL backend
07:08mozinatorAWizzArd, and use penumbra'
07:08mozinatorto make cool GUI effects
07:09AWizzArdAh, penumbra to allow fast GPU calculated effects?
07:09mozinatorexactly !
07:10mozinatorat the moment scenegraph uses it's own effects compiler, but I like penumbra's effects much beter :)
07:11mozinatorand if the computer does not understand GLSL the effects are just basic clojure :)
07:11AWizzArdYes, sounds really nice.
07:11mozinatorand nothing is generated to disc, just generated GLSL in-memory
07:11AWizzArdLots of GUI people could be very interested in that.
07:12mozinatorAWizzArd, way more intuitive to make a GUI with Clojure !
07:12mozinatorEverything you do is immediatly applied
07:12mozinatorSo its more like designing a GUI then programming
07:13AWizzArdHow complete is the JavaFX support so far?
07:14mozinatorAWizzArd, at the moment clj-scenegraph is just syntactic sugar for the scenegraph project https://scenegraph.dev.java.net/
07:14mozinatorProject Scene graph is not publicly developed by sun anymore
07:14mozinatorsince 2008
07:15AWizzArdoh, too sad
07:15mozinatorSo I took the liberty to make a fork of it, and extended it with maven support
07:15AWizzArdBut can you still use new features of JavaFX?
07:15AWizzArdmozinator: btw, look into your private messages.
07:15mozinatorAWizzArd, I dont think so, only the 2008 features
07:18mozinatorBut for my purposes the Scenegraph project is complete enough
07:18AWizzArdI see.
07:18AWizzArdWill it allow to add several "modern widgets" for applications?
07:18AWizzArdLike password input fields, tab panes, etc.?
07:19mozinatorYou can embed the swing widgets
07:19mozinatorOr make your own widgets
07:20AWizzArdBut 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.
07:21mozinatorYou can put a JSGPanel into a Swing tab plane
07:21mozinatorand put a Swing tab plan into a JSGPanel
07:21mozinatorplan -> pane
07:21AWizzArdI see.
07:21mozinatorYou can some examples here: https://scenegraph-demos.dev.java.net/demos.html
07:22AWizzArdIs SceneGraph basically a lib to paint vector graphics?
07:22mozinatoryes, based on the scenegraph "pattern"
07:23mozinatorwhich gives all kinds of benefits
07:23AWizzArdk
09:36astoddardI 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?
09:41chouserastoddard: there's not an API for it afaik, but you can query them if you really want to.
09:42chouserthe original forms provided for :pre/:post are metadata on the arglists, which are metadata of the function's var
09:42chouser(map meta (:arglists (meta #'foo)))
09:43chouserThey'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.
09:47astoddardchouser: thanks, very interesting, (and deep for me.) Seems counter-intuitive to have a post condition be metadata on an arglist.
09:48chouserhm, that's an interesting point.
09:49chouserpre-conditions of course pretty much have to be per-arglist, but I can certainly see an argument for a single set of post-conditions.
09:50astoddardYes, as I am getting out of my depth anyway, I can envisage wanting a single set of post conditions on a multimethod.
09:56chouseryeah, I think pre/post on multimethods is vaguely planned. Certainly sounds useful.
09:59astoddardMy idea about wanted to change/add conditions came from thinking about iterative development at the REPL.
10:00astoddardI 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:01astoddardIf I wanted to do this now I would need to get a function's source, redefine it and then rebind it?
10:03a_strange_guyastoddard: you could build a HOF that wraps an existing function with pre/post-condition checking
10:04a_strange_guythere was a Screencast (Full Disclojure) on that
10:05a_strange_guy{:pre ... :post} is just the most primitive building block for design by contract
10:06Chousukearen't arglists attached to the vars of functions? you can change the metadata of those without redefining their value
10:06chouserChousuke: yes, but that metadata isn't consulted when the function is run
10:07chouser:pre/:post is consulted when the function is compiled -- changing the metadata afterwards won't do anything useful.
10:07Chousukehm, right, so the pre/post info is only considered at compile-time
10:08a_strange_guychouser: it's actually never considered, :pre/:post works on anonymous functions
10:08chousera_strange_guy: right. I meant that the :pre/:post are considered, not the metadata.
10:10a_strange_guynow with metadata for fn's you could attach :pre:post to the fn's directly
10:10a_strange_guybut I don't see any added value in overly strict design by contract
10:13a_strange_guy,(> "interactive developement" "design by contract")
10:13clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
10:13a_strange_guydamn ^^
10:15astoddarda_strange_guy: (if (= "developer" "consumer of API") true "maybe")
10:43chouserrhickey: will mix-ins work for reify as they will for deftype?
10:43chouserI guess closures complicate things a little.
11:19crowbar7I just ordered both of he clojure books. hope they are both good reads.
11:19crowbar7the*
11:21lancerxI 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:22crowbar7I like most of the apress books
11:22crowbar7I pre-ordered that one.
11:22stuartsierrayay!
11:22crowbar7I ordered the other one "programming clojure"
11:22stuartsierraboo!
11:22stuartsierra:)
11:23lancerxstuartsierra: wasn't sure if that nick was you, but I decided I'd compliment you anyway :)
11:23crowbar7you a fan of the apress one I take it?
11:23stuartsierraI'm writing half of it.
11:23crowbar7LMAO
11:23crowbar7awesome.
11:24lancerxwhich means he'll have more of a love/hate relationship than fanish-ness :)
11:24stuartsierrayou got it
11:25crowbar7stuartsierra: I'm new to clojure, but not as much to java or common lisp.
11:25SynrGprogramming clojure is my current "bus read" on my eee
11:25SynrGnice to have repl right there at my fingertips as i read
11:25lancerxso 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:25the-kennyChousuke: Ha! Found you in http://www.flickr.com/photos/franck_/4414287310/in/photostream
11:25SynrGi'm quite enjoying it
11:26SynrGthe apress books will be next
11:26lancerxSynrG: heck yeah, I was REPLing on my flight Thursday, it was great
11:26SynrGalso i have netbeans and enclojure on my eee model 4G (ouch)
11:27SynrGworks well enough. it's just that netbeans wants a display larger than 800x480. heh
11:27lancerxI actually went with emacs for dev after being a 20yr vi-guy and I'm in love
11:27crowbar7I 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:27SynrGxrandr --output LVDS1 --panning 1024x768
11:28crowbar7You use Graphiz for that graph generation?
11:28SynrGi'm using netbeans at work with ruby, so it's a natural choice
11:28lancerxoh 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:29crowbar7lancerx: Such as b-trees?
11:29lancerxis there a good book, reference, etc for thinking about data structures in lisp/FP?
11:29crowbar7ummm hold on
11:29lancerxmy working example is JCR (Java Content Repository), which is a hierarchical tree of content nodes
11:30crowbar7http://www.cs.sfu.ca/CC/310/pwfong/Lisp/3/tutorial3.html
11:30crowbar7maybe
11:30lancerxcrowbar7: awesome man, thanks
11:31lancerxcrowbar7: yeah a quick skim says this is gonna be very helpful
11:32wthiddencan you use a reader macro splice in a function?
11:33crowbar7lancerx: I used that to learn some common lisp data structs.
11:36stuartsierrawthidden: no
11:36lancerxstuartsierra: 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:37stuartsierrayeah, that'd be nice
11:39stuartsierraWhich functions are primitive-aware?
11:40stuartsierraI've got ==, <, <=, >, >=, pos?, neg?, zero?, +, -, /, *, inc, dec, and the unchecked-* functions.
11:40stuartsierraNot the = function.
11:52cemerickDestructuring is not supposed to look ahead in lazy seqs, right?
11:52ChousukeI think it does, by one
11:52cemericke.g. (let [[a & b] (foo)] ...) should only make the first item in the (foo) seq concrete
11:53cemerickChousuke: looks like it does, by two here
11:53cemerickbut I actually didn't think it looked ahead at all
11:55ChousukeI vaguely remember Rich mentioning that destructuring has "next" semantics, but you should confirm that.
11:57cemerickeven seq appears to look ahead by one here, which definitely shouldn't happen IIUC
11:59Chousukehm, seq has to, so it knows whether to return a seq or nil
12:00cemerickyeah, right, nm
12:00cemerickI ran out of tea :-/ ;-)
12:10defnmorning all
12:10defnerr nearly afternoon i guess
12:10defn:X
12:11defn<---awfully lazy
12:31defnhmmm -- how do i use 1.2.0 with lein
12:31nteondefn: 1.2.0-master-SNAPSHOT ?
12:32nteondefn: thats only an educated guess
12:32defndoes that work for contrib also?
12:32technomancycontrib is just 1.2.0-SNAPSHOT IIRC
12:33defnmaster-SNAPSHOT worked also
12:34defni thought duck-streams got renamed to .io
12:34defnhm
12:34nteoncool, about the master-SNAPSHOT
12:46stuartsierradefn: it did
12:48stuartsierraI think if you use contrib "master-SNAPSHOT" you'll only get old builds
12:49fanaticobuild.clojure.org only lists 1.2.0-SNAPSHOT
12:49stuartsierrathat is correct
13:07LauJensenAnybody got the URL of that example Rich posted of using Cells ?
13:08fanaticoLauJensen: http://gist.github.com/311542 <- this?
13:10duncanmboo, i have this stupid API that i have to use and it uses bit masks
13:10duncanmi never remember to how set it up
13:10LauJensenfanatico: Dont think that was it
13:14LauJensenStill, that example does seem to show off all the stuff, its cool
13:30triyowhats the easiest way to transform a seq of [& :key val] into a map strucutre?
13:30chouser(apply array-map the-seq)
13:30triyothx
14:33RaynesI wish ioke-mode.el wasn't (slightly) broken. :\
14:34RaynesYou 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:36technomancyRaynes: sorry, my 2010 language is Duby. and 2011 is Factor.
14:36technomancyso you'll have to wait a few years.
14:37RaynesDuby? That sounds interesting.
14:37RaynesThough I don't think you'll need an entire year with Factor.
14:38technomancywell I'm not planning on stopping with Clojure... =)
14:38RaynesI didn't figure you would. Nobody can stop once they've started.
14:39RaynesAw, no wikipedia page for Duby. :(
14:39nedtechnomancy, just popping in to say thanks for your emacs repo ;)
14:39RaynesI am disappoint.
14:39technomancyRaynes: Duby has like ten users. ={
14:39technomancyned: cool!
14:39RaynesSo does Ioke, but it has a wikipedia page.
14:40RaynesAlbeit a small and insignificant one, but one nonetheless.
14:40RaynesMembers: 40
14:40RaynesThe number of members on Kenai are exactly the number of members in the Ioke mailing list as of today.
14:40Raynes:)
14:52defn2010 is my Limbo year
14:52defn(kidding..kidding..)
14:53rseniorI'm having some difficulty getting lein swank (and swank-clojure-project has the same problem) to recognize that my
14:53rsenior files are in src/, it seems like I'm probably missing something
14:53rsenior basic since I have a very small build etc but the namspaces that I
14:53rsenior have in src/ aren't showing up in swank
14:54rsenioroops, sorry that broke into multiple messages
14:56rseniorI'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:57defnrsenior: what specifically are you trying to do
14:57rseniorI just have two clojure files, one references the other
14:57defnin new builds of lein you need to specify namespaces
14:57hiredmanonly for compiling
14:57rseniorthat's what I was thinking
14:57hiredmannot for classpath stuff
14:57defn*nod* -- im just not clear on what rsenior's problem is
14:58rseniorok, I'll layout what I have
14:59rseniorcom/my/package/swank-project-test.test namespace
14:59rseniorand a com/my/package/swank-project-test.test-common namespace
14:59defnthe -'s might be your problem
14:59rseniorok
14:59rseniorlet me pull them out
15:00rseniorfrom the directory names as well?
15:00defnyeah
15:00defnfor the purposes of testing it anyway
15:00defni remember you needed to call -'s _'s in your project.clj
15:00defnin order for it to work
15:02hiredmanrsenior: com/my/package/swank-project-test.test-common is not a valid namespace
15:03defnhiredman: for the reason im describing or other?
15:03hiredmandefn: other
15:03hiredmannamespaces don't contain '/'
15:04defnhiredman: oh yeah, i thought he was referring to his directory structure
15:04defnbut that makes sense
15:04hiredmanin that case it is wrong too
15:04defneither way that would be incorrect
15:04defnyeah
15:04defncom.my.package.swank_project_test.test_common
15:04arohnerWhen using clojure-mode in emacs, there is too much indentation when a function is continued to the next line
15:05rseniorI'm not using slashes, just .
15:05rsenioryeah, that's how I've got it
15:05arohneri.e. (foo \n bar) indents like 6 spaces, when I want it to be 2. How do I fix that?
15:05defnarohner: on defs or on defn's?
15:05arohnerdefn: when calling functions
15:05arohnerdefn looks fine
15:06arohner(defn foo \n bar) indents 2 spaces, but (foo \n bar) indents 8 spaces
15:06defnarohner: 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:09defnarohner: clojure-mode uses lisp-indent-function it looks like
15:09rseniordefn: removed the - stuff and still the same result
15:09defnrsenior: something you might want to ask technomancy about -- i dont know :\
15:10hiredmanrsenior: do your namespaces and directory structures match?
15:10rsenioryes
15:10hiredmanhow do you know?
15:11defnsrc/com/my/package/swank-project-test/test-common.clj
15:11hiredmanno
15:12hiredman- needs to be _ in filenames
15:12rseniorI got rid of all -
15:13hiredmanso what is your namespace now?
15:13defnhiredman: right, but dont you still refer to them in the project.clj as -'s? i avoid them just because of that weirdness
15:13rseniorso now I have srcsrc/com/company/swanktest/squaretest.clj with a namspace of com.company.swanktest.squaretest
15:14rseniorI 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:15rseniorsrcsrc above should just be src
15:15hiredmanand what is the code that is failing?
15:15rseniorI'm not even to the code failing part
15:15rseniorI run lein swank and run (all-ns) and don't even see the namespace in there
15:15_atoah
15:15_atothere's your problem
15:15hiredmanwhy would it be?
15:16_ato(all-ns) won't show namespaces until they're loaded
15:16defnbingo
15:16_atoit doesn't walk the classpath
15:16rseniorso just lein swank isn't aware of my source files?
15:16rseniorper the docs, I thought it added src to the classpath
15:17_atocorrect, but all-ns doesn't show you what's in the classpath
15:17_atoit shows you all the loaded namespaces
15:17_atojust try (require 'com.company.swanktest.squaretest)
15:18rsenioroh, I see what you're saying, the source is there, but needs to be included via use/require
15:18rseniorok
15:20rseniorthat was it
15:20_atoyep, 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:20rseniorwow, totally missed that one
15:21rseniorso how do users of lein swank typically get that loaded
15:21_atothe 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_atowhich will compile/execute it and hence pull in all the require/uses at the top of the file
15:22rseniorthat's how I work with swank when I launch it inside of emacs
15:22rseniorok, I understand
15:22rseniorthanks so much for the help
15:49Scriptorhey everyone, got a question about macros
15:50RaynesEVIL!
15:50Scriptorsince Clojure is compiled, does that mean that the compiled code for a macro is run *during* compile-time when it's called?
15:50RaynesBEGONE!
15:50Scriptorheh
15:50Scriptorit's just an implementation question!
15:51Raynes;)
15:51RaynesThat'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:52LauJensenRaynes: Shower time? Oh its monday already? :)
15:52hiredmanScriptor: yes
15:52hiredmanmacro expansion happens before compilation
15:52RaynesLauJensen: :p
15:52RaynesHey! I did get to see the answer.
15:52Scriptoryay!
15:54Scriptorthat'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:54hiredmanit has to run before compilation because macros operate on datastructures(code) and after compilation you just have bytecode
15:55triyoI'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:55hiredman
15:55hiredmantriyo: macros are not operations on strings
15:56hiredman(x y z) is a list
15:56stuartsierratriyo: you probably want ~(symbol (str "make-" name))
15:56hiredman(defn make- whatever) is also alist
15:56Scriptorhiredman: right, that seems to be the only way to run the logic inside a macro
15:56triyostuartsierra: thats exactly it
16:14hiredmanhttp://writequit.org/blog/?p=365 oooh, clojure-opennlp
16:15hiredmanclojurebot definitely needs
16:21caljuniorjava interop question: shoppingBasket.set(new NumberOfPotatoes(3))
16:22caljuniorhow could I clojurize this?
16:22caljuniorI tried: (. shoppingBasket (NumberOfPotatoes. 3))
16:22caljuniornot good
16:22hiredmanuh
16:22caljuniorAlso: (set! (. shoppingBasket (NumberOfPotatoes.)) 3)
16:22caljuniorno dice
16:22hiredmanso what is shoppingBasket.set()?
16:23caljuniorinstance
16:23caljuniorinstanceMember rather
16:24hiredmanare you sure? because static calls look exactly the same in java
16:24caljuniorcorrection: instance.
16:24caljuniorfinal answer
16:24hiredmancaljunior: how can that be an answer?
16:24caljuniorit's a joke
16:25hiredmancaljunior: do you know how to write a clojure call to a method on an instance of an object?
16:26caljunioryes: (. instance-expr (method-symbol args*))
16:26dakronehiredman: hurray, I'm glad you like my post :)
16:26hiredman:D
16:27hiredmancaljunior: that will work but more common these days is (.method instance args*)
16:28hiredmancaljunior: so then how would you write shoppingBasket.set() in clojure?
16:28derefedI 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:28caljunior(.set shoppingBasket)
16:28nDuffWhy 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:29kotarak,(.toString "Hooray")
16:29clojurebot"Hooray"
16:29hiredmancaljunior: and now new NumberOfPotatoes(3)
16:29kotaraknDuff: (:use [clojure.contrib.duck-streams ...])
16:29kotaraknote []
16:29S11001001derefed: even with defn it could still be marked private, this is determined by metadata, not the defining macro
16:29caljunior(.set shoppingBasket (NumberOfPotatoes. 3))
16:29derefedS11001001: is it just arbitrary?
16:30caljunior:-O
16:30S11001001derefed: never
16:30caljuniorit's so simple, it hurts.
16:30nDuffkotarak, ahh; thanks.
16:30derefedhmm... but other functions aren't being marked private
16:31derefedhow can I force it to be public?
16:31S11001001do you control the module you are importing?
16:31derefedand how can I know ahead of time which things are public/private
16:31derefedyeah
16:31kotarakderefed: 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:32hiredmanderefed: regardless of your current issue you are asking for problems using single segment namespaces
16:32derefedkotarak: doesn't seem to be
16:32derefedhiredman: what do you mean?
16:33hiredman~namespaces
16:33clojurebotnamespaces 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:33derefedoh
16:33derefedwhy is that a bad thing
16:33hiredmanbecause of the way clojure compiles namepsaces single segment namespaces end being classes in what is called the default package in java
16:34derefedso should I stuff all these into a folder to get a second segment and declare it in ns?
16:34derefedor can I do without the folder
16:35hiredmanyour namespaces and directory/file structure must match
16:35kotarakderefed: some kind of quasi-standard which arose lately seems to be foo.core. If you would normally call it foo.
16:35derefedokay
16:35derefedI'll do that
16:35derefeddo you think that'll solve my other problem or is that unrelated?
16:36derefedlol
16:38hiredmanderefed: I think it might, but regardless it will put you in well used code path which makes for easier debugging
16:38derefedokay
16:38derefedI'll give it a shot
16:43technomancykotarak: according to fogus: "whenever I solve a hard problem with C++ I feel like I've won a bar fight."
16:44kotarakhehe
16:44dnolenClojure on Linux Journal cover, nice, http://www.linuxjournal.com/on-newsstands
16:45kotaraktechnomancy: 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:45stuartsierraI like C much better than C++
16:46technomancyyeah, they're definitely different levels of ick. =)
16:46stuartsierraC is great if you care about things like bit sizes and memory layout.
16:48derefedah 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:48derefedthanks for the tip about namespaces hiredman
16:48Licenserhi 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:48Licenserbest 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:49caljuniorthanks for helping me answer my own question hiredman :-)
16:49hiredman:)
16:50derefedwhat is sandboxing?
16:50Licenserderefed: preventing code from things like rm -rf /
16:50derefedoh
16:50Licenserwhich is pretty cool if you have publically editabile code (as in clojurebot or my project for example)
16:51hiredmandakrone: 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:51Chousukeyou could of course just define your own language for the AIs, but that's rather limiting :/
16:51dakronehiredman: that's a good idea
16:52dakroneI'll check it out
16:52LicenserChousuke: that was my first idea, but it seems that the scripting frameowk for java is pretty cool
16:52ChousukeLicenser: you don't need a scripting framework when you have clojure, anyway. :)
16:53Licensermainly 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:53ChousukeLicenser: but sandboxing Clojure isn't easy to do perfectly, so... :/
16:53hiredmanyou can white list functions, but that might be painful
16:53ChousukeLicenser: I think then you should probably just define your own language and write an interpreter for it
16:53ChousukeLicenser: of course, since you'll be writing an interpreter for a *data structure* it won't be so bad. :)
16:54LicenserDid that last time :P I ended up with AmberVM :P a huge construct slow as hell and nearly as unsecure as the original
16:54hiredmanhttp://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj
16:55Chousukewell, all you really need are some primitives and a way to define functions
16:55Licenserhiredman: 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:55Chousukethe clojurebot sandbox won't really help you.
16:56hiredmanwell
16:56hiredman,alter-var-root
16:56clojurebot#<core$alter_var_root__6210 clojure.core$alter_var_root__6210@1998f48>
16:56hiredman:|
16:56hiredman,(alter-var-root foo)
16:56clojurebotDENIED
16:56Licenserah well not that bad
16:57hiredmanclojurebot has a blacklist, which is full of holes
16:57Licenserwell ideally I wanted to allow people to write the AI scripts in any java scripting framework compatible language :P
16:57ChousukeYou probably won't be able to allow the users access to clojure.core though :/
16:57Licenserhmm complicated
16:57hiredmanyou would want a combination interpreter/whitelist
16:58Chousukeor you can trust your users not to do silly things, but...
16:58hiredmanhohoho
16:58nDuff...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:58LicenserChousuke: that line is nearly worth a quote :P
16:59nDuffat that point you can do OS-level sandboxing, java security framework sandboxing, put them inside of qemu VMs, or pretty much anything else
16:59ChousukeLicenser: indeed, it's like trusting fish not to swim
17:00LicensernDuff: the systm level security isn't that much of an issue, I wonder about in application security
17:00hiredmanand can you trust the AIs?
17:00nDuffLicenser, 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:00Licenserhiredman: they might try to achieve world domunation one day
17:00LicensernDuff: that isn't a dumb idea actually
17:00jasappqueue skynet comment
17:01hiredmanfor the interpreter/whitelist approach the interpreter would be more of a deep inspecter, but it would have the form of an interpreter
17:02jasapphiredman: I might have missed it, are you happy with the sandboxing you've done for clojurebot?
17:02hiredmanmeh
17:03jasappI see him broken every now and then, is that because of people breaking him intentionally?
17:03hiredmannot that I am aware of
17:03hiredmanwhen is it broken?
17:04LicenserI think people here are OK enough not to make stupid things
17:04jasappI can't remember the last time I saw him broken, actually
17:04hiredman:D
17:04hiredmanfive nines dude
17:04jasappheh
17:04bsteuberhow about the JVM's sandboxing abilities? I would have guessed they solved that issue somehow
17:05hiredman~sandboxing
17:05clojurebotexcusez-moi
17:05hiredman~sandbox
17:05clojurebotsandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html
17:05hiredmanclojurebot: dork
17:05clojurebotIt's greek to me.
17:05crowbar7hiredman: do you actually mean Nine Fives?
17:05crowbar7p
17:05crowbar7:p
17:05hiredman~words
17:05clojurebotThese words are razors to my wounded heart
17:06Licenserso the jvm sandboxing does not allow in application sadnboxing :( so no luck for me
17:07bsteuberhow about the &env stuff and eval - never gotten into this stuff..
17:07bsteuberof how about eval'in stuff in a namespace you set up for them?
17:08Licenserhmm I am note sure
17:09LicenserI 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:11Licenser 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:12bsteuberand before eval you can let clojure resolve all symbols and make sure nothing is used that resolves to the outside
17:14technomancyhugod: you work on the jclouds library?
17:14Licenserhrm that all sounds not nice
17:14bsteuberI think it's still way easier that rolling an own DSL
17:15bsteuberwell, the namespace setup isn't even necessary
17:15Licenserbsteuber: I'm not sure, I can see so many things go wrong
17:16bsteuberso I just picture some white- oder blacklists or a combination
17:16bsteuberyou need to specify what you want users to have of have not - whichever method you use
17:17Licenser*nods*
17:17hiredmanpure functions you can whitelist like +
17:17hiredmanyou won't want to allow restruicted calling to java
17:18hugodtechnomancy: yes
17:18bsteuberand then, you just (read user-code) and recursively check for violating symbols
17:18bsteubershould be an easy algorithm
17:18Licenserhmm hmm
17:18technomancyhugod: cool; sent a pull request for a few cosmetic things
17:18hiredman,(doc tree-seq)
17:18clojurebot"([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:19technomancyhugod: also I noticed "mvn test" runs the tests for clojure itself, but I'm not maven-savvy enough to fix it
17:19hiredmanhttp://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj#L59
17:19technomancyhugod: assuming you have commit rights?
17:19Licenserah nice
17:19technomancytree-seq is awesome
17:19hugodtechnomancy: great - the clojure binding is pretty new - the blobstore will be improved later today
17:19hugodtechnomancy: I do
17:19technomancyoh nice
17:20technomancywe've been rolling our own jets3t wrapper and will have to expand to rackspace soon, so this looks perfect.
17:20hugodI've been mainly working on the compute side, to support my pallet project
17:20technomancyright; that looks cool
17:20hugodtechnomancy: excellent
17:21Licenserhmm so if I whitelist it should be quite secure, as in allowing only things like fn, if, map, reduce ... + custom functions
17:22bsteubermy feeling is that you want to have a whitelist of namespaces
17:22bsteuberand each of those might have a blacklist of symbols
17:22hiredmanbsteuber: no
17:23bsteuberhiredman: explain plz :)
17:23Licenseryes plese please :D I want to learn
17:23hugodtechnomancy: i'll look at the tests - I'm not a maven expert either..
17:24hiredmanyou 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:24miltondsilvaHello. Is there any clojure networking library? I need to transfer packets from various clients to a server. What are my options?
17:26bsteuberhiredman: okay, there are some edge cases - especially about java interop
17:27bsteuberbut is it that awful?
17:27hiredmanwould you white list clojure.core?
17:27bsteubermiltondsilva: you can use any java networking lib
17:27Licenserwell whitelisting would only make it horrible on the users right?
17:27hiredmanit has eval, it has alter-var-root, etc
17:27bsteuberdunno about clojure specific libraries
17:28hiredmanLicenser: depends on what you white list
17:28hiredmanand how far you are willing to go
17:28Licenserfunctions I'd say
17:28bsteuberI'd blacklist some symbols from clojure.core
17:28Licenseror forms for that matter
17:28bsteuberbut allow for the rest
17:28hiredmanbsteuber: and when you upgrade clojure? do you go throw clojure.core everytime doing an audit?
17:29bsteuberok, it has to be updated with each clojure version
17:29Chousukeallowing clojure also allows java
17:30Chousukewhich means you need to blacklist most of java
17:30Chousukeblacklists don't work ;P
17:30Licenserso whitelist is it
17:30Chousukethough you could get pretty far by disallowing .
17:31bsteuberyes, but inside of whitelisted namespaces I'd use blacklisted symbols
17:32bsteuberI think this could be a nice library - clj-sandbox maybe
17:32Licenserbsteuber: yes
17:32bsteuberbut if it is done once and has some configuration possibilities, anyone could use it
17:32bsteuberthough I don't know of more users than Hiredman and Licenser at this point :)
17:33bsteuberbut I guess you never know them in advance
17:34Licensera good sandboxing would be great
17:34bsteuberyeah, there would be many uses
17:34hiredmanbsteuber: add as I have said your whitelisting namespaces is a bad idea I doubt I'd use it
17:34hiredmanand
17:34bsteuberuser supplied agents running on arbitrary servers have great potential, I guess
17:35S11001001Is clojure.core/compile allowed to compile and save class output for modules used by the given module?
17:36LicenserI think a good sandbox should allow: white and blacklisting forms and namespaces allowing library users to customice as they see fit
17:36hiredmanS11001001: 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:36hiredmanbut I can't really tell what you are asking
17:36bsteuberhiredman: 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:37bsteuberfor example the namespace you wrote just for the users to have
17:37hiredman*shrug*
17:37hiredmancode away
17:37duncanmwhat's the way to update the clojure and clojure-contrib jars that's used by SLIME?
17:37hiredmanbsteuber: that namespace has almost no functions in it
17:37S11001001if 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:37duncanmi tried putting 1.2 jars in .swank-clojure and it didn't work
17:39bsteuberhiredman: how would you specify what users ARE allowed to use, then?
17:39technomancyduncanm: did you remove the old jars from there?
17:39technomancyduncanm: probably easier to create a project-specific repl and upgrade your project
17:39LicenserI'll go with form whitelisting for now
17:39Licenserit sounds as the most secure way to me
17:40hiredmanbsteuber: I would use a whitelist of symbols combined with an interpreter/inspector
17:40hiredmanso a graylist
17:40bsteuberyeah, I agree about the interpreter
17:40Licenserwhat exactly do you mean with an interpreter
17:40bsteuberI guess something like disallowing .
17:40bsteuberso some form-checker
17:41hiredmanS11001001: those namespace names are just an example right, you aren't actually using single segment names, yes?
17:41S11001001hiredman: yes
17:41bsteuberlicenser: hope you do your stuff in a separate library
17:41chouserwhy not run the whitelist against the results of the compiler analysis.
17:41chouser?
17:42Licenserwhat is acompiler analysis?
17:42duncanmtechnomancy: i did remove them, and i got an error saying it couldn't find clojure.main
17:42chouserthat 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:43chouserthe 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:43bsteuberhiredman: 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:43bsteuberbut I don't know
17:43chouserfor 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:44duncanmtechnomancy: is there a reason why i'd see that? java.lang.NoClassDefFoundError: clojure/main
17:44technomancyduncanm: works for me
17:45duncanmjava -jar clojure.jar clojure.main should work, right?
17:45Licenserchouser: you scare me o.O
17:46chouserLicenser: you can look at clojurescript to see how it does it -- it's all clojure code (no java) and right there in contrib. :-)
17:46bsteuberchouse: great stuff
17:47bsteuber+r
17:47chouserit probably only works on older versions of clojure, unfortunately.
17:47Licenserchouser: just that I still don't undestand some aspects in clojure and looking in the inner working I am really afirght
17:48technomancyduncanm: actually I think it's getting stuck with the old classpath
17:48avarI finally got clojure working with swank but now I get this error on slime runtime: http://paste.scsys.co.uk/40449
17:49duncanmtechnomancy: sounds right, but how do i fix that?
17:49technomancyduncanm: try resetting swank-clojure-classpath to nil and it will try to autodetect it again
17:49avar"Caused by: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.io.Writer"
17:49chouserLicenser: well, maybe it would be easier to implement a full Clojure interpreter, but I'm don't think that's an obvious conclusion.
17:50Licenserwhy every time quiestions here end in the suggestion to to write clojure in clojure? :P
17:50chouserActually, I think I'm suggesting that you *not*. But anyway...
17:50technomancyLicenser: because it's inevitable!
17:51Licenseroh
17:51avartechnomancy: 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:51duncanmtechnomancy: i dunno how to tell M-x set-variable to let me type nil
17:51technomancyduncanm: M-: (setq swank-clojure-classpath nil) should do it
17:51technomancyavar: M-x clojure-install has been deprecated for some time now
17:52technomancysee the swank-clojure readme for updated instructions
17:53avarThis is (clojure-slime-config), but yeah it's really hard to find some proper documentation for this ;/
17:54technomancyavar: I think the swank readme is actually pretty thorough
17:55technomancyclojure-slime-config is part of M-x clojure-install, it's deprecated
17:55technomancyit does display a warning that it's deprecated when you use the old install method
17:55technomancybut I should just remove it.
17:57avarThe swank readme tells you to use clojure-install if you don't want to use ELPA
17:59avarAnyway 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:00S11001001I think it compiles other stuff, which makes lein jar put dependent classes in jars. Later all
18:00technomancyavar: must have a pretty old readme then
18:03hiredmanI 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:04avarOh 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:04avarMaybe I'll send you a documentation patch with some explicit examples once I get this running right :)
18:05technomancythat'd be great
18:05technomancyout-of-date documentation is a big problem with swank
18:05Licenserhmm 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:05avarFinding 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:07technomancymaybe an elisp example would be appropriate
18:08avaryeah
18:14avartechnomancy: 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:14technomancyavar: 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:14technomancylike it says in the readme
18:15technomancyyou don't set slime-lisp-implementations unless you want to use CL and clojure together
18:17avarThat'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:18nteonwhats the best way to join a number of sets?
18:18technomancyhm; sorry... I don't know how to use it with CL
18:19avarThat's easy, you just set slime-lisp-implementations to include both e.g. '(sbcl and '(clojure
18:19hiredmannteon: have you looked in clojure.set?
18:20nteonhiredman: yes, and I want to use union, but union doesn't want to work with me.
18:21hiredmannteon: how so?
18:21avarI'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:21avarAnyway I'm asking too much, I'm just going to sleep and look at this tomorrow :)
18:21hiredmanavar: uh, it's yourproject/libs/
18:21hiredmannot src
18:22technomancyswank-clojure will only download jars when it hasn't been configured
18:22technomancybecause if you haven't told it where your own jars are, it's useless
18:26defngod 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:28Licenserdefn: I know the feeling
18:31nteonhiredman: 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:33hiredmannteon: that has nothing to do with union
18:33hiredmanyou are trying to call a Symbol as a function somewhere
18:34nteonhiredman: yea, I realize its my fault and not the set libraries, I just don't know why yet.
18:34nteon(a) returns the set when I execute it at the repl, but (union (a)) throws that error
18:35hiredmanand (a)?
18:56duncanmwhat's the way to go from a 2D java array to a nice Clojure seq?
18:56duncanm(seq x) only seqifies the outer array
18:57hiredmanwhy?
18:57clojurebotwhy not?
18:57duncanmi was seeing this #<double[][] [[D@2206270b>
18:58duncanmthen i added a seq call, and it only turned into this: (#<double[] [D@19aa5882> #<double[] [D@7e98cbf7>)
18:58hiredmanif it is just for printing I think pprint will print arrays nicely
18:58duncanmahh
18:58duncanmokay
18:58hiredmanor at least has an option to
18:58hiredmanif you *really* want seqs you can just map seq
19:03nteonokay, I know what I'm doing wrong, I just don't know why its wrong http://fpaste.org/uTxk/
19:04nteoncontrol in that case refers to a function that accepts no args
19:05nteonI want to call it like (defmodel a :control some-fn)
19:31dnolennteon: what do you want the result to look like?
19:36nteondnolen: i want it to expand to (def a #{...}), given my example input above
19:37dnolennteon: and what is in the set?
19:37nteondnolen: some keywords
19:38nteondnolen: and it works as pasted, but I don't understand why the commented out part doesn't work
19:38dnolennteon: because control is not a function at, it's just a symbol at macroexpansion time
19:39dnolennot a function at -> not a function at that point
19:39dnolenif you really want to call that function you'll need to resolve that symbol or use eval.
19:41rickmodeQuestion: 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:43nteondnolen: of course! thanks.
19:45dnolennteon: np
19:46nteonthat makes sense, and the error makes sense in this context. I just didn't fully get (probably still don't) macro-expansion time
19:54bsteuberhow would you assoc a list of keys to the same value in the most elegant way?
19:57bsteuberlike that?
19:57bsteuber,(apply assoc {} (interleave [1 2 3] (repeat 42)))
19:57clojurebot{3 42, 2 42, 1 42}
20:14_ato,(zipmap [1 2 3] (repeat 42))
20:14clojurebot{3 42, 2 42, 1 42}
20:14_atobsteuber: ^
20:28bsteuber_ato: thx, I always forget about zipmap
20:29bsteuberI also don't remember the f for (f cons) -> #(cons %2 %1)
20:29bsteuberhaskells swap, I think
20:41_atobsteuber: 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:46bsteuberI think I've seen one here before
20:46bsteuberbut yeah, I was just curious
20:54shrugheshaskell's is called flip, but i don't know if clojure has one
21:08nteonwhat is the best way to load a file of clojure code into a particular namespace at runtime?
21:08bsteuber,(doc load-file)
21:08clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
21:08bsteubernteon: probably this
21:08qbgJust bind *ns* around load-file
21:09nteonqbg: okay, thats along what I was thinking. wasn't sure if there was a better way to do it
21:09bsteubersorry, got the "particular" wrong :)
21:10qbgCome up with a more elegant design?
21:11bsteuber,`with-ns
21:11clojurebotsandbox/with-ns
21:12bsteuberI guess it's not officially allowed to rebind *ns* on your own
21:12bsteuberat least that's how I understand http://clojure.org/namespaces
21:13nteonbsteuber: what do you mean allowed?
21:14bsteuberwell that you shouldn't use (bindung [*ns*] ..) on your own, but rather call functions like in-ns
21:14bsteuberI guess there was a with-ns macro somewhere for that?
21:14bsteuberbut I might be completely wrong :)
21:16bsteuberhttp://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/with_ns.clj#L20
21:16psykotichttp://gist.github.com/326073
21:16bsteuberthis does something special, at least
21:17bsteuberanyways, I'm going to bed - cu
21:18nteonbsteuber: thanks! thats what I was just about to write, but most likely not quite as nicely as stuart
21:32defnanyone have any experience connecting to an SSL secured https site?
21:46mikemhi, 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:47mikemthe error trace does indicate that it checked clojars.org/repo/ and build.clojure.org/releases...
22:13brandonwi don't quite understand what is going on here:
22:13brandonw,(map #(println %1 %2) (range 1 5) [:1 :2 :3 :4])
22:13clojurebot(nil nil nil nil)
22:13Scriptordoes Clojure's 'or' compile down to the same bytecode as or in Java?
22:13brandonw,(map #(println %1 %2) (range 1 5) [:1 :2 :3 :4])
22:13clojurebot(nil nil nil nil)
22:13brandonwerr, that didn't help much
22:13Scriptorbrandonw: println just prints it, but it returns nil
22:14brandonwoh right, that would be a bad example
22:14brandonwlet me use what i originally wrote before i started trying to debug
22:14hiredmanScriptor: how could it?
22:15hiredmanclojure's truth table is not the same
22:15Scriptorhiredman: not sure at all, it just seems to be less efficient though
22:15brandonwah, got it
22:15brandonwmy problem was i was using #([%1 %2]) as an fn for map, instead of #(vector %1 %2)
22:16Scriptorhmm, why wouldn't that work?
22:16hiredmanbrandonw: just call vector
22:16brandonwit tries to call the resulting vector
22:16brandonwas a function
22:16hiredman,(map vector [1] [2])
22:16clojurebot([1 2])
22:16brandonwoh right
22:16brandonwhaha
22:16hiredman,(macroexpand-1 '#([%1 %2]))
22:16clojurebot(fn* [p1__11865 p2__11866] ([p1__11865 p2__11866]))
22:17brandonw,([1 :1])
22:17clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: PersistentVector
22:17brandonwdoesn't work :)
22:17brandonwas smart as clojure is, it can't quite read your mind, haha
22:18brandonwthat will be in 2.0
22:39RaynesOh my God. Twitter is down.
22:43tomojit's just you
22:44RaynesNot the website; the API.
22:44iceyRaynes: seems to be working for me
22:44iceyor rather, my client is connecting fine
22:44RaynesOh. That's just great.
22:45RaynesOh joy, now it's working.
23:01radsmikem: try [clojure-http-client "1.0.0-SNAPSHOT"]
23:50slyphonso, what do people use for templating w/ compojure?
23:51technomancyslyphon: HTML or general?
23:51slyphonHTML, i guess
23:51technomancyI really like enlive for that
23:51slyphoni'm a little lost w/o ERb
23:51technomancybut it's not really well-documented
23:51technomancyenlive is much better than ERb for HTML/XML
23:51slyphoni want to avoid anything like jsp or "struts" or that crazy bullshit
23:52slyphonoh?
23:52slyphonis it clojure?
23:52technomancyyeah
23:52technomancy~enlive
23:52clojurebotExcuse me?
23:52slyphonoh, maybe i'll check it out
23:52technomancy,google enlive clojure
23:52clojurebotjava.lang.Exception: Unable to resolve symbol: google in this context
23:52technomancy~google enlive clojure
23:52clojurebotFirst, out of 514 results is:
23:52clojurebotClojure and me: Enlive: yet another HTML templating library
23:52clojurebothttp://clj-me.blogspot.com/2009/01/enlive-yet-another-html-templating.html
23:53slyphontechnomancy: is leingen easy enough where a maven neophyte like me will be able to use it?
23:53slyphoni've been using rake so far, and just checking all my jars into the repo
23:53slyphonbecause that's how i *roll*
23:53technomancyclojurebot: enlive is for generating HTML from pure-markup templates: http://wiki.github.com/cgrand/enlive/getting-started
23:53clojurebotYou don't have to tell me twice.
23:54technomancyslyphon: dude. git is astonishingly bad at tracking jar files.
23:54technomancygo right now and rewrite your history to cut them out
23:54technomancyquickly, before anyone notices.
23:54slyphonheh
23:54technomancyslyphon: yeah, anyway you should be fine using leiningen with no maven knowledge. it's designed for that exact use case.
23:54slyphonah, good
23:55technomancyif it weren't from the overly-verbose log output when it runs, you would never know maven was involved.
23:55_atoI found this quite handy as well for enlive: http://github.com/swannodette/enlive-tutorial
23:55slyphontechnomancy: heh
23:57slyphonwow, this looks...different
23:57technomancyif you're used to systems that mix presentation and logic, it's quite a change
23:57technomancybut a refreshing one, I think.
23:57slyphonyeah
23:58slyphonwell, i used haml for my last project
23:58slyphonwhich i thought was quite nice
23:59hugodtechnomancy: what would you recommend for the general (non-html/xml) case?
23:59technomancyhugod: there was an interesting looking string interpolation macro discussed a few months ago, and there was also a templating library announced called fleet
23:59technomancybut I haven't used either