#clojure logs

2011-08-02

00:01pcavsgrant__: or maybe he should continue... heh
00:16MasseRHow 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
00:16MasseRAnd, what does the stars in *foo* signify?
00:17jonabbeythe stars signify that it is an unusual kind of thing, a var that is actually like to be redefined
00:17jonabbeylikely
00:17jonabbeyCreatures From The Black Saloon
00:17jonabbeyLizard Vision
00:17jonabbeyups, sorry, emacs error
00:18jonabbeybut that's just convention.. the stars on their own mean nothing
00:18technomancynot redefined, just rebound
00:18MasseRYup knowing convention helps reading the code :)
00:19PupenoMasseR: what do you mean by how idiomatic?
00:21MasseRI usually prioritize things when learning languages. I was able to leave template haskell to "unknown point in future"
00:23PupenoMasseR: 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.
00:24PupenoMasseR: 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.
00:24pcavsMasseR: 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.
00:25pcavsMasseR: But like all things, your ability is the just the integral of effort over time
00:26MasseRYup
00:31dnolenMasseR: macros are the best thing ever.
00:31dnolenexample, https://gist.github.com/1119599
00:31dnolenHaskell lazy pattern matching semantics as a macro
00:32Pupenopcavs: 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.
00:33technomancy_ato: are you interested in including a vagrant config in clojars-web to ease contributors getting their own hacking instances going?
00:35technomancyPupeno: any progress on the hacks? or ideas about what you'd like to tackle first?
00:35_atotechnomancy: yeah, once you're happy with it let me know and I'll merge your branch
00:35technomancy_ato: will do
00:35Pupenotechnomancy: no, since I last spoke here until 20 minutes ago I was sleeping… timezones! :P
00:35technomancy_ato: you think we should lock to an older version of lein?
00:36technomancyPupeno: aha; well I can't blame you then. =)
00:37PupenoI'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.
00:37PupenoAre you located in the US?
00:37technomancyPupeno: yes, in Seattle
00:37_atotechnomancy: 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.
00:37PupenoAh, yes, you mentioned the Seattle Clojure user group.
00:37technomancy_ato: yeah, it seems like we should aim for compatibility
00:39PupenoIf 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.
00:40technomancyPupeno: I guess more than packages some people might be hesitant to set up a clojars user on their box
00:40_atoPupeno: 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
00:41Pupenotechnomancy: indeed!
00:42technomancyhiredman: do you think the mina scp handler will require a unix-level clojars user?
00:43Pupeno_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?
00:44technomancyPupeno: if scp writes to the fs, then it's hard to prevent users from overwriting files other users have written
00:45Pupenotechnomancy: true… maybe it would be better to just upload through HTTP then… have an API.
00:46technomancyPupeno: sure, and this is supported by the maven APIs
00:46technomancybut it's much less work to write your own scp handler than interface with maven
00:46technomancythat said, it would be cool if clojars could accept maven deployments
00:46technomancyif it's something you feel strongly about ... might make a good place to start =)
00:47taliosfrom the maven side - you should be able to write a scp based wagon implementation
00:47technomancyindonesian spam on debian-java-pkg, what the hell.
00:47talioshttp://maven.apache.org/wagon/wagon-providers/wagon-ssh/ already exists actually
00:48taliosdeploys files to ssh servers - MIGHT work for clojars
00:48Pupenotechnomancy: 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.
00:48technomancyPupeno: well, it's all been implemented for you
00:48technomancyit's just a matter of hooking it up
00:49PupenoMaven receives uploads over SSH too?
00:50PupenoIs this wagon-ssh thing the receiver or the sender?
00:50technomancyI doubt it's as simple as clojars-style "have a pom and a jar", but yes
00:50taliosit 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
00:51taliostechnomancy: 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://
00:51technomancytalios: there's no explicit support, but it may come for free with the underlying deploy API
00:51technomancyit's not hardcoded to https or anything
00:51taliosoh wait - lein handles this already *fwap* - this is for pure maven foo is it that you want?
00:52talios*nod*
00:56PupenoArgh… the VirtualBox extension failed to install.
01:00PupenoAh, it's for VB 4.0, not 4.1.
01:02Pupenotechnomancy: 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 ;)
01:02technomancyPupeno: good point; I didn't know they were specific to minor point versions
01:02technomancy4.1 wasn't out when I wrote this
01:03technomancyI'm not even sure what the extension pack is for
01:03PupenoScotty… vagrant me up! :)
01:07PupenoThe image is downloading.
01:07PupenoWho created this image?
01:07Pupenohttp://dl.dropbox.com/u/7490647/talifun-ubuntu-11.04-server-i386.box ?
01:10technomancyI think it's a community vagrant box
01:11MasseRGot 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
01:11PupenoAh, ok.
01:12PupenoMasseR: something yto check out as well: http://thinkrelevance.com/blog/2008/09/23/pcl-clojure-chapter-8.html
01:13MasseRThanks
01:16PupenoI think I'll get started today with re-learning macros.
01:26ibdknoxseancorfield: you here?
01:27Pupenotechnomancy: 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.
01:29Pupenotechnomancy: I did the improvement to the instructions: https://github.com/pupeno/clojars-web/commit/6c124f9f86225b1155e62a0eb4a830584a3f2165
01:56PupenoWow… it's really taking a while to provision the VM.
02:07Pupenotechnomancy: the creation of the VM failed when compiling nailgun, I hope I fixed it here: https://github.com/pupeno/clojars-web/commit/e6b98de1757b0f19f36f5c73ce2f905e8a6a246c
02:08PupenoOk… off to work… see ya!
03:25Pupeno_Hello.
03:27leonidhi
04:14penryuI 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
04:14penryuanyone have any more info on this?
04:39Pupeno_technomancy: ping?
04:40triyoI 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()"
04:41triyoI did an alert on Showdown object
04:41triyoand it returns [Object] which is good.
04:41triyoHowever if I alert Showdown.converter I get "undefined"
04:42triyothis is only if {:optimizations :advanced} is set
04:43triyoHere is my cljs function https://gist.github.com/1119832
04:43triyoI'd appreciate any input
04:47triyoI 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.
05:27pyrmorning
05:28zaracHey folks!
05:31zaracI've recently been acquianted with clojure. What are some examples of what it's used for? Rather, what do you guys use it for?
05:33hiredmanI 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
05:33hiredmanworks great
05:36babilenzarac: What do you want to use it for?
05:39MasseRzarac: 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
05:39MasseRSo programs that you'd expect immediate response might not be a good fit
05:40MasseRbut servers, guis etc work fine
05:47MasseRI must say clojure macros are a "wee bit" easier than template haskell :D
05:53zaracah, ok, thanks : 0
05:53zarac: ) *
05:53zaracgood answers =D
05:54zarachiredman: what is (amazon) sqs ?
05:54hiredmanhttp://aws.amazon.com/sqs/
05:54zaracthanks
05:55zaracah, neat
06:48wjlroeDoes anyone know how to sort out logging with ring (actually Noir) running in Tomcat? stdout isn't visible anywhere afaik
07:07manutterHmm, Tomcat logging ... it's been a while
07:07manutterI seem to recall something about a catalina.log file, do you have something like that?
07:08manutterThe "correct" solution is probably to install log4j or something
08:00neotykGood morning everyone!
08:22wjlroemanutter: 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)
08:25manutterProbably something needs to be configured in web.xml or something, but my java/tomcat skills are rusted away to nothing :(
08:51wjlroeNow I trying to get the context working - so / goes to my app. It's just not playing ball at all
09:11Pupeno_How do you access classes inside classes in Java?
09:11Pupeno_in Clojure.
09:11kumarshantanuPupeno_: OuterClass$InnerClass
09:12Pupeno_Do I have to import the inner class?
09:12Pupeno_I do.
09:12Pupeno_Thank s :)
09:26pyrwhen building servlet
09:26pyrwith lein-ring
09:27pyrit's possible to have a handler that is a function, right ?
10:19mattmitchell,(doc key)
10:19clojurebot"([e]); Returns the key of the map entry."
10:24mattmitchellhow do you use the "key" function?
10:24mattmitchell,(key {:one 1})
10:24clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry>
10:25Scriptor,(key (first {:a 1}))
10:25clojurebot:a
10:25Scriptormattmitchell: ^
10:25theignoratiis there a better way of doing (cons (.getChannel m) (cons (.getCommand m) (cons (.getData1 m) (cons (.getData2 m) '()))))?
10:25mattmitchellScriptor: thanks
10:26mattmitchell,(first {:id 1})
10:26clojurebot[:id 1]
10:26mattmitchell,(key [:id 1])
10:26clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>
10:26mattmitchell,(class (first {:id 1}))
10:26clojurebotclojure.lang.MapEntry
10:26mattmitchellahh, repl is playing tricks on me
10:26mattmitchell(class [:id 1])
10:26mattmitchell,(class [:id 1])
10:26clojurebotclojure.lang.PersistentVector
10:27Scriptortheignorati: look into juxt
10:27Scriptor,(doc juxt)
10:27clojurebot"([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:27raektheignorati: list*
10:27raekoh, or in this case, 'list' will do
10:27raekor you can just use a vector literal
10:28raek(list (.getChannel m) (.getCommand m) (.getData1 m) (.getData2 m))
10:28raek[(.getChannel m) (.getCommand m) (.getData1 m) (.getData2 m)]
10:29raekyou can call seq on that vector if you really want to hide the fact that it comes from a vector
10:30theignoratithanks!
11:12mattmitchellanyone use cake? is it still being developed?
11:17pcavsmattmitchell: looks like it, recent commits as of July 20th
11:17mattmitchellpcavs: cool ok
11:22zvrbai tried to install slime-clj in emacs, and I get a message about symbol's value being void: slime-clj
11:22zvrbait seems that the slime-clj elpa package is mangled, and i can't even unistall it
11:25hugodzvrba: 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:27zvrbahugod: but I want slime. so what do I do?
11:28pcavszvrba: follow instructions here: https://github.com/technomancy/swank-clojure
11:29zvrbapcavs: I did.
11:29zvrbapcavs: and when I execute clojure-jack-in, I get a message about swank-clj symbol as variable value being void
11:30raekzvrba: swank-clojure and swank-clj are not the same thing
11:30raekthe latter has been renamed recently
11:30pcavsconfusing, but true
11:30zvrbaI did also swank-clojure
11:30zvrbabut it ended up in .lein directory
11:31raekyes. swank-clojure is a lein plugin, slime is a emacs package
11:31zvrbaand when I do clojure-jack-in, I get an error message
11:31raek(though there is a deprecated swank-clojure.el emacs package - don't install that)
11:32raekzvrba: make sure you don't have any of the -clj emacs packages installed at the same time
11:32zvrbaok, it worked now
11:32zvrbai deleted all previous slime packages from elpa directory
11:40dnolenit's looking like Clojure pattern matching is going to be pretty darn fast and quite a bit of fun
11:41Scriptorlinky?
11:42dnolenScriptor: you can follow here, https://github.com/swannodette/match/wiki/Design-Wiki
11:42dnolenit'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:43mattmitchellzvrba: you got clojure-jack-in to work? all i get is a message "starting swank server", but it never actually starts it up
11:43mattmitchellslime-connect works though
11:44mefestodnolen: wow that's impressive! to think, i had no idea i was riding back to the airport with a clojure god :)
11:44mefestoerrm, from last clojure-conj that is
11:45mefestodnolen: you think at this clojure-conj you'll be doing a talk on this?
11:45chousersomebody better
11:45dnolenmefesto: I would not count myself amongst Clojure "gods" :) and ambrosebs has been helping out a lot on this.
11:46dnolenmefesto: 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:48Scriptorany word on student discounts at clojure conj? :)
11:48zvrbamattmitchell: yeah, i got it to work. under windows!
11:48mattmitchellzvrba: nice, i can't get past that message. hmm.
11:49zvrbawell
11:49zvrbawhat I did: physically deleted all previous slime/swank/clojure packages
11:49zvrbaand then followed instructions on the swank-clojure page
11:49zvrbathen it worked
11:49mattmitchellzvrba: ok i'll try that
11:55mattmitchellzvrba: when i do that, i get an error in emacs when i start up... can't open/load "slime"
11:55mattmitchelli think this is an emacs-starter-kit thing
12:08neotykcemerick: are you here?
12:08cemerickOnly nominally. :-)
12:09neotykshort question about schema support in rummage
12:09cemerickshoot
12:09neotykhow do I add set type, or some other list for a column?
12:10neotykmost of fields we have are string and integer, only one that has to support multiple values
12:11neotykand I'm lost
12:15cemerickneotyk: 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:15neotykyes
12:16neotykI can get that thing out and store it in another domain, but would be nice to have it in original one
12:18cemerickYou have records like {:always-a-long 5847578 :always-a-string "foo" :always-a-set #{:foo :bar}}?
12:18mattmitchelltechnomancy: 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:19pcavsmattmitchell: is this in windows? I'd imagine you'd need to add lein to your PATH var, wherever you've installed it
12:20mattmitchellthis is os x
12:20neotykcemerick: yes
12:20pcavsmattmitchell: cool, makes it easier
12:20mattmitchellpcavs: and lein is in my path, but it's looking at /bin/bash for some reason
12:20cemerickneotyk: Then I think using clojure.lang.Keyword there as the "column"'s value type would work.
12:20pcavsmattmitchell: oh weird...
12:20hiredmanosx ignores the path you set in your shell
12:21hiredmanfor .apps
12:21neotyklet me try
12:21pcavshiredman: wow that is...hmmm....dumb?
12:21mattmitchellhiredman: dang, ok. anyway around that?
12:21hiredmanthe only way to change the path for .apps is to do some xml stuff
12:21hiredman(setenv "PATH" "...")
12:22pcavshiredman: 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:22technomancyyou can also do some silly add-to-list on exec-path
12:22technomancybut yeah, it's a pretty annoying bug.
12:23mattmitchelli'm using the latest version of http://emacsformacosx.com/
12:23mattmitchell23.3
12:23technomancyrunning -nw is a workaround
12:23pcavsI usually like doing -nw personally so I can use tmux/screen copy pasting as well
12:24pcavsbut you could always just symlink lein to wherever it's looking for it mattmitchell
12:24drewrtechnomancy: 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:24mattmitchellpcavs: that's true
12:26anfabam a java dev..would learning clojure primarily expand my programming depth or also increase my job opportunities?
12:28dnolenanfab: if you're Java dev I'm not sure how it will expand your job opportunities. will definitely expand programming depth.
12:31chouseranfab: 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:32anfabchouser : by polygot jobs do you mean the ones that require to work on multiple things?
12:32neotykcemerick: (class clojure.lang.Keyword) does not match class clojure.lang.LazySeq
12:32cemerickneotyk: well, c.l.Keyword *is* a class
12:33chouseranfab: yes, or shops that value that ability even if they currently only have code in a single language.
12:33cemerickBeyond 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:33chouseranfab: oh sorry, polyglot means "multiple languages" not just multiple "things"
12:33neotykcemerick: I guess easiest will be to move it to different domain
12:33neotykas this set is containing maps
12:34cemerickah
12:34anfabchouser : hmm..okay..thanks
12:34cemerickneotyk: You'd need something like this for nested Clojure data structures: https://github.com/cemerick/rummage/issues/3
12:35technomancydrewr: unintentional. I thought slime-lisp-implementations was a CL thing; is that correct?
12:35neotykcemerick: I do have it in my code already
12:35cemerickneotyk: However, even if that were available, you're losing all of the querying capabilities in sdb by going with a model like that.
12:37neotykcemerick: I know this part is not to be queried by
12:37neotykI
12:37neotyk'll move it to different domain
12:38cemerickneotyk: 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:39neotykcemerick: thanks
12:39Noianohi
12:39cemerickneotyk: sure, FWIW :-)
12:39neotykGood night everyone!
12:40NoianoI 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:40Noianowhat can I do?
12:41technomancyNoiano: change the clojure version to 1.3.0-beta1
12:42technomancyand file a bug with labrepl
12:42Noianotechnomancy, you may have guessed I am new to clojure so could you please be more specific about where to perform the version change?
12:44technomancyNoiano: 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:44Noianoperfect, let's see if it works :)
12:46zvrbawhat's new in clojure 1.3?
12:46wjlroetechnomancy: I'm having weird problems with "lein compile" in that it will hang on Linux (works on OS X).
12:46wjlroeAny clues?
12:47drewrtechnomancy: I use it for clojure when outside lein
12:47Noianotechnomancy, I did as you said but I get exactly the same error...want me to paste project.clj onto pastebin?
12:47wjlroeI'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:49Noianotechnomancy, false allarm, I just forgot to save the file :D
12:50zvrbahmm, it seems that recent swank+slime works much better than about 6 months ago
12:50zvrbaat least it can find documentation properly
12:53theignoratiwhat's a simple way for clojure applications to talk to eachother over the network?
12:53theignoratiand passing data
12:53hiredmanhttps://github.com/hiredman/vespa-crabro
12:54pcavsprotocol buffers/thrift/avro ?
12:54pcavshiredman: cool
12:54technomancywjlroe: hard to say without details
12:55theignoratithat involves java classes though and I'd like to avoid that
12:56technomancytheignorati: old contrib has a socket-repl you can use pretty easily
12:56technomancyhard to avoid java classes
12:56hiredmantheignorati: do you need a data format or a network connection?
12:56theignoratiwell proto generated classes or things like that
12:58wjlroetechnomancy: 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:53gtrakhow does this destructuring work? (fn [req] (let [{:keys [status] :as response} (client req)] ...
13:54gtrak'client' is the arg to the that returns this function
13:54dakronegtrak: 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:55dakrone*response
13:56gtrakpulls out the :status key from the map returned by (client req)?
13:58mefesto,(let [{:keys [fname lname] :as person} {:fname "John" :lname "Smith"}] [fname lname person])
13:58clojurebot["John" "Smith" {:lname "Smith", :fname "John"}]
14:00gtrakI see, binds the symbols to the values at the keys of the same name
14:30hvhow can I get the list of "require"d namespaces?
14:32amalloy&(doc all-ns)
14:32lazybot⇒ "([]); Returns a sequence of all namespaces."
14:33hvamalloy: thanks
14:41leonid_are there any differences among &() ,() and #() ?
14:43amalloyleonid_: uh. what? a more verbose example please
14:44leonid_as in, typing in this channel
14:44leonid_,(+ 1 2 3)
14:44clojurebot6
14:44leonid_&(+ 1 2 3)
14:44lazybot⇒ 6
14:44leonid_#(+ 1 2 3)
14:44leonid_##(+ 1 2 3)
14:44lazybot⇒ 6
14:44leonid_hmm
14:44leonid_there are two bots ?!
14:44amalloywell, you've seen one difference already
14:45amalloythe other is that ##(symbol "this") can appear anywhere in your message, up to ##(inc 2) times
14:45lazybot (symbol "this") ⇒ this
14:45lazybot (inc 2) ⇒ 3
14:45leonid_i see
14:48imadehello, can anyone review my solution https://gist.github.com/1120880 to 4clojure problem http://www.4clojure.com/problem/28
14:50leonid_do you want to shorten the answer?
14:50leonid_exactly what are you looking for?
14:50amalloyimade: fwiw, (lazy-cat x y) is pretty similar to (lazy-seq (concat x y))
14:50leonid_(i didn't use lazy-cat or lazy-seq on my 33 char solution
14:51imadeamalloy: thanks, I will try to implement it with lazy-cat
14:55imadeyup works as expected and makes it more readable
15:05mattmitchelltechnomancy: is it possible for the lein repl to have tab completion?
15:06technomancyI 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:07mattmitchelltechnomancy: ok cool, just checkin
15:07amalloytechnomancy: fwiw, cake repl has completion of function names
15:07amalloynot sure how it works; i barely know how any of cake works
15:07jweissanyone 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:08technomancyamalloy: it doesn't use rlwrap
15:08amalloyah, right. the ruby readline bindings
15:08technomancyit'd be sweet if Java suddenly decided not to pretend the command-line didn't exist
15:21amalloyhey 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:34wunkiI know it's not much, but does anyone see what I did wrong by looking at this trace: https://gist.github.com/b76e1c84fffa02a5dbe9
15:34wunkiI'm just trying to follow alonge here: http://devcenter.heroku.com/articles/clojure-web-application
15:40carllercheAre there any private hosted maven repos as a service available somewhere?
15:43leonid_amalloy: it's Last Element
15:44PupenoWhat's the best way in Clojure to read a whole stream into a string?
15:45mefestoslurp ?
15:45mefesto,(doc slurp)
15:45clojurebot"([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:45PupenoThanks.
15:46arohneroh cool, I didn't realize slurp uses reader now
15:47mefestooh, yeah might want to check what version that happened in
15:47mefesto,*clojure-version*
15:47clojurebot{:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}
15:47amalloymefesto: 1.2
15:48amalloymaybe 1.1, but it's certainly been around for longer than 1.3
15:48mefestoim 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:50amalloymefesto: i have no opinion on the docstring, but the source in 1.2.1 is clearly using reader
15:50mefestoamalloy: oh ok i guess they just clarified the docs
16:13technomancyI think the docs are fixed in git
16:15technomancyproof that patches can still get applied
16:41TimMcHooray for triple-escaping...
16:41amalloyrargh, 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:42amalloyi 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:42TimMc,(.replaceAll "\\" "\\\\" "\\")
16:42clojurebot#<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 1>
16:46technomancyamalloy: I opened a ticket for that
16:47amalloytechnomancy: any genius workaround in the meantime? i'm about to defn it, snag the metadata, and then ns-unmap it
16:47amalloywhich, ew
16:47technomancycan't think of a better solution
16:47technomancybut yeah
16:48amalloyi considered stealing #'clojure.core/sigs, but that assumes that (fn [x] x) has already been homogenized into (fn ([x] x))
17:11lpetithello
17:15gtrakin the map let destructuring, is there any difference between [{:keys (...) and [{:keys [...] ?
17:15lpetitgtrak: no
17:15amalloygtrak: if () works, i wouldn't use it
17:16gtrakyea, seems awkward, but works
17:16lpetitgtrak: you can also try with #{}, which is semantically conveying that the order is unimportant
17:16lpetitbut longer to write
17:19gtrakI guess the macro takes care of it not being quoted, holy crap the destructure fn is complicated
17:19lpetitSo 34kb is the average size of a hello world in clojurescript. Not sure I'll show this to my javascript/nodjs co-worker ...
17:19gtraklpetit, using advanced mode?
17:19lpetitgranted, clojurescript is not for hello worlds :-)
17:19lpetityes
17:19lpetitgtrak: yes
17:24dnolenlpetit: that 5k, 6k gzipped and it grows pretty slowly. I started porting core.logic even after 500-600 lines it was still 34kb.
17:24lpetitdnolen: 34kb gzipped ?
17:24dnolenlpetit: no, 5-6k gzipped
17:25dnolenanybody that's complaining about 34k of JS doesn't know jack squat about modern JS development.
17:25amalloydnolen: did you include actual uses of core.logic? if not it was probably optimizing it all down to an empty string
17:25dnolenamalloy: it was all in there.
17:25lpetitso those 34kb are really the entry price, but does not at all represent anything wrt to the size of my code base, great
17:25amalloyyeah, seriously. ace.js is a megabyte
17:26lpetitThat's what I wanted to read, thx guys
17:27lpetitdnolen: for core.logic, will you manage 2 separate versions ?
17:28dnolenlpetit: 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:29lpetitdnolen: oh yes, the macros must be written in clojure
17:30dnolenhiredman: unless the compiler is baked in I don't see how that could work.
17:30lpetithiredman: because the compiler is in clojure, not in clojurescript ?
17:30hiredmanuh, the reader reads in clojure forms, the compiler generates js
17:30hiredmanI don't understand why macro expansion can't sit in the middle there
17:31amalloywhen 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:31lpetitmacroexpansion will probably use other helper fns. Where would they come from ?
17:31amalloylpetit: those helper fns have to be there anyway, since the macro *expansion* is happening already
17:32dnolenamalloy: macroexpansion does not happen at the ClojureScript REPL at all.
17:32lpetitamalloy: what was the question, after all ? :)
17:33dnolenamalloy: er sorry I mean perhaps it does at the REPL, but macroexpand is not available at runtime, it's something the compiler does.
17:33amalloydnolen: indeed, and i don't think i said it should be available at runtime
17:34lpetitClojureScript 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:34dnolenamalloy: then it's available at compile time like it is right now.
17:34amalloydnolen: right. but why do macro definitions have to be in separate clj files, instead of cljs files?
17:35amalloyjust because you couldn't :require them from one cljs file to another?
17:35amalloyi guess that would be a problem
17:37lpetitbut 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:38lpetitOr am I totally wrong ?
17:38dnolenI 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:39dnolenshipping the complier along with the runtime is clearly not in line with that goal at all.
17:39gtrakcan't you use a macro in the compiler to split out the macros from cljs files that they're defined within?
17:39gtrakcode-is-data and all that?
17:40dnolengtrak: I'm not sure what you're trying to say.
17:40lpetitSo in ClojureScript, code is data, but data is not code (at runtime).
17:41lpetitOr the opposite *grumpf*
17:41hiredmanmaking macros available doesn't mean you need to ship a whole runtime and compiler
17:41gtrakyou don't need to macroexpand at run-time, I'm basically saying what amalloy said I think, "it seems like ..."
17:42dnolenhiredman: 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:42Scriptorlpetit: code can be used and manipulated as clojurescript's data structures, these same datastructures can in turn be treated and run as code
17:42dnolenthe reader is like JSON.decode for ClojureScript
17:43lpetithiredman: 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:44lpetitScriptor: no, not with ClojureScript
17:45Scriptorhow so?
17:45lpetitScriptor: 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:45lpetitIt's more "like" the AOT compilation process, if you want
17:46lpetit(not totally true, since during AOT, you can still launch bombs via execution side effects ...
17:47lpetit... 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:47ScriptorI think I see your point, but at least during compile-time code can be manipulated and run as needed
17:49lpetitScriptor: 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:50gtrakwhy wouldn't you be able to use a clojure macro to create macros from cljs source?
17:50kumarshantanuCan anybody tell how to specify heap size in Leiningen's project.clj?
17:51kumarshantanuesp when using with a plugin (lein-daemon in this case)
17:51maaclI 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:51dnolengtrak: because the compiler is not a part of the runtime.
17:52lpetitdnolen: someone with diagram skills should graphically represent what is happening with ClojureScript. Seems it would be appreciated by lots of people.
17:53dnolenin Clojure proper forms are compiled as they are encountered. The ClojureScript compiler is *whole program compilation*
17:53lpetitdnolen: Currently, I'm falling short of finding a good analogy to help explain the process.
17:53dnolen^ ... whole program compilation, everything has to be there for it to work.
17:53lpetitdnolen: partly due to the fact that the Compiler is written in Clojure, this seems to blurr the lines for people
17:54gtrakdnolen, AOT compilation of stuff that uses macros works in clojure, yes?
17:54dnolenlpetit: partly, the other part is that the source is intended to be fed to Google Closure which is a *whole program JS compiler*
17:55lpetitdnolen: would be more precise to say "In Clojure proper, forms are compiled *and evaluated* as they are encountered"
17:55dnolenlpetit: Clojure is incrementally compiled. ClojureScript is not.
17:55lpetitdnolen: indeed, I imagine without that it could not be used with advanced settings to minify code
17:57lpetitdnolen: indeed, if you draw the parallel between java bytecode and "JS after having been 'compiled' by goog"
17:57ibdknoxthe lack of use in ClojureScript makes me sad
17:57ibdknoxany one of the contributors here that could explain that decision?
17:58dnolenibdknox: use / require as fns?
17:58lpetitdnolen: 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:58lpetitibdknox: lack of (use ...) or (:use ...) ?
17:58ibdknoxboth
17:59dnolenlpetit: ClojureScript REPL does pass stuff to the compiler I think.
17:59lpetitdnolen: ok, I'll have to check sometime
17:59ibdknoxdnolen: 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:00dnolenibdknox: I'm not sure about the lack of use, probably nobody's got around to it yet.
18:01ibdknoxdnolen: it actually seems to be a conscious decision from the docs
18:02maaclI 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:02dnolenibdknox: link?
18:02dnolenmaacl: I'd check the ML that one's come up a lot.
18:03maacldnolen: I will give that a try, thanks
18:03lpetitdnolen, ibdknox: to limit the risks of name collisions with other js scripts that may be installed on the "host html page" ?
18:04ibdknoxlpetit: I would expect use to inject into the current namespace
18:04ibdknoxlpetit: which in most cases shouldn't do anything unexpected
18:04lpetitibdknox: oh yes indeed, sorry
18:05ibdknoxdnolen: I guess it was about the more general case of having require/use functions
18:05ibdknoxdnolen: for example here they're talking about the browser-connected repl
18:05ibdknoxdnolen: https://github.com/clojure/clojurescript/blob/master/devnotes/bcrepl.org
18:05Raynesmaacl, 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:05RaynesIt was the commit immediately after that one that asploded it.
18:06maaclRaynes: ok, thanks
18:06dnolenibdknox: stuartsierra made it sound like core is interested in require as fn.
18:06dnolenibdknox: you'll have to inquire on clojure-dev about the fate of use, I'm curious myself.
18:07ibdknoxdnolen: at first I didn't think it would matter that much, but it makes a huge difference in practice
18:07ibdknoxI've been working on my client-side framework for CLJS
18:07ibdknoxand having everything aliased is a lot of meaningless typing
18:08dnolenibdknox: don't disagree at all.
18:08lpetitibdknox: even with code completion ?
18:08ibdknoxlpetit: even as an ex-PM for Visual Studio, I don't think tools should ever have to make up for things like that
18:08ibdknoxlpetit: it works in Clojure, and I don't think there's a fundamental reason for it not working in CLJS
18:09lpetitibdknox: what does "ex-PM" mean ?
18:09lpetitibdknox: not arguing on that
18:09ibdknoxlpetit: I was the Program Manager in charge of C# and VB in the IDE
18:09ibdknoxlpetit: left about 7 months ago
18:12ibdknoxbut yeah, if any of you guys are in the bay area, you should come to the bay area clojure group on thursday
18:12lpetitheh, this compiles fine in cljs: (defn hello [n] (cool-man n)) (defn cool-man [m] (str "Cool, " m))
18:13ibdknoxI'll be previewing some of the stuff I've been working in CLJS
18:14maaclRaynes: Are you sure about that commit no? can't seem to locate
18:15lpetitibdknox: can you help me understand the forces and limitations of brepl, currently ?
18:15Raynesmaacl: cd3eaa959d09375c6ead13e240f1c4f9b58013e4 Try that.
18:16lpetitibdknox: 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:17ibdknoxlpetit: 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:17ibdknoxlpetit: though I just got macros working locally, so that's not on github yet
18:17maaclRaynes: ah, yes much better - thanks
18:18ibdknoxlpetit: 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:18lpetitibdknox: fair enough for a "dev" mode
18:18lpetit!
18:18ibdknoxlpetit: I think so :)
18:19lpetitibdknox: "or if you're adding a new macro" => it's not a technical limit, isn't it ?
18:19lpetits/isn't/is/
18:19lazybot<lpetit> ibdknox: "or if you're adding a new macro" => it's not a technical limit, is it ?
18:20ibdknoxlpetit: I guess not, you just have to reload things files on the class path
18:20ibdknox-things
18:20lpetitidbknox: "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:21ibdknoxlpetit: ah, you can't define macros in the repl itself, given the limits of CLJS
18:21ibdknoxlpetit: you have to write macros in a file and run brepl from that dir
18:21ibdknoxlpetit: so I guess that's a limitation, but that's at the level of ClojureScript not brepl
18:22ibdknoxactually
18:22lpetitidbknox: 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:22lpetit?
18:23ibdknoxlpetit: yeah, you could do that
18:23ibdknoxlpetit: I think there might be an easier way though
18:23lpetitidbknox: tl;dr so I see no technical limitation, neither at the clojurescript nor the brepl levels
18:23ibdknoxlpetit: the way I wrote brepl, I can interpret forms before they go to the compiler
18:24ibdknoxlpetit: so if I captured defmacro, which is meaningless in cljs, I could go off onto some other code path
18:24lpetitibdknox: so you can hook something to come back to the Clojure evaluator, e.g. like they did for :cljs/quit special keyword ?
18:24ibdknoxlpetit: that's how my require works, yeah
18:25lpetitibdknox: indeed, since I guess 99,99%+ usages of defmacros are top level usages
18:26ibdknoxI 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:26lpetitibdknox: that leaves open the question of "in which ns would you evaluate this defmacro" ?
18:26amalloylpetit: :( - for any nontrivial macro i like to do (letfn [(helpers [x]...)] (defmacro my-macro [args] ...))
18:26lpetitamalloy : oh :)
18:26lpetit99,98% then :-p
18:27lpetitjust kidding
18:27amalloyof course, letfn isn't implemented yet either, but i have (let [...] (defmacro ...)) too
18:28dnolenamalloy: what's the benefit of that style? seems unidiomatic to me.
18:28ibdknoxI was wondering the same thing
18:28lpetitencapsulation, I guess
18:28amalloydnolen: don't have to pollute the namespace with a bunch of helper functions that make no sense outside that macro's context
18:28dnolenamalloy: pollute how?
18:29amalloydnolen: compared to the alternative of (defn helper [x] ...) (demacro my-thing [args] (... (helper args) ...))
18:29dnolenamalloy: also just hurts testability in my opinion for anything but the simplest macros.
18:29lpetitamalloy: defn- isn't enough then ?
18:30lpetitdnolen: that's indeed more difficult to mock up things, I guess :)
18:30clojurebottwo things are more than one thing
18:30ibdknoxlol
18:30lpetitthx clojurebot
18:31ibdknoxamalloy: out of curiosity, do you tend to do that with regular function definitions as well?
18:31lpetitWhat 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:32hiredmanmy clojure reader is one big letfn
18:33lpetithiredman: for "pollution reason", or with perfs in mind ?
18:38lpetitDo you have pointers wrt "Clojure/core & 'their' 'browser-connected stuff' WIP" ?
18:39lpetitFirst time I read about it above ^^^
18:40ibdknoxonly a tweet and their notes
18:40ibdknoxhttps://github.com/clojure/clojurescript/blob/master/devnotes/bcrepl.org
18:41lpetittweet by who, btw (might have to follow if it's just not that I overlooked it) ?
18:44lpetitwhy 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:51technomancydo 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:54lpetittechnomancy: inc
18:57lpetitmust leave, good night
18:58technomancyhiredman: haven't you heard? apparently clojure is bigger[1] than scala, java, and C++ combined
18:58hiredmanusing df -h?
18:58technomancy[1] when measured by growth in the community relative to four years ago
19:00_atohehe from one person to 5000+ (mailing list). Man that's like 500000% growth.
19:01technomancy_ato: unprecedented![2]
19:01technomancy[2] except by every other language with over 5000 users
19:05amalloyibdknox: sometimes. with functions i expect the helper functions will more often be reusable, so i don't mind making them public
19:09_atomy 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:11technomancypretty steady otherwise
19:11technomancyoh, but barely over a year
19:11_atoyeah, sadly I don't have the full history. I should try to extract it from the Internet Archive
19:12livingstonhey, where do I find (doc ..) now in 1.3?
19:19amalloyibdknox: 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:21ibdknoxamalloy: fair enough
19:22technomancy_ato: 950 in november of 08 when I joined
19:24tmciverHi all. Noob question: why does the following work
19:24tmciver&(filter #(< % 5) '(1 2 3 4 5 6 7 8 9))
19:24lazybot⇒ (1 2 3 4)
19:24tmciverthis doesn't
19:25tmciver&(filter #(< % 5) (iterate inc 1))
19:25lazybotExecution Timed Out!
19:25technomancy,(take 4 (filter #(< % 5) (iterate inc 1)))
19:25clojurebot(1 2 3 4)
19:25livingstontmciver: how is it supposed to know that it only counts up?
19:25livingstonand thus can stop after only 4.
19:26tmciverHow does it know it only counts up? (iterate inc 1)
19:26livingstonfilter doesn't know that - it will check them all.
19:27tmciverAhhh!
19:27technomancythere's always (:use [clojure.contrib.turing :only [halting?]]), but I don't think it's been modularized for 1.3
19:28tmciverI 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:28livingstonha. speaking of 1.3 ... bump: where did the doc function end up?
19:28hiredmanmacro
19:28hiredmanin clojure.repl I believe
19:29technomancytmciver: if you did doseq over the infinite seq, it would
19:29tmciverAh, OK. Thanks again!
19:29livingstonhiredman: thanks - a ns I didn't know I needed.
19:30amalloytechnomancy: huh. i was actually looking up the proof of the halting problem's undecidability while you guys in here started talking about it
19:30hiredman~halting problem
19:30clojurebotnot a problem, the average bid for it on getacoder is $821.00
19:31livingstonwell, the particular case in question *could* be optimized into the compiler, but I don't know why you'd bother.
19:32TimMcOh man, I want to put that on getacoder.
19:33hiredmansomeone did and that was the bid
19:35livingstonit's worth doing as a screen. don't accept bids from any of those people on a real problem.
19:36TimMchiredman: Awesome.
19:37tmcivertechnomancy, 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:37livingston,(take 10 '(a b c))
19:37clojurebot(a b c)
19:37hiredmanit's sill an infinite sequence
19:37livingstonsure you can
19:37hiredmanfilter just never yields another value
19:38tmciverlivingston, Hmmm
19:38livingstontmciver: what hiredman is pointing out is that it will go looking forever for the 5th value which is never to be found
19:39hiredmangiven an arbitrary infinite sequence of numbers, if you remove all values less than 5, how long is the sequence?
19:39tmciverlivingston, hiredman: OK, but it works in your example because it's not an infinite sequence.
19:39livingstonthis is fine: ,(take 10 (iterate inc 1))
19:40livingstontake keeps going until it gets it's fill or hits the end.
19:40livingston,(doc take)
19:40clojurebot"([n coll]); Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n."
19:41tmciverlivingston, hiredman: Thanks. I *think* I got it now.
19:41raekwell, the repl is the thing that keeps going until it gets the end of the seq
19:42livingstonraek: true, you could probably def that into something without trouble, until you went looking for the 5th one...
19:42raek(first (remove odd? (remove even? (range)))) <-- the first natural number which is both even and odd
19:43amalloytmciver: i don't think anyone's mentioned it yet, but the function you're probably looking for is ##(doc take-while)
19:43lazybot⇒ "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."
19:43raekall natural numbers will be searched but none will match the criterias
19:44livingstonraek: well, as long as it's only the natural ones ;)
19:44tmciveramalloy: yes, I was just playing around with that too.
20:07livingstonis doseq the equivalent of common-lisp's mapc and the preferred way to iterate for side effects?
20:15carlo_auis macroexpand-all in core in clojure 1.2?
20:16amalloycarlo_au: no. clojure.walk
20:17carlo_auso I would call it with (clojure.walk/macroexpand-1 'sdfsd ) ?
20:18carlo_auah, that works, thanks amalloy
20:18amalloyyou asked about -all, and now -1. they're not in the same place
20:22carlo_ausorry, I meant clojure.walk/macroexpand-all
20:22livingstonIf 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:09tomojwasn't there once a snippet to find all classes implementing an interface?
22:21pdk,(+ 25.9 3.4)
22:21clojurebot29.299999999999997
22:22romanandreghey 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:22romanandregI'm having issues getting familiar with the documentation
22:22brehautromanandreg: theres nothing as sohpisticated as hoogle
22:22brehautromanandreg: but clojuredocs.org is useful
22:22romanandregbrehaut: checking out...
22:23brehautromanandreg: its not really possible to do type based doc queries for clojure
22:23brehautromanandreg: however you might find lazybot's $findfn command useful
22:23brehaut$findfn inc [1 2 3] [2 3 4]
22:23lazybot[clojure.core/map clojure.core/pmap clojure.core/keep]
22:24romanandregbrehaut: it's something :-|
22:24romanandregbrehaut: thanks :-)
22:27brehautromanandreg: from there repl there is also find-doc and apropos (in clojure.core and clojure.repl respectively)
22:27brehauteg ##(apropos 'map)
22:27lazybotjava.lang.Exception: Unable to resolve symbol: apropos in this context
22:28brehaut##(use 'clojure.repl)
22:28lazybot⇒ nil
22:28brehaut##(apropos 'map)
22:28lazybot⇒ (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:34romanandreg(doc zip)
22:34clojurebotGabh mo leithscéal?
22:34romanandreg(doc 'zip)
22:34clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>
22:34romanandreg(doc filter)
22:34clojurebot"([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:34brehautromanandreg: you are looking for map
22:35romanandregbrehaut: nope... just playing with clojurebot
22:35brehautromanandreg: ok then :)
22:35romanandregbrehaut: I'm kind of confused, don't know when to use 'symbol, and when to use only symbol
22:35romanandregg.e apropos require the "'"
22:35leonid_you can pm clojurebot if you don't want to clutter up the channel with spam
22:35romanandregwhile doc doesn't
22:35brehautromanandreg: basicly always use symbol except for use and require
22:36romanandregbrehaut: symbol meaning... not using "'"
22:36romanandreg?
22:36brehautyeah
22:36brehautsorry
22:36brehautonly use the quote on a symbol when you want the symbol itself, rather than waht it is bound to
22:36romanandregbrehaut: ok, makes sense
22:38brehautromanandreg: 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:39brehautromanandreg: however, to throw a bit of extra confusion in there, import never needs the quote
22:39romanandregbrehaut: is the reason that the ns form doesn't require the "'" related to the fact that ns is a macro?
22:39brehautromanandreg: i believe so
22:39romanandregbrehaut: lol... I found the requiring functions are a bit hard to remember
22:40romanandregbrehaut: coming from Haskell where you have more or less the same features, I found clojure's a bit more... maybe complicated?
22:40brehautromanandreg: mostly you want require
22:40brehautuse is more useful in a repl
22:40brehautand import is for java
22:41romanandregyes... require with the :only, :except or :as options
22:41brehautyup
22:42romanandregbrehaut: btw... nice post on the clojure web stack.
22:42brehautromanandreg: thanks :) also i dont know if :only makes sense with require
22:43romanandregbrehaut: kind of want to steal your blog stylesheets as well hehe :-p
22:43brehautid rather you didnt ;)
22:43brehautfranchise is a great font though
22:44romanandregbrehaut: hehehehe... just thinking outloud... yeah the effect on the links where it get's all white with the transition
22:44romanandregnice touch
22:44romanandregbrehaut: and the font helps a lot
22:44brehautthanks
22:44romanandregbrehaut: how long have you been coding clojure?
22:45brehautsort of 3 years, but properly about 1.5
22:45romanandregbrehaut: have you seen it getting a lot of traction lately?
22:45brehautyeah; its kind of hard not too :)
22:45romanandregbrehaut: I'm just getting in... so I'm curious
22:48brehautwell, there are clojure jobs in new zealand, so i think that means its got some traction ;)
22:48romanandregbrehaut: 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:50romanandregbrehaut: that and the inevitability of Lisp dialects
22:59ferdnewbie playing with some clojure constructs... Help: why do I get a NPE when evaluating the following?:
22:59ferd(doseq [x (list (fn [] (println 1)) (fn [] (println 2)))] ((x)))
23:00brehautferd doseq is a comprehension notation; your list is automatically unpacked
23:01brehaut,(doseq [x [(fn [] (println 1)) (fn [] (println 2))]] (x))
23:01clojurebot1
23:01clojurebot2
23:01brehautferd: dropping the second set of parens wrapping x does what you want
23:01brehautferd: you would only need the second set if x returned a function
23:02ferdahh
23:02brehautferd: its also idiomatic ot use a literal vector rather than a list for that sort of thing too
23:02ferdthanks a lot!!
23:03brehautferd: just for completeness ##(doseq [x [(fn [] (fn [] (println 1))) (fn [] (fn [] (println 2)))]] ((x)))
23:03lazybot⇒ 1 2 nil
23:03ferdgot it. Works now: (doseq [x [(fn [] (println 1)) (fn [] (println 2))]] (x))
23:04brehautferd: and if you were to do this seriously, you would just use a do ##(do (println 1) (println 2))
23:04lazybot⇒ 1 2 nil
23:05ferdbrehaut: Thanks again... I think you retained the double parents on your first one
23:05ferd"do" ? let me see that one
23:05brehaut(do (println 1) (println 2))
23:06ferdI meant, let me learn it from the docs :-)
23:06ferd(newbie newbie if you didn't realize yet)
23:06brehautno problem
23:07ferdthat's fine... I need doseq cause the list of functions will be dynamic
23:08ferdI pasted here a small version of what I'm doing to make it fit in the chat
23:08brehautsure
23:24tomojare there any good ways to make keyword typos less of an issue, besides making fewer typos?
23:27tomojI guess there are just all the good ways to find bugs