#clojure log - Aug 02 2011

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

0:01 pcavs: grant__: or maybe he should continue... heh

0:16 MasseR: How idiomatic is it to write macros in clojure. I think template haskell is relatively similar to macros, but there it's a tool for automatic type safety /code shortening, not something you'd consider for 99% for the projects

0:16 And, what does the stars in *foo* signify?

0:17 jonabbey: the stars signify that it is an unusual kind of thing, a var that is actually like to be redefined

0:17 likely

0:17 Creatures From The Black Saloon

0:17 Lizard Vision

0:17 ups, sorry, emacs error

0:18 but that's just convention.. the stars on their own mean nothing

0:18 technomancy: not redefined, just rebound

0:18 MasseR: Yup knowing convention helps reading the code :)

0:19 Pupeno: MasseR: what do you mean by how idiomatic?

0:21 MasseR: I usually prioritize things when learning languages. I was able to leave template haskell to "unknown point in future"

0:23 Pupeno: MasseR: ah… I see… well, no… writing macros in Lisp is essential. Don't start with them if the rest of the language still feels complex or weird, because they'll add complexity and weirdness, but don't skip it.

0:24 MasseR: you could actually write whole programs without ever creating a macro, but you'd be missing out the power of lisp. According to Paul Graham, 25% of Via Web, their web app, was macross.

0:24 pcavs: MasseR: I don't think I'm too off base by saying macros are the hardest part about lisp to "master" Not just writing them, but when and how to apply them, and then learning the different forms they can take.

0:25 MasseR: But like all things, your ability is the just the integral of effort over time

0:26 MasseR: Yup

0:31 dnolen: MasseR: macros are the best thing ever.

0:31 example, https://gist.github.com/1119599

0:31 Haskell lazy pattern matching semantics as a macro

0:32 Pupeno: pcavs: it gets easier over time… as a general rule when getting started… don't write a macro until it's bloody obvious you need one.

0:33 technomancy: _ato: are you interested in including a vagrant config in clojars-web to ease contributors getting their own hacking instances going?

0:35 Pupeno: any progress on the hacks? or ideas about what you'd like to tackle first?

0:35 _ato: technomancy: yeah, once you're happy with it let me know and I'll merge your branch

0:35 technomancy: _ato: will do

0:35 Pupeno: technomancy: no, since I last spoke here until 20 minutes ago I was sleeping… timezones! :P

0:35 technomancy: _ato: you think we should lock to an older version of lein?

0:36 Pupeno: aha; well I can't blame you then. =)

0:37 Pupeno: I'm checking out vagrant now. I'll try to figure out in the next hour or so if I feel comfortable hacking on this project. I'd probably get started with simple stuff like remember password or some other peripheral features.

0:37 Are you located in the US?

0:37 technomancy: Pupeno: yes, in Seattle

0:37 _ato: technomancy: not sure. I guess it might help prevent problems due to all the crazy maven deps but I guess ideally we should fix that in the project.clj if we can.

0:37 Pupeno: Ah, yes, you mentioned the Seattle Clojure user group.

0:37 technomancy: _ato: yeah, it seems like we should aim for compatibility

0:39 Pupeno: If you want an opinion: I do think it should be possible to do most of the stuff for developing without requiring a virtual machine and the way jars are uploaded sound too complex to me. But of course, until I read the code and see what's going on, it's just a guess on my side.

0:40 technomancy: Pupeno: I guess more than packages some people might be hesitant to set up a clojars user on their box

0:40 _ato: Pupeno: hiredman's been working a branch that doesn't use external ssh, but instead the Apache SSHD library. That should make it a lot easier just to run standalone without nailgun and pecial SSHD configuration

0:41 Pupeno: technomancy: indeed!

0:42 technomancy: hiredman: do you think the mina scp handler will require a unix-level clojars user?

0:43 Pupeno: _ato: this is how I'd develop it. I create a dedicated program that when run would scan a directory and process any jars, putting them into the db and deleting them. I'd run that program periodically. If it gets too slow due to start time I'd turn it into a deamon that use FAM or the like to watch said directory. Any reason it's not done like that?

0:44 technomancy: Pupeno: if scp writes to the fs, then it's hard to prevent users from overwriting files other users have written

0:45 Pupeno: technomancy: true… maybe it would be better to just upload through HTTP then… have an API.

0:46 technomancy: Pupeno: sure, and this is supported by the maven APIs

0:46 but it's much less work to write your own scp handler than interface with maven

0:46 that said, it would be cool if clojars could accept maven deployments

0:46 if it's something you feel strongly about ... might make a good place to start =)

0:47 talios: from the maven side - you should be able to write a scp based wagon implementation

0:47 technomancy: indonesian spam on debian-java-pkg, what the hell.

0:47 talios: http://maven.apache.org/wagon/wagon-providers/wagon-ssh/ already exists actually

0:48 deploys files to ssh servers - MIGHT work for clojars

0:48 Pupeno: technomancy: Oh, you mean supporting the same API as Maven does for receiving uploads? Maybe that'd be nice, but if it's too complex I'd stay away from and just write a simple API… I'd try to stay clear of Maven's complexity.

0:48 technomancy: Pupeno: well, it's all been implemented for you

0:48 it's just a matter of hooking it up

0:49 Pupeno: Maven receives uploads over SSH too?

0:50 Is this wagon-ssh thing the receiver or the sender?

0:50 technomancy: I doubt it's as simple as clojars-style "have a pom and a jar", but yes

0:50 talios: it can do. well - not receive, but send. http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html has examples of configuring maven to push/deploy via scp

0:51 technomancy: does lein have support for mavens build extensions? when you declare the wagon-ssh dep as an extension, you can have a repository definition of scpexe://

0:51 technomancy: talios: there's no explicit support, but it may come for free with the underlying deploy API

0:51 it's not hardcoded to https or anything

0:51 talios: oh wait - lein handles this already *fwap* - this is for pure maven foo is it that you want?

0:52 *nod*

0:56 Pupeno: Argh… the VirtualBox extension failed to install.

1:00 Ah, it's for VB 4.0, not 4.1.

1:02 technomancy: maybe it's better not to link to a specific version of the extension but to just link to http://www.virtualbox.org/wiki/Downloads and instruct to install the extension too ;)

1:02 technomancy: Pupeno: good point; I didn't know they were specific to minor point versions

1:02 4.1 wasn't out when I wrote this

1:03 I'm not even sure what the extension pack is for

1:03 Pupeno: Scotty… vagrant me up! :)

1:07 The image is downloading.

1:07 Who created this image?

1:07 http://dl.dropbox.com/u/7490647/talifun-ubuntu-11.04-server-i386.box ?

1:10 technomancy: I think it's a community vagrant box

1:11 MasseR: Got to get going, but was able to read this: http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-getting.html . I like to 'chew' on things when walking :P. On the shorter syntax, I gathered that ` starts implicit quoting. foo# is similar to c macros, expanding to name and ~foo is probably the value

1:11 Pupeno: Ah, ok.

1:12 MasseR: something yto check out as well: http://thinkrelevance.com/blog/2008/09/23/pcl-clojure-chapter-8.html

1:13 MasseR: Thanks

1:14 * Pupeno should re-read that.

1:16 Pupeno: I think I'll get started today with re-learning macros.

1:26 ibdknox: seancorfield: you here?

1:27 Pupeno: technomancy: that box seems to have guest additions for 4.0, not 4.1. I got a warning saying that the whole universe may end because of that.

1:29 technomancy: I did the improvement to the instructions: https://github.com/pupeno/clojars-web/commit/6c124f9f86225b1155e62a0eb4a830584a3f2165

1:56 Wow… it's really taking a while to provision the VM.

2:07 technomancy: the creation of the VM failed when compiling nailgun, I hope I fixed it here: https://github.com/pupeno/clojars-web/commit/e6b98de1757b0f19f36f5c73ce2f905e8a6a246c

2:08 Ok… off to work… see ya!

3:25 Pupeno_: Hello.

3:27 leonid: hi

4:14 penryu: I found a log from September where people were trying to keep SLIME from clobbering the paredit's binding of DEL to paredit-backward-delete, but no resolution here: http://clojure-log.n01se.net/date/2010-09-12.html

4:14 anyone have any more info on this?

4:39 Pupeno_: technomancy: ping?

4:40 triyo: I have a ClojureScript that references a third-party library, "Showdown" (js markdown port). It all works if I don't add the {:optimizations :advanced}. With advance optimization, I get a js error: "Uncaught TypeError: undefined is not a function" in this part "new Showdown.converter()"

4:41 I did an alert on Showdown object

4:41 and it returns [Object] which is good.

4:41 However if I alert Showdown.converter I get "undefined"

4:42 this is only if {:optimizations :advanced} is set

4:43 Here is my cljs function https://gist.github.com/1119832

4:43 I'd appreciate any input

4:47 I would have been much happier if the error was that it can't find Showdown reference, instead of it failing on .converter part. I would have then known that it can't find the Showdown lib.

5:27 pyr: morning

5:28 zarac: Hey folks!

5:31 I've recently been acquianted with clojure. What are some examples of what it's used for? Rather, what do you guys use it for?

5:33 hiredman: I use it to pipe irc messages (recieved in irssi running in screen on a host) into amazon sqs then use it on the other end to pull it down (on my laptop) and growl them

5:33 works great

5:36 babilen: zarac: What do you want to use it for?

5:39 MasseR: zarac: I'd say the same that's answered on haskell. "Yes it can do that", meaning that you could use clojure on whatever you want. With one caveat however, it takes an insane amount of time to start the jvm

5:39 So programs that you'd expect immediate response might not be a good fit

5:40 but servers, guis etc work fine

5:47 I must say clojure macros are a "wee bit" easier than template haskell :D

5:53 zarac: ah, ok, thanks : 0

5:53 : ) *

5:53 good answers =D

5:54 hiredman: what is (amazon) sqs ?

5:54 hiredman: http://aws.amazon.com/sqs/

5:54 zarac: thanks

5:55 ah, neat

6:48 wjlroe: Does anyone know how to sort out logging with ring (actually Noir) running in Tomcat? stdout isn't visible anywhere afaik

7:07 manutter: Hmm, Tomcat logging ... it's been a while

7:07 I seem to recall something about a catalina.log file, do you have something like that?

7:08 The "correct" solution is probably to install log4j or something

8:00 neotyk: Good morning everyone!

8:22 wjlroe: manutter: yeah so I got log4j running, but it seems to not be working afaik. (works in dev - not in tomcat). apparently catalina.out should have Standardout - but it doesn't (not from Noir/Compojure anyway)

8:25 manutter: Probably something needs to be configured in web.xml or something, but my java/tomcat skills are rusted away to nothing :(

8:51 wjlroe: Now I trying to get the context working - so / goes to my app. It's just not playing ball at all

9:11 Pupeno_: How do you access classes inside classes in Java?

9:11 in Clojure.

9:11 kumarshantanu: Pupeno_: OuterClass$InnerClass

9:12 Pupeno_: Do I have to import the inner class?

9:12 I do.

9:12 Thank s :)

9:26 pyr: when building servlet

9:26 with lein-ring

9:27 it's possible to have a handler that is a function, right ?

10:19 mattmitchell: ,(doc key)

10:19 clojurebot: "([e]); Returns the key of the map entry."

10:24 mattmitchell: how do you use the "key" function?

10:24 ,(key {:one 1})

10:24 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry>

10:25 Scriptor: ,(key (first {:a 1}))

10:25 clojurebot: :a

10:25 Scriptor: mattmitchell: ^

10:25 theignorati: is there a better way of doing (cons (.getChannel m) (cons (.getCommand m) (cons (.getData1 m) (cons (.getData2 m) '()))))?

10:25 mattmitchell: Scriptor: thanks

10:26 ,(first {:id 1})

10:26 clojurebot: [:id 1]

10:26 mattmitchell: ,(key [:id 1])

10:26 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>

10:26 mattmitchell: ,(class (first {:id 1}))

10:26 clojurebot: clojure.lang.MapEntry

10:26 mattmitchell: ahh, repl is playing tricks on me

10:26 (class [:id 1])

10:26 ,(class [:id 1])

10:26 clojurebot: clojure.lang.PersistentVector

10:27 Scriptor: theignorati: look into juxt

10:27 ,(doc juxt)

10:27 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

10:27 raek: theignorati: list*

10:27 oh, or in this case, 'list' will do

10:27 or you can just use a vector literal

10:28 (list (.getChannel m) (.getCommand m) (.getData1 m) (.getData2 m))

10:28 [(.getChannel m) (.getCommand m) (.getData1 m) (.getData2 m)]

10:29 you can call seq on that vector if you really want to hide the fact that it comes from a vector

10:30 theignorati: thanks!

11:12 mattmitchell: anyone use cake? is it still being developed?

11:17 pcavs: mattmitchell: looks like it, recent commits as of July 20th

11:17 mattmitchell: pcavs: cool ok

11:22 zvrba: i tried to install slime-clj in emacs, and I get a message about symbol's value being void: slime-clj

11:22 it seems that the slime-clj elpa package is mangled, and i can't even unistall it

11:25 hugod: zvrba: you probably don't really want slime-clj. If the package manage is having trouble removing it, you can rm -rf ~/.emacs.d/elpa/slime-clj

11:27 zvrba: hugod: but I want slime. so what do I do?

11:28 pcavs: zvrba: follow instructions here: https://github.com/technomancy/swank-clojure

11:29 zvrba: pcavs: I did.

11:29 pcavs: and when I execute clojure-jack-in, I get a message about swank-clj symbol as variable value being void

11:30 raek: zvrba: swank-clojure and swank-clj are not the same thing

11:30 the latter has been renamed recently

11:30 pcavs: confusing, but true

11:30 zvrba: I did also swank-clojure

11:30 but it ended up in .lein directory

11:31 raek: yes. swank-clojure is a lein plugin, slime is a emacs package

11:31 zvrba: and when I do clojure-jack-in, I get an error message

11:31 raek: (though there is a deprecated swank-clojure.el emacs package - don't install that)

11:32 zvrba: make sure you don't have any of the -clj emacs packages installed at the same time

11:32 zvrba: ok, it worked now

11:32 i deleted all previous slime packages from elpa directory

11:40 dnolen: it's looking like Clojure pattern matching is going to be pretty darn fast and quite a bit of fun

11:41 Scriptor: linky?

11:42 dnolen: Scriptor: you can follow here, https://github.com/swannodette/match/wiki/Design-Wiki

11:42 it's probably going to be a month or so before we cut v0.1, but it will already be useful. pattern matching on seqs is nearly 2X faster than destructuring them.

11:43 mattmitchell: zvrba: you got clojure-jack-in to work? all i get is a message "starting swank server", but it never actually starts it up

11:43 slime-connect works though

11:44 mefesto: dnolen: wow that's impressive! to think, i had no idea i was riding back to the airport with a clojure god :)

11:44 errm, from last clojure-conj that is

11:45 dnolen: you think at this clojure-conj you'll be doing a talk on this?

11:45 chouser: somebody better

11:45 dnolen: mefesto: I would not count myself amongst Clojure "gods" :) and ambrosebs has been helping out a lot on this.

11:46 mefesto: I pitched two talks one on core.logic another on predicate dispatch. If my talk gets accepted I'll probably just talk about this work anyway.

11:48 Scriptor: any word on student discounts at clojure conj? :)

11:48 zvrba: mattmitchell: yeah, i got it to work. under windows!

11:48 mattmitchell: zvrba: nice, i can't get past that message. hmm.

11:49 zvrba: well

11:49 what I did: physically deleted all previous slime/swank/clojure packages

11:49 and then followed instructions on the swank-clojure page

11:49 then it worked

11:49 mattmitchell: zvrba: ok i'll try that

11:55 zvrba: when i do that, i get an error in emacs when i start up... can't open/load "slime"

11:55 i think this is an emacs-starter-kit thing

12:08 neotyk: cemerick: are you here?

12:08 cemerick: Only nominally. :-)

12:09 neotyk: short question about schema support in rummage

12:09 cemerick: shoot

12:09 neotyk: how do I add set type, or some other list for a column?

12:10 most of fields we have are string and integer, only one that has to support multiple values

12:11 and I'm lost

12:14 * cemerick is re-reading his own code :-P

12:15 cemerick: neotyk: so, collection values are automatically handled as you'd expect, given sdb's semantics; I presume you're working with fixed-domain-schema, then?

12:15 neotyk: yes

12:16 I can get that thing out and store it in another domain, but would be nice to have it in original one

12:18 cemerick: You have records like {:always-a-long 5847578 :always-a-string "foo" :always-a-set #{:foo :bar}}?

12:18 mattmitchell: technomancy: when i exec clojure-jack-in, i get: "/bin/bash: lein: command not found" -- can i set the PATH env var in emacs so that it finds lein?

12:19 pcavs: mattmitchell: is this in windows? I'd imagine you'd need to add lein to your PATH var, wherever you've installed it

12:20 mattmitchell: this is os x

12:20 neotyk: cemerick: yes

12:20 pcavs: mattmitchell: cool, makes it easier

12:20 mattmitchell: pcavs: and lein is in my path, but it's looking at /bin/bash for some reason

12:20 cemerick: neotyk: Then I think using clojure.lang.Keyword there as the "column"'s value type would work.

12:20 pcavs: mattmitchell: oh weird...

12:20 hiredman: osx ignores the path you set in your shell

12:21 for .apps

12:21 neotyk: let me try

12:21 pcavs: hiredman: wow that is...hmmm....dumb?

12:21 mattmitchell: hiredman: dang, ok. anyway around that?

12:21 hiredman: the only way to change the path for .apps is to do some xml stuff

12:21 (setenv "PATH" "...")

12:22 pcavs: hiredman: well .apps are just directories with their own weird folder set up, I bet there's some googling/fixing up you could do, but might not be worth it. Are you using aquamacs or something mattmitchell?

12:22 technomancy: you can also do some silly add-to-list on exec-path

12:22 but yeah, it's a pretty annoying bug.

12:23 mattmitchell: i'm using the latest version of http://emacsformacosx.com/

12:23 23.3

12:23 technomancy: running -nw is a workaround

12:23 pcavs: I usually like doing -nw personally so I can use tmux/screen copy pasting as well

12:24 but you could always just symlink lein to wherever it's looking for it mattmitchell

12:24 drewr: technomancy: is using your slime+clojure-jack-in supposed to break slime-lisp-implementations or is that just a side-effect of not being supported?

12:24 mattmitchell: pcavs: that's true

12:26 anfab: am a java dev..would learning clojure primarily expand my programming depth or also increase my job opportunities?

12:28 dnolen: anfab: if you're Java dev I'm not sure how it will expand your job opportunities. will definitely expand programming depth.

12:31 chouser: anfab: if you only know java currently, there may be some "polyglot jobs" that would be within reach if you picked up a second language such as Clojure

12:32 anfab: chouser : by polygot jobs do you mean the ones that require to work on multiple things?

12:32 neotyk: cemerick: (class clojure.lang.Keyword) does not match class clojure.lang.LazySeq

12:32 cemerick: neotyk: well, c.l.Keyword *is* a class

12:33 chouser: anfab: yes, or shops that value that ability even if they currently only have code in a single language.

12:33 cemerick: Beyond that, it's possible I'm mis-remembering how I implemented the encoders — I *think* they get applied to every item in collection values, not to collections themselves.

12:33 chouser: anfab: oh sorry, polyglot means "multiple languages" not just multiple "things"

12:33 neotyk: cemerick: I guess easiest will be to move it to different domain

12:33 as this set is containing maps

12:34 cemerick: ah

12:34 anfab: chouser : hmm..okay..thanks

12:34 cemerick: neotyk: You'd need something like this for nested Clojure data structures: https://github.com/cemerick/rummage/issues/3

12:35 technomancy: drewr: unintentional. I thought slime-lisp-implementations was a CL thing; is that correct?

12:35 neotyk: cemerick: I do have it in my code already

12:35 cemerick: neotyk: However, even if that were available, you're losing all of the querying capabilities in sdb by going with a model like that.

12:37 neotyk: cemerick: I know this part is not to be queried by

12:37 I

12:37 'll move it to different domain

12:38 cemerick: neotyk: Yeah, that's one way out. Otherwise, I'd suggest pr-str'ing such values ahead of time, keeping in mind the sdb value size limits.

12:39 neotyk: cemerick: thanks

12:39 Noiano: hi

12:39 cemerick: neotyk: sure, FWIW :-)

12:39 neotyk: Good night everyone!

12:40 Noiano: I am trying to execute labrepl but I get a dependency error when executing lein deps. One artifact is missing " org.apache.maven:super-pom:jar:2.0"

12:40 what can I do?

12:41 technomancy: Noiano: change the clojure version to 1.3.0-beta1

12:42 and file a bug with labrepl

12:42 Noiano: technomancy, you may have guessed I am new to clojure so could you please be more specific about where to perform the version change?

12:44 technomancy: Noiano: oh, sure. in the file project.clj, change 1.3.0-master-SNAPSHOT to 1.3.0-beta1 under the line that starts with :dependencies

12:44 Noiano: perfect, let's see if it works :)

12:46 zvrba: what's new in clojure 1.3?

12:46 wjlroe: technomancy: I'm having weird problems with "lein compile" in that it will hang on Linux (works on OS X).

12:46 Any clues?

12:47 drewr: technomancy: I use it for clojure when outside lein

12:47 Noiano: technomancy, I did as you said but I get exactly the same error...want me to paste project.clj onto pastebin?

12:47 wjlroe: I'm using clj-riak and riak-client libraries. I'm gonna try using one then the other to see what is messing this up

12:49 Noiano: technomancy, false allarm, I just forgot to save the file :D

12:50 zvrba: hmm, it seems that recent swank+slime works much better than about 6 months ago

12:50 * zvrba happy :)

12:50 zvrba: at least it can find documentation properly

12:53 theignorati: what's a simple way for clojure applications to talk to eachother over the network?

12:53 and passing data

12:53 hiredman: https://github.com/hiredman/vespa-crabro

12:54 pcavs: protocol buffers/thrift/avro ?

12:54 hiredman: cool

12:54 technomancy: wjlroe: hard to say without details

12:55 theignorati: that involves java classes though and I'd like to avoid that

12:56 technomancy: theignorati: old contrib has a socket-repl you can use pretty easily

12:56 hard to avoid java classes

12:56 hiredman: theignorati: do you need a data format or a network connection?

12:56 theignorati: well proto generated classes or things like that

12:58 wjlroe: technomancy: yeah sorry. I've found it was the java-riak-client somehow, can't work out how it's managed to make the compile process hang though

13:53 gtrak: how does this destructuring work? (fn [req] (let [{:keys [status] :as response} (client req)] ...

13:54 'client' is the arg to the that returns this function

13:54 dakrone: gtrak: it pulls out the :status key from the map and binds it to the 'status' var, then the whole map is available as 'respose'

13:55 *response

13:56 gtrak: pulls out the :status key from the map returned by (client req)?

13:58 mefesto: ,(let [{:keys [fname lname] :as person} {:fname "John" :lname "Smith"}] [fname lname person])

13:58 clojurebot: ["John" "Smith" {:lname "Smith", :fname "John"}]

14:00 gtrak: I see, binds the symbols to the values at the keys of the same name

14:30 hv: how can I get the list of "require"d namespaces?

14:32 amalloy: &(doc all-ns)

14:32 lazybot: ⇒ "([]); Returns a sequence of all namespaces."

14:33 hv: amalloy: thanks

14:41 leonid_: are there any differences among &() ,() and #() ?

14:43 amalloy: leonid_: uh. what? a more verbose example please

14:44 leonid_: as in, typing in this channel

14:44 ,(+ 1 2 3)

14:44 clojurebot: 6

14:44 leonid_: &(+ 1 2 3)

14:44 lazybot: ⇒ 6

14:44 leonid_: #(+ 1 2 3)

14:44 ##(+ 1 2 3)

14:44 lazybot: ⇒ 6

14:44 leonid_: hmm

14:44 there are two bots ?!

14:44 amalloy: well, you've seen one difference already

14:45 the other is that ##(symbol "this") can appear anywhere in your message, up to ##(inc 2) times

14:45 lazybot: (symbol "this") ⇒ this

14:45 (inc 2) ⇒ 3

14:45 leonid_: i see

14:48 imade: hello, can anyone review my solution https://gist.github.com/1120880 to 4clojure problem http://www.4clojure.com/problem/28

14:50 leonid_: do you want to shorten the answer?

14:50 exactly what are you looking for?

14:50 amalloy: imade: fwiw, (lazy-cat x y) is pretty similar to (lazy-seq (concat x y))

14:50 leonid_: (i didn't use lazy-cat or lazy-seq on my 33 char solution

14:51 imade: amalloy: thanks, I will try to implement it with lazy-cat

14:55 yup works as expected and makes it more readable

15:05 mattmitchell: technomancy: is it possible for the lein repl to have tab completion?

15:06 technomancy: I think you can preseed rlwrap with a bunch of built-ins, but for context-sensitive completion you need swank or IDE integration or something

15:07 mattmitchell: technomancy: ok cool, just checkin

15:07 amalloy: technomancy: fwiw, cake repl has completion of function names

15:07 not sure how it works; i barely know how any of cake works

15:07 jweiss: anyone have org-mode working with clojure? my clojure-mode and swank all work fine, but clojure code blocks in org-mode don't work C-c C-c says "can do nothing useful at this location"

15:08 technomancy: amalloy: it doesn't use rlwrap

15:08 amalloy: ah, right. the ruby readline bindings

15:08 technomancy: it'd be sweet if Java suddenly decided not to pretend the command-line didn't exist

15:21 amalloy: hey leonid_, you were saying you had a really short solution to one of the #4clojure problems (aside from your rand-nth shenanigans), but i've forgotten which. do you know which one i'm talking about?

15:34 wunki: I know it's not much, but does anyone see what I did wrong by looking at this trace: https://gist.github.com/b76e1c84fffa02a5dbe9

15:34 I'm just trying to follow alonge here: http://devcenter.heroku.com/articles/clojure-web-application

15:40 carllerche: Are there any private hosted maven repos as a service available somewhere?

15:43 leonid_: amalloy: it's Last Element

15:44 Pupeno: What's the best way in Clojure to read a whole stream into a string?

15:45 mefesto: slurp ?

15:45 ,(doc slurp)

15:45 clojurebot: "([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."

15:45 Pupeno: Thanks.

15:46 arohner: oh cool, I didn't realize slurp uses reader now

15:47 mefesto: oh, yeah might want to check what version that happened in

15:47 ,*clojure-version*

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

15:47 amalloy: mefesto: 1.2

15:48 maybe 1.1, but it's certainly been around for longer than 1.3

15:48 mefesto: im running 1.2.1 and the docstring only says "Reads the file named by f". it doesn't mention the use of io/reader

15:50 amalloy: mefesto: i have no opinion on the docstring, but the source in 1.2.1 is clearly using reader

15:50 mefesto: amalloy: oh ok i guess they just clarified the docs

16:13 technomancy: I think the docs are fixed in git

16:15 proof that patches can still get applied

16:41 TimMc: Hooray for triple-escaping...

16:41 amalloy: rargh, why is it defn that parses out :arglists metadata, instead of fn? makes it a huge pain to get the right :arglists metadata attached to a custom def-whatever macro

16:42 i want it to expand into something like (let [foo* (fn [their-args] ...)] (defn foo [& args] (when (okay-to-do-stuff) (apply foo* args))), but i can't get the arglists right. i can't just wrap the body of their function with a (when), because they might have added some :pre or :post checking

16:42 TimMc: ,(.replaceAll "\\" "\\\\" "\\")

16:42 clojurebot: #<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 1>

16:46 technomancy: amalloy: I opened a ticket for that

16:47 amalloy: technomancy: any genius workaround in the meantime? i'm about to defn it, snag the metadata, and then ns-unmap it

16:47 which, ew

16:47 technomancy: can't think of a better solution

16:47 but yeah

16:48 amalloy: i considered stealing #'clojure.core/sigs, but that assumes that (fn [x] x) has already been homogenized into (fn ([x] x))

17:11 lpetit: hello

17:15 gtrak: in the map let destructuring, is there any difference between [{:keys (...) and [{:keys [...] ?

17:15 lpetit: gtrak: no

17:15 amalloy: gtrak: if () works, i wouldn't use it

17:16 gtrak: yea, seems awkward, but works

17:16 lpetit: gtrak: you can also try with #{}, which is semantically conveying that the order is unimportant

17:16 but longer to write

17:19 gtrak: I guess the macro takes care of it not being quoted, holy crap the destructure fn is complicated

17:19 lpetit: So 34kb is the average size of a hello world in clojurescript. Not sure I'll show this to my javascript/nodjs co-worker ...

17:19 gtrak: lpetit, using advanced mode?

17:19 lpetit: granted, clojurescript is not for hello worlds :-)

17:19 yes

17:19 gtrak: yes

17:24 dnolen: lpetit: that 5k, 6k gzipped and it grows pretty slowly. I started porting core.logic even after 500-600 lines it was still 34kb.

17:24 lpetit: dnolen: 34kb gzipped ?

17:24 dnolen: lpetit: no, 5-6k gzipped

17:25 anybody that's complaining about 34k of JS doesn't know jack squat about modern JS development.

17:25 amalloy: dnolen: did you include actual uses of core.logic? if not it was probably optimizing it all down to an empty string

17:25 dnolen: amalloy: it was all in there.

17:25 lpetit: so those 34kb are really the entry price, but does not at all represent anything wrt to the size of my code base, great

17:25 amalloy: yeah, seriously. ace.js is a megabyte

17:26 lpetit: That's what I wanted to read, thx guys

17:27 dnolen: for core.logic, will you manage 2 separate versions ?

17:28 dnolen: lpetit: porting core.logic to clojurescript is not a high priority for me, deep in pattern matching and predicate dispatch, but yes, there'll have to be a clojurescript branch, the biggest change is moving all the macros into a separate ns.

17:29 * hiredman still doesn't understand why that is required

17:29 lpetit: dnolen: oh yes, the macros must be written in clojure

17:30 dnolen: hiredman: unless the compiler is baked in I don't see how that could work.

17:30 lpetit: hiredman: because the compiler is in clojure, not in clojurescript ?

17:30 hiredman: uh, the reader reads in clojure forms, the compiler generates js

17:30 I don't understand why macro expansion can't sit in the middle there

17:31 amalloy: when it reads a defn, it emits javascript. it seems like it could easily choose to, when it reads in a defmacro, emit no javascript but change its internal state

17:31 lpetit: macroexpansion will probably use other helper fns. Where would they come from ?

17:31 amalloy: lpetit: those helper fns have to be there anyway, since the macro *expansion* is happening already

17:32 dnolen: amalloy: macroexpansion does not happen at the ClojureScript REPL at all.

17:32 lpetit: amalloy: what was the question, after all ? :)

17:33 dnolen: amalloy: er sorry I mean perhaps it does at the REPL, but macroexpand is not available at runtime, it's something the compiler does.

17:33 amalloy: dnolen: indeed, and i don't think i said it should be available at runtime

17:34 lpetit: ClojureScript is a more "classically" compiled language than Clojure. e.g. if I write a (println) at line one of a ClojureScript file, I'll have no immediate side effect, as is currently the case with Clojure.

17:34 dnolen: amalloy: then it's available at compile time like it is right now.

17:34 amalloy: dnolen: right. but why do macro definitions have to be in separate clj files, instead of cljs files?

17:35 just because you couldn't :require them from one cljs file to another?

17:35 i guess that would be a problem

17:37 lpetit: but it's not just that macros must be in separate files, right ? It's that macros must be written in Clojure. The fact that Clojure and ClojureScript share so much in common in terms of syntax facilitates writing macros for ClojureScript. Would the cljsc compiler have been writte in java, macros for cljs would have been harder to provide !

17:38 Or am I totally wrong ?

17:38 dnolen: I think the bigger point is, ClojureScript needs to be lightweight to run on mobile devices, websites, and to startup quickly as a shell script.

17:39 shipping the complier along with the runtime is clearly not in line with that goal at all.

17:39 gtrak: can't you use a macro in the compiler to split out the macros from cljs files that they're defined within?

17:39 code-is-data and all that?

17:40 dnolen: gtrak: I'm not sure what you're trying to say.

17:40 lpetit: So in ClojureScript, code is data, but data is not code (at runtime).

17:41 Or the opposite *grumpf*

17:41 hiredman: making macros available doesn't mean you need to ship a whole runtime and compiler

17:41 gtrak: you don't need to macroexpand at run-time, I'm basically saying what amalloy said I think, "it seems like ..."

17:42 dnolen: hiredman: I don't see where they would be available. The cljs reader√ is not something that ClojureScript compiler even uses as far as I can tell.

17:42 Scriptor: lpetit: code can be used and manipulated as clojurescript's data structures, these same datastructures can in turn be treated and run as code

17:42 dnolen: the reader is like JSON.decode for ClojureScript

17:43 lpetit: hiredman: granted, there certainly were several possibilities to not ship the compiler at runtime. Not writing the compiler in ClojureScript is certainly not a self-sufficient explanation.

17:44 Scriptor: no, not with ClojureScript

17:45 Scriptor: how so?

17:45 lpetit: Scriptor: compilation and execution, in ClojureScript, are not "intertwinned" as they are in Clojure (it's not a "one top level form at a time")

17:45 It's more "like" the AOT compilation process, if you want

17:46 (not totally true, since during AOT, you can still launch bombs via execution side effects ...

17:47 ... while during the ClojureScript compilation, you will only be able to launch bombs ... from the Clojure macros you may have written for your cljs code.

17:47 Scriptor: I think I see your point, but at least during compile-time code can be manipulated and run as needed

17:49 lpetit: Scriptor: only in the code which does the compilation. You will not be able to "launch bombs" while in the ClojureScript compilation phase, but if it is a side effect of calling a macro. Whose macro will have to be written in Clojure ... and reached from your cljs files.

17:50 gtrak: why wouldn't you be able to use a clojure macro to create macros from cljs source?

17:50 kumarshantanu: Can anybody tell how to specify heap size in Leiningen's project.clj?

17:51 esp when using with a plugin (lein-daemon in this case)

17:51 maacl: I get this error "TypeError: Cannot read property 'prototype' of undefined" when trying to run the nodehello demo from the ClojureScript demo- can anyone help?

17:51 dnolen: gtrak: because the compiler is not a part of the runtime.

17:52 lpetit: dnolen: someone with diagram skills should graphically represent what is happening with ClojureScript. Seems it would be appreciated by lots of people.

17:53 dnolen: in Clojure proper forms are compiled as they are encountered. The ClojureScript compiler is *whole program compilation*

17:53 lpetit: dnolen: Currently, I'm falling short of finding a good analogy to help explain the process.

17:53 dnolen: ^ ... whole program compilation, everything has to be there for it to work.

17:53 lpetit: dnolen: partly due to the fact that the Compiler is written in Clojure, this seems to blurr the lines for people

17:54 gtrak: dnolen, AOT compilation of stuff that uses macros works in clojure, yes?

17:54 dnolen: lpetit: partly, the other part is that the source is intended to be fed to Google Closure which is a *whole program JS compiler*

17:55 lpetit: dnolen: would be more precise to say "In Clojure proper, forms are compiled *and evaluated* as they are encountered"

17:55 dnolen: lpetit: Clojure is incrementally compiled. ClojureScript is not.

17:55 lpetit: dnolen: indeed, I imagine without that it could not be used with advanced settings to minify code

17:57 dnolen: indeed, if you draw the parallel between java bytecode and "JS after having been 'compiled' by goog"

17:57 ibdknox: the lack of use in ClojureScript makes me sad

17:57 any one of the contributors here that could explain that decision?

17:58 dnolen: ibdknox: use / require as fns?

17:58 lpetit: dnolen: question: in 'dev' mode, is the closure compiler used at all, or is it just a mode where the "raw javascript produced by the Clojure CLJS compiler" is output to files, along with the required js deps ?

17:58 ibdknox: lack of (use ...) or (:use ...) ?

17:58 ibdknox: both

17:59 dnolen: lpetit: ClojureScript REPL does pass stuff to the compiler I think.

17:59 lpetit: dnolen: ok, I'll have to check sometime

17:59 ibdknox: dnolen: hm? I wrote a (require) for brepl, but the way that has to work is at a level far below writing a require in CLJS itself

18:00 dnolen: ibdknox: I'm not sure about the lack of use, probably nobody's got around to it yet.

18:01 ibdknox: dnolen: it actually seems to be a conscious decision from the docs

18:02 maacl: I get this error "TypeError: Cannot read property 'prototype' of undefined" when trying to run the nodehello demo from the ClojureScript demo- can anyone help?

18:02 dnolen: ibdknox: link?

18:02 maacl: I'd check the ML that one's come up a lot.

18:03 maacl: dnolen: I will give that a try, thanks

18:03 lpetit: dnolen, ibdknox: to limit the risks of name collisions with other js scripts that may be installed on the "host html page" ?

18:04 ibdknox: lpetit: I would expect use to inject into the current namespace

18:04 lpetit: which in most cases shouldn't do anything unexpected

18:04 lpetit: ibdknox: oh yes indeed, sorry

18:05 ibdknox: dnolen: I guess it was about the more general case of having require/use functions

18:05 dnolen: for example here they're talking about the browser-connected repl

18:05 dnolen: https://github.com/clojure/clojurescript/blob/master/devnotes/bcrepl.org

18:05 Raynes: maacl, dnolen: Yeah, that's totally broken right now. I filed an issue on Jira about it a few days ago. If you check out to 6ead13e240f1c4f9b58013e4 it'll work.

18:05 It was the commit immediately after that one that asploded it.

18:06 maacl: Raynes: ok, thanks

18:06 dnolen: ibdknox: stuartsierra made it sound like core is interested in require as fn.

18:06 ibdknox: you'll have to inquire on clojure-dev about the fate of use, I'm curious myself.

18:07 ibdknox: dnolen: at first I didn't think it would matter that much, but it makes a huge difference in practice

18:07 I've been working on my client-side framework for CLJS

18:07 and having everything aliased is a lot of meaningless typing

18:08 dnolen: ibdknox: don't disagree at all.

18:08 lpetit: ibdknox: even with code completion ?

18:08 ibdknox: lpetit: even as an ex-PM for Visual Studio, I don't think tools should ever have to make up for things like that

18:08 lpetit: it works in Clojure, and I don't think there's a fundamental reason for it not working in CLJS

18:09 lpetit: ibdknox: what does "ex-PM" mean ?

18:09 ibdknox: not arguing on that

18:09 ibdknox: lpetit: I was the Program Manager in charge of C# and VB in the IDE

18:09 lpetit: left about 7 months ago

18:12 but yeah, if any of you guys are in the bay area, you should come to the bay area clojure group on thursday

18:12 lpetit: heh, this compiles fine in cljs: (defn hello [n] (cool-man n)) (defn cool-man [m] (str "Cool, " m))

18:13 ibdknox: I'll be previewing some of the stuff I've been working in CLJS

18:14 maacl: Raynes: Are you sure about that commit no? can't seem to locate

18:15 lpetit: ibdknox: can you help me understand the forces and limitations of brepl, currently ?

18:15 Raynes: maacl: cd3eaa959d09375c6ead13e240f1c4f9b58013e4 Try that.

18:16 lpetit: ibdknox: I have hard times understanding (not had the time to really test by myself) how far it pushes the "dynamic" limit forward (e.g. when will I be forced to stop sending forms one by one, and have to reload the whole page) ?

18:17 ibdknox: lpetit: you shouldn't need to reload the page unless the connection to the server is dropped, or if you're adding a new macro

18:17 lpetit: though I just got macros working locally, so that's not on github yet

18:17 maacl: Raynes: ah, yes much better - thanks

18:18 ibdknox: lpetit: as far as I know I have a complete superset of everything you can do in CLJS, with the exception of sending it through the Google Closure compiler

18:18 lpetit: ibdknox: fair enough for a "dev" mode

18:18 !

18:18 ibdknox: lpetit: I think so :)

18:19 lpetit: ibdknox: "or if you're adding a new macro" => it's not a technical limit, isn't it ?

18:19 s/isn't/is/

18:19 lazybot: <lpetit> ibdknox: "or if you're adding a new macro" => it's not a technical limit, is it ?

18:20 ibdknox: lpetit: I guess not, you just have to reload things files on the class path

18:20 -things

18:20 lpetit: idbknox: "adding a new macro" => since macros are in the "compiler" (in Clojure), what kind of support did you have to provide (currentl in your local repo) ?

18:21 ibdknox: lpetit: ah, you can't define macros in the repl itself, given the limits of CLJS

18:21 lpetit: you have to write macros in a file and run brepl from that dir

18:21 lpetit: so I guess that's a limitation, but that's at the level of ClojureScript not brepl

18:22 actually

18:22 lpetit: idbknox: isn't that because you're viewing the Clojure REPL and the underlying JVM as one single piece, whereas you could start different "REPL clients" for the same JVM, thus being able to have the CLJS REPL in one terminal, and a regular Clojure REPL in another

18:22 ?

18:23 ibdknox: lpetit: yeah, you could do that

18:23 lpetit: I think there might be an easier way though

18:23 lpetit: idbknox: tl;dr so I see no technical limitation, neither at the clojurescript nor the brepl levels

18:23 ibdknox: lpetit: the way I wrote brepl, I can interpret forms before they go to the compiler

18:24 lpetit: so if I captured defmacro, which is meaningless in cljs, I could go off onto some other code path

18:24 lpetit: ibdknox: so you can hook something to come back to the Clojure evaluator, e.g. like they did for :cljs/quit special keyword ?

18:24 ibdknox: lpetit: that's how my require works, yeah

18:25 lpetit: ibdknox: indeed, since I guess 99,99%+ usages of defmacros are top level usages

18:26 ibdknox: I want to sort out with Clojure/core guys what's going on with their browser-connected stuff though before I make that big of an investment in brepl

18:26 lpetit: ibdknox: that leaves open the question of "in which ns would you evaluate this defmacro" ?

18:26 amalloy: lpetit: :( - for any nontrivial macro i like to do (letfn [(helpers [x]...)] (defmacro my-macro [args] ...))

18:26 lpetit: amalloy : oh :)

18:26 99,98% then :-p

18:27 just kidding

18:27 amalloy: of course, letfn isn't implemented yet either, but i have (let [...] (defmacro ...)) too

18:28 dnolen: amalloy: what's the benefit of that style? seems unidiomatic to me.

18:28 ibdknox: I was wondering the same thing

18:28 lpetit: encapsulation, I guess

18:28 amalloy: dnolen: don't have to pollute the namespace with a bunch of helper functions that make no sense outside that macro's context

18:28 dnolen: amalloy: pollute how?

18:29 amalloy: dnolen: compared to the alternative of (defn helper [x] ...) (demacro my-thing [args] (... (helper args) ...))

18:29 dnolen: amalloy: also just hurts testability in my opinion for anything but the simplest macros.

18:29 lpetit: amalloy: defn- isn't enough then ?

18:30 dnolen: that's indeed more difficult to mock up things, I guess :)

18:30 clojurebot: two things are more than one thing

18:30 ibdknox: lol

18:30 lpetit: thx clojurebot

18:31 ibdknox: amalloy: out of curiosity, do you tend to do that with regular function definitions as well?

18:31 lpetit: What could be added to CCW to ease the use of ClojureScript users ? (Not just "what", but also "how would you see it implemented as a feature from a user's level ?")

18:32 hiredman: my clojure reader is one big letfn

18:33 lpetit: hiredman: for "pollution reason", or with perfs in mind ?

18:38 Do you have pointers wrt "Clojure/core & 'their' 'browser-connected stuff' WIP" ?

18:39 First time I read about it above ^^^

18:40 ibdknox: only a tweet and their notes

18:40 https://github.com/clojure/clojurescript/blob/master/devnotes/bcrepl.org

18:41 lpetit: tweet by who, btw (might have to follow if it's just not that I overlooked it) ?

18:44 why does he say "require mechanisms are out; the source that forms the repl’s environment will need to be updated and the page reloaded" ?

18:51 technomancy: do people not read things before they retweet them, or are there really that many people out there so confused that they are excited that clojure has a higher rate of growth than scala?

18:54 lpetit: technomancy: inc

18:56 * hiredman is apparently behind the tweet storm

18:57 lpetit: must leave, good night

18:58 technomancy: hiredman: haven't you heard? apparently clojure is bigger[1] than scala, java, and C++ combined

18:58 hiredman: using df -h?

18:58 technomancy: [1] when measured by growth in the community relative to four years ago

19:00 _ato: hehe from one person to 5000+ (mailing list). Man that's like 500000% growth.

19:01 technomancy: _ato: unprecedented![2]

19:01 [2] except by every other language with over 5000 users

19:05 amalloy: ibdknox: sometimes. with functions i expect the helper functions will more often be reusable, so i don't mind making them public

19:09 _ato: my completely unscientific graph: http://meshy.org/~ato/clojure-group-stats/ the growth fairly steady really. If anything it's very slowly decreasing although there's a bit of spike around the ClojureScript release time

19:11 technomancy: pretty steady otherwise

19:11 oh, but barely over a year

19:11 _ato: yeah, sadly I don't have the full history. I should try to extract it from the Internet Archive

19:12 livingston: hey, where do I find (doc ..) now in 1.3?

19:19 amalloy: ibdknox: but see, for example, https://github.com/flatland/useful/blob/develop/src/useful/map.clj#L5 - putting this anywhere but a let around keyed seems silly

19:21 ibdknox: amalloy: fair enough

19:22 technomancy: _ato: 950 in november of 08 when I joined

19:24 tmciver: Hi all. Noob question: why does the following work

19:24 &(filter #(< % 5) '(1 2 3 4 5 6 7 8 9))

19:24 lazybot: ⇒ (1 2 3 4)

19:24 tmciver: this doesn't

19:25 &(filter #(< % 5) (iterate inc 1))

19:25 lazybot: Execution Timed Out!

19:25 technomancy: ,(take 4 (filter #(< % 5) (iterate inc 1)))

19:25 clojurebot: (1 2 3 4)

19:25 livingston: tmciver: how is it supposed to know that it only counts up?

19:25 and thus can stop after only 4.

19:26 tmciver: How does it know it only counts up? (iterate inc 1)

19:26 livingston: filter doesn't know that - it will check them all.

19:27 tmciver: Ahhh!

19:27 technomancy: there's always (:use [clojure.contrib.turing :only [halting?]]), but I don't think it's been modularized for 1.3

19:28 tmciver: I thought I remember reading that the repl will force the realization of the lazy seq. I was expecting to see it print (1 2 3 4).

19:28 livingston: ha. speaking of 1.3 ... bump: where did the doc function end up?

19:28 hiredman: macro

19:28 in clojure.repl I believe

19:29 technomancy: tmciver: if you did doseq over the infinite seq, it would

19:29 tmciver: Ah, OK. Thanks again!

19:29 livingston: hiredman: thanks - a ns I didn't know I needed.

19:30 amalloy: technomancy: huh. i was actually looking up the proof of the halting problem's undecidability while you guys in here started talking about it

19:30 hiredman: ~halting problem

19:30 clojurebot: not a problem, the average bid for it on getacoder is $821.00

19:31 livingston: well, the particular case in question *could* be optimized into the compiler, but I don't know why you'd bother.

19:32 TimMc: Oh man, I want to put that on getacoder.

19:33 hiredman: someone did and that was the bid

19:35 livingston: it's worth doing as a screen. don't accept bids from any of those people on a real problem.

19:36 TimMc: hiredman: Awesome.

19:37 tmciver: technomancy, livingston: I was confusing myself earlier when I did (take 10 (filter #(< % 5) (iterate inc 1))) which froze the repl. I guess you're not suppose to take more than is in the sequence . . .

19:37 livingston: ,(take 10 '(a b c))

19:37 clojurebot: (a b c)

19:37 hiredman: it's sill an infinite sequence

19:37 livingston: sure you can

19:37 hiredman: filter just never yields another value

19:38 tmciver: livingston, Hmmm

19:38 livingston: tmciver: what hiredman is pointing out is that it will go looking forever for the 5th value which is never to be found

19:39 hiredman: given an arbitrary infinite sequence of numbers, if you remove all values less than 5, how long is the sequence?

19:39 tmciver: livingston, hiredman: OK, but it works in your example because it's not an infinite sequence.

19:39 livingston: this is fine: ,(take 10 (iterate inc 1))

19:40 take keeps going until it gets it's fill or hits the end.

19:40 ,(doc take)

19:40 clojurebot: "([n coll]); Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n."

19:41 tmciver: livingston, hiredman: Thanks. I *think* I got it now.

19:41 raek: well, the repl is the thing that keeps going until it gets the end of the seq

19:42 livingston: raek: true, you could probably def that into something without trouble, until you went looking for the 5th one...

19:42 raek: (first (remove odd? (remove even? (range)))) <-- the first natural number which is both even and odd

19:43 amalloy: tmciver: i don't think anyone's mentioned it yet, but the function you're probably looking for is ##(doc take-while)

19:43 lazybot: ⇒ "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."

19:43 raek: all natural numbers will be searched but none will match the criterias

19:44 livingston: raek: well, as long as it's only the natural ones ;)

19:44 tmciver: amalloy: yes, I was just playing around with that too.

20:07 livingston: is doseq the equivalent of common-lisp's mapc and the preferred way to iterate for side effects?

20:15 carlo_au: is macroexpand-all in core in clojure 1.2?

20:16 amalloy: carlo_au: no. clojure.walk

20:17 carlo_au: so I would call it with (clojure.walk/macroexpand-1 'sdfsd ) ?

20:18 ah, that works, thanks amalloy

20:18 amalloy: you asked about -all, and now -1. they're not in the same place

20:22 carlo_au: sorry, I meant clojure.walk/macroexpand-all

20:22 livingston: If I (dorun (map fn huge-list)) and huge-list is lazy I should just go through huge-list one at a time and if I have memory for one I have memory for all (assuming fn is comparable) right?

22:09 tomoj: wasn't there once a snippet to find all classes implementing an interface?

22:21 pdk: ,(+ 25.9 3.4)

22:21 clojurebot: 29.299999999999997

22:22 romanandreg: hey guys... coming from Haskell here, does anyone here knows what hoogle is, and if so, do you know if there is an equivalent thing for clojure?

22:22 I'm having issues getting familiar with the documentation

22:22 brehaut: romanandreg: theres nothing as sohpisticated as hoogle

22:22 romanandreg: but clojuredocs.org is useful

22:22 romanandreg: brehaut: checking out...

22:23 brehaut: romanandreg: its not really possible to do type based doc queries for clojure

22:23 romanandreg: however you might find lazybot's $findfn command useful

22:23 $findfn inc [1 2 3] [2 3 4]

22:23 lazybot: [clojure.core/map clojure.core/pmap clojure.core/keep]

22:24 romanandreg: brehaut: it's something :-|

22:24 brehaut: thanks :-)

22:27 brehaut: romanandreg: from there repl there is also find-doc and apropos (in clojure.core and clojure.repl respectively)

22:27 eg ##(apropos 'map)

22:27 lazybot: java.lang.Exception: Unable to resolve symbol: apropos in this context

22:28 brehaut: ##(use 'clojure.repl)

22:28 lazybot: ⇒ nil

22:28 brehaut: ##(apropos 'map)

22:28 lazybot: ⇒ (map-invert pprint-map *symbol-map* make-map build-request-map map-keys partition-map mapcat-chain write-concern-map sorted-map ns-unmap zipmap map mapcat sorted-map-by map? amap struct-map proxy-mappings pmap map-indexed ns-map array-map hash-map unzip-map map-pass... http://gist.github.com/1121767

22:34 romanandreg: (doc zip)

22:34 clojurebot: Gabh mo leithscéal?

22:34 romanandreg: (doc 'zip)

22:34 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>

22:34 romanandreg: (doc filter)

22:34 clojurebot: "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."

22:34 brehaut: romanandreg: you are looking for map

22:35 romanandreg: brehaut: nope... just playing with clojurebot

22:35 brehaut: romanandreg: ok then :)

22:35 romanandreg: brehaut: I'm kind of confused, don't know when to use 'symbol, and when to use only symbol

22:35 g.e apropos require the "'"

22:35 leonid_: you can pm clojurebot if you don't want to clutter up the channel with spam

22:35 romanandreg: while doc doesn't

22:35 brehaut: romanandreg: basicly always use symbol except for use and require

22:36 romanandreg: brehaut: symbol meaning... not using "'"

22:36 ?

22:36 brehaut: yeah

22:36 sorry

22:36 only use the quote on a symbol when you want the symbol itself, rather than waht it is bound to

22:36 romanandreg: brehaut: ok, makes sense

22:38 brehaut: romanandreg: you need to use quote on use and require (when they arent part of a ns form) because at the time you use them, they havent been important, so the symbols are unbound (im probably wrong in the details, but its close enoguh in practise)

22:39 romanandreg: however, to throw a bit of extra confusion in there, import never needs the quote

22:39 romanandreg: brehaut: is the reason that the ns form doesn't require the "'" related to the fact that ns is a macro?

22:39 brehaut: romanandreg: i believe so

22:39 romanandreg: brehaut: lol... I found the requiring functions are a bit hard to remember

22:40 brehaut: coming from Haskell where you have more or less the same features, I found clojure's a bit more... maybe complicated?

22:40 brehaut: romanandreg: mostly you want require

22:40 use is more useful in a repl

22:40 and import is for java

22:41 romanandreg: yes... require with the :only, :except or :as options

22:41 brehaut: yup

22:42 romanandreg: brehaut: btw... nice post on the clojure web stack.

22:42 brehaut: romanandreg: thanks :) also i dont know if :only makes sense with require

22:43 romanandreg: brehaut: kind of want to steal your blog stylesheets as well hehe :-p

22:43 brehaut: id rather you didnt ;)

22:43 franchise is a great font though

22:44 romanandreg: brehaut: hehehehe... just thinking outloud... yeah the effect on the links where it get's all white with the transition

22:44 nice touch

22:44 brehaut: and the font helps a lot

22:44 brehaut: thanks

22:44 romanandreg: brehaut: how long have you been coding clojure?

22:45 brehaut: sort of 3 years, but properly about 1.5

22:45 romanandreg: brehaut: have you seen it getting a lot of traction lately?

22:45 brehaut: yeah; its kind of hard not too :)

22:45 romanandreg: brehaut: I'm just getting in... so I'm curious

22:48 brehaut: well, there are clojure jobs in new zealand, so i think that means its got some traction ;)

22:48 romanandreg: brehaut: I've seen a lot of posts asking for Clojure/Scala... that's why I started to pay a bit of attention to it

22:50 brehaut: that and the inevitability of Lisp dialects

22:59 ferd: newbie playing with some clojure constructs... Help: why do I get a NPE when evaluating the following?:

22:59 (doseq [x (list (fn [] (println 1)) (fn [] (println 2)))] ((x)))

23:00 brehaut: ferd doseq is a comprehension notation; your list is automatically unpacked

23:01 ,(doseq [x [(fn [] (println 1)) (fn [] (println 2))]] (x))

23:01 clojurebot: 1

23:01 2

23:01 brehaut: ferd: dropping the second set of parens wrapping x does what you want

23:01 ferd: you would only need the second set if x returned a function

23:02 ferd: ahh

23:02 brehaut: ferd: its also idiomatic ot use a literal vector rather than a list for that sort of thing too

23:02 ferd: thanks a lot!!

23:03 brehaut: ferd: just for completeness ##(doseq [x [(fn [] (fn [] (println 1))) (fn [] (fn [] (println 2)))]] ((x)))

23:03 lazybot: ⇒ 1 2 nil

23:03 ferd: got it. Works now: (doseq [x [(fn [] (println 1)) (fn [] (println 2))]] (x))

23:04 brehaut: ferd: and if you were to do this seriously, you would just use a do ##(do (println 1) (println 2))

23:04 lazybot: ⇒ 1 2 nil

23:05 ferd: brehaut: Thanks again... I think you retained the double parents on your first one

23:05 "do" ? let me see that one

23:05 brehaut: (do (println 1) (println 2))

23:06 ferd: I meant, let me learn it from the docs :-)

23:06 (newbie newbie if you didn't realize yet)

23:06 brehaut: no problem

23:07 ferd: that's fine... I need doseq cause the list of functions will be dynamic

23:08 I pasted here a small version of what I'm doing to make it fit in the chat

23:08 brehaut: sure

23:24 tomoj: are there any good ways to make keyword typos less of an issue, besides making fewer typos?

23:27 I guess there are just all the good ways to find bugs

Logging service provided by n01se.net