#clojure logs

2013-07-26

00:05TimMc...which it does, right?
00:09callenTimMc: the whole point of bcrypt is to produce hashes from values such that the relationship cannot be precomputed.
00:10TimMcAre you saying that bcrypt(A) sometimes produces B and sometimes produces not-B?
00:11callen...yes
00:11mmarczykbcrypt uses a random salt which is included in the output
00:12mmarczykalong with the work factor (how many iterations of an expensive procedure to use)
00:12Raynesbcrypt would be an amazing thing if it didn't, let me tell you.
00:12mmarczykthen to verify it extracts salt, work factor and the actual hashed password
00:13mmarczykthe (plaintext, salt, work-factor) -> hashed output relationship is deterministic, of course
00:14TimMcOh, sure.
00:14alexgunnarsonHey everyone! So… i'm looking to develop a write-once-deploy-anywhere Clojure app. I'm looking for a general direction to go in in terms of the platform. Clojure+JavaFx+Java+JVM, Clojure+Flex+Flash, ClojureScript+HTML+CSS… all of them are great but they have their own individual pros and cons. The JVM is fast and has amazing, mature, well-documented libraries. But, from what I've seen, it doesn't run on iOS or Android excep
00:14alexgunnarsonwith hacks (at least, not yet - waiting on Oracle there). Flash has great functionality and graphics, which Java only does moderately well by comparison, but Flash Player is proprietary and has terrible performance. And finally, HTML5 is supposed to be the future, but the spec's not even completed (2020, anyone?), it lacks key functionalities, it doesn't have uniform behavior across platforms and browsers, and it's not as
00:14alexgunnarsonperformance-geared as, for instance, the JVM. Thoughts?
00:14callenalexgunnarson: jesus dude.
00:14alexgunnarson:D
00:14akaha
00:14callenalexgunnarson: just use Luminus.
00:16alexgunnarsoncallen: thanks for the suggestion. i'll look into that. what advantages does it have?
00:16callenalexgunnarson: I'm not here to play mixologist. If you want to make a web app with Clojure, just use Luminus.
00:16callenadvantages - uhmmm, it won't fuck you around and will force you to just make your app instead of jacking off to acronyms.
00:17Rayneslol
00:17akathat should be it's official motto
00:18alexgunnarsonyeah post that on the homepage
00:18callenI think yog is too professional for that.
00:18Raynesalexgunnarson: What callen is trying to say is that you're spending far too much time trying to find the best thing ever when you'd likely be better served by just doing what you want to do.
00:19alexgunnarsonRaynes: if i "just did what i wanted to do" i'd be stuck with actionscript and flash and my app would be dead at some point
00:19RaynesThen don't use flash.
00:19callenalexgunnarson: do you want to make a web app in clojure or not?
00:19RaynesFlash isn't even supported on iOS.
00:19RaynesSo I don't know how using flash would help you anyways if that's a goal.
00:20alexgunnarsonRaynes: not in the browser but in AIR it is
00:20RaynesAIR isn't supported in Linux.
00:20RaynesAnd is a piece of shit regardless.
00:20callenAIR is garbage.
00:20RaynesWhen it was supported, everyone hated it.
00:20alexgunnarsoni know… anything that uses flash player is terrible
00:20RaynesWell, that's not what I was saying.
00:20akaalexgunnarson: it is literally impossible to write software that runs everywhere and perfoms ideally on all platforms
00:21RaynesI enjoy flash games from time to time.
00:21callenRaynes: tower defense yo.
00:21alexgunnarsonme too!
00:21RaynesYou're just overthinking thing.
00:21callenso can we get back to the Clojure?
00:21futilecallen: hey callen im working on some ObjC right now
00:21alexgunnarsonaka: the JVM comes close and hopefully oracle will push it onto mobile platforms but we're still holding our breath on that
00:21callenfutile: I don't care.
00:21alexgunnarsonhahaha
00:21futilecallen: you told me to say so!
00:22akahow is oracle going to push it to iOS?
00:22callenno I didn't.
00:22callenfutile: in general, please don't talk to me unprompted.
00:22callenfutile: I don't like ignoring people, but I don't like *wanting* to /ignore them either.
00:22alexgunnarsonaka: they almost did back in like february or something i can't remember the date
00:22futilecallen: stop talking about yourself
00:22callenfutile: I'm talking about you.
00:22futileyou're doing it again
00:22RaynesWe really need moderators in here.
00:22alexgunnarsonaka: they announced that it would happen but they never really carried their plans out
00:23callenRaynes: 4rlz.
00:23Raynescallen is too hostile, futile is too dumb.
00:23RaynesThat combination is pretty deadly.
00:23futileill fix it
00:23callenthank god
00:23RaynesWas it something I said? :\
00:23alexgunnarsonyeah let's get some admin privileges in here
00:23callenproblem is, he'll come back in 5 minutes then talk about how terrible of a person he is.
00:23callenRaynes: he does like that like every other day, don't take it personally.
00:24Raynescallen: Suggestion though: ignore him. You don't have to /ignore him. It's easy: you don't respond to what he says.
00:24RaynesI don't ignore anybody at all and I get by just fine.
00:24callenhe takes over the channel too often
00:24RaynesAnd trust me, I hate people too.
00:24callenhaha, fair enough :)
00:24akaalexgunnarson: how would they implement that? there is still going to be a disconnect from the native sdk
00:25RaynesGood news is that the language is popular enough now that this happens, callen.
00:25RaynesHigh schoolish fights and such.
00:25callenthere's always an impedance mismatch between a generic toolkit and native. It's inescapable.
00:25alexgunnarsonaka: hold on let me get the article
00:25callenRaynes: we need local dictators/warlords/ircops to police though.
00:25akaanyways, alexgunnarson, you want to build a mobile app or a web app?
00:25RaynesAll three!
00:25callenRaynes: god willing.
00:26callenRaynes: also, do you use Xmonad?
00:26Raynescallen: I was responding to aka, but sure. :p
00:26alexgunnarsonhttp://java.dzone.com/articles/oracle-gets-java-running-ios
00:26callenoh, woops.
00:26Raynescallen: I use OS X.
00:26RaynesI used xmonad ages ago when I still used linux.
00:26alexgunnarson"Oracle ADF Mobile uses a native container that runs applications on both iOS and Android from a single source base. One part of that native container is a headless/lightweight JVM."
00:26callenYourKit and jvisualvm don't seem to work with xmonad.
00:26callenThis...deeply upsets me.
00:26poggioI'm using xmonad right now
00:26callenalexgunnarson: that doesn't change what I said.
00:26callenalexgunnarson: the impedance mismatch is in your code.
00:26callenalexgunnarson: not in the tools you're using.
00:26alexgunnarsonalthough i suppose the "headless/lightweight JVM" might not support clojure…
00:27alexgunnarsoncallen: you have a point
00:27callenalexgunnarson: at best you could IFDEF and write specific platform code for each
00:27callenalexgunnarson: but then you're back to the days of C and C++
00:27alexgunnarsonwhich would be terrible
00:27callenalexgunnarson: there is no "one platform to rule them all, and in the darkness bind them"
00:27alexgunnarsonwell okay for specific tasks
00:27callenwell, it produced nice user experiences, even if it wasn't easy to work with as a developer.
00:27alexgunnarsonwhich makes me sad, because i always loved LOTR :D
00:27callenalexgunnarson: why don't you tell us what you want to do?
00:27RaynesI booted into windows to play DmC: Devil May Cry callen. Why is this channel more entertaining than that game?
00:27alexgunnarsoncallen: very true
00:28callenRaynes: because I'm here, knocking heads.
00:28callenRaynes: why are you playing the bastard child DMC game?
00:28RaynesI've played all the others and not this one...
00:28alexgunnarsoncallen: i want to basically make a clojure OS that runs on the JVM
00:29Rayneso_o
00:29callenalexgunnarson: no.
00:29alexgunnarsonhaha
00:29RaynesIf you want to invent an operating system, you probably shouldn't worry about interoperablity with... operating systems.
00:29callenprobably shouldn't use a language that requires a VM host *and* an OS host.
00:29alexgunnarsonwell it's a virtual OS
00:30RaynesSo it's emacs?
00:30Raynes~rimshot
00:30clojurebotBadum, *tish*
00:30callenRaynes isn't kidding though. lisp OS in a bucket.
00:30samratcallen: I think `export _JAVA_AWT_WM_NONREPARENTING=1` before running jvisualvm fixes it.
00:30alexgunnarsonhmm. true. emacs haha
00:30callensamrat: I'll have to try that with yourkit as well. Thank you!
00:31poggioyou may want to check this out as well, I needed to add it to my xmonad.hs http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html
00:33ToBeReplacedemacs hackers in terminal mode -- do you just use C-<right> and ilk for paredit instead of C-) ?
00:36karvusI do, but only because I'm in terminal mode seldom enough that I don't care enough to come up with a reasonable, alternative scheme.
00:40ToBeReplacedthanks
01:09alexgunnarsonit seems like everyone's dead…
01:09alexgunnarsonhey so how about concurrent, functional UIs? anyone seen this?: http://augustl.com/blog/2013/truly_concurrent_user_interfaces/
01:10alexgunnarsonit's a project called concui
01:13vilonisI'm having trouble finding standard library documentation for clojure (even a list of all the modules), anyone know of a good source?
01:14noidivilonis, http://clojure.github.io/clojure/
01:15vilonisah, I wasn't sure if that was it
01:16noidiyou can find usage examples etc. on http://clojuredocs.org/
01:16brehautout of date examples
01:16brehautclojuredocs.org is only current up to 1.3; 1.5.x the latest release
01:19noidiI don't think there have been many backwards-incompatible changes
01:19noidiit may be missing stuff but I doubt that many of the examples are wrong
01:21futileis callen gone yet?
01:21futilei love the clojure community, including the irc community. they're all such nice people.
01:22zRecursivesure
01:22zRecursiveClojure makes interested in Java again
01:22zRecursivemakes me
01:23futile*you're all
01:23futilethats why im shocked callen hasnt been banned by now
01:26SegFaultAXI just got +b from #python for talking about dependency injection. :/
01:26SegFaultAXI knew they hated Java but shit.
01:27SegFaultAXJust explaining what it is to someone is enough to get +b
01:28futileSegFaultAX: that cant possibly be why
01:29futileSegFaultAX: theres nothing wrong with that as a concept, its perfectly legit and useful
01:30SegFaultAXfutile: Read the scrollback.
01:30futileSegFaultAX: the dependency injection part?
01:30noidiyou're pretty much doing dependency injection when you work with higher-order functions :P
01:31futileheh
01:31futilenever thought of it that way
01:31futilenot sure its right
01:31noidime neither :)
01:32SegFaultAXfutile: You'll see that right before I was +b, I was suggesting reading Martin Fowler.
01:32noidiI think there are some parallels with dependency injection if you're calling e.g. merge-with or sorted-map-by
01:33mthvedtas an enterprise java refugee, let me say a major reason for DI is composable execution contexts
01:33futileSegFaultAX: heh
01:33mthvedtthis is huge when you have 1 million lines of bad java code expected to run in 50 places
01:34mthvedtwith each module being a moving part
01:34SegFaultAXmthvedt: That and being able to swap out components for eg testing.
01:34dpathakjdoes anyone know an easy way to inspect a Clojure function's enclosing scope at runtime? e.g. suppose I do (defn incrementer [n] (fn [i] (+ i n))). is there a way to take (incrementer 5) and no other arguments, and return 5?
01:34SegFaultAXIntegration testing without DI in Java is extremely painful.
01:34futileyea
01:34futilein ruby too
01:34SegFaultAXfutile: Well in Ruby you can literally modify anything at runtime
01:35SegFaultAXIncluding the root objects that dominate the entire object tree.
01:35futilethats what makes it so painful
01:35mischovHas anybody else been having problems with Carmine not wanting to let a macro be build around wcar as shown in the github docs?
01:35SegFaultAXKernel, Module, Object, BasicObject, etc.
01:35futileyeah
01:35futileyou can just delete Kernel iirc
01:35futilethat was fun
01:35SegFaultAXI don't think you can undef Kernel, but maybe.
01:35dpathakj(besides the obvious (- ((incrementer 5) 0) 0)… i'm wondering more about a reflection-type solution.
01:37dpathakjthe closest thing i've found is clojure.repl/source, but that doesn't do what i'm thinking of.
01:37futileSegFaultAX: i remember using python before ruby and thinking how dumb it was that i could modify my own classes but not String or Object.
01:37SegFaultAXYou mean str or object I assume.
01:37futileyep
01:37futilebeen too long
01:40mthvedtsegfaultax: right, but that's a subset of setting up execution contexts.
01:40SegFaultAXmthvedt: I suppose that's true. Good point.
01:41mthvedtif/when big companies start writing millions of lines of bad clojure code, i wager clojure DI will become a lot more popular
01:42noidi,(require 'clojure.reflect)
01:42clojurebotnil
01:42SegFaultAXmthvedt: stuartsierra's blog post about his workflow is basically DI.
01:42noidi,(reflect (let [foo 10] (fn [] foo)))
01:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reflect in this context, compiling:(NO_SOURCE_PATH:0:0)>
01:42noidi,(clojure.reflect/reflect (let [foo 10] (fn [] foo)))
01:42clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: sandbox$eval84$fn__85>
01:43noididpathakj, oh well, for me that returns a map containing #clojure.reflect.Field{:name foo, :type long, :declaring-class user$eval171$fn__172, :flags #{}
01:43SegFaultAXnoidi: I think it's disabled by clojail.
01:44noididpathakj, presumably you can then use something like https://github.com/arohner/clj-wallhack to get the field's value
01:46futile,(let [list [:foo :bar "baz" :quux :yay], [a [b & c]] (split-with (complement string?) list)] [a b c])
01:46clojurebot[(:foo :bar) "baz" (:quux :yay)]
01:47dpathakjnoidi: cool. could be interesting. thanks.
01:51dpathakj(luckily I don't have a specific use case other than the toy problem I mentioned; this is more a matter of exploration…)
01:56zRecursive,(Math/sqrt 10000000000)
01:56clojurebot100000.0
02:09futile,(into {} (zipmap [1 2 3] [:a :b :c]))
02:09clojurebot{3 :c, 2 :b, 1 :a}
02:12SegFaultAXfutile: Why?
02:12futilewhat SegFaultAX?
02:12SegFaultAX,(zipmap [1 2 3] [:a :b :c])
02:12clojurebot{3 :c, 2 :b, 1 :a}
02:24futileSegFaultAX: cuz i wanted to make a map from keys/vals
02:24futile,(map identity [1 2 3] [:a :b :c])
02:24clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity>
02:24futile,(map vector [1 2 3] '[a b c])
02:24clojurebot([1 a] [2 b] [3 c])
02:26futile,(map #(hash-map :a %1 :b %2) [1 2 3] '[a b c])
02:26clojurebot({:a 1, :b a} {:a 2, :b b} {:a 3, :b c})
02:26futileis there a nicer way of doing that?
02:26futile,(map #(hash-map :a %1 :b %2) [1 2 3] '[4 5 6])
02:26clojurebot({:a 1, :b 4} {:a 2, :b 5} {:a 3, :b 6})
02:35cespare|homeWhen I start lein repl, it says it started nREPL on some port but it doesn't create target/. Isn't it supposed to?
02:35cespare|home(nobody is responding on #leiningen)
02:35callenSegFaultAX: best reason to get banned I've ever heard.
02:39futilecespare|home: i dont think target/ has anything to do with the port nrepl connects on.
02:39futilei think target is just a temporary place to put compiled files
02:39cespare|homeHow does e.g. vim-fireplace know what port to listen on?
02:40cespare|homeby what I'm reading it looks for target/repl-port
02:53SegFaultAXcespare|home: What port to listen on?
02:54SegFaultAXcespare|home: Fireplace connects to nrepl.
02:55RaynesSegFaultAX: Yes. Over a port.
02:55RaynesWhich it has to get from leiningen.
02:55RaynesAnd cannot get from Leiningen magically.
02:55RaynesIt requires a file, just like cespare|home said.
02:55Raynescespare|home: In any case, you can make it connect by using :Connect nrepl://localhost:<port> (it will autocomplete the first parts if you hit tab a couple of times).
02:56SegFaultAXRaynes: Does fireplace open a port? Maybe I misunderstood.
02:57RaynesSegFaultAX: If there is no port file, it gives up and creates a repl itself and then everything you evaluate takes 10 seconds to evaluate.
02:58SegFaultAXRaynes: Orly?
02:58RaynesIt's better to connect to a running lein repl instance, which it can do if there is a port file there or if you use :Connect.
02:58RaynesNo, I'm just kidding.
02:58SegFaultAXHeh
02:58SegFaultAXI didn't know that.
02:58SegFaultAXThanks for the clarification.
02:59SegFaultAXI've never actually had fireplace spin up its own repl. I've /always/ connected to an already running one.
02:59RaynesIf you go to a project that doesn't have a repl running and do cqc, it'll work.
03:01SegFaultAXRaynes: Does it spin up a new one everytime you evaluate something or does it persist across the rest of your session?
03:01futile(inc clojure)
03:01lazybot⇒ 14
03:01futileonly 14?
03:01futile$karma clojure
03:01lazybotclojure has karma 14.
03:01futile$karma amalloy
03:01lazybotamalloy has karma 67.
03:02futilethats not right.
03:02RaynesSegFaultAX: I thought it persisted across your session, but given that it takes about a month to evaluate anything I expect I'm wrong.
03:02Raynes(identity futile)
03:02lazybotfutile has karma 2.
03:02futile,(dotimes [i 10] (inc clojure))
03:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: clojure in this context, compiling:(NO_SOURCE_PATH:0:0)>
03:02futileaww
03:02zRecursive(identity zRecursive)
03:02lazybotzRecursive has karma 0.
03:02SegFaultAXfutile: Wrong bot.
03:02RaynesAnd it isn't actual code anyways.
03:02RaynesIt's just parsing it to be clever.
03:02futile,(dotimes [i 10] (println "(inc clojure)"))
03:02clojurebot(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n(inc clojure)\n
03:03RaynesThat wouldn't work either.
03:03futiledidnt help.
03:03Rayneslazybot ignores clojurebot.
03:03futileawwww
03:03zRecursive:-D
03:03zRecursivekarma 0
03:03futile(+ clojure 1000) ;; just make this work plz Raynes
03:03noidi,(list? '(1 2 3))
03:03clojurebottrue
03:03noidi,(list? `(1 2 3))
03:03clojurebotfalse
03:04futile,(seq? '(1 2 3))
03:04clojurebottrue
03:04futile,(seq? `(1 2 3))
03:04clojurebottrue
03:04futileneat
03:04noidithat bug took me quite a while to find...
03:04SegFaultAX,`(1 2 3)
03:04clojurebot(1 2 3)
03:04futilenoidi: ow
03:04noidi,(class `(1 2 3))
03:04clojurebotclojure.lang.Cons
03:04futilehmm, 2am. not good.
03:05zRecursive,(def song (ref #{}))
03:05clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
03:05Raynes&`(1 2 3)
03:05lazybot⇒ (1 2 3)
03:05futile&(inc clojure)
03:05lazybotjava.lang.RuntimeException: Unable to resolve symbol: clojure in this context
03:05futile&(inc 'clojure)
03:05lazybotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number
03:05futile:D
03:05RaynesThat's interesting.
03:05futile&'(inc clojure)
03:05lazybot⇒ (inc clojure)
03:05Raynes&(type `(1 2 3))
03:05lazybot⇒ clojure.lang.Cons
03:05futileRaynes: yeah, make it a built-in function.
03:06Raynes&(type '(1 2 3))
03:06lazybot⇒ clojure.lang.PersistentList
03:06zRecursive,(eval &'(inc clojure))
03:06clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
03:06RaynesI guess that'd do it, noidi.
03:07futile,((juxt type class) `(1 2 3))
03:07clojurebot[clojure.lang.Cons clojure.lang.Cons]
03:07futile,(= type class)
03:07clojurebotfalse
03:07futileoh
03:07zRecursive,(type type)
03:07clojurebotclojure.core$type
03:08zRecursive,(type class)
03:08clojurebotclojure.core$class
03:08futile,(doc type)
03:08clojurebot"([x]); Returns the :type metadata of x, or its Class if none"
03:08futile,(doc class)
03:08clojurebot"([x]); Returns the Class of x"
03:08RaynesYou guys can get a repl by typing 'lein repl', by the way.
03:08futileah
03:08futilebut we're experisharilearning
03:08RaynesLook at all the people leaving because of you.
03:09zRecursiveRaynes: can we message bot ?
03:09Raynes(leave guys, they need to think you're bothering them)
03:09RaynesSee!
03:09RayneszRecursive: Yes.
03:09futile(:O
03:09callenzRecursive: no, the bot broke IRC
03:09zRecursiveRaynes: which bots to use ?
03:09callenzRecursive: the bot is a magical special case of IRC
03:09RaynesEither bots to use.
03:10zRecursivelazybot and clojurebot is same ?
03:10futilebedtime
03:10RaynesNot the same.
03:10RaynesThey're completely different bots.
03:10zRecursivethen message to who ?
03:11RaynesEither oen.
03:11Raynesone*
03:11zRecursivewhy not one bot as lambdabot in #haskell ?
03:13callenzRecursive: 'murica.
03:13RaynesBecause it's entirely legal to write IRC bots and some people enjoy doing it.
03:13RaynesThis isn't a democracy, we don't vote for bot president.
03:13SegFaultAXI for one... blah blah overlords.
03:14zRecursivesee
03:14metellusa bot election
03:14Rayneslazybot supports abortion.
03:14metellusthat would be.
03:14RaynesJust a heads up.
03:14callenRaynes: post-natal abortion of people that abuse bots in public channels?
03:15Raynes~rimshot
03:15clojurebotBadum, *tish*
03:47cespare|homeIs there a way to get the repl to automatically reload my project code when the file changes?
03:47cespare|home(I'm using lein repl if that matters)
03:49AtKaaZhi, was there a function that would return true if all items in collection would satisfy some passed function? ie. testfor(fun, [1,2,3,4]) where fun would test for equality let's say so if 1==2 then 2==3 then 3==4 then return true, else false; or something like that
03:49SegFaultAX,(every? even? [2 4 6])
03:49clojurebottrue
03:50AtKaaZdoes it work for equals?
03:50AtKaaZlike 2==4==6 ?
03:50Chousukeyou can apply =
03:50Chousuke,(apply = [1 1 1])
03:50clojurebottrue
03:50AtKaaZoh yes that makes sense
03:50AtKaaZso it's like (= 1 1 1)
03:51SegFaultAXAtKaaZ: Yes.
03:51AtKaaZbut suppose you don't have = that can take more than 2 params
03:51Chousukeyou can reduce
03:51AtKaaZso you can only do (= 1 1) or (fun 1 1)
03:51SegFaultAX,(every? #(= 1 %) [1 2 3])
03:51clojurebotfalse
03:51SegFaultAX,(every? #(= 1 %) [1 1 1])
03:51clojurebottrue
03:51Chousukethough reduce won't be lazy
03:52AtKaaZok but I want that 1 inside the function to be the first element from the list
03:52AtKaaZie. not hardcoded
03:52AtKaaZok more like fun should take two params
03:52SegFaultAXAtKaaZ: What are you implementing? RLE?
03:52ChousukeAtKaaZ: just take it from the list then :P
03:52AtKaaZ(something? #(= %1 %2) [1 1 1])
03:52AtKaaZno, I am just trying to remember the name of a clojure function which already does this
03:53hyPiRion,(let [[f & r] [1 2 3]] (every? #{f} r))
03:53clojurebotfalse
03:53AtKaaZ(cause i think there's one?)
03:53SegFaultAXAtKaaZ: Checking if every element = the first element is the same as applying =
03:53AtKaaZwasn't there some justone function though?
03:54AtKaaZSegFaultAX: you may be right, but I think I worded it wrongly
03:54SegFaultAXAtKaaZ: Tell us what you really want, then.
03:54AtKaaZwhat I want is something like this (something? #(= %1 %2) [1 1 1]) where %1 and %2 is previous and next(or current) element
03:54AtKaaZfrom that list
03:55AtKaaZlike comparing elements I think
03:55SegFaultAXHow is that different from apply =. You're just doing it pair-wise.
03:55amalloy&(partition 2 1 [1 2 3])
03:55lazybot⇒ ((1 2) (2 3))
03:55amalloySegFaultAX: he's asking for functions in general, not = in particular
03:56SegFaultAXHe specifically asked for equals.
03:56AtKaaZ,(sort #(> %1 %2) [1 3 2 9 -1])
03:56clojurebot(9 3 2 1 -1)
03:56hyPiRion,(->> [1 2 3 4] (partition 2 1) (every? (fn [[a b]] (== (inc a) b))))
03:56clojurebottrue
03:56amalloyequals was the example he gave
03:56AtKaaZgrr I think it's sort lol
03:56SegFaultAX,(sort-by > [1 2 3 4])
03:56clojurebot(1 2 3 4)
03:56SegFaultAX,(sort-by < [1 2 3 4])
03:56clojurebot(1 2 3 4)
03:56AtKaaZyes that one, thanks guys! sorry for my poor expressive skills
03:56SegFaultAXWhat am I doing, haha.
03:57hyPiRionwat
03:57SegFaultAXAtKaaZ: You were looking for sort-by?
03:57hyPiRionsort is not taking the previous and next(or current) element
03:57AtKaaZfor sort I think, why did your sort-by give the same results?
03:58AtKaaZoh ?
03:58AtKaaZwait actually it's not sort, because it returns a list xD
03:58AtKaaZand i want it to return true or false depending on what function returns when taking elements by 2
03:58hyPiRion,(sort-by :foo > [{:foo 1} {:foo 2} {:foo -5}])
03:58clojurebot({:foo 2} {:foo 1} {:foo -5})
03:59hyPiRionwhen taking elements by 2 -> elaborate
03:59AtKaaZ(somefn? #(> %1 %2) [1 2 3 4 5]) returns true but (somefn? #(> %1 %2) [1 2 3 5 4 6 7]) returns false
03:59SegFaultAX,(sort-by identity > (range 10))
03:59clojurebot(9 8 7 6 5 ...)
03:59SegFaultAXI forgot keyfn was first that's all.
03:59cespare|homeAtKaaZ: hyPiRion already gave you your answer
04:00AtKaaZcespare|home, where? I missed it
04:00cespare|homeyou can use partition to get the pairs of two, and then use every?
04:00hyPiRion,(->> [1 2 3 4] (partition 2 1) (every? (fn [[a b]] (== (inc a) b))))
04:00clojurebottrue
04:00AtKaaZah, but wasn't there just one function?
04:00hyPiRion^
04:00SegFaultAXAtKaaZ: Wrap it in a defn and it will be.
04:00hyPiRionjust one function?
04:00AtKaaZI mean, some idiomatic function that does it
04:00SegFaultAXAtKaaZ: Do you mean something in clojure.core?
04:01AtKaaZ(somefn? #(= %1 %2) [1 2 3 4 5]) returns false; and (somefn? #(= %1 %2) [1 1 1 1 1]) returns true;
04:01amalloyAtKaaZ: there is no single pre-built function that does the six things you are asking for
04:01AtKaaZsomefn? aka one function :)
04:01amalloyyou will have to build one
04:01AtKaaZlol
04:01cespare|homeAtKaaZ: you can do it with a complicated reduce, i think.
04:02SegFaultAXAtKaaZ: You keep using =, but is your actual use case just for general functions?
04:02AtKaaZyes SegFaultAX
04:03SegFaultAXAtKaaZ: Then you have your answer.
04:03AtKaaZok thank you :(
04:03hyPiRionAtKaaZ: you can spin it off in another way
04:04cespare|home,(reduce = (map #(apply = %) (partition 2 1 [1 2 3 4])))
04:04clojurebotfalse
04:04cespare|homeAtKaaZ: ^^ another way.
04:04hyPiRion,(let [foo [1 2 3 4]] (->> (map #(= %1 (inc %2)) foo (rest foo)) (every? true?)))
04:04clojurebotfalse
04:05AtKaaZ:) but still I failed to find that one function, so either I am remembering wrongly(likely the case but sad) or I am unable to find that one function
04:05SegFaultAXIf it's acceptable to process the entire list maybe.
04:05SegFaultAXAtKaaZ: What difference does it make? Why does it need to be from clojure.core?
04:06amalloycespare|home: what on earth is that function supposed to do?
04:06AtKaaZSegFaultAX: it's because i wanted to know the name of that function xD to see if other langs have it
04:06cespare|homeamalloy: which function?
04:06cespare|homeoh oops.
04:06amalloythe one you just offered. it seems to return true if either all the elements are the same or they are all pairwise different
04:07AtKaaZamalloy: assert thatfun(testfn, a,b,c,d,e) where thatfun applies testfn to a and b then to b and c etc...
04:07AtKaaZso my use case was for = but still
04:07cespare|home,(every? true? (map #(apply = %) (partition 2 1 [1 1 1 2])))
04:07clojurebotfalse
04:08cespare|homeamalloy: ^^ is what I meant
04:08SegFaultAXYour use case is for =... we answered that 10 minutes ago.
04:08amalloycespare|home: but like hyPiRion and SegFaultAX have already said, that's just a bad way to write (apply = [1 1 1 2]))
04:08cespare|homeis there an easier way to do (every? true? ...)?
04:08AtKaaZSegFaultAX, was it with apply = ?
04:08cespare|homeSegFaultAX: false, you can put any other function instead of =
04:08hyPiRioncespare|home: reduce =
04:09cespare|homehyPiRion: not the same
04:09hyPiRioncespare|home: reduce = true
04:09hyPiRion,(reduce = true [false])
04:09clojurebotfalse
04:09hyPiRion,(reduce = true [])
04:09clojurebottrue
04:09cespare|homeok, that's more characters though
04:09hyPiRionit's obviously not easier though
04:10SegFaultAX,(reduce = true [false false])
04:10clojurebottrue
04:10SegFaultAXSo no.
04:10cespare|homeruby has all?, i was hoping for the same.
04:10SegFaultAX,(reduce = true [true false false])
04:10clojurebottrue
04:10SegFaultAX^ that was amalloy's point
04:11hyPiRionyeah, bugger.
04:11SegFaultAXcespare|home: That's what every? is, but more general.
04:11hyPiRionapply = true it is then
04:11SegFaultAXcespare|home: You could do (every? identity ...) and that's the same.
04:12SegFaultAXcespare|home: To match ruby's impl, we don't care that they all equal exactly true... only true in a boolean context ("truthy")
04:13SegFaultAXWhich for clj is anything other than nil and false.
04:13AtKaaZ,(and true true false)
04:13clojurebotfalse
04:13cespare|homeSegFaultAX: right, it would be convenient if, if you didn't specify a pred, it used a default check for truthiness
04:14cespare|homehaha, 'and' would indeed do that heh.
04:14hyPiRionconvenient sure, but it wouldn't increase your productivity by some factor.
04:14SegFaultAXcespare|home: Doubtful. How often are you really checking if every item is not nil or false?
04:14cespare|homeuh, in the context where it just came up?
04:14cespare|homewhere I know each item is true or false?
04:14SegFaultAXcespare|home: But AtKaaZ's case is after applying a predicate function :)
04:15AtKaaZyeah, I remember it could take a function
04:15SegFaultAXcespare|home: So why have (every? (map pred L))?
04:15hyPiRion(every? true? ...) is more evident than (every? ...) though.
04:15AtKaaZand it would apply it to each element, however I don't remember if it would need an extra element to apply it to first one like (fn 0 firstelem)
04:15SegFaultAXhyPiRion: If you only care about /actually true/, right.
04:16cespare|homeSegFaultAX: ah this is true.
04:16SegFaultAXcespare|home: (every? pred L) is clearly cleaner and more general.
04:16hyPiRionSegFaultAX: Sure. And if not, do (not-any? #{nil false} ...) instead
04:17SegFaultAXcespare|home: In ruby, you most often apply all? with a block anyway.
04:17SegFaultAX[1,2,3].all? { |e| e % 2 == 0 }
04:17hyPiRion(every? even? [1 2 3])
04:18hyPiRionsee, you're using pred the same way really
04:18AtKaaZmaybe it was like this: (thefn pred 0 [1,2,3,4,5]) and it would apply (pred 0 1) and if true continues, apply (pred 1 2) ... so on until false then return false
04:18SegFaultAXhyPiRion: Exactly.
04:18cespare|homeSegFaultAX: yes i saw your point, which is why i agreed with you.
04:19SegFaultAXRuby's iterator protocol is pretty neat. Implement 1 method (#each) and you can mixin Enumerable to get a bunch of stuff for free.
04:20cespare|homelol, took me forever. Does this work then? (defn atkaaz [f s] (every? #(apply f %) (partition 2 1 s)))
04:20cespare|home(atkaaz = [1 1 1 1]) -> true
04:20cespare|home(this is literally my first day writing clojure btw)
04:20AtKaaZcool then, seems to do the job :)
04:20AtKaaZ(I don't really know clojure though, as if that's not obvious haha)
04:20SegFaultAXYou could have a second clause that takes n, the size of the slice to use.
04:21cespare|home(atkaaz < [1 2 3 4]) -> true
04:21AtKaaZSegFaultAX, i'm glad i found functional ruby aka elixir :)
04:22SegFaultAX,((fn atkaaz ([f s] (atkaaz 2 f s)) ([n f s] (every? #(apply f %) (partition n 1 s)))) = [1 1 1 1])
04:22clojurebottrue
04:22SegFaultAX,((fn atkaaz ([f s] (atkaaz 2 f s)) ([n f s] (every? #(apply f %) (partition n 1 s)))) 3 = [1 1 1 1])
04:22clojurebottrue
04:22SegFaultAXNot a good test case, but yea.
04:23AtKaaZalmost hurts my head trying to understand it lol
04:31AtKaaZalmost like map-indexed except it doesn't pass the index but the previous element heh
04:32AtKaaZalmost like reduce... hmm maybe I remember reduce wrongly
04:49AtKaaZoh man, I really think I remembered reduce wrongly(maybe also combined it with every? in my head and saw it as 1 function), and that's the one function that I thought did what I expected, sad so sad but must accept it: I was wrong
04:57Guest__how do i put the contents of a vector into a map? i use (into {} (partition 2 [1 2 3 4])).
04:58Guest__what am i doing wrong here?
04:58Guest__thanks. :)
05:00hyPiRion,(conj {} '(1 2)) ; no work
05:00clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
05:00hyPiRion,(conj {} [1 2]) ; works
05:00clojurebot{1 2}
05:00hyPiRionBut even better, use ##(apply hash-map [1 2 3 4])
05:00lazybot⇒ {1 2, 3 4}
05:00Guest__hyPiRion thanks!
05:03ucbbeat me to it
05:04ucb:)
05:41ddellacostais there a way to ensure I'm using the === operator in ClojureScript?
05:42ddellacostaah, from looking at source, looks like I use "=="
07:05mmarczykddellacosta: identical? actually
07:06mmarczykddellacosta: unless dealing with numbers, in which case it's indeed ==
07:07ddellacostammarczyk: thanks!
07:07mmarczyknp
09:12stuartsierraAn experiment: clojure.walk reimplemented with protocols https://github.com/stuartsierra/clojure.walk2
10:02dsapalaDoes anyone here know why I might get "Entity used in relationship does not exist" in Korma when I "defentity" in a function? I'm doing a "declare" before the function to make sure they're "def"'d.
10:05dsapalaI'm trying to use Stuart Sierra's approach to clojure workflow (http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded) and this is the only thing I haven't been able to overcome yet.
11:01futilewhat's the point of interning clojure symbols if it always creates a new one?
11:02gfredericks,(identical? (symbol "foo") (symbol "foo"))
11:02clojurebotfalse
11:03gfredericksfutile: you might be referring to a different thing?
11:03futilepossibly the same thing
11:03gfrederickswhat interning are you talking about?
11:03futilegfredericks: https://groups.google.com/forum/#!topic/clojure/crmUDnGIVCg
11:04futile,(Symbol/intern. "foo")
11:04clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: Symbol, compiling:(NO_SOURCE_PATH:0:0)>
11:04futile,(clojure.lang.Symbol/intern. "foo")
11:04clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: intern., compiling:(NO_SOURCE_PATH:0:0)>
11:04futile,(clojure.lang.Symbol/intern "foo")
11:04clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
11:04futilethat one
11:05gfredericksfutile: I don't know for sure but I think the point here is to avoid duplicating the String objects
11:05futileok
11:05gfrederickssymbols themselves can't be interned simply (like keywords can) because of metadata
11:05futileoh right
11:06gfredericksor conversely, keywords can't have metadata so that they can be interned simply :)
11:29futile$mail brehaut btw hopefully this gets rid of the confusion: https://github.com/sdegutis/zephyros
11:29lazybotMessage saved.
12:03mbarbierihi, midje question: I have a data structure (map with keywords as keys and lists of lists as values) and I want to test some functions I wrote to get values from it, but I don't want to use the actual structure, because it could change.
12:04mbarbieriif this is my data: (def mydata {:blah [[1 2 3] [4 5 6]]} I thought I could substitute it with a test version of it, using (let [mydata my-test-date] …tests…) but it doesn't work
12:06futilembarbieri: I've been solving that issue by considering the data structure opaque, and writing functions that return everything I need to know about it, in a way that's not determined by the original data structure.
12:06futilembarbieri: if the data structures have to change, then only those functions that access it have to change, nothing else in my program does, since those functions will always return the data in the same structure
12:07astevedoes anyone have examples on parsing dates?
12:08asteveI'd like to take a string in the format YYYYmmdd and create a java.util.Date object from it
12:08asteveI'm not sure if that's the clojure way
12:08futile,(.parse (SimpleDatFormat. "yyyy") "1985")
12:08clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: SimpleDatFormat, compiling:(NO_SOURCE_PATH:0:0)>
12:09futile,(.parse (java.text.SimpleDateFormat. "yyyy") "1985")
12:09clojurebot#inst "1985-01-01T00:00:00.000-00:00"
12:09futilere asteve
12:09mbarbierifutile: it's what I'm doing, I had this data structure, and now it changed, so I'm trying to write some function to access it and keep the data structure opaque, my question was about testing it with midje
12:10futilembarbieri: well it doesnt matter what lib you use to test it, you'd do it the same way: have functions that create this opaque data structure for you, rather than creating it yourself.
12:10futilembarbieri: in fact id argue midje encourages the bad practice of re-binding functions to return data structures you created in the test, which you shouldnt do anyway
12:11futileit just causes fragility problems
12:12mbarbierifutile: ok now I get it: have functions that create the data structure. Noted. Thanks!
12:13futilembarbieri: yeah, let the data structure be *entirely* encapsulated in your src/ file, dont let test/ files know anything about it
12:19mbarbierifutile: *entirely* is a dynamically binded var right? :)
12:20futile#<Unbound Unbound: #'mbarbieri/*entirely*>
12:31g06|inwhy doesn't this work -- (.printf System/out "!") ?
12:36ToxicFrogg06|in: interesting. System/out is a java.io.PrintStream, which has two printf methods, printf(Locale, String, Object...) and printf(String, Object...)
12:36gfrederickshaving java varargs means you need to pass an array
12:36ToxicFrogSomething like (.printf System/out "!" nil) works
12:36ToxicFrogAah
12:36gfredericks(.printf System/out "!" (into-array []))
12:36gfredericksalso works
12:36g06|inthanks!
12:36gfredericksg06|in: note clojure.core/format
12:36gfredericksin case that's what you really want
12:38scgilardior clojure.core/printf
12:38gfredericksoh right
12:38gfredericksof course :)
12:38g06|inthanks!!
12:46redderhsHi, the link in this message is in regards to an Open Source Computing to further the developments of hardware for the mobile industry. It's time for Linux to be the #1 Consumer Operating System, Ubuntu Edge movement! http://pastebin.com/j57Dc29E We can all make a difference for as little as One Dollar! Thank You for your time.
12:56akathere are commercials in this channel?
12:56gfredericksnot welcomed, no
12:59aka:)
13:09winkdamn ubuntu zealots
13:35callenwhat a bastard.
13:50futilejust wrote a book proposal and realized i already own a book that has exactly the same chapters, and i just never opened it before.
13:51callenfutile: do you have a facebook or twitter account?
13:54seangroveUhg, NPE when running cljsbuild test. Incredibly frustrating
13:57wei_poll: which clojurescript data binding library do you use? cljs-binding, purnam, something else?
13:58futilecallen: no
13:58futilecallen: why?
13:58seangrovewei_: Please update us on the poll results when they're in ;)
13:59callenfutile: it's a good outlet for random thoughts like that
13:59callenfutile: you should try 'em.
13:59futilecallen: oh. didnt realize i was doing irc wrong.
13:59futileit was about Clojure, does that make it relevant?
14:00callenfutile: try to think in terms of the utility others might derive from it.
14:00callenfutile: you couldn't tell you were talking about Clojure, or what book you were talking about
14:00wei_seangrove: will do, if there's enough responses!
14:00callenfutile: you speak for your own benefit and it's obvious.
14:00futilecallen: oh i see.
14:01futileyou're just a prick. a total prick.
14:01futilewell i think maybe we'd be better off if you were banned.
14:01futilecallen: you make this channel horrible to be in.
14:01futileor rather, you're horrible to be around.
14:01justin_smithlook who's talking
14:02callenI'll get some gauze and ointment for that burn. back in a flash.
14:02callen(inc justin_smith)
14:02lazybot⇒ 4
14:13ToBeReplacedwill mapply or something like it make its way into clojure core?
14:15bbloomToBeReplaced: monad apply?
14:15bbloomToBeReplaced: i don't foresee any kind of monad stuff making it into core any time soon
14:15ToBeReplaced,mapply?
14:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mapply? in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:15bbloomeven if it was of interest, it's always best to assume core won't change fast enough for your needs
14:15ToBeReplacedhm...i thought there was a clojurebot thing for mapply
14:16bbloom~mapply
14:16clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
14:16bbloomooooh that kind of mapply
14:16pgr0ssdoes anyone know how to test a compojure app that uses cemerick/friend? i can't find a way to setup a fake session that bypasses the authentication
14:18ToBeReplacedbbloom: yeah i seem to use it a fair amount
14:18pgr0ssi tried grabbing the value of :session from a real requst, and then assoc'ing it (request :post "/url_behind_auth" :session saved-session) but friend still seems to think the request is unauthenticated
14:19bbloomToBeReplaced: i haven't felt the need, or maybe i just think about it differently. curious: what do you use it for?
14:19justin_smithpgr0ss: what about conditionally bypassing the friend code by wrapping the handler in a conditional?
14:20justin_smithsomething like (if (= (System/getProperty "debug") "true") (handler request) (handler (friend request)))
14:21ToBeReplacedoptional keyword arguments -- i was about to open source a lib to connect clojure.java.jdbc specs to c3p0, and realized i would prefer to use it there
14:21ToBeReplacedie (pool db :max-statements 10), or (pool db)
14:22pgr0ssjustin_smith: I suppose I could, but then I can't test that some routes require auth, some don't
14:22pgr0ssjustin_smith: also, what about code that relies on the current logged in user?
14:22justin_smithpgr0ss: yeah, that would be an issue, I don't know enough about friend to know how to best handle that
14:22bbloomToBeReplaced: ah. i try to avoid optional keyword arguments like that or provide an alternative "plumbing" function that takes a normal map
14:23justin_smithpgr0ss though you could manufacture a request map that is sure to be denied if auth is required, and succeed otherwise
14:23ToBeReplacedbbloom: my default is to expose the unrolled version, and use the collected version internally
14:23justin_smithpgr0ss: and similarly, you could manufacture a map with the user data when you bypass friend
14:23bbloomToBeReplaced: hm, yeah those sorts of optional kw args seem to only really be useful for "porcelain" commands that will be used at the repl
14:23bbloombut even then, i tend to prefer maps
14:23pgr0ssjustin_smith: yeah, that's what i'm trying to do - i can't seem to get a request map that satisfies friend authentication
14:24justin_smithpgr0ss: this is how I unit test web apps with session / auth at least
14:24justin_smiththat is why I suggested optionally turning the auth off
14:24ToBeReplacedbbloom: you would rather pack up connection pool options? my reason for not is that typically you wouldn't be calling this with a configuration from somewhere else
14:25ToxicFrogbbloom: why (apply concat (butlast args) (last args)) rather than (apply concat args)?
14:25justin_smithie. manufacture the session friend would return for testing code needing user in session, and then verify that friend doesn't let you in when not bypassing it on the right routes, that covers the two cases you mentioned
14:25bbloomToxicFrog: i find that the map versions are much easier to work with and don't mind the extra two chars in general :-)
14:25bbloomnot the least of which, is the need for something like that mapply function
14:26ToxicFrogbbloom: not the question I'm asking.
14:26pgr0ssjustin_smith: got it; yeah, maybe i'll go down this route if i can't seem to figure out how to test with friend dirctly
14:26bbloomToxicFrog: (last args) is assumed to be a map
14:26ToxicFrogAah
14:26bbloomsorry, that previous message was for ToBeReplaced
14:27justin_smithpgr0ss: the way I generally test controllers is to mock up the request as it hits the controller
14:27justin_smithsince my controllers are less stable than my request handler (generally)
14:27ToBeReplacedToxicFrog: the last argument is assumed to be a map, so concat flattens it out
14:28justin_smithand then I test each handler fn in isolation, if it tests well, it should compose properly
14:28ToxicFrogbbloom: so the result basically ends up as [arg1 arg2 .. argn [k1 v1] [k2 v2] [k3 v3]]
14:28ToxicFrog?
14:28bbloomToxicFrog: the idea is to call a function like (f arg1 arg2 :kwarg1 1 :kwarg 2) like this: (mapply f arg1 arg2 {:kwarg1 :kwarg 2})
14:29bbloomer, only with a correctly typed map: {:kwarg1 1 :kwarg2 2}
14:30ToBeReplacedbbloom: i'm wondering whether if map were available, the unrolled version would be more widely used
14:30ToBeReplaced*mapply
14:31RaynesWhich Haskell web framework is trying the least to be rails?
14:31ToBeReplacedit's in the library coding standards, and is practical i think
14:32RaynesThat sounds like something totally non confrontational to put on twitter!
14:32hexaHi all , I'm been juggling around a little problem , say I want to create a map based on multiple functions returning keys and taking the same argument list ... would using comp and having the result be like [result-map argument-list] be a good idea or I'm missing a simpler way... ? (I'm building multiple parts of web page)
14:33troydlHowdy, quick question if I may: Is there a function to spit out a range of letters the way (range 0 5) works for numbers?
14:33bbloomToxicFrog: *shrug*
14:33Raynes<smug>sounds like you want a monad, hexa</smug?
14:33justin_smithhexa: juxt?
14:33ToxicFrogbbloom: ?
14:33Raynes>
14:33Rayneshexa: juxt is probably what you want, but it's hard to tell unless we saw what the code takes and returns for real.
14:33bbloomToxicFrog: dunno if it would see more use or what the best decision is. i was just curious about your need for it. thanks for explaining
14:34justin_smithhexa: if the functions should all receive the same args, and you don't want laziness, juxt is a perfect match
14:34ToxicFrogbbloom: what need for it? I'm confused
14:34hexaLooks like this : https://www.refheap.com/16937
14:34hexachecking juxt :)
14:34bbloomToxicFrog: gah, sorry
14:34bbloomToBeReplaced: that was for you again ^^
14:34bbloomToxicFrog: you're a victim of my two-characters-then-tab expansion strategy that my fingers have memorized
14:35ToxicFrogtroydl: (->> (range (int \a) (int \z)) (map char)) ?
14:35hexaRight juxt is it thx!
14:35justin_smithhexa: in that code, should test-map1 and test-map2 see the same args or different?
14:35justin_smithif they should see the same args, yeah juxt
14:35Raynesbbloom: Whenever Raynos talks after me, people start exploding into flames because their clients usually prefer tab completion for whoever talked last.
14:35ToxicFrog,(->> (range (int \a) (int \k)) (map char))
14:35clojurebot(\a \b \c \d \e ...)
14:36RaynesIt's quite entertaining.
14:36hexajustin_smith, same args
14:36bbloomRaynes: damn irc clients need fuzzy completion or CamelHumpsOrSomething
14:36Raynessnaplets make no sense.
14:36bgilberttroydl: I've used this before: (def all-chars
14:36bgilbert (map char (range 97 123)))
14:37bgilbert,(take 10 (map char (range 97 123)))
14:37clojurebot(\a \b \c \d \e ...)
14:37justin_smith,(char 96) ; is jealous to not be considered a char
14:37clojurebot\`
14:38troydlThanks guys. Neocons didn't like dealing with numbers as keywords. I ended up doing (map keyword (repeatedly 3 gensym)) which seems to have worked out.
14:38antares_troydl: Neo4j does not like dealing with numbers as keywords, so does Neocons
14:38troydlRight
14:40justin_smithneocons huh, someone should make a sbcl backend for clojure and call it newleft (sbcl - steel - stalin getitlol)
14:40Raynescallen: Oh callen, look at you hiding in the twitters.
14:41troydljustin_smith: Lol, yeah the name neocons makes for some interesting google results when I have problems
14:41callenRaynes: Scotty.
14:41Raynescallen: Have you played with snap at all?
14:41justin_smith*2g1c
14:41justin_smiththat is
14:42Raynescallen: Is it just me, or do snaplets sound absolutely batshit bloody insane. It's like "Hey, don't use libraries, write this weird ass special thing for our web framework cuz cool!"
14:42callenRaynes: it's a combinatorial framework
14:42callenRaynes: I avoided it like the plague.
14:42RaynesIt's like the antithesis of all things that are good in functional languages.
14:42callenbeyond using some lower level tooling
14:42callenRaynes: I mean, you're describing a lot of Haskell in general.
14:42callen"COOL SHIT JUST CUZZZZZ"
14:42RaynesI just don't get why it's all so terrible.
14:43RaynesYesod is a monstrous nuclear disaster zone with the worst dependency tree I've ever seen and so many template Haskell hacks that I'm not sure the language still qualifies as Haskell when you write it.
14:43callenThat's why Yesod gets its own book.
14:43callennot for making web apps, just for explaining/apologizing for Yesod.
14:44RaynesI feel mean for saying all this, but goodness.
14:44callenRaynes: I don't think Haskellers have ever had a notion of making a thing that does things.
14:44justin_smithI dunno if the amount of haskell discussion on this channel should make me glad we are keeping up with the joneses or make me jealously wonder if they are talking about clojure on #haskell
14:44callenat least the Scala people get work done in-between hacking on scalaz and making periodic table of operator libraries.
14:45Raynescallen: And now I'm sad because the homepage for Scotty is a .edu page.
14:45callenRaynes: it's the best way to make a web app in Haskell I've found. Sorry :)
14:45callenjustin_smith: they don't talk about Clojure in #haskell because they're too busy ENDOFUNCTOR MONOID HILBERT SPACE
14:45RaynesI wonder if anyone has written actual websites in snap or yesod. Like. ones humans can look and interact with.
14:46justin_smithI think there are mathematical jargon spaces that are compact enough that a markov chain could hold its own for a while
14:46callenRaynes: lots of Haskeller blogs.
14:46callenRaynes: also I just checked the FPComplete Yesod tutorial
14:47callenthe *first* line of the *first* example is the following: {-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-}
14:47callen^^ lol.
14:47Rayneslol
14:47callensecond line? import Yesod
14:47Raynescallen: Also, the reason I was looking at this stuff is because I want to do a website with a friend, but he doesn't really want to do it in Clojure but we both want to do it in something reasonably interesting and Haskell seemed like a reasonable option at first since we're both kinda into it.
14:48callenRaynes: do it in Elixir.
14:48RaynesBut, I feel like my apartment will slowly sink into a basement and all light will be seeped out of my life if I try to do this in Haskell.
14:48callenRaynes: Elixir+Dynamo
14:48callenpractical, fun, interesting.
14:48callen(Dynamo in this case refers to the elixir cowboy wrapper, not the data store)
14:48RaynesI can't really do anything in Elixir because of… I guess OCD issues related to how terrible Erlang ports are and how nobody cares enough to fix them.
14:49RaynesWhich to be fair includes me because I do not intend to dig into the Erlang C code.
14:49ToxicFrogRaynes: do it in Scala~
14:49callenRaynes: Chicago Boss is Elixir compatible and doesn't require digging around in too much Erlang.
14:49RaynesHe already does Scala.
14:49callenRaynes: I really think you're not giving Elixir and Chicago Boss a fair shake here.
14:49AdeonI know someone who made his blog in sed
14:49Raynescallen: Because if I decide I need to shell out then I'm screwed and that bothers me.
14:50RaynesI can't really get over it.
14:50RaynesIf Erlang ports stop sucking, I'll be a big Elixir guy again.
14:50callenRaynes: that bad? ow.
14:50callenI know ports suck, but damn.
14:50callenRaynes: Racket? Common Lisp?
14:51RaynesI can't talk to something on stdin, close it, and then read from stdout. When I mentioned this in #erlang, I got responded with "Well, I don't know of any languages that can do that." to which I o_o'd out and explained very politely how that was incorrect.
14:51ToxicFrogwait what
14:52callenRaynes: OCaml?
14:52RaynesRacket isn't a terrible idea.
14:52RaynesI mean, this particular project won't require any shelling out (at least, not that I can foresee) so Elixir would be a fine option.
14:53Raynescallen, ToxicFrog: https://www.refheap.com/13920 I wrote this ages ago and showed it to Erlangers and they were like RETWEET RETWEET OMG but shit, no way I'm messing with this C insanity to fix it.
14:53Raynes:p
14:53callenRaynes: Common Lisp + Clack + Caveman is cool.
14:55callenRacket doesn't have a very serious/good web stack though
14:55callenCL's is more mature
14:56Raynescallen: https://github.com/mattsta/erlang-stdinout-pool This is the result of the Erlang port issues.
14:56callenthis is why I just write Clojure and thereby not suffer unnecessary problems.
14:56callenI'd still really like the ability to produce self-contained binaries that start and die quickly
14:57Raynescallen: I never actually figured out how to report this as an actual issue to Erlang though.
14:57RaynesThey have like 12 different mailing lists for issues and 'proposals' and all this nonsense.
14:57callenRaynes: they're a political hive in emulation of their VM process model.
14:57Raynescallen: I asked in #erlang what the best way to report the bug would be, they said to not bother unless I'm going to fix it as well.
14:57callenLOL
14:58RaynesAt which point I gave up entirely and just started complaining to everyone who would listen instead.
15:03callenRaynes: these sorts of problems are also why Python is still my default glue language, to my eternal chagrin.
15:03RaynesHeck, I might write the site in Python just for shits and giggles.
15:03RaynesAt least you can actually do things with it. *shrug*.
15:04callenRaynes: if you write in Python then I could probably answer any questions off the top of my head limitlessly.
15:05callenRaynes: not to mention being able to recommend some pimp-ass libraries.
15:05seangrovemonocle
15:05seangroveVery dapper o_
15:05callenseangrove: no.
15:06seangroveI've been thinking about monocle compared to core.async a bit recently
15:06callenasync in Python is dumb.
15:07callenTwisted is the purest form of Pythonic evil I've ever seen.
15:07seangrovecallen: Async in every language seems to be pretty unpleasant overall
15:07seangroveAnd yes, twisted is an amazing achievement
15:07callen"amazing"
15:07seangroveProbably should have put amazing in quotes, yes
15:07callenseangrove: not really.
15:08callenhttp-kit is quite pleasant.
15:08callenlacks thread affinity, otherwise quite nice.
15:08seangroveHrm, I used the http-kit client in a small test project, really didn't care for it
15:08seangroveConsuming twitter's streaming api with it was unpleasant
15:09callenI've not had occasion to use the client, I've only used it server-side.
15:09callenand for that, it's very nice.
15:09seangroveBut I haven't thought hard enough if that's fixable through a bit of client design, or if it's a language-level issue
15:09seangroveIt looks very solid though
15:12callenasync has been done well before
15:13seangroveWhere? Really curious to see different approaches to make it easier to reason about
15:13seangroveAhk, but I have ot catch the bus
15:13seangroveWill ask again in a bit
15:17futileanyone have experience with HTTP 30? codes?
15:18callenI gotta say, 30 is a new one for me.
15:19callenwhen did they start doing 2-digit HTTP status codes?
15:19bbloomsounds like somebody fat-fingered a 301 or 203
15:19bbloomer 302, i'm apparently number dyslexic
15:19futileand i thought 30* would not be so clear as 30?
15:19bbloomand/or have fat fingers
15:19futileffs
15:20upwardindexIs this the idiomatic way to get an element deep inside maps: (reduce get {:a {:b {:c {:d 4}}}} [:a :b :c :d]) ?
15:20bbloomupwardindex: get-in
15:20futileupwardindex: get-in
15:20upwardindexThank you both!
15:21ystaelI'm clearly missing something fundamental about dynamic vars; can someone explain? https://www.refheap.com/16938
15:21bbloomystael: they interact badly with laziness
15:21bbloomchange map to mapv
15:21bbloomor (doall (map ...))
15:21ystael*facepalm* of course. thank you very much!
15:21ystaeli had completely forgotten about that part
15:22ztellmanI'm not sure "of course" is the right reaction to that
15:22yedi_callen: you google "user authentification in clojure" and friend comes up
15:22yedi_but you're right, i should roll my own
15:23ystaelztellman: in the sense of "i'm pretty sure i saw a post last month where somebody else ran into this, but i forgot" :)
15:24ztellmanystael: fair enough, but no one will ever convince me that's an intuitive interaction between clojure primitives
15:25ystaelztellman: the evidence proves there can be no argument from me :D
15:26gfredericksztellman: is this a "clojure should be different" objection or a "it's hard to write a useful language that isn't complicated" lament?
15:27ztellmangfredericks: I suppose lazy-seqs could close over the thread-local context on creation, but that would cause a host of other problems
15:27ztellmanso the latter, I guess
15:28gfredericksk just curious :)
15:28muhoo_here's a stupid exception-handling question: is there any less ugly way than this to print the INPUTS to a function if a postcondition fails? https://www.refheap.com/16939
15:28gfredericksI don't actually know of any problems with the former approach, unless perf is an issue
15:28muhooi tried dire, it doesn't seem to have any way to showwhat args exactly broke the thing.
15:29ztellmangfredericks: it lets thread-local data escape the local context
15:29ztellmancan cause resource leaks of all kinds
15:29muhooalso {:post [()]} just throws an exception, doesn't tell me what exactly was the incorrect args going in to the function
15:29gfredericksztellman: oh I guess that could be weird
15:30gfredericksmuhoo: for debugging I normally do an alter-var-root
15:30gfredericksmuhoo: easy to make general helpers that use that approach
15:30gfredericksrather than changing a function itself
15:30muhoogfredericks: any examples out there of that technique?
15:31gfredericks(alter-var-root #'foo (fn [f] (fn [& args] (or (apply f args) (throw (ex-info "" {:poop! args}))))))
15:32muhoothanks. actually i'm pretty sure dire use alter-var-root under the hood.
15:33muhooi'm hoping to put stuff in place for production to make the exceptions more helpful.
15:33gfredericksI've been noodling the idea of logging helpers that let you declaratively add interesting logging in an aspect-oriented style
15:33muhooan exception that doesn't show what args caused the error is pretty useless to me. i'm dealing with massive amounts of unpredictable data inputs; anything can break things and i'm playing whack-a-mole
15:34callenmuhoo: this is pretty standard enterprise style logging
15:34PuercoPopis there something like * from the cl repl in clojure?
15:34callenfn + args + exception, sometimes with full trace.
15:37muhoogfredericks: well thanks, the above is a lot cleaner than the (if-let [res (stuff)] res (throw ...)) approach
15:37`cbpPuercoPop: *1, *2, *3
15:39callengfredericks: I've been considering the same thing!
15:39callendefn-traced, defn-logged, etc
15:41gfrederickscallen: oh mine would be alter-var-root style helpers to put after the functions
15:41gfredericksand combined with a logging lib that uses data rather than strings
15:41muhoodire is pretty awesome. it seems an alter-var-root that prints the input args if the postcondition fails would be a good addition to it
15:42muhooi've used the erlang-style "supervise" functions of dire with good results
15:42PuercoPop`cbp: thanks
15:42callengfredericks: sounds solid.
15:44PuercoPopis there a way to do partial aplication in a way I bind the second and third params but not the first?
15:46llasramPuercoPop: Just use an anonymous function: #(some-function % arg1 arg2)
15:46PuercoPopthanks
15:48ivan&(((fn [f y z] #(f % y z)) - 5 6) 13)
15:48lazybot⇒ 2
16:00tbaldridgellasram: but...but...I want all my code to be point free!
16:00ivanand running on a point-free CPU
16:01bbloomtbaldridge: looking at the state monad inside core.async, i couldn't help but think "oh man, this would be awesome for some concatenative action"
16:02tbaldridgeinteresting...I've had a passing intrest in Forth in the past. How would this be done in a concatenative language?
16:02bblooma "state monad" in a concatenative programming are just functions which take a state from the stack & then leave it modified back on the stack when done
16:03bbloomgive it a try with https://github.com/brandonbloom/factjor :-)
16:03bbloomsomethingg like (cat/run {:the "state"} (foo 1) (bar 2 3))
16:03bbloomwhere foo and bar have stack effects [state x -- state*] and [state x y -- state*]
16:05bbloomi discovered that variadic functions don't make for clean interop, sadly. i've been toying with the idea of a version of clojure core which defines all arity overload as syntax rules over fixed arity functions. but you'd also need multi-valued returns
16:06bbloomhttps://github.com/brandonbloom/domscript/blob/master/src/domscript/cat.clj
16:06bbloomtbaldridge: ^^ that's a good example of the "jquery monad" basically
16:08bbloombut in the case of your state monad, you have essentially stacks of bindings, which you can implement as dynamic variables
16:09bbloomfactor calls them "namespaces": http://docs.factorcode.org/content/article-namespaces.html
16:09bbloomunfortunately, factor's primary data structures are all mutable, so you can't really do speculative execution, but that's not an inherent limitation
16:12tbaldridgebbloom: the one problem I see is that a language like this assumes that that your execution model is...well..stack based. Sometimes I need to create a block reference it in every other operation
16:13bbloomtbaldridge: you can mix and match
16:13tbaldridgebbloom: It seems like you'd end up with something like coding JVM bytecode by hand. Simple ops, almost impossible to understand for more complex code.
16:13bbloomFactor is sorta "extremist programming" to see how far they can push the idea
16:13bbloombut the answer is "surprisingly far"
16:14bbloomtbaldridge: factor supports lexical variables with full closure semantics: http://docs.factorcode.org/content/article-locals-examples.html
16:14bbloomso you can do whatever you need to do in the style that is most appropriate
16:15bbloompersonally, i think the applicative style is a better default, but that doesn't mean the concatenative style isn't super useful
16:15bbloombasically every time you reach for ->, you're programming concatenatively in a very limited way
16:15tbaldridgeagreed.
16:16bbloomtbaldridge: while i've got you here. SSA questions....
16:17tbaldridgeyes
16:17bbloomi know that core.async's SSA is very limited to it's particular use case
16:17bbloombut would it make sense to do an SSA -> JVM or JS backend?
16:17bbloomor are the lambda-calculus-ish clojure primitives a better match for the underlying hosts?
16:19tbaldridgeNo, I'd prefer to target JVM bytecode. It was simpler the way I implemented it, but targeting bytecode would give you access to the JVM jump bytecodes which would (most likely) dramatically improve performance in some cases
16:20bbloomsorry, No to which question?
16:20tbaldridgeas it stands, the blocks are put into a big switch statement, so doing state transitions means you have to bounce out of the switch and back in to the next block. With bytecodes you could just jump right to the target location.
16:20tbaldridgeare sexprs better....no
16:20tbaldridgethey're simpler that's all.
16:20bbloomok, that's what i thought
16:21bbloomi'm wondering if it would make sense to define a dynamically typed SSA language that had good backends for JVM ByteCode & JavaScript
16:21bbloomie so that more of the compiler front ends can be recycled
16:22tbaldridgeI've been thinking about that as well. I'd like to see that happen at some point, but it's a fair amount of work.
16:24bbloomoh yeah, big project for sure
16:24tbaldridgeI was hoping the GSOC CinC project would do something like this but they seem to be going down the route of writing yet another Clojure analyzer.
16:24bbloom:-/
16:26bbloomi tried to find if anybody was doing SSA->JS & i saw some mention of Dart, but i couldn't find that in the codebase
16:26bbloomsince i figured SSA->JVM was a no brainer
16:26bbloombut i realized that you're doing SSA back to CLJ, which is probably close enough to SSA->CLJ
16:26bbloomer i mean close enough to SSA->JS
16:28tbaldridgea few days ago I implemented a CLJ->SSA->Cython "translator". It was a fun experiment, but the output was so different from "normal" python that it actually ran slower than interpreted bytecode
16:28bbloomheh cool
16:39futilehey so has anyone figured out how to get rid of clojure's s-exps?
16:40justin_smithwhy would you want to?
16:40futilei think the only thing left to solve is how to disambiguate between a value or a fn call with no args
16:40bbloomwe have a solution to that… they are called parenthesis…
16:40gfredericksthis comes up every few months
16:40futilei know, im reading old threads, thats how i found this topic
16:40gfredericksthere was even an april fools language devoted to it
16:41gfredericksthe name of which escapes me
16:41justin_smithoh, yeah, I almost chuckled out loud at that one
16:41mthvedtgfredericks: squarejure?
16:41futilei dont care for it myself, i like parens. im just wondering if theres any news on its progress
16:41mthvedtno, that's wrong
16:41gfredericksoh nevermind
16:41gfredericksthat was about swapping square brackets and parens
16:41mthvedtclochure
16:42gfredericksfutile: I don't think anybody expects progress
16:42gfredericksany "solution" you come up with is bound to be much more complicated and problematic than whatever "problems" are associated with the normal syntax
16:42malynhttps://github.com/one-more-minute/clarity (although I don't actually want to use that :)
16:42callenRaynes: http://www.stephendiehl.com/posts/haskell_web.html
16:42RaynesI saw that.
16:42callendamn
16:42RaynesMade me want to punch a kitten.
16:43callenRaynes: "javascript code generation" KITTY_SCARED.JPG
16:43Raynes"LOOK. HERE'S A TRIVIAL USELESS EXAMPLE THAT IS SIMPLE. HASKELL IS EASY. WEB DEV IN HASKELL IS EASY SEE"
16:43callenRaynes: "disk-backed key-value store that only works in Haskell"
16:43DeranderI was incredibly amused by that intro example
16:44gfredericksmalyn: hah is that just a macro that uses :column metadata?
16:44Derandermy first thought: "wtf is forM_"
16:44RaynesI know what forM_ is. Still think it's all silly.
16:45arrdemmalyn: wat no
16:45malyngfredericks: Not sure how it works. At first it sounded interesting, but any non-trivial example started making me uncomfortable.
16:45malyn("interesting" in a theoretical sense)
16:46gfredericksI wonder how it handle double-open-parens
16:47Raynescallen: I've been contemplating offering money for the first person to submit a pull request to fix the port issues I've had.
16:47RaynesIt'd be a fun social experiment.
16:47Raynessubmit and get accepted, of course.
16:48callenRaynes: gittip is neat, but I'd still really like to see a github-aware bounty system.
16:48callenor just a bounty system in general that actually works and lets people pitch in if they want it to happen too.
16:50callenRaynes: is there such a thing? An escrow/bounty system for OSS?
16:50RaynesI saw something recently.
16:51Raynescallen: http://coderbounty.com/ here is one thing.
16:52callenRaynes: looks so horrendously ghetto.
16:52ToBeReplacedjust in case anyone is interested -- created two mini libraries i've had to use in lots of places: https://github.com/ToBeReplaced/jdbc-pool https://github.com/ToBeReplaced/mapply
16:53callenToBeReplaced: ...you are aware of bonecp right?
16:53futileToBeReplaced: ive heard bone cp is better
16:53Raynescallen: What's amusing is that it wants you to link to a github issue but oh look you can't open issues on otp, only pull requests.
16:53callenRaynes: I was thinking of something more generic.
16:54Raynescallen: Because apparently you aren't supposed to send issues without patches or some shit.
16:54futile~mapply
16:54clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
16:54ToBeReplacedi've heard yeah -- just not currently used in my work environment
16:55ToBeReplacedmaybe should have named it jdbc-c3p0-pool ... probably would have been better... should have asked first
16:55callenToBeReplaced: well there are existing c3p0 libs for clojure too :P
16:55futileoh, mapply is neat
16:56futilealthough i think a better solution is just write fns that take an optional map at the end
16:56ToBeReplacedthe pooling we use internally is all down-and-dirty, so i'm not one to understand diff between either lib
16:56ToBeReplacedcallen: links? quick google didn't show
16:57ToBeReplacedi also didn't want to do anything other than provide a thin wrapper for easy setup into a org.clojure/java.jdbc specification
16:58Derander~mapply
16:58clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
16:58ToBeReplacedfutile: i think it depends -- use cases for both for sure
16:58futileToBeReplaced: i like that answer a lot
16:58futileits not the fanboyish all-or-nothing approach of some idiots.
16:58futile:)
17:04callennot duplicating effort is valuable and reduces clojars noise.
17:10ToBeReplacedcallen: what is that in reference to?
17:12callenI don't think it needs a prompt.
17:13bbloomcallen: do you have a twitter account?
17:14callenbbloom: I feel like this is a setup for something.
17:14callenbbloom: I do.
17:14bbloomcallen: not a few hours ago you were giving futile shit for saying something without context. now you're doing it.
17:14justin_smithI swear #clojure is turning into an epistolary novel with all the subtle intregues and indirect insults
17:15callenbbloom: it was in reference to the conversation about the connection pooling libraries.
17:15callenbbloom: I said it didn't need a prompt, I didn't say it didn't have one.
17:15callenbbloom: there are more valid reasons to harangue me than this. Find them and then raise cane with me.
17:15rattboiraise cain
17:16futilehey guys
17:16futileremember how we all love Clojure?
17:16futilelets agree that Clojure is pretty great, yeah?
17:16rattboiClojure is awesome
17:16futile(inc rattboi)
17:16lazybot⇒ 1
17:16callenrattboi: so it is, thank you.
17:16callen(inc rattboi)
17:16lazybot⇒ 2
17:16futileis it pronounced Closure or Clo-jure?
17:17callenfutile: Clozhure
17:17callenbut quickly, you don't rest on the zh
17:17callenin french it'd be a dj
17:17futiledo you emphasise the U or the O?
17:17callenerrrr, j
17:17callenderp.
17:18callenfutile: it's pretty close to the pronunciation of closure, if not identical for the most part. It's just that it's specifically zh sound whereas I've heard some brits pronounce closure differently.
17:18rattboiI emphasize the O
17:18futilealso, why does the Clojure wikipedia article have an example that does defn inside a let? that seems wrong
17:18futilerattboi: ive just been saying Closure.
17:19Okasufutile: Wikipedia seems mostly wrong, do not rely on it too much.
17:19futileOkasu: but surely *we* can fix the Clojure page up?
17:19callenfutile: last time we tried to use Wikipedia, they deleted Hickey's page.
17:19callenI think we're scurred now.
17:20futileuhh
17:20justin_smithdef[u]n inside let is a standard common lisp idiom for mutable private data, it happens to work in clojure, but not be standard clojure style
17:20futileheh http://en.wikipedia.org/wiki/Rich_Hickey
17:20futilejustin_smith: we should change it to look more idiomatic.
17:20futilethe examples there.
17:20futilenot that im qualified to do it..
17:22futileok, we were on the topic of pronouncing Clojure, and 2 Seans just joined. is it too off topic to ask why Sean is pronounced Shawn?
17:22callenfutile: irish name.
17:23futileoh
17:23callenoriginally from "John"
17:23callenthe sound went from "John" to "zhawn" to "shawn"
17:23OkasuYawn.
17:24OkasuExtreme form John.
17:24Okasuof*
17:24futileok thx guys
17:26Okasucallen: Wow, you mean like when time passes clojure well go forl "Clojure" to "Clozha" to "Closhaw"?
17:26Okasus/well go forl/will go from/
17:28gtrakjustin_smith: not only is it not idiomatic, it'll break with threads
17:28justin_smithyet it claims to be threadsafe
17:29callenOkasu: lol
17:29gtrakwhere?
17:29clojurebotwhere is forget where
17:30Okasugtrak:
17:30Okasu>A thread-safe generator
17:30Okasuhttps://en.wikipedia.org/wiki/Clojure
17:30gtrakdoh.. that is fine
17:30gtraksorry, I was thinking scheme's nested 'define'
17:31justin_smithgtrak: wait, I see an atom there, won't that be thread safe - or was that a recent edit?
17:31justin_smithheh, our conversation threads lost sync for a second there
17:32gtrakyea, I use defs within lets occasionally just to screw with my team
17:32justin_smithhey, sometimes you gotta keep secrets!
17:33gtraksometimes you gotta understand when/how top-level things actually get evaluated ;-)
17:34justin_smith(let [fn-I-will-only-need-here (fn [..] ....)] (def do-foo (fn-I-will-only-need-here ...)) (def do-bar (fn-I-will-only-need-here ...)))
17:34justin_smithgtrak: so what is the pitfall with something like that?
17:35justin_smithI suspect it is probaly just some vestigal cl-based instinct being followed - but is it something that actually breaks things?
17:35gtrakoh, there isn't one.. just saying it's possible to get in trouble. it's just helpful to know it's closing over some variables during the static initializer of the namespace
17:35justin_smithoh, yeah, sure
17:35gtrakand also during compile-time
17:35justin_smithyeah, so you don't want any state modifications in the let bindings
17:36gtrakgenerally, you should move your state to the top of your app
17:36gtrakso it's not bound to a namespace lifecycle, vars have the same problem.
17:36gtrakin that case of the symbol generator it doesn't matter
17:36futilegtrak: thanks for sharing about Datomic
17:37gtrakdo you like it?
17:37futileAfter reading about 5 documents and blog posts and stuff on it, I finally get it.
17:37justin_smithwe did a big transformation not long ago - took all the state-atom-maps we had at the tops of our libs and moved them into config that is explicitly generated (so things could become re-entrant)
17:37futileI don't think it's that complicated, I think those documents just need to emphasize that attributes are free-floating and any entity can have any attribute.
17:38justin_smiththen rather than setting an atom in the lib, you pass config into lib functions
17:38futilegtrak: I like it so far, but it feels a little daunting to setup at first. There's no built-in convenience functions for creating schemas, which makes them seem huge.
17:39futilesrsly, 6 lines per single attribute!
17:39Raynescallen: I'm working with Jose to see what we can do about that ports issue finally. I sent an email to the erlang-questions mailing list to see what reception it gets, and he is gonna try to bring it up to Joe Armstrong and see what he thinks/potentially get it added to the internal otp issue tracker and such. So hopefully we can get some progress made on that and my mental anguish can subside.
17:40callenRaynes: I'm surprised it flew under Joe's radar.
17:40gtrakjustin_smith: yea, that makes testing much easier (tractable at all)
17:40callenRaynes: in the meantime, use Elixir!
17:40callenRaynes: with Dynamo or Chicago Boss :D
17:40futilewhoa, elixir looks crazy
17:41Raynesfutile: It's crazy awesome. I wrote the URI library and original mix when it was still really early. Then I saw how bad Erlang ports were and got sad and ran away. Stayed friends with Jose though. He consults with me a lot about Clojure design choices because he likes Clojure and wants to do as much of what Clojure did right as he can, which is why I love Elixir so much.
17:42futileRaynes: oh neat
17:43callenRaynes: Jose is a very nice person.
17:43callenhe's probably the only nice Rails core dev.
17:43RaynesHe holds a special place in my heart.
17:43futileoh man, is he into Rails 'magic' philosophy?
17:44callenI don't think so. He's definitely into having nice tools though.
17:44RaynesWell, he made Elixir.
17:44RaynesSo I don't think so.
17:44noncom|2hi, i have a (defn) in another namespace and i have an alias to that namespace (made by :as), how do i get that what is defined with (defn)?
17:45noncom|2smth like (ns-resolve 'that-another-ns-alias (symbol (name defn-name))) does not work...
17:45noncom|2says cant find that-another-ns-alias
17:45justin_smithnoncom|2: (ns foo) (defn bar [] ...) (ns user) (require '[foo :as f]) (f/bar)
17:46gtraknoncom|2: (def the-new-var old-var-ns/old-var)
17:47noncom|2i have the defn-name unknown at compile-time, so i think that i have to formulate somehting like that require
17:47gtrakah, I thought you wanted to make an alias to the function
17:47noncom|2like (require '[foo :as (symbol (name user-defined-name))])
17:48noncom|2gtrak: yeah, but that is dynamic, so i'm knoking my head at the wall now :)
17:48gtrakwhat is dynamic, the old one?
17:48noncom|2oh nono, i mean it is known only at compile-time
17:48gtraknot sure what you mean
17:48gtrakwhat isn't known at run-time in clojure?
17:49noncom|2a user passes a keyword or a string, and i have to resolve that as a binding in another namespace (which is also specifield at runtime)
17:49noncom|2but they are specified in different places
17:49noncom|2namespace first
17:49gtrakah, you want ns-resolve with aliases?
17:50noncom|2yeah, i tried, but did not work. i guess maybe the require thing will work?
17:51gtrakcheck it out: https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L3943
17:51noncom|2i mean, ns-resolve does not accept smth like (ns-resolve (symbol (name use-defined-ns-name)))
17:51gtrakyou can build up the env parameter from your current namespace, I believe
17:51noncom|2i am fully unaware of what is env in clojure
17:52noncom|2i mean envirinemnet
17:52noncom|2oh my spelling/...
17:52gtrakuser> (take 20 (ns-map *ns*)).....([sorted-map #'clojure.core/sorted-map] [read.......
17:52gtrakyou should be able to figure it out from there
17:52noncom|2ah that is
17:52noncom|2yeah, i will have to go to study things
17:53noncom|2this is basic, but i did not use it before
17:53gtrakthe functions are here: http://clojure.org/namespaces
17:53gtrakit's nice that it's all data, like a lot of clojure
17:54noncom|2not a word on envs though.. will have to dig up additional sources.
17:54gtrakns-aliases?
17:54gtrakit's probably fastest just to read the impl
17:54noncom|2yeah, about data - one day i found out that clojure namespaces are not maps!
17:54noncom|2yeah, i think i will do it
17:55gtrakit's not something people do a lot..
17:56noncom|2btw, knowing that clojure nss are not maps, terrifies me in some way...
17:56noncom|2:)
17:56gtrakobjects are data too? ;-)
17:56gtrakor can be viewed as such
17:57noncom|2hmmm.. all is data and all is code.. but not all is valid ahaha :)
17:57noncom|2yeah, that's like hebrew. all their data is code and vice-versa
17:58gtrakall this fuss to flip some bits on the screen
17:58noncom|2true and i won't even remember that in 1000 years after...
17:59noncom|2or no, i'll be sitting and rememberin, contemplating on it, specially..
17:59noncom|2:))
18:02justin_smithnoncom|2: user> (require '[clojure.string :as s]) ;;; nil ;;; user> (resolve 's/join) ;;; #'clojure.string/join
18:02justin_smith
18:02justin_smithsomething like that should work for what you want, yes?
18:03justin_smithusing (comp resolve symbol) on whatever the user provides (if they are providing a string)
18:03squidzdnolen: is it possible to create source maps yet for clojurescript
18:03justin_smith,((comp resolve symbol) "clojure.string/join")
18:03clojurebot#'clojure.string/join
18:04noncom|2so i will try now!
18:04gtrakclojures docs says 'same as (ns-resolve *ns* symbol)'
18:05justin_smithoh, ok
18:05justin_smithbut does ns-resolve work with ns aliases in that way?
18:05gtrak*ns* isn't going to give you what you want at runtime
18:05noncom|2hmmmm
18:05gtrakyea, seems like ns-resolve will do it
18:06gtrakbut you should pass in a hardcoded ns symbol I guess
18:06noncom|2but hey! looks like it went just fine!
18:06gtrakcall it from another namespace?
18:06gtraksee how that goes
18:06noncom|2i have this now:
18:07noncom|2(let
18:07noncom|2 [mk-grabber ((comp resolve symbol) (str "jcv/" (name grabber-type)))
18:07noncom|2...
18:07gtrakif *ns* is a var.. then it's not going to work, I'm not sure if it is or not
18:07noncom|2and yes, it goes into that ns, takes that grabber-maker-fn, and later, in the (let), it passes arguments to that maker and the grabber creation is being attempted
18:08noncom|2,(type *ns*)
18:08clojurebotclojure.lang.Namespace
18:08noncom|2oh
18:08noncom|2well, (resolve) is same as (ns-resolve *ns*)....
18:08gtrak,(class #'*ns*)
18:08clojurebotclojure.lang.Var
18:08noncom|2oO
18:08gtrakit's for repl stuff
18:09justin_smithwill ns-resolve work with aliased namespaces?
18:09noncom|2let me try
18:09gtrakmeaning, it's not getting reset all the time when your code runs, only at the repl and read/eval time.
18:10noncom|2what you mean not getitng reset?
18:10justin_smithI have done (require '[clojure.string :as s]) - (resolve (symbol "s/join")) works, (ns-resolve 's 'join) does not
18:11justin_smithor am I using ns-resolve wrong?
18:11noncom|2ahaha
18:11noncom|2here:mk-grabber (ns-resolve (resolve 'jcv) (name grabber-type))
18:11noncom|2NullPointerException java.util.concurrent.ConcurrentHashMap.hash (:-1)
18:12noncom|2(resolve 'a)
18:12noncom|2,(resolve 'a)
18:12clojurebotnil
18:12squidzstuartsierra: or do you maybe know?
18:12stuartsierraeh, what?
18:12noncom|2hmmm, creating a meaningful example for clojurebot takes thinking...
18:13noncom|2it's just that jcv is surely already aliased before it gets to that line
18:13noncom|2in my code.
18:13noncom|2,(ns-aliases)
18:13clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$ns-aliases>
18:13noncom|2,(ns-aliases *ns*)
18:14clojurebot{}
18:14noncom|2oO
18:14squidzstuartsierra: what the status is about sourcemaps with clojurescript
18:14stuartsierrasquidz: no idea
18:14gtrakhope this illustrates the point: $ java -jar clojure-1.5.1.jar -e "(ns user2) (defn n [] *ns*) (ns user) (user2/n)" ... #'user2/n ... #<Namespace user>
18:15noncom|2squidz: a little off-topic: in my experience clojurescript debugs like heaven with standard browser console
18:15gtrak*ns* isn't where the function lives.
18:16bbloomsquidz: seangrove is the guy most recently tooling around w/ source maps
18:16noncom|2gtrak: right, it's where it was called from, this is fine i guess?
18:16gtrakI thought you cared about aliases defined in your namespace?
18:17gtraknot the namespace that the user is in
18:17squidzbbloom: oh okay, does he get on the channel?
18:17noncom|2ah, i see
18:17noncom|2i seee waht you meen
18:17gtrakcool :-)
18:17bbloomsquidz: yeah, he's here relatively frequently
18:17gtrakwas hard to explain :-)
18:17noncom|2sorry :))
18:18noncom|2i'll make a test now
18:18seangrovesquidz: What do you need to know?
18:19squidzseangrove: if it is possible to create sourcemaps for clojurescript
18:19noncom|2gtrak: yes, surely you're right, it fails when i'm not there
18:19noncom|2oh man
18:20gtrakso.. back to 15 minutes ago :-), you'll have to hardcode the ns if that's what you want
18:21noncom|2but is there a way to not hardcode it?
18:21gtrakunless there's a more convenient way... not sure
18:21gtrakah, I have a terrible idea, let me try it
18:21squidzI saw this site that explains how to generate sourcemaps but not sure how to do it with clojurescript or if it's possible http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
18:21noncom|2:))
18:22bbloomsquidz: clojurescript source maps are a work in progress, they are not available for general use yet
18:22gtraksimple :-)
18:23gtrak,(namespace `ljldfljdfjldfljdsfljsdfljsdf)
18:23clojurebot"sandbox"
18:23seangrovebbloom: I think they're in there already
18:23bbloomseangrove: ok, you know better than me :-) you help squidz
18:23seangroveThey only have line info, and it's off by one, but you just have to add a :source-map key to your cljs-build compiler options
18:23seangroveLet me try it...
18:24squidzseangrove: wow cool I really want to try it out
18:24noncom|2gtrak: yeah, and when you said you have an idea, i recalled ns-find also!
18:25noncom|2and it like wox with strs.. ? (namespace) is close to (ns-find) afaik..
18:25gtrakright, backtick means the symbol doesn't have to actually exist... though, so that's not hardcoding anything :-)
18:26noncom|2well, that's super-great!
18:26noncom|2so now i can have fun with even more bad style dynamically resolving code :D
18:26gtrakheh, yes. I'd be curious if there's a better way.
18:27gtrakah!
18:27gtrakit all comes back around, close over the value of *ns* at compile-time
18:27gtrakin a let
18:27noncom|2)))
18:27noncom|2i'll try
18:27noncom|2now
18:28seangroveAh, I get an NPE with it. Lame.
18:28gtraknoncom|2: yep, works :-). $ java -jar clojure-1.5.1.jar -e "(ns user2) (let [the-ns *ns*] (defn n [] the-ns)) (ns user) (user2/n)"...#'user2/n...#<Namespace user2>
18:29noncom|2heh))
18:29squidzseangrove: hmmm I would really like to test it out even though it's one line off
18:29noncom|2good hacking this is
18:31seangrovesquidz: I haven't used it from cljsbuild, checking it now
18:32noncom|2but that feels a little crazy
18:32squidzseangrove: wow i'm crossing my fingers, that would be so cool
18:33gtraknoncom|2: pretty sure it'll work
18:33seangroveI'm getting an NPE, let me see if I can track it down
18:33noncom|2yeah, it does! :) fun stuff. thank you!
18:34squidzI had no idea it was so close until I saw something about it yesterday
18:34seangrovesquidz: What did you see yesterday?
18:35squidzI saw an article where somebody mentioned having the :source-map option in the cljsbuild options
18:35justin_smithgtrak: what was that we were saying about defn inside let?
18:35justin_smithlol
18:35gtrakjustin_smith: right :-)
18:35seangroveYeah, looks like it works, but you can't use optimizations :whitespace, it has to be at least :simple
18:35gtraklike i said, it's helpful to know how eval works..
18:36gtrakespecially if you like being nasty
18:36seangroveAnd after the js is generate, you have to edit the soureMappingURL comment at the bottom so it points to the right location for your map
18:36seangroveAnd after *that*, you have to copy all your source code somewhere the browser can find it
18:37seangroveAh, and edit the *.js.map.merged file to point to the relative location of the copied source
18:37squidzseangrove: can you put an example in a gist. I really want to try it out
18:37seangroveI hope I'm wrong about all of that, but I haven't found a way to make it work without those crazy manual-edits and copying the entire source code to a browser-accessible url
18:37squidzseangrove: it't really exciting
18:37seangroveSure, One second
18:38squidzseangrove: thanks a ton. It's really nice of you
18:39seangrovesquidz: No proble, just be ready to write me a clojure backend for reliably downloading imap emails
18:39seangroveWhich is what I'm escaping from by making this gist...
18:41justin_smithsounds like a fair trade
18:42seangroveGotta leverage all this source map work I've been doing somehow
18:42squidzseangrove: hehe, well I have no idea about imap emails. But if I could, I would
18:42seangroveIt's not very pleasant, I wouldn't recommend it
18:42squidzis it for business?
18:43seangroveThe imap stuff is, not source maps
18:43squidzbecause I can't imagine it's for pleasure
18:43seangroveIt turns out to be pretty cool to query your inbox for all sorts of things from clojure
18:43seangroveBut That's only after you have a local copy of it, etc.
18:44squidzfor some kind of app? Do you have ideas of what you would do with the emails?
18:48seangroveYup, works, one line off
18:48seangroveOne second, will post the gist
18:49squidzseangrove: awesome work I really owe you one
18:59seangrovesquidz: Try this https://gist.github.com/sgrove/6092756
19:00seangroveLet me know if it works for you
19:00squidzokay i'll try it out now. Thanks so much. I'll tell you if I get it going
19:01seangroveHopefully this can all be folded into cljsbuild at some point
19:02seangroveAnd very hopefully I'm wrong about source-maps not being able to access file urls, so we don't have to copy all the source code to browser-accessible urls
19:02seangroveBut there's remarkably little written about this stuff for source maps that I've been able to find so far
19:03squidzyeah i'm sure other poeple would like to see your write up
19:04squidzi'm getting this whin i try to run lein cljsbuild -> java.lang.Exception: Unknown build identifier: prod
19:04squidzis prod for production|/
19:04squidz?
19:05seangroveyeah
19:05seangroveShould be dev
19:05seangroveUpdated
19:06squidzit says Unknown build identifier: dev
19:06callenRaynes: if not Elixir, there's always Go too >:)
19:06Raynesif I wanted to kill myself there are easier ways to do it, callen.
19:06seangrovesquidz: Do you have a dev build id?
19:07squidzno
19:07seangroveCan you paste your project.clj somewhere?
19:08squidzseangrove: https://www.refheap.com/16946
19:08RaynesOh dear.
19:08RaynesThat's impressive.
19:09seangrovesquidz: Looks like you haven't updated it like the example in my gist
19:10seangroveYou'll need to give your builds ids, and also to pass :source-map to the compiler section
19:10squidzh now I see the build id
19:10seangrovesquidz: https://github.com/emezeske/lein-cljsbuild#multiple-build-configurations look at "optionally assign an id"
19:11squidzokay it compiled on to the next step
19:14eggheadis there a 'best choice' for websockets in clj currently (preferably easily working w/ ring/compojure)
19:17eggheaderr, I guess I'll just want two web servers and a main method instead of lein ring, right?
19:18squidzseangrove: what about source entries that refer to "file:/home/albert/.m2/repository/org/clojure/google-closure-library/0.0-2029-2/google-closure-library-0.0-2029-2.jar!/goog/base.js"
19:19seangrovesquidz: Ignore them
19:19seangroveThey're inside jar files anyway, browser won't be able to open them up
19:21tomjackhmmmmm https://www.refheap.com/0fdbc1b0180c4af8d46db6b10
19:26RaynesO.O
19:27squidzseangrove: so if it works I should be able to see the clojurescript files in chromes debugger(I enabled source-maps in the settings)
19:28callentomjack: hahahahahah what the fuck did you do?
19:28seangrovesquidz: Yeah, more or less
19:28seangroveYou should see them listed under sources
19:30seangrovesquidz: Example: http://dl.dropbox.com/u/412963/Screenshots/ce.png
19:31RaynesAJ!
19:31RaynesAH!
19:31RaynesWhat is this it's scary.
19:33callenseangrove: source maps are live?!
19:33seangrovecallen: They've been live for awhile, it's just not a full implementation
19:33seangroveBut it'll get you down to the line number at least
19:33callenseangrove: :D :D :D
19:34callenseangrove: version?
19:34seangrove0.0-1844
19:34seangroveBut as you can see from the gist above, it's *not* a smooth process
19:34seangroveA lost of it needs to be rolled into cljsbuild probably
19:35squidzshit i really want to get it but its not showing up
19:35seangrovesquidz: What's the source-map comment at the end of the compiled js file, and from what url are you serving it?
19:36squidzoh i skipped the js comment
19:38squidzholy shit it works
19:38squidzthanks seangrove
19:43seangroveAh, glad to hear it
19:43seangroveSpread the word squidz ;)
19:43squidzyeah I really should
19:44squidzmy clojurescript file is found but it appears to be empty
19:44seangroveTry right-clicking and opening in a new tab
19:44seangroveWhat url is it at?
19:45squidzokay yeah its the wrong url
19:47squidzoh my god I can't believe this is working
19:47squidzwith break points and everything
19:47squidzi'm as giddy as a school girl
19:48squidzI will spread the word
21:11tomjackcallen: no clue..
21:11tomjacknot my POM..
21:19akurilinNeed an opinion. Say I'm passing some data from my clojure web app to an ObjectiveC client. The former is pretty happy with working with maps stitched together from different db tables. The latter generally prefers a class for every object type. I could technically use something like NSDictionary to try to mimic a clojure map, but I don't know if I should avoid trying to copy that idiom.
21:20akurilinOn the other hand making a boilerplate class for each chunk of JSON I pass back from the web app is a bit of a pita.
21:25callenakurilin: NSDictionary is fine.
21:25callenthat's a standard choice for any kind of JSON data.
21:36akurilincallen, as in, most people don't bother wrapping it in container classes with cozy typed properties/
21:36akurilin*?
21:36clojurebot* is just for when you are lazy and sloppy
22:13isaacbwyou guys
22:13isaacbwI love you so much
22:17isaacbwis there a function in core like C's strstr?
22:17isaacbwi.e get the position of a substring
22:31isaacbwdoes clojure have a core function for finding substrings?
22:32bbloomuse regex
22:32bbloom(find-doc "re-")
22:32r0bgleesonmy hair is awesome
22:32isaacbwI guess I can just use java.lang.String's indexOf as well
22:33bbloomor that
22:56callenakurilin: not necessarily.
23:26isaacbwwould anyone mind sanity checking my line buffering function? It works, but I have no idea if it's very idiomatic http://pastie.org/8179805
23:26futileisaacbw: for idiomaticity i would use refheap.com
23:27futileisaacbw: it looks like you're just recursing, which means you can ditch letfn and use recur
23:27futile,(doc recur)
23:27clojurebotIt's greek to me.
23:27futileaw
23:27futileisaacbw: also its usually more idiomatic in Clojure to rely on (possibly lazy) sequences rather than recursion
23:28futileand functions which act on sequences, like filter, reduce, etc.
23:28futileisaacbw: can you show me some sample usage for this function?
23:29isaacbwfutile: here's a simple (not very useful) example https://www.refheap.com/16951
23:30isaacbwthis is for processing line-based network streams
23:31futilei guess i just dont understand it well enough
23:31r0bgleesoni am a line-based network stream
23:31futilei mean, that code prints "hi" but returns "there!".
23:31isaacbwmore importantly, it prints "hi" and puts "there!" into the buffer
23:31futileisaacbw: so, itll do whatever function you give it to each line, and return the last one?
23:32futilehmm
23:32isaacbwso when more input comes in, line-buffering can continue where it left off
23:32futileisaacbw: i think i see.
23:32isaacbwthough I guess I can get rid of the atom swapping in line-buffer and do that outside
23:33futileisaacbw: why not use clojure.string/split ?
23:33futileisaacbw: or even better: http://clojuredocs.org/clojure_core/clojure.string/split-lines
23:33isaacbwbecause I can't differentiate the result between (split "ab\nc") and (split "ab\nc\n")
23:33futileisaacbw: oh i think i see why you wouldnt want that, because you might not have a completed line at the end.
23:34isaacbwboth return ["ab" "c"]
23:34futileheh i think i did this a few years ago when parsing irc messages.
23:34isaacbwyea
23:34futileok let me think for a bit on this
23:44futileisaacbw: https://www.refheap.com/16952
23:44futileim not perfectly content with it
23:45futilefeels a bit wordy somehow. but this is the general approach i'd take
23:45futileyeah, wait, this is stupid.
23:45futilei got too juxt-happy
23:47futileok second try: https://www.refheap.com/16953
23:49futilei still dont like it. dont know why though.
23:49isaacbwah, that's much more readable than what I had!
23:49isaacbwthank you!
23:50isaacbwthis all requires a pretty different way of thinking
23:50futileyeah, ive been doing clojure full-time for 9 months and its still not natural for me yet
23:51futilei think the only way i get by is because i keep forcing myself to think in terms of sequences
23:52futile,(conj [1 2 3] [4])
23:52clojurebot[1 2 3 [4]]
23:52futile,(concat [1 2 3] [4])
23:52clojurebot(1 2 3 4)
23:52futileok yeah thats what i should use. i dont trust conj ever.
23:53futileisaacbw: this always returns a string that you can append more data to and process in the same way.
23:54futileisaacbw: and by append i really mean pass (str old-buffer new-data) to the function
23:55futile,(concat [1 2 3] [])
23:55clojurebot(1 2 3)
23:55futileoh hey that makes it simpler i think
23:56futile,(concat [1 2 3] nil)
23:56clojurebot(1 2 3)
23:56futilewoo!
23:56futilehttps://www.refheap.com/16954
23:56futileits even simpler isaacbw
23:58futileguys, is there a way to do destructuring that works like butlast/last ?
23:58futileoh duh, reverse the seq.
23:59futilehmm, i cant tell if this made it better or worse: https://www.refheap.com/16955