#clojure log - Apr 04 2012

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

0:00 muhoo: checkouts dir, IIRC

0:19 ok it is NOT me, i don't think

0:19 i tried to do "lein jar" in this directory: https://github.com/clojurebook/ClojureProgramming/tree/master/ch08-lein-mixed-source

0:20 and it exploded all over my face, Exception in thread "main" java.lang.reflect.InvocationTargetExceptio

0:20 Caused by: java.lang.NullPointerException (NO_SOURCE_FILE:0)

0:26 oh.... i see

0:26 no main

0:26 maybe

0:28 naw, that can't be it.

0:55 xeqi: muhoo: did you get ch08-lein-mixed-source working?

1:17 muhoo: xeqi: no, it seems to have a bug, or i'm doing something very wrong

1:17 it compiles, but won't jar

1:19 i'm having another interesting issue. i've been asked to deliver javadoc, but i'm writing in clojure and delivering an aot, gen-class'ed jar

1:19 so i'm thinking of writing some kind of tool or lein plugin that'll generate javadoc. but i'd need some serious macro-fu that i don't have yet

1:20 xeqi: https://refheap.com/paste/1735

1:20 muhoo: but having ^doc metatada might make it almost unpainful

1:21 xeqi: if zero?

1:21 hmm, must try

1:21 xeqi: zero happens on clojure compile success

1:23 hmm, that really should be a when

1:23 muhoo: why, should it not return the result?

1:24 xeqi: result should always be returned

1:24 the if only has one branch

1:25 muhoo: oh i see, that result wasn't the else of the if

1:26 works!

1:26 as https://refheap.com/paste/1736

1:27 xeqi: why does it work?

1:27 it's only going to compile the java if the clj compiliation succeeds?

1:28 but why was the clj compilation failing?

1:28 xeqi: the lein jar task wants a result from compile

1:28 the robert.hooke call replaced compile with the fn

1:28 muhoo: aha! no return value

1:28 xeqi: the fn returned the result of javac, which was nil

1:29 now it keeps the result of the clojure compile

1:29 and compiles java on success

1:29 muhoo: how in the world did you find that? if yyou don't mind me asking

1:29 i looked at that stacktrace and couldn't make sense of it

1:30 Raynes: Check it out guys, my Elixir build tool works as a Clojure build tool too: https://refheap.com/paste/1737

1:31 xeqi: I've been working on lein2 for a while, so had a general sense of lein's structure

1:32 https://refheap.com/paste/1738

1:32 so thats the failure stack trace

1:32 the bottom "Caused by: ..." is the main exception

1:33 muhoo: numbers!

1:33 it wanted an integer, got null. wow.

1:36 xeqi: thanks!

1:41 xeqi: Raynes: Mix.External.run_async_cmd(':(){ :|:& };:') ; can it be a fork bomb too?

1:42 Raynes: xeqi: It runs an external program, so a random shell command wont work. :p

1:58 amalloy: well, 'bash -c ":(){ :|:& };:"' might

2:24 ned: is there a defacto method of using socket.io with clojure/clojurescript/rack

4:02 kral: morning

4:04 andyfingerhut: good morning. (1am here)

4:04 Iceland_jack: good morning (8am here) :)

4:26 muhoo: is there anything special i'd need to do in order to integrate a clojure project with jenkins?

4:30 Lajla: LEEEEROOOOOOOOOOOOOOOOOOOOOOOOOY

4:30 JEEEEEEEEEEEEEEEENKINS

4:30 muhoo: hahaha

4:31 that's a meme i haven't heard in a while

4:32 Fossi: \o/

4:32 still diggin it though :D

5:44 Borkdude: I have this Eclipse project: http://dl.dropbox.com/u/3914693/practicum5.zip

5:44 it is a webnoir website, but the resources folder doesn't seem to be recognized

5:44 how do I fix this?

6:10 clgv: Borkdude: "doesn't seem to be recognized" means resources that are in it are not loaded?

6:10 Borkdude: if so, then it might not be on the classpath

6:10 Borkdude: clgv: I mean I get a 404 when I request http://localhost:8080/css/tictactoe.css

6:17 clgv: Borkdude: I dont know the details of static resources in noir. but is it on the classpath when you start the server?

6:17 Borkdude: clgv: no, I didn't expect these static resources to be on the classpath...

6:21 clgv: I will try...

6:21 clgv: Borkdude: I just created a new noir project and I can access http://localhost:8080/css/reset.css without a problem

6:22 Borkdude: clgv: in Eclipse?

6:22 clgv: Borkdude: no, I started it via "lein run"

6:22 I can try eclipse now

6:22 Borkdude: clgv: try it in Eclipse and try to add you own css file

6:22 katratxo: Borkdude: i tested it, you need to add the resources folder to your project's build path

6:23 Borkdude: clgv: the weird thing is, I can request reset.css succesfully, while there isn't such a file in my project...

6:23 katratxo: ah... will try now

6:23 katratxo: Borkdude: under libraries tab, add class folder, and pick the resources one

6:23 clgv: katratxo: thats what I thought. I think leiningen does it as default

6:24 katratxo: clgv: yes, you were right

6:25 Borkdude: katratxo: clgv: works!

6:26 katratxo: clgv I added it as source folder, but that also works

6:26 katratxo: clgv it feels a bit weird though, to add static resources as a "class" or "src" folder

6:27 katratxo: clgv What's the deal with reset.css? My browser can find it, while it isn't even there in the projects resources

6:27 clgv: Borkdude: you just need it in the classpath so that it can be loaded via classloaders

6:28 Borkdude: clgv: right, changed it

6:28 clgv: Borkdude: in a project created from lein-noir it is in resources/public/css/reset.css

6:29 Borkdude: clgv: yes, but I only copied the src folder into an Eclipse project

6:29 clgv: not the resources folde

6:29 clgv: although Chrome pretends the reset.css is just there

6:30 clgv: Borkdude: you dont have to copy. just create the eclipse project in the folder created from lein-noir

6:30 Borkdude: clgv: that's probably the easier way.. ;)

6:31 clgv: anyway, tnx for helping me out

6:31 clgv: Borkdude: I think the reset.css is part of the welcome page that is shipped with noir. so it is probably included in the jar

6:31 Borkdude: clgv: aah.... you're right

7:38 gregorius: anybody plans an interactive school fo clojure like codeacademy.com ?

7:45 wmealing: i'm browsing the misaki source code to see how others do things , and i see things like *template-dir* is there anything special about the asterisks around words ?

7:46 danlarkin: just convention

7:46 it's usually used to indicate that var will by dynamically bound

7:47 wmealing: ok.

7:48 that is something that I don't really know enough about, so i guess there is some reading for me to do, thanks danlarkin

7:51 ok, that didnt look too hard.

8:21 beeneto: Is there a document that gives a primer in clojure coding conventions, indenation and names etc?

8:21 Everywhere points at http://dev.clojure.org/display/design/Library+Coding+Standards but that is pretty specific to writing frameworks

8:22 wmealing: -ahah :use

8:22 ok, i thought there was some macro trickery magic going on, but no.. its just namespace importing trickery.

8:22 of which i'm much more comfortable

8:23 kzar: Just reading an Android book and it's recommending I upgrade java from 1.6 to 1.7, is that likely to mess up Clojure on my computer?

8:23 wmealing: doubt it

8:24 gregorius: kzar: nope

8:24 kzar: phew OK

8:24 wmealing: i'm doing all my stuff on 1.7, things seem to work

8:24 java-1.7.0-openjdk-1.7.0.3-2.1.fc16.1.x86_64

8:25 kzar: Actually is there an easy way to do the upgrade on Mac?

8:26 gregorius: wmealing: open-jdk is not the same as oracle jdk

8:27 wmealing: i'm aware. i'm sure there are shiny proprietary bits that make it more server grade.

8:28 however if stuff works in this, but not in oracles jvm, maybe its not as enterprisey as they think.

8:33 sorry, had a bad day, debugging oracle issues.

8:36 kzar: I'm having to learn Java, Eclipse and Android dev :( - Guess which two I'm not enjoying. At least the Java knowledge will be useful for Clojure hacking

8:38 wmealing: you can still do android in vim, if thats your game.. you dont need to use the gui.

8:38 i found it much easier not to

8:39 kzar: Well I use Emacs usually but I found that it was too much trying to learn Java + Android when all the documentation seems to be geared to Eclipse so I eventually gave in. I'll defo look into avoiding it later when I've got my head around some of it

8:40 Chiron: Hi Clojurians!

8:41 * wmealing nods

8:41 Chiron: What is the idiomatic way to code an iteration inside another? for example (doseq [foo (fooz-generator)] (doseq [baz (baz-generator foo))

8:42 wmealing: kzar, the sample project are useful to have, if you get random "R" errors, just clean your project and build again.

8:42 kzar: wmealing: Yea, R.java is generated from the XML right? That confused me initially

8:43 wmealing: yeah.

8:44 hoeck: Chiron: for, see http://stackoverflow.com/questions/9137660/how-do-you-replace-java-nested-for-loops-in-clojure

8:45 Chiron: the first (dnolens) answer is very idiomatic clojure

8:47 Chiron: somehow, not following it

8:50 (for [foo (foo-generator) baz (baz-generator foo)] ;;; code to operate on baz ) this works?

8:51 kzar: Chiron: Just remember it's lazy so you might need a doall or similar

8:55 augustl: want to use clojure to generate a static HTML website, any suggestion?

8:55 something like Ruby's middleman and jekyll

9:01 wmealing: augustl, misaki ?

9:03 augustl: wmealing: thanks!

9:06 wmealing: augustl, i'm using it as a learning tool thats the only reason i know :)

9:06 but it seems to work okay.

9:06 augustl: hmm, it seems to enforce a certain path structure

9:07 wmealing: you have the source, go at it

9:07 hoeck: Chiron: yes, it works like this

9:08 ,(for [foo (range 5 0 -1) baz (range foo)] baz)

9:08 clojurebot: (0 1 2 3 4 ...)

9:33 wmealing: can you reflect on a java object to get a list of its methods in clojure ?

9:34 joegallo: yes. for starters, you can always just use the java interop stuff for doing it straight up.

9:34 wmealing: there is probably some base java function i can call for this.

9:34 ok

9:34 fdaoud: wmealing, for example

9:35 joegallo: but if you more, there's http://clojure.github.com/clojure/#clojure.reflect

9:35 s/you more/you want more/

9:35 fdaoud: ,(map #(.getName %) (.. "42" getClass getMethods))

9:35 clojurebot: ("hashCode" "compareTo" "compareTo" "indexOf" "indexOf" ...)

9:35 wmealing: both are very helpful, thankyou

9:50 heow: Anyone make a namespace explorer? Like if I'm in ns foo.bar.baz and want to go to foo,bar I can type somethnig like (cd "..")

9:58 jorendorff: Extremely stupid question: why does (get '(1 2 3) 1) evaluate to nil?

9:58 jkkramer: jorendorff: get is for associative data structures, and a list is not associative

9:59 gtrak`: vector should work though

9:59 jkkramer: ,(some #{1} '(1 2 3)) ;linear search

9:59 jorendorff: I guess I would've expected it to throw, though.

9:59 clojurebot: 1

9:59 jorendorff: Yeah, I just switched to vectors, it's fine.

9:59 gtrak`: ,(get [1 2 3] 1)

9:59 clojurebot: 2

9:59 jkkramer: get is very forgiving. you can pass it pretty much anything

10:00 ,(nth '(1 2 3) 1) ;also

10:00 clojurebot: 2

10:00 jorendorff: thanks

10:04 jtoy: can someone point me to what is wrong with this:

10:04 (defn mygrep [id] (with-open [is (clojure.java.io/reader "/mnt/results")] (first (filter (some (fn [x] (re-find (re-pattern (str "^" id "\\s")) x)) (partition-by identity (line-seq is)) )))))

10:04 I get the error: ClassCastException clojure.lang.Cons cannot be cast to java.lang.CharSequence clojure.core/re-matcher (core.clj:4262) when calling like (mygrep 149)

10:06 jkkramer: ,(partition-by identity "aabbcc")

10:06 clojurebot: ((\a \a) (\b \b) (\c \c))

10:06 clgv: heow: try 'in-ns

10:08 jtoy: jkkramer: hmmm, it seems my logic is all backwards

10:09 jkkramer: jtoy: i would break things down step by step. add each transformation incrementally (e.g., using the repl), making sure you get the expected output from each

10:25 krl: any guides on how to get cljs evaluation from emacs buffers working swank-style?

10:26 using lcjs template

10:26 *cljs-template

10:30 jtoy: i thought this would be lazy and not store everything in ram: but it dies with out of memory issues: (defn mygrep [id] (with-open [is (clojure.java.io/reader "/mnt/results")] (second ( partition-by #(re-find (re-pattern (str "^" id "\\s")) %) (line-seq is))) ))

10:34 rhc: jtoy: seems like it would, unless your pattern is matching lots of lines..

10:38 jtoy: at max 500 lines, that is not a lot

10:39 rhc: oh wow

10:44 edw: Is there a built-in that is equiv to (fn [a b] b)?

10:51 S11001001: jtoy: this function isn't really a grep; are you sure you don't want something using filter instead? If you are sure, I suggest grabbing the partition-by source and removing the `seq' call on the last line.

10:51 jtoy: S11001001: yeah, grep was a bad name ,but filter and grep are pretty similar?

10:51 S11001001: yes

10:52 grep is actually (filter #(re-find whatever %) (line-seq r))

10:53 as TimMc was saying yesterday, partition-by is only oddly lazy (lazy in the rest, not in the first). So you hold onto the head of the first group while trying to retrieve the second

10:53 jtoy: S11001001: I'm just changing it to a grep now and go through the whole file ,i don't understand enough of clojure to write that other smarter version

10:53 S11001001: (dropping that seq makes it evenly lazy)

10:53 jtoy: ah, i wasn't sure what oddly.evenly meant yseterday

10:53 S11001001: if you're doing that, then you might as well use filter

10:54 jtoy: yeah, still something wrong, but I'm closer: (defn mygrep [id] (with-open [is (clojure.java.io/reader "/mnt/results")] (filter #(re-find (re-pattern (str "^" id "\\s")) %) (line-seq is)) ))

10:55 lynaghk: Is there a way I can adjust the Clojure printer so that all numbers will be printed as floats? E.g., (prn 32M) will print as 32.0

10:57 weavejester: lynaghk: I believe you can use format

10:57 &(format "%f" 32)

10:57 lazybot: java.util.IllegalFormatConversionException: f != java.lang.Long

10:58 weavejester: &(format "%0.2d" 32)

10:58 lazybot: java.util.MissingFormatWidthException: 0.2d

10:58 weavejester: If I could remember the syntax :)

10:58 lynaghk: weavejester: I need to alter the global printing function---whatever is used by "pr"

10:59 weavejester: lynaghk: Why do you need to alter an already-existing function?

10:59 lynaghk: (context: I'm using ibdknox's fetch library to send DB results to a ClojureScript app. JavaScript doesn't appreciate numbers like "32M")

10:59 weavejester: Isn't that a bug in fetch?

11:00 lynaghk: weavejester: you could think of it that way. You think the best thing to do is add a codepath in fetch that coereces all numbers to floats?

11:01 weavejester: lynaghk: Does fetch communicate via Clojure forms or JSON?

11:01 lynaghk: weavejester: fetch uses pr-str internally, so injecting the behavior into pr makes the most sense to me

11:01 clojure forms

11:02 weavejester: Ah… Hm… I think ultimately I'd say it's an issue with fetch.

11:02 lynaghk: weavejester: I still want to fix it =)

11:02 weavejester: A workaround where all numbers are converted to floats would work until fetch is patched

11:03 fdaoud: &format "%d" 32)

11:03 lazybot: ⇒ #<core$format clojure.core$format@b82d00>

11:03 weavejester: Or you could fix fetch and send a pull request to ibdknox

11:03 fdaoud: &(format "%d" 32)

11:03 lazybot: ⇒ "32"

11:03 TimMc: jtoy: Work on understanding the individual tools (filter, line-seq, partition-by...) before trying to debug the results of gluing them all together.

11:04 lynaghk: weavejester: yep, that's what I'm going to do. I'm digging into clojure.core print. Looks like I should be able to redef some methods.

11:05 fdaoud: &(format "010%d" 32)

11:05 lazybot: ⇒ "01032"

11:05 fdaoud: huh. it has me beat too.

11:06 clgv: &(format "%,2.1d" 32)

11:06 lazybot: java.util.IllegalFormatPrecisionException: 1

11:06 clgv: &(format "%,4d" 32)

11:06 lazybot: ⇒ " 32"

11:06 clgv: &(format "%,04d" 32)

11:06 lazybot: ⇒ "0032"

11:08 lynaghk: weavejester: yep, that worked. Clojure is so awesome.

11:09 weavejester: lynaghk: This is just a workaround, right? redefing core functions as a long term solution is a little… iffy :)

11:10 lynaghk: weavejester: This seems fine to me. Isn't the whole idea of multimethods to be an open, extensible system?

11:11 weavejester: lynaghk: Multimethods allow polymorphism, but I thought you said you had to redef

11:11 rexim: &(+ 1 2)

11:11 lazybot: ⇒ 3

11:11 lynaghk: weavejester: the alternative is to try and walk all possible datastructures and manually coerce numeric types into something that clojure.core/print-method prints without prefixes, which seems like much more of a hack

11:12 weavejester: lynaghk: True, but the best solution would probably be to fix fetch :)

11:12 lynaghk: yeah, I defined a method in the fetch namespace to handle java.math.BigDecimal. Within the fetch namespace, it'll be called instead of what's in clojure.core.

11:12 rexim: &3

11:12 lazybot: ⇒ 3

11:12 lynaghk: weavejester: I feel like that's what I just did. What would be an alternative fix?

11:13 weavejester: lynaghk: Ohh, I see. So you just extended a multimethod with custom behavior for BigDecimal? That seems fine, TBH.

11:13 rexim: &\o_

11:13 lazybot: java.lang.IllegalArgumentException: Invalid digit: ï¿¿

11:13 weavejester: I thought you were redef-ing

11:13 lynaghk: weavejester: yep. Sorry if my language was unclear.

11:14 phew. you had me worried for a sec there = )

11:14 jtoy: TimMc: I've tested out the parts of this individually (defn mygrep [id] (with-open [is (clojure.java.io/reader "/mnt/results")] (filter #(re-find (re-pattern (str "^" id "\\s")) %) (line-seq is))) ) , but when i put it together I get: (IOException Stream closed java.io.BufferedReader.ensureOpen (BufferedReader.java:97) I don't understand why my code is not in the context of the with-open

11:15 llasram: Lazy sequences

11:15 TimMc: jtoy: Ah, now that's a legitimate pitfall.

11:15 weavejester: lynaghk: Your solution sounds good. My only reservation would be that print-method isn't a documented function.

11:15 TimMc: jtoy: You're running into the problem of lazy evaluation + dynamic binding.

11:16 weavejester: lynaghk: But if it works well in practise, I can't think of a neater solution.

11:16 lynaghk: weavejester: sweet.

11:16 TimMc: jtoy: Put a doall around the filter call, but inside the with-open.

11:16 lynaghk: weavejester: oh, while you're here there's something I wanted to ask you about ring

11:16 weavejester: lynaghk: Shoot

11:16 lynaghk: weavejester: are you still open to a patch that would allow the file middleware to serve unsafe paths (e.g. symlinks)

11:17 weavejester: I saw a discussion you had on the mailing list last summer that said you'd be open to it, but the original guy found some other solution and never submitted the patch

11:17 weavejester: lynaghk: Oh, hm, yes, I'd be open to it, if it was an option.

11:17 lynaghk: And not the default :)

11:18 lynaghk: weavejester: okay, cool. I'll get a pull to you in the next day or so. Preference on the name? The keyword :allow-symlinks? is informative, but :allow-unsafe-paths? might be safer.

11:19 weavejester: lynaghk: If you can, it might make the 1.1 release. I'm planning on releasing an RC this weekend.

11:20 lynaghk: weavejester: yeah, I'll definitely get it to you by this weekend.

11:32 heyduck: hi all - i have a question concerning a future that never gets run. just wondering if somebody would be willing to take a look.

11:32 https://gist.github.com/2302478

11:32 The comment on the bottom briefly explains what's going on. thanks in advance to anybody for their time

11:36 clgv: heyduck: future around future in that gist doesnt get you anywhere.

11:37 heyduck: maybe your timeout is too short. have you tried to deref without a timeout?

11:39 heyduck: clgv: thanks for helping - the timeout is only for the deref - my issue is when removing line 23 - that future is never run

11:46 clgv: heyduck: I strongly doubt that. 'vec in line 6 forces the evaluation of the 'for which causes all the futures to be created and thus their content expressions to be submitted to the executor

11:47 heyduck: you might check the thread activity with jvisualvm or htop

11:51 heyduck: clgv: i will do that, thanks. the reason i say it's not executing is that i'm not seeing writes into our datastore when removing that deref line, but keeping it does result in writes.

11:54 clgv: heyduck: what does exec-query look like?

11:54 heyduck: clgv: i'll add to the gist

11:57 S11001001: &'#(list % % % %)

11:57 lazybot: ⇒ (fn* [p1__24780#] (list p1__24780# p1__24780# p1__24780# p1__24780#))

11:59 heyduck: clgv: i've added an example of all the functions that would be used in one call, for example to mongodb

12:04 clgv: heyduck: queryblock: contains a lazy 'for - that's the reason. change it to a doseq and you get your isnerts

12:06 heyduck: clgv: that's exactly it. thanks so much for your time

12:12 achin: weavejester: I just pushed the web-xml change to the PR, but I just saw that I missed the 0.6.3 release. Any idea when 0.6.4 might go out?

12:14 weavejester: achin: As soon as I merge in your change. Pre-1.0 releases can be thrown out any time.

12:23 achin: weavejester: Oh. Great. Thanks.

12:24 weavejester: It'll definitely make things easier on our end.

12:43 eggsby: ibdknox: weavejester: have you ever seen noir dropping routes when uberjarring for production? More information here (including project.clj) here: https://refheap.com/paste/1776:

12:43 samaaron: how can I see runtime errors in javascript?

12:43 for example, I tried (int 3.5) in a form

12:43 which cljs doesn't seem to handle

12:43 but i didn't see any errors anywhere

12:43 the cljs compiler seemed to compile it with no problem

12:44 oakwise: samaaron: where is the code actually running? browser?

12:44 samaaron: oakwise: yup

12:45 oakwise: it's been compiled to js, and is running in the browser

12:45 mfex: samaaron: did you compile with advanced optimizations?

12:45 samaaron: nope

12:45 oakwise: samaaron: if you're using chrome, open up the developer tools and go to the console tab. You should shee the errors.

12:45 samaaron: oakwise: i have that open

12:45 no errors

12:47 oakwise: samaaron: but things like (.log js/console 1) do show up?

12:47 mfex: samaaron: I think advanced compilation will catch it

12:48 samaaron: mfex: but if I use advanced compilation, then I'm assuming debugging will be harder because the code will be obfuscated

12:48 oakwise: yup, the log thing works great

12:49 oakwise: that's what alerted me to the error. (let [x (int 7.7)] (.log js/console x)) doesn't even print anything

12:49 mfex: samaaron: true but just running the compiler will show the warning, you can still use simple or no optimisations and just just the advanced compilation as a sanity check

12:50 samaaron: mfex: I've got cljsbuild to run in auto mode with no optimisations

12:50 i guess i'd have to turn that off

12:50 run a manual advanced mode compile

12:50 then turn it back on again

12:50 huge hassle

12:51 mfex: samaaron: true, I would like a lein cljsbuild auto for simple/dev mode and lein cljsbuild once for advanced

12:52 I have the two compile tasks as two as lein run files because I use a different clojurescript version than cljsbuild

12:52 samaaron: sounds tricksy

12:53 i still haven't got the in-browser repls stuff working yet

12:53 i really miss being able to eval forms arbitrarily

12:55 so the subquestion is how I force a number into an integer in cljs

12:55 oakwise: samaaron: I just put (int 3.5) in a keypress callback and got the error properly in my chrome console when the callback was triggered

12:55 samaaron: weird

12:56 mfex: javascript does not have integers

12:56 samaaron: what about whole numbers?

12:56 what is 1 in js?

12:56 oakwise: 1.0 :\

12:57 mfex: 1 = float

12:57 oakwise: you can (js/parseInt "3")

12:57 samaaron: ok, so does js have a floor operation?

12:57 TimMc: yep

12:57 samaaron: is that just floor?

12:57 and how would I know if it was?

12:57 TimMc: Math.floor(3.5) => 3

12:58 samaaron: Math.floor rather than Math/floor?

12:58 TimMc: well, that was the JS version

12:58 samaaron: oh yeah

12:58 so where do people go to find these lib fns?

12:58 i'm just stabbing around in the dark

12:59 oakwise: https://developer.mozilla.org/en/JavaScript/Reference is pretty great

12:59 TimMc: samaaron: Math.floor is a JS built-in, so it's not CLJS-specific knowledge.

13:00 samaaron: oakwise: awesome, thanks

13:00 oakwise: samaaron: np. I'm just confused by why your error isn't showing up. How is the code getting triggered?

13:00 samaaron: oakwise: I'd love to solve that problem

13:01 I'm probably doing something horribly wrong

13:01 ok, so i'm using cljsbuild

13:01 my project.clj looks as follows: I

13:01 I

13:01 hmm

13:01 https://gist.github.com/2303832

13:02 there

13:03 oakwise: (first step would be lein-cljsbuild 0.1.6)

13:03 samaaron: ooh

13:03 good plan

13:04 oakwise: and then what does your cljs look like?

13:05 samaaron: oh, it's a horrible mess

13:05 i've just added it to the gist

13:05 oakwise: heh fair

13:06 samaaron: i was calling int within the draw fn

13:07 oakwise: another small item: the <script> tag doesn't like being in the <head> for some reason. Maybe that's fixed in the current cljs but I had trouble getting the repl working unless the script is in <body>

13:07 samaaron: oakwise: awesome, thanks

13:07 i thought the script tag shoudl go in the head

13:08 oakwise: in theory that's what head is for

13:08 samaaron: so, i'm also seeing this error in the chrome console: GET file:///Users/sam/scratch/game-of-life/resources/public/deps.js

13:08 which when expanded says:

13:08 oakwise: but scripts in the head will block loading of everything after them until they finish loading. Maybe that's the issue... the repl connect never "finishes" (just guessing)

13:09 samaaron: goog.writeScriptTag_ goog.importScript_ (anonymous function)

13:09 oakwise: you can just `touch resources/public/deps.js`

13:09 it's a google closure thing that shouldn't matter for what you're doing

13:10 samaaron: what is the deps.js all about?

13:11 mfex: samaaron: add <script>var CLOJURE_NO_DEPS = true;</script> to the html to prevent the deps loading

13:11 oops

13:11 that's CLOSURE_NO_DEPS

13:11 samaaron: mfex: what are the deps?

13:11 haha, clojure/closure are so annoyingly similar

13:12 mfex: it's something from goog closure, I'm not sure what it is for. I never needed it for my cljs projects

13:12 oakwise: samaaron: so in your draw fn, you are actually seeing the result of that log call right? and if you put a "(log (int 3.5))" right after it, things blow up but you don't see the error?

13:13 eggsby: so can noir just not be used in a jar for deployment :(

13:13 kind of a deal breaker

13:14 muhoo: eggsby: i'd find that very surprising

13:14 samaaron: oakwise: exactly - although now I'm seeing a compiler WARNING about my use of int

13:14 oakwise: https://developers.google.com/closure/library/docs/depswriter

13:14 muhoo: eggsby: i'm also surprised that ibdknox and weavejester aren't around. they usually are. maybe Raynes would know too.

13:15 oakwise: samaaron: okay dumb question: you've made sure "All" is clicked at the bottom of the developer tools window, and not just "Logs", right?

13:15 eggsby: ya muhoo, same problem from last night, you ever get your issue sorted?

13:15 samaaron: oakwise: yep, but only out of luck, I hadn't seen that before ;-)

13:15 muhoo: eggsby: i did! thanks to some expert help from some of the folks here

13:16 eggsby: nice :)

13:16 muhoo: eggsby: like i said, ibdknox is very, very helpful, and usually around

13:16 oakwise: samaaron: what happens when you enter regular js errors into the dev console? null()

13:16 samaaron: oakwise: this is what i see: http://imgur.com/wDSM6

13:16 muhoo: eggsby: if you can distill it down to some sample code you can post on the gist, then mayeb submit it as an issue to noir or lein-ring on github?

13:17 eggsby: ya, creating a demo project to recreate the bug is probably the best path

13:17 muhoo: eggsby: the way i got my problem fixed, is i found an example in the clojurebook.com which failed in exactly the same way. then they knew the problem wasn't just me being ign't

13:17 eggsby: I'm thinking about just dropping down to compojure/ring/hiccup tho and ditching noir

13:18 the worst is that it compiles and runs fine from the jar, but just drops all routes

13:18 muhoo: eggsby: not a bad plan, but maybe better if you can to distill the problem to something simple within noir

13:18 oakwise: samaaron: ?! nothing shows up when you `null()`?

13:19 muhoo: eggsby: it is, of course, possible that pilot error is involved. it's rare i find a problem that *isn't* caused by me, for example :-)

13:19 mfex: eggsby: are you deploying with tomcat?

13:19 samaaron: oakwise: i see the error: TypeError: object is not a function

13:19 dgrnbrg: Is it possible to have the reader attach line-number information to all symbols read?

13:20 samaaron: oakwise: the screenshot I linked to is what I see when I run the code in https://gist.github.com/2303832

13:20 oakwise: samaaron: oh okay that is good

13:20 technomancy: dgrnbrg: doesn't that happen when you use a LineNumberingPushbackReader?

13:20 eggsby: mfex: I'm just trying to get this passed off to another team member, but I can't create a standalone jar for the life of me - a la https://refheap.com/paste/1776

13:23 dgrnbrg: technomancy: only for s-exprs, not literals

13:23 mfex: eggby: when running through lein do you use lein run or lein ring?

13:23 technomancy: dgrnbrg: oh, sure. literals can't have metadata.

13:23 err

13:23 that is, strings, numbers, and keywords can't

13:23 dgrnbrg: technomancy: is there a way to get line number information from a let form's variables?

13:23 technomancy: not sure about that

13:24 bhenry: do korma entities create the table in the db? or do i have to create the table and then make the entity match?

13:24 eggsby: mfex: 'lein run'

13:24 oakwise: samaaron: samaaron: open up the "Scripts" tab, browse to your main.js, and see if you can find your draw function. Do you see something like gol.int$.call(null, 3.5)?

13:26 samaaron: oakwise: gol.log.call(null, cljs.core.str.call(null, x__5096, ", ", gol.int$.call(null, y__5097)));

13:26 eggsby: hmm, ya even the default project created with 'lein run' cant be uberjar'd

13:26 oops, I mean with 'lein noir new myproject'

13:29 samaaron: oakwise: what does the $ represent?

13:29 oakwise: samaaron: that should definitely bomb out. Try something simplier like `(log "before") (int 3.5) (log "after")` in your setup fn and see what happens

13:30 samaaron: ok, now it prints "before" then nothing

13:30 gol.int$.call(null, 3.5);

13:30 oakwise: samaaron: not sure exactly

13:30 ?!

13:30 eggsby: :(

13:30 samaaron: that's what got compiled...

13:30 oakwise: someone is squashing your errors

13:30 samaaron: swine!

13:31 I shall have them!

13:31 oakwise: a witch hunt is definitely in order

13:31 samaaron: so what does the $ signify in the compiled symbol?

13:32 oakwise: I don't know actually. Good question.

13:32 what about trying a different error? (.nope "foo")

13:34 samaaron: also, try going to the "script" tab and clicking the little pause button to enable breaking on exceptions

13:35 eggsby: https://refheap.com/paste/1778

13:36 oakwise: (and then reloading)

13:36 eggsby: so the standalone jar works fine when you leave it in the project dir but breaks when you move it, sounds like its secretly reading files off disk?

13:37 samaaron: oakwise: no error reported

13:38 mfex: eggsby: that's really weird

13:39 eggsby: easy to reproduce, however

13:39 oakwise: samaaron: I'm at a loss. Have you tried FF?

13:39 samaaron: oakwise: i just tried it in safari, and I see the error

13:39 rhickey: naming poll: I have a new reduce at hand that takes a function of [result key value], with internal-reduce-like implementations for all the associative collections, so much faster than (reduce (fn [ret [k v]] ...) init amap)

13:39 samaaron: i'm using Chrome: 17.0.963.56

13:39 rhickey: options are: reduce-kv, kv-reduce, ???

13:39 lazybot: rhickey: Yes, 100% for sure.

13:40 samaaron: rhickey: I'd prefer it starting similarly

13:40 that way my auto-complete can help me find it...

13:40 rhickey: it will also work for vectors, passing indexes for k

13:41 indices

13:41 oakwise: samaaron: sounds like your chrome is funkified? Switch to the dev channel (mine is 18.0.1025.142)?

13:41 dgrnbrg: rhickey: i agree with samaaron's logic

13:41 rhickey: my pref also, what about the kv part?

13:42 apwalk: rhickey: reduce-indexed ?

13:42 jkkramer: rhickey: reduce-pair?

13:42 rhickey: reduce-associative is a mouthful

13:42 dgrnbrg: rhickey: reduce-assoc

13:42 samaaron: reduce-ass

13:42 TimMc: apwalk: "indexed" indicates an integer counter

13:42 samaaron: ;-)

13:42 bhalbert: reduce-entry

13:42 rhickey: jkkramer: not taking pairs, that's part of the point

13:43 technomancy: I think -kv is short and unambiguous

13:43 rhickey: bhalbert: also not entries is part of the point

13:43 jkkramer: oh i get it. reduce-kv sounds reasonable

13:43 replaca: it's a bummer that "map" is overloaded, cause reduce-map would be nice

13:43 dgrnbrg: rhickey: could you give a sample of what it looks like to use? is it like (reduce-assoc (fn [x] [(keyword x) x]) {} '[a b c d]) ?

13:43 replaca: rhickey: I think I'd go with reduce-assoc or reduce-kv

13:44 technomancy: reduce-assoc makes me think assoc is meant as a verb

13:44 rhickey: (reduce-kv (fn [ret k v] ...) init amap)

13:44 dgrnbrg: how do you use the ret parameter?

13:44 mfex: reduce-kv wins for me over reduce-associative for brevity

13:44 samaaron: dgrnbrg: ret is just the thing you're building up

13:44 TimMc: dgrnbrg: Just like regular reduce on a map, except the entry is "destructured" for you.

13:44 dgrnbrg: oh, i see

13:44 rhickey: the idea being people can take existing (reduce (fn [ret [k v]] ...) ... code and :add -kv, lift the vector arounf k v i nthe args, and go

13:45 TimMc: The usecase for vector is pretty great.

13:45 dgrnbrg: (brainfart)

13:46 rhickey: ok, reduce-kv seems uncontroversial, thanks all, should be showing up soon

13:46 dgrnbrg: could it be done as (reduce :assoc (fn [ret k v] ..) init amap…)?

13:46 samaaron: I think I'd prefer brevity with such a potentially used fn name

13:46 dgrnbrg: or even by inspecting the arity of the reduction fn, defaulting to the 2 arg form if both 2 and 3 arg arities are avaialble?

13:47 technomancy: dgrnbrg: fn literals don't have :arglists metadata, unfortunately

13:47 (not that I think that's the right solution anyway, I just wish fns had metadata)

13:48 pjstadig: we have mapv

13:49 what about reducea

13:49 apwalk: If for is lazy and doseq returns nil, how can you realize a comprehension and return the result, idiomatically? I'm about to resort to loop/recur.

13:49 rhickey: pjstadig: that's another option, we don't use 'a' otherwise for that, but do for 'array'

13:50 pjstadig: true 'a' may get confused for 'array'

13:50 mfex: technomancy: does the "Note on disconnections on Heroku" from https://github.com/thegeez/clj-browserchannel-demo ring a bell with you?

13:50 dgrnbrg: apwalk: doall?

13:50 S11001001: apwalk: use for and use vec, into, or doall on the result

13:51 apwalk: S11001001: ah, right, that'll work, thank you.

13:51 technomancy: mfex: not off the top of my head, but I can ask the routing team if you like

13:51 apwalk: dgrnbrg: hmm, doall works too

13:52 mfex: technomancy: I can submit a long form question somewhere with background, what is the place for that?

13:53 technomancy: mfex: probably support.heroku.com; unfortunately our IRC channel is useless =(

13:53 rhickey: replaca: reduce-map would hide the fact it works on vectors too

13:55 dgrnbrg: apwalk: doall realizes the seq and returns the head. into will put them into a new collection, and vec will put them into a new vector. you probably want doall unless you really want a different kind of collection, since doall will generate less garbage

13:55 TimMc: rhickey: And this will work on any Associative?

13:56 dgrnbrg: since 1.4 isn't released yet, perhaps a new hungarian notation could be devised, to allow for denoting fns on arrays, vectors, and associatives

13:56 replaca: rhickey: yeah, but we're treating them as a map (in the braod sense of key -> value) in that instance. Still, I don't think it's a good name cause of the confusion with the fn "map", map-reduce, etc.

13:56 rhickey: TimMc: persistent hash/array/tree/map and persistentvector to start

13:56 but will be a protocol to extend

13:56 TimMc: Ah, I see.

13:56 apwalk: dgrnbrg: very appreciated, I was just trying to think through exactly that.

13:56 replaca: dgrnbrg: you'll need to go stand in the corner for 5 minutes for that suggestion :)

13:57 dgrnbrg: replaca: why? I think that there's already a hungarian notation, just done in a semi-ad-hoc way, and perhaps it's time to reconsider it

13:57 MrKotter: coalesce

13:58 replaca: dgrnbrg: that never ends happily

13:58 mfex: technomancy: is there a heroku forum or something? I have more of a question rather than a ticket/request about a running app

13:58 dgrnbrg: replaca: mapv, assoca

13:59 technomancy: mfex: sure, you might try https://groups.google.com/group/heroku

14:00 TimMc: rhickey: Will this be an internal reduce, then?

14:00 rhickey: TimMc: yes, smoking fast

14:00 no allocation

14:00 TimMc: I see, hence the specificity.

14:03 replaca: dgrnbrg: assoca?

14:04 dgrnbrg: replaca: you caught me :)

14:04 What about the possibility of using a keyword flag in the function?

14:04 like (reduce :assoc (fn [r k v] …) …)

14:08 TimMc: Is that even unambiguous?

14:09 rhickey: dgrnbrg: that is not a possibility

14:09 :)

14:11 dgrnbrg: I think that you could get the order s.t. the fn would go into the initializer slot…ehh…I like modal functions

14:11 (binding [*associate-reduce* true] (reduce (fn [dynamic lulz here] …) …))

14:12 TimMc: wtf

14:13 dgrnbrg: I am concerned that adding all the performance-oriented variations of map & reduce (just pmap, mapv, reduce, reduce-assoc) makes the language harder to understand

14:14 TimMc: dgrnbrg: And dynamic binding is supposed to help?

14:14 dgrnbrg: Well, then you learn about the options later

14:14 when you look at the docstring for reduce

14:15 The idea being that if I present many coworkers w/ clojure, they'll flail around w/ the choices because they're obsessed with "performance", and then they'll decide it's "too many choices" and go back to doing it in java w/ for loops :(

14:18 technomancy: if they're obsessed with performance they'll flail regardless

14:30 just don't show them http://meshy.org/2009/12/13/widefinder-2-with-clojure.html or they'll explode

14:32 clojurebot: ludicrous speed is great for when light speed is too slow: http://meshy.org/2009/12/13/widefinder-2-with-clojure.html

14:32 clojurebot: You don't have to tell me twice.

14:33 jorge_: anyone here familiar with clj-facebook-graph? I am a little confused as to how the callback works

14:33 or doesn't work, in my case.

14:39 autodidakto: If anyone wants to submit examples to clojuredoc for "amap", it would be much appreciated :) http://clojuredocs.org/clojure_core/clojure.core/amap

14:48 is clojure.walk/walk syntactic sugar for two maps? is it a different use case?

14:49 S11001001: autodidakto: it's an unbounded number of maps and intos

14:49 and utterly eager

14:49 so, in short, the latter

14:49 autodidakto: S11001001: thanks

14:51 S11001001: on the other hand, it *is* fmap (the functor map operation), but clojure's map is not functor map

14:51 hmm, that is not quite right, never mind

14:53 autodidakto: hehe, alright. I'm studying the documentation for walk/into/fmap right now

14:54 S11001001: autodidakto: I'm afraid the best way to understand map (and its numerous weird consequences) is to read the source

14:55 uh, I mean walk :)

14:55 autodidakto: S11001001: will do.

15:01 llasram: I think that 2009 "widefinder" blog post has a concurrency bug in its atom-using code.

15:02 I'm very glad I finally embraced refs

15:03 samaaron: llasram: I see it as embracing the immutability first and foremost :-)

15:03 llasram: Ok, that is probably more fundamental :-)

15:04 samaaron: then you should embrace the Overtone sine waves ;-)

15:06 autodidakto: samaaron: sounds like you're preaching a new religion

15:06 samaaron: autodidakto: haha - I'm hardly the relgious type

15:07 but I guess if I were to preach anything it would be the value of seeing programming as an art and to perceive the artistry in programming

15:07 and the artist in the programmer

15:07 autodidakto: All hail Immutability, the first and foremost. His name is Overtone. Let his sine waves overcome you.... at least that's my understanding

15:07 oh that works too :)

15:13 samaaron: btw, I appreciate your talks on overtone and how you compare the layout of the guitar fretboard and fingerings as an outdated, arbitrary constraint

15:16 gregorius: newbe question: anybody using clooj?

15:19 autodidakto: go ahead and ask your question, gregorius

15:20 mk: ~anybody

15:20 clojurebot: Pardon?

15:20 gregorius: already asked: anybody using clooj? because i don't know the difference between clooj-0.2.8-standalone.jar and clooj-0.2.8.jar

15:20 mk: ~anyone

15:20 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

15:21 autodidakto: get standalone

15:21 gregorius: autodidakto: thnx

15:21 mk: gregorius: I'm guessing that with standalone, you won't need to find all the other jars yourself

15:21 autodidakto: "runs as a standalone application or as a clojure editor embedded in another java or clojure application. The standalone version (containing the clojure core, currently version 1.3.0) is a single jar file that can be launched by double-clicking

15:21 gregorius: silly me, should read the readme

15:22 mk: gregorius: np, and welcome to the channel :)

15:22 autodidakto: hehe I almost missed it too.

15:23 Gregorius: I once misread a README, filed issues, etc. I felt so dumb I made myself fork the project and work improving the documentation to make up for not reading the README

15:23 gregorius: as a totaly newbre (also a programming newbe) :is there any need of type conversion in clojure?

15:24 autodidakto: Gregorius: don't worry about types for now

15:24 AimHere: What autodidakto, but the answer is yes.

15:24 *said

15:25 samaaron: autodidakto: yup - the exciting question is what might musical interfaces look like in the future - now they're free from arbitrary constraints...

15:27 mk: gregorius: powerful languages like the various lisps might be a bit harder to learn at first, so if you get stuck or confused that's normal - feel free to ask in here if that happens

15:28 gregorius: autodidakto: ok, but this functional thing is weird

15:28 autodidakto: i mean clojure... wanted to do a simple thing but I"m stuck

15:28 autodidakto: samaaron: I also think about the physical-handicap angle... it's tough for me to practice certain intruments because of a shoulder condition.. Other people have much worse problems..

15:28 gregorius: mk: I'm stuck already on a simple problem

15:28 autodidakto: Gregorius: there are some good books just coming out :)

15:29 gregorius: autodidakto: books are expensive, especially if you ern little

15:30 autodidakto: or u mean i should start with some lisp ebooks that are free?

15:30 mk: gregorius: there are ways to get books without paying - such as the local library, or university library

15:30 autodidakto: Gregorius: it's worth it. PM me and I'll give you recommendations

15:30 gregorius: mk: not here

15:30 sattvik: gregorius: what sort of problem have you run into?

15:32 gregorius: sattvik: oh just wanted to create a sum from the ciphers of a given number an i have no idea how to start it with clojure

15:32 samaaron: autodidakto: that's a very important and interesting angle too :-)

15:32 autodidakto: sattvik: he said he's just beginning to program. everything is a roadblock at those stages. I'll recommend him some good resources

15:33 mk: gregorius: you've got a repl set up and running, yes?

15:33 gregorius: mk: positive

15:33 AimHere: autodidakto, thing is, there's good free Lisp resources that are non-Clojure, like SICP; a total programming newbie will have pain converting between the languages

15:34 mk: gregorius: what's the cipher of a number?

15:34 gregorius: SICP is scheme based?

15:34 AimHere: Yes

15:34 autodidakto: AimHere: yeah. I dont recommend trying to translate.

15:34 AimHere: Learn enough clojure to be dangerous; then translate ;)

15:34 autodidakto: SICP is mit scheme, though someone has just begun translating the examples. Either way, I'd recommend more hand holding for a first book..

15:36 gregorius: mk: a number usually includes ciphers

15:36 mk: sorry was meaning a digit

15:37 my bad english

15:37 mk: gregorius: so when we represent 112, we use 2 digits

15:37 I follow so far

15:38 gregorius: 112 are 3 digits

15:39 mk: okey i know the algorithm, i have to read the number and do a mod operation (number mod 10)

15:39 edw: How can I create an unqualified name?)

15:40 AimHere: The way I'd be inclined to do that would be using a recursive function using the mod and the quotient

15:40 samaaron: edw: in which context?

15:40 edw: So I can (eval `(let [foo 42] foo)) for example.

15:40 mk: gregorius: convert to string, take the length of that string. Done?

15:40 AimHere: Is he not summing the digits rather than counting them?

15:41 samaaron: edw: `(let [~'foo 42] ~'foo)

15:41 edw: Ah. Thank you.

15:41 samaaron: np

15:42 edw: I had a brain fart and was typing the uglier ~(symbol 'foo)

15:42 gregorius: mk: convert to string? wait have to look in docs

15:43 AimHere: gregorius > That's one way of doing it, though if you're summing the digits rather than counting them, it might be a funky way of getting the answer

15:43 mk: gregorius: what are the answers to the following: 1, 111, 222, 1234?

15:43 AimHere: (also, negatives)

15:44 gregorius: AimHere: the problem is how to get digits out from the number. tokenize?

15:45 mk: (1, + 1 1 1) etc

15:45 AimHere: gregorius (- (int %) (int \0)) perhaps; as I say, funky

15:45 mk: gregorius: I'm still not sure what you need to do :) - how do you solve 1, 111, 222, 1234? What are the final answers?

15:46 gregorius: AimHere: % ? not mod ?

15:46 mk: for example you have a number 1234. ok?

15:46 AimHere: gregorius > This is using a rather silly way of taking the string of the number; ignore it for the time being

15:46 mk: 1 3 6 and 10? or 1 3 3 and 4?

15:46 gregorius: mk: then the sum of digits is: 1 + 2 + 3+4

15:47 yoklov: Anybody want to give me some feedback on my GSOC proposal? http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/thomcc/1

15:47 mk: or 1 1 1 and 4?

15:47 AimHere: Right, probably the mod way is better

15:47 gregorius: mk: what do u mean?

15:47 goodieboy: what's the main difference between an atom and a ref?

15:48 samaaron: goodieboy: an atom provides no coordination guarantees

15:48 mk: gregorius: there are many, many things you could be talking about

15:48 AimHere: gregorius > He wasn't sure what your problem was; he didn't know whether you were summing or counting digits

15:48 samaaron: a ref can be updated in a transaction

15:48 mk: but you're just talking about getting the sum of every digit?

15:48 goodieboy: samaaron: ahh ok

15:49 samaaron: goodieboy: in fact, refs may *only* be updated in transactions, and therefore use the STM

15:49 AimHere: gregorius > Do you know about recursion? Making a function call itself?

15:49 gregorius: mk: I'm summing the digits not counting

15:49 samaaron: atoms just provide atomic updates

15:49 goodieboy: samaaron: very good to know. OK so when working with multiple threads, refs are definitely the right choice.

15:49 gregorius: AimHere: positive. have a knowledge what is a recursion

15:50 samaaron: goodieboy: it's not as simple as that

15:50 both are useful with multiple threads

15:50 the question is whether or not you want to coordinate updates of multiple references

15:50 mk: yoklov: I'll have a look - I'll message you?

15:50 yoklov: k

15:50 AimHere: Good. Then can you see how the problem could be done as a recursive function? if f(n) is the sum of the digits of n, then f(1234) is 1+f(234) which is 1+2 + f(34) and so on?

15:51 Or in this case, f(1234) is f(123)+4 which is f(12) + 3+4 ...

15:51 gregorius: AimHere: recursion is nice but the performance is not so good if u r using recursion, i think

15:51 goodieboy: samaaron: i see

15:51 gregorius: AimHere : but i got your idea

15:52 AimHere: gregorius> In lisps, including clojure, there's a clever trick called tail recursion which makes the performance better

15:52 mk: gregorius: don't worry about performance

15:52 gregorius: Aimhere: f(n) = 1+ f(n-1) right?

15:52 AimHere: Not in this case

15:52 samaaron: AimHere: Clojure doesn't have real tail recursion as the JVM doesn't support it

15:52 AimHere: Here, f(n)=mod(n,10) + f(int (n/10))

15:53 gregorius: AimHere: sorry, i was simplyfing

15:53 AimHere: samaaron, there is a hack though, which does the job

15:53 gregorius: what is ttail recursion??? (silly me)

15:54 yoklov: tail recursion is where the recursion is turned into a loop

15:54 AimHere: gregorius > Don't worry about it at the moment; it's a way of improving performance and not having stack overflows when you recurse

15:54 fliebel: gregorius: basically a function that ends by calling itself.

15:54 gregorius: AimHere: okey the algorithm is clear, but have no ide how to start the implementation in clojure

15:55 BTW, do you know any pastebin alernative with clojure highlightning?

15:55 AimHere: pastebin.com has clojure highlighting, I've not needed any others yet

15:55 fliebel: gregorius: refheap

15:55 yoklov: gregorious: also, recursion is more expensive than a procedure call in most languages

15:56 fliebel: https://refheap.com/paste

15:56 autodidakto: ahh, first types, now tail recursion... you're too worried about optimization for now :)

15:56 AimHere: I think talk of tail recursion and procedure call cost is perhaps 'premature optimization' here

15:56 gregorius: yolkov: this is the point why i was meaning it's a performance bottleneck

15:56 fiebel: thnx

15:56 autodidakto: btw, this is the first i've heard of clooj. playing with it now. pretty cool. Like Dr Racket but for clojure

15:57 weavejester: Does anyone know of a good Leiningen method to hook into if you want to run every time

15:57 I want to write a file to the project root before a command

15:57 gregorius: autodidakto: i got it from: http://dev.clojure.org/display/doc/Getting+Started

15:58 Raynes: weavejester: Before *every* command?

15:58 Or just before a certain command?

15:58 weavejester: Raynes: Any command that potentially executes code in a project

15:59 So maybe… eval-in-project?

15:59 Except there's trampolining

15:59 But every command would work as well, as all it's doing is writing a hidden file.

16:01 Hm… I suspect I'll have to have two different hooks for Lein 1 and 2.

16:01 But I guess it's only relevant in Lein2 anyway...

16:05 gregorius: AimHere: so my first problem is: how to proove that the input is a number?

16:05 mabes: in clojure 1.2 land I used slurp* to read a jetty request body.. in clojure 1.3 what is the preferred way of doing that now that slurp* is gone?

16:06 weavejester: mabes: Use slurp

16:06 mabes: Without the *

16:06 mabes: In Clojure 1.2 slurp is the same as the old slurp*

16:06 AimHere: gregorius, I'm not sure why you need to do that; the 'number?' function should do though

16:07 gregorius: AimHere: as a said, i'm totlly newbe

16:07 thnx for hint of number?

16:07 AimHere: Well you'd only have to check for a number if this function was going to be fed things that weren't numbers by accident

16:11 mabes: weavejester: cool, thanks

16:22 gregorius: AimHere: hmm, just started and:

16:23 AimHere: (println (read-line)))

16:23 AimHere : sorry wrong.

16:24 sattvik: gregorius: Clojure is a dyanmic language, so you generally don't have to worry about types. You can (for now) just assume that whatever your function gets is a valid input.

16:24 gregorius: AimHere : (let [yayinput (read-line)])

16:24 but after (println (yayinput)) throws an exception

16:25 amalloy: too many parens

16:25 (println yayinput)

16:25 AimHere: There's an extra paren after the (let [] too

16:25 gregorius: amalloy :a also an CompilerException thrown by REPL

16:26 amalloy: AimHere: well. there are the right parens, just in the (possibly) wrong place - it should go after the println

16:26 AimHere: Indeed

16:26 N8Dawg: I had a question to the room, I was thinking about writing a filesystem library

16:27 * gregorius understands nothing now

16:27 N8Dawg: which would return a directory as a tree of maps,

16:27 the content of files would also be accessible as an attribute of the map

16:28 amalloy: (let [input (read-line)] (println input))

16:28 AimHere: gregorius > (let [yin (read-line)] (println yin))

16:28 N8Dawg: is there a library which does this already?

16:31 is it even a good idea/useful?

16:32 sattvik: N8Dawg: I think it sounds interesting, especially if it could be made to be relatively platform-agnostic.

16:32 No idea if there is anything like it, though.

16:33 N8Dawg: basically the idea is to transform a filesystem into clojure data so it can be filtered mapped etc

16:39 gregorius: N8Dawg: somethink like NoSQL ?

16:40 N8Dawg: gregorious: how do you mean?

16:43 gregorius: N8Dawg: a kind of mapping that is used in NoSQL

16:46 N8Dawg: gregorius: like hadoop? hadoop runs on a distributed filesystem. I'm thinking a really simple abstraction, something you'd point at a local directory

16:48 gregorius: N8Dawg: not hadoob, more like MongoDB, or CouchDB, or something JSON

16:49 unlink: How do I specify system properties values on the command line when using lein run?

16:50 e.g. java -Dsome.property=value clojure.main script.clj

16:52 technomancy: unlink: JVM_OPTS=-Dsome.property=value

16:52 as an environment variable

16:52 or :jvm-opts ["-Dsome.property=value"] in project.clj if you want it always on

16:53 unlink: technomancy: I see in the lein source that JVM_OPTS is marked as being for backwards compatibility...do you intend to remove it?

16:53 technomancy: unlink: no, JAVA_OPTS is for backwards compat

17:06 goodieboy: i'm curious about when you should use defonce?

17:07 wouldn't it only be useful when you reload a namespace?

17:18 unlink: What is the recommended logging stack for clojure applications? Do I need tools.logging, slf4j and log4j?

17:20 TimMc: [1;5D[1;5D[1;5D[1;5D[1;5D

17:21 wtf

17:22 cjfrisz: TimMc: Did you just try to lay some terminal colors on the IRC?

17:22 TimMc: No, I think it's a connection issue.

17:23 cjfrisz: Ahh

17:23 TimMc: Super laggy connection on my laptop, and I think either my local terminal or irssi got confused.

17:23 llasram: unlink: I'm curious about that as well. Java logging in general is still pretty murky to me.

17:24 unlink: llasram: I have logging working with tools.logging and log4j with a 5-line log4j arcane property file incantation on my classpath.

17:25 llasram: I read on the internets that slf4j is the new hotness, plus it lets me configure jetty logging at the same time. It seems that it's turtles all the way down with Java logging; everything seems to be a facade.

17:25 in Python, my "logging" is sys.stderr.write("%s\tDEBUG\tsomething happened\n" % datetime.datetime.utcnow())

17:27 llasram: In Python and Ruby I've been getting some serious mileage out of the standard-library logging classes, just because the consist format makes it easy to add log-based alerting.

17:27 Java logging's format flexibility seems like a bit of a negative there, although being able to redirect to syslog with a config file change is pretty nice :-)

17:29 unlink: llasram: yeah. I don't want to configure logging in my application, though. http://www.12factor.net/logs

17:32 llasram: Ooh, that looks like an interesting manifesto. Thanks for the link!

17:32 And that is what I'm doing in practice, actually. In reality even the Java and Clojure stuff I've got going is writing to stdout and just redirecting to syslog via `logger`.

17:32 The idea of a config-file change to send to syslog sounded nice, but on reflection maybe it isn't :-)

17:35 unlink: llasram: well, the config file change should be to pipe your application to logger(1).

17:39 technomancy: under what circumstances does leiningen delete and re-download the whole lib/ directory?

17:41 llasram: using slf4j + logback + tools.logging seems to work well, too.

17:42 llasram: as an added bonus, it has fairly sensible default configuration

17:54 y3di: ah the headline of the rich hickey info q video on hackernews tricked me into thinking that some clojurewest vids were starting to go up

18:02 devn: y3di: you weren't the only one :)

18:23 autodidakto: yah, those vids are taking a minute to be uploaded. What the dilly-yo?

18:24 aperiodic: they're being edited by a production company before being uploaded, which I guess takes some time.

18:25 at least, that's what I heard

18:27 autodidakto: ahh. Thanks for the info. Good audio and slide management is worth a wait.

18:32 offby1: Ahoy -- I just ran "lein test" on an old project, and got a big stack trace that contained this baffling line:

18:32 Exception in thread "main" java.lang.Exception: No such var: clojure.core/spit (NO_SOURCE_FILE:1)

18:32 any idea what that means?

18:33 amalloy: spit didn't exist until clojure 1.2 (1.1?). so you're running new code on an old clojure

18:34 offby1: aha!

18:34 thanks.

18:36 TimMc: repeatability, bro

18:37 autodidakto: repeatability, bro

18:37 offby1: repeatability, bro

18:37 * offby1 glances around nervously.

18:37 offby1: do I win something?

18:38 gaah, once again hosed by my inability to run "strace" on OS X.

18:38 grr

18:40 this is probably laughably ignorant, but: short of strace, how can I tell which clojure I'm using?

18:42 Bronsa: ,(clojure-version)

18:42 clojurebot: "1.4.0-master-SNAPSHOT"

18:43 offby1: that would require that I have a repl running :)

18:43 I guess I could "lein repl".

18:44 user=> (clojure-version) => "1.2.1"

18:44 hmm

18:44 autodidakto: how are you using clojure?

18:44 offby1: I nuked ~/.m2 an ~/.lein, and re-ran "lein test", and it downloaded some stuff ... and then failed the same way.

18:45 autodidakto: just running "lein test" at the moment

18:45 ldopa: offby1: pgrep -lf clojure. should be able to see the version of the jar on the cp

18:45 offby1: hmm, clever

18:45 zip nada bupkis -- pgrep gave no output.

18:45 probably help if I actually had a java process running though :)

18:45 let's try again

18:46 http://ix.io/2h6 <-- 1.2.1 clear as day

18:47 I guess I gotta see if this problem repros on *nix, where I can actually run strace.

18:55 amalloy: offby1: that's just the lein jvm, though - it's running on 1.2, but it launches another jvm for your app to run in, and that might be some other version

18:55 offby1: amalloy: hence my desire to repro this on linux -- I have no idea what files are being loaded by what processes

18:56 amalloy: i never mastered strace. i hear it's awesome, and a few times i've tried, but i've just had a terrible time learning anything

18:56 offby1: any suggestions for which Java package I should install on Ubuntu 11? The choices are overwhelming :-p

18:56 odd, I'm an strace whiz

18:58 I think the secrets are 1) knowing which system calls to trace (the default of "all" can be overwhelming); 2) putting the output into a file that you can then browse with your favorite editor

18:58 autodidakto: offby1: why you keep hosing it, then?

18:58 offby1: autodidakto: why do I keep hosing what?

18:59 amalloy: offby1: i think i installed openjdk-6-jdk, but on 10.10, not 11

18:59 autodidakto: "gaah, once again hosed by my inability to run "strace" on OS X."

18:59 offby1: autodidakto: I'm still not understanding your question

18:59 I simply meant that, because I don't know how to run strace on OS X (the program is Linux-specific), I can't investigate my problem

18:59 amalloy: er, that's a total lie. i'm on 11.10

18:59 i just forgot what year it is now

19:00 so, openjdk-6-jdk is probably a reasonable choice for you

19:00 offby1: *sigh* my Ubuntu laptop has chosen _now_ to do an unattended dist-upgrade

19:01 autodidakto: offby1: ahh. thought you tweaked a config and broke it something. not a question anyway, just teasing

19:01 offby1: autodidakto: I think OS X has some equivalent ("dtrace" maybe) but I've never learned it

19:02 aperiodic: i've never had luck with dtrace

19:02 offby1: kinda smells all enterprise-y

19:02 aperiodic: disktop uses it, and it just spews error messages

19:16 offby1: w00t, repros on *nix; now for "strace" wizardry

19:19 grr

19:19 time to grovel some git repositories, I guess

19:23 well, this is probably a clue: after cleaning thoroughly with "git clean -dxf", then running "lein test" again, I see the message "Copying 2 files to /usr/local/src/anagrams/clojure/lib". Looking in that directory, I see: clojure-1.1.0jar and clojure-contrib-1.1.0.jar

19:23 why would lein copy an old version of clojure, and then expect a newer one?

19:29 dnolen`: all CLJS IPrintable types have JS toString methods now - fixes behavior of the IPrintable CLJS types w/ str

19:32 amalloy: offby1: i suspect if you could link to your project.clj (and source files if possible; they might or might not be necessary) it would be the work of a couple minutes to tell you the problem

19:35 offby1: technomancy: "lein test" is failing; the problem seems to involve it downloading and using clojure 1.1. See http://ix.io/2ha for a bit of a transcript

19:35 amalloy: ok, hold on

19:36 amalloy: https://github.com/offby1/anagrams/commit/5e7a2bd029ce73932355658529a0909bbf55e72e

19:37 * offby1 smacks forehead

19:37 offby1: I wonder if it's because the project.clj file asks for that old version

19:37 amalloy: offby1: https://github.com/offby1/anagrams/blob/master/clojure/project.clj

19:37 yes

19:37 you ask for an old version, and by god you get an old version

19:38 devn: I saw some discussion not too long ago about corelibs using type hinting to avoid reflection warnings

19:38 say I (:import [com.foo.bar.baz BazThing])

19:38 offby1: amalloy: the nerve!!

19:38 amalloy: i would say: depend on 1.3, don't depend on contrib at all, and write your own version of lower-case

19:38 devn: is it sufficient to hint like (defn foo [^BazThing baz-arg] ...)

19:39 amalloy: or use one from a different lib, like apache commons

19:39 offby1: amalloy: huh

19:39 why?

19:39 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

19:39 xeqi: &(clojure.string/lower-case "ASDF")

19:39 lazybot: ⇒ "asdf"

19:39 amalloy: oh, it's in clojure.string. use that, then

19:39 offby1: hm, OK

19:39 amalloy: it's *also* in java.lang.String/toLowerCase, which i hadn't noticed

19:40 devn: ,(.toLowerCase "ABCD")

19:40 clojurebot: "abcd"

19:41 amalloy: btw, just browsing through this code, combine could be a lot simpler: (defn combine [words anagrams] (for [word words, anagram anagrams] (cons wod anagram)))

19:52 unlink: (binding [*warn-on-reflection* true] (letfn [(lower [s] (.toLowerCase s))] (lower "ABCD")))

19:53 ,(binding [*warn-on-reflection* true] (letfn [(lower [s] (.toLowerCase s))] (lower "ABCD")))

19:53 clojurebot: "abcd"

19:53 unlink: oh, it's not dynamic.

19:55 brehaut: ,(do (set! *warn-on-reflection* true) (let [lower (fn [s] (.toLowerCase s))] (lower "ABCD")))

19:55 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set>

19:56 amalloy: unlink: indeed, that will cause reflection

19:56 devn: reflection is a bummer

19:57 just got rid of a bunch of warnings -- word to the wise: dont wait until you've written a bunch of code to tackle your reflection warnings

19:57 just had to traverse a bunch of javadoc to remember what happened where

19:58 Node => NamedNodeMap => DomAttr

20:02 offby1: nuts. for some reason I thought integers in Clojure were infinite-precision, like in some Schemes ... I don't suppose they are.

20:03 amalloy: offby1: wellllll

20:03 offby1: with the M suffix

20:03 I guess they are

20:03 amalloy: in versions before 1.3 they were infinite-precision by default

20:04 starting with 1.3, you can get infinite precision either by using the M suffix or by using promoting operators like +' instead of + and *' instead of *

20:04 offby1: ah

20:04 thanks; my code dates from before 1.3 so it assumed infinite-precision

20:05 amalloy: but integer literals are 64 bits, which is practically infinite anyway. i find it a little surprising you'd use that up without noticing

20:06 beffbernard: amalloy: Do you know the reasons why they moved away from infinate-precision? Other than performance reasons/

20:07 amalloy: why would there be any other reason?

20:07 like, if performance didn't matter, there would be no benefit at all to moving away from infinite precision

20:07 beffbernard: I guess there could be political reasons

20:08 offby1: is there a deftest macro that's specialized for testing equality? (is (= this that)) works, but if the test fails, I don't get a nice message saying "this was 27 but that was 19".

20:08 beffbernard: I suppose checking for overflow/boxing/primitives would be costly

20:08 dnolen`: beffbernard: it was for perf reasons.

20:08 beffbernard: checking for overflow is not that costly - boxing primitives is.

20:08 TimMc: The decision was made over several dead bodies.

20:09 beffbernard: TimMc: lol

20:10 amalloy: offby1: doesn't it say something like "expected: (= this that); actual (not (= 27 19))"?

20:11 offby1: oh, lemme look again

20:11 * offby1 smacks forehead

20:11 offby1: gonna get a callous on that forehead pretty soon :)

20:11 thanks

20:12 devn: can you remove a reflection warning, but have another spring up in its place? As in: If I hint an arg or two, but then that function is generic enough to work in another context, do I wind up with a new reflection warning for that type?

20:12 or can i rest easy knowing that all hints are as they should be once reflection warnings subside?

20:14 S11001001: devn: actually, you end up with a classcastexception at runtime

20:14 consider (defn close-thing [it] (.close it))

20:15 if you lock down it to a particular interface or class, it won't pick up other no-arg methods named "close", and you'll get a ClassCastException for trying to use them

20:16 devn: so then the question becomes (in my mind) -- do I err on the side of being specific, or err on the side of reflection

20:16 S11001001: choose reflection

20:16 devn: it seems like historically the answer has been the former

20:16 really?

20:16 Frozenlock: I find myself doing (first (filter ...)) quite often. Is there a function for that?

20:16 S11001001: I disagree; historically, the answer I have heard, from Rich et al, has been leave reflection alone until you need to fix it for performance

20:17 devn: Frozenlock: I must be mis-remembering -- I've seen discussion on the clojure mailing list which discuss whether or not hints should be required for new "contrib" libraries

20:17 i write "contrib" because...well, clojure.contrib is no more

20:17 maybe it was for core libs

20:18 S11001001: Frozenlock: there was, but it was dropped because it was kind of pointless when you can just first filter

20:18 Frozenlock: Ok, at least I know I'm the only one :)

20:18 *not

20:18 Thanks!

20:19 TimMc: S11001001: ffilter?

20:19 S11001001: find-first

20:19 devn: write one! :)

20:19 (defn ffilter [pred coll] ...)

20:20 S11001001: in all seriousness simple juxtapositions of two functions don't really deserve librification

20:20 brehaut: (def first-where (comp first filter))

20:20 S11001001: I'm also against not=, if-not, & such

20:20 Frozenlock: devn: Sure, was just wondering I there was already something for it (example if; when).

20:20 devn: Frozenlock: there might be, but it not might be the path you're staring down

20:20 Frozenlock: phrase your question in terms of data in, data out

20:21 Frozenlock: Multiple maps in, single maps out

20:21 devn: use data

20:22 aperiodic: devn: my impression is that requiring hints for libraries is just so there's no performance issues from the library, which would be inconvenient for library users to fix. in your own code, i'd say forget about reflection unless it's in an inner loop

20:25 devn: aperiodic: it feels like a nice exercise, though

20:25 aperiodic: if i'm writing a library for public consumption, why not do it?

20:25 amalloy: S11001001: well, not= is sorta in a different category, because there's a jvm bytecode instruction for it; (not (= x y)) would be much less performant. it's also often a more-clear way to write what you mean

20:26 aperiodic: devn: oh, yeah, for a public library, not having reflection is definitely a benefit.

20:29 offby1: *sigh* Why am I getting ``Could not start swank server: That's not a task''? Lein is as far as I know up to date; so is clojure-mode

20:30 yoklov: you need lein-swank

20:30 https://github.com/technomancy/swank-clojure

20:31 offby1: odd, I've never had to install that manually before

20:32 yoklov: weird, i think i always have

20:32 devn: offby1: how do you try to start it?

20:32 aperiodic: it could've been a dependency or dev dependency of the other projects you ran `lein swank` in

20:32 devn: clojure-jack-in, slime-connect, etc

20:34 offby1: devn: M-x clojure-jack-in

20:34 Frozenlock: lein plugin install swank-clojure 1.4.0

20:34 offby1: Frozenlock: aha, that sounds good

20:34 devn: yeah, do that

20:34 i was living in the olden days until recently

20:34 M-x slime-connect

20:34 Frozenlock: No dependency needed after that P)

20:34 :)

20:34 devn: yeah, much nicer

20:35 yoklov: i thought that was deprecated (though it's what i do too)

20:35 Frozenlock: Perhaps... I'm still rocking lein 1.

20:35 offby1: Frozenlock: success! Thanks

20:35 Frozenlock: Messing with clojure made me a new man: If it ain't broken, don't fix it!

20:36 offby1: np

20:36 yoklov: yeah, lein version 2 crapped out on me once so i installed it as lein2 and i never remember to use it

20:36 devn: i feel like part of the clojure motto is to absolutely fix it if it's fundamentally broken

20:36 that's sort of the obligation

20:40 wei_: speaking of lein, what's the best way to include a java project as a dependency?

20:41 oc: mvn is a sure bet

20:44 (release the java project as a jar/war/ear-packaged mvn artifact, then depend on it using lein)

20:45 wei_: oc: could you point me to instructions on how to do that?

20:47 oc: if you are unfamiliar with maven, I suggest you start with sonatype's guide for how to release jars (i.e. to nexus) using mvn deploy:deploy-file

20:47 Frozenlock: I think you can also put them on clojars- but I really don't know how.

20:50 aperiodic: yeah, i usually just throw em up on clojars under my username group

20:51 oc: maven is an entire ecosystem for handling the complexities of dependencies, releasing, versioning and distribution... (love it or hate it, it does that part quite nice) explaining how it works is kinda out of scope. There are however two things you can do easily given that the java project is not itself built with maven; 1) if you are the sole developer, you can always locally release it using mvn install:install-file, 2) release it to a mvn repository using mvn d

20:51 aperiodic: wei_: can you get produce the jar you want lein to be able to grab?

20:51 wei_: yup. it's this project https://github.com/gvsumasl/jacc

20:52 i've been putting the jar in lib/ -- and that works until i call "lein deps" which clears the lib directory

20:53 amalloy: ~repeatability

20:53 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

20:54 wei_: thanks, I had a feeling it wasn't the right way to do things

20:54 oc: i guess you can also use a local store such as libs, just remember to datestamp the jar for future developers ;)

20:55 offby1: hmm, (= 1 1M) => false .... surprising

20:56 oc: surprising?

20:56 (type 1M)

20:57 amalloy: &(== 1 1M)

20:57 lazybot: ⇒ true

20:58 wei_: if I don't want to set up private maven repo, is it appropriate to upload a pure-java project to clojars?

20:58 aperiodic: wei_: i'm guilty of that

20:58 wei_: cool :)

20:58 muhoo: now i'm usin glein to build java projects too. i ain't going back ant unless someone drags me kicking and screaming.

20:58 lein, not glein

20:58 oc: clojars is just a m2-repo isn't it? :)

20:59 offby1: oc: I guess I figured = was "numerical equality".

20:59 as opposed to (say) "identity" -- analogous to scheme's "eq"

21:00 amalloy: yeah, the distinction between = and == is a little weird to me

21:00 offby1: in scheme you have (at least) three kinds of equality, and you need to know which one is which :-|

21:00 amalloy: == is a special numbers-only comparator, which i guess is faster and more...type-ambivalent?

21:00 offby1: I've made my peace with that

21:00 oc: offby1: = sadly equals Java' equals() ;)

21:01 offby1: and I'm 100% ignorant of Java

21:01 oc: (fortunate when dealing with java)

21:01 offby1: so is that basically a pointer comparison?

21:01 oc: umm when i think of it, it also considers nil

21:02 amalloy: no, identity? is a pointer comparison

21:02 oc: humm, i just read the doc. wtf.

21:02 &(doc =)

21:02 lazybot: ⇒ "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) ... https://refheap.com/paste/1794

21:02 amalloy: = is the general-purpose "are these the same thing", and == is some weird wart that you occasinoally see used for numbers

21:03 oc: lazybot cut this part: " Clojure's immutable data

21:03 structures define equals() (and thus =) as a value, not an identity, comparison,"

21:04 * oc has poor paste skills

21:04 offby1: ask the bot if 1 equals 1M.

21:04 oc: &(= 1 1M)

21:04 lazybot: ⇒ false

21:04 oc: &(== 1 1M)

21:04 lazybot: ⇒ true

21:05 amalloy: oc: ...he linked to a paste of the part he cut off. i don't know why you would paste that back into the channel; anyone who wants to read it all can follow it

21:05 offby1: works for me!

21:05 oc: thanks

21:06 oc: amalloy: well, the last sentence was the crux :)

21:06 fhil: Hi, all. Quick question. I'm considering picking up Clojure. Slowly. Is this the right place to be as a newbie?

21:06 offby1: fhil: absoloosely

21:06 fhil: they haven't kicked me out yet :)

21:07 fhil: Sounds good.

21:08 amalloy: don't listen to him, he just wants someone else to get picked on when he's not the most junior anymore

21:09 fhil: Joy of Clojure. Will start next week.

21:09 * offby1 fidgets uncomfortably

21:09 muhoo: fhil: i recommend clojurebook.com

21:10 fhil: You're good offby1. I can take the low punches... instead. You can relax now.

21:11 oc: joy of clojure is imho somewhat more advanced than i.e. clojure in action. Though absolutely a great book

21:11 fhil: java/groovy background

21:11 RickInGA: I really liked the 2nd edition of programming clojure by stuart halloway and aaron bedra

21:11 oc: i usually recommend CiA first for java devs

21:12 haven't read programming clj

21:13 RickInGA: the last chapter walks through creating a web app with noir and deploying it on heroku

21:13 was the reason I bought it, but the whole book is good

21:13 oc: i.e. the webnoir.org tutorial? ;)

21:13 yoklov: isn't there a new clojure book?

21:14 RickInGA: oc: good point, the tutorails for noir are fantastic

21:14 yoklov: yes, Clojure Programming by Chaz Emerick. What I have read of it has been very good.

21:14 fhil: Is Noir the faved web framework?

21:14 cemerick: yoklov: You may be thinking about http://clojurebook.com, which muhoo mentioned abobve

21:14 fhil: Arguably...

21:14 oc: ring is my fav web framework ;)

21:17 noir builds defpage and some middleware (and a lot of other nice stuff) onto ring

21:18 fhil: the smaller the better.

21:20 offby1: I notice that it takes about ten seconds from when I type "lein test", to when I see ``Testing anagrams.test.core''. (This is a not-terribly-slow Macbook Air). Is that typical? If not, is there something simple I can do to reduce that delay?

21:22 yoklov: err, so what's the deal with the new clojure book?

21:23 offby1: It's new. It's about Clojure. And it's a book.

21:23 * offby1 glances around nervously.

21:23 yoklov: well what's the target audience?

21:23 cemerick: yoklov: Did you go to http://clojurebook.com? ;-)

21:23 yoklov: / is it a good reference?

21:24 offby1: no idea.

21:24 yoklov: I mean, it suggests that I am its target audience, but… is that _really_ true?

21:24 offby1: haven't read it.

21:25 yoklov: Okay, so targetted at java/ruby/python devs?

21:25 fhil: cemerick: cheers. Thanks for the work on the book.

21:25 RickInGA: yoklov: I have donly dipped in and out of it, but what I have read has been very well written.

21:26 yoklov: the ns macro with use and require was a mystery to me until I read that part of the book.

21:26 cemerick: yoklov: well, I *hope* we're not lying to you :-)

21:27 fhil: Sure, I hope you're enjoying it.

21:27 muhoo: i found it the clearest and easiest to digest so far, though the noir docs are also exemplary, imho

21:27 fhil: Not yet. Just learned about it.

21:29 muhoo: in fact, i treat it as docs, and find myself blitzing around it as a reference, instead of hittting google. or here :-)

21:32 mk: which new book is this?

21:33 RickInGA: mk: Clojure Programming by cemerick, et al. from O'Reilly

21:33 brehaut: mk: http://www.clojurebook.com/

21:38 mk: thanks. What's the animal on the cover?

21:40 brehaut: “The animal on the cover of FILL IN TITLE is FILL IN DESCRIPTION.”

21:40 thats from the colophon

21:40 although i probably have an old pdf

21:44 alex_baranosky: just curious: do a lot of you guys use core.match?

21:55 devn: alex_baranosky: i think it's a mixed bag

21:55 alex_baranosky: devn: funky syntax?

21:55 I pretty much have only ever used it to flatten nested conditionals

21:55 devn: i have a hard time saying I "use" it. I use it, but it's not an automatic requirement.

21:56 alex_baranosky: I use it alla carte I guess

21:56 devn: I find myself wanting for very general, specific reasons

21:56 much like your example of flattening nested conditionals

21:58 yoklov: clojure already has destructuring so i don't need it as often as i did when i wrote in racket

22:00 5EXAAM9RU: alex_baranosky: What part of the syntax do you think is funky? the (match indentation part? or?

22:01 alex_baranosky: 5EXAAM9RU, I don't per se. Just thought devn might have been thinking that

22:30 dnolen: CLJS now warns on redef and the various shadowing issues around redef fixed

22:35 autodidakto: Ahhh. Nothing like rainbow parenthesis to show my pride.... in lisp.

22:36 eggsby: :)

22:36 could someone speak on cljs v. something like coffeescript?

22:36 I've been using coffeescript for a few months to my great enjoyment, why might I want to switch to cljs?

22:36 autodidakto: eggsby: specify good sir!

22:37 eggsby: what do you do with coffee/js?

22:37 cljs is more than a cleaner way to write js

22:37 yoklov: eggsby: with coffeescript you still have most of JS's problems, they're just hidden from you

22:37 eggsby: Well, I enjoy coffeescript because it simplifies scoping and provides shorthand notation for best practices. I (and some of my coworkers) are wondering what we could gain by using cljs

22:38 yoklov: clojurescript attempts to actually tackle the flaws

22:38 eggsby: We all like clojure so it seems like a good road to go down, but we're all having trouble envisioning what we'd gain from it

22:38 yoklov: what is the generated js like?

22:38 autodidakto: coffeescript is easier js. cljs can be a replacement for js

22:38 yoklov: eggsby: very tough to read.

22:38 you get surprisingly used to it

22:38 but its rough.

22:39 autodidakto: you dont do cljs to generate js. you do it for client-side, in browser clojure

22:39 yoklov: well you still need to look at the generated code a lot.

22:39 i do at least

22:40 debugging and such

22:40 dnolen: eggsby: it depends on whether JS semantics work well enough for you.

22:40 eggsby: I prefer CLJS semantics. And I don't think I'd use anything where I don't have access to core.match / core.logic - but I'm clearly biased.

22:41 * eggsby goes and checks out core.match

22:41 autodidakto: it's pattern matching

22:41 dnolen: eggsby: one thing I definitely think is superious is managing front end dependencies - lein cljsbuild is turning to be great for that.

22:41 eggsby: when I use JS and CoffeeScript managing deps is pretty ad-hoc.

22:42 eggsby: It is, there's no beaten path as far as asset management goes

22:42 Though there are a lot of options

22:43 dnolen: eggsby: and lein is pretty darn good compared to what's out there :) stuff like bundler, rvm which I use at work is oh so bad.

22:43 eggsby: What about interoperability with js libs? Is it easy enough to do fluid interfaces? (with the .. macro for instance?)

22:44 dnolen: eggsby: the js interop story is OK, but to be honest there's very few JS libs that I think are any good.

22:44 eggsby: I know in jQuery for example fluid interfaces are extremely popular, they were always kind of a hassle (not very idiomatic) in coffeescript

22:44 dnolen: eggsby: we use underscore.js, no need for that in Clojure.

22:44 eggsby: Hm, fair point. I use underscore and backbone quite a bit, but so long as I could access the vars and js keywords (i.e. "new") I needed i'd be fine

22:44 hhutch: eggsby: i've written a fair amount of demo code using Google Closure APIs and Clojurescript

22:45 dnolen: eggsby: I don't really have an opinion one way or the other about jQuery, it's useful but I'm ready for something better.

22:45 eggsby: At the end of the day I won't know whether its right for me until I try it out :)

22:45 hhutch: the interop, to me at least, is the same as with java

22:45 eggsby: dnolen: agreed

22:45 devn: dnolen: what's your take on bundler?

22:45 dnolen: devn: bunlder rake exec wtf

22:45 eggsby: jQuery is bloated is my issue, which is tied to another interest about cljs generated js, if its unreadable to me that sounds like it may be generated unnecessary code to support the syntax, which slows things down, broadly speaking

22:46 Is this a 'real issue' or just a red herring?

22:46 s/generated/generating

22:46 dnolen: eggsby: I think with source maps the tables are going to dramatically change around front end dev.

22:46 eggsby: GClosure dead code elimination is too good.

22:46 * devn grins

22:46 dnolen: why should I use your 150k library when I only need 5k of it.

22:47 devn: dnolen: because it might mean you need to give your client a CD instead of a floppy

22:47 ??

22:47 lazybot: devn: Uh, no. Why would you even ask?

22:47 dnolen: this whole movement around tiny JS libs is very short sighted - just use better tools IMO.

22:48 devn: agreed.

22:49 dnolen: JSConf went well - definitely got some folks interested in the idea of ClojureScript and hopefully less afraid of Lisp in general.

22:49 devn: that's a trend

22:49 eggsby: hhutch: where could I find that demo code?

22:50 dnolen: you have any idea whether yr talk will be publicly available? If so any idea when? :D

22:50 devn: dnolen: i see a lot of people who have been cutely critical of lisp and fp starting to "get it"

22:51 dnolen: eggsby: I don't know actually.

22:51 eggsby: :(

22:51 dnolen: eggsby: but probably not too long.

22:51 eggsby: ontwik got some from last year, but they kind of slowly trickled out

22:52 dnolen: devn: yep

22:53 Frozenlock: In Noir, is there a way to export a bunch of page as html, but with the folders at the same time (in order to keep the same paths)? I would like to make an offline backup of static pages.

22:53 eggsby: heh, making jeckyll in noir?

22:54 -c

22:54 Frozenlock: Jeckyll does that?

22:54 devn: Frozenlock: just use wget?

22:54 Frozenlock: devn: of course!

22:54 Thanks!

22:54 However, as I'm mostly trying to learn clojure.. is there an in-clojure way? :P

22:55 xeqi: Frozenlock: clj-http ?

22:56 yoklov: Frozenlock, maybe some way of messing with the routes table? That was actually one of the proposals for google summer of code this year (so i don't think anybody did it).

22:56 devn: Frozenlock: you could shell out. wget just does so much for you that it seems sort of crazy to not use it

22:56 yoklov: err, has already done it*

22:56 devn: there is, im sure, a wget for java

22:57 Frozenlock: devn: indeed, found one in half a second http://www.devdaily.com/blog/post/java/jget-something-like-wget

22:58 I might take your advice and just relax on this one.

22:58 devn: Frozenlock: i mean, you *caN*

22:58 *can*

22:58 but it's just probably not worth it if you just want to run it over your site

23:01 johnkpaul: is there anything special about the default user namespace?

23:01 devn: johnkpaul: no, not really

23:01 johnkpaul: using clojurescript, I can easily def a symbol in cljs.user

23:01 but when I'm in any other namespace, it errors out

23:02 devn: johnkpaul: script/repljs?

23:03 johnkpaul: lein trampoline cljsbuild repl-listen

23:03 devn: i have no idea what that means :X

23:03 johnkpaul: :/ that's the command I ran to get the repl

23:04 basically, after running that, (def hello "world") works fine

23:04 dnolen: johnkpaul: hullo!

23:04 johnkpaul: and I can run (identity hello) and I get "world"

23:04 :D hey dnolen

23:04 figured you'd be swanodette in here too

23:05 I'm working on something dear to your heart actually

23:05 dnolen: johnkpaul: hmm, I haven't run into that problem. how are you switching namespaces?

23:05 johnkpaul: !

23:06 johnkpaul: (in-ns 'cljs-demo.core)

23:06 dnolen: johnkpaul: yeah that should just work.

23:06 johnkpaul: so that works fine

23:06 and from there, I can run (identity cljs.user/hello)

23:06 and that works as well

23:06 and from there, I can run alerts or console logs

23:06 but I can't def

23:07 (def test "hello") gives me ...

23:07 "Error evaluating:" (def test "test") :as ".test = \"test\";\n"

23:07 #<SyntaxError: syntax error>

23:08 dnolen: johnkpaul: yeah, there's a bug in JIRA. I think using in-ns without first evaluating the ns form doesn't work right now.

23:09 johnkpaul: oh! ok, let me try that

23:09 eggsby: hmm, 56kb hello world :(

23:10 dnolen: eggsby: heh, yeah CLJS doesn't compete against hello world in JS or CS

23:10 johnkpaul: so that works dnolen, it takes > 30 seconds to load it all into the browser

23:10 dnolen: eggsby: only if you already use something like jQuery + Underscore.js, then the size is competitive

23:10 johnkpaul: "it all" meaning all of the macros and modules in cljs-demo.core

23:11 eggsby: dnolen: so you use cljs in leiu of jquery? how do you handle dom selection/event delegation?

23:11 dnolen: johnkpaul: huh, that seems odd - it never takes more than 2-3 seconds for me.

23:11 eggsby: or ajax, etc

23:11 johnkpaul: eggsby: cljs includes the google closure toolkit

23:11 dnolen: eggsby: domina is getting good and GClosure is actually fine for the basics.

23:11 johnkpaul: eggsby: http://closure-library.googlecode.com/svn/docs/closure_goog_dom_dom.js.html

23:12 dnolen: eggsby: one my favorite things to show is that a project that uses GClosure, domina, core.logic generates 650k of code

23:12 eggsby: but after advanced opts and gzip - 34k

23:13 johnkpaul: dnolen: so that load time might be FF, I haven't tried in chrome

23:13 but what I'm looking for now is how to run code after the repl starts up

23:13 something like python's -i

23:13 dnolen: johnkpaul: remember there's no load time that's browser related when you eval ns form

23:13 johnkpaul: that's all in the browser REPL (which is not in the browser)

23:14 johnkpaul: oh, I didn't have to run all of the other parameters to ns

23:15 I passed :use-macros and require-macros and all of that

23:15 maybe that's what took so long?

23:15 dnolen: johnkpaul: it's a bit weird to realize but eval'ing ns form doesn't trigger anything in the browser.

23:15 johnkpaul: oh, really? But I saw tons of ajax requests

23:15 dnolen: johnkpaul: w/ browser REPL you have to sometimes deal w/ browser REPL sync issues, sometimse just refresh.

23:15 johnkpaul: definitely unrelated

23:16 johnkpaul: hm, they were actually all almost the same line

23:16 if(goog.getObjectByName('clojure.browser.event')){true}else{false};

23:16 it was just different object's by name

23:16 ~ 20 of them

23:16 clojurebot: Cool story bro.

23:18 johnkpaul: anyway, that's something I can figure out

23:18 but do you know if I can run a script in the repl before it ends up with the user

23:18 I want to preload that namespace

23:18 so the user can just start playing with the repl with everything loaded

23:19 jonasen: dnolen: do you have time for a core.logic question?

23:19 dnolen: johnkpaul: if you build the file once, everything is compiled, so the browser has it all.

23:20 johnkpaul: only trick is to start the repl and eval the ns expression, to save them one step.

23:20 johnkpaul: oh I see, yeah, that's what I want, if they can start with the repl in the right namespace

23:20 dnolen: johnkpaul: yes

23:20 jonasen: what's up?

23:21 johnkpaul: ok thanks, I need to get dinner, I'll continue working on it afterwards but I'll be back

23:21 jonasen: I'm trying to make a version of appendo which would take an arbitrary number of args, called `concato`

23:21 dnolen: johnkpaul: I would recommend making a custom lein task - might want to pick some brains in here that have done that more than I have.

23:22 jonasen: sure

23:22 jonasen: dnolen: but I dont't know how to do the recursion (because of https://gist.github.com/2236019)

23:23 dnolen: jonasen: what does you attempt at concato look like?

23:24 jonasen: dnolen something like https://refheap.com/paste/1795

23:25 dnolen: jonasen: looking

23:30 Frozenlock: (.mkdirs (file "asdf")) Creates a directory called "asdf". (make-parents (file "asdf")) does apparently nothing. How is this function supposed to be used?

23:31 dnolen: jonasen: https://gist.github.com/2307725

23:31 jonasen: dnolen: thanks, I'll take a look

23:33 dnolen: jonasen: only slightly different from yours

23:36 bowski: Hello clojure friends. I'm learning this language for a project I just got. I've never written in clojure, but I defined 8 nodes as lists with things in them. Right now I just want to go through each node and display the first thing (car, right?). Can someone help me learn the right way to go about it?

23:36 Frozenlock: bowski: not car, first

23:37 bowski: oh, ok. I've done a little scheme before and they look very similar

23:37 Frozenlock: Car would have been right for other lisps.

23:37 brehaut: ,(map first [[:a :b] [:c :d]])

23:37 wei_: (map #(println (first %)) nodes)

23:37 jonasen: dnolen: I commented on your gist

23:38 dnolen: jonasen: it's easy to run into non-termination with concato

23:39 bowski: I labeled them node0 - node7. how could I access all of these? It looks like map is the way to go. I'm reading up on the clojure doc for map

23:39 dnolen: jonasen: you absolutely cannot call appendo w/ all fresh vars.

23:39 jonasen: dnolen: ah, I see

23:43 dnolen: Do you think there's a different approach? A different way to implement `concato` with stronger termination guarantees?

23:44 dnolen: jonasen: pondering it a bit right now :)

23:44 jonasen: dnolen: :)

23:45 dnolen: Also, is this a restriction in miniKanren or does (for example) prolog behave the same way?

23:45 dnolen: jonasen: pretty sure Prolog has the same problems.

23:46 jonasen: dnolen: Good! Then it should be possible to find something in Prolog literature!

23:47 dnolen: jonasen: yes or ask on StackOverflow with the equivalent Prolog

23:47 jonasen: I've gotten very nice insights there that way.

23:51 bowski: say I wanted to (println node1 - node7). How could I append a string for the range of 1-7 to be executed? Also, thanks for taking the time to read/help me guys.

23:54 jwpalmer: Haha, my professor I believe

23:54 unlink: Do people typically deploy with OpenJDK nowadays?

23:59 eggsby: unlink: I think everyone still uses oracle, openjdk still has some bugs for a lot of libs :/

Logging service provided by n01se.net