#clojure log - Nov 23 2013

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

10:51 wakeup: Hi

10:51 I am evaluating clojurescript, but I get this exception ony first run: Caused by: java.lang.RuntimeException: Unable to resolve var: reader/*alias-map* in this context

10:52 (Run using lein cljsbuild once)

10:52 Any ideas?

10:58 emaphis: wakeup: this may answer your question: https://groups.google.com/forum/#!topic/clojurescript/0F8lErJ0PPM

11:05 wakeup: emaphis: thanls, how do I update tools.reader?

11:07 It's not in my dependencies or anything.

11:09 coventry: Are the slides for Rich Hickey's core.async talk at Strange Loop available anywhere? The InfoQ presentation of his slides breaks for me at about 5 min 50 s.

11:15 dnolen: wakeup: what version of CLJS?

11:15 wakeup: you must specify a version, and I recommend cljsbuild 1.0.0

11:53 fakedrak`: hello

11:56 I think I have reddit.clj in ~/.m2 (in the sense that I did `lein install && mvn install' in my local custom copy of the project and the directory /home/fakedrake/.m2/repository/reddit/clj/reddit.clj/0.4.1/ now exists)

11:57 and in another project that requires reddit.clj i have it in :dependencies

11:58 but i get " Could not locate reddit/clj/core__init.class " when i run `lein test'

11:58 any ideas?

11:58 justin_smith: does your dependency clause match the project pom?

11:59 fakedrak`: how do I check that?

11:59 justin_smith: what does your dependency look like?

12:00 fakedrak`: [reddit.clj "0.4.1"]

12:00 hmm maybe I should make it 0.4.1-fakedrake

12:00 justin_smith: and is there a jar file in that m2 dir?

12:00 fakedrak`: yes

12:01 coventry: Check that the jar is listed in in "lein classpath".

12:01 justin_smith: if you changed the version string, yeah, match the version string

12:01 fakedrak`: reddit.clj-0.4.1.jar in the above directory

12:01 aha waith

12:02 yes it is!

12:02 (lein classpath, nice)

12:02 wakeup: request.onload = function () {...} in javascript can be exptressed how in clojurescipt?

12:02 Oh set!, my bad

12:09 fakedrak`: is there a standard clojure function that will return its single argument? namely i want (identity-fn x) => x

12:10 justin_smith: indentity

12:10 err identity

12:10 you almost had it

12:10 ,(identity 'x)

12:10 clojurebot: x

12:12 justin_smith: fakedrak`: out of curiosity, what was the issue with your dependency?

12:13 fakedrak`: justin_smith: thanx! the usecase is this (some-fn :key1 :key2 :key3 identity)

12:13 where if all else fails just give back what I provided

12:13 ah sry wrong problem:P

12:14 justin_smith: I have no idea what I did with the dep

12:14 justin_smith: it just started working?

12:14 fakedrak`: i just changed 1.4.6 to 1.4.6-fakedrake on both sides

12:14 and it worked

12:14 :P

12:14 glad it did and it is cleaner this way but I have no clue why it didnt work before

12:15 justin_smith: I assume it is a fork you are using, and that's why you aren't just using the original?

12:15 you can set up a clojars account and push your jar there also

12:17 gfredericks: when making a command-line tool, it is fun to have a *dry-run?* var, add ^:side-effect metadata to my functions, and then use robert.hooke to dynamically patch all the vars in the ns to check *dry-run?*

12:18 no it isn't.

12:18 justin_smith: first class parameterized namespaces would be nice

12:19 call some namespace-constructor and get a paramaterized (configured) version of each function in the namespace

12:19 as a replacement for globals, some extra arg needed by every single function, etc.

12:19 gfredericks: HRM.

12:20 justin_smith: it could be done with an object or a clojure that returns functions

12:20 gfredericks: (def my-db-ns (partial clojure.java.jdbc my-db-config))

12:20 justin_smith: right

12:20 the object / closure version is not as clean as just making a new ns though

12:22 but maybe that idea is flawed

12:23 I mean what if some lib you are using needs a config - does it have its own config, and how do you force it to load a different config? does it chain? is that a clean design?

12:23 I would have to think over all the implications

12:23 this could all be done without rewriting clojure though

12:26 wakeup: / #j clojurescript

12:38 gfredericks: justin_smith: I'm not sure I understand that question

12:38 justin_smith: if one wanted the configuration to be re-entrant

12:38 and if a configured namespace then wanted to configure another

12:38 the sticky details

12:39 coventry: justin_smith: Sounds like a stealth invasion of a big ball of mutable state to me. :-)

12:39 s/of/by/

12:39 justin_smith: right

12:40 the point is to have a clean way to manage it, maybe the current system is fine for that

13:04 gfredericks: thank goodness wolfram is releasing that new PL or programming would keep being difficult

13:05 justin_smith: so is it mathematica with some extra syntax or what?

13:06 * gfredericks has no idea

13:06 bbloom: i think it's literally just mathematica.

13:10 gfredericks: presumably I don't need to know what it is exactly because it's just that easy

13:10 justin_smith: just watch, it will rip off a bunch of stuff from haskell, then sue the haskell people for patent infringement

13:11 http://vserver1.cscs.lsa.umich.edu/~crshalizi/reviews/wolfram/

13:25 silasdavis: I have some json files in my project's resources folder

13:25 when I use AOT compilation they get copied to target/classes and target/test-classes

13:25 which causes duplications when I load using carica/resources

13:26 is there any way I can avoid this

13:26 can someone explain why these files are copied/how I am misusing the resources folder?

13:28 gfredericks: I know leiningen lets you config a test resources directory...I wonder if that would prevent target/test-classes from getting /resources?

13:49 cYmen: I think Joy of Clojure is not a good book. I'm not sure we should recommend it to anyone.

13:50 mysamdog: What's wrong with it?

13:50 cYmen: To be fair I'm only 2/3, through.

13:50 emaphis: Ok, I'm a noob, what is a good book.

13:50 cYmen: emaphis: I don't know. I started with Joy of Clojure.

13:50 I am a noob as well.

13:50 mysamdog: http://www.amazon.com/gp/product/1449394701?ie=UTF8&tag=httpcemericom-20&linkCode=shr&camp=213733&creative=393185&creativeASIN=1449394701&ref_=cm_sw_r_tw_dp_jCHKnb0966XJY

13:50 justin_smith: cYmen: what don't you like about it?

13:51 mysamdog: It's called Clojure Programming, and it's great

13:51 cYmen: justin_smith: Explanations of almost all matters are just terrible. You either already know how that stuff works or have to figure it out using online resources.

13:51 emaphis: I always like OReilly books

13:52 cYmen: And there are things, like their A* implementation, that I think is neither good nor in any way helpful learning clojure.

13:52 emaphis: I've heard Joy of Clojure isn't supposed to be the first book you read.

13:53 cYmen: And I just read half a chapter about prototype based inheritance and now I'm not even sure if that is a best practice or just something semi-clojure-related the authors wanted to talk about.

13:54 emaphis: I have heard that as well but don't think it is good as a second book either.

13:54 It's not like it explains any complicated parts in more detail or whatever.

13:55 scottj: cYmen: I can't stand JoC either, but there are tons of people who love it, so it makes sense for each person to just recommend whatever book they like and not tell others what to recommend.

13:55 cYmen: The usual disclaimers about, character, background and tastes apply of course...

13:56 scottj: Yeah, but I think recommendations on IRC are reproductive.

13:57 Somebody recommends it because somebody else recommended it and so on...

13:57 coventry: cYmen: Joy of Clojure is not a good book to learn the basics of clojure from.

13:57 cYmen: So I just wanted to complain about it to put my opinion of it out there. :)

13:57 justin_smith: I don't recommend books I don't read, and I doubt many other people are doing that either

13:57 cYmen: coventry: Well, what would you think is it good for learning?

13:57 coventry: I thought they said something to that effect in the introduction.

13:58 Clojure Programming. http://clojurebook.com

13:58 justin_smith: http://joyofclojure.com/foreword/ the caveats here are very clear

13:58 "it may not be an ideal first book on Clojure either. The authors assume you’re fearless and, importantly, equipped with a search engine"

13:59 cYmen: Yes, well imho they might as well have written "this book is crap but it has a reference list in the back and provides ideas what to search for online"

14:00 That's not a reason to buy a book. And a disclaimer that it is crap doesn't make it less crappy.

14:00 justin_smith: it's not crap. It's just not an introductory text.

14:00 cYmen: Sorry, that was exaggerated.

14:00 It is not a terrible book at all.

14:01 coventry: Crappy for your purposes. It's understandable that you're frustrated, but you could have avoided the trouble by reading the frontispiece to understand the book's purpose.

14:02 cYmen: I'm not frustrated by the difficulty.

14:02 I'm frustrated by the failure of this book to make difficult things more accessible.

14:03 gfredericks: Raynes: ping

14:04 is it wakeup time in california yet

14:04 arrdem: gfredericks: should be... it's 11:06 there unless I can't math

14:04 justin_smith: depends how late you were drinking and how much you drank and what shift you work. :)

14:04 cYmen: :)

14:04 arrdem: sometimes I think that #clojure is its own timezone...

14:05 gfredericks: Raynes: I am using conch and (ls "." {:seq true}) hangs; when I C-c it interrupts with something in j.u.c.locks...tryRelease

14:07 (ls ".") works just fine of course

14:07 stacktrace has LinkedBlockingQueue.take

14:09 justin_smith: somehow, even when your work day is 11 pm to 7 am, people still get judgey if you drink at 9 am

14:12 gfredericks: is there any way to start a repl when my project.clj has :aot and :main even if my project won't compile?

14:20 coventry: gfredericks: Does "java -cp `lein classpath` clojure.main" work?

14:24 gfredericks: hmm...probably

14:24 * gfredericks puts that in his back pocket

14:25 coventry: Yeah, it's handy.

14:48 {[^-^]}: Rich said clojurescript is clojure's scripting story but I can't find anything about how to shell script with it

14:50 coventry: {[^-^]}: Have you seen https://github.com/alandipert/gherkin ?

15:19 biggbear: .(clojure.pprint/cl-format nil "~63,'0b" (bit-shift-left (bit-set 0 62) 1))

15:20 ,(clojure.pprint/cl-format nil "~63,'0b" (bit-shift-left (bit-set 0 62) 1))

15:20 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint>

15:20 arrdem: biggbear: throw a use in there and it'll work.. clojurebot is weird about the sandbox and uses. they timeout and unload after a while.

15:21 biggbear: is this a bug or what? im getting "ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)"

15:22 arrdem: ,(do (require 'clojure.pprint) (clojure.pprint/cl-format nil "~63,'0b" (bit-shift-left (bit-set 0 62) 1)))

15:22 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint>

15:22 arrdem: ,(require 'clojure.pprint)

15:22 clojurebot: nil

15:23 guns: coventry: Wow, so gherkin isn't a joke? A quick scan shows that the authors are actually competent at bash

15:23 that's exciting if they're really going to write a lisp core in just bash

15:23 arrdem: ,(#'clojure.pprint/cl-format nil "~b" 64)

15:23 clojurebot: "1000000"

15:23 biggbear: arrdem that works

15:24 arrdem: ,(#'clojure.pprint/cl-format nil "~63,'0b" (bit-shift-left (bit-set 0 62) 1))

15:24 clojurebot: #<ArithmeticException java.lang.ArithmeticException: integer overflow>

15:24 * arrdem grabs a repl

15:24 biggbear: arrdem: i find pprint fails printing the zero negative

15:26 * arrdem struggles to recal two's complement arithmetic

15:28 arrdem: biggbear: reduces to #(#'clojure.pprint/cl-format nil "~b" (bit-set 0 63))

15:29 biggbear: but can confirm that (~0)<<63 breaks cl-fmt

15:29 biggbear: care to open a jira ticket?

15:31 coventry: guns: I think he's serious, but having a laugh at the same time. :-)

15:42 guns: coventry: I'll keep an eyeball on it then. Thanks for the heads up

15:53 biggbear: arrdem: yes a jira ticket would be fine.

16:18 kristof: Since the youtube channel hasn't updated, I take it there's no way to watch clojure-conj stuff, yet?

16:19 cYmen: Is #(apply hash-set (filter even? %)) idiomatic?

16:21 My problem here was that filter returns a seq not another set...

16:21 `cbp: i don't see any loop/recur so i dont see why not

16:22 but you may wanna use set

16:22 instead of hash-set

16:22 cYmen: oh, that exists and doesn't need the apply. Sweet. :)

17:01 Raynes: gfredericks: I'll look into that.

17:01 gfredericks: Raynes: easy workaround was splitting lines myself

17:16 cYmen: Is there something like (let [v (map :k) :or 17] ...)?

17:17 Bronsa: cYmen: (let [{v :k :or {v 17}} map] ..)

17:18 bbloom: also:

17:18 (let [v (map :k 17)] ...)

17:18 you may want to avoid using the word "map" for a local, since it will shadow clojure.core/map

17:18 cYmen: Yeah, I didn't use it just wanted to hint at what it is.

17:18 Thanks! :)

17:19 Raynes: gfredericks: Yeah, but obviously that shouldn't happen :P

17:20 gfredericks: When you use :seq true, it uses a queue under the hood to keep constantly reading from the process.

17:20 gfredericks: Otherwise if you applied a timeout and the timeout occurred before you read from the lazy seq, the process would be dead and its output prior to being killed out be inaccessible.

17:21 bbloom: cYmen: you may want to read http://clojure.org/special_forms#Special Forms--Binding Forms (Destructuring)

17:21 sorry that link has spaces in it, you need to copy paste :-/

17:21 and:

17:21 (doc get)

17:21 clojurebot: "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."

17:22 cYmen: bbloom: Actually had that link open already just couldn't find the relevant parts. :)

17:22 bbloom: which is the fully nil-safe version of lookup (the same operation as :keywords and maps as functions)

17:23 gfredericks: Raynes: that use case implies you want all the output that occurred before the timeout?

17:23 (just making sure I understand)

17:24 Raynes: gfredericks: Yes.

17:25 gfredericks: Raynes: I'm happy to make a ticket if that's the goodest idea

17:25 Raynes: gfredericks: yiss plz

17:27 gfredericks: Raynes: also am I crazy or does conch take options in a combo of kv-varargs and final options map?

17:33 Raynes: gfredericks: Meaning it allows both?

17:33 Or some options can only be passed one way?

17:35 gfredericks: I'm trying to remember if I wanted to support both for some reason.

17:35 Usually I'm just an options map at the end sort of guy.

17:36 also: where does the mangling of clojure(script) names to java(script) names happen? i'd like to map "a->b" to "a__GT_b" at runtime.

17:37 Raynes: gfredericks: How big is the directory you're lsing?

17:38 hiredman: also: in advanced mode the google closure compiler does further munging along other optimizations

17:39 also: yeah, so without advanced mode, or when exporting the defs

17:40 gfredericks: Raynes: 10 files?

17:40 Raynes: gfredericks: Interesting. i can't reproduce it myself. :o

17:41 What version of conch is this that you're using?

17:41 hiredman: relying on those names means you or anyone downstream of you cannot use advanced mode

17:44 by that I mean don't do it, think of the children

17:44 also: hiredman: yes, this is for a library where some namespaces will be exported for use in javascript

17:44 gfredericks: Raynes: 0.5.2

17:45 Raynes: gfredericks: Give 0.6.0 a shot?

17:45 gfredericks: https://clojars.org/me.raynes/conch

17:45 also: hiredman: anyway, it looks like it's here: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L2686-L2711

17:46 gfredericks: Raynes: I will totesally do that

17:56 Raynes: oh man that worked I a am a really bad open source problem reporter

17:58 dnolen: also: does ^:export not solve your problem?

18:02 gfredericks: dnolen: special characters are still munged

18:04 dnolen: also: oh, you *want* munge facilities at runtime

18:05 also: dnolen: that's half of it. i'd then like to do something like goog.getObjectByName, but on a name like 'ns.a->b' instead of 'ns.a__GT_b'

18:07 dnolen: also: right, sounds like you're on your way then.

18:11 hiredman: if you are building javascript interface I would use set! or aset to build an interface object and have the compiler emit the code in a function literal

18:12 which there is some cljsbuild option for

18:17 so you get something like function () {Foo["external"] = ...}()

18:17 also: hiredman: thanks, that seems like it might be a more sane way to do this

18:17 Raynes: gfredericks: Hahaha, well, happy to hear I don't have a bug there in any case :P

18:19 hiredman: and you can still use advanced mode that way

18:20 abaranosky: does anyone know how to express tuple types in core.typed? ex. ["Bob" 21]

18:20 hiredman: abaranosky: there is a Vector type

18:21 cYmen: How do I call a function recursively with variable argument count?

18:22 noprompt: cYmen: like with recur?

18:22 abaranosky: hiredman: the example I found here (https://github.com/clojure/core.typed/wiki/Types#vectors) seems to assume a vector with every element having the same type though

18:22 cYmen: Well, (recur a b rest) doesn't work. How do I fix it? :)

18:23 noprompt: cYmen: hmm... sounds a bit fishy.

18:23 abaranosky: cYmen: make it take non-varargs to avoid the apply call at every recursion step

18:23 noprompt: ^^^

18:23 hiredman: abaranosky: look further down the page

18:23 abaranosky: and iyou really want the varargs, wrap the call in a no-varargs version a "convenience" fn

18:23 noonian: yeah, can use an inner loop form that takes the explicit collection of args so the top level function has the same interface

18:23 abaranosky: hiredman: thanks

18:24 hiredman: nice. Got it, thanks

18:24 cYmen: abaranosky: You can use apply with recur?

18:24 noprompt: cYmen: no.

18:24 abaranosky: cYmen: probably not.. check the repl :) I never do it.

18:25 cYmen: hrhr

18:25 noprompt: i mean afaik you can't and if you're doing that it's probably a good sign you're problem hasn't been broken down far enough.

18:26 dpritchett: anyone successfully connecting to heroku postgres (remotely) via a jdbc URL and org.clojure/java.jdbc "0.3.0-beta1" ?

18:26 noprompt: cYmen: it sounds to me like you should go the route abaranosky is getting at. use a helper function.

18:27 abaranosky: gist forthcoming

18:28 dpritchett: With a jdbc URL of the form

18:28 "jdbc:postgresql://host.amazonaws.com:5432/dbname?user=user&password=pass&ssl=true" I get rejected because it doesn't like the username 'daniel' which happens to be my local username on OSX and is definitely not the username in the jdbc URL

18:30 abaranosky: cYmen: looking at my gist... I'd probably use a loop/recur and not a helper fn.. I'll show you what I mean

18:34 also: dpritchett: have you tried it as user:password@host ?

18:34 dpritchett: Yeah, when I tried that it gave me a "role name_of_db does not exist" error from postgres

18:34 another time I got a pg_hba does not love you error

18:34 i'm trying the 0.2.3 jdbc lib now, maybe it'll help

18:35 i should've kept all my failing test cases rather than updating it in place, my bad

18:36 abaranosky: cYmen: https://gist.github.com/AlexBaranosky/7621419

18:37 cYmen: abaranosky: thanks :)

18:37 dpritchett: with postgres://user:pass@host:port/dbname?ssl=true i get

18:37 PSQLException FATAL: no pg_hba.conf entry for host "99.3.164.209", user "x" database: "y" SSL off

18:39 bitemyapp: abaranosky: you missed out on the type theory meetup, it was a ton of fun.

18:39 abaranosky: bitemyapp: I wanted to go too :(

18:39 bitemyapp: abaranosky: come to the next one! :)

18:40 should happen in a week or three.

18:40 also: dpritchett: i'd try moving the parameters out of the url

18:40 dpritchett: Yeah, I'm trying to build a hash to please http://clojure.github.io/java.jdbc/#clojure.java.jdbc/get-connection now

18:41 abaranosky: bitemyapp: nice

18:42 also: dpritchett: is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#PostgreSQL close?

18:42 dpritchett: I'll try it, thanks

18:44 bitemyapp: abaranosky: Consolation prize! - Check this out http://ncatlab.org

18:45 abaranosky: checking out... what is it?

18:45 bitemyapp: abaranosky: awesome wiki resource for category theory and how it ties into type theory, set theory, philosophy, and comp sci :)

18:46 abaranosky: bitemyapp: nice

18:52 noprompt: bitemyapp: this wiki is pretty rad.

18:53 coventry: bitemyapp: https://github.com/coventry/troncle/blob/master/src/troncle/traces.clj#L101 (C-c t V to toggle tracing, t/sa to set a tracing-output predicate which takes the arguments.)

18:53 noprompt: bitemyapp: i was beginning to get into abstract algebra a couple years ago before working sort of got in the way of all that. at the time this would have been very useful.

18:54 bitemyapp: noprompt: I am very happy with this wiki.

18:54 It makes 1000x more sense than anything on wikipedia.

18:54 it's also a good example of why I love wikis.

18:54 coventry: oooohhhh pretty *_*

18:55 noprompt: bitemyapp: i had a math professor who had a ton of great (old) books on abstract algebra and from what i remember they were far easier to comprehend then the shit they peddle in classrooms today.

18:55 textbooks have seriously gone down hill.

18:55 coventry: I'm finding troncle useful for developing troncle, at this point.

18:56 noprompt: bitemyapp: wikipedia usually doesn't help much if you're trying to *understand* something. it's good to find a bearing though for which directions you need to head tho.

18:57 bitemyapp: noprompt: why even bother trying to explain anything then? why not just have a list of sources and possibly related nouns? :P

18:57 coventry: that's a good place to be in :)

18:57 noprompt: god i wish i still had the PDF scans of those books. they were *awesome*.

18:58 seriously if you have the money and can shell out for the older abstract algebra books they're worth it.

18:59 bitemyapp: i think i missed something.

18:59 bitemyapp: noprompt: ?

19:00 noprompt: bitemyapp: by the way i'm still bleeding. just decided to say fuck it and incrementally rewrite this horses shit in cljs.

19:00 bitemyapp: it's good to try to understand the code

19:00 but sometimes it's better to rewrite.

19:02 noprompt: 90% of the time i'd definitely agree and as it stands now i have an understanding of what the code is doing at a high level. but it's such a mess.

19:03 i'm talking about methods on objects that manipulate state in other objects and side effect at the same time *everywhere*.

19:04 children directly mutating their parent and then doing something to some global state.

19:05 bitemyapp: :|

19:05 noprompt: was the code obfuscated on *purpose*?

19:06 noprompt: bitemyapp: honestly, i have no idea. it was written by two people one not much better than the other.

19:06 it appears to me as the programmer had good intentions but didn't understand the consequences of making certain design decisions.

19:07 bitemyapp: noprompt: and probably wasn't remotely aware of the alternatives.

19:08 noprompt: bitemyapp: probably not. i was under the impression that OOP JS was considered a bad idea but i guess i don't know as much about the JS community as i thought.

19:09 and by OOP i'm talking about the imitation class based stuff with inheritance etc.

19:09 abaranosky: noprompt: JS is a bad idea :P

19:09 noprompt: is there a name for that?

19:09 abaranosky: haha yeah.

19:09 abaranosky: CLJS is a good idea :)

19:09 noprompt: abaranosky: this is also true.

19:12 well time to whip up some bacon!

19:13 {[^-^]}: how do I get aroun this?

19:14 http://dev.clojure.org/jira/browse/CLJ-1082?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel

19:15 ,(reduce + (subvec (into (vector-of :long) (range 100)) 0 10))

19:15 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.core.Vec cannot be cast to clojure.lang.PersistentVector>

19:17 coventry: Are you concerned with performance? The obvious thing to do is wrap it in a (vec).

19:17 ,(reduce + (vec (subvec (into (vector-of :long) (range 100)) 0 10)))

19:17 clojurebot: 45

19:19 {[^-^]}: I'm sorta worried about performance

19:19 but I guess it will be fixed in a future revision of clojure so I should worry about it now right

19:19 ?

19:19 shouldn't*

19:25 coventry: I wouldn't unless it shows up as a hotspot in profiling.

19:25 abaranosky: is there a CIDER irc channel?

19:26 {[^-^]}: umm, the idiomatic way to do a loop to do something N times is to reduce over (range N) right?

19:26 abaranosky: doseq

19:26 coventry: It really depends.

19:26 {[^-^]}: is that just as performant as a loop?

19:27 well I don't need side-effects

19:27 abaranosky: {[^-^]}: yes

19:27 {[^-^]}: and I thought doseq is for side-effects

19:27 abaranosky: it is implemented as a loop

19:27 hiredman: dotimes

19:27 abaranosky: {[^-^]}: what you asked is how to *do* something n times... that means side effects

19:27 coventry: (doc for)

19:27 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when te

19:28 abaranosky: for is just sugar over map/filter/etc

19:28 I'd recommend getting more compfortable with those first and ignoring 'for'

19:29 coventry: Reduce is for when you want to compute some accumulation over the iterations.

19:29 {[^-^]}: well not *do* but compute something using a counter

19:29 and accumulator

19:30 abaranosky: {[^-^]}: it heavily depends on what you are doing... Most of the time reduce is not needed

19:30 but.... I can't tell you without looking at the actual requirements

19:33 {[^-^]}: I don't think doseq is what I need since I need the result of the last computation

19:33 abaranosky: yes definiately not doseq

19:34 coventry: {[^-^]}: What are you trying to do?

19:34 {[^-^]}: so I asked if reduce was idiomatic here and if it's as perfomant as a manual loop?

19:34 abaranosky: you need either: map, reduce, loop

19:35 coventry: That's like asking whether "dude" is idiomatic. It depends on the context, dude.

19:35 abaranosky: {[^-^]}: yeah dude

19:38 cYmen: What is the most convenient way to trace a loop/recur?

19:40 coventry: cYmen: Troncle! https://github.com/coventry/troncle

19:41 bitemyapp: someday I will understand how NHL Hockey '94 for the Genesis is still fun today.

19:43 cYmen: Where is the documentation for clojure.tools.trace anyway?

19:44 coventry: https://github.com/timvisher/what-does-tools-trace-do/blob/master/src/what_does_tools_trace_do/core.clj

19:44 cYmen: coventry: I want to try that but I just don't feel like installing and figuring out something new right now.

19:45 coventry: cYmen: Sure.

20:15 justin_smith: to do something i times I think the canonical thing is dotimes

20:16 never mind, specified needing a result

20:23 {[^-^]}: what's faster, ((partial bit-or 0) 1) or (#(bit-or 0 %) 1) ?

20:24 justin_smith: criterium would tell you

20:24 though it is very likely the latter

20:25 bitemyapp: {[^-^]}: my guess is the latter, but use criterium.

20:28 justin_smith: http://sprunge.us/bJfd the latter is much much faster

20:28 ~20x faster

20:28 clojurebot: No entiendo

20:29 {[^-^]}: I guess I won't ever be using partial then

20:30 justin_smith: sometimes the syntactic convenience outweighs the performance penalty

20:31 Bronsa: yeah, partial is implemented in terms of apply, it will always be slower than #()

21:09 bpr: did the set of compiler options change in cljs 0.0-2060? I'm getting a strange AssertionError from this project.clj: https://www.refheap.com/21201

21:09 The error is pasted in the link above

21:11 I see that "* CLJS-683: :source-map-path compiler option to simplify web server

21:11 integration" is listed in the enhancements for 0.0-2060. Given that, is my project.clj incorrect for the new version of cljs?

21:12 bitemyapp: `cbp: watching a tourney?

21:13 `cbp: bitemyapp: yeah kinda, also making dinner

21:19 dnolen: bpr: try 2080

21:21 bpr: note you need to set an :output-dir and it must be in the same directory as :output-to

21:22 bpr: :output-dir "resources/public/js/out" should do the trick for you

21:27 bpr: is this new requirement in support of source maps?

21:28 dnolen: bpr: yep

21:28 bpr: otherwise calculating relative URL is a PITA

21:29 bpr: dnolen: gotcha. thanks!

23:23 wei__: does lobos support adding fields to an existing table (ALTER) in Postgres?

23:23 SegFaultAX: Just in case anyone was wondering, the new Mario 3d world is /amazing/ :)

23:26 bitemyapp: SegFaultAX: another one? yeesh.

23:26 wei__: I prefer migratus, in case that's any help to you.

23:27 wei__: bitemyapp: ok, will check it out. running into some limitations of lobos pretty early on

23:27 SegFaultAX: bitemyapp: Hmm?

23:38 swarthy: I've been reading a lot about deploying clojure web apps. Everyone always tells you 'how' but makes little in the way of recommendations. If I'm deploying a small compojure based CRUD app < 100 users and I may run additional apps on the server? Should I uberjar?

23:38 With nginx in front?

23:39 jared314: swarthy: with jetty?

23:39 swarthy: That is what I see people talking about? I'm mostly curious what the best way to accomplish a web app deploy is with the fewest struggles.

23:39 Also I'm less than familiar with JVM stack at present.

23:40 but happy to learn

23:50 bitemyapp: SegFaultAX: there have been at least two or three mario 3d worlds.

23:52 swarthy: Yeah Nintendo has always been weird. With hardware as their focus they change the consoles, but keep the same game or 99% of the story from iteration to iteration.

23:52 Never been my thing.

23:53 justin_smith: swarthy: nginx and varnish in front are good, but if you are really looking at 100 users total (and not at a given time), they may not be needed

23:53 also, using uberwar and putting the app in a tomcat container can have advantages

23:53 in terms of convenient systematic restart / autodeploy kind of stuff

23:54 bitemyapp: swarthy: I really like classic games and emulators, including the original Super Mario World for SNES, but there's just not enough variety or refinement of the gameplay.

23:54 swarthy: Super Meat Boy was a better platformer

23:54 swarthy: bitemyapp: yes SMB was good, made playing games in the room with your friends telling you how bad you are great again.

23:54 justin_smith: So do you typically uberjar at Instrument?

23:55 justin_smith: uberwar

23:55 if not that, I would uberjar

23:55 lein in production is asking for a disaster

23:55 swarthy: justin_smith: Well uberwar gets dropped into a Java server container yes? I know nothing about that yet.

23:55 technomancy: (inc uberjar)

23:55 lazybot: ⇒ 1

23:55 justin_smith: ie. use lein to build, but don't even have it installed on the prod server

23:56 technomancy: swarthy: uberwars are for people who already have a big investment in the JVM

23:56 justin_smith: swarthy: that's what I was saying about tomcat, uberwar makes it easy to just use the existing tomcat functionality, and just drop your thing into it

23:56 swarthy: Okay, so as a former UNIX \ scripting language dev. I want to deploy my new clojure stuff, so uberjar will suffice? No reason it will come back to bite me?

23:57 justin_smith: nope

23:57 just java -jar for a ring app

23:57 technomancy: right, you want nginx just to avoid running jetty on port 80

23:57 justin_smith: you may want to set up a service abstraction for convenient shutdown / restart / redeploy

23:57 technomancy: but keep it simple with a run-jetty call in your uberjar's -main

23:58 justin_smith: but as a *nix person you probably know how to do that (register a pid, make an init script, etc.)

23:58 brainproxy: is there a way in clojure mode to get the nice highlighthing for (def... ...) if the def... has a dash in it?

23:58 swarthy: Is there a reason not to expose Jetty directly that I should know about?

23:58 brainproxy: i.e. clojure mode in emacs

23:58 swarthy: but I'm happy to use nginx

23:58 just curious

23:58 justin_smith: it is probably more fragile than nginx, but at a small scale it should be fine

23:59 also probably more fragile than tomcat, at that

23:59 technomancy: swarthy: don't run your app as root

23:59 justin_smith: yeah, that is hopefully a given in the unix world

23:59 but I guess there are people that foolish

Logging service provided by n01se.net