#clojure log - Jan 04 2012

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

0:05 amalloy: someone did something like that. but it's very dangerous territory: you're abstracting over stuff that you really need to know/care about

0:41 * technomancy_ builds a project graph of everything on clojars

0:41 technomancy_: man, there's a lot of potential in clojuresphere

0:43 wingie: are there some cool products created with clojure?

0:43 and how do you think clojure compares to scala?

0:44 technomancy_: clojurebot: scala?

0:44 clojurebot: {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}

0:44 wingie: whats that?

0:46 technomancy_: scala

0:47 wingie: dont get the example .. it's demonstrating the verbosity of it?

0:47 amalloy: i think the dramatic illegibility. like, i get haskell type signatures, but i can't even begin to guess what this means

0:47 technomancy_: yeah, I have no idea

0:48 my take-away is that scala is easier for Java people to learn because it lets them mix imperative OO and FP.

0:48 and for some reason, some people think that's a good thing.

0:48 wingie: are there times you need oop in clojure?

0:48 its like js embracing oop and fp

0:49 could be a good thing?

0:49 who said fp fits for every situation

0:49 also if all langs were fp we would have missed oop :)

0:49 so good to be able to use whatever we want whenever we want perhaps

0:49 technomancy_: well... if you can't see why that's bad maybe you should spend some time doing scala.

0:50 or JS for that matter

0:50 * technomancy_ shudders

0:50 wingie: im spending quite of an amount on js

0:50 but im still very new to programming in general

0:50 its due to the mutable states in objects?

0:51 *reading programming clojure*

0:51 technomancy_: OO is a bunch of concepts bundled up together

0:51 wingie: perhaps it will give me some more hints

0:51 technomancy_: some of them are good, but there's no reason to take them as a whole

0:52 wingie: couldnt you say that they make more sense for our mind?

0:52 fryguy: wingie: no

0:52 wingie: when you have robot .. he has a name .. he can do things etc

0:52 amalloy: you can say anything you want. the english language is very expressive

0:52 wingie: kinda like theatre

0:52 technomancy_: OO is definitely more intuitive to people who have been trained in OO.

0:53 amalloy: same thing applies to mutable state. SICP goes forever without introducing any mutability and then is like "okay look, you can change things if you want. see how many of our existing concepts/rules this breaks?"

0:55 but if you grew up thinking of programming as "do this, do that, now do this" then it feels "natural" to use mutation, and "restrictive" not to; as opposed to "natural" to program functionally and "world-breaking" not to

0:55 skelternet: wasn't OO's birth in SmallTalk supposed to be more around so-called message-passing and not so much function calls? That seemed like a big deal

0:56 amalloy: one of the things OO originally emphasized was immutability

0:57 wingie: amalloy: the former is imperative programming and the latter is functional programming?

0:57 amalloy: yes

0:57 technomancy_: amalloy: eh? you mean kay?

0:57 amalloy: technomancy_: yeah

0:58 wingie: are there more styles than ip and fp?

0:58 amalloy: am i wrong? i've had trouble re-discovering his quote about that

0:59 technomancy_: that's new to me

1:01 oh dang

1:01 I never realized what fnil was for

1:01 but it's for implementing safe-inc

1:02 whenever I do map-reduces to do counts I always have to (defn safe-inc [x] (inc (or x 0))), which is what fnil is for

1:02 this concludes me being an idiot; back to your regularly-scheduled #clojure.

1:02 alexbaranosky: wingie, I've done a decent amount of Scala at work - I like Clojure better for various reasons, but you could do a lot worse than being "stuck" with Scala

1:02 amalloy: yeah, i love (fnil inc 0)

1:04 wingie: alexbaranosky: could you just name some of the reasons?

1:06 technomancy_: I've only seen one person go the other way, (clojure -> scala) but that could also be explained by the relative size of the communities, so whatever.

1:06 alexbaranosky: wingie, I day try them both.

1:06 amalloy: technomancy_: http://programmers.stackexchange.com/questions/81197/what-did-alan-kay-mean-by-assignment-in-the-early-history-of-smalltalk is a pretty good thing on that topic

1:06 alexbaranosky: technomancy_, also the company you keep affects that perception I'm sure

1:07 technomancy_: yeah, definitely

1:07 amalloy: right, probably anyone going from clojure->scala will have their relationship with technomancy_ degrade first, so that he never notices them leave

1:07 technomancy_: amalloy: nah gnuvince still has the gall to hang out in #emacs; can you believe it

1:07 alexbaranosky: wingie, Scala is not dynamically typed, so depending on which side of the stat/dynamic argument you live you may like Scala or Clojure more, for example

1:07 technomancy_: thanks for the link

1:07 amalloy: (cause how could you leave while you're still buddies with phil)

1:08 * technomancy_ doesn't mind static typing; it's static typing without hindley-milner that sounds annoying

1:08 alexbaranosky: wingie, Scala is very object oriented - you could say 60% oo, 40% functional

1:08 amalloy: yeah, i feel the same. hindley-milner makes static types totally un-irritating

1:08 technomancy_: alexbaranosky: wouldn't you say that is more a function of the codebase than the language?

1:09 alexbaranosky: wingie, Clojure is much less OO centric, maybe like 10% or something

1:09 wingie: alexbaranosky: oh thought it was not oo at all

1:09 technomancy_: alexbaranosky: from what I gather there are lots of people trying to write Java in Scala and some people trying to write Haskell in Scala

1:09 alexbaranosky: technomancy_, to a degree, but in Scala even functions are objects

1:09 so I counted that :)

1:09 hiredman: https://twitter.com/#!/timbray/status/153996532952203264

1:09 technomancy_: heh

1:10 alexbaranosky: there's nothing in Scala keeping you from using simple collections: seqs, sets, maps etc

1:10 wingie, Scala even has a Haskell -like extension library called Scalaz that is pretty interesting to read through

1:11 technomancy_: alexbaranosky: right; it seems like whether you do FP or OO in scala depends largely on what circles you find yourself in

1:11 amalloy: https://twitter.com/#!/dibblego/status/124946563494719488 is one of the ones i feel guilty for liking

1:11 wingie: i wished i had more time to delve into all these langs

1:11 alexbaranosky: wingie, I personally prefer Clojure because it is more concise, more lazy (in the man Im a lazy sunofabitch today way), easier to write more concise code with less duplication -- and I hate duplication

1:12 technomancy_, definately, at my work the code is OO in Scala

1:12 wingie: alexbaranosky: yeah im already in love with lisp

1:12 i have no reason at all using clojure over node.js atm but i can't stop reading and learning about it

1:13 amalloy: hiredman: wow, that list surely is a sign of disease

1:13 alexbaranosky: node js is js, so that's a reason :)

1:13 wingie: JS really sucks compared to Clojure

1:13 thats also a reason for using it =)

1:14 but then you would use CoffeeScript and a lot of uglyness is solved

1:14 and you quite enjoy writing it

1:14 technomancy_: wingie: if you haven't read http://clojure.org/state you should at some point

1:14 wingie: i actually have

1:14 technomancy_: oh, cool

1:14 alexbaranosky: oh yeah - Scala is more complicated than Clojure

1:14 technomancy_: and then somewhere down the line you'll definitely want to read Out of the Tarpit as well

1:14 alexbaranosky: :)

1:15 wingie: is it worth learning Scala just to confirm Clojure is more pretty/concise?

1:15 hiredman: s/more complicated/less maintainable/

1:15 technomancy_: wingie: if you're interested in static types, it makes way more sense to pick up ocaml or haskell

1:15 static types on the JVM are just not much fun.

1:15 wingie: technomancy_: in a way im fond of the jvm

1:16 technomancy_: well, I mean if you're more interested in learning a good type system than Getting Stuff Done

1:16 wingie: im more to the latter

1:16 technomancy_: to a lisper, the JVM just means giving up tight posix integration and fast boot time, but to a static typing fan it means giving up full type inference, which is huuuuuge.

1:16 wingie: i have some requirements a lang must "pass" to be worth learning it

1:16 amalloy: i've dabbled in haskell, and read several chapters of a scala book (serious credentials there). haskell just seems to have way fewer special cases and a more consistent worldview

1:17 wingie: one of them is it must be deployable .. preferable in Heroku

1:17 alexbaranosky: Scala's type system is really nice, but its type inference isn't as good as Haskell/Ocaml

1:17 * technomancy_ fought with ocsigen to get it on heroku and lost badly

1:17 wingie: and Heroku has support for Clojure, Scala, Ruby, Java, Node.js, Groovy and Python

1:17 no Haskell

1:17 technomancy_: gonna need to lick my wounds a bit more before I revisit that one. =\

1:17 amalloy: technomancy_: that's an ocaml thing?

1:18 technomancy_: amalloy: yeah

1:18 alexbaranosky: amalloy, yeah, because Haskell isn't doing any OO so the language can be simpler

1:18 wingie: not even Cloud9ide has support for Haskell highlughting .. it seems that it's not that widely used they bothered to support it quickly .. perhaps later on

1:18 or not that hyped i should say?

1:18 amalloy: alexbaranosky: it actually has a ton of OO, it just can afford to think about it differently than java does; scala has to embrace java *and* pile on its own ideas

1:18 technomancy_: wingie: these days you can deploy pretty much anything on heroku provided the compiler doesn't need to be installed on a systemwide level

1:19 wingie: I've got an emacs lisp webapp at http://commodore-night-vision.herokuapp.com

1:19 ocsigen's build is just batshit insane; it's definitely an outlier

1:19 * technomancy_ has never been forkbombed by a makefile before

1:19 alexbaranosky: amalloy: hasells got records, and typeclases, so it has polymorphism, butnot the kind of OO you see in Scala

1:19 not saying Im voting for Scala's OO :)

1:20 or maybe I'm forgetting something....

1:20 amalloy: no, that's basically what i meant

1:20 wingie: technomancy_: hm how do you do that?

1:20 amalloy: i'm just saying that it's a mistake to say "OO" and mean "how java implements OO"

1:21 technomancy_: wingie: here's the trick for elisp: https://github.com/technomancy/heroku-buildpack-emacs

1:21 oh, apparently you can run ocaml: https://github.com/markpundsack/heroku-buildpack-opa just not ocsigen

1:21 amalloy: i guess inheritance is a fairly key part of OO, which haskell is kinda missing. but it does have interface inheritance in typeclasses

1:23 Twey: Haskell can do subtyping too, with HList

1:23 * technomancy_ heads off; ttyl

1:23 wingie: technomancy_: it's kinda a hack?

1:23 does original lisp implement oo?

1:24 i recall someone from lisp said he chose haskell since he wanna use oo sometimes

1:24 Twey: Enhh

1:25 You can do OO (for any of the many and poorly-defined values of ‘OO’) in Haskell, but generally you wouldn't, because it's just not something that makes a lot of sense in the programming model Haskell primarily enables

1:25 Not that it's not possible, it's just not very useful

1:25 Common Lisp, OTOH, has a great OO system

1:25 amalloy: wingie: http://www.winestockwebdesign.com/Essays/Lisp_Curse.html has an interesting point about object-orientedness in lisp, in the first few paragraphs

1:25 the rest of the article is worth reading too, but isn't really relevant to your current questions

1:26 wingie: amalloy: seems like an intresteing read

1:27 ill read it before bed time

1:27 which is very soon

1:28 one thing that seems weird is the way it destructures a map

1:29 so I have this map: {:last-name "Vinge" :first-name "Vernor"}

1:29 and it is passed to this function: (defn greet-author-2 [{fname :first-name}]

1:29 wouldn't it be better doing: (defn greet-author-2 [{:first-name fname}]

1:29 coffeescript is doing like that

1:30 Twey: amalloy: That's a neat article

1:30 wingie: but i guess i could agree to the way clj is doing it

1:31 or no

1:31 it feels more natural with the coffeescript approach

1:59 what's the diff between (ns foo) and (in-ns 'foo)

2:00 raek: wingie: ns is a convenience macro for callin use, require, and import, but it also calls in-ns and refer-clojure for you

2:01 but basically you use 'ns' to create a new namespace and 'in-ns' to enter an existing one

2:02 wingie: raek: ah thnaks

2:02 thanks

2:03 raek: not that if you have (ns foo (:refer-clojure :exclude [replace])) in foo.clj, require it and then use (ns foo) to enter the namespace in the repl, you will mess up replace in foo

2:04 wingie: seems to much info for me right now .. have to absorb it slowly by reading the book

2:04 raek: since (ns foo) does something like (ns foo (:refer-clojure :exclude []))

2:04 wingie: but i know if there are same names they will be replaced

2:05 raek: wingie: this is a good guide: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

2:06 I rarely use 'ns' in the repl at all, but I use it in every source file

2:07 in emacs I can press C-c C-k followed by C-c M-p to load a namespace and cause the repl to be in it

2:08 the equivalent clojure repl invokation would be (require 'foo :reload) (in-ns 'foo)

2:15 amalloy: or: (doto 'foo (require :reload) (in-ns))

2:16 wingie: raek: thanks ill have a look in it

3:34 tsdh: Is it a bug (with no practical implications) that (= (gensym) 'G__1737) returns true for a wisely chosen symbol?

3:44 CmdrDats: hey guys, I need to connect to a server running swank with emacs from the outside - any pointers on how I should handle some kind of authentication/security so that it's not just an open port?

3:47 tsdh: CmdrDats: Why not ssh to the server and only connect locally? Then you can forbid connections from outside to the swank port.

4:07 CmdrDats: found this : http://a1k0n.net/2005/11/04/lisp-using-slime-over-ssh.html :D

4:07 looks like i can make that work with clojure just fine

4:12 notsonerdysunny: CmdrDats: would you be able to post what you come up with on using slime over ssh?

4:13 CmdrDats: sure

4:13 notsonerdysunny: thanks CmdrDats

4:15 amalloy: tsdh: IMO yes. i wish gensyms worked like they do in CL

4:16 notsonerdysunny: easy. call the two hosts Server and Client. on Server, lein swank. on Client: ssh -NfL 4006:localhost:4005 Server; (slime-connect localhost 4006)

4:17 the tricky part is getting filename translation right when you do stuff like C-c C-k. i haven't really worked out how to do that, but there are definitely articles about it that appear to make some sense

4:18 tsdh: amalloy: Thanks, I agree. It might even get a real issue if one clojure process generates code that is loaded by another process later on...

4:19 amalloy: well you're never going to make that work

4:20 there's a reason the CL reader barfs when it tries to read a form containing a gensym - it refuses because it might create a collision

4:21 tsdh: Really? I can read gensym-like looking symbols just find with SBCL.

4:22 notsonerdysunny: thx amalloy

4:23 amalloy: tsdh: hmmmmm. the behavior seems to be more complicated than i thought

4:24 for example, (let ((#:G9518 1)) #:G9518) gives me an error on clisp

4:24 but it's not a reader error, because i can evaluate '#:G9518

4:25 tsdh: amalloy: Indeed, that doen't evaluate in SBCL, too.

4:26 amalloy: (eq '#:G111 '#:G111) => NIL, which somehow explains it.

4:27 amalloy: ah. so when it reads them in it refuses to let them be eq to anything else

4:27 tsdh: Ok, so my code generation argument doesn't make sense with CL, anyway.

4:29 amalloy: right. if you want to serialize code as a string, you have to settle on names for the gensyms, and those can conflict

4:30 Fossi: either that or they would have to be more unique ;)

4:30 amalloy: but if you want to preserve the gensyms you can just write your own. instead of serializing '(fn [foo_1029] (inc foo_1029)), you can serialize it as '(let [foo (gensym)] `(fn [~foo] (inc ~foo)))

4:30 Fossi: afaik erlang creates unique identifiers even across machines

4:31 amalloy: you have to eval in any case, so all you have to do is be more explicit about the gensyms in the output code

4:34 tsdh: amalloy: Right. But in that case, the reading process will generate unique gensyms again, so that it's again only an issue if a user decides to use vars like G__1713. (I've heard rumors that programming physicists like to have hundreds of variables that are simply numbered. :-))

4:47 fbru02: hey guys ! what's the best way to eliminate for a vec the previous to last element ?

4:55 AWizzArd: fbru02: maybe subvec is what you want

4:57 fbru02: AWizzArd: thanks let me tcheck that

5:27 blackbit: Are there any plans to add core.match to clojure?

5:31 jaley: hey guys. sorry... i've been reading the migration guide and i can't find the answer anywhere... where are the libraries formerly in contrib that didn't migrate to a modular library now? i'm looking for what was repl-utils

5:34 ejackson: jaley: a lot of that went into clojure.repl

5:34 i think

5:38 fbru02: what's the best way to cons something into a vector and get a vector back ?

5:41 jaley: ejackson: oh.. there's a clojure.repl... thanks!

5:41 ejackson: fbru02: conj

5:42 fbru02: ejackson: and then reverse it ?

5:42 ejackson: fbru02: to do that you need to go via a seq

5:43 fbru02: ejackson: yeah the thing is I want a vector and i want to add sth at the front

5:43 ejackson: fbru02: concat then

5:44 ,(into [] (concat [1] [2 3 4]))

5:44 clojurebot: [1 2 3 4]

5:44 fbru02: ejackson: awesome, thanks

5:44 ejackson: fbru02: careful about letting that get too long though, concat is dangerous

5:45 fbru02: ejackson: no it will be small always

5:45 ejackson: you're good then

5:48 tscheibl: ,(concat [1] [2 3 4])

5:48 clojurebot: (1 2 3 4)

5:48 ejackson: tscheibl: he wanted a vector back

5:48 tscheibl: yep I'm just testing

5:48 ejackson: :)

5:49 tscheibl: although I could do it in my own repl ;)

5:49 ,(apply conj [1] [2 3 4 5])

5:50 clojurebot: [1 2 3 4 5]

5:51 tsdh: tscheibl: BTW, I've seen that clojure 1.4 added some eager, vector-returning variants of map, filter, reduce (mapv, filterv, reducev)...

5:51 tscheibl: tsdh: hey, cool

5:51 ejackson: that's interesting

5:51 tscheibl: ejackson: btw, the apply conj version is almost double speed of the into variant

5:52 ejackson: seriously ?

5:52 tsdh: tscheibl: Really? What clojure version?

5:52 tscheibl: yep.. just tried it out using (time)

5:52 1.3

5:52 ,(time (dotimes [c 10000] (into [] (concat [1] [2 3 4 5]))))

5:52 clojurebot: "Elapsed time: 133.842 msecs"

5:53 tscheibl: ,(time (dotimes [c 10000] (apply conj [1] [2 3 4 5])))

5:53 clojurebot: "Elapsed time: 144.392 msecs"

5:53 tscheibl: hmm

5:53 at least in my repl on 1.3

5:53 tsdh: tscheibl: Hm, in that version, into will use transients if possible. But the conversion from persistent to transient and back again doesn't make sense if the vector is that small...

5:53 tscheibl: ,(time (dotimes [c 100000] (into [] (concat [1] [2 3 4 5]))))

5:53 clojurebot: "Elapsed time: 485.379 msecs"

5:53 tscheibl: ,(time (dotimes [c 100000] (apply conj [1] [2 3 4 5])))

5:53 clojurebot: "Elapsed time: 263.549 msecs"

5:54 tscheibl: ha

5:55 tsdh: tscheibl: Try into with some larger structures, and then it should be much faster than conjoining every item separately.

5:55 tscheibl: the difference in speed gets bigger the more repetitions I use

5:55 tsdh: ok

5:59 tsdh: hmm.. I've tried it with vectors of maps instead of scalars now... the apply version is still significantly faster

6:01 tsdh: tscheibl: Try this

6:01 ,(let [v1 (vec (take 10000 (iterate inc 0))), v2 v1] (time (dotimes [_ 1000] (into v1 v2))))

6:01 clojurebot: "Elapsed time: 1061.225 msecs"

6:01 tsdh: ,(let [v1 (vec (take 10000 (iterate inc 0))), v2 v1] (time (dotimes [_ 1000] (apply conj v1 v2))))

6:02 clojurebot: "Elapsed time: 5778.755 msecs"

6:02 tsdh: Six times slower.

6:04 tscheibl: tsdh: ok.. so it depends on the size of the vector that becomes applied

6:05 anyway, the "into" version looks cleaner :)

6:06 tsdh: tscheibl: Yep. into creates a mutable (transient) vector for its first argument, into which additions can be performed more efficient.

6:06 tscheibl: and more concise

6:06 zilti: I have a problem with clj-time... I want to "(parse (formatters :date) (now))" but that doesn't work... :(

6:11 tscheibl: zilti: why would you want to do that?

6:11 zilti: tscheibl: I want to format the current date

6:11 tsdh: When chunking a seq in order to process chunks in parallel, is there some rule of thumb how many chunks to generate depending of the number of processors?

6:12 zilti: tsdh: One per virtual core I'd say would be the most efficient

6:13 tscheibl: zilti: wouldn't it be 'unparse' then? (unparse (formatters :date) (now))

6:14 zilti: Oh. Indeed

6:14 tsdh: zilti: Hm, but then, if one chunk is processed earlier, its thread cannot pick up another chunk.

6:15 zilti: So I'd say, it might be something like (* 2 N) or so... Well, I'll run some benchmarks...

6:15 zilti: tsdh: Yes, but a solution to that isn't that trivial... Maybe you'd have to look which other chunk is the longest and "cut" it... But it definitely will slow it down if you run the processing of two chunks on one core

6:16 because of the swapping

6:18 tsdh: zilti: I don't intend to activate more workers than I have cores. I just want to have enough chunks so that workers finishing early may pick up another one.

6:19 zilti: tsdh: Oh I see.

7:01 dbushenko: how is android support in clojure 1.3?

7:41 Fossi: dbushenko: i guess the same as before

7:41 dbushenko: :-)

7:42 Fossi: the bigger problem back then was clojure support for android

7:42 ie functional languages that create loads of objects

7:42 but i only tried the last time before the bigger garbage collection and jit improvements

7:43 maybe also creating a 3d game in clojure wasn't such a great idea ;)

7:44 as even java struggles a lot with garbage collection in that area

7:44 basically the evengalist said: NEVER give the gc a chance to run, except inbetween levels :>

7:59 rabbler: I totally forgot the name of the unix tool to use instead of JLine… Can anyone remind me? Man, leave for vacation for a couple weeks and you forget a lot of stuff.

7:59 ejackson: emacs ?

7:59 :P

8:00 rabbler: no. command line stuff. I'm not an emacs person, I've given up on that one for quite a while.

8:00 clgv: rabbler: try rlwrap

8:00 rabbler: that's it!

8:00 thanks!

8:00 clgv: rabbler: see the clojure wikibook for an advanced setup

8:01 rabbler: And yeah, that's the site I was at before. It's all comin' back.

8:01 2 Clojure-Conj, 2 years and I still haven't done any dev with Clojure. Kick me.

8:19 * tsdh kicks rabbler

8:20 tsdh: rabbler: Was that ok?

8:20 ejackson: tsdh: I was gonna too, but it seemed rude to add injury to insult

8:21 tsdh: :-)

8:24 rabbler: Heh, yeah.

8:24 Been trying. I'm in my java, objective-c world.

8:24 I want to dump the Java as much as possible. Can't really dump the Obj-C though.

8:25 AWizzArd: Emacs 24 with Slime under Windows: I have problems with german umlauts. For example (println (char 252)) ==> Debugger entered--Lisp error: (end-of-file) byte-code("\302\30\"\210\303\304\"\210\300\30\"\207" [error process debug slime-net-close t "net-read error: %S"] 3) see http://paste.lisp.org/display/126859 for the full output.

8:25 Ideas?

8:26 I can not continue to work. I first have to M-x slime-disconnect and then M-x slime-connect RET RET again.

8:42 solussd: where did clojure.contrib.io go?

8:42 AWizzArd: solussd: try clojure.java.io

8:42 solussd: thanks

8:57 TimMc: ~where did contrib go?

8:57 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

8:57 TimMc: solussd: ^

8:57 That's as complete a list as you'll find.

8:57 solussd: thanks- I've been looking for that.

9:11 ejackson: what do I need to be able to refer to a protocol from another namespace ?

9:16 TimMc: ejackson: You should be able to just require/use it, yeah?

9:16 Unless there's also something to import. Does a protocol create a Java interface?

9:17 ejackson: i know you have to import records, and thats working

9:17 unsure about protocols

9:20 mcrittenden: would someone mind giving me a hint on http://www.4clojure.com/problem/23 ? I got here https://gist.github.com/1560238 but it throws an error and I just realized conj doesn't always add to the beginning anyway

9:20 ejackson: its weird, I can extend my type, it finds the protocol in the other namespace, but then when I try to use it, it says there's no implementation

9:21 rabbler: mcrittenden: conj will add to the tail on vectors and the head on lists.

9:21 mcrittenden: rabbler right, so I feel like conj must not be the right solution here

9:22 rabbler: if you want it at the head, all the time, you can use cons.

9:22 but, that is not efficient on vectors… but, again, if you want it, you have it.

9:23 ejackson: aaah, I see, when you call the method from the other namespace, you need to fully qualify it (using :require not :use for that namespace)

9:25 mcrittenden: hmm ok so now it's just an issue of debugging the error. thanks

9:25 rabbler: I'm not very concerned with efficiency on a puzzle like this

9:26 rabbler: mcrittenden, I understand. Just throwing it out there.

9:26 mcrittenden: rabbler: oh sure thing, I appreciate the tip for sure

9:26 rabbler: I've only done 70 problems on 4clojure so far.

9:27 mcrittenden Really makes me feel like a moron when I am doing those problems!

9:27 mcrittenden: rabbler: haha that makes me feel better. i'm just getting started with clojure but I figured I'd at least make it past the "easy" questions without getting stumped

9:29 rabbler: mcrittenden, hint: You are trying to call a function when you do this: (coll)

9:30 mcrittenden: rabbler: that plus i had the params reversed for (cons ...). this worked: https://gist.github.com/1560282

9:31 thanks again for the help!

9:32 rabbler: mcrittenden: cool.

9:51 clgv: mcrittenden: you can have that shorter with one reduce only ;)

9:52 mcrittenden: clgv how do you mean?

9:52 clgv: you might have a look at my solution overthere ;)

9:53 mcrittenden: clgv whoa, interesting

9:54 amalloy's solution is just: into()

9:54 into ()

9:54 weird stuff

9:54 clgv: mcrittenden: in fact I could skip the anonymous function for a better golf score

9:54 mcrittenden: lol yeah, I didnt know the into was implemented like that at this time ;)

10:07 minikomi: hi there

10:10 I'm working through 4clojure .. I keep using loop/recur eg. https://gist.github.com/1560424

10:12 clgv: minikomi: you could do that very concise the lazy way as well.

10:12 minikomi: oh? do you mind editing the gist to give me nudge in the right direction?

10:12 koeien: i used a solution that iterates the function fn [[x y]] [y (+ x y)]

10:13 minikomi: haven't wrapped my head around laziness yet

10:13 clgv: minikomi: did you solve it already?

10:13 minikomi: well, that gist was my solution and it gave me all green

10:14 clgv: minikomi: the you can just "follow" me (click at the users list) to see my solutions.

10:14 minikomi: ok, no problem

10:14 same user name ?

10:14 clgv: yes

10:16 minikomi: hmm. will have a play with it in the REPL. Thanks!

10:18 clgv: minikomi: if the problem has something sequency then there is a chance the lazy way (map&co, lazy-seq) is the best choice

10:18 koeien: lazy-seq automatically interleaves the computation?

10:18 even if i use a tail-recursive function?

10:19 minikomi: thanks.

10:20 clgv: koeien: with lazy-seq you can return the "current" seq element and do the a <- b, b <- a+b switch in the function call that is used for the next seq element

10:20 minikomi: map / reduce I have some bearing of coming from ruby, but i often fall back on loops when I get stuck

10:20 koeien: clgv: i'll play around with it, i come from haskell so it's a bit confusing to see what's strict and what's lazy

10:21 clgv: koeien: only seqs are lazy ;)

10:27 zilti_: Is there a page which lists the contents of *request* from Ring?

10:29 bsteuber: any cljs experts here? I got similar problems to http://groups.google.com/group/clojure/msg/13048df8108e3f64

10:30 only :optimizations nil works for me

10:46 flashingpumpkin: hey guys. I'm curious if someone went to the lengths to port penumbra to clojure 1.3. I can't really find something on the list and github doesn't look like it too.

10:48 it's making use of a lot of contrib packages - I guess refactoring that is the biggest hurdle, non?

11:26 Kvaks: Newb-question here: I want to use a str-utils function, and have added 'org.clojure/clojure-contrib "1.2.0"' to dependencies and run 'lein deps'. The contrib jar gets downloaded to lib/ and I can see some contrib-stuff in the repl, but no str-utils. Any idea what I'm doing wrong? (I'm using emacs/slime/swank/leiningen.)

11:27 zilti_: ~where did contrib go?

11:27 ~where did contrib go?

11:27 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

11:28 Kvaks: Thanks, I'll look at that.

11:33 Raynes: Kvaks: What function from str-utils do you want?

11:34 The old Clojure Contrib was deprecated in favor of splitting the libraries into individual libraries, so you don't want to use clojure contrib like that anymore. However, str-utils was deprecated long before that. There is a new namespace built into Clojure with most of the things from the old string utility libraries. clojure.string. Chances are what you want is there.

11:37 Kvaks: Raynes: I'm realizing that the book/tutorial I'm reading is slightly outdated, yes. :-)

11:42 wingie: Kvaks: what bootk ar you reading?

11:43 im reading "Programming Clojure" from 2009 and I can't include the re-split

11:43 Kvaks: wingie: Same book here.

11:44 wingie: Kvaks: what page are you at?

11:44 we can do "pair learning"

11:44 :)

11:44 Kvaks: Hehe. :)

11:44 Page 50-60.

11:46 wingie: im at 65 =)

11:47 solussd: are there clojure conj videos from this year?

11:48 Bronsa: not yet AFAIK

11:48 wingie: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

11:48 why doesn't (require 'clojure.string) works?

11:48 as in the example

11:50 oh it works now .. i messed up my repl and had to restart it

11:53 are there times you are using java libs from clojure?

11:53 and what kind of libs/classes are you using then?

11:55 jodaro: wingie: are you asking in general?

11:55 wingie: yeah

11:56 wanna know what kind of java code i would wanna use

11:56 cgray: there's lots and lots of java code out there... it's kind of a hard question to answer

11:56 jodaro: yeah, depends on what you are trying to do

11:57 but if you happen to have a problem that is already solved by some java library or framework

11:57 often you can either use it directly or write a thin clojure wrapper over it

11:57 thats one of the main strengths of the language

11:57 you don

11:57 't have to start from scratch

11:58 (though sometimes its more fun to)

11:59 wingie: jodaro: could you give me some examples of java code that are good to use

11:59 cgray: really stateful java can be tough to use, and I've seen some java that calls System.exit() on error, which is obviously pretty bad

11:59 wingie: if someone asked me why coffeescript is js compatible i would for example say now you can use ExtJS, Sproutcore, Underscore, Mocha, Vowsjs and some other js libs

12:00 zilti: clojurescript!

12:00 wingie: cgray: seems not that beautiful to use java from clojure

12:01 zilti: wingie: It's as beautiful as possible

12:01 imo

12:01 wingie: perhaps another strength is that it could be run in jvm

12:01 jodaro: i think you get used to it

12:01 joly: I've seen Clojure code using Swing, logging frameworks, etc. Most Java libraries should be usable from Clojure.

12:01 wingie: so performance boosts in jvm to speed up other langs would benefit clojure as well

12:01 jodaro: and like i said, you can always wrap your java usage up and put it in a dark corner of the codebase

12:01 so no one has to see/smell it

12:02 wingie: yeah

12:02 wrap it up!

12:05 koeien: i would like to parse a file format in clojure. what is the recommended way / library of doing this?

12:06 TimMc: koeien: Binary format?

12:06 koeien: no, text-based

12:06 use ANTLR and java bindings? or is there a reasonably efficient port of Parsec?

12:07 TimMc: OK, there are several parsing libs out there. fnparse and parsley come to mind, although you'll have to check on their maturity/maintenance activity.

12:07 zilti: There is a jparsec

12:10 koeien: thank you for your pointers.

12:13 wingie: a var is a global variable with a value. a var is bound to a symbol to access it's value?

12:14 please confirm that

12:14 a local is a local variable. just like the above one but just for a local scope?

12:19 vivekn: Hi, is there any good VoIP library for clojure? I want to implement audio conferencing between multiple clients.

12:20 pbuckley: wingie: I think you have that right, but I'm far from an expert

12:21 rabbler: wingie: Just to clarify locals aren't 'variables'. They cannot change.

12:21 but you can change a def.

12:23 zilti_: vivekn: You'll have to use a java library

12:23 vivekn: oh,do you have any suggestions?

12:24 pbuckley: rabbler: but you can re-use and change the value of a local within a let binding, correct?

12:25 ,(let [f (+ 3 4)

12:25 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

12:25 rabbler: That doesn't change the value. The value cannot change in that scope.

12:25 pbuckley: ,(let [f (+ 3 4) f (+ f 5)] (println f))

12:25 rabbler: So, you set the value. But you cannot alter it.

12:25 clojurebot: 12

12:25 pbuckley: I can set it multiple times, referring to the old one

12:25 Raynes: It looks like change, but in reality you're just creating a new thing.

12:25 pbuckley: right, but I'm always referring to the newest thing

12:26 the old thing can't be referred to once the new thing is there

12:26 Raynes: So?

12:26 zilti_: vivekn: No, I'm sorry.

12:26 pbuckley: so it looks like it changed

12:26 Raynes: That's because you can't refer to two things by the same name in the same scope.

12:26 wingie: rabbler: right

12:27 pbuckley: it just seems like meaningless semantics in the context of setting a symbol to a new value in the same let binding

12:27 for all intents and purposes, the value the symbol points to, "has changed"

12:28 wingie: isn't it true for a var too? you are just setting a new value and it's unchanged?

12:28 pbuckley: even though under the covers where you can't access anything, it hasn't actually "changed"

12:28 wingie: I think so

12:28 jcrossley3: what's the recommended clojure library for rabbitmq? google's telling me to use the java one.

12:28 wingie: but why is it called variable then?

12:28 if it cannot change

12:28 since someone said local can't be changed, i assumed that a variable is changeable then

12:28 antares_: jcrossley3: I am obviously biased but https://github.com/michaelklishin/langohr is probably by the fast best right now

12:29 rabbler: wingie: its not called a variable. It's called a local. It's a val, not a var.

12:29 pbuckley: rabbler: he's asking about vars now, set with def

12:29 antares_: jcrossley3: "the best" as in, feature-complete, well maintained, developed by someone who has been using rabbitmq for 3 years

12:29 Raynes: rabbler: He isn't talking about locals.

12:29 pbuckley: like, why are they called vars, if they can't change

12:29 rabbler: sorry.

12:29 heh.

12:30 wingie: np

12:30 anyone knows the answer for that one?

12:30 Raynes: http://clojure.org/vars

12:31 A var is mutable. You change it *in place*. You don't create a new one.

12:31 jcrossley3: antares_: thanks. do you think that's the one most people use?

12:32 antares_: jcrossley3: there is no single Clojure client that most people use

12:32 zilti_: ,(.split "Hello World" " ")

12:32 clojurebot: #<String[] [Ljava.lang.String;@171c6d6>

12:32 zilti_: huh

12:32 pbuckley: Raynes: so if the locals aren't mutable, when I set "f" twice in a let binding, I'm taking up two slots in memory, is that the impact?

12:32 antares_: jcrossley3: and as congomongo demonstrates, what most people use can actually be quite crappy :)

12:32 zilti_: ,(println (.split "Hello World" " "))

12:32 clojurebot: #<String[] [Ljava.lang.String;@1add89d>

12:33 Raynes: zilti_: That's a Java array. You can work with it like a normal seqable object. If you want to look at it in a pretty way in the REPL, you can do ##(seq (.split "Hello, World!" " "))

12:33 lazybot: ⇒ ("Hello," "World!")

12:33 antares_: zilti_: maybe use (vec …)

12:33 zilti_: What am I doing wrong? All I know is that I did it right five minutes ago

12:33 cgray: ,(clojure.string/split "Hello world" #" ")

12:33 jcrossley3: antares_: ha! is it fair to say most people use the java client directly from clojure? (just based on what google tells me)

12:33 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>

12:33 cgray: ,(require 'clojure.string)

12:33 clojurebot: nil

12:33 cgray: ,(clojure.string/split "Hello world" #" ")

12:33 clojurebot: ["Hello" "world"]

12:34 Raynes: pbuckley: I imagine the old value would be garbage collected, since it isn't used anymore after you've created the new binding.

12:34 pbuckley: Raynes: thanks

12:34 Raynes: But I'm not the one to talk to about memory semantics.

12:34 antares_: jcrossley3: many people do and langohr is actually a really small library that makes that easier. It very much follows Java client API conventions and AMQP model in general (http://rubyamqp.info/articles/amqp_9_1_model_explained/)

12:35 jcrossley3: but the fact of the matter is, there is a dozen of incomplete rabbitmq clients that seemingly were developed by people who did not understand AMQP 0.9.1 very well, so they invented all kinds of weird APIs and terminology that confuses everyone on the mailing list

12:36 jcrossley3: antares_: understood. thanks for the perspective!

12:36 Vinzent: Hi. Why this line of code (-> url (client/get {:as :byte-array}) :body ByteArrayInputStream. xml/parse) doesn't work? client is clj-http.client and xml is clojure.xml. With standard parser it just hangs forever

12:37 Raynes: pbuckley: I mean, there is a meaningful difference here. You have a value bound to x. You create a new value and bind it to x. This value is completely independent of the old value of x, but there can't be two of them so the newer one shadows the first one, simulating change. You can't (set! x "newval") or anything like that. You can't loop over it and change it in place (unless it is bound to something mutable like a ref, atom, etc)

12:37 for example.

12:37 zilti: Oh I love broken routers

12:40 pbuckley: Raynes: I think I get it - there is meaningful difference beyond the semantics, but in my limited time using clojure, I haven't needed to go beyond simulating change, and so the semantic difference is my "childish" understanding at this point

12:40 antares_: jcrossley3: if you decide to use langohr, I am in #rabbitmq to answer your questions

12:45 wingie: what are the use cases for threading?

12:47 i wanna know when i benefit from using clojure (support for multi threading) instead of node.js (single threaded) as backend server for my web app

12:49 licenser: wingie: node.js is no fun (my 2 cent) closures biggest benefit is that you write lisp instead of JS

12:50 zilti: Ok so what's the recommended way of splitting a string, since (.split "Hello World" " ") doesn't work correctly (even if it should)?

12:50 wingie: the weakest point of js is also the strongest

12:50 Raynes: zilti: That works fine.

12:50 zilti: Why do you think it isn't working?

12:50 licenser: wingie: horrible variable scoping?

12:50 zilti: ,(println (.split "Hello World" " "))

12:50 wingie: using node.js i am using js full stack

12:50 clojurebot: #<String[] [Ljava.lang.String;@4fe2b3>

12:50 cgray: ,(clojure.string/split "Hello world" #" ")

12:50 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>

12:50 cgray: ,(require 'clojure.string)

12:50 clojurebot: nil

12:50 cgray: ,(clojure.string/split "Hello world" #" ")

12:50 clojurebot: ["Hello" "world"]

12:50 Raynes: zilti: It is a Java method. It returns a Java array. There is nothing wrong with that.

12:50 licenser: wingie: with noir and noir-cljs you can too with clojure :)

12:50 wingie: but that was not the question .. how do i benefit from multithreading?

12:50 licenser: which is pretty amazing

12:51 wingie: in a web server

12:51 zilti: Used inside Java, String.split doesn't return an _array_

12:51 technomancy: clojurebot: same language on client and server?

12:51 clojurebot: No entiendo

12:51 licenser: wingie: if you run only one instance of node.js and it really only runs 1 thread you benefit hugely

12:51 but I am not a expert on node.js's inner workings

12:51 more threads mean more core can in parallel answer more requests

12:51 technomancy: clojurebot: using the same language on the client and server is not a big deal: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/

12:51 clojurebot: In Ordnung

12:51 licenser: it is a no tradeoff scaling

12:51 Raynes: zilti: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#split(java.lang.String)

12:52 TimMc: zilti: It absolutely does.

12:52 Raynes: zilti: You're splitting a string. You need a collection of the split pieces. That's what you've got. The problem is that you're trying to print a Java object, but it doesn't look the way you expect it to because it is a Java object. If you want to look at it in the Clojure seqy way, call seq on the result. In practice, unless you plan on printing it for some reason, you don't need to.

12:52 &(first (.split "Hello, World" " "))

12:53 lazybot: ⇒ "Hello,"

12:53 licenser: but wingie I would imagine that node.js will spawn multiple acceptors for your cores right?

12:53 Raynes: &(seq (.split "Hello, World" " "))

12:53 lazybot: ⇒ ("Hello," "World")

12:53 Raynes: It is doing exactly what you want.

12:53 cgray: Raynes: what's wrong with clojure.string/split ?

12:53 * zilti 's head meets his table

12:54 TimMc: &(apply str (interpose " " (.split "Hello, world!" " ")))

12:54 lazybot: ⇒ "Hello, world!"

12:54 Raynes: cgray: It is utterly unnecessary.

12:54 zilti: That's what happens if you haven't programmed for two months

12:54 licenser: Raynes: i disagree

12:54 I find calling object functions the last resort

12:55 Raynes: There is nothing wrong with it if you already have clojure.string imported or have some other reason for using it, but there is no good reason to use it over .split in this case.

12:55 Especially in this case, since he didn't understand what was going on. clojure.string dances around the problem.

12:56 wingie: technomancy: that author just knows nothing about it

12:56 "I’ve used it a little"

12:56 it seems like that

12:56 Raynes: Didn't you recently point out that you are new to programming?

12:57 wingie: but i have used node.js pretty long

12:57 and am building a serious web app with it .. i just hate posts when people write since they are biased

12:57 licenser: wingie: will node js spawn multiple 'workers' for all of your cores?

12:57 TimMc: zilti: Haha, sorry to jump on you.

12:57 technomancy: he has a really good point that the difficulty is not in learning a new language, it's in learning a new runtime.

12:57 wingie: licenser: chill im not tryng to start a war

12:57 but we can all be more objective

12:57 licenser: wingie: no I am seriously curios

12:57 technomancy: I know Clojure backwards and forwards, but I can't do crap in ClojureScript because I don't know anything about the browser or node.

12:58 mcrittenden: wingie what's a situation where it's useful to use the same language client-side and server-side? curiousity question

12:58 licenser: I don't know the answer hence me asking :)

12:58 wingie: licenser: no it wont

12:58 or

12:58 TimMc: mcrittenden: It's fantastic for enforcing input constraints.

12:58 technomancy: whereas even though I didn't know Mirah at all, it was super-easy for me to code up a couple apps in it since I knew the JVM already.

12:58 wingie: js is single threaded .. so i guess its not the same as using clojure

12:58 licenser: I see but the benefit you get from clojure is that you get this kind of scaling for free instead of needing to do it by hand

12:58 TimMc: mcrittenden: Ever run into a site that had different notions of how a credit card field should be formatted in its server and client code?

12:59 wingie: but what i reacted on that post was that he just said "it won't help you" .. it _really_ helps you to share code

12:59 licenser: wingie: for 95% of all web apps the app itself is single threaded more threads only mean more req/s but spawning more servers does the same more or less (plus some memory overhead)

12:59 mcrittenden: TimMc usually in that case you use a jquery form validation lib with a custom vali rule client-side, and that doesn't help you much server-side, no?

12:59 wingie: and obviosuly he doesnt know how/why to share code

12:59 technomancy: TimMc: the article makes a really good point about how server-side validation is all about security and enforcing a formal model, while client-side validation is purely a UX concern

13:00 the overlap is superficial

13:00 TimMc: mcrittenden: The problem is keeping the two consistent so you don't piss off your users.

13:00 making it easy to be correct, not just possible.

13:01 wingie: mcrittenden: same general libs that don't care about server or client side envs eg underscore and sugarjs .. those don't have to be changed at all since they are pure functions

13:01 technomancy: if you want to talk about validation, we already have the same language running client-side and server side: regular expressions.

13:02 wingie: then there are libs that have same code base but behave differently .. eg. testing suites like mocha

13:02 mcrittenden: wingie: you've been in a situation where it was useful to use those libs both client-side and server-side?

13:02 TimMc: technomancy: "Sorry, your field did not match the regex. Please try again."

13:02 wingie: in node.js you run the tests in cli .. in browser it uses the dom .. but the testing code is the same .. means reusablility

13:02 TimMc: and they're still dual-homed.

13:02 technomancy: TimMc: did you read the article? the purpose of server-side validation is totally different from client-side

13:03 wingie: mcrittenden: yeah .. im using underscore on client and server

13:03 TimMc: technomancy: Yes, I've read the article, and I think that point is misleading.

13:03 mcrittenden: wingie: interesting. not open source by any chance is it?

13:03 TimMc: technomancy: Server requirements trickle down to the client and need to be communicated.

13:03 Raynes: I <3 validation. I remember trying to get a redbox kiosk to accept my raynes.me email address. Apparently it doesn't understand those kinds of emails.

13:04 wingie: one unconvenient way was to serve a js file to browser and then npm install it for node.js

13:04 but a trend is now to use browserify

13:04 you npm install it..and it will be used on both browser and server .. no more file split

13:04 technomancy: "this field needs to match this pattern" is data, you don't need to share a turing-complete language to share it.

13:05 wingie: you update it with npm and the browser will get the new version too

13:05 TimMc: technomancy: Your grandparents are gonna have a fun time using your websites.

13:05 wingie: technomancy: yeah i agree on reg exps

13:05 keep it simple is good

13:05 but there are more

13:05 benefits from sharing the same lang

13:05 licenser: TimMc: I don't think his grandparents will know the internet as we know it

13:05 wingie: another is that you can move forward fast

13:06 TimMc: "Your username did not match /[a-z0-9_-]{3,20}/i, please try again."

13:06 zilti: npm? browserify? *confused*

13:06 wingie: eg. just remembering one lang syntax, eco system .. which gives you focus and speed .. (i know you wanna learn more langs but we are talking about dev speed for you app now)

13:06 mcrittenden: npm = node package manager, sort of like leiningen for node

13:07 wingie: and if you are hiring people you can just hire good js people

13:07 technomancy: one language, two runtimes

13:07 wingie: not having to have an add "we need js devs .. would be good if you knew clojure"

13:07 technomancy: guess which is more difficult to learn?

13:07 TimMc: complecting some topics here

13:08 zilti: technomancy: JS?

13:08 wingie: technomancy: just saying that post was not very fair at all .. a typical post i wouldn't even post in irc .. gives no value

13:08 technomancy: zilti: JS or Clojure/Clojurescript; the fact remains. it's much easier to learn a new language on the same runtime than a new runtime for the same language.

13:08 wingie: you could attack it more objectively

13:08 licenser: probably your add 'need closure devs' will spawn less but more skilled results then 'we need js devs' (not saying bad things about them but there are way more want-to-be people in the JS world I think)

13:09 wingie: eg. if clojure could be used on both ends .. would people that loved clojure say it was a bad thing?

13:09 no

13:09 TimMc: technomancy: What does "a new language on the same runtime" have to do with the price of tea in China?

13:09 * mcrittenden is a want-to-be person in the clojure world :D

13:09 licenser: wingie: it can ^^ look at clojurescript

13:09 wingie: if you don't like js then its better to just say js sucks and i dont want to work with it .. but don't attack the benefits of using the same lang on both ends

13:09 its powerful and saves time

13:10 zilti: technomancy: I'd say it's harder to switch from one programming paradigm to another

13:10 TimMc: I don't know what you;re trying to compare.

13:11 wingie: licenser: yeah yyou are right .. that is a good thing about clojure .. but there are kick ass devs using node.js too

13:12 licenser: im doing a serious web app with extjs and sproutcore .. need to use js for it

13:12 licenser: wingie: don't say they aren't but there is a bigger pool of people meaning also a wider spread, clojure is pretty esoteric compared to JS, and that in my experience attracts the upper scale of devs (or the crazy ones :P)

13:13 wingie: yeah i agree

13:13 why im here =)

13:13 licenser: ^^ crazy? :P

13:13 just kidding mate

13:13 wingie: just saying node.js/browser is a good fit .. but that's that

13:14 licenser: I personally aint' a big fan of javascript, I find it ends up in a mess most of a time but hey that just as well can be my lack of experience

13:14 fortunately I found my way out of the mess ^^

13:15 wingie: its solid to say clojure > js

13:15 licenser: I won't go so far I'd say for me clojure > js

13:15 wingie: nah it is

13:16 js was created in 10 days

13:16 just to give more flashy experience

13:16 TimMc: Created under a marketing deadline. Bad news.

13:16 mcrittenden: ad hominem!

13:16 licenser: I've seen people do amazing things with js, so one situation where my dislike for js was solidified was when a friend of me showed me some of his code and was all like 'look how beautiful and pure this code is' and I was close to vomiting, I still don't understand all of it since it is so spagetified

13:16 TimMc: Not terrible for what it is, though.

13:17 wingie: yeah .. people need to learn proper programming before writing big apps

13:17 (me)

13:18 talking about langs are okay but saying same lang on both ends is bad just because you dont like js is chilidsh

13:18 mcrittenden: anyone feel like giving me a hint on http://www.4clojure.com/problem/52 ? specifically, I don't understand what that let is doing, with the (range) in there

13:18 technomancy: wingie: I'm not saying it's unique to JS

13:18 licenser: today I tried to help a colleague with a bit of JS for a web fronted he used jQuery and was generating a table that was like 50 rows with combo boxes in each row and some stuff and it took between 1 and 0.5s to build that

13:18 it really shocked me

13:18 technomancy: I'm saying the same thing applies to clojure/clojurescript

13:18 cgray: for me, the worst thing about the linked article is how general it is. since he's talking about js, everyone assumes client means browser and server means web server, but imagine if client meant ssh client and server meant ssh server. why on earth would you not want to write both of them in the same language?

13:19 wingie: technomancy: yeah its not ideal .. yet

13:19 some problems before in node.js/browser land is now slowly going away

13:19 TimMc: I mostly agree with technomancy's broader point: A language is designed for a runtiome, and the same code may not be sane for both runtimes at the same time.

13:19 technomancy: that doesn't mean clojurescript is useless; it's not just some magic code-sharing dust you can sprinkle on your app to not have to think differently in different contexts

13:19 licenser: clojurescripts biggest downside is the complexity to get it to work properly

13:19 wingie: its still very new

13:19 licenser: but that was the same with clojure before technomancy laied his hands on it and created lein ;P

13:19 TimMc: but there's no reason a validation lib cannot be transpiled for great benefit.

13:19 licenser: technomancy: I want leinjs

13:20 clj_newb: I have a dream. I have a dream that one day, my Clojure code will be judged by what it's meant to do, not on whether the platform it runs on is Java or JavaScript.

13:21 TimMc: clj_newb: JVM, you mean. Clojure doesn't run on Java.

13:21 hroarke: mcrittenden: the range constructs an infinite (lazy) sequence of integers. destructuring in the let takes that sequence apart into elements.

13:22 technomancy: it's funny that the directory in the clojure repository that contains the .java source files is called src/jvm.

13:22 and then we complain about people not understanding the distinction. =)

13:22 TimMc: indeed

13:22 technomancy: Maybe that was from back when the .NET project was a bigger goal?

13:23 technomancy: must have been

13:23 clj_newb: I have a dream. I have a dream that one day, when Clojure programmers are writing Clojure code, they ask "what is this code menat to do" rather than "does this code run on the JVM or V8." <-- there we go, does this work?

13:23 TimMc: much better :-)

13:24 mcrittenden: hroarke: so a is 0 and b is 1, etc?

13:24 TimMc: although there may be some quibbling with your dream itself.

13:24 hroarke: mcrittenden: Yep

13:25 wingie: i have a dream

13:25 TimMc: &(let [[[a b] c] [[1 2] 3]] [a b c])

13:25 lazybot: ⇒ [1 2 3]

13:25 wingie: that one day we don't need to have js only in browser

13:25 doesn't java plugin come along with all browsers?

13:26 or do you have to install it manually?

13:26 clj_newb: didn't sun write abrowser back in the day? why did it fail?

13:26 TimMc: wingie: Wake up, we're there.

13:26 licenser: wingie: TimMc is right there are clojurescript (named firced cause it matches the channel name partially :P), coffee script and probably others

13:27 wingie: licenser: but its compiled all down to js

13:27 licenser: so that isn't a big issue for me

13:27 wingie: is java plugin installed on all browser by default?

13:27 licenser: nope

13:27 wingie: wouldn't that be nice?

13:27 zilti: wingie: It's still supplied with most PCs when you buy one

13:28 wingie: if jvm was installed on all browsers you could run clojure!

13:28 RickInGA: Google is working on building a sandbox for native code in a browser (C++ I assume), but Mozilla has said they won't support it.

13:28 Raynes: Applets are so 2002.

13:28 zilti: Next-gen-Applets are so 2012

13:28 pandeiro: Don't forget about Dart

13:28 wingie: no no no

13:28 i have a dream...

13:28 TimMc: wingie: I misunderstood you, I thought you were annoyed that JS was limited to the browser, not that the browser be limited to JS.

13:28 grammar fail, too much lag

13:28 zilti: RickInGA: Yes, because it's stupid. Then you need to supply a version for ARM and one for x86 or what?

13:29 licenser: wingie: I don't think it would, java is a huge beast compared to js I think

13:29 gf3: hey guys, so I have a function that should optionally take some sort of configuration, is it better to explicitly pass in a config map, or have some sort of global dynamic map?

13:29 wingie: ...i wished that the web we see it today (web browsers) disappeared and apps (as client) took over

13:30 having watched a Steve Jobs interview I feel that is the future we don't see it quite yet

13:30 but its evolving .. and computers like Asus Transformer Prime is one big step towards that

13:30 TimMc: gf3: It kind of depends on how many levels that option map would have to be passed through, and whether binding is appropriate.

13:31 zilti: wingie: Since the next Windows will have an app store we might get one step closer to that one (simplifying application installation)

13:31 wingie: iPhone/Android phones -> iPad/Android tablets -> computers like Transformer

13:31 zilti: Unfortunately technologies like Web Start have pretty much failed for consumers

13:32 licenser: zilti: for the reason that it is hugely complicated

13:32 wingie: Steve Jobs believed in the future laptops and desktops will be really rare and the mainstream will be computers like Transformer with "app" OSes

13:32 licenser: also the advantage of web apps is that they pretty much run everywhere

13:32 zilti: Is it? I don't think so. It's dead-easy

13:32 gf3: TimMc: 2 or 3 levels, I'll be using the data for translating request URIs to file paths

13:32 pandeiro: Raynes: is there any way I can inspect the noir errors map while my app is running? Relatedly can the app be run from and interacted with from the REPL?

13:32 zilti: click link -> get app

13:32 not even the need to launch an "app store" or whatever

13:33 And automatic updates on each launch

13:33 licenser: zilti: you have worked often with them? I have to deal with some of the buggers at work and it is always a pain

13:33 zilti: Web Start? What's the pain with it? All you basically need is an XML file

13:33 licenser: then they don't like the old IE we have to use, or don't run at all on the linux we have on other hosts

13:33 or the XML isn't correctly linked to the java thingy

13:33 pbuckley: wingie: have you read that article about why apps can't replace the web, because they don't have a standard for linking? (i.e. HTML?) - seemed convincing to me that the browser and web pages are still superior to a bunch of disconnected and mostly impossible/improbable to connect apps

13:33 Raynes: gf3: As in the validation *errors* map?

13:34 pandeiro: Raynes: yessir

13:34 licenser: zilti: might be that I had a particularly nasty combination of enviromentatl conditions but I only have bad experiences

13:34 zilti: I never had problems, especially not since they provide that js library for launching webstart and applets

13:34 Raynes: gf3: That var is only ever bound inside of requests. As such, the code looking at it has to be underneath a defpage (you know, a route).

13:34 wingie: pbuckley: they could link in another way like with JSON sent to another app

13:34 Raynes: Outside of requests, it isn't bound at all.

13:35 TimMc: Raynes: You mean pandeiro

13:35 wingie: and it will give you what you wanted to check out

13:35 Raynes: Yeah, I do.

13:35 TimMc: I'm sitting like 6 feet away from my monitor. :p

13:35 pandeiro: Raynes: I see, and what about the general case of somehow interacting with the app through the REPL? Not possible, right?

13:35 (Sorry to make you squint)

13:35 Raynes: :p

13:35 pbuckley: wingie: they could, but that would take effort and standardization, and we already have the web which does a good enough job and which is improving with HTML5 etc

13:35 pandeiro: I CAN USE ALL CAPS IF YOU LIKE :-P

13:35 gf3: Raynes: no, I actually don't touch the req/resp

13:36 Raynes: I just use the URI to do some other work

13:36 Raynes: pandeiro: You can run the whole thing in the repl and interact with it if you want.

13:36 wingie: so i guess that would be a platform standard .. eg. iOS would say .. you can open another app by doing X Y Z

13:36 Raynes: pandeiro: Just run the server inside of a repl session.

13:36 wingie: and imo way better than web standards .. takes an eternity to imeplement

13:37 pandeiro: Raynes: just by calling the app.server/main fn, yes?

13:37 wingie: look at from "iPhone to Tablets" evolution

13:37 Raynes: gf3: I was actually responding to pandeiro. I got a bit confused for a moment there.

13:37 pandeiro: Yep.

13:37 gf3: Raynes: haha, no worries

13:37 TimMc: gf3: Go for dynamic, I guess. Just beware of lazy seqs yo ucreate in that scope!

13:37 wingie: just a couple of years it has gained popularity from 0 .. the speed is enourmous

13:37 pbuckley: right, but the web standards are already here - not that it couldn't be done, it just would take a bunch of work to make happen

13:37 sure, tablets are cheap toys, of course they sell well

13:37 gf3: TimMc: thank you

13:38 pbuckley: but if anything, they're becoming less standardized as they increase in popularity

13:38 TimMc: pbuckley: Cheap toys? In my day, all we had was a squireel and a stick, and we had to *buy* the stick ourselves!

13:38 pbuckley: TimMc: LOL :-)

13:38 pandeiro: I think I am confusing things by moving the valid? functions for my data to the models... I see Chris has them in the views... I am still trying to grasp the separation of concerns

13:38 zilti: lol

13:38 licenser: TimMc: but they were quality squirrels!

13:38 wingie: pbuckley: yeah of course its here .. (almost) but Steve Jobs noticed on mobile phones people are actually using apps more than browser .. it just fits better and gives a smoother experience

13:39 TimMc: damn straight

13:39 pandeiro: like where would data processing/mapping happen, in the view or the model?

13:39 licenser: that were better times *sigh*

13:39 wingie: we use facebook.. twitter etc .. very specific about what we wanna use

13:39 zilti: wingie: But mostly, those "apps" are just embedded browsers

13:39 licenser: they were no cheep china squirrels like you get today ...

13:39 TimMc: These modern squirrels fall apart if you so much as look at them.

13:39 wingie: that will come into the mainstream computers one day .. then JS wouldn't have that much of monopoly

13:39 solussd: are type hints supported for return values now? I don't see it documented on clojure.org (that site needs some serious updating)

13:39 wingie: or importance compared to today .. which will make me happy =)

13:40 zilti: yeah they are hacks right now

13:40 phonegap etc

13:40 solussd: e.g. (defn ^Type blah [arg] thingOfType)

13:40 cgray: solussd: yes, type hints are supported for return values

13:40 licenser: wingie: but the apps were pre fared because they were more tailored to the over all user experience of the device

13:40 if you just plug the same apps on a windows phone 7 device they probably wouldn't be enjoyed that much

13:41 wingie: licenser: yeah .. the user experience will get better .. but i think it has already opened users mind about how you do things

13:41 licenser: wingie: I agree that apps are the better way if they are 1) portable and 2) provide a native user experience on all platforms

13:42 it starts that AquaMacs on OS X behaves horribly different from Emacs on windows or console-emacs on linux

13:42 the same app but I feel like they are three entirely different ones

13:43 technomancy: aquamacs is a fork

13:43 wingie: like Steve Jobs believed .. i believe too .. the user experience in computers we know today (dekstop/laptops) will be dinousaurs maybe in 10 years .. just like the floppy disks .. just a possibility nice to have in mind if you are a developer (so it can guide you through your choices)

13:43 technomancy: it shouldn't be surprising that it behaves differently; it's just like how firefox behaves differently from the Mozilla suite.

13:44 wingie: perhaps it will not longer be about web sites .. but apps!

13:44 TimMc: Oh man, is that still around?

13:44 technomancy: probably not; I had a hard time picking an analogy. =\

13:44 licenser: wingie: or it might be all about web apps but no apps any more :P

13:45 wingie: licenser: impossible

13:45 licenser: not at all

13:45 wingie: we are actually heading the other direction

13:45 arent we?

13:46 people mimich apps using web

13:46 licenser: I think we are currently more heading into the web apps direction

13:46 wingie: yes

13:46 because its just a mimick

13:46 eg. Sproutcore has already begun a cool project

13:46 licenser: doesn't mean that if someone comes up with a good solution for apps

13:46 it won't change

13:46 pandeiro: did fogus ever release any results of his survey on Clojure users?

13:46 wingie: you write once and its deployed in all platforms .. web is just one of them .. just another platform

13:47 not "the one"

13:47 iOS, Android, Web .. its 3 different platforms

13:47 that is how they think of it

13:48 zilti: And they think: "Let's make it for the web, so it runs on every device and we save a lot of money"

13:49 wingie: yeah the web platform is huge .. app platforms is evolving

13:49 i personally hope app platforms will win

13:49 web wasn't meant to do these things

13:50 zilti: I hope that, too

13:50 wingie: it's a good transportation layer though

13:50 zilti: Besides I don't like the cloud that much. It's useful sometimes, but I want to control my data

13:50 wingie: so now i have another reason to learn other langs like clojure

13:51 zilti: just because your are using an app doesn't mean thats its not in the cloud

13:51 your data that is

13:51 browser is just a client for consuming things

13:51 like an app

13:51 so it would still be data in cloud (i believe that is a good model)

13:51 zilti: Yes, but usually if you have a "desktop app" you have a possibility to store the data on your device

13:51 wingie: right

13:52 offline data

13:52 thats a good solution

13:52 zilti: I rarely see this on web apps

13:52 logically

13:52 wingie: yeah its emerging

13:52 cloud9ide supports it

13:52 but i feels apps are the way to go .. ahh .. we are lucky to live in this time

13:52 so much happening

13:53 RickInGA: wingie /agree

13:53 rabbler: Anyone know if the "Clojure in Clojure" initiative is still under development? Just curious.

13:53 wingie: (and in percentage not many knows about this)

13:53 like looking into the future .. and create it today

13:53 $$$

13:54 RickInGA: I just installed clooj... when I type (+ 1 2) in the input, I get (+ 1 2) in the REPL output, was expecting 3

13:54 jodaro: Raynes figured out a way to time travel with Clojure

13:54 so we could probably do that right now

13:55 Raynes: &(clojure.string/reverse "2012")

13:55 lazybot: ⇒ "2102"

13:55 Raynes: Welcome to the future.

13:55 zilti: lol :)

13:55 RickInGA: nice

13:55 jodaro: good thing irc is still around in 2102

13:55 wingie: haha

13:55 technomancy: :dependencies [[org.clojars.docbrown/flux-capacitor "0.0.1-SNAPSHOT"]]

13:56 zilti: Too bad we can't look what's happening outside IRC in 2102 :(

13:56 jodaro: heh

13:56 crap, forgot plutonium at safeway

13:57 RickInGA: anyone using clooj 0.2.7 on windows?

13:58 zilti: Oh, Windows's still around, too?

13:58 RickInGA: heh, yeah some of us are still on legacy platforms

13:58 jodaro: huh

13:58 the future kind of sucks

13:58 bring us back, Raynes

13:59 RickInGA: I seem to have a RPL as opposed to a REPL. wondering if there is something I need to set to get my E :)

13:59 Raynes: &(clojure.string/reverse "2102")

13:59 lazybot: ⇒ "2012"

13:59 dabd: how do you call append-spit from duck-streams? when i call it with (ds/append-spit "~/tmp/out.txt" "hello") I get Can't dynamically bind non-dynamic var: clojure.contrib.duck-streams/*append-to-writer*

13:59 Raynes: You're trying to use an ancient library with a not-so-ancient version of Clojure.

14:00 You don't need duck-streams for this. http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/spit the normal spit works with an :append option.

14:00 (spit "somefile" "sometext"

14:01 dabd: ty

14:01 Raynes: Damn enter key.

14:01 Too close.

14:01 (spit "somefile" "sometext" :append true)

14:02 $examples clojure.core/spit

14:02 lazybot: https://gist.github.com/1561483

14:02 Raynes: That's right. He can do that.

14:07 cemerick: If one were to publish an example (and therefore not well-behaved) web crawler, what URL should be used as the crawl root?

14:07 I'd like to get a decent spread (i.e. dredging google isn't compelling), but I'm having a hard time coming up with a site that I don't mind quasi-DDOSing.

14:08 ibdknox: cemerick: what are you ddosing?

14:09 cemerick: ibdknox: you missed my first msg… :-)

14:09 If one were to publish an example (and therefore not well-behaved) web crawler, what URL should be used as the crawl root?

14:09 ibdknox: lol

14:10 cemerick: I am perhaps overestimating the example's reach. ;-)

14:10 ibdknox: :)

14:10 cemerick: But I figure it's better to be polite in any case.

14:10 Or, be impolite to someone that won't care.

14:11 ibdknox: amazon!

14:11 cemerick: hrm, maybe

14:11 not the best spread though…

14:11 The best thing I've come up with is BBC's news section.

14:12 ibdknox: that's not bad

14:12 cemerick: wikipedia is even better, but that feels wrong somehow

14:14 jodaro: if you donate $20 first, you might feel better about it

14:15 ibdknox: haha

14:15 zilti: lol

14:16 cemerick: What are you parsing the pages with?

14:16 ibdknox: enlive, I assume

14:16 zilti: Didn't know that's possible

14:16 cemerick: yeah, enlive

14:16 semperos: it's quite adept at it

14:16 ibdknox: it's one of its primary use cases :)

14:16 cemerick: which uses tagsoup

14:17 ibdknox: zilti: dnolen has a good tutorial on it on his github

14:17 cemerick: book example?

14:17 cemerick: yup

14:17 ibdknox: zilti: and cemerick has in his book :)

14:17 lol

14:17 cemerick: 91 lines for a pretty decent little webcrawler, with some stupid word frequency tabulation as well

14:18 zilti: The last time I had to parse HTML I tried a few libs

14:18 htmlcleaner was the only one able to parse EVERYTHIN

14:18 cemerick: never heard of it

14:18 zilti: http://htmlcleaner.sourceforge.net/

14:18 cemerick: tagsoup and stone soup have never failed me *shrug*

14:18 zilti: It's java, though. But it's small and simple IMO

14:19 cemerick: not that I do this sort of stuff much

14:19 Gah, Java? I try to say away from stuff written in Java.

14:19 zilti: lol, and then again you're using Clojure

14:20 cemerick: zilti: I'm very dry. ;-)

14:20 ibdknox: all the cool kids are.

14:20 cemerick: I'd say it and mean it ;)

14:20 cemerick: That should mean that I need to get outta here.

14:21 ibdknox: you are in the *wrong* place then! :-D

14:21 ibdknox: stumbled in here by accident

14:21 I was trying to go to #closure ;)

14:21 jordandanford: I'm new to Clojure and I'm having some trouble with macros and namespaces - can someone help? http://pastebin.com/B75pHUni

14:21 cemerick: ibdknox: oh, burn

14:22 zilti: jordandanford: If you're new to Clojure macros should be pretty much the last thing to learn

14:23 ibdknox: jordandanford: it's usually not a good idea to create magic vars like that.

14:23 jordandanford: ibdknox: What would you recommend I do instead?

14:23 cemerick: jordandanford: You're trying to establish anaphoric bindings, and what ibdknox said. Very rarely a good reason for either.

14:23 cgray: jordandanford: and you probably mean ~@body rather than ~body

14:24 jordandanford: cgray: oh yeah, good point

14:24 pandeiro: ibdknox: i'm trying to test my app at the REPL (swank) and getting no such var arguments, yet running `lein run` works fine... do I need to manually require all the namespaces in the REPL before requiring app.server?

14:24 cemerick: jordandanford: (println (:name current-state))

14:24 ibdknox: pandeiro: what do you mean by test your app?

14:25 pandeiro: Noir doesn't mess with Clojure's dependency resolution so requiring server should require all the things it needs

14:26 pandeiro: ibdknox: yeah i mean i just want to run the app from the REPL...

14:26 jordandanford: cemerick: I'm going to end up with a lot of functions that modify the state map, so I was just hoping I could use a macro to reduce the boilerplate – is that just a bad idea from the start?

14:26 lynaghk: cemerick, you know about the JIRA, yeah? I just submitted my first patch to CLJS and I accidently set the status to "in progress", though it should probably be "open" until a core member has time to look at it, right?

14:27 cemerick: lynaghk: yup

14:27 ibdknox: pandeiro: as in just start the server from the repl? That should work

14:27 lynaghk: I can't figure out how to flip it back.

14:27 ibdknox: pandeiro: what's the exact error you're getting?

14:27 lynaghk: (p.s. I am not so good at "computers")

14:27 ibdknox: lynaghk: me neither

14:27 :D

14:27 cemerick: jordandanford: I don't think (:name state) is boilerplate :-)

14:27 pandeiro: No such var: user/prepare-user-doc

14:28 lynaghk: Nice job on Mostly Lazy, b.t.w., I listened to the episode with chris granger this morning.

14:28 cemerick: keys into maps are pretty essential; hiding them behind magical macros isn't really doing anyone any good.

14:28 pandeiro: ibdknox: yet like i said, i don't get that error with `lein run`, only when i try to require myapp.server

14:28 ibdknox: pandeiro: ah, I wonder if swank doesn't execute in the directory of your project

14:28 pandeiro: try changing it load-views-ns instead of load-views

14:28 cemerick: lynaghk: thanks :-) Going roll in a new format soon. Hoping people like it, too.

14:29 pandeiro: ibdknox: ah ok

14:29 cemerick: lynaghk: link to this JIRA issue?

14:29 lynaghk: http://dev.clojure.org/jira/browse/CLJS-114

14:29 ibdknox: pandeiro: I don't use swank, so I've not run into this

14:29 pandeiro: but assuming the classpath is setup correctly, load-views-ns should wor

14:29 k

14:29 pandeiro: ibdknox: that did it, thank you

14:30 ibdknox: np :)

14:30 pandeiro: ibdknox: what do you use?

14:30 ibdknox: pandeiro: VIM :D

14:30 jordandanford: cemerick: I'm not referring to that in particular, I just mean that I'm going to need to get a lot of those values in every function and I don't really want to write out extra let bindings every time

14:30 * pandeiro makes the sign of the cross

14:30 ibdknox: haha

14:30 jordandanford: cemerick: but I guess I'm just being lazy

14:30 emezeske: ibdknox: I thought maybe I was insane for using VIM, it makes me happy that I'm not alone :)

14:30 ibdknox: emezeske: not at all

14:31 we are the few and the proud ;)

14:31 cemerick: jordandanford: That may be the case, but at the very least, I would write them out a couple of times before

14:31 pandeiro: ibdknox: i made the switch when i decided to focus on learning clojure... after 2 years learning vim... embarrassed to say i can't even remember some of the most basic bindings

14:31 lynaghk: :wq

14:31 cemerick: getting into a macro, so you understand what you need

14:31 ibdknox: emezeske: also I mostly just like being able to say that I don't use emacs so I don't have to fix those problems for people ;)

14:31 jordandanford: cemerick: okay

14:31 ibdknox: lynaghk: lol

14:31 cemerick: jordandanford: That, and anaphora are tricky :-)

14:31 pandeiro: ibdknox: haha

14:32 jordandanford: cemerick: seems like it

14:32 emezeske: ibdknox: excellent plan!

14:34 cemerick: emezeske: #2 editor in these parts; you're far from alone

14:35 pandeiro: ibdknox: i noticed in the webnoir examples, you put valid? functions together with a view, and in noir-blog, you stick them with the models... any logic behind that?

14:35 (is this stuff that would traditionally go in the 'controller' portion of a rails/etc app?)

14:35 ibdknox: pandeiro: I usually put them in models

14:36 pandeiro: what about data-mapping and processing? also models usually?

14:36 ibdknox: pandeiro: yessir

14:41 Clojure has been eating HN these past few days :)

14:45 lynaghk: cemerick, is there anything I can do about this mangled JIRA issue, or should I just let it be for a week or two?

14:47 TimMc: lynaghk: You can't just edit it?

14:47 pandeiro: ibdknox: with load-views-ns I don't get the error output, but I also don't get any of my views ... should I take it to #emacs? ;)

14:47 ibdknox: haha

14:48 lynaghk: TimHc, the status field doesn't show up anywhere on the edit screen

14:48 ibdknox: pandeiro: easiest solution is to just require your views explicitly at the top like you would normal files

14:48 pandeiro: what does your load-views-ns look like?

14:48 pandeiro: require all the views in the server.clj ?

14:48 TimMc: lynaghk: It's probably handled differently.

14:49 ibdknox: pandeiro: yeah, that essentially what those are doing

14:49 pandeiro: (load-views-ns "src/woodshed/views")

14:49 ibdknox: ah

14:49 it should be (load-views-ns 'woodshed.views)

14:49 pandeiro: wha... ok

14:49 cemerick: lynaghk: Let it be; as long as it's tagged appropriately, it should move through

14:50 ibdknox: pandeiro: you're telling it what namespace you want to load, as opposed to a directory

14:50 lynaghk: cemerick, okay. Thanks Chas.

14:50 cemerick: bug people on clojure-dev ~Friday if it hasn't been touched

14:51 lynaghk: We git-submodule our dependencies from private repos, so it's not a huge need since we wrote the patch. I just want to be a good citizen = )

14:51 pandeiro: ibdknox: still no views... guess i will have to add them manually to server.clj if i want to use the swank repl?

14:51 TimMc: lynaghk: Status changes are performed using specific transitions on a state machine graph. :-)

14:51 ibdknox: pandeiro: I guess so :( Sorry I'm not more help there :/

14:52 TimMc: Unfortunately, this JIRA installation does not have a transition from In Progress back to whatever.

14:53 pandeiro: ibdknox: np, you've helped plenty... i will adjust my workflow for now

14:53 i already wasn't using swank to launch the app, just thought it would be cool

14:53 lynaghk: TimMc, That's certainly a positive outlook: always making progress.

14:54 TimMc: haha

14:54 gregATio: anyone there?

14:54 ibdknox: pandeiro: I don't think there will be a huge benefit over just using Noir's reload behavior, but I dunno

14:55 TimMc: gregATio: Where?

14:55 ibdknox: TimMc: I dunno, but I'm there

14:55 gregATio: just using irc in emacs for the first time

14:55 lol , ok ok , i guess its working

14:57 TimMc: lynaghk: It's a mildly interesting topic: https://confluence.atlassian.com/display/JIRA/Configuring+Workflow

14:57 pandeiro: ibdknox: yeah really what i wanted to be able to do is examine things inside the running app... validation/*errors* for example

14:57 lynaghk: TimMc, I thought you were joking about the state machine.

14:58 pandeiro: ibdknox: i am debugging load-views-ns and your implementation is getting all the nested namespaces just fine...

14:58 TimMc: It makes sense though, doesn't it?

14:58 ibdknox: pandeiro: ah, so those are bound per request, so you really wouldn't be able to see them anyways. You'd have to print them out or something

14:58 pandeiro: ibdknox: ah ok, Raynes told me that an hour ago and I pretended I understood but now I get it

14:58 ibdknox: haha

14:59 Raynes: Nice to know that I'm excellent at explaining things.

14:59 pandeiro: so there really isn't anyway to example requests while they happen?

14:59 Raynes: Good thing I'm not writing a book.

14:59 Oh wait...

14:59 jodaro: haha

14:59 ibdknox: Raynes: :D

14:59 pandeiro: Raynes: no it's a pebkac issue for sure (on my side)

14:59 ibdknox: pandeiro: not without being able to break at a specific line

15:00 which I believe you can do using the debuggers out there

15:00 but that's getting deep into emacs land

15:00 pandeiro: yeah i don't think i will make it there in 2012

15:01 basically then there isn't much advantage to launching the server in the REPL (other than not having to leave the REPL, which is comforting :)

15:01 ibdknox: yeah, pretty much

15:03 TimMc: The REPL means you can redef stuff, though.

15:04 ibdknox: TimMc: it reloads the NS, so you essentially get the same behavior

15:05 pandeiro: ibdknox: so i just had to do the (load-views-ns 'woodshed.views) inside the REPL

15:05 TimMc: oof, right

15:05 ibdknox: pandeiro: oh cool :D

15:12 _Vi: Is there way to automatically convert "(:use some.namespace)" to "(:use [some.namespace :only [this that those]])"? It should scan the source, resolve things and "register" them in ":only" lists.

15:13 amalloy: slamhound alleges to do this

15:17 zilti: "Caused by: java.lang.RuntimeException: Unable to resolve symbol: pass in this context" What could cause this error? That symbol doesn't exist anywhere in my source code

15:22 Vinzent: What can I use to extract the text content of a page?

15:25 zilti: Vinzent: Web page? enlive (Clojure) or - my recommendation b/c I already did it - htmlcleaner (java)

15:27 Vinzent: zilti, yes, but I need only text, without any tags. https://github.com/tol/webmine seems outdated

15:29 yazirian: If I run clojure-jack-in, where do stdout/stderr go? They aren't appearing in the REPL, nor are they appearing in *swank* or something, and slime-redirect-inferior-output says "No inferior lisp process"

15:32 wingie: i can't require math: (require 'clojure.contrib.math)

15:32 it says couldn't not include it

15:32 im using "lein repl"

15:32 TimMc: wingie: Don't use contrib...

15:32 unless you really have to.

15:33 amalloy: and then if you really have to, still don't

15:33 wingie: why?

15:33 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

15:33 wingie: but the issue still remains .. why can't i require it?

15:33 amalloy: haha good call clojurebot

15:36 wingie: TimMc: could you explain why i shouldn't use it?

15:36 zilti: wingie: Because contrib is discontinued

15:36 since like forever

15:36 TimMc: wingie: It's hard, I have a terribvle connection right now.

15:37 Basically, it's a monolithic lib containing unmaintained parts. Hard to version, too!

15:37 ferd: Any enlive expert around? I need a way to delete a node (and it's children) but the condition is on one of the children. Example: Delete nodes whose child element contains text "test": <x><y><z>test</z></y></x> -> <x></x>

15:38 TimMc: wingie: Anyway, do you have it in project.clj? And have run lein deps?

15:38 wingie: i see

15:38 no i haven't

15:38 i guess i shouldn't have

15:38 okay .. no contrib!

15:38 TimMc: Everything, including clojure.core, needs to be listed (or a dep of something that is.)

15:38 wingie: hate unmaintained stuff

15:39 code is like muscles

15:39 fbru02_: is there a way to distinguish if you are creating a var or just calling make a fucntion call ?

15:39 wingie: have to be maintained

15:39 TimMc: fbru02_: defn is def + fn, if that's what you're asking.

15:40 wingie: in a post the author said rather use "require" than "use"

15:40 is this better practice?

15:40 TimMc: wingie: use is fine with :only, and require is gest with :as

15:40 *best

15:41 wingie: okay

15:41 require reminds me about node.js

15:41 just require it into a var

15:41 fbru02_: TimMc: no , i was thinking about introspection sth of the sort (defn foo (if (creating-var? (first [1 2 3]) (fnext [1 2 3])) ; (foo) => 2 , (def bar (foo)); (bar) => 1

15:43 TimMc: I don't understand the question, sorry.

15:43 simonadameit: is there a function to check if a sequence contains some elements?

15:43 Vinzent: simonadameit, some

15:44 fbru02_, why do you need this?

15:45 fbru02_: Vinzent: i have a case where i need to distinguish when i'm doing a closure or when i'm calling the defn directly

15:45 zilti: simonadameit: or some?

15:45 TimMc: simonadameit: You mean, is not empty?

15:45 simonadameit: zilti: actually I want the seq to contain all members of a a set

15:45 or some collection

15:45 not just some

15:45 zilti: There's a function for that, too, if I remember correctly

15:47 simonadameit: zilti: i thought so too.. but I dont seem to find the name right now

15:47 zilti: Maybe "every?" works

15:47 http://clojuredocs.org/clojure_core/clojure.core/every_q

15:48 looks like it's what you're looking for

15:48 Vinzent: fbru02_, as being said, defn is just (def name (fn ...)), I don't think you can do that without wrapping all your code in some macro... If I understand you correctly, which I probably don't :)

15:49 fbru02_: Vinzent: heheh thanks!! I thnk i will go the macro way

15:49 simonadameit: hm… not exactly, since I want to check if a seq/collection contains all elements, not if a predicate is true for all elements of the seq

15:49 zilti: fbru02_: defn is just a macro expanding to (def name (fn ...))

15:49 simonadameit: it can contain others too

15:49 Vinzent: fbru02_, anyway, why do you need such thing?

15:50 simonadameit, clojure.set/subset or somethin like that?

15:50 emezeske: simonadameit: every? #{elements that I want} coll

15:50 zilti: simonadameit: It works even if the set contains others, too

15:50 fbru02_: Vinzent: so, let think about it for a while and then I tell you :) maybe my thinking is wrong

15:50 emezeske: simonadameit: would using the set as the pred work?

15:50 zilti: ,(every? #{1 2 3 4 5 6 7} [1 2 3])

15:50 clojurebot: true

15:50 Vinzent: fbru02_, ok

15:51 simonadameit: ,(every? #{1 2 3} [1 2 3 4])

15:51 clojurebot: false

15:51 simonadameit: that I want to be true

15:51 TimMc: fbru02_: You're probably trying to do somethign terrible.

15:51 zilti: simonadameit: You could just flip the order

15:51 ,(every? [1 2 3 4] #{1 2 3})

15:51 clojurebot: true

15:52 Vinzent: ,(clojure.set/subset? #{1 2 3} (set [1 2 3 4])) ; more readable, imo

15:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set>

15:52 Vinzent: ,(require 'clojure.set)

15:52 clojurebot: nil

15:52 Vinzent: ,(clojure.set/subset? #{1 2 3} (set [1 2 3 4])) ; more readable, imo

15:52 clojurebot: true

15:52 emezeske: Vinzent: that definitely seems like the right solution

15:52 simonadameit: zilti: that only works incidently since vector looks up keys :))

15:53 I guess I will have to do with set… though that is less efficient than it could be in this case

15:53 no need to create a set from the seq

15:57 wingie: would you use clojure to write a banking system?

15:57 or a game backend?

15:58 TimMc: Didn't you already ask this?

15:58 wingie: no?

15:58 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

15:58 wingie: not this specific

15:58 TimMc: clojurebot: botsmack

15:58 clojurebot: Owww!

15:58 Vinzent: wingie, someone already wrote MMO server in clojure

15:58 wingie: MMO?

15:59 TimMc: wingie: OK, someone was asking here (like yesterday) about game dev. Oh, right -- it was about OOP or something.

16:00 zilti: I wouldn't write huge games in clojure - I don't think the transactional memory system can handle that

16:00 Vinzent: wingie, yeah, online game. I can't give you a link, but I read about it in some blog...

16:01 zilti: Vinzent: You mean this one? http://code.google.com/p/poonscape/

16:02 emezeske: zilti: what is it about the STM system that you think can not handle a huge game?

16:02 zilti: ARGHHH WHY does Clojure keep spitting errors at me because of keywords that aren't there??

16:02 lazybot: zilti: Definitely not.

16:02 Vinzent: zilti, no, i don't think so

16:02 simonadameit: is there a preferred paste site/bot for this channel?

16:03 cemerick: most people use gist

16:03 TimMc: ~paste

16:03 clojurebot: paste is gist

16:03 zilti: emezeske: Not that much the STM itself but more that if you copy the whole game stuff each frame (which has to happen if you code idiomatic) you'll fill the whole ram

16:03 cemerick: The lisp paste bot used to be here, years ago.

16:03 TimMc: clojurebot: forget paste |is| gist

16:03 clojurebot: I forgot that paste is gist

16:03 TimMc: ~paste

16:03 zilti: and copying even in STM is slow compared to mutable data structures

16:03 clojurebot: paste is gist

16:03 TimMc: clojurebot: You're terrible.

16:03 clojurebot: Huh?

16:03 technomancy: clojurebot: pastesnack

16:03 clojurebot: Cool story bro.

16:04 cemerick: zilti: persistent data structures do not use copy-on-write.

16:04 TimMc: zilti: JVM GC is pretty fast for small recent objects.

16:04 emezeske: zilti: so you're saying that any clojure app with lots of state will eventually run out of memory? that doesn't sound right...

16:04 zilti: No

16:04 simonadameit: zilti: this is what I had in mind: https://gist.github.com/1562138

16:04 zilti: Just that 60 times a sec plus garbage collection will really slow things down I think

16:05 simonadameit: i wonder if clojure already has this :)

16:05 TimMc: zilti: *really* fast

16:05 zilti: simonadameit: Now it does ;)

16:06 amalloy: i bet clojurebot sees the . and gives up? if so that's terrible

16:06 hiredman: the what?

16:07 cemerick: zilti: I wouldn't knock it 'til you try it. The STM is no slouch.

16:07 zilti: Never said it is

16:07 It's an amazing piece of code

16:07 hiredman: or have tried it even without the stm

16:09 ferd: No enlive guru around ?

16:10 TimMc: ferd: You'll never know until you ask an enlive question. :-P

16:10 Raynes: ~anyone

16:10 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

16:10 ferd: TimMc: I did a few mins ago ;-)

16:11 Raynes: So your question was rhetorical? ;P

16:11 ferd: Here I ago again: I'm new to enlive... I cannot find a way to delete a node (and it's children) but the condition is on one of the children. Example: Delete nodes whose child element contains text "test": <x><y><z>test</z></y></x> -> <x></x>

16:12 TimMc: ferd: Oh, I saw that. Bad timing.

16:12 Someone had just asked about why they shouldn't use contrib.

16:12 ferd: Raynes: exactly ;-)

16:14 devinus: i'm still struggling to understand when to use 'symbol vs symbol

16:14 for example

16:15 pandeiro: can a nested map have meta data? no right?

16:15 devinus: why does use use (use 'clojure.repl) when doc uses (doc refer-clojure)

16:15 why isn't it (doc 'refer-clojure) ?

16:15 amalloy: pandeiro: certainly

16:15 cemerick: ferd: doable, but I'm tied up; maybe msg the ML. Someone (maybe me) will get to it in short order.

16:15 Raynes: doc is a macro and use is not.

16:15 zilti: devinus: the ' means "don't evaluate the following thing"

16:16 pandeiro: amalloy: I mean when using a map literal? without making it a var?

16:16 devinus: zilti: right, i get that much

16:16 zilti: yes, and doc is a macro

16:16 devinus: but how is (doc refer-clojure) evaluating refer-clojure?

16:16 Raynes: Since use is not a macro, it can't defer evaluation of refer-clojure, so if you don't quote it, it evaluates it immediately.

16:16 devinus: Raynes: i get that macro's don't quote the symbol, but why is doc a macro and use is not?

16:16 if use is not a macro, is it a fun?

16:17 Raynes: Because...

16:17 TimMc: devinus: doc uses the var -- (doc +) would give doc the fn, not the var.

16:17 devinus: You could write a doc function that takes #'+, but that's inconvenient.

16:17 and doc is a REPL namespace fn, intended for the common case.

16:17 pandeiro: i'm wondering about i18n, using a single map to store strings vs. storing each as its own var... the advantage i see in the latter is being able to store metadata...

16:18 devinus: ok, so is use a fn?

16:18 Raynes: There is already a macro that makes use prettier, ns. It's always a good idea to base your API on functions and, if you want, add macros to make them easier to use later.

16:18 &(ifn? use)

16:18 lazybot: ⇒ true

16:18 amalloy: because when you want to look up something's doc, you always have its name available in raw code: a macro can do that and might as well add some syntax sugar for it

16:18 duck1123: pandeiro: if it's all one var, that's only one thing to re-bind

16:18 amalloy: but when you want to import a namespace, you often only have the namespace passed to you as an argument

16:18 devinus: ok…so use is a function, that brings up another question i have….

16:18 Vinzent: pandeiro, you can use metadata with maps, see 'with-meta'

16:19 devinus: if use can import names into the current namespace, isn't the namespace mutable?

16:19 and i see a lot of procedural-esque code like e.g. (update-foo!)

16:19 ferd: cemerick: Thanks... I'm making some progress... using the "has" selector... I think I'm close

16:19 Vinzent: by the way, why 'use' is a function? Imo, there should be the 'use' macro and the 'use*' function. Quoting in use leads to misunderstanding and confusing

16:20 devinus: Vinzent: +1

16:20 that's why i think i've been getting confused

16:21 zilti: devinus: Yes, the namespace is mutable. Otherwise e.g. a REPL wouldn't be possible

16:21 pandeiro: duck1123: that is a good point, but with with ns-publics I could probably easily loop through and bind everything...

16:22 Vinzent: devinus, this question has been raised already... Maybe it will be done in clojure 2.0, since it a breaking change.

16:23 devinus: Vinzent: use vs use* you mena?

16:23 mean*

16:23 duck1123: I think 'use' is considered low level enough, that the sugar isn't needed

16:24 technomancy: hawt: (let [graph (fetch-github-projects (build-project-graph))] (->> graph :clj-stacktrace :dependents (map graph) (map :github-url)))

16:25 duck1123: if you're doing anything fancy with using that can't be done as part of the ns form, you already have to have them as symbols

16:25 TimMc: technomancy: *nice*

16:25 Vinzent: devinus, yeah. and also something like this https://github.com/stuartsierra/need would be cool

16:25 amalloy: (map (comp :github-url graph))?

16:25 Raynes: Yeah, I was thinking that too.

16:25 Seems kind of wasteful to map twice.

16:25 technomancy: fine, fine

16:26 anyway, I found our next seajure project. =)

16:26 Vinzent: duck1123, use is widly used in the repl and in various tutorials, code examples, etc

16:26 Raynes: technomancy: Will it use tentacles? :D

16:26 technomancy: Raynes: it uses clojuresphere

16:26 TimMc: Raynes: No, tentacles is so 2011...

16:26 technomancy: which still uses clj-github

16:26 devinus: Vinzent: that's actually pretty cool

16:26 Raynes: technomancy: The new Github API doesn't have a search mechanism, so that makes sense.

16:27 technomancy: Raynes: not even list by language?

16:27 Raynes: Nope.

16:27 technomancy: ouch

16:28 I wonder how much stuff is in github that's not in clojars though

16:28 for this particular purpose anyway

16:29 Vinzent: devinus, yeah, I have no idea why it's still not in the core

16:30 devinus: *sigh* hopefully my copy of JoC is going to clear some things up

16:30 mrb_bk: I'm assuming that it will create more questions than it answers

16:30 In a good way

16:30 Raynes: IIRC, there is some consolidation going on for namespace imports.

16:31 technomancy: yeah!

16:31 there's this open issue

16:32 http://dev.clojure.org/jira/browse/CLJ-879

16:32 you should all go vote for it

16:32 since it's getting ignored

16:32 Raynes: Not surprising.

16:32 simonadameit: is there something like quickcheck for clojure?

16:33 devinus: simonadameit: i'm interested in the same thing

16:33 wingie: this was a good one: http://cemerick.com/2010/06/07/results-from-the-state-of-clojure-summer-2010-survey/

16:33 djwhitt: there's also https://github.com/clojure/test.generative

16:34 hiredman: https://github.com/clojure/test.generative

16:34 cemerick: wingie: that's old

16:34 ~survey

16:34 clojurebot: survey is http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/

16:34 devinus: when clojure.contrib was broken up, where was repl-utils landed?

16:34 wingie: devinus: oh they have a clojure survery each year =)

16:35 hiredman: test.generative hasn't seen a lot of use outside of stuart h. though

16:35 cemerick: they? o.0 :-P

16:35 The omnipresent "they" perhaps.

16:35 technomancy: cemerick: the royal we

16:35 Vinzent: technomancy, what's the problem with breaking backward compatibility? 1.3 and deprecating of contrib caused much more problems than changing ns decl can cause

16:35 mcrittenden:

16:35 oops

16:36 technomancy: Vinzent: well the whole point of contrib was it was full of ideas that weren't necessarily very good to begin with. so there was no guarantee of stability.

16:36 simonadameit: hiredman: thanks ill look into it

16:37 technomancy: Vinzent: practically speaking people ended up using it like the standard library because early on there was no alternative, but it was very clear that was not the intention

16:37 Vinzent: technomancy, but, anyway, is was de-facto standard clojure library

16:37 technomancy: Vinzent: right; in the end the only difference is that core gets to say "i told you so" when everything breaks.

16:39 Vinzent: hah, right...

16:39 devinus: anybody know what happened to clojure.contrib.repl-utils? :(

16:41 Raynes: devinus: clojure.repl

16:41 devinus: Raynes: what happened to show ?

16:43 it listed out all the methods of a java object pretty nicely

16:43 TimMc: ~what happened to contrib?

16:43 clojurebot: Well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

16:44 TimMc: devinus: ^

16:44 devinus: hrm...

16:44 TimMc: devinus: clojure.reflect/reflect, sort of

16:45 xcv: Hey guys, does anyone have a feel for how a typical noir-esque clojure web stack performs compared to rails?

16:47 devinus: xcv: probably generally faster, unless there's some serious architectural problems with noir

16:47 xcv: I realize that this question might not have a perfect answer, but do share if you have any biased anecdotes or gut-feeling approximations

16:47 :P

16:47 ibdknox: xcv: well

16:47 xcv: devinus: I'd think so, a priori. How much faster in general? 50%? 20%?

16:48 TimMc: A friend of a friend once told me that noir doesn't have to reticulate quite so many splines as rails does.

16:48 devinus: xcv: i don't know myself, but we are talking about rails. it's not known for it's speed. plus clojure has the JVM working in it's favor

16:48 ibdknox: TimMc: it's true

16:48 xcv: haha

16:48 devinus: and i'm pretty sure noir can use jetty right? which means it can utilize multiple threads

16:48 ibdknox: yes

16:48 devinus: (i think?)

16:48 ibdknox: devinus: Noir can use anything

16:49 xcv: and then there's aleph

16:49 devinus: right

16:49 ibdknox: Netty/Tomcat/Jetty

16:49 devinus: which uses netty

16:49 nice

16:49 ibdknox: xcv: I have a gist that has Noir on top of aleph

16:50 xcv: ibdknow: Ok cool, I'll check that out

16:50 duck1123: transitioning from jetty to aleph was pretty easy

16:50 devinus: Noir would probably do best on netty when used in a highly concurrent simultaneous situation like a chatroom or something, prob best on jetty when serving sites

16:50 that's just an educated guess though

16:50 ibdknox: devinus: correct

16:51 xcv: I think my use case calls for jetty then

16:52 the reason I ask is that I was checking out some mailing lists for yesod, the haskell web framework, and though one would think haskell outperformed rails (being statically typed and compiled), that was not the case, since the rendering engine yesod used was slower

16:53 they seemed to be working on fixing it, but it got me thinking whether the "newness" of some of the clj web libs was hurting performance or not

16:53 not rendering in particular, but the general case

16:53 that's why I asked

16:54 [outperformed ruby, I mean]

16:54 technomancy: that's quite surprising

16:54 I bet yesod lets you swap in a more efficient rendering engine though

16:55 xcv: ah, sorry, seems it was the database driver in that case

16:56 here's part of that conversation (http://www.haskell.org/pipermail/web-devel/2011/001064.html)

16:56 TimMc: Yep, the whole stack matters.

16:56 xcv: but of course, this is an area where the java interop is really helping clojure

16:58 so my gut tells me a lot of those problems are not there for clojure, thanks to all the battle-tested libs that are being wrapped below the surface

16:59 technomancy: yeah IIRC the yesod author had to write his own mysql adapter

16:59 xcv: yeah, I think I heard about that too

17:01 they're working on a couple of different postgres adapters, but it seemed like neither of them was both performant and production-ready

17:07 devinus: hrm

17:08 does anybody know how to start a newline in the current parens with paredit without slime taking the line?

17:08 amalloy: i use C-j

17:08 well. actually i don't use paredit in the repl. but C-j works anyway

17:09 devinus: it does work

17:09 sort of annoying though

17:09 maybe i should bind Shift-Enter to be the new enter

17:09 amalloy: technomancy: i am completely baffled by some behavior i'm getting from lein. i have this test, which depends on protocol P being extended to type T. when i run lein test, i get failures saying P isn't implemented for T. lein swank followed by (test #'the-test) returns :ok and prints nothing. lein repl followed by (test #'the-test) prints out the "no implementation" error messages and then returns :ok anyway, but i assume that's something to d

17:10 TimMc: amalloy: "that's something to d"

17:10 amalloy: that's something to do with me calling the clojure.test code incorrectly in some way. does any of this make sense to you, and is there more information i could provide that would help clarify?

17:10 (thanks TimMc)

17:13 technomancy: I'm not sure what to expect calling test directly. what about run-tests?

17:13 in general I'm useless re: protocol questions though

17:14 amalloy: &(doc run-tests)

17:14 lazybot: java.lang.RuntimeException: Unable to resolve var: run-tests in this context

17:15 hiredman: amalloy: the thing to watchout for with protcols and clojure-test-mode is runing tests can causes code to be reloaded

17:16 amalloy: hiredman: i don't use clojure-test-mode

17:16 but yes, i agree it looks kinda like a classloader issue

17:16 technomancy: bloody protocols

17:16 hiredman: you might want to turn on verbose loading and see what happens

17:17 amalloy: hiredman: how do i do that?

17:17 technomancy: run-tests clarifies things a little: the tests fail in both repl and swank, and only repl prints any output. weird, but whatever

17:17 hiredman: (alter-var-root *loading-verbosely* (constantly true))

17:18 you can also do (require 'foo.bar :verbose)

17:18 amalloy: what namespace is that in? it doesn't seem to be available in my 1.3 repl

17:18 hiredman: it's in core

17:18 oh

17:18 (alter-var-root #'*loading-verbosely* (constantly true))

17:18 of course

17:19 amalloy: oh, it's private. right

17:20 Vinzent: btw, why there is no set-var-root?

17:21 technomancy: Vinzent: that's not what vars are for.

17:21 alter-var-root is awkward on purpose

17:26 Vinzent: technomancy, that's a strange approach. One can still misuse vars, awkwardness of alter-var-root won't stop him!

17:26 technomancy: ugly things should look ugly

17:27 amalloy: hiredman: that's a neat little tool to know about. it doesn't seem to be useful for me, since each file is being loaded only once (in a probably-reasonable order), and calling run-tests doesn't cause anything to reload

17:27 hiredman: huh

17:29 Vinzent: I remember I have (alter-var-root #'something (constantly (constantly :foo)) - that's too ugly for this

17:32 amalloy: but there's definitely some weird classloader voodoo going on. maybe it's relevant that the class i'm extending to is a java class; it is presumably not showing up in the clojure namespace-loading verbose info

17:33 hiredman: sure

17:39 technomancy: ibdknox: noir uses clj-stacktrace, right?

17:39 ibdknox: technomancy: yeah

17:40 technomancy: I'm adding functionality to let you specify frames to omit

17:40 ibdknox: !

17:40 that would be killer

17:40 technomancy: excellent

17:41 if you want to take a look at the omit-frames branch, basically right now it's just set up so the pst function takes an options map

17:41 hm; but you probably don't use that as your entry point

17:41 ibdknox: I don't

17:41 technomancy: you use parse-exception?

17:41 ibdknox: let me look real quick at what I do

17:42 devinus: (defn my+ [& args] (apply '+ args))

17:42 what am i missing there?

17:42 ibdknox: technomancy: yep

17:42 devinus: how do i refer to args correctly?

17:42 ibdknox: devinus: don't quote +

17:42 devinus: ok, so apply is a macro

17:42 sweet it works

17:42 ibdknox: ,(doc apply)

17:42 Bronsa: no, apply is a function

17:42 clojurebot: "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."

17:42 ibdknox: not a macro

17:43 technomancy: ibdknox: so I've exposed the omit function as well: https://github.com/mmcgrana/clj-stacktrace/blob/omit-frames/src/clj_stacktrace/repl.clj#L56

17:43 devinus: grr

17:43 Bronsa: ,+

17:43 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@143fc61>

17:43 technomancy: would that get you what you need?

17:43 devinus: i still don't get how symbol resolution works

17:43 ibdknox: technomancy: I think so

17:43 devinus: well

17:43 what i mean is i don't understand why apply would take the unquoted version

17:44 technomancy: ibdknox: do you already have a mechanism set up for how users would customize things like to-omit?

17:45 amalloy: devinus: apply doesn't want a symbol, it wants a function

17:45 rjack: I need to parse a query string and I'm trying to use ring.middleware.params as suggested here: http://stackoverflow.com/a/6596296/54967 but I can't use parse-params in my code. Is this because it's defined with defn-? How can I use it anyway?

17:45 ibdknox: technomancy: no, I'll have to think about that. My thought was just to omit things I know you don't want to see... which isn't necessarily a long list, but enough that it would be valuable

17:45 amalloy: '+ evaluates to a symbol, +. + evalutes to a function, the implementation of addition

17:46 devinus: there's too much mixing between functions that want symbols versus functions

17:46 ibdknox: rjack: you might find it much easier to get started with Noir

17:46 technomancy: ibdknox: there are curmudgeons who think that no such things exist

17:46 ibdknox: technomancy: they don't use Noir ;)

17:46 amalloy: hah

17:46 ibdknox: technomancy: like amalloy :p

17:47 rjack: ibdknox: I'm using enlive because I need to scrape some web pages. Some infos I want to scrape are query string parameters in href urls.

17:47 ibdknox: ah

17:48 hiredman: technomancy: I am not saying that a mechanism shouldn't exist, I am saying that the default should not be to trim stuff out

17:48 devinus: amalloy: thanks

17:48 it's starting to slowly sink in

17:49 technomancy: hiredman: ok, but I need actual examples

17:49 nickmbailey: how do i import a type defined with deftype from another namespace into my current namespace

17:49 (:use ns) doesn't seem to work

17:49 technomancy: like concrete things you would use that otherwise-lost information for

17:50 rjack: ibdknox: I'm new to clojure so I don't know if I need to specify some parameter in (:use ring.middleware.params)) in order to use parse-params.

17:51 ibdknox: rjack: defn- makes it private, unfortunately

17:51 devinus: clojure uses UTF16 strings right?

17:52 rjack: ibdknox: as I thought :( thank you

17:53 hiredman: technomancy: depends, what you filtering out?

17:55 Vinzent: nickmbailey, use :import

17:55 technomancy: hiredman: clojure.lang.AFn and clojure.lang.RestFn seem like no-brainers

17:56 probably clojure.lang.Compiler and clojure.lang.Var as well

17:57 Vinzent: rjack, you still can use private fns like this: #'full.ns/private-var, but only if you really know what are you doing

17:57 hiredman: I could see AFn and RestFn

17:57 ibdknox: technomancy: I started writing something for a new project of mine that allowed me to also modify what was said for each frame of an exception

17:57 nickmbailey: Vinzent: thanks

17:57 ibdknox: technomancy: to make them a bit more friendly

17:57 technomancy: ibdknox: how so?

17:58 hiredman: does clj-stacktrace do transforming of java frames into clojure (fn classes into vars)

17:58 ibdknox: technomancy: in this particular case the system you're working with is a blackbox, and should stay that way. So it would replace parts of the stack with what it was doing

17:59 technomancy: kind of neat, but has limited applicability. It was also replacing the messages of exceptions based on the type and whatever other information I could extract.

18:00 technomancy: hiredman: I think so, if I get what you're asking

18:01 hiredman: ,(class +)

18:01 clojurebot: clojure.core$_PLUS_

18:01 hiredman: -> clojure.core/+

18:01 technomancy: oh, yeah it does that

18:02 has to reimplement it though; it's a shame that's not exposed by Clojure itself

18:02 TimMc: technomancy: I did see a demunge somewhere.

18:02 clojure.main, maybe

18:03 technomancy: TimMc: oh cool; in clojure.repl. must be new-ish.

18:04 yeah, :added "1.3"

18:04 glad it exists, even though I can't rely on it in this case.

18:04 TimMc: ,(require 'clojure.repl)

18:04 clojurebot: nil

18:05 TimMc: ,(-> + class str demunge)

18:05 clojurebot: "class clojure.core/+"

18:06 TimMc: I guess clojure.repl was already use'd, that require wouldn't have done anything for me.

18:09 rjack: Vinzent: it works, thank you!

18:09 replaca: technomancy: do you want me to take a whack at the slamhound pretty-print thing?

18:10 Vinzent: rjack, but I don't thibk you really should use it in your case. It was done private for some reason

18:11 technomancy: replaca: oh dang; sorry. way behind on my email.

18:11 replaca: yeah, I think the main issue was it was inserting newlines like so: (:use\n [whatever.blah])

18:13 rjack: Vinzent: as strange as it may sound, I think that in this file https://github.com/rjack/ring/blob/master/ring-core/src/ring/middleware/params.clj parse-params should be public and assoc-params should be private.

18:14 Vinzent: I don't know, but assoc-params looks like an helper function for parse-params, yet it's public.

18:14 Vinzent: rjack, indeed

18:14 hiredman: technomancy: one possiblity is release with omit defaulting to false, see what people come up with, and get a reasonable default from there

18:15 technomancy: hiredman: yeah, that may be wise

18:16 rjack: Vinzent: let's see, I'm opening a pull request

18:55 wingie: are everything an object in clojure?

18:55 or is there no such thing

19:01 gf3: I notice sometimes people show the expansion of the function short-form by preceding it with a quote, does this work simply because the macro is expanded as usual, and the quote prevents invocation?

19:01 or is there some other magic at work there?

19:12 jodaro`: ahah

19:13 jodaro: gloss.repeated is automagically prefixing my stuff with a count

19:13 which i don't wnat

19:13 or want

19:13 ztellman: use :prefix :none

19:13 jodaro: perfect

19:13 thanks!

19:14 ztellman: keep in mind that the frame needs to be bounded some other way

19:14 otherwise it will never actually return anything

19:14 jodaro: hmm

19:14 ztellman: you could use finite-frame as a wrapper, for instance

19:14 jodaro: basically this protocol has a spot for 0 or more null terminated strings

19:14 ztellman: or define a delimiter

19:15 jodaro: and a size field that tells the server the size of those strings (as a whole)

19:15 so sometimes i need it empty

19:15 sometimes i need "foo"

19:15 ztellman: is the size field always there?

19:15 jodaro: and sometimes i need "foo\0bar"

19:15 yeah

19:15 size field is required

19:15 (and sometimes "foo\0bar

19:15 sorry

19:16 foo\0bar\0baz

19:16 ztellman: so isn't the size field the prefix you were saying you don't want?

19:16 jodaro: well i'm specifiying it manually

19:16 amalloy: technomancy, hiredman: figured out my issue and it was pretty weird. try this: (defprotocol Foo (bar [this])) (def b bar) (extend-type String Foo (bar [this] 10)) ;; now, (bar "") returns 10 but (b "") throws an exception

19:17 ztellman: can you put your frame in a gist and show it to me?

19:17 jodaro: i suppose i could let repeated specify it autmagically

19:17 yeah, hold

19:18 amalloy: gf3: #(foo %) is a reader macro, not a regular macro. it gets "expanded" as part of the process of reading, whereas regular macros get expanded during evaluation (which is suppressed when quoting)

19:18 hiredman: amalloy: must be the magic protocol metadata+var name

19:19 gf3: amalloy: so the quote just prevents invocation of the already expanded macro?

19:19 technomancy: amalloy: you aren't making me trust protocols more

19:19 jodaro: ztellman: https://gist.github.com/1563014

19:19 thats what i started with and i've just been splitting/joining by hand

19:19 but having gloss handle it would be way cleaner

19:19 TimMc: gf3: No macros involved.

19:20 jodaro: wait sorry, i left something out

19:20 TimMc: Hey, it's ztellman!

19:20 jodaro: :type is just an :int32

19:20 amalloy: right, hiredman. b doesn't have :protocol in its var's meta, though i don't really know what the consequences of that are

19:20 gf3: TimMc: I am confused, amalloy just mentioned it is a reader macro

19:20 jodaro: in an enum

19:21 ztellman: TimMc: hi

19:21 TimMc: gf3: reader "macro" :-/

19:21 hiredman: the call site isn't being compiled as a protocol callsite

19:21 ztellman: jodaro, the data-size is defined earlier in the rame?

19:21 frame*

19:21 TimMc: ztellman: We had a burning question for you the other day: Why specify codecs using maps, which aren't sequential?

19:21 jodaro: oh, yeah

19:21 (defcodec data-size :int32)


19:21 doesn't really need to be like that i guess

19:22 i was just trying to split things up

19:22 ztellman: TimMc, you can use other data structures

19:22 but sometimes it's nice to have the key-value pairing

19:22 jodaro: TimMc: i switched to ordered-map

19:22 amalloy: in fact the way i was doing it was a little bit different: more like (letfn [(make-fn [f] (...use f...))] (def bar-fn (make-fn bar)), so there was no var at all to have metadata on

19:22 jodaro: and it works great

19:22 ztellman: for instance [:int32 :int32] is a perfectly valid frame

19:23 jodaro: there are only interposed null delimiters, correct?

19:23 jodaro: ztellman: i was doing something like {:m :int32 :f (string :utf-8)}

19:23 ztellman: so "a\0b\0c", not "a\0b\0c\0"

19:23 jodaro: without ordered maps but forgetting that they wouldn't be ordered

19:23 yes, thats correct

19:24 ztellman: ok, so the best thing to do is just have the splitting be a post-step

19:24 jodaro: ok

19:24 ztellman: putting together a forked gist, just a sec

19:24 jodaro: the request and response are the same format

19:24 i'm already splitting the response

19:24 and that works fine

19:27 TimMc: ztellman: If you use a map, that restricts you to use of the exact same architecture and Clojure version -- the ordering is arbitrary.

19:28 ztellman: TimMc, that's why ordered-map exists

19:28 jodaro: https://gist.github.com/1563018

19:28 I haven't tested this, but hopefully the intent is clear

19:29 TimMc: ztellman: Wiki might need clarification, then -- plain maps are used everywhere.

19:29 ztellman: TimMc, maps cleanly encode and decode within gloss

19:29 jodaro: ztellman: nice, thanks!

19:30 ztellman: keys are ordered alphabetically

19:30 TimMc: Ah! I see.

19:30 hiredman: b

19:30 ztellman: if you're trying to conform to another protocol, ordered-map is required

19:30 TimMc: Got it.

19:30 ztellman: I think I mention this in the wiki, but I'll double-check

19:30 TimMc: ztellman: What "alphabetically" do you use?

19:30 jodaro: TimMc, ztellman: thats what threw me

19:30 the alphabetical ordering

19:30 ztellman: I sort by (name keyword)

19:31 jodaro: mainly because i figured the key would be descriptive of the field

19:31 TimMc: ztellman: I'm thinking about non-ASCII.

19:31 jodaro: not necessary an ordered key

19:31 necessarily

19:31 ztellman: ok, if that was confusing I'll clarify in the documentation

19:31 thanks for the feedback

19:32 jodaro: yeah

19:32 maybe just add in a plug for ordered-map in the first example

19:33 mdeboard: This is a bit off-topic but do any of you have any recommended reading/study materials wrt machine learning?

19:35 ztellman: TimMc: I think naive unicode sorting should be consistent even if it's not always "correct"

19:35 and consistency is all we need

19:36 TimMc: Codepoints worked.

19:36 *works

19:36 wingie: why doesn't ^serializable-stu work

19:36 for showing meta

19:37 jodaro: mdeboard: https://cwiki.apache.org/confluence/display/MAHOUT/Reference+Reading

19:37 looks like there is some stuff there

19:37 mdeboard: Yeah I'm there atm

19:37 jodaro: thanks

19:37 jodaro: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-867-machine-learning-fall-2006/

19:37 technomancy: wingie: that's deprecated; use the meta function

19:37 jodaro: i haven't read any of it

19:37 but

19:38 wingie: technomancy: ah good .. i love using the names instead

19:38 makes it more consistent

19:38 why i love clojure in the first place

19:38 technomancy: ^ is now used to attach metadata instead of reading it

19:38 wingie: okay .. ill just use the function instead

19:38 they should ditch all those syntax!

19:39 make it clean and consistent with no exceptions!

19:39 wouldn't that be cooler?

19:39 mdeboard: jodaro: Yeah I guess I was looking for some first-hand recommendations from the Clojure crowd; thanks for your efforts

19:39 wingie: the no syntax lang

19:46 TimMc: ztellman: "When a frame is defined using a map, Gloss encodes the vals in an arbitrary but consistent order. To work with existing binary protocols, use Gloss' ordered-map (or a vector.)"

19:46 Sound about right?

19:54 ztellman: TimMc: yeah

19:55 feel free to make the edit to the wiki, if you're feeling driven

19:55 TimMc: OK, added after the encode/decode[BJust did. :-)

19:55 (ugh, bad connection)

19:55 ztellman: ha, ok

19:55 thanks

20:02 clj_newb: anyone know of a decent effort to implement a J/K/APL DSL within Clojure?

20:07 wingie: Is it possible to use OOP JS frameworks (ExtJS, Sproutcore, YUI etc) with ClojureScript?

20:07 TimMc: wingie: You have the full power of JS in CLJS.

20:08 ibdknox: when I get a minute again I'll release the cool stuff I did with jQuery in cljs

20:09 alexbaranosky: hey TimMc, give any more love to TryClojureScript ?

20:10 etosch: Anyone know if there's a straightforward way of setting max_allowed_packets using with-connection on a mysql database?

20:14 TimMc: alexbaranosky: Nah, I'm still annoyed at it.

20:15 ibdknox: TimMc: what's wrong?

20:16 TimMc: ibdknox: Can't figure out how to get the namespace right.

20:16 Let me start up the server...

20:19 ibdknox: are you using Clojail to sandbox cljs compilers for each person?

20:20 TimMc: ibdknox: http://k.timmc.org:7013/ Try (+ 1 2), then (str 6), then (clojure.core/str 6)

20:20 Oh, I'm not sandboxing the compiler at all. Should I?

20:21 ibdknox: I thought it kept track of declared symbols so it can resolve them over time, but that might only be part of the repl functionality. I can't remember

20:21 wingie: TimMc: cool .. will check back later on it when it's mature

20:22 TimMc: ibdknox: Anything it doesn't recognize gets a cljs.user. in front of it.

20:22 amro: I have a vector, [a1 a2 b1 b2 ...] and I need to process each pair at once. is there an idiomatic way for handling that?

20:23 ibdknox: ,(doc partition)

20:23 TimMc: amro: partition is a good start

20:23 alexbaranosky: amro, 'partition

20:23 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

20:23 amro: thanks

20:24 hiredman: ~partition

20:24 clojurebot: partition is probably not what you want; see partition-all.

20:24 ibdknox: TimMc: hm, are you declaring a namespace somewhere for the user?

20:25 TimMc: I have only once ever needed partition-all.

20:25 ibdknox: I almost always want it

20:25 jodaro: rad. ztellman had exactly the solution i needed

20:25 TimMc: The one time I needed it, it was for displaying data for human consumption.

20:26 ibdknox: TimMc: lol have you tried this? (defn b [] (js/alert "hey"))

20:26 TimMc: it might be worth looking into how I did brepl

20:26 it's a similar problem

20:27 TimMc: ibdknox: Here's latest: https://github.com/baznex/trycljs/blob/master/src/trycljs/models/compile.clj

20:27 I'm basically flailing around.

20:27 ibdknox: I think if you refer clojure.core into there it'll work :)

20:28 TimMc: Is that it?

20:29 ibdknox: As in, (refer 'clojure.core) as the first part of the code to compile?

20:30 ibdknox: mhm

20:31 TimMc: ibdknox: Evaluation error: TypeError: cljs.core.refer is undefined

20:31 * TimMc headdesk

20:31 ibdknox: lol

20:32 another potential solution is to wrap all of it in an NS call

20:32 but that won't work long term if people are allowed to define functions

20:33 TimMc: ibdknox: ns call won't work -- GClosure throws a shitfit

20:33 ibdknox: let me see what I did then

20:34 TimMc: (goog.provide() throws an error the second time you give it the same ns to "teach new developers not to do that")

20:35 ibdknox: I cheated and used compiler internals

20:36 TimMc: I saw a browser repl thingy in the CLJS codebase, is that brepl?

20:36 ibdknox: nope, that's the official browser repl

20:37 I wrote mine a couple days after CLJS came out

20:37 wingie: what does # mean: (meta #'str)

20:37 mdeboard: hipster

20:37 ibdknox: I think they used mine as inspiration

20:37 mdeboard: srsly.

20:37 TimMc: found it

20:38 alexbaranosky: wingie, means its a var

20:38 ibdknox: I think the problem is you need to add clojure.core to the build environment, without sending it to the client again

20:38 TimMc: wingie: # is a reader dispatch character. It is meaningless without the next char.

20:38 alexbaranosky: wingie, specifically #' indicates that 'str' is a var

20:39 TimMc: wingie: #'foo is (var foo)

20:39 wingie: alexbaranosky TimMc I see

20:39 the latter seems more understandable

20:39 TimMc: wingie: read http://clojure.org/reader

20:39 alexbaranosky: try: (#'str "a" "b")

20:39 wingie: ,(#'str "a" "b")

20:39 clojurebot: "ab"

20:39 TimMc: ibdknox: Did you solve the require vs. goog.provide problem?

20:39 ibdknox: but the compiler has to know about that ns otherwise it won't be able to resolve it. Last I knew it basically just kept a map of vars and their corresponding namesapces

20:39 yeah

20:39 alexbaranosky: wingie, understanding is in the eye of the beholder

20:40 wingie: alexbaranosky: yepp .. good that both methods exist

20:40 i like choice

20:40 alexbaranosky: I think #' goes back to Common Lisp

20:40 so we're building on the backs of the greats here :)

20:41 hiredman: #' means something different in common lisp

20:41 TimMc: ibdknox: Maybe I can surgically remove the ns declaration after compilation. >_<

20:41 hiredman: "look up the value of this symbol in the function namespace" or something

20:42 ibdknox: TimMc: what you really want is to just call analyze and emit on the things, that will solve your problem

20:42 jcrossley3: is there a way to determine whether a java class is available at runtime?

20:42 ibdknox: TimMc: you'll have to sandbox though, otherwise people's functions will stomp on eachother

20:42 alexbaranosky: hiredman, ahh, I wasn't aware it had a different meaning in CL. thx

20:42 hiredman: http://c2.com/cgi/wiki?SharpQuote

20:42 mdeboard: If anyone's was paying attention earlier when I asked for first-hand recommendations for ML reading, I got a recommendation for http://www.amazon.com/gp/product/B0028N4WM4, $6 on the kindle

20:43 hiredman: "it's a crazy lisp 2 thing"

20:43 TimMc: ibdknox: Are you sure that the analyzer needs to know what functions have been declared?

20:44 I was hoping that since symbols are expanded by default to cljs.user/foo that I wouldn't have to bother.

20:44 alexbaranosky: hiredman, totally makes sense, since symbols are in another namespace from functions in lisp 2's

20:44 ibdknox: ah

20:44 sure

20:44 TimMc: it at least needs to know clojure.core and anything else you want to expose

20:45 technomancy: alexbaranosky: assuming keeping functions in a separate namespace made sense in the first place =)

20:45 ibdknox: TimMc: also, don't forget, you can always overwrite goog.provide to not be retarded

20:46 alexbaranosky: technomancy, well, if you're going to be crazy, might as well make sense while you're at it

20:46 etosch: jcrossley3: you mean like http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/ClassLoader.html?

20:46 TimMc: ibdknox: Hmm... perhaps delegate and catch?

20:46 hiredman: jcrossley3: as far as I know the only way is to try and load the class

20:47 jcrossley3: etosch: hiredman: nothing similar to ruby's 'defined?' method?

20:47 something like symbol? or var? but for java classes?

20:47 hiredman: ,(doc resolve)

20:47 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

20:47 hiredman: ,(doc ns-resolve)

20:47 clojurebot: "([ns sym] [ns env sym]); Returns the var or Class to which a symbol will be resolved in the namespace (unless found in the environement), else nil. Note that if the symbol is fully qualified, the var/Class to which it resolves need not be present in the namespace."

20:48 hiredman: ^- but ns-resolve actual throws an exception instead of returning nil for classes

20:48 etosch: jcrossley3: okay, this is from a while ago, but I seem to remember that the only way to check on the jvm speciically was to get a runtime and then test for a specific class using a class loader, but i am not certain

20:48 hiredman: ,(ns-resolve 'Foo)

20:48 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$ns-resolve>

20:48 hiredman: ,(ns-resolve *ns* 'Foo)

20:48 clojurebot: nil

20:48 hiredman: Uh

20:48 Oh

20:49 well, then there you go

20:49 ibdknox: TimMc: that works too :)

20:49 hiredman: ,(ns-resolve *ns* 'String)

20:49 clojurebot: java.lang.String

20:49 hiredman: ,(class (ns-resolve *ns* 'String))

20:49 clojurebot: java.lang.Class

20:49 jcrossley3: hiredman: nice, thanks. :)

20:49 ibdknox: TimMc: gotta run, but let me know how it goes :)

20:49 etosch: hiredman: cool, nice to see this is less painful in clojure :)

20:49 TimMc: ibdknox: thanks

20:56 Here's a nice trick for reading multiple forms from a string:

20:57 &(let [s "1 2 ;comment \n 3 ; more comment"] (rest (read-string (str "(do " s " \n)"))))

20:57 lazybot: ⇒ (1 2 3)

21:05 TimMc: alexbaranosky: ugh, you tricked me into working on trycljs more

21:16 alexbaranosky: TimMc, old Jedi trick ;)

21:23 unlink: Perhaps my expectations are incorrect, but why does a call to (meta foo) after (defn ^String foo [] "foo") yield nil?

21:23 TimMc: unlink: the meta you seek is on the var

21:24 unlink: Try (meta #'foo)

21:28 unlink: TimMc: Why thank you.

21:28 I was looking on the fn, wasn't I.

21:29 TimMc: yep!

21:48 gf3: is there a predicate in core somewhere which is something like: checking if the count of an intersection is greater than zero?

21:49 I guess (subset?) is what I want

21:49 wingie: are all of the clojure's functions available in clojurescript?

21:52 xcv: Are you guys using any authentification library for your clojure web apps? I'm used to devise with rails and was wondering if there was a slimmed down version of it that still handled most of the boring standard auth logic, password encryption etc.

21:53 authentication, that is

21:53 :P

21:54 wingie: xcv: i fixed it with oneall.com =)

21:54 better than janrain and gigya

21:55 and no need for custom auth (which sucks nowadays if your app is for the crowd=

21:59 xcv: wingie: Thanks, this might be a good fit for one part of my app, I'll look into it. I also need a more classical username/password system for the other part

22:01 wingie: wrt clojurescript, there's an overview on the wiki https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure

22:01 gf3: is there a more idiomatic way of writing the following:

22:01 (some (set (list clip)) [:border-box :padding-box :content-box])

22:01 where clip is a keyword

22:02 wingie: I hope it will be out of alpha and similar to coffeescript with solid documentation and user base

22:03 xcv: wingie: the major differences, as I recall, are the lack of refs, stm and agents, and that macros have to be defined in clojure files and imported to clojurescript files, since they operate on the clojure side of things

22:03 amalloy: (set (list x)) is just #{x}

22:03 xcv: there's a better overview in Rich's presentation on blip.tv

22:03 wingie: xcv: do you know if the functions work like: rest, first, second etc?

22:04 amalloy: but really you want (#{:border-box :padding-box :content-box} clip)

22:04 wingie: xcv: okay *watching it*

22:05 xcv: wingie: first and rest are, at least

22:05 there's a lot of stuff in src/cljs/cljs/core.cljs in the github repo

22:06 I guess most of the "canonical" utility functions and common algorithmic stuff is there or coming soon, in the talk he mentioned that those things were low-hanging fruit

22:07 don't know the specific status though

22:09 gf3: amalloy: thank you

22:09 amalloy: that should have the same effect, right?

22:09 amalloy: naw, i like suggesting totally-different replacement code

22:12 xcv: Any more recommendations for auth plugins? Or should I just roll my own?

22:14 wingie: xcv: he says that clojure targets the .NET platform

22:15 what's that about

22:15 amalloy: sandbar has auth-related stuff but i don't know much about it

22:16 xcv: wingie: Not sure, maybe this? https://github.com/clojure/clojure-clr

22:18 gf3: amalloy: no I meant set→key vs key→set

22:18 amalloy: I didn't mean your actual suggestion, sorry

22:18 I remember reading that

22:19 wingie: xcv: looks cool

22:19 but it seems to be a big project for one guy to handle :)

22:25 fbru02_: ,(map (partial apply hash-map) [["x" 4] ["x" 5] ["y" 6]])

22:25 clojurebot: ({"x" 4} {"x" 5} {"y" 6})

22:31 kenth: Hi, is there a way to extend a given protocol to a record after it has already been partially defined in defrecord?

22:38 riddochc: Hey. Anyone had problems building clojure under openjdk? When I do a 'mvn install' at the tip of clojure's master branch, I get a few errors like: "The method divide(BigDecimal, int) in the type BigDecimal is not applicable for the arguments (BigDecimal, MathContext)"

22:46 Running 'lein jar' in enlive says it can't get org.clojure:clojure:jar:1.4.0-alpha3. I'm a bit surprised by this.

22:52 replaca: technomancy: (sorry, got pulled from the computer) yeah, that's what I guessed. I'll make a patch and see what you think

22:52 technomancy: do you have a preference patch or pull?

22:53 amalloy: replaca: it's easy to create a patch from a pull request, not so easy the other way

22:56 replaca: amalloy: yeah, doesn't matter to me much - just what people like.

23:00 amalloy: replaca: https://github.com/flatland/useful/pull/5.patch for example. i'm just saying if technomancy doesn't like pull requests it's super-easy for him to pretend you sent him a patch instead

23:15 jodaro: ztellman: that worked great

23:15 ztellman: jodaro: awesome, glad to hear it

23:22 jodaro: i shuffled things around a little and put it in its own codec

23:22 and then include it in the request and response codec

23:23 but otherwise, yeah, exactly what i was looking for. i guess i should have explored compile-frame closer

23:24 ztellman: I think the documentation could stand a little restructuring

23:25 jodaro: i like the conversational style

23:25 the lamina channels docs are good like that too

23:25 maybe just more examples along those same lines

23:26 technomancy_: replaca: a pull request would be great

23:26 is it something that can be done entirely in slamhound?

23:27 riddochc: I use openjdk for everything

23:35 alexbaranosky: man can't wait to deploy next version of Midje, the colorized clj-stacktraces look great

23:36 technomancy_: alexbaranosky: I think I wrapped up the omit-frames branch

23:36 just waiting for review from Mark to merge it

23:37 alexbaranosky: technomancy_, nice. then comes the color-specifying code? Or is it already incorporated in the branch?

23:38 technomancy_: I think it should be implemented in terms of the opts arg to pst once omit-frames is on master

23:39 alexbaranosky: yeah, I see the opts arg now, I'm checking out the branch

23:39 now would you need to make the color into semantically meaningful names, like I did (:java-colo, repl-color, etc)?

23:41 riddochc: technomancy_: I've only recently been using openjdk - suse's been shipping it, and apparently oracle's licenses don't allow the linux distros to package the sun jdk/jre.

23:45 technomancy_: alexbaranosky: yeah, so probably two layers of maps

23:45 one for color names to ansi codes, and one for frame types to color names

23:46 alexbaranosky: technomancy_, yeah that sounds necessary

Logging service provided by n01se.net