#clojure log - Aug 24 2013

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

0:16 dnolen: looks like tbaldridge put my post on HN https://news.ycombinator.com/newest

0:16 feel free to upvote!

0:17 cgag: ha i already searched to upvote it

0:17 and didn't see it

0:28 dnolen: i don't know what i did wrong in the past, but doing cljsbuild clean and then rebuilding

0:28 allowed me to connect

0:29 i'm finally free... been trying to get this to work for so long, wish i thought of trying that earlier

0:29 ivan: what does ^not-native mean? native to what?

0:32 cgag: ivan: what?

0:33 * ivan finds http://dev.clojure.org/jira/browse/CLJS-443

0:34 ivan: "In the presence of this type hint all protocol fns on the hinted symbol will be directly dispatched under advanced compilation."

1:28 futile: technomancy: I took up a naming scheme just like yours... almost. For example, my app to keep Mac processes alive is gonna be called Charon

1:41 cgag: man i'm disappointed with these reactions to that core.async post

1:42 bbloom: it was posted late on a friday & wasn't super relevant to non cljs users…. *shrug*

1:43 SegFaultAX: dnolen: Ping

1:45 dark_element: cgag, what post are you talking about?

1:45 cgag: https://news.ycombinator.com/item?id=6267439

1:46 shaungilchrist: "Guess what - in the time that it took me to read this post, Moore's Law solved the problem."

1:46 hahaha what!?

1:50 Raynes: It's hacker news.

1:50 Do you really honestly, deep in your heart expect more trhan that?

1:51 shaungilchrist: at one point, yes.

1:51 cgag: i don't know why i always do

1:52 shaungilchrist: ha yeah i definitely remember when i was really impressed by HN, i still am by the occasional really good comment

1:52 Raynes: What's more annoying than hacker news commentors is old-time hacker news users who reminisce about the time when HN was the land of milk and honey.

1:52 shaungilchrist: the idea that "more power" compensates for complexity is just so absurd. Like if you keep getting your fingers caught in a blender the answer is a faster blender.

1:53 cgag: Raynes: i was actually talking more about my own gradual disillusionment than the quality actually changing

1:53 shaungilchrist: yeah hn was just a more focussed slashdot for a while, oh well

1:53 Raynes: Every single place on the internet and in real life that is set up in such a way that the general public can mess with it is going to get messed with. There are good people and shitty people. If you let both of them in, both of them will come in.

1:54 If HN makes you feel bad, go read threads on dreamincode.net

1:54 If you have suicidal tendencies, I suggest not doing this though.

1:54 SegFaultAX: Raynes: Dark, man. Dark.

1:55 Raynes: SegFaultAX: I haven't even put eyeliner and black fingernail polish on yet.

1:55 There is a whole thread on dreamincode dedicated to arguing about whether or not HTML is a programming language.

1:56 shaungilchrist: wow that page made me want to get adblock again

1:56 ivan: moore's law comment posted by someone writing PHP at Apple

1:56 SegFaultAX: Raynes: http://www.youtube.com/watch?v=ydbDJqXCrFs

1:56 Raynes: http://www.dreamincode.net/forums/topic/327561-whats-your-most-controversial-programming-opinion/page__view__findpost__p__1892173 See this.

1:56 http://www.dreamincode.net/forums/topic/327561-whats-your-most-controversial-programming-opinion/page__view__findpost__p__1892185 And this.

1:57 SegFaultAX: ivan: http://i.imgur.com/ru012rf.jpg

2:01 shaungilchrist: ivan: wow you weren't kidding

2:03 cgag: oh i was thinking that was a joke about the hiphop vm but i guess that was facebook

2:04 seabre: Raynes: I remember when /r/programming on Reddit was Paul Graham and Lisp.

2:05 seangrov`: Raynes: Is there content on that page, or just ads jumbled together?

2:06 Raynes: seangrov`: Mostly just ads.

2:06 cgag: i'm always amazed sites that look like that manage to have a real user base

2:07 Raynes: Most of the regulars have DiC++

2:07 shaungilchrist: markovian ad-generation

2:07 Raynes: Which eliminates the ads.

2:07 FOR A FEEEEEEEEEE

2:43 kab3wm: I'm new to clojure and hoping someone can help me out with a something. I have a function that is returning a very nested list of maps. Looks like this: ((({:key "val"}) ({:key2 "val2"}))) is there an easy way to reduce this so it's easier to access my data?

2:46 SegFaultAX: kab3wm: For starters, don't generate a deeply nested list of maps. :)

2:47 shaungilchrist: ,(flatten '((({:key "val"}) {:key2 "val2"})))

2:47 clojurebot: ({:key "val"} {:key2 "val2"})

2:47 kab3wm: SegFaultAX: I absolutely agree that's where I should fix this.. however what I'm developing is purely for migrating a database. I just need it to work once, so I'm trying to solve the easier problem. :)

2:48 SegFaultAX: I usually consider flatten a code smell, but for a one-off task it might be alright.

2:48 shaungilchrist: totally a code smell but if that is really the world he is living in it may smell of victory (temporarily)

2:49 kab3wm: shaungilchrist: thank you. Not sure how I missed that in the docs. I think I was looking at reduce, etc.

2:49 shaungilchrist: you can go the other gnar gnar route of like (let [[[[key]] ....)

3:03 callen: shaungilchrist: ...gnar gnar?

3:04 shaungilchrist: haha sorry I forget my sarcastic surfer impression may not work via text

3:05 callen: shaungilchrist: didna even know what it meant mate.

3:07 shaungilchrist: oh haha gnarley

3:51 Raynes: callen: People are slowly removing letters from words until things are merely grunts. For example, "That's nuts man, you so cray"

3:52 callen: You so cray http://goo.gl/pnRzt

3:53 God how do people eat those things. It looks like it'll come back to life and chew it's way out of you.

3:57 TEttinger: Raynes, people eat mantis shrimp in places like Hong Kong. there the word translates as "pissing shrimp" because if you boil it without killing it first, it will evacuate its bladder in your cooking pot.

3:58 mantis shrimp can also (depending on species) punch through glass with a hammer arm or slice through a finger to the bone with their stabber arm

3:59 WHY. would you try to catch and eat that.

4:00 it isn't even worth catching sometimes because some will cut through nets. and it's cheaper than lobster, so you get less money for catching one...

4:00 callen: Raynes: words are evaporating :|

4:00 TEttinger: anis simp

4:00 shaungilchrist: human language is just slowly turning into APL

4:00 Raynes: You don't want to know what I read from that TEttinger

4:01 TEttinger: shaungilchrist: chinese?

4:01 one symbol per word?

5:11 SegFaultAX: Anyone done 178 on 4clojure?

5:14 I'm having trouble getting my solution under 500 chars (including whitespace)

5:17 Well, under 400 now.

5:35 wei_: any recommendations for a cljs or js routing library?

6:54 Gonzih: Hi all, guys how can I pass hashmap to function accepting optional hash-map argument. Like so (defn myf [a & {:as options}] (println a options)) (def opts {:a :b :c :d}) (myf 1 opts).

6:55 Right now it fails with IllegalArgumentException No value supplied for key: {:a :b, :c :d}

6:55 I can think about (flatten (vec opts)). But is there cleaner way doing so?

7:11 mpenet: TEttinger: there is an hilarious theoatmeal comic about that beast

7:12 but you probably know about it already

7:12 TEttinger: mpenet, yup.

7:42 wei_: Gonzih: I would define myf as (defn myf [a & [options]] (println a options))

7:48 Gonzih: wei_: It's not mine function

7:48 wei_: it is actually macro

7:51 wei_: not sure then, sorry. try your method

8:55 wink: Just submitted my talk for euroclojure, so now it's hoping for success \o/

9:27 siscia: anybody here willing to explain a stackoverflow that I am not sure to get ?

9:27 https://www.refheap.com/17989

9:27 it is a Sieve for prime number

9:44 jaley: can anyone point me at a good setup guide for cljs development from emacs? I'd really like a way of having a REPL for my server-side app, and a browser-connected REPL for cljs. is there a way to do this yet? I've found all the separate pieces of documentation on lein-cljsbuild, piggyback and the clojurescript page itself, but i'm having trouble sticking it all together

9:57 TEttinger: siscia, isn't it just = in clojure? what is == for?

9:58 hyPiRion: TEttinger: == is for numbers

9:58 TEttinger: huh, learn something new

9:58 hyPiRion: ,((juxt = ==) 1.0 1.0M)

9:58 clojurebot: [false true]

10:06 bbloom: dnolen: entertaining that you and i bash javascript on twitter & mozilla ppl keep commenting :-P

10:51 dw1: whoahbot:

11:11 sexpGirl: I've got a question about the blog entry by dnolen/swannodette here: http://swannodette.github.io/2013/08/17/comparative/ How easy / hard would it be to add a 'replay' functionality where you could record inputs (both what the user types and the autocompletion suggestions) and then deterministically reproduce the output? Is is doable at all?

11:12 bbloom: sexpGirl: event systems are inherently non-deterministic

11:13 sexpGirl: even if the particular browser gives you determinism, it's an implementation detail / undefined behavior

11:13 core.async (and golang & other csp things) utilize randomness when multiplexing to ensure that non-determinism is always present & never accidentally relied on

11:14 if you want real determinism, such as needed for replay, it's a lot of work

11:14 you can fake it by mocking out the event layer & record/playback a higher-level deterministic thing

11:16 sexpGirl: bbloom: oh I see... So it's not that easy at all : )

11:18 bbloom: sexpGirl: nope! maintaining determinism over the passage of time is *hard*!

11:24 sexpGirl: @bbloom: but things like networked games, like say Warcraft III or League of Legends, can kinda trivially records inputs and the time at which they happened (as well the PRNG seed) and then allow to replay games (and the replay files are tiny, because all they record are the players inputs)

11:24 bbloom: sexpGirl: it's var from trivial!

11:24 sexpGirl: for one thing, they control the game loop. you don't control the browser's event loop

11:25 like i said, you can mock the full event layer & then accomplish this sort of thing by imposing constraints on events in order to make them deterministic

11:26 core.async recognizes that this non-determinism exists & goes out of it's way to prevent you from ignoring that, so you'd either need to use the :priority flag everywhere, or not use core.async, if you wanted determinism

11:27 s/var/far

11:27 seangrov`: bbloom: I'm not sure I believe you 100%

11:27 bbloom: seangrov`: ?

11:27 seangrov`: But I just built my first toy project for core.async, so I'll find out one way or another ;)

11:28 Curious about recording/replaying events (a la pedestal) as well

11:28 bbloom: But I won't disagree too much until I've actually tried it

11:28 bbloom: pedestal is recording & replaying dataflow operations

11:28 which is…. a deterministic layer above the event system!

11:31 sexpGirl: what if I were to use some FRP thinggy to do the UI: would FRP help easily record/replay deterministically inputs / outputs? (does my question even make sense? Maybe I'm way off here)

11:32 bbloom: "some FRP thinggy" is more than a little vague :-) but the real question is: what precisely do you want to record/replay? every little UI behavior? or something more like an undo/redo tree?

11:32 you need to intentionally inject determinism in to your application at the layer you actually need determinism

11:36 sexpGirl: @bloom: say I wanted to write a ClojureScript game, I'd like to be able to easily offer a replay feature (where I would only need to save user inputs and then use my deterministic engine to replay the game as it did happen).

11:37 @bloom: my question is more of a theoretical question to understand how things works and the issues at play here : )

11:37 seangrov`: sexpGirl bbloom: That's the exact case I'm looking at in my toy battleship cljs implementation

11:37 bbloom: sexpGirl: sure, so go ahead & use the same techniques that work in any other language. don't rely on the order of browser events & don't use core.async

11:38 seangrov`: if you record all of the game moves…. you've created a deterministic layer above the event system :-P

11:39 seangrov`: bbloom: Ok, then I agree

11:39 But wondering about still running the game move list through core.async to simulate the replay

11:40 Just curious to see what problems come up - but I need to play with core.async tonight and tomorrow to get a personal understanding of core.async code

11:40 siscia: sexpGirl: have you never play SuperMeatBoy ?

11:41 bbloom: seangrov`: right, but you have less risk of non-determinism. in a battleship game, there are turns. so each event is time++

11:42 seangrov`: in a RTS, you have to worry about the passage of time

11:42 clj_newb_2345: ladies and gentlemen, after 8 years of clojure dev in Vim, I've seen the light and switching to emacs; anyone care to recommend a "learn how to use emacs/clojure the hardway" ?

11:42 bbloom: seangrov`: you need either a fixed time step or need to also record the amount of time passed at each stage

11:43 sexpGirl: clj_newb_2345: 8 years of clojure? You've been coding in Clojure since 2005?

11:43 seangrov`: bbloom: That makes sense - I was just confused about how discreet time steps were inherently incompatible with core.async's non-determinism

11:43 bbloom: seangrov`: the non-determinism comes in once you have multiple different communicating processes

11:44 seangrov`: b/c that's when you introduce multiplexing & async delivery

11:44 if you only have one go-loop, core async is kinda un-interesting :-P

11:45 sexpGirl: @bbloom: pure curiosity but are you the author of core.async?

11:45 s4muel: clj_newb_2345: er, emacs-live + evil-mode + (learn paredit) has been working for me as a recent convert

11:45 bbloom: sexpGirl: nope. that would be tbaldrid_, rhickey, & others

11:47 hyPiRion: clj_newb_2345: that's amazing, because Clojure 1.0 came out almost 6 years ago

11:47 clj_newb_2345: sexpGirl : hmm, no, miscalculation, more like 5 years

11:48 no, not since 2005

11:48 sexpGirl: clj_newb_2345: :)

11:48 clj_newb_2345: this is like peopel who need 5 years of Visual Studio 2013 experience

11:49 scheme families though, I have used for a long time :-)

12:06 jonasen: dnolen: ping

12:07 dnolen: jonasen: pong

12:07 jonasen: dnolen: do you know what cljs/user.js is all about? https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L678

12:08 dnolen: jonasen: no idea

12:09 jonasen: dnolen: ok. I get ERROR: JSC_DUPLICATE_INPUT. Duplicate input: cljs/user.js

12:09 when running the example https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L747

12:10 dnolen: jonasen: yeah I don't really know anything about the comments and what they're supposed to verify

12:10 jonasen: and only for the :whitespace optimization. :simple and :advanced seems to work fine

12:10 dnolen: maybe they're just out of date

12:12 dnolen: jonasen: quite possible, I've never really looked at the comments, at one point I considered deleting them

12:16 jonasen: dnolen: they've helped me understand closure.clj in the past so I've found them valuable.

12:16 dnolen: jonasen: which why I've left them alone

12:17 jonasen: but I don't know what state they are in, if you can confirm something is out of date more than happy to remove the confusing ones

12:21 jonasen: cljs/user.js is probably meant to be the cljs version of user.clj. I have no idea how (or if) it works

12:23 ToBeReplaced: is there a performance difference between using case and using a hash-map ?

12:26 creese: I'm trying to figure out the best way to do web applications. Has anyone tried to combine AngularJS with CLJS or would that be considered a clojure anti-pattern?

12:26 bbloom: ToBeReplaced: on the jvm, case should be compiled to a switch statement where possible

12:29 ToBeReplaced: bloom: i see i wasn't asking a reasonable question; thanks... java searching helped me out

12:53 swarthy: I'm fairly new to clojure and the new 1.3 clojure-contrib libraries are somewhat confusing to me. Where do I find str-utils2, I would like the 'contains?' function? On this page: http://dev.clojure.org/display/doc/Clojure+Contrib+Libraries I have looked and on Google and am still unsure.

12:56 `cbp``: swarthy: clojure contrib is deprecated, you can get help from this page http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go

12:56 ToBeReplaced: swarthy: I'm not sure if that ever made its way into a library after contrib was deprecated -- we have clojure.string, but that doesn't have your function

12:56 swarthy: i would just use #(.contains ^String %1 %2)

12:57 swarthy: looking at the source of the function it is very trivial so I can just implement it quickly, but the contrib stuff is confusing to new people.

12:57 thanks for the link

12:57 ToBeReplaced: yes I agree, I'll just add it myself it is simple after checking the source

12:57 Thanks ToBeReplaced and `cbp`

13:19 seangrov`: Are there any good textmate integrations with clojure/nrepl?

13:19 Not finding much

13:46 llambda: hm sort of a strange question, but does anyone remember a talk someone gave a while back about using clojure to analyze their email (iirc using log normal distribution and possibly related to a DDD conference?) i'm looking for the URL to the video if anyone has any idea what i'm talking about :)

13:57 seangrov`: llambda: If you find it, please share it

14:01 llambda: seangrov`: will do :) i'm not having much luck now...one of those moments where i clearly remember when i where i watched it but don't have the web history anymore to find it :\

14:08 coventry: What's the clojure equivalent of python's locals(), to get a map of the current value assignments?

14:13 bbloom: coventry: there is no such (standard) equivalent

14:13 coventry: some debugging tools have various hacks to accomplish that, but they must rely on implementation details b/c locals can be optimized away, cleared to nil, encapsulated in closures, etc

14:14 llambda: seangrov`: i think this was it --> http://skillsmatter.com/podcast/open-source-dot-net/keynote-eric-evans

14:15 bbloom: coventry: although you can do it statically with the implicit &env argument to macros, but still an impl detail

14:16 coventry: bbloom: Thanks, I will look into using &env, and look at how the ritz debugger does it.

14:42 hrvladev: Hi, guys. Can you recommend graphic library, where I can have multiple layers or something like a few html's canvas with different z-index? I've read about Seesaw and Quil, but don't know which to choose.

14:42 I'm trying to implement Atari's Breakout and later Arkanoid.

14:47 lynaghk: hrvladev: if you want to work with the DOM instead of a raw pixel graphics context, you can use C2

14:54 hrvladev: if you are familiar with the raw <canvas> API already, though, I would just use the canvas elements directly and not worry about finding a ClojureScript wrapper for 'em

14:55 once you get a working demo up with all of the moving pieces, you could throw it in a gist or public repo and ask for more specific help on places where you found stuff awkward/difficult.

14:55 hrvladev: lynaghk: I am not sure that I want to use DOM. I've done some games with JS and HTML5, but now I want to do it in Clojure.

14:55 lynaghk: hrvladev: Oh! you mean you don't necessarily want to use the browser?

14:55 hrvladev: Yes

14:56 lynaghk: Ah. I can't help you there then =/

14:56 hrvladev: I don't want to use it.

14:56 Because it will be a project for a Clojure course. And using ClojureScript is not preferable.

14:57 Thanks (:

15:25 paroxyzm_: Hello! When you look at the code of say - comp function is has multiple entry points: ([f], [f g] [f g h] [f1 f2 f3 & fs]). Why is it so when only one entry point would be suficient? (the last one)

15:27 bbloom: paroxyzm_: performance

15:27 paroxyzm_: the last one incurs extra allocations for the sequence

15:28 paroxyzm_: but that doesn't mean you should mimic that in your own code. clojure.core is on *everybody's* critical path. only use that overloading trick if you've benchmarked :-)

15:29 paroxyzm_: bbloom Thank you.

15:38 nkozo: what's the most popular clojurescript+clojure validation library ?

15:41 callen: nkozo: http://www.clojure-toolbox.com/

15:41 nkozo: the clojure-toolbox is a good place to check.

15:41 dobry-den: (Clojurescript) I'm building a simple speed-reading app that enumerates a vector of words like ["Hi," "I'm" "Chuck."] and displays them one at a time in a <div></div> at a user-specified rate (like 300wpm). What's a good practice for managing the state of <currentWordIndex> and <displayRate>?

15:42 callen: dobry-den: does the rate need to vary or respond to change over time?

15:42 dobry-den: if not, then just map an increasing vector of delay wrappers around the DOM display fns of the content, partitioning/chunking as it makes sense to do so.

15:42 dobry-den: callen: I'd like to be able to pause/resume, scrub the progress bar.

15:44 callen: well, some kind of iterator fn would make sense then

15:45 with it checking some kind of pause/reset booleans or something

15:45 dnolen: dobry-den: I'd probably do it in core.async to eliminate too much state tracking, but I'm biased.

15:46 callen: dnolen: I'm waiting for the complexity to pass a threshold before resorting to that, but it's a good option to keep in mind.

15:46 in particular, I'd like to make certain dobry-den's solution is something they can understand holistically before jumping into (def *MAGIC*)

15:48 dobry-den: callen: My naive idea in my just-start-somewhere mode was a setInterval on some displayNextWord function where currentWordIndex and displayRate are just global variables. But now I'm hunting for a nicer design pattern - Ideally something more functional.

15:49 dnolen: dobry-den: so you're first solution is the one that callen suggested. It can be done more cleanly in core.async but that is a small rabbit hole. Worthwhile since when you come out you'll be able blast through problems like this w/o global state tracking.

15:49 callen: dobry-den: I'd say at least knowing a bit of core.async and having it in your toolbox is valuable, but I would also advise not necessarily using a bazooka to make rabbit stew.

15:50 dobry-den: core.async is actually cool and I've played with it before - enough to not be scared of giving it a shot. (https://gist.github.com/danneu/5941767)

15:51 callen: core.async or not, I'd still end up writing an iterator fn that processes a vector of chunked content.

15:52 whether that involves global state or not is up to taste for something like this.

15:52 Raynes: do you know why lein prism exits if the first time it's executed, a test fails?

15:56 dobry-den: dnolen: What feature of clojure.async minimizes state tracking in this situation?

15:56 For instance, pausing and resuming an enumeration

15:57 dnolen: dobry-den: you can just represent the entire thing as a process and minimize the amount of externally visible state

15:59 dobry-den: dnolen: Sorry if I'm getting too dense and I don't want to overstay my welcome. But how would you represent something like enumerateWords(["a" "b" "c"], 300wpm) as a "process"?

15:59 dnolen: dobry-den: for example scrubbing can suppress the interval channel that changes the words and change the words itself. a button channel can unsuppress the interval channel.

16:00 dobry-den: dnolen: Cool, thanks.

16:02 Sort of like its own little program with it's own little API that my DOM will talk to.

16:03 bbloom: dobry-den: that's precisely the idea :-)

16:04 dnolen: dobry-den: sketch, http://gist.github.com/swannodette/6330038

16:04 clj_newb_2345: does anyone here play with Clojure on the Zing VM ?

16:04 dnolen: dobry-den: notice how tiny it is an no global state

16:06 dobry-den: dnolen: oh, hot. thanks a lot. i'll get crackin

16:07 callen: oh yeah, that is quite nice.

16:09 dnolen: dobry-den: tweaked, you need a separate chan for the interval control, obviously you can improve what I've written.

16:09 tylerweb: I'm trying to extend a record in one namespace and use the added function in another namespace

16:10 when im in the other namespace it find find the function

16:10 can't find*

16:10 is there a namespace restriction with extend?

16:11 dobry-den: dnolen: awesome

16:11 bbloom: tylerweb: can you provide a minimum reproduction? maybe a multi-file gist. your description isn't clear enough on it's own

16:12 tylerweb: bbloom: https://www.refheap.com/18007

16:12 thats the gist of what im trying to do

16:12 other records with functions defined inline work fine

16:12 its only the extend thats failing

16:13 bbloom: tylerweb: you don't show where Storable is defined

16:13 what error do you get?

16:13 oh nevermind see that error there

16:14 tylerweb: bbloom: https://www.refheap.com/18007 updated with storable declaration

16:14 derp maybe not

16:14 bbloom: tylerweb: you're not importing storable

16:14 tylerweb: i don't trust your reporduction with the in-ns forms etc

16:14 also i suspect you may have a stale instance or something from re-defining protocols

16:15 tylerweb: its a fresh repl

16:15 bbloom: tylerweb: please try to make a true minimum reproduction w/ realistic file structure, etc. you'll probably solve your own problem that way

16:15 tylerweb: the other records use protocols that aren't imported

16:15 bbloom: it can't be a fresh repl executed in the order you put in that paste. you define the protocol after you use it

16:16 scientific method up in here :-)

16:20 tylerweb: bbloom: i just uploaded the whole dir to github: https://github.com/tjgillies/futs/tree/master/src/futs

16:20 should be easier

16:21 bbloom: yeash. talk about premature modularization. why so many directories/files/whatever?

16:22 tylerweb: bbloom: its an experiment in learning protocols and records, its not production code

16:22 callen: this.namespace.is.designed.to.induce.rage.lel.lel.lel :refer [die-in-a-fire]

16:22 my next library gets a troll namespace.

16:22 tylerweb: LOL

16:23 i wanted to separate everything to learn how to set up importing/requiring

16:23 bbloom: don't do it how you're doing it

16:23 :-)

16:24 tylerweb: do what? my experiment?

16:24 bbloom: load, load-file, in-ns, etc are 99% for repl use

16:24 tylerweb: i wouldn't write production code like that

16:24 bbloom: sure, but you're trying to understand what's going wrong, but you have like 10 files in 4 directories

16:24 your problem can be simplified down to TWO FILES in a single directory

16:24 then others will be better able to help you, but you probably will be able to figure it out on your own then :-)

16:25 tylerweb: right but thats a simple problem, i made it difficult because difficult problems are better for learning

16:26 it works fine if its all in the same file

16:26 bbloom: so figure out precisely when it stops working…. minimally

16:26 this is debugging 101

16:26 tylerweb: everything runs, except the save function never gets added to File

16:27 if i do it from the repl it works

16:27 my first question in here was asking if extend had some sort of namespace limitation

16:27 bbloom: …but you just showed me some exception messages in your paste…. you're not making any sense

16:27 tylerweb: i showed the exceptions before i declared the extend in the repl

16:27 if i manually extend from repl it works

16:28 extend being https://github.com/tjgillies/futs/blob/master/src/futs/records/file.clj#L5

16:29 all the other code works fine

16:30 maybe i found a legit bug

16:32 coventry: You should put together a minimal test case which demonstrates it, then.

17:03 timsgardner: wish there was a reducers form of for

17:07 ToBeReplaced: quick ANN: https://github.com/ToBeReplaced/lettercase

17:22 sos-insects: hello

17:59 Anderkent: Anyone know of a emacs-live (the overtone emacs config) tutorial for complete emacs newbies?

17:59 (and perhaps, how to bend it to use evil?)

18:00 kmicu: Anderkent: Is http://overtone.github.io/emacs-live/ not good for you?

18:01 You can simply add evil config in your custom pack.

18:02 https://github.com/siancu/evilmode-pack or use this

18:03 Anderkent: kmicu: yes, I fetched that

18:03 I'm looking for a 'how do I really use this' tutorial not the 'how do I install this' tutorial

18:04 but I guess if most people grabbing it are alraedy emacs-comfortable, there might not be such a thing

18:04 http://overtone.github.io/emacs-live/doc-shortcuts.html aha, that's a step forward

18:05 kmicu: thanks for the evilmode-pack, that's helpful!

18:07 coventry: Could someone please unpack for what (alter-var-root v (constantly ((meta v) ::traced))) is doing to the var v? (It's a form in clojure.tools.trace/untrace-var*. ::traced is clearly being used to track whether or not a trace should be reported for the current var, and the next form (alter-meta! dissoc ::traced) must be turning that off. So what is the alter-var-root doing?)

18:08 s/unpack for/unpack for me/

18:09 amalloy: coventry: i don't think you're right about what ::trace is being used for

18:09 i'd say that ::traced is the "base" version of the function, and v currently holds a version of it wrapped with tracing, so that this sets v to (::traced (meta v))

18:10 this is without looking at the trace source, just your snippet, so of course i could be missing something

18:10 coventry: OH! Thanks, that makes a lot of sense.

18:10 I should have read trace-var* before asking.

18:12 amalloy: You're right, that's what's going on.

18:21 callen: *=//////23

19:13 Anderkent: oh, you can splice code into defproject?! Wow. Imma abuse it straight away.

19:19 dobry-den: (cljs) Why can't you nest js/setInterval within (go ...)? ie (go (js/setInterval #(>! c "hello") 1000)) fails with ">! not used in (go ...) block". So I changed to (js/setInterval #(go (>! c "hello")) 1000).

19:22 Anderkent: I jumped into Emacs + Evil Mode + Clojure all at the same time just a few months ago if you need help.

19:23 Anderkent: Here's my workflow. https://news.ycombinator.com/item?id=5870669

19:23 I realize i've been saying 'a few months ago' for like a year.

19:24 Anderkent: dobry-den: cool

19:24 dobry-den: as to your question: >! etc must run directly under a go block. It's not setInterval that's special cased, it's the #(>!) that can never work

19:24 amalloy: dobry-den: go can't reach into lambdas

19:24 coventry: dobry-den: regarding your async question, execution of the go block has finished by the time the js/setInterval callback is called.

19:24 dobry-den: oh, of course. thanks

19:26 Anderkent: dobry-den: did you do any special key remappings for stuff like nrepl.el? ctrl-c as 'quit' is heavily ingraned for me already, but nrepl.el uses it as a prefix :(

19:26 dobry-den: Anderkent: oh, I was thinking Emacs Live was that big Emacs bundle that comes with lots of things set up. I now seee that it's just Overtone integration

19:27 lemme see

19:27 Anderkent: no, it is the big bundle with a lot of stuff

19:27 made by overtone guys :P

19:27 i mean I guess 'a lot of' is relative

19:28 dobry-den: Oh, so Emacs Prelude is a similar thing

19:29 Anderkent: hm. so evil mode breaks paredit for me. Blah.

19:29 dobry-den: Anderkent: I don't think I use C-c in nrepl. For instance, on its README i see that C-c C-z switches current buffer to nrepl, but I never found a usecase for it

19:31 Oh, nevermind. C-c M-j is launches nrepl and i use that all the time. I guess the point is that the few things I use C-c for don't really feel like C-c, just a magical thing my fingers do when i, for instance, want to launch nrepl.

19:31 Anderkent: ^^ OK

19:31 dobry-den: Lemme see what i have in my .emacs file

19:31 I certainly use paredit-mode in nrepl

19:33 Anderkent: dobry-den: if you have something like: (+ 1 2 \n 3 |4), pipe being cursor, and run `dd`, do you lose the closing paren?

19:34 dobry-den: Anderkent: yeah.

19:34 That's how it should be

19:35 coventry: dobry-den: where does find-file-in-project (mentioned in your HN comment) come from?

19:35 Anderkent: no, paredit should never let you unbalance your parens

19:35 dobry-den: Anderkent: Yeah, I can understand that preference. Personally, I like that Evil(Vim) commands are more "raw"/"hard" edits.

19:36 In your example, I would opt for paredit's C-k if I wanted to preserve the paren

19:36 coventry: package-install find-file-in-project

19:37 coventry: Cool, thanks.

19:38 Raynes: callen: Not the foggiest. Kyle really did write pretty much all of that.

19:38 I basically just did lolchangethisitssilly.

19:38 And pretended to help.

19:39 callen: Raynes: dammit

19:42 dobry-den: coventry: just remember that it will start searching from where ever it finds a .git/.svn/etc

19:43 sometimes i'll be slammin my magical file finding button but realize i never 'git init'

19:44 DigitalJack: Is anyone here familiar with ztellman's gloss?

19:44 ztellman: a bit

19:44 DigitalJack: ha

19:44 coventry: dobry-den: Yep, it's a nice idea. I'll probably make something out of it to bind to C-c C-t, because clojure-jump-between-tests-and-code is a bit unreliable.

19:44 DigitalJack: I'm very confused about specifying a repeated structure

19:45 ztellman: what are you trying to do?

19:45 DigitalJack: I'm reading a file, and I don't know what the last 50 some odd bytes are, so I'd just like to specify something in my map like {:rest {repeat 50 :byte)}

19:46 I just can't seem to figure out if that is possible or if I have to write [:byte :byte :byte …. :byte] 50 times

19:47 ztellman: or (vec (repeat 50 :byte))?

19:47 Anderkent: DigitalJack: you want (repeat 50 :byte), not {repeat} :)

19:47 DigitalJack: so that (vec (repeat 50 :byte)) will be evaluated when I define the frame map?

19:47 ztellman: yes

19:48 DigitalJack: wow, ok.

19:48 I'll give that a try… I'm making my own life hard I guess :)

19:48 ztellman: arguably 'repeated' in gloss could deal with statically sized collections, but the idea is that you'd just enumerate them if it's a constant set of elements

19:53 DigitalJack: I was trying repeated actually… that's where I seemed to be not getting anywhere. I probably just don't quite get how it's supposed to be used. In trying to read a file, couldn't I just have a frame with (repeated :byte), and read in an arbitrary number of bytes? I kept getting an exception

19:54 The (vec (repeat 50 :byte)) worked great, ztellman

19:54 ztellman: DigitalJack: I was just saying that it wasn't obviously wrong, the unspoken assumption is that you're only using it on variable-sized collections

19:55 that may not be explicitly stated anywhere, though

19:56 DigitalJack: ztellman: alrighty, thanks for the help!

20:05 timsgardner: After they're realized, do seqs gain constant-time count?

20:19 coventry: Can nrepl be persuaded to DTRT with M-. on a java class/method?

20:22 akhudek: timsgardner: no

20:56 akurilin: I'd like to wrap all my DB calls (using clojure jdbc) with some time logging a la Rails logging. I could make a wrapper for the most common functions such as jdbc/query and do some logging in there, and just pass through all of the parameters to the library.

20:56 But I'm wondering if there's as better way.

20:56 Ideally it'd not introduce any new boilerplate into the business logic code, since there's plenty happening there already without an additional (log-time) wrapper.

20:58 callen: akurilin: write a func that passes queries to the jdbc lib...

20:58 just wrap the func

20:58 akurilin: so make my own wrappers that accept the same exact params and call those instead of the libs, right?

20:59 callen: akurilin: yeap. I think what *I* would do is write a middleware/library that logs queries that hit JDBC.

20:59 and wrap something deeper in JDBC.

21:00 akurilin: callen, so that'd involve redefining some of the internal library functions, if I'm understanding correctly?

21:00 callen: possibly, unless they offer some kind of DI.

21:01 akurilin: callen, gotcha, that makes plenty of sense.

21:01 callen: up to you how fancy you want to be.

21:02 akurilin: callen, generally speaking there's no need to fork libraries for small weaks, and redefinitions within the library ns should be sufficient, right?

21:02 *tweaks

21:03 callen: akurilin: uh, sure, but this discussion has added to my todo list.

21:04 akurilin: callen, what did you realize you needed to do?

21:04 callen: write a query logging library.

21:05 glosoli: Damn, been switching between VIM, LightTable and Emacs, and all the time I end up loving Emacs more than others lol

21:07 muhoo: they'll pry emacs from my cold dead ctrl-meta-shift fingers

21:07 trish_f: sooooooooooooooo

21:08 miql: I heare you, glosoli. Been a life-long vimmer and finally transitioning to emacs + evil.

21:08 callen: glosoli: yissss

21:09 akurilin: callen, ah. I've written a basic logger along the lines of Rails to print out http method, route, params, timing etc, but right now it doesn't separate between DB time and app time. I think Rails by default will log each query and how long it took.

21:09 glosoli: miql: i was always against Emacs somehow, for some stupid reason of it not being friendly experience of my previous tries lol, kinda got used to it, haven't tried any vi layer though

21:09 akurilin: Pretty convenient if you forgot to add a few indexes here and there :)

21:09 callen: akurilin: that's what I mean.

21:09 akurilin: rails style query logger.

21:10 akurilin: Yeah. You might need to do a sum of all the time spent in DB somewhere in the middleware.

21:11 callen: didn't plan on it.

21:11 but could.

21:19 jasonjckn: Is this channel also for clojurescript?

21:19 coventry: People discuss clojurescript here a lot.

21:21 jasonjckn: I'm trying to use emacs eval cljs inside my browser. I have it nearly working, the *inferior-lisp* buffer let's me type in expressions to evaluate and it works fine, however using C-x C-e hangs

21:21 so I can type in "4" and hit enter, and it returns 4, but if I C-x C-e "4" it says "C-x C-e" in the mini buffer forever

21:23 I see what's happening, it's not actually hanging because of the execution of the command, it's just not showing the results in the mini buffer.

21:23 I guess that's good enough.

21:37 dobry-den: akurilin: I wrote the same thing using timbre

21:37 akurilin: similarly i never made it so far as to figure out how to measure time in db land

22:05 akurilin: dobry-den, got it, sounds like we are all solving the same problems independently here :)

22:06 w|t: how can i call clojure.lang.Var.invoke(Object...)? or do a suitable replacement?

22:07 since there is no varargs argument in any of the invoke() methods

22:07 any way other than to do it manually?

22:17 akurilin: Random question, not sure where else to ask. Does anybody know of any good recent texts out there for designing distributed web services, ideally with cloud hosting in mind?

22:24 s4muel: Not quite a text but the first thing that came to mind was http://12factor.net/

22:25 cgag: that looks like a nice resource, thanks

22:28 akurilin: s4muel, very interesting, thanks!

22:59 cemerick: Does anyone have a defonce macro for clojurescript handy?

23:01 swarthy: I have a string form a file w/ slurp, i then re-seq to get a list of matches [["full-match" "inner-match"] ["full-match-2" "inner-match-2"]], what is the best way to get a seq with only: ["inner-match" "inner-match2"]. My efforts so far have only yielded: [("inner-match") ("inner-match2")].

23:03 kurisumasu: (->> (map rest) (reduce concat))?

23:03 swarthy, ^

23:04 amalloy: cemerick: does defonce even make sense for cljs? in what context could you use it?

23:04 swarthy: kurisumasu: thank you for helping, which argument is my seq of regex matches? I am very new to clojure.

23:05 cemerick: amalloy: same as in Clojure: for when you want to reload the same file repeatedly, and not touch any existing value

23:06 amalloy: cemerick: but cljs is compiled once and then run: how would you, in a running cljs app, ever load the same file twice?

23:06 it makes sense in clj-jvm because you can load a file, fiddle with it, load it again...

23:07 cemerick: amalloy: cljs has a REPL :-) Many, in fact.

23:09 kurisumasu: swarthy, oh, so, the `->>` (thread-last-macro) is a function that rewrites your code to compose functions. In this case, it takes the result of the previous operation, and gives it as the last argument for the next operation. Thus, (->> x (map rest) (reduce concat)) is the same as (reduce concat (map rest x))

23:09 swarthy, are you familiar with map and reduce?

23:10 swarthy: kurisumasu: thank you again, yes I am familiear with map and reduce. That is what I am using, concat was also very helpful. I'll work with the snippets you have given me here, I really appreciate it!

23:16 clj_newb_2345: for clojure dev, does emacs24 offer anything useful over emacs23 ?

23:23 cemerick: this looks sane: https://gist.github.com/cemerick/6331727

23:23 amalloy: FWIW ^

23:23 swarthy: kurisumasu: That worked great thank-you! Seeing the use of concat in a practical setting was great! I can read and read and read about it, but it takes time to click.

23:23 benkay: clj_newb_2345: if you're not already working with a well-honed Emacs setup, you can use Emacs Live with 24 to get a dev env up pretty quickly

23:24 swarthy: cemerick: I wanted to thank you for your book, I'm a clojure newbie and reading through it now.

23:24 clj_newb_2345: benkay: I'm about halfway through setting up http://clojure-doc.org/articles/tutorials/emacs.html -- waht is "emacs live" ?

23:24 cemerick: swarthy: Glad you're enjoying it. Say hi to the other authors too if you see them. :-)

23:24 benkay: clj_newb_2345: https://github.com/overtone/emacs-live

23:25 swarthy: cemerick: Will do, your name happens to be the easiest to I.D. in the chat and I remember you from the Relevance podcast.

23:26 benkay: clj_newb_2345: it turned configuring emacs for my team and myself from "wtf am i even doing" into "oh, this is tractable with a month and a half of practice"

23:27 kurisumasu: swarthy, that's basically `flatten`, except that it only flattens a single level :)

23:29 cgag: emacs24 has it's own package manager which is pretty sweet

23:29 swarthy: kurisumasu: Yeah, it does seem like a flatten. Its funny how a new language with such a different paradigm can be so mentally jarring until someone more experienced points things out.

23:34 kurisumasu: swarthy, it's easier to learn these things with a fresh mind, I guess :)

23:37 callen: Emacs was never an issue for me because I started with it early and always had a config that "accreted" over time.

23:38 I've started using the package management in a limited fashion, I don't know that I'll fully convert anytime soon though.

23:39 bja: callen: I found the opposite. I was absolutely glacial trying to learn both emacs and clojure at the same time.

23:41 benkay: #pedestal's a little quiet tonight - would anyone in #clojure spare a moment to look at this (https://groups.google.com/forum/#!topic/pedestal-users/K19pdr7WeKM) for me?

23:41 swarthy: bja: I agree, for the time being I'm using Light Table, and supplementing Vim + fireplace.vim

23:41 benkay: swarthy bja emacs live y'all

23:42 Raynes: Or just… you know, emacs.

23:42 swarthy: benkay: My problem with that is that I am a Vim user, and even Evil mode in emacs didn't feel so great -- you still have to learn a lot of Emacs bindings, etc. to make progress.

23:43 benkay: Raynes: i kept hearing that from experienced Emacs users, and then ricocheting off the default Emacs setup.

23:43 callen: I suspect people were a lot more willing to learn new tools 20 and 30 years ago.

23:43 bja: evil mode seemed okay for me, I was just haven't adjusted to buffers opening at random on me

23:43 callen: These days, if you aren't 100% key combo and feature compatible with whatever cockamamie IDE or editor they're used to, you've now killed their cat :(

23:43 Raynes: swarthy: evil-mode is pretty darn good.

23:43 seangrov`: benkay: Curious about emacs live - does it do anything worthwhile for non-overtone work?

23:44 callen: seangrov`: it has a shake-n-bake clojure-mode/nrepl.el, but that's far from difficult to setup.

23:44 swarthy: Yes evil mode gets a lot right, just some basic things. Rather than spend a week learning to configure Emacs to work like Vim then learn clojure, I skipped that and went to learning Clojure asap.

23:44 benkay: seangrov`: can't really say, as i'm a total noob. it comes with enough pre-wiring to start learning how to play around with the repl from inside emacs

23:44 swarthy: Light Table was the fastest way to achieve that at the moment.

23:44 callen: (setq package-list '(clojure-mode nrepl)) (dolist (package package-list) (package-install package))

23:44 swarthy: But emacs is a nice editor.

23:44 callen: it's not hard people.

23:45 seangrov`: I've git cloned my dotfiles onto other peoples' computers to get them up and running with Emacs + Clojure.

23:46 seangrov`: callen: Ah, I misunderstood emacs live, I thought it was about live-coding a la lighttable (but in emacs)

23:46 callen: seangrov`: it's nothing special, just has good marketing.

23:47 bja: I still haven't figured out a reasonable, non emacs+ritz way of doing step-through debugging. I sorta feel like I've replaced the step-through debugger with the repl, a trace function, and writing small and pure functions as much as possible

23:48 it seems like slimv+ritz serving up SWANK might do this, but I never quite managed to get it working (although I did get slimv's repl working)

23:54 callen: bja: if you figure out something better than slime/swank or ritz/nrepl, please let me know.

23:54 bja: there's always debug-repl and limit-break, but they're both limited to locals.

23:54 but they're nicer to use than ritz.

23:54 benkay: http://hugoduncan.org/ritz-conj/

23:54 bja: callen: yeah. it looks like you can use vim-redl and call its break/continue stuff

23:54 which seems like an upgrade over debug-repl

23:55 still not ideal though

23:56 cgag: ah i didn't realize that existed, i was planning on trying to write something like debug-repl soon

23:56 callen: cgag: always ask first :)

Logging service provided by n01se.net