#clojure log - Jun 30 2012

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

2:11 xumingmingv: I'am stuck with how to a gen-class and java array related problem

2:11 https://gist.github.com/3022563

2:11 is the :constructor part correct?

2:12 to use "[java.net.URL;" to represent a java.net.URL class?

3:25 SrPx: Hey guys. Is there a lein command to run a .clj file?

3:30 antares_: SrPx: there is no, you run namespaces

3:30 lein run -m my.namespace.to.run

3:31 namespaces that you want to run need to have (:gen-class) in the (ns …) definition and the -main function that takes & args

3:31 that's it

4:04 SrPx: antares_: o.o

5:04 Raynes: Well guys, the Heroku outage isn't effecting refheap anymore. Unfortunately, the database service I use was also effected by the storm that hit the AWS data center. My database is down and until it comes back up, refheap wont be working. Heroku will be trying to restart refheap every 10 minutes for the rest of the night until the database comes back online.

5:05 I'm going to bed, sirs and madams.

5:06 borkdude: oops

5:06 I read about the storm on the news now… good luck and sleep well

5:28 alexyakushev: Hello, I'm a new to protocols but is it possible to extend some protocol for an arbitrary object to support destructuring?

5:29 I guess if such a protocol exists it should implement `get` function or something

5:34 borkdude: alexyakushev maybe this? https://groups.google.com/forum/?fromgroups#!topic/clojure/K5HyK7GDnUE

5:35 alexyakushev destructuring uses nth

5:37 alexyakushev: borkdude: Thanks! I'll take a look

5:37 borkdude: I'm looking for associative destructuring, like for maps

5:37 borkdude: alexyakushev example?

5:38 alexyakushev: borkdude: You know, {:keys [foo bar]}

5:38 borkdude: ah

5:38 alexyakushev: Yes, I found how to do that using `proxy` under the link you provided, thank you again

5:39 Though I hoped it is possible to do this without wrapping of any kind. But that's too much:)

5:40 borkdude: alexyakushev I don't know what is used for associative destructuring, maybe the Associative interface?

5:41 alexyakushev: From the source code it calls simple `get`, as far as I can tell

5:41 And `get` is redirected to clojure.lang.RT

5:41 I haven't looked inside yet, but I guess protocols are not available that deep, am I wrong?

5:42 borkdude: alexyakushev I think you are right, clojurescript has that better solved I think

5:42 alexyakushev one day maybe protocols will make it into this more fundamental level

5:42 alexyakushev: Well, hail to the Clojure in Clojure while we're waiting for it:)

5:43 borkdude: alexyakushev just apply a patch ;)

6:07 is there any clojurescript game similar to tictactoe on github?

8:28 N8Dawg: is anyone else having trouble connecting to www.datomic.com ?

8:56 kmicu: N8Dwag: no, it works

9:01 N8Dawg: but some Heroku and AWS US based servers was down earlier, maybe this is the reason

10:36 gfredericks: I'm using Raphael with cljs and wanted to try out advanced compilation. Obviously I need to declare 'var Raphael' in an externs file, but what about all the methods on the raphael objects? how do I declare those?

10:38 cemerick: gfredericks: I'm right behind you. Please do post or gist about it when you have that riddled out.

10:38 gfredericks: haha

10:38 well I guess I'll try it the naive way and make sure it breaks first

10:46 is clojars on EC2?

10:53 well apparently justing setting :optimizations to :advanced in the cljsbuild config doesn't do it

10:53 tomoj: gfredericks: looking at the ip and https://forums.aws.amazon.com/ann.jspa?annID=1528 , I'm guessing no

10:53 gfredericks: tomoj: ok thx; thought I might have connectivity trouble, but I think it's working fine

11:02 strangely the cljsbuild docs don't seem to mention advanced compilation at all o_O

11:27 oh nevermind it did do advanced

11:54 Scriptor: yep, makes a good deal of difference

11:54 18k lines to about 5k

11:54 andn that 18 is already minimzied

11:54 *minimized

12:58 wingy: first i thought why not goto-ns instead of in-ns .. is the answer that clojure tries to stay declarative?

13:09 gfredericks: wingy: if nothing else, goto-ns confusingly evokes goto

13:14 $mail cemerick I believe the externs section of http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html describes the correct way

13:14 lazybot: Message saved.

13:21 gfredericks: what are the implications of naming protocol methods with -foo instead of foo?

13:21 (in cljs)

13:23 Bronsa: it's just a convention i guess

13:24 wingy: heh .. i was confused why they only showed vars and not functions :) but functions are first class and can be assigned to any var

13:24 Bronsa: to tell that a protocol method is intended for internal use only

13:25 gfredericks: Bronsa: you know that? I originally assumed it was mandatory since it seemed to mirror the .-foo attribute access syntax

13:25 but only recently discovered you don't need it

13:25 and want to be sure there's not some crazy performance implication

13:26 Bronsa: i am not 100% sure, for that ask dnolen, but i'm pretty confident that's the only meaning to the - prefix

13:27 gfredericks: okay thanks

13:28 Bronsa: also gfredericks the .-foo syntax was introduced after those protocols were made so i dont think it's related in anyway

13:28 any way*

13:29 gfredericks: ah ha. good to know.

13:50 noko33: why (meta ^String 'sym) is nil but (meta ^String []) resolves to {:tag java.lang.String} ?

13:51 Bronsa: i'm guessing you are applying the metadata to the (quote sym) list

13:54 dreish: Yes, you would need to do (meta '^String sym)

13:54 '^String sym is a tagged, quoted symbol.

13:56 It looks more sensible if you write out the quote instead of using a quote mark: (meta (quote ^String sym)) ; yes ... (meta ^String (quote sym)) ; no

14:04 noko33: Bronsa, dreish: thanks, I understand now

14:11 dnolen: gfredericks: - is just a convention. first the fn vs. the -first as implemented by a particular type.

14:16 gfredericks: dnolen: okay cool, thanks

14:31 bagelz: is there a clojurebot repl I can pm?

14:31 gfredericks: you can pm clojurebot

14:32 ,(+ 1 2)

14:32 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args (3) passed to: sandbox$eval-in-box>

14:32 gfredericks: clojurebot seems to be ill

14:32 but you can also pm lazybot

14:32 bagelz: very cool

14:32 I pmed him and he did it fine

14:32 that is fantastic.

14:47 gfredericks: isn't there a constant-time way to find the highest bit set in a number?

14:48 without using logarithms :(

14:55 wingy: whats the point of:

14:55 (require 'clojure.set)

14:55 (clojure.set/union #{1 2 3} #{4 5 6})

14:55 the first line .. the second seems to work without the 1st

14:56 gfredericks: the require ensures that clojure.set has been loaded. If it got loaded somewhere else already I suppose the second line would still work, but you shouldn't count on it

14:57 dnolen: wingy: some REPLs (lein) may have loaded clojure.set, but that won't always be the case.

14:58 wingy: but in the 2nd line im using a namespace qualified symbol

14:58 cant still get why i would need the first one

14:59 dnolen: wingy: libs are not automatically loaded.

14:59 wingy: this works: (clojure.string/blank? "")

14:59 without loading it

14:59 tmciver: wingy: in general you need the require. For me, lein repl loads it automatically, swank clojure does not.

14:59 wingy: blank? doesnt work

14:59 dnolen: wingy: what REPL are you using?

14:59 wingy: lein

14:59 dnolen: wingy: lein loads a bunch of things

15:00 wingy: if you use the standard Clojure REPL (which is not as nice), you have to require first.

15:00 wingy: dnolen: no it didnt load string namespace since blank? wont work

15:00 but having (clojure.string/blank? "") worked

15:00 dnolen: wingy: blank? won't work because you didn't "use"" it, unrelated.

15:00 wingy: so unless it is doing some magic underneath when i use the full qualified name i still dont get why i have to require

15:00 gfredericks: wingy: first look up require vs use

15:00 dnolen: wingy: because automatically loading libs is a terrible idea.

15:01 wingy: refer to the section on namespaces in your favorite Clojure book, should clarify things.

15:03 wingy: dnolen: the example was from the book

15:09 ok one last try: so i fire up "clj" version 1.4 .. i run (blank? "") it couldnt resolve symbol .. i run (clojure.string/blank? "") it worked .. i didn't require it .. so i run (require 'clojure.string) and it required it .. i do (blank? "") it didnt work .. i do (clojure.string/blank? "") it worked .. i dont get the purpose of require

15:10 what did it help me with without me being able to do before i required it

15:10 gfredericks: wingy: (blank? "") will never work until you do (use 'clojure.string)

15:10 wingy: yeah i know .. im trying to get require

15:10 gfredericks: that's a separate issue

15:10 wingy: i get use .. i dont get require .. whats the purpose

15:10 gfredericks: okay so don't infer anything from whether or not blank? works

15:11 the purpose of require is to ensure that the namespace has been loaded. the reason you're seeing the behavior you are is that it was loaded already before you required it, which should be considered a coincidence

15:14 wingy: by loaded you mean the source files are read into memory .. and i can use them but have to specify the namespace qualified symbol

15:14 makes more sense now

15:14 gfredericks: no you do have to specify the namespace qualified symbol

15:14 oh yes you said that

15:14 sorry I read an extra negative

15:14 wingy: you inverted my expression

15:14 gfredericks: yes I think you have it

15:15 SrPx: hey guys what is again that clojure library to write html clojure-like and then convert?

15:15 gfredericks: hiccup

15:15 or crate in cljs

15:15 wingy: seems that i always want to use (use)

15:15 gfredericks: wingy: it's deprecated

15:16 wingy: use is deprecated?

15:16 gfredericks: require now has the use functionality as part of its options, and you're encouraged not to blindly use everything from a namespace so that it's easier to track where each symbol comes from

15:16 but I still use use sometimes :)

15:17 don't tell anybody

15:17 wingy: lol

15:17 gfredericks: use will be removed? where is the deprecation info

15:17 gfredericks: I don't know about either of those

15:17 the changelog for 1.4 might mention it

15:18 wingy: how did you know its deprecated then

15:18 gfredericks: I hang out in #clojure a lot

15:18 wingy: the book isnt mentioning it

15:18 ok

15:18 gfredericks: 1.4 is pretty recent

15:18 probably recenter than any book

15:19 SrPx: gfredericks: ty

15:22 wingy: ok require over use and refer

15:22 so many options are creating incidental complexity

15:23 gfredericks: the ns macro has a long and sordid history

15:23 bagelz: unavoidable if it's supposed to be useful, right?

15:35 wingy: clojure is as unix as it can get

15:35 brainproxy: defend your statement

15:36 wingy: small pieces doing one thing good one thing only

15:36 then macros come to help you

15:36 brainproxy: :)

15:36 wingy: this and that to require .. but dont use them! they will make your code messy

15:36 use "ns" macro

15:36 kinda wtf

15:37 you first confuse me .. then you help me out .. while in node.js you just use require()

15:37 brainproxy: oh, your coming from nodejs also?

15:37 *you're

15:37 wingy: yeah .. explaining my confusions a lot huh? :)

15:37 brainproxy: me too

15:37 I started w/ nodejs in jan 2010

15:38 wingy: a little bit later for me .. are you still using it?

15:38 brainproxy: still really like it, sure

15:38 some things are easy to reach for

15:38 such as sockjs, socket.io

15:38 wingy: yeah their npm is really neat

15:38 brainproxy: yeah, npm is really slick

15:39 wingy: so simple .. also node.js itself is so simple and powerful .. but js is bleeh

15:39 used a lot of coffeescript before livescript

15:39 brainproxy: js can be nice, and I like coffeescript a lot

15:39 wingy: have a look at LiveScript

15:39 its Coffee with FP style

15:39 brainproxy: but ultimately, once you get a sense of what immutable collections and STM bring to the table, it's hard to want to prog in plain old js

15:40 wingy: yeah

15:40 for how long have you been using clojure?

15:40 brainproxy: going on two months now

15:40 not very long

15:40 tomoj: STM == atoms in this case?

15:40 brainproxy: read the O'Reilly book on Clojure as a crash course

15:40 tomoj: i meant STM in general

15:41 as opposed to having to think about splitting work out to different processes

15:41 tomoj: processes? thought you were talking about js

15:41 brainproxy: nodejs has a notion of processes

15:41 e.g. the child_process module

15:41 which is actually really cool

15:41 tomoj: don't see how that is relevant

15:42 brainproxy: well, um, with a single thread, if you have anything cpu bound then you'll get eaten alive

15:42 so you need to split out work and coordinate among processes

15:42 wingy: for blocking operations

15:42 brainproxy: even with the cluster sugar, it's still kind of hairy

15:43 wingy: if you don't want to chunk the long living operations in pieces and have everything in one process .. but that is an ugly hack in my ears

15:43 tomoj: I don't see how cljs helps at all there

15:43 brainproxy: we're not talking cljs

15:44 if I accidentally said cljs i meant straight up clojure

15:44 tomoj: oh, clj-jvm vs js?

15:44 brainproxy: yes

15:44 well, vs nodejs considered in toto, not just js the language

15:44 wingy: clj/jvm vs js/node.js

15:45 i feel it doesn't add much value to use cljs on node.js

15:45 tomoj: I disagree strongly

15:47 unless you mean it doesn't add much value to use cljs/node.js instead of clj/jvm, then I only disagree weakly :)

15:47 brainproxy: i think cljs on top of nodejs is pretty attractive actually

15:47 wingy: yeah that was my point

15:48 brainproxy: because of the things cljs gives you

15:48 wingy: i would rather wanna use clj/jvm than cljs/node.js

15:48 brainproxy: i'm just saying that when I bump up against anything that dips into mvcc territory

15:48 then I am going to go with clojure/jvm

15:48 hands down

15:49 the reality is that a lot of web facing stuff, e.g. collaborative web apps, that kind of thing

15:49 wingy: brainproxy: what db are you using?

15:49 brainproxy: easily start to deal with mvcc related concerns, and in my experience trying to work that out with node is kind of difficult

15:49 tomoj: I would almost say that it is impossible

15:50 brainproxy: wingy: some couch stuff, i am experimenting with orientdb also

15:59 wingy: thougt about using datomic .. anyone having experience with that one?

16:18 antares_: folks who have been asking for an alternative insert function in Monger: 1.1.0-beta1 now has it, see https://github.com/michaelklishin/monger/blob/master/ChangeLog.md

16:32 augustl: are there any books out there that describes the details of the inner workings of the persistent data structures in clojure?

16:35 arohner: augustl: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/

16:35 http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/

16:42 augustl: arohner: cool, thanks :)

16:42 would be interesting to try to implement it on top of Node.js buffers

16:42 which are just raw out-of-vm (but still garbage collected) allocated bytes

16:47 wingy: lein is like npm but for the whole project cycle

16:47 pretty cool

16:48 augustl: there are so many things that are solved problems on the JVM platform.. Makes you wonder why people bother to make new ones.

16:48 I've heard Oracle is implementing Node.js on the JVM, for example

16:49 antares_: with a complete JS implementation based on invokedynamic, yes

16:49 wingy: what?

16:49 clojurebot: what is 2d6

16:49 augustl: V8 is cool, but is it worth having to write all the libraries from scratch again? :)

16:49 antares_: it will be part of JDK 8, called Nashorn

16:49 augustl: a fork of Rhino?

16:49 antares_: no, a green field design

16:49 invokedynamic from the ground up

16:50 augustl: interesting naming, Nashorn = rhino (ish) in many european languages

16:50 antares_: yes, absolutely, that's the pun

16:51 http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CFEQFjAA&amp;url=http%3A%2F%2Fwiki.jvmlangsummit.com%2Fimages%2Fc%2Fce%2FNashorn.pdf&ei=imbvT5npNYLU-gariJmvAw&usg=AFQjCNFyPrV5etR8ikgrNn5-5wZCZUWyGA&sig2=ywfL2opN9UPUq0gVayfTEg

16:52 augustl: great, thanks

16:52 wingy: so js would be yet another jvm lang

16:52 antares_: right

16:52 wingy: using a new engine

16:53 but that wouldn't affect clojure programmers who only wants to use clojure

16:53 augustl: Rhino is kind of black magic, seems like a welcome addition

16:53 wingy: i can understand the need for javascript for java coders since java is not dynamic

16:54 antares_: wingy: it has no relation to Clojure, just saying that Oracle indeed works on a JS implementation and there are at least two projects that are "polyglot Node.js-like environments"

16:54 wingy: yeah

16:54 antares_: and it is just one more proof that they care about JVM being polyglot

16:54 wingy: pretty cool initiative

16:54 yeah just like heroku

16:54 i like polyglotism

16:58 seems that jvm is of higher value, than the java lang itself

16:58 i dont think they thought it would play out like this in the late 90s?

16:58 the goal was to make Java the lang popular right

16:59 pipeline: as far as i understand it

17:00 they expected the jvm to be very valuable also

17:00 augustl: not sure if this is off topic, does clojurescript implement persistent data structures? The presentation by Rich Hickey on blip.tv is a year old or so

17:00 antares_: augustl: it does

17:00 augustl: with the same performance characteristics of cloure?

17:01 that is, a vector with 1000 items won't perform a full cow when creating a copy with one more item added to it, etc

17:03 tomoj: if it did that, it wouldn't be persistent, would it?

17:03 antares_: augustl: more or less, they are doing some interesting things to get as close as possible to JVM Clojure performance where JS VMs can optimize things well

17:04 tomoj: actually if you always do a full copy, then 'old versions' are not penalized, so maybe that does count as persistent.. just always slow?

17:05 augustl: antares_: cool

17:05 technomancy: tomoj: I'm not sure the whole "old versions don't degrade in perf" is necessarily technically part of persistence. I think it depends on who you ask.

17:05 augustl: tomoj: no idea.. I'd guess the performance characteristics of making copies with alterations is part of the whole "persistent" thing

17:05 tomoj: technomancy: naturally

17:06 in effect I was asking you :)

17:06 augustl: currently investigating why everyone is using backbone and jQuery and nobody is using google closure for building JS apps, google closure seems insanely powerful

17:06 (meta-related to clojurescript)

17:11 tomoj: with backbone you just download one small file, drop in a jquery cdn link, write 10 lines of code and you have a stupid todo list

17:12 for many it would take longer just to understand what the hell closure is I think

17:12 augustl: yeah, people seem to like tools that are easy to use the first days and weeks while writing an app

17:12 indeed, I'm currently having to make a big effort to figure out how to use closure. Seems like it's worth it, but the docs by Google are kind of meta

17:14 akhudek: sadly, I think there is probably a need for some sort of easy bootstrap for the clojure stack, even though that sort of "easy" is against the general philosophy of the language

17:14 some of the noir + lein newnew templates are a good start

17:15 I shouldn't say against the philosophy, rather, not the most important kind of "easy"

17:18 augustl: I've had enough of tools that optimize for being easy to get started with ;) The "getting started" chunk is quite a lot smaller than the "being a competent user of" chunk.

17:19 antares_: akhudek: it is not against, it is just not the #1 priority for the core team. I think the community in general is all for making all kinds of things easier on newcomers.

17:23 SrPx: ...

17:26 I'm trying to create a project using leiningen: C-x shell, lein new myproj... the problem its being created on emacs/bin

17:38 wingy: i feel disabled in clojure world

17:38 how do i run a .clj script?

17:40 kovasb: wingy: theres a number of tools for that

17:40 wingy: 3rd party stuff on github

17:40 wingy: wow .. sounds hard to do a such simple things .. is it because it has to be compiled etc?

17:40 kovasb: or you can just write a shell script

17:41 i don't think it needs to be compiled

17:41 wingy: is there no equivalent to someething as simple as: "node.js ./script.js" ?

17:41 kovasb: but it does need to be run through the jvm

17:41 wingy: "node ./script" i meant

17:41 kovasb: yes, there are such things

17:41 probably many , on github

17:42 Chousuke: wingy: the biggest problem with running clojure programs as scripts is the jvm startup time.

17:42 kovasb: wingy: most stuff tends to be automated through lein

17:42 wingy: kovasb: could lein run a simple script like that?

17:42 kovasb: wingy: that automates a huge number of things

17:42 aperiodic: wingy: if you're using lein, then the easiest way is probably `lein run -m my.ns`, if my.ns has a -main fn

17:43 kovasb: usually i do "lein run"

17:43 from inside my project folder

17:43 and it runs

17:43 augustl: I don't think the java platform is commonly used for command line scripts

17:43 kovasb: wingy: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md

17:43 augustl: or CLIs in general

17:44 because of the slow startup time that was already mentioned

17:44 wingy: i see .. explains why its so difficult

17:44 kovasb: how to run a script is an example in the middle

17:44 augustl: so since few people do it, that's probably why it's hard to do :)

17:44 wingy: hmm a big -

17:44 scripts are making dev faster

17:44 kovasb: yeah, its more like "i wanna run my program" rather than "i wanna run my script"

17:44 but nb there are solutions for jam startup time

17:45 augustl: doesn't `java -jar path/to/clojure.jar path/to/the-script.clj` work?

17:45 it will execute the -main of the-script.clj

17:45 (afaik)

17:46 kovasb: i think you put the namespace instead of a file path

17:46 aperiodic: what about the classpath?

17:46 kovasb: if you are calling java directly ilke that you need to use the options of java

17:47 (the executable)

17:47 wingy: ok lein run -m app.core worked great .. ill stick to that one for now til im not a noob anymore :)

17:47 kovasb: sweet!

17:47 wingy: hate the first month of noobishness .. you are so disabled

17:47 kovasb: yeah learning about lein is great

17:47 thats what its all about

17:48 wingy: "For those of you new to the JVM who have never touched Ant or Maven in anger: don't panic. Leiningen is designed with you in mind."

17:49 he read my mind

17:50 isnt there a way to make jvm startup time faster for testing things out?

17:50 eg. having it up all the time .. then there would be no need for start up?

17:53 augustl: wingy: there are many ways to reload stuff in a jvm as it runs yeah

17:54 wingy: augustl: i mean for running simple .clj scripts .. it takes like 5 secs for jvm to start .. is there a way to have it as fast as node?

17:54 aperiodic: no

17:54 wingy: ok

17:55 aperiodic: you can mitigate things somewhat by AOT-compiling, but jvm startup is always gonna be a second or two for the foreseeable future

17:56 augustl: wingy: well there are other JVMs out there than HotSpot, perhaps there are some with focus on startup speed

17:56 but now I'm just guessing, for all I know, long startup time is an effect of the bytecode formats or whatever

17:56 wingy: but why does it start and stop start and stop all the time .. cant it just be started?

17:57 if you want a clean state for some reason you could just run a command for it .. but it would always be started .. kinda makes sense

17:58 augustl: technically speaking it can, afaik

17:58 aperiodic: that is the usual strategy for development. run a repl or swank server, restart it only when you have to, and run tests in a persistent autotest mode so you don't have to wait on jvm startup

18:00 wingy: yeah i have to find my dev flow for clojure/java

18:01 it sure won't be like the one for node

18:01 and perhaps it shouldn't

18:01 aperiodic: do you use vim/emacs?

18:01 wingy: no

18:01 sublime text as a interim editor

18:08 aniero: wingy: vim or emacs gets you in-editor code evaluation with varying levels of hackery involved in making it work

18:08 recommend lein-tarsier + vimclojure, if you do vim. emacs, you're on your own

18:09 ... or most people in here can help with that, i assume :D

18:09 wingy: :)

18:10 aniero: wingy: have a project you're working on?

18:10 wingy: yeah

18:11 i hope 2 weeks will get me up to speed with clojure

18:11 aniero: it'll probably take longer than that... heh

18:12 wingy: why i hope

18:12 aniero: think i'm getting the hang of things, though

18:18 SrPx: 2 days trying to learn clojure and I can't even get a hello world because I can't do anything with emacs, clojure repl won't work with sublime, not good with notepad++, don't know eclipse

18:18 sigh : /

18:19 hyPiRion: Tried clojure-box?

18:20 http://clojure.bighugh.com/

18:20 amalloy: SrPx: just use your favorite editor, and don't bother with editor integration. paste it into a command-line repl

18:21 ivaraasen: SrPx: had some problems with the repl in Sublime myself. worked once i fixed the keymapping

18:21 SrPx: hmm

18:22 amalloy: but everything uses leiningen

18:22 amalloy: yes, and i advocate using leiningen

18:22 wingy: just use the command line instead

18:22 SrPx: ivaraasen: you are using sublime?

18:22 amalloy: from the command line

18:22 wingy: SrPx: i am .. but just for editing text

18:22 amalloy: you don't need any editor support to use clojure productively

18:22 SrPx: ivaraasen: how did you fix the repl?

18:22 ivaraasen: SrPx: yeah

18:22 i have leiningen installed though

18:23 wingy: wow cool .. lein repl includes clojuredocs examples

18:24 but bad that i have to run (doc *ns*) and then (cdoc *ns*(

18:24 but bad that i have to run (doc *ns*) and then (cdoc *ns*)

18:24 SrPx: ivaraasen: how did you do it

18:46 wingy: programming is like a game in which you want to escalate to the next level

18:49 ivaraasen: wingy: i prefer trying to glitch the games

18:51 augustl: speaking of games, have anyone ever created games with Clojure? I suppose interfacing with LWJGL from clojure isn't too hard.

18:51 antares_: augustl: people typically use clojurescript for games

18:52 augustl: for browser based games, you mean?

18:52 aperiodic: augustl: there are implementations of tetris & asteroids in penumbra's examples folder (https://github.com/ztellman/penumbra/tree/master/test/example/game)

18:52 ivaraasen: augustl: i've seen a guy do Minecraft mods in Clojure

18:53 aperiodic: (this seems to be a really popular question here in the past few days)

18:53 augustl: ivaraasen: ah, interesting, I'll look that up

18:54 ivaraasen: augustl: it's named conjcraft if I remember correctly

18:54 augustl: yeah just found it, that's correct

19:21 recur: Hi, I'm a clojure n00b. I want to repeatedly apply a function a set number of times passing in the output as the input. Is there a simple way to do that (I'm trying not to create loops :) )?

19:24 jjido: recur: you want a fold it seems

19:25 recur: oh cool, looks perfect

19:25 thanks jjido, didn't know that existed :)

19:28 jjido: recur: it is called reduce

19:28 ,doc reduce

19:28 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0)>

19:28 recur: oh haha, i was looking at the actual clojure 'fold' function

19:28 wow, clojurebot failed

19:28 jjido: I failed

19:29 recur: ,doc fold

19:29 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0)>

19:29 recur: at least it doesn't crash :D

19:29 an egg drop hitting an exception on the other hand… :P

19:30 hyPiRion: ,(doc reduce)

19:30 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

19:30 hyPiRion: It didn't fail, it returned exactly what you would expect it to return.

19:31 aperiodic: ,(take 10 (iterate inc 0))

19:31 clojurebot: (0 1 2 3 4 ...)

19:31 aperiodic: recur: i think iterate is what you want

19:31 ,(doc iterate)

19:31 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

19:31 recur: ahh, awesome

19:32 ,(rest '(3 4 5))

19:32 clojurebot: (4 5)

19:32 recur: sweet bot :)

19:32 aperiodic: ~botsnack

19:32 clojurebot: Thanks! Can I have chocolate next time

19:34 recur: ,(clojure.repl/doc first)

19:34 clojurebot: "([coll]); Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil."

19:35 recur: sweet, learned how to use namespaces at the same time. Pretty useful 5 mins :)

19:35 thanks for the info!

19:36 hehe, with light table and doc, I now have my own personal dynamic reference page :)

19:58 wingy: lein is the defacto for clojure i guess. no need to look at maven at all?

19:59 gfredericks: not unless you're already using it or have some organizational incentive like that

19:59 ivaraasen: i really need to try Overtone

20:01 wingy: looks really cool

20:01 music in code

20:03 SrPx: Can I use java libs on clojurescript? (guess not =S )

20:03 wingy: SrPx: yes

20:03 SrPx: wingy: o.o

20:03 wingy: full java interop

20:03 gfredericks: no

20:03 SrPx: ...

20:04 wingy: oh ...

20:04 O_o

20:04 gfredericks: unless maybe you run it on rhino I suppose

20:04 but if you're doing that there's no reason to use cljs

20:04 wingy: oh clojurescript :P

20:04 gfredericks: there are easier ways to slow your code down

20:04 I recommend Thread/sleep

20:05 wingy: :)

20:06 overtone looks neat!

20:06 finally no more software pianos!

20:06 SrPx: õo

20:06 lol.

20:18 kovasb: this 1424 build of cljs is killing me

20:18 anyone know how satisfies? has changed?

20:19 ivaraasen: wingy: also, OSC integration is quite nice. i've done a few small live sessions using my Android phone to control Renoise.

20:20 gfredericks: I'm not sure how lein cljsbuild tests are supposed to work

20:21 kovasb: clojure needs the sponsorship of some internet billionare

20:21 so many lose ends

20:23 gfredericks: a lot of ends have been tightened so far

20:23 kovasb: yes, but the surface area is speeding :)

20:23 spreading

20:25 fml. i can't event ind where satisfies? is implemented in the source

20:27 ah there we go.

20:42 gfredericks: with the cljsbuild browser repl, is there any way to update code without restarting everything involved?

20:45 kovasb: update code?

20:45 wingy: seems that you really don't need to install clojure at all

20:45 gfredericks: like change my source code

20:45 and have the repl reflect that.

20:45 kovasb: you can reload the application without rebooting the repl

20:45 wingy: your install jvm then lein .. and it will fire up clojure using "lein repl"

20:45 kovasb: the repl state will remember what namespace you are in

20:46 but the state in the browser will be wiped out

20:46 gfredericks: so refresh the page and reconnect?

20:46 wingy: could someone confirm

20:46 kovasb: the connect should happen automatically

20:46 wingy: yes

20:47 wingy: kovasb: yay

20:47 gfredericks: kovasb: mine is manual

20:47 kovasb: often i just move to the namespace at the repl and paste the new code in

20:47 hmm

20:47 gfredericks: which is how I set it up

20:47 just to aggravate myself apparently

20:48 kovasb: cool YMMV but it works "most" of the time for me

21:08 wingy: why do i have to quite 1: (def a ^{:created (System/currentTimeMillis)} 1)

21:08 that wont work, this do: (def a ^{:created (System/currentTimeMillis)} '1)

21:08 i dont get why

21:09 since (def a 1) without quoting works

21:10 gfredericks: oh you can't put metadata on numbers

21:10 it works the second way but not really

21:10 it just doesn't crash

21:11 when you add the quote you're essentially writing (quote 1)

21:11 Iceland_jack: gfredericks: Doesn't it apply the metadata to the quote?

21:11 Right

21:11 gfredericks: so the metadata gets added to that list

21:11 which gets lost at compile time

21:11 so there's no effect

21:11 you can put the metadata on the var though

21:12 arohner_: wingy: metadata can only be added to clojure objects (vars, symbols, datastructures)

21:12 wingy: i thought that was what i did

21:12 arohner_: java ints and strings are final, so clojure can't extend them

21:12 gfredericks: wingy: move it to before the a

21:12 wingy: this works: (def a ^{:created (System/currentTimeMillis)}

21:12 [1 2 3])

21:12 ah .. i think i get it

21:12 gfredericks: wingy: yeah vectors can have metadata

21:13 wingy: right

21:13 gfredericks: ,(with-meta {:foo 2} #{1 2 3})

21:13 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to clojure.lang.IPersistentMap>

21:13 gfredericks: ,(with-meta #{1 2 3} {:foo 2})

21:13 clojurebot: #{1 2 3}

21:16 wingy: is ^ a sugar syntax for with-meta?

21:16 gfredericks: not quite

21:16 ^ is read-time metadata attached to the code itself

21:16 whereas with-meta is a runtime function call

21:17 wingy: but in the end the meta data that is created is no different?

21:17 just different ways to create it?

21:18 gfredericks: well you have to be careful with the difference. In a lot of cases read-time metadata only has any effect if a macro or an element of the compiler is expecting it

21:18 if not it may not make it through to runtime

21:19 I could say (if foo ^{:haha true} bar baz) in my code

21:19 and the metadata would be meaningless

21:19 wingy: i see

21:20 gfredericks: because the compiler isn't expecting metadata there

21:21 ,(meta (with-meta {} {:my :meta}))

21:21 clojurebot: {:my :meta}

21:21 gfredericks: ,(let [x {}] (meta ^{:my :Meta} x))

21:21 clojurebot: nil

21:22 gfredericks: ^ that's the difference I'm talking about

21:22 ,(meta ^{:my :Meta} {})

21:22 clojurebot: {:my :Meta}

21:22 gfredericks: ^ however that also

21:25 wingy: didnt know the last one worked

21:25 gfredericks: it's because the map {} compiles to itself

21:25 so it carries the metadata with it to runtime

21:25 wingy: so ^ isnt counted as a arg

21:25 gfredericks: correct

21:26 the reader immediately places the metadata on the map it creates

21:26 the compiler sees a list of two elements

21:26 a symbol meta and an empty map

21:26 it resolves the symbol meta to clojure.core/meta, and compiles to code that will call that var with the map as its argument

21:26 wingy: i see

21:27 gfredericks: it's the same map that the reader attached the metadata to, so it's still there

21:27 but in the middle case the reader attached the metadata to the symbol x

21:27 wingy: good thing to do is to know how clojure works exactly under the hood

21:27 gfredericks: which is not what the clojure.core/meta function is receiving as its argument

21:27 wingy: right

21:28 gfredericks: it took me a while to get the readtime/runtime distinction

21:28 wingy: i understood parse time and run time pretty quick in js .. have to get the clojure internals more in details

21:29 gfredericks: macros are a lot easier once you understand read vs compile vs run

21:29 wingy: run is eval?

21:29 gfredericks: no I just meant runtime

21:30 wingy: ok so 3 phases

21:30 gfredericks: yeah, at least abstractly

21:30 I'm not actually familiar with the internals too muchu

21:31 wingy: read time: source code to code structure, compile time: code structure to byte code, run time: run byte code

21:31 is that correct?

21:31 gfredericks: yep

21:31 macros run at compile time

21:32 wingy: yeah they manipulate the data structure at compile time

21:32 gfredericks: exactly

21:34 wingy: so the reader is for the first part, the compiler for the next .. is there a "runner" or is the compiler running it once it has the byte code?

21:34 gfredericks: I think that's just the jvm running it

21:34 wingy: ok

21:35 someone here said that parse-string is the reader

21:35 gfredericks: read-string?

21:35 clojurebot: read-string |is| as unsafe as eval unless *read-eval* is bound to false.

21:35 wingy: yeah

21:35 gfredericks: yeah that's basically it

21:35 wingy: and if you pass the returned data structure to eval it will be compiled and run

21:35 gfredericks: yep

21:36 read-string is good for figuring out what the reader macros do

21:36 wingy: so one can say from a higher perspective that eval is compiler/runner ?

21:36 gfredericks: I think it wraps the expr in a function, compiles that, and calls the function

21:36 so sorta

21:36 wingy: ok

21:37 mindbender: how do I install a plugin in lein2?

21:40 wingy: gfredericks: for how long have you been using cljure?

21:40 gfredericks: three or four years or something

21:40 wingy: wow

21:40 you must be very productive in it

21:41 gfredericks: it just makes me grumpy about other languages

21:41 wingy: yeah

21:41 it already has that affect on me

22:45 isnt there a good way to browse https://clojars.org/

22:54 mindbender: does the :extra-classpath-dirs option still work with lein2 cos I just got an error when trying to swank into a project that uses that option to specify the file the jvm was complaining of not finding?

22:55 technomancy: ^^

22:55 technomancy: mindbender: it was removed in 2.x; try :resource-paths

23:18 frozenlo`: I'm using org-mode to write a text. In it I link to some images (with [[./folder/img.jpg]]). I want to use the exported as an input for Noir. So I do this `(slurp "my-html.html") and it works perfectly... except for the images. The "." appears in the images path, messing evertyhing up. Any workaround?

23:30 mindbender: technomancy: :resouce-paths got me up to having swank server started. I'm using :plugin [lein-swank "1.4.0"] then I get similar issue to https://github.com/technomancy/swank-clojure/issues/92. I on cygwin emacs 23.4.1

23:32 technomancy: hm; I don't know what causes that

23:32 mindbender: even slime-connect says connected but doesn't create slime-repl buffer

23:35 could it be a plugin conflict?

23:35 technomancy: unlikely; it's probably on the elisp side

23:38 frozenlo`: Solved my problem. If anyone is interested, here is a little function to export org document to an html usable by Noir. https://gist.github.com/3026701

23:54 michaelr525: good morning

23:58 wingy: good morning

Logging service provided by n01se.net