#clojure logs

2013-08-24

00:16dnolenlooks like tbaldridge put my post on HN https://news.ycombinator.com/newest
00:16dnolenfeel free to upvote!
00:17cgagha i already searched to upvote it
00:17cgagand didn't see it
00:28cgagdnolen: i don't know what i did wrong in the past, but doing cljsbuild clean and then rebuilding
00:28cgagallowed me to connect
00:29cgagi'm finally free... been trying to get this to work for so long, wish i thought of trying that earlier
00:29ivanwhat does ^not-native mean? native to what?
00:32cgagivan: what?
00:34ivan"In the presence of this type hint all protocol fns on the hinted symbol will be directly dispatched under advanced compilation."
01:28futiletechnomancy: I took up a naming scheme just like yours... almost. For example, my app to keep Mac processes alive is gonna be called Charon
01:41cgagman i'm disappointed with these reactions to that core.async post
01:42bbloomit was posted late on a friday & wasn't super relevant to non cljs users…. *shrug*
01:43SegFaultAXdnolen: Ping
01:45dark_elementcgag, what post are you talking about?
01:45cgaghttps://news.ycombinator.com/item?id=6267439
01:46shaungilchrist"Guess what - in the time that it took me to read this post, Moore's Law solved the problem."
01:46shaungilchristhahaha what!?
01:50RaynesIt's hacker news.
01:50RaynesDo you really honestly, deep in your heart expect more trhan that?
01:51shaungilchristat one point, yes.
01:51cgagi don't know why i always do
01:52cgagshaungilchrist: ha yeah i definitely remember when i was really impressed by HN, i still am by the occasional really good comment
01:52RaynesWhat'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.
01:52shaungilchristthe 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.
01:53cgagRaynes: i was actually talking more about my own gradual disillusionment than the quality actually changing
01:53shaungilchristyeah hn was just a more focussed slashdot for a while, oh well
01:53RaynesEvery 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.
01:54RaynesIf HN makes you feel bad, go read threads on dreamincode.net
01:54RaynesIf you have suicidal tendencies, I suggest not doing this though.
01:54SegFaultAXRaynes: Dark, man. Dark.
01:55RaynesSegFaultAX: I haven't even put eyeliner and black fingernail polish on yet.
01:55RaynesThere is a whole thread on dreamincode dedicated to arguing about whether or not HTML is a programming language.
01:56shaungilchristwow that page made me want to get adblock again
01:56ivanmoore's law comment posted by someone writing PHP at Apple
01:56SegFaultAXRaynes: http://www.youtube.com/watch?v=ydbDJqXCrFs
01:56Rayneshttp://www.dreamincode.net/forums/topic/327561-whats-your-most-controversial-programming-opinion/page__view__findpost__p__1892173 See this.
01:56Rayneshttp://www.dreamincode.net/forums/topic/327561-whats-your-most-controversial-programming-opinion/page__view__findpost__p__1892185 And this.
01:57SegFaultAXivan: http://i.imgur.com/ru012rf.jpg
02:01shaungilchristivan: wow you weren't kidding
02:03cgagoh i was thinking that was a joke about the hiphop vm but i guess that was facebook
02:04seabreRaynes: I remember when /r/programming on Reddit was Paul Graham and Lisp.
02:05seangrov`Raynes: Is there content on that page, or just ads jumbled together?
02:06Raynesseangrov`: Mostly just ads.
02:06cgagi'm always amazed sites that look like that manage to have a real user base
02:07RaynesMost of the regulars have DiC++
02:07shaungilchristmarkovian ad-generation
02:07RaynesWhich eliminates the ads.
02:07RaynesFOR A FEEEEEEEEEE
02:43kab3wmI'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?
02:46SegFaultAXkab3wm: For starters, don't generate a deeply nested list of maps. :)
02:47shaungilchrist,(flatten '((({:key "val"}) {:key2 "val2"})))
02:47clojurebot({:key "val"} {:key2 "val2"})
02:47kab3wmSegFaultAX: 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. :)
02:48SegFaultAXI usually consider flatten a code smell, but for a one-off task it might be alright.
02:48shaungilchristtotally a code smell but if that is really the world he is living in it may smell of victory (temporarily)
02:49kab3wmshaungilchrist: thank you. Not sure how I missed that in the docs. I think I was looking at reduce, etc.
02:49shaungilchristyou can go the other gnar gnar route of like (let [[[[key]] ....)
03:03callenshaungilchrist: ...gnar gnar?
03:04shaungilchristhaha sorry I forget my sarcastic surfer impression may not work via text
03:05callenshaungilchrist: didna even know what it meant mate.
03:07shaungilchristoh haha gnarley
03:51Raynescallen: People are slowly removing letters from words until things are merely grunts. For example, "That's nuts man, you so cray"
03:52Raynescallen: You so cray http://goo.gl/pnRzt
03:53RaynesGod how do people eat those things. It looks like it'll come back to life and chew it's way out of you.
03:57TEttingerRaynes, 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.
03:58TEttingermantis 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
03:59TEttingerWHY. would you try to catch and eat that.
04:00TEttingerit 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...
04:00callenRaynes: words are evaporating :|
04:00TEttingeranis simp
04:00shaungilchristhuman language is just slowly turning into APL
04:00RaynesYou don't want to know what I read from that TEttinger
04:01TEttingershaungilchrist: chinese?
04:01TEttingerone symbol per word?
05:11SegFaultAXAnyone done 178 on 4clojure?
05:14SegFaultAXI'm having trouble getting my solution under 500 chars (including whitespace)
05:17SegFaultAXWell, under 400 now.
05:35wei_any recommendations for a cljs or js routing library?
06:54GonzihHi 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).
06:55GonzihRight now it fails with IllegalArgumentException No value supplied for key: {:a :b, :c :d}
06:55GonzihI can think about (flatten (vec opts)). But is there cleaner way doing so?
07:11mpenetTEttinger: there is an hilarious theoatmeal comic about that beast
07:12mpenetbut you probably know about it already
07:12TEttingermpenet, yup.
07:42wei_Gonzih: I would define myf as (defn myf [a & [options]] (println a options))
07:48Gonzihwei_: It's not mine function
07:48Gonzihwei_: it is actually macro
07:51wei_not sure then, sorry. try your method
08:55winkJust submitted my talk for euroclojure, so now it's hoping for success \o/
09:27sisciaanybody here willing to explain a stackoverflow that I am not sure to get ?
09:27sisciahttps://www.refheap.com/17989
09:27sisciait is a Sieve for prime number
09:44jaleycan 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
09:57TEttingersiscia, isn't it just = in clojure? what is == for?
09:58hyPiRionTEttinger: == is for numbers
09:58TEttingerhuh, learn something new
09:58hyPiRion,((juxt = ==) 1.0 1.0M)
09:58clojurebot[false true]
10:06bbloomdnolen: entertaining that you and i bash javascript on twitter & mozilla ppl keep commenting :-P
10:51dw1whoahbot:
11:11sexpGirlI'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:12bbloomsexpGirl: event systems are inherently non-deterministic
11:13bbloomsexpGirl: even if the particular browser gives you determinism, it's an implementation detail / undefined behavior
11:13bbloomcore.async (and golang & other csp things) utilize randomness when multiplexing to ensure that non-determinism is always present & never accidentally relied on
11:14bbloomif you want real determinism, such as needed for replay, it's a lot of work
11:14bbloomyou can fake it by mocking out the event layer & record/playback a higher-level deterministic thing
11:16sexpGirlbbloom: oh I see... So it's not that easy at all : )
11:18bbloomsexpGirl: nope! maintaining determinism over the passage of time is *hard*!
11:24sexpGirl@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:24bbloomsexpGirl: it's var from trivial!
11:24bbloomsexpGirl: for one thing, they control the game loop. you don't control the browser's event loop
11:25bbloomlike 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:26bbloomcore.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:27bblooms/var/far
11:27seangrov`bbloom: I'm not sure I believe you 100%
11:27bbloomseangrov`: ?
11:27seangrov`But I just built my first toy project for core.async, so I'll find out one way or another ;)
11:28seangrov`Curious about recording/replaying events (a la pedestal) as well
11:28seangrov`bbloom: But I won't disagree too much until I've actually tried it
11:28bbloompedestal is recording & replaying dataflow operations
11:28bbloomwhich is…. a deterministic layer above the event system!
11:31sexpGirlwhat 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:32bbloom"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:32bbloomyou need to intentionally inject determinism in to your application at the layer you actually need determinism
11:36sexpGirl@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:37sexpGirl@bloom: my question is more of a theoretical question to understand how things works and the issues at play here : )
11:37seangrov`sexpGirl bbloom: That's the exact case I'm looking at in my toy battleship cljs implementation
11:37bbloomsexpGirl: 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:38bbloomseangrov`: if you record all of the game moves…. you've created a deterministic layer above the event system :-P
11:39seangrov`bbloom: Ok, then I agree
11:39seangrov`But wondering about still running the game move list through core.async to simulate the replay
11:40seangrov`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:40sisciasexpGirl: have you never play SuperMeatBoy ?
11:41bbloomseangrov`: right, but you have less risk of non-determinism. in a battleship game, there are turns. so each event is time++
11:42bbloomseangrov`: in a RTS, you have to worry about the passage of time
11:42clj_newb_2345ladies 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:42bbloomseangrov`: you need either a fixed time step or need to also record the amount of time passed at each stage
11:43sexpGirlclj_newb_2345: 8 years of clojure? You've been coding in Clojure since 2005?
11:43seangrov`bbloom: That makes sense - I was just confused about how discreet time steps were inherently incompatible with core.async's non-determinism
11:43bbloomseangrov`: the non-determinism comes in once you have multiple different communicating processes
11:44bbloomseangrov`: b/c that's when you introduce multiplexing & async delivery
11:44bbloomif you only have one go-loop, core async is kinda un-interesting :-P
11:45sexpGirl@bbloom: pure curiosity but are you the author of core.async?
11:45s4muelclj_newb_2345: er, emacs-live + evil-mode + (learn paredit) has been working for me as a recent convert
11:45bbloomsexpGirl: nope. that would be tbaldrid_, rhickey, & others
11:47hyPiRionclj_newb_2345: that's amazing, because Clojure 1.0 came out almost 6 years ago
11:47clj_newb_2345sexpGirl : hmm, no, miscalculation, more like 5 years
11:48clj_newb_2345no, not since 2005
11:48sexpGirlclj_newb_2345: :)
11:48clj_newb_2345this is like peopel who need 5 years of Visual Studio 2013 experience
11:49clj_newb_2345scheme families though, I have used for a long time :-)
12:06jonasendnolen: ping
12:07dnolenjonasen: pong
12:07jonasendnolen: do you know what cljs/user.js is all about? https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L678
12:08dnolenjonasen: no idea
12:09jonasendnolen: ok. I get ERROR: JSC_DUPLICATE_INPUT. Duplicate input: cljs/user.js
12:09jonasenwhen running the example https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L747
12:10dnolenjonasen: yeah I don't really know anything about the comments and what they're supposed to verify
12:10jonasenand only for the :whitespace optimization. :simple and :advanced seems to work fine
12:10jonasendnolen: maybe they're just out of date
12:12dnolenjonasen: quite possible, I've never really looked at the comments, at one point I considered deleting them
12:16jonasendnolen: they've helped me understand closure.clj in the past so I've found them valuable.
12:16dnolenjonasen: which why I've left them alone
12:17dnolenjonasen: 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:21jonasencljs/user.js is probably meant to be the cljs version of user.clj. I have no idea how (or if) it works
12:23ToBeReplacedis there a performance difference between using case and using a hash-map ?
12:26creeseI'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:26bbloomToBeReplaced: on the jvm, case should be compiled to a switch statement where possible
12:29ToBeReplacedbloom: i see i wasn't asking a reasonable question; thanks... java searching helped me out
12:53swarthyI'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:56ToBeReplacedswarthy: 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:56ToBeReplacedswarthy: i would just use #(.contains ^String %1 %2)
12:57swarthylooking 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:57swarthythanks for the link
12:57swarthyToBeReplaced: yes I agree, I'll just add it myself it is simple after checking the source
12:57swarthyThanks ToBeReplaced and `cbp`
13:19seangrov`Are there any good textmate integrations with clojure/nrepl?
13:19seangrov`Not finding much
13:46llambdahm 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:57seangrov`llambda: If you find it, please share it
14:01llambdaseangrov`: 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:08coventryWhat's the clojure equivalent of python's locals(), to get a map of the current value assignments?
14:13bbloomcoventry: there is no such (standard) equivalent
14:13bbloomcoventry: 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:14llambdaseangrov`: i think this was it --> http://skillsmatter.com/podcast/open-source-dot-net/keynote-eric-evans
14:15bbloomcoventry: although you can do it statically with the implicit &env argument to macros, but still an impl detail
14:16coventrybbloom: Thanks, I will look into using &env, and look at how the ritz debugger does it.
14:42hrvladevHi, 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:42hrvladevI'm trying to implement Atari's Breakout and later Arkanoid.
14:47lynaghkhrvladev: if you want to work with the DOM instead of a raw pixel graphics context, you can use C2
14:54lynaghkhrvladev: 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:55lynaghkonce 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:55hrvladevlynaghk: 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:55lynaghkhrvladev: Oh! you mean you don't necessarily want to use the browser?
14:55hrvladevYes
14:56lynaghkAh. I can't help you there then =/
14:56hrvladevI don't want to use it.
14:56hrvladevBecause it will be a project for a Clojure course. And using ClojureScript is not preferable.
14:57hrvladevThanks (:
15:25paroxyzm_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:27bbloomparoxyzm_: performance
15:27bbloomparoxyzm_: the last one incurs extra allocations for the sequence
15:28bbloomparoxyzm_: 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:29paroxyzm_bbloom Thank you.
15:38nkozowhat's the most popular clojurescript+clojure validation library ?
15:41callennkozo: http://www.clojure-toolbox.com/
15:41callennkozo: the clojure-toolbox is a good place to check.
15:41dobry-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:42callendobry-den: does the rate need to vary or respond to change over time?
15:42callendobry-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:42dobry-dencallen: I'd like to be able to pause/resume, scrub the progress bar.
15:44callenwell, some kind of iterator fn would make sense then
15:45callenwith it checking some kind of pause/reset booleans or something
15:45dnolendobry-den: I'd probably do it in core.async to eliminate too much state tracking, but I'm biased.
15:46callendnolen: 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:46callenin particular, I'd like to make certain dobry-den's solution is something they can understand holistically before jumping into (def *MAGIC*)
15:48dobry-dencallen: 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:49dnolendobry-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:49callendobry-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:50dobry-dencore.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:51callencore.async or not, I'd still end up writing an iterator fn that processes a vector of chunked content.
15:52callenwhether that involves global state or not is up to taste for something like this.
15:52callenRaynes: do you know why lein prism exits if the first time it's executed, a test fails?
15:56dobry-dendnolen: What feature of clojure.async minimizes state tracking in this situation?
15:56dobry-denFor instance, pausing and resuming an enumeration
15:57dnolendobry-den: you can just represent the entire thing as a process and minimize the amount of externally visible state
15:59dobry-dendnolen: 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:59dnolendobry-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:00dobry-dendnolen: Cool, thanks.
16:02dobry-denSort of like its own little program with it's own little API that my DOM will talk to.
16:03bbloomdobry-den: that's precisely the idea :-)
16:04dnolendobry-den: sketch, http://gist.github.com/swannodette/6330038
16:04clj_newb_2345does anyone here play with Clojure on the Zing VM ?
16:04dnolendobry-den: notice how tiny it is an no global state
16:06dobry-dendnolen: oh, hot. thanks a lot. i'll get crackin
16:07callenoh yeah, that is quite nice.
16:09dnolendobry-den: tweaked, you need a separate chan for the interval control, obviously you can improve what I've written.
16:09tylerwebI'm trying to extend a record in one namespace and use the added function in another namespace
16:10tylerwebwhen im in the other namespace it find find the function
16:10tylerwebcan't find*
16:10tylerwebis there a namespace restriction with extend?
16:11dobry-dendnolen: awesome
16:11bbloomtylerweb: can you provide a minimum reproduction? maybe a multi-file gist. your description isn't clear enough on it's own
16:12tylerwebbbloom: https://www.refheap.com/18007
16:12tylerwebthats the gist of what im trying to do
16:12tylerwebother records with functions defined inline work fine
16:12tylerwebits only the extend thats failing
16:13bbloomtylerweb: you don't show where Storable is defined
16:13bbloomwhat error do you get?
16:13bbloomoh nevermind see that error there
16:14tylerwebbbloom: https://www.refheap.com/18007 updated with storable declaration
16:14tylerwebderp maybe not
16:14bbloomtylerweb: you're not importing storable
16:14bbloomtylerweb: i don't trust your reporduction with the in-ns forms etc
16:14bbloomalso i suspect you may have a stale instance or something from re-defining protocols
16:15tylerwebits a fresh repl
16:15bbloomtylerweb: please try to make a true minimum reproduction w/ realistic file structure, etc. you'll probably solve your own problem that way
16:15tylerwebthe other records use protocols that aren't imported
16:15bbloomit can't be a fresh repl executed in the order you put in that paste. you define the protocol after you use it
16:16bbloomscientific method up in here :-)
16:20tylerwebbbloom: i just uploaded the whole dir to github: https://github.com/tjgillies/futs/tree/master/src/futs
16:20tylerwebshould be easier
16:21bbloomyeash. talk about premature modularization. why so many directories/files/whatever?
16:22tylerwebbbloom: its an experiment in learning protocols and records, its not production code
16:22callenthis.namespace.is.designed.to.induce.rage.lel.lel.lel :refer [die-in-a-fire]
16:22callenmy next library gets a troll namespace.
16:22tylerwebLOL
16:23tylerwebi wanted to separate everything to learn how to set up importing/requiring
16:23bbloomdon't do it how you're doing it
16:23bbloom:-)
16:24tylerwebdo what? my experiment?
16:24bbloomload, load-file, in-ns, etc are 99% for repl use
16:24tylerwebi wouldn't write production code like that
16:24bbloomsure, but you're trying to understand what's going wrong, but you have like 10 files in 4 directories
16:24bbloomyour problem can be simplified down to TWO FILES in a single directory
16:24bbloomthen others will be better able to help you, but you probably will be able to figure it out on your own then :-)
16:25tylerwebright but thats a simple problem, i made it difficult because difficult problems are better for learning
16:26tylerwebit works fine if its all in the same file
16:26bbloomso figure out precisely when it stops working…. minimally
16:26bbloomthis is debugging 101
16:26tylerwebeverything runs, except the save function never gets added to File
16:27tylerwebif i do it from the repl it works
16:27tylerwebmy first question in here was asking if extend had some sort of namespace limitation
16:27bbloom…but you just showed me some exception messages in your paste…. you're not making any sense
16:27tylerwebi showed the exceptions before i declared the extend in the repl
16:27tylerwebif i manually extend from repl it works
16:28tylerwebextend being https://github.com/tjgillies/futs/blob/master/src/futs/records/file.clj#L5
16:29tylerweball the other code works fine
16:30tylerwebmaybe i found a legit bug
16:32coventryYou should put together a minimal test case which demonstrates it, then.
17:03timsgardnerwish there was a reducers form of for
17:07ToBeReplacedquick ANN: https://github.com/ToBeReplaced/lettercase
17:22sos-insectshello
17:59AnderkentAnyone know of a emacs-live (the overtone emacs config) tutorial for complete emacs newbies?
17:59Anderkent(and perhaps, how to bend it to use evil?)
18:00kmicuAnderkent: Is http://overtone.github.io/emacs-live/ not good for you?
18:01kmicuYou can simply add evil config in your custom pack.
18:02kmicuhttps://github.com/siancu/evilmode-pack or use this
18:03Anderkentkmicu: yes, I fetched that
18:03AnderkentI'm looking for a 'how do I really use this' tutorial not the 'how do I install this' tutorial
18:04Anderkentbut I guess if most people grabbing it are alraedy emacs-comfortable, there might not be such a thing
18:04Anderkenthttp://overtone.github.io/emacs-live/doc-shortcuts.html aha, that's a step forward
18:05Anderkentkmicu: thanks for the evilmode-pack, that's helpful!
18:07coventryCould 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:08coventrys/unpack for/unpack for me/
18:09amalloycoventry: i don't think you're right about what ::trace is being used for
18:09amalloyi'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:10amalloythis is without looking at the trace source, just your snippet, so of course i could be missing something
18:10coventryOH! Thanks, that makes a lot of sense.
18:10coventryI should have read trace-var* before asking.
18:12coventryamalloy: You're right, that's what's going on.
18:21callen*=//////23
19:13Anderkentoh, you can splice code into defproject?! Wow. Imma abuse it straight away.
19:19dobry-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:22dobry-denAnderkent: I jumped into Emacs + Evil Mode + Clojure all at the same time just a few months ago if you need help.
19:23dobry-denAnderkent: Here's my workflow. https://news.ycombinator.com/item?id=5870669
19:23dobry-denI realize i've been saying 'a few months ago' for like a year.
19:24Anderkentdobry-den: cool
19:24Anderkentdobry-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:24amalloydobry-den: go can't reach into lambdas
19:24coventrydobry-den: regarding your async question, execution of the go block has finished by the time the js/setInterval callback is called.
19:24dobry-denoh, of course. thanks
19:26Anderkentdobry-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:26dobry-denAnderkent: 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:27dobry-denlemme see
19:27Anderkentno, it is the big bundle with a lot of stuff
19:27Anderkentmade by overtone guys :P
19:27Anderkenti mean I guess 'a lot of' is relative
19:28dobry-denOh, so Emacs Prelude is a similar thing
19:29Anderkenthm. so evil mode breaks paredit for me. Blah.
19:29dobry-denAnderkent: 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:31dobry-denOh, 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:31Anderkent^^ OK
19:31dobry-denLemme see what i have in my .emacs file
19:31dobry-denI certainly use paredit-mode in nrepl
19:33Anderkentdobry-den: if you have something like: (+ 1 2 \n 3 |4), pipe being cursor, and run `dd`, do you lose the closing paren?
19:34dobry-denAnderkent: yeah.
19:34dobry-denThat's how it should be
19:35coventrydobry-den: where does find-file-in-project (mentioned in your HN comment) come from?
19:35Anderkentno, paredit should never let you unbalance your parens
19:35dobry-denAnderkent: Yeah, I can understand that preference. Personally, I like that Evil(Vim) commands are more "raw"/"hard" edits.
19:36dobry-denIn your example, I would opt for paredit's C-k if I wanted to preserve the paren
19:36dobry-dencoventry: package-install find-file-in-project
19:37coventryCool, thanks.
19:38Raynescallen: Not the foggiest. Kyle really did write pretty much all of that.
19:38RaynesI basically just did lolchangethisitssilly.
19:38RaynesAnd pretended to help.
19:39callenRaynes: dammit
19:42dobry-dencoventry: just remember that it will start searching from where ever it finds a .git/.svn/etc
19:43dobry-densometimes i'll be slammin my magical file finding button but realize i never 'git init'
19:44DigitalJackIs anyone here familiar with ztellman's gloss?
19:44ztellmana bit
19:44DigitalJackha
19:44coventrydobry-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:44DigitalJackI'm very confused about specifying a repeated structure
19:45ztellmanwhat are you trying to do?
19:45DigitalJackI'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:46DigitalJackI just can't seem to figure out if that is possible or if I have to write [:byte :byte :byte …. :byte] 50 times
19:47ztellmanor (vec (repeat 50 :byte))?
19:47AnderkentDigitalJack: you want (repeat 50 :byte), not {repeat} :)
19:47DigitalJackso that (vec (repeat 50 :byte)) will be evaluated when I define the frame map?
19:47ztellmanyes
19:48DigitalJackwow, ok.
19:48DigitalJackI'll give that a try… I'm making my own life hard I guess :)
19:48ztellmanarguably '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:53DigitalJackI 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:54DigitalJackThe (vec (repeat 50 :byte)) worked great, ztellman
19:54ztellmanDigitalJack: 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:55ztellmanthat may not be explicitly stated anywhere, though
19:56DigitalJackztellman: alrighty, thanks for the help!
20:05timsgardnerAfter they're realized, do seqs gain constant-time count?
20:19coventryCan nrepl be persuaded to DTRT with M-. on a java class/method?
20:22akhudektimsgardner: no
20:56akurilinI'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:56akurilinBut I'm wondering if there's as better way.
20:56akurilinIdeally 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:58callenakurilin: write a func that passes queries to the jdbc lib...
20:58callenjust wrap the func
20:58akurilinso make my own wrappers that accept the same exact params and call those instead of the libs, right?
20:59callenakurilin: yeap. I think what *I* would do is write a middleware/library that logs queries that hit JDBC.
20:59callenand wrap something deeper in JDBC.
21:00akurilincallen, so that'd involve redefining some of the internal library functions, if I'm understanding correctly?
21:00callenpossibly, unless they offer some kind of DI.
21:01akurilincallen, gotcha, that makes plenty of sense.
21:01callenup to you how fancy you want to be.
21:02akurilincallen, generally speaking there's no need to fork libraries for small weaks, and redefinitions within the library ns should be sufficient, right?
21:02akurilin*tweaks
21:03callenakurilin: uh, sure, but this discussion has added to my todo list.
21:04akurilincallen, what did you realize you needed to do?
21:04callenwrite a query logging library.
21:05glosoliDamn, been switching between VIM, LightTable and Emacs, and all the time I end up loving Emacs more than others lol
21:07muhoothey'll pry emacs from my cold dead ctrl-meta-shift fingers
21:07trish_fsooooooooooooooo
21:08miqlI heare you, glosoli. Been a life-long vimmer and finally transitioning to emacs + evil.
21:08callenglosoli: yissss
21:09akurilincallen, 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:09glosolimiql: 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:09akurilinPretty convenient if you forgot to add a few indexes here and there :)
21:09callenakurilin: that's what I mean.
21:09callenakurilin: rails style query logger.
21:10akurilinYeah. You might need to do a sum of all the time spent in DB somewhere in the middleware.
21:11callendidn't plan on it.
21:11callenbut could.
21:19jasonjcknIs this channel also for clojurescript?
21:19coventryPeople discuss clojurescript here a lot.
21:21jasonjcknI'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:21jasonjcknso 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:23jasonjcknI 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:23jasonjcknI guess that's good enough.
21:37dobry-denakurilin: I wrote the same thing using timbre
21:37dobry-denakurilin: similarly i never made it so far as to figure out how to measure time in db land
22:05akurilindobry-den, got it, sounds like we are all solving the same problems independently here :)
22:06w|thow can i call clojure.lang.Var.invoke(Object...)? or do a suitable replacement?
22:07w|tsince there is no varargs argument in any of the invoke() methods
22:07w|tany way other than to do it manually?
22:17akurilinRandom 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:24s4muelNot quite a text but the first thing that came to mind was http://12factor.net/
22:25cgagthat looks like a nice resource, thanks
22:28akurilins4muel, very interesting, thanks!
22:59cemerickDoes anyone have a defonce macro for clojurescript handy?
23:01swarthyI 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:03kurisumasu(->> (map rest) (reduce concat))?
23:03kurisumasuswarthy, ^
23:04amalloycemerick: does defonce even make sense for cljs? in what context could you use it?
23:04swarthykurisumasu: thank you for helping, which argument is my seq of regex matches? I am very new to clojure.
23:05cemerickamalloy: same as in Clojure: for when you want to reload the same file repeatedly, and not touch any existing value
23:06amalloycemerick: but cljs is compiled once and then run: how would you, in a running cljs app, ever load the same file twice?
23:06amalloyit makes sense in clj-jvm because you can load a file, fiddle with it, load it again...
23:07cemerickamalloy: cljs has a REPL :-) Many, in fact.
23:09kurisumasuswarthy, 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:09kurisumasuswarthy, are you familiar with map and reduce?
23:10swarthykurisumasu: 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:16clj_newb_2345for clojure dev, does emacs24 offer anything useful over emacs23 ?
23:23cemerickthis looks sane: https://gist.github.com/cemerick/6331727
23:23cemerickamalloy: FWIW ^
23:23swarthykurisumasu: 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:23benkayclj_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:24swarthycemerick: I wanted to thank you for your book, I'm a clojure newbie and reading through it now.
23:24clj_newb_2345benkay: I'm about halfway through setting up http://clojure-doc.org/articles/tutorials/emacs.html -- waht is "emacs live" ?
23:24cemerickswarthy: Glad you're enjoying it. Say hi to the other authors too if you see them. :-)
23:24benkayclj_newb_2345: https://github.com/overtone/emacs-live
23:25swarthycemerick: Will do, your name happens to be the easiest to I.D. in the chat and I remember you from the Relevance podcast.
23:26benkayclj_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:27kurisumasuswarthy, that's basically `flatten`, except that it only flattens a single level :)
23:29cgagemacs24 has it's own package manager which is pretty sweet
23:29swarthykurisumasu: 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:34kurisumasuswarthy, it's easier to learn these things with a fresh mind, I guess :)
23:37callenEmacs was never an issue for me because I started with it early and always had a config that "accreted" over time.
23:38callenI've started using the package management in a limited fashion, I don't know that I'll fully convert anytime soon though.
23:39bjacallen: I found the opposite. I was absolutely glacial trying to learn both emacs and clojure at the same time.
23:41benkay#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:41swarthybja: I agree, for the time being I'm using Light Table, and supplementing Vim + fireplace.vim
23:41benkayswarthy bja emacs live y'all
23:42RaynesOr just… you know, emacs.
23:42swarthybenkay: 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:43benkayRaynes: i kept hearing that from experienced Emacs users, and then ricocheting off the default Emacs setup.
23:43callenI suspect people were a lot more willing to learn new tools 20 and 30 years ago.
23:43bjaevil mode seemed okay for me, I was just haven't adjusted to buffers opening at random on me
23:43callenThese 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:43Raynesswarthy: evil-mode is pretty darn good.
23:43seangrov`benkay: Curious about emacs live - does it do anything worthwhile for non-overtone work?
23:44callenseangrov`: it has a shake-n-bake clojure-mode/nrepl.el, but that's far from difficult to setup.
23:44swarthyYes 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:44benkayseangrov`: 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:44swarthyLight Table was the fastest way to achieve that at the moment.
23:44callen(setq package-list '(clojure-mode nrepl)) (dolist (package package-list) (package-install package))
23:44swarthyBut emacs is a nice editor.
23:44callenit's not hard people.
23:45callenseangrov`: I've git cloned my dotfiles onto other peoples' computers to get them up and running with Emacs + Clojure.
23:46seangrov`callen: Ah, I misunderstood emacs live, I thought it was about live-coding a la lighttable (but in emacs)
23:46callenseangrov`: it's nothing special, just has good marketing.
23:47bjaI 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:48bjait 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:54callenbja: if you figure out something better than slime/swank or ritz/nrepl, please let me know.
23:54callenbja: there's always debug-repl and limit-break, but they're both limited to locals.
23:54callenbut they're nicer to use than ritz.
23:54benkayhttp://hugoduncan.org/ritz-conj/
23:54bjacallen: yeah. it looks like you can use vim-redl and call its break/continue stuff
23:54bjawhich seems like an upgrade over debug-repl
23:55bjastill not ideal though
23:56cgagah i didn't realize that existed, i was planning on trying to write something like debug-repl soon
23:56callencgag: always ask first :)