2013-07-26
| 00:05 | TimMc | ...which it does, right? |
| 00:09 | callen | TimMc: the whole point of bcrypt is to produce hashes from values such that the relationship cannot be precomputed. |
| 00:10 | TimMc | Are you saying that bcrypt(A) sometimes produces B and sometimes produces not-B? |
| 00:11 | callen | ...yes |
| 00:11 | mmarczyk | bcrypt uses a random salt which is included in the output |
| 00:12 | mmarczyk | along with the work factor (how many iterations of an expensive procedure to use) |
| 00:12 | Raynes | bcrypt would be an amazing thing if it didn't, let me tell you. |
| 00:12 | mmarczyk | then to verify it extracts salt, work factor and the actual hashed password |
| 00:13 | mmarczyk | the (plaintext, salt, work-factor) -> hashed output relationship is deterministic, of course |
| 00:14 | TimMc | Oh, sure. |
| 00:14 | alexgunnarson | Hey 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:14 | alexgunnarson | with 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:14 | alexgunnarson | performance-geared as, for instance, the JVM. Thoughts? |
| 00:14 | callen | alexgunnarson: jesus dude. |
| 00:14 | alexgunnarson | :D |
| 00:14 | aka | ha |
| 00:14 | callen | alexgunnarson: just use Luminus. |
| 00:16 | alexgunnarson | callen: thanks for the suggestion. i'll look into that. what advantages does it have? |
| 00:16 | callen | alexgunnarson: I'm not here to play mixologist. If you want to make a web app with Clojure, just use Luminus. |
| 00:16 | callen | advantages - uhmmm, it won't fuck you around and will force you to just make your app instead of jacking off to acronyms. |
| 00:17 | Raynes | lol |
| 00:17 | aka | that should be it's official motto |
| 00:18 | alexgunnarson | yeah post that on the homepage |
| 00:18 | callen | I think yog is too professional for that. |
| 00:18 | Raynes | alexgunnarson: 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:19 | alexgunnarson | Raynes: 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:19 | Raynes | Then don't use flash. |
| 00:19 | callen | alexgunnarson: do you want to make a web app in clojure or not? |
| 00:19 | Raynes | Flash isn't even supported on iOS. |
| 00:19 | Raynes | So I don't know how using flash would help you anyways if that's a goal. |
| 00:20 | alexgunnarson | Raynes: not in the browser but in AIR it is |
| 00:20 | Raynes | AIR isn't supported in Linux. |
| 00:20 | Raynes | And is a piece of shit regardless. |
| 00:20 | callen | AIR is garbage. |
| 00:20 | Raynes | When it was supported, everyone hated it. |
| 00:20 | alexgunnarson | i know… anything that uses flash player is terrible |
| 00:20 | Raynes | Well, that's not what I was saying. |
| 00:20 | aka | alexgunnarson: it is literally impossible to write software that runs everywhere and perfoms ideally on all platforms |
| 00:21 | Raynes | I enjoy flash games from time to time. |
| 00:21 | callen | Raynes: tower defense yo. |
| 00:21 | alexgunnarson | me too! |
| 00:21 | Raynes | You're just overthinking thing. |
| 00:21 | callen | so can we get back to the Clojure? |
| 00:21 | futile | callen: hey callen im working on some ObjC right now |
| 00:21 | alexgunnarson | aka: the JVM comes close and hopefully oracle will push it onto mobile platforms but we're still holding our breath on that |
| 00:21 | callen | futile: I don't care. |
| 00:21 | alexgunnarson | hahaha |
| 00:21 | futile | callen: you told me to say so! |
| 00:22 | aka | how is oracle going to push it to iOS? |
| 00:22 | callen | no I didn't. |
| 00:22 | callen | futile: in general, please don't talk to me unprompted. |
| 00:22 | callen | futile: I don't like ignoring people, but I don't like *wanting* to /ignore them either. |
| 00:22 | alexgunnarson | aka: they almost did back in like february or something i can't remember the date |
| 00:22 | futile | callen: stop talking about yourself |
| 00:22 | callen | futile: I'm talking about you. |
| 00:22 | futile | you're doing it again |
| 00:22 | Raynes | We really need moderators in here. |
| 00:22 | alexgunnarson | aka: they announced that it would happen but they never really carried their plans out |
| 00:23 | callen | Raynes: 4rlz. |
| 00:23 | Raynes | callen is too hostile, futile is too dumb. |
| 00:23 | Raynes | That combination is pretty deadly. |
| 00:23 | futile | ill fix it |
| 00:23 | callen | thank god |
| 00:23 | Raynes | Was it something I said? :\ |
| 00:23 | alexgunnarson | yeah let's get some admin privileges in here |
| 00:23 | callen | problem is, he'll come back in 5 minutes then talk about how terrible of a person he is. |
| 00:23 | callen | Raynes: he does like that like every other day, don't take it personally. |
| 00:24 | Raynes | callen: Suggestion though: ignore him. You don't have to /ignore him. It's easy: you don't respond to what he says. |
| 00:24 | Raynes | I don't ignore anybody at all and I get by just fine. |
| 00:24 | callen | he takes over the channel too often |
| 00:24 | Raynes | And trust me, I hate people too. |
| 00:24 | callen | haha, fair enough :) |
| 00:24 | aka | alexgunnarson: how would they implement that? there is still going to be a disconnect from the native sdk |
| 00:25 | Raynes | Good news is that the language is popular enough now that this happens, callen. |
| 00:25 | Raynes | High schoolish fights and such. |
| 00:25 | callen | there's always an impedance mismatch between a generic toolkit and native. It's inescapable. |
| 00:25 | alexgunnarson | aka: hold on let me get the article |
| 00:25 | callen | Raynes: we need local dictators/warlords/ircops to police though. |
| 00:25 | aka | anyways, alexgunnarson, you want to build a mobile app or a web app? |
| 00:25 | Raynes | All three! |
| 00:25 | callen | Raynes: god willing. |
| 00:26 | callen | Raynes: also, do you use Xmonad? |
| 00:26 | Raynes | callen: I was responding to aka, but sure. :p |
| 00:26 | alexgunnarson | http://java.dzone.com/articles/oracle-gets-java-running-ios |
| 00:26 | callen | oh, woops. |
| 00:26 | Raynes | callen: I use OS X. |
| 00:26 | Raynes | I used xmonad ages ago when I still used linux. |
| 00:26 | alexgunnarson | "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:26 | callen | YourKit and jvisualvm don't seem to work with xmonad. |
| 00:26 | callen | This...deeply upsets me. |
| 00:26 | poggio | I'm using xmonad right now |
| 00:26 | callen | alexgunnarson: that doesn't change what I said. |
| 00:26 | callen | alexgunnarson: the impedance mismatch is in your code. |
| 00:26 | callen | alexgunnarson: not in the tools you're using. |
| 00:26 | alexgunnarson | although i suppose the "headless/lightweight JVM" might not support clojure… |
| 00:27 | alexgunnarson | callen: you have a point |
| 00:27 | callen | alexgunnarson: at best you could IFDEF and write specific platform code for each |
| 00:27 | callen | alexgunnarson: but then you're back to the days of C and C++ |
| 00:27 | alexgunnarson | which would be terrible |
| 00:27 | callen | alexgunnarson: there is no "one platform to rule them all, and in the darkness bind them" |
| 00:27 | alexgunnarson | well okay for specific tasks |
| 00:27 | callen | well, it produced nice user experiences, even if it wasn't easy to work with as a developer. |
| 00:27 | alexgunnarson | which makes me sad, because i always loved LOTR :D |
| 00:27 | callen | alexgunnarson: why don't you tell us what you want to do? |
| 00:27 | Raynes | I booted into windows to play DmC: Devil May Cry callen. Why is this channel more entertaining than that game? |
| 00:27 | alexgunnarson | callen: very true |
| 00:28 | callen | Raynes: because I'm here, knocking heads. |
| 00:28 | callen | Raynes: why are you playing the bastard child DMC game? |
| 00:28 | Raynes | I've played all the others and not this one... |
| 00:28 | alexgunnarson | callen: i want to basically make a clojure OS that runs on the JVM |
| 00:29 | Raynes | o_o |
| 00:29 | callen | alexgunnarson: no. |
| 00:29 | alexgunnarson | haha |
| 00:29 | Raynes | If you want to invent an operating system, you probably shouldn't worry about interoperablity with... operating systems. |
| 00:29 | callen | probably shouldn't use a language that requires a VM host *and* an OS host. |
| 00:29 | alexgunnarson | well it's a virtual OS |
| 00:30 | Raynes | So it's emacs? |
| 00:30 | Raynes | ~rimshot |
| 00:30 | clojurebot | Badum, *tish* |
| 00:30 | callen | Raynes isn't kidding though. lisp OS in a bucket. |
| 00:30 | samrat | callen: I think `export _JAVA_AWT_WM_NONREPARENTING=1` before running jvisualvm fixes it. |
| 00:30 | alexgunnarson | hmm. true. emacs haha |
| 00:30 | callen | samrat: I'll have to try that with yourkit as well. Thank you! |
| 00:31 | poggio | you 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:33 | ToBeReplaced | emacs hackers in terminal mode -- do you just use C-<right> and ilk for paredit instead of C-) ? |
| 00:36 | karvus | I 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:40 | ToBeReplaced | thanks |
| 01:09 | alexgunnarson | it seems like everyone's dead… |
| 01:09 | alexgunnarson | hey so how about concurrent, functional UIs? anyone seen this?: http://augustl.com/blog/2013/truly_concurrent_user_interfaces/ |
| 01:10 | alexgunnarson | it's a project called concui |
| 01:13 | vilonis | I'm having trouble finding standard library documentation for clojure (even a list of all the modules), anyone know of a good source? |
| 01:14 | noidi | vilonis, http://clojure.github.io/clojure/ |
| 01:15 | vilonis | ah, I wasn't sure if that was it |
| 01:16 | noidi | you can find usage examples etc. on http://clojuredocs.org/ |
| 01:16 | brehaut | out of date examples |
| 01:16 | brehaut | clojuredocs.org is only current up to 1.3; 1.5.x the latest release |
| 01:19 | noidi | I don't think there have been many backwards-incompatible changes |
| 01:19 | noidi | it may be missing stuff but I doubt that many of the examples are wrong |
| 01:21 | futile | is callen gone yet? |
| 01:21 | futile | i love the clojure community, including the irc community. they're all such nice people. |
| 01:22 | zRecursive | sure |
| 01:22 | zRecursive | Clojure makes interested in Java again |
| 01:22 | zRecursive | makes me |
| 01:23 | futile | *you're all |
| 01:23 | futile | thats why im shocked callen hasnt been banned by now |
| 01:26 | SegFaultAX | I just got +b from #python for talking about dependency injection. :/ |
| 01:26 | SegFaultAX | I knew they hated Java but shit. |
| 01:27 | SegFaultAX | Just explaining what it is to someone is enough to get +b |
| 01:28 | futile | SegFaultAX: that cant possibly be why |
| 01:29 | futile | SegFaultAX: theres nothing wrong with that as a concept, its perfectly legit and useful |
| 01:30 | SegFaultAX | futile: Read the scrollback. |
| 01:30 | futile | SegFaultAX: the dependency injection part? |
| 01:30 | noidi | you're pretty much doing dependency injection when you work with higher-order functions :P |
| 01:31 | futile | heh |
| 01:31 | futile | never thought of it that way |
| 01:31 | futile | not sure its right |
| 01:31 | noidi | me neither :) |
| 01:32 | SegFaultAX | futile: You'll see that right before I was +b, I was suggesting reading Martin Fowler. |
| 01:32 | noidi | I think there are some parallels with dependency injection if you're calling e.g. merge-with or sorted-map-by |
| 01:33 | mthvedt | as an enterprise java refugee, let me say a major reason for DI is composable execution contexts |
| 01:33 | futile | SegFaultAX: heh |
| 01:33 | mthvedt | this is huge when you have 1 million lines of bad java code expected to run in 50 places |
| 01:34 | mthvedt | with each module being a moving part |
| 01:34 | SegFaultAX | mthvedt: That and being able to swap out components for eg testing. |
| 01:34 | dpathakj | does 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:34 | SegFaultAX | Integration testing without DI in Java is extremely painful. |
| 01:34 | futile | yea |
| 01:34 | futile | in ruby too |
| 01:34 | SegFaultAX | futile: Well in Ruby you can literally modify anything at runtime |
| 01:35 | SegFaultAX | Including the root objects that dominate the entire object tree. |
| 01:35 | futile | thats what makes it so painful |
| 01:35 | mischov | Has anybody else been having problems with Carmine not wanting to let a macro be build around wcar as shown in the github docs? |
| 01:35 | SegFaultAX | Kernel, Module, Object, BasicObject, etc. |
| 01:35 | futile | yeah |
| 01:35 | futile | you can just delete Kernel iirc |
| 01:35 | futile | that was fun |
| 01:35 | SegFaultAX | I don't think you can undef Kernel, but maybe. |
| 01:35 | dpathakj | (besides the obvious (- ((incrementer 5) 0) 0)… i'm wondering more about a reflection-type solution. |
| 01:37 | dpathakj | the closest thing i've found is clojure.repl/source, but that doesn't do what i'm thinking of. |
| 01:37 | futile | SegFaultAX: 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:37 | SegFaultAX | You mean str or object I assume. |
| 01:37 | futile | yep |
| 01:37 | futile | been too long |
| 01:40 | mthvedt | segfaultax: right, but that's a subset of setting up execution contexts. |
| 01:40 | SegFaultAX | mthvedt: I suppose that's true. Good point. |
| 01:41 | mthvedt | if/when big companies start writing millions of lines of bad clojure code, i wager clojure DI will become a lot more popular |
| 01:42 | noidi | ,(require 'clojure.reflect) |
| 01:42 | clojurebot | nil |
| 01:42 | SegFaultAX | mthvedt: stuartsierra's blog post about his workflow is basically DI. |
| 01:42 | noidi | ,(reflect (let [foo 10] (fn [] foo))) |
| 01:42 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reflect in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 01:42 | noidi | ,(clojure.reflect/reflect (let [foo 10] (fn [] foo))) |
| 01:42 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: sandbox$eval84$fn__85> |
| 01:43 | noidi | dpathakj, oh well, for me that returns a map containing #clojure.reflect.Field{:name foo, :type long, :declaring-class user$eval171$fn__172, :flags #{} |
| 01:43 | SegFaultAX | noidi: I think it's disabled by clojail. |
| 01:44 | noidi | dpathakj, presumably you can then use something like https://github.com/arohner/clj-wallhack to get the field's value |
| 01:46 | futile | ,(let [list [:foo :bar "baz" :quux :yay], [a [b & c]] (split-with (complement string?) list)] [a b c]) |
| 01:46 | clojurebot | [(:foo :bar) "baz" (:quux :yay)] |
| 01:47 | dpathakj | noidi: cool. could be interesting. thanks. |
| 01:51 | dpathakj | (luckily I don't have a specific use case other than the toy problem I mentioned; this is more a matter of exploration…) |
| 01:56 | zRecursive | ,(Math/sqrt 10000000000) |
| 01:56 | clojurebot | 100000.0 |
| 02:09 | futile | ,(into {} (zipmap [1 2 3] [:a :b :c])) |
| 02:09 | clojurebot | {3 :c, 2 :b, 1 :a} |
| 02:12 | SegFaultAX | futile: Why? |
| 02:12 | futile | what SegFaultAX? |
| 02:12 | SegFaultAX | ,(zipmap [1 2 3] [:a :b :c]) |
| 02:12 | clojurebot | {3 :c, 2 :b, 1 :a} |
| 02:24 | futile | SegFaultAX: cuz i wanted to make a map from keys/vals |
| 02:24 | futile | ,(map identity [1 2 3] [:a :b :c]) |
| 02:24 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity> |
| 02:24 | futile | ,(map vector [1 2 3] '[a b c]) |
| 02:24 | clojurebot | ([1 a] [2 b] [3 c]) |
| 02:26 | futile | ,(map #(hash-map :a %1 :b %2) [1 2 3] '[a b c]) |
| 02:26 | clojurebot | ({:a 1, :b a} {:a 2, :b b} {:a 3, :b c}) |
| 02:26 | futile | is there a nicer way of doing that? |
| 02:26 | futile | ,(map #(hash-map :a %1 :b %2) [1 2 3] '[4 5 6]) |
| 02:26 | clojurebot | ({:a 1, :b 4} {:a 2, :b 5} {:a 3, :b 6}) |
| 02:35 | cespare|home | When I start lein repl, it says it started nREPL on some port but it doesn't create target/. Isn't it supposed to? |
| 02:35 | cespare|home | (nobody is responding on #leiningen) |
| 02:35 | callen | SegFaultAX: best reason to get banned I've ever heard. |
| 02:39 | futile | cespare|home: i dont think target/ has anything to do with the port nrepl connects on. |
| 02:39 | futile | i think target is just a temporary place to put compiled files |
| 02:39 | cespare|home | How does e.g. vim-fireplace know what port to listen on? |
| 02:40 | cespare|home | by what I'm reading it looks for target/repl-port |
| 02:53 | SegFaultAX | cespare|home: What port to listen on? |
| 02:54 | SegFaultAX | cespare|home: Fireplace connects to nrepl. |
| 02:55 | Raynes | SegFaultAX: Yes. Over a port. |
| 02:55 | Raynes | Which it has to get from leiningen. |
| 02:55 | Raynes | And cannot get from Leiningen magically. |
| 02:55 | Raynes | It requires a file, just like cespare|home said. |
| 02:55 | Raynes | cespare|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:56 | SegFaultAX | Raynes: Does fireplace open a port? Maybe I misunderstood. |
| 02:57 | Raynes | SegFaultAX: 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:58 | SegFaultAX | Raynes: Orly? |
| 02:58 | Raynes | It'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:58 | Raynes | No, I'm just kidding. |
| 02:58 | SegFaultAX | Heh |
| 02:58 | SegFaultAX | I didn't know that. |
| 02:58 | SegFaultAX | Thanks for the clarification. |
| 02:59 | SegFaultAX | I've never actually had fireplace spin up its own repl. I've /always/ connected to an already running one. |
| 02:59 | Raynes | If you go to a project that doesn't have a repl running and do cqc, it'll work. |
| 03:01 | SegFaultAX | Raynes: Does it spin up a new one everytime you evaluate something or does it persist across the rest of your session? |
| 03:01 | futile | (inc clojure) |
| 03:01 | lazybot | ⇒ 14 |
| 03:01 | futile | only 14? |
| 03:01 | futile | $karma clojure |
| 03:01 | lazybot | clojure has karma 14. |
| 03:01 | futile | $karma amalloy |
| 03:01 | lazybot | amalloy has karma 67. |
| 03:02 | futile | thats not right. |
| 03:02 | Raynes | SegFaultAX: I thought it persisted across your session, but given that it takes about a month to evaluate anything I expect I'm wrong. |
| 03:02 | Raynes | (identity futile) |
| 03:02 | lazybot | futile has karma 2. |
| 03:02 | futile | ,(dotimes [i 10] (inc clojure)) |
| 03:02 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: clojure in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 03:02 | futile | aww |
| 03:02 | zRecursive | (identity zRecursive) |
| 03:02 | lazybot | zRecursive has karma 0. |
| 03:02 | SegFaultAX | futile: Wrong bot. |
| 03:02 | Raynes | And it isn't actual code anyways. |
| 03:02 | Raynes | It's just parsing it to be clever. |
| 03:02 | futile | ,(dotimes [i 10] (println "(inc clojure)")) |
| 03:02 | clojurebot | (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:03 | Raynes | That wouldn't work either. |
| 03:03 | futile | didnt help. |
| 03:03 | Raynes | lazybot ignores clojurebot. |
| 03:03 | futile | awwww |
| 03:03 | zRecursive | :-D |
| 03:03 | zRecursive | karma 0 |
| 03:03 | futile | (+ clojure 1000) ;; just make this work plz Raynes |
| 03:03 | noidi | ,(list? '(1 2 3)) |
| 03:03 | clojurebot | true |
| 03:03 | noidi | ,(list? `(1 2 3)) |
| 03:03 | clojurebot | false |
| 03:04 | futile | ,(seq? '(1 2 3)) |
| 03:04 | clojurebot | true |
| 03:04 | futile | ,(seq? `(1 2 3)) |
| 03:04 | clojurebot | true |
| 03:04 | futile | neat |
| 03:04 | noidi | that bug took me quite a while to find... |
| 03:04 | SegFaultAX | ,`(1 2 3) |
| 03:04 | clojurebot | (1 2 3) |
| 03:04 | futile | noidi: ow |
| 03:04 | noidi | ,(class `(1 2 3)) |
| 03:04 | clojurebot | clojure.lang.Cons |
| 03:04 | futile | hmm, 2am. not good. |
| 03:05 | zRecursive | ,(def song (ref #{})) |
| 03:05 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 03:05 | Raynes | &`(1 2 3) |
| 03:05 | lazybot | ⇒ (1 2 3) |
| 03:05 | futile | &(inc clojure) |
| 03:05 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: clojure in this context |
| 03:05 | futile | &(inc 'clojure) |
| 03:05 | lazybot | java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number |
| 03:05 | futile | :D |
| 03:05 | Raynes | That's interesting. |
| 03:05 | futile | &'(inc clojure) |
| 03:05 | lazybot | ⇒ (inc clojure) |
| 03:05 | Raynes | &(type `(1 2 3)) |
| 03:05 | lazybot | ⇒ clojure.lang.Cons |
| 03:05 | futile | Raynes: yeah, make it a built-in function. |
| 03:06 | Raynes | &(type '(1 2 3)) |
| 03:06 | lazybot | ⇒ clojure.lang.PersistentList |
| 03:06 | zRecursive | ,(eval &'(inc clojure)) |
| 03:06 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 03:06 | Raynes | I guess that'd do it, noidi. |
| 03:07 | futile | ,((juxt type class) `(1 2 3)) |
| 03:07 | clojurebot | [clojure.lang.Cons clojure.lang.Cons] |
| 03:07 | futile | ,(= type class) |
| 03:07 | clojurebot | false |
| 03:07 | futile | oh |
| 03:07 | zRecursive | ,(type type) |
| 03:07 | clojurebot | clojure.core$type |
| 03:08 | zRecursive | ,(type class) |
| 03:08 | clojurebot | clojure.core$class |
| 03:08 | futile | ,(doc type) |
| 03:08 | clojurebot | "([x]); Returns the :type metadata of x, or its Class if none" |
| 03:08 | futile | ,(doc class) |
| 03:08 | clojurebot | "([x]); Returns the Class of x" |
| 03:08 | Raynes | You guys can get a repl by typing 'lein repl', by the way. |
| 03:08 | futile | ah |
| 03:08 | futile | but we're experisharilearning |
| 03:08 | Raynes | Look at all the people leaving because of you. |
| 03:09 | zRecursive | Raynes: can we message bot ? |
| 03:09 | Raynes | (leave guys, they need to think you're bothering them) |
| 03:09 | Raynes | See! |
| 03:09 | Raynes | zRecursive: Yes. |
| 03:09 | futile | (:O |
| 03:09 | callen | zRecursive: no, the bot broke IRC |
| 03:09 | zRecursive | Raynes: which bots to use ? |
| 03:09 | callen | zRecursive: the bot is a magical special case of IRC |
| 03:09 | Raynes | Either bots to use. |
| 03:10 | zRecursive | lazybot and clojurebot is same ? |
| 03:10 | futile | bedtime |
| 03:10 | Raynes | Not the same. |
| 03:10 | Raynes | They're completely different bots. |
| 03:10 | zRecursive | then message to who ? |
| 03:11 | Raynes | Either oen. |
| 03:11 | Raynes | one* |
| 03:11 | zRecursive | why not one bot as lambdabot in #haskell ? |
| 03:13 | callen | zRecursive: 'murica. |
| 03:13 | Raynes | Because it's entirely legal to write IRC bots and some people enjoy doing it. |
| 03:13 | Raynes | This isn't a democracy, we don't vote for bot president. |
| 03:13 | SegFaultAX | I for one... blah blah overlords. |
| 03:14 | zRecursive | see |
| 03:14 | metellus | a bot election |
| 03:14 | Raynes | lazybot supports abortion. |
| 03:14 | metellus | that would be. |
| 03:14 | Raynes | Just a heads up. |
| 03:14 | callen | Raynes: post-natal abortion of people that abuse bots in public channels? |
| 03:15 | Raynes | ~rimshot |
| 03:15 | clojurebot | Badum, *tish* |
| 03:47 | cespare|home | Is there a way to get the repl to automatically reload my project code when the file changes? |
| 03:47 | cespare|home | (I'm using lein repl if that matters) |
| 03:49 | AtKaaZ | hi, 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:49 | SegFaultAX | ,(every? even? [2 4 6]) |
| 03:49 | clojurebot | true |
| 03:50 | AtKaaZ | does it work for equals? |
| 03:50 | AtKaaZ | like 2==4==6 ? |
| 03:50 | Chousuke | you can apply = |
| 03:50 | Chousuke | ,(apply = [1 1 1]) |
| 03:50 | clojurebot | true |
| 03:50 | AtKaaZ | oh yes that makes sense |
| 03:50 | AtKaaZ | so it's like (= 1 1 1) |
| 03:51 | SegFaultAX | AtKaaZ: Yes. |
| 03:51 | AtKaaZ | but suppose you don't have = that can take more than 2 params |
| 03:51 | Chousuke | you can reduce |
| 03:51 | AtKaaZ | so you can only do (= 1 1) or (fun 1 1) |
| 03:51 | SegFaultAX | ,(every? #(= 1 %) [1 2 3]) |
| 03:51 | clojurebot | false |
| 03:51 | SegFaultAX | ,(every? #(= 1 %) [1 1 1]) |
| 03:51 | clojurebot | true |
| 03:51 | Chousuke | though reduce won't be lazy |
| 03:52 | AtKaaZ | ok but I want that 1 inside the function to be the first element from the list |
| 03:52 | AtKaaZ | ie. not hardcoded |
| 03:52 | AtKaaZ | ok more like fun should take two params |
| 03:52 | SegFaultAX | AtKaaZ: What are you implementing? RLE? |
| 03:52 | Chousuke | AtKaaZ: just take it from the list then :P |
| 03:52 | AtKaaZ | (something? #(= %1 %2) [1 1 1]) |
| 03:52 | AtKaaZ | no, I am just trying to remember the name of a clojure function which already does this |
| 03:53 | hyPiRion | ,(let [[f & r] [1 2 3]] (every? #{f} r)) |
| 03:53 | clojurebot | false |
| 03:53 | AtKaaZ | (cause i think there's one?) |
| 03:53 | SegFaultAX | AtKaaZ: Checking if every element = the first element is the same as applying = |
| 03:53 | AtKaaZ | wasn't there some justone function though? |
| 03:54 | AtKaaZ | SegFaultAX: you may be right, but I think I worded it wrongly |
| 03:54 | SegFaultAX | AtKaaZ: Tell us what you really want, then. |
| 03:54 | AtKaaZ | what I want is something like this (something? #(= %1 %2) [1 1 1]) where %1 and %2 is previous and next(or current) element |
| 03:54 | AtKaaZ | from that list |
| 03:55 | AtKaaZ | like comparing elements I think |
| 03:55 | SegFaultAX | How is that different from apply =. You're just doing it pair-wise. |
| 03:55 | amalloy | &(partition 2 1 [1 2 3]) |
| 03:55 | lazybot | ⇒ ((1 2) (2 3)) |
| 03:55 | amalloy | SegFaultAX: he's asking for functions in general, not = in particular |
| 03:56 | SegFaultAX | He specifically asked for equals. |
| 03:56 | AtKaaZ | ,(sort #(> %1 %2) [1 3 2 9 -1]) |
| 03:56 | clojurebot | (9 3 2 1 -1) |
| 03:56 | hyPiRion | ,(->> [1 2 3 4] (partition 2 1) (every? (fn [[a b]] (== (inc a) b)))) |
| 03:56 | clojurebot | true |
| 03:56 | amalloy | equals was the example he gave |
| 03:56 | AtKaaZ | grr I think it's sort lol |
| 03:56 | SegFaultAX | ,(sort-by > [1 2 3 4]) |
| 03:56 | clojurebot | (1 2 3 4) |
| 03:56 | SegFaultAX | ,(sort-by < [1 2 3 4]) |
| 03:56 | clojurebot | (1 2 3 4) |
| 03:56 | AtKaaZ | yes that one, thanks guys! sorry for my poor expressive skills |
| 03:56 | SegFaultAX | What am I doing, haha. |
| 03:57 | hyPiRion | wat |
| 03:57 | SegFaultAX | AtKaaZ: You were looking for sort-by? |
| 03:57 | hyPiRion | sort is not taking the previous and next(or current) element |
| 03:57 | AtKaaZ | for sort I think, why did your sort-by give the same results? |
| 03:58 | AtKaaZ | oh ? |
| 03:58 | AtKaaZ | wait actually it's not sort, because it returns a list xD |
| 03:58 | AtKaaZ | and i want it to return true or false depending on what function returns when taking elements by 2 |
| 03:58 | hyPiRion | ,(sort-by :foo > [{:foo 1} {:foo 2} {:foo -5}]) |
| 03:58 | clojurebot | ({:foo 2} {:foo 1} {:foo -5}) |
| 03:59 | hyPiRion | when taking elements by 2 -> elaborate |
| 03:59 | AtKaaZ | (somefn? #(> %1 %2) [1 2 3 4 5]) returns true but (somefn? #(> %1 %2) [1 2 3 5 4 6 7]) returns false |
| 03:59 | SegFaultAX | ,(sort-by identity > (range 10)) |
| 03:59 | clojurebot | (9 8 7 6 5 ...) |
| 03:59 | SegFaultAX | I forgot keyfn was first that's all. |
| 03:59 | cespare|home | AtKaaZ: hyPiRion already gave you your answer |
| 04:00 | AtKaaZ | cespare|home, where? I missed it |
| 04:00 | cespare|home | you can use partition to get the pairs of two, and then use every? |
| 04:00 | hyPiRion | ,(->> [1 2 3 4] (partition 2 1) (every? (fn [[a b]] (== (inc a) b)))) |
| 04:00 | clojurebot | true |
| 04:00 | AtKaaZ | ah, but wasn't there just one function? |
| 04:00 | hyPiRion | ^ |
| 04:00 | SegFaultAX | AtKaaZ: Wrap it in a defn and it will be. |
| 04:00 | hyPiRion | just one function? |
| 04:00 | AtKaaZ | I mean, some idiomatic function that does it |
| 04:00 | SegFaultAX | AtKaaZ: Do you mean something in clojure.core? |
| 04:01 | AtKaaZ | (somefn? #(= %1 %2) [1 2 3 4 5]) returns false; and (somefn? #(= %1 %2) [1 1 1 1 1]) returns true; |
| 04:01 | amalloy | AtKaaZ: there is no single pre-built function that does the six things you are asking for |
| 04:01 | AtKaaZ | somefn? aka one function :) |
| 04:01 | amalloy | you will have to build one |
| 04:01 | AtKaaZ | lol |
| 04:01 | cespare|home | AtKaaZ: you can do it with a complicated reduce, i think. |
| 04:02 | SegFaultAX | AtKaaZ: You keep using =, but is your actual use case just for general functions? |
| 04:02 | AtKaaZ | yes SegFaultAX |
| 04:03 | SegFaultAX | AtKaaZ: Then you have your answer. |
| 04:03 | AtKaaZ | ok thank you :( |
| 04:03 | hyPiRion | AtKaaZ: you can spin it off in another way |
| 04:04 | cespare|home | ,(reduce = (map #(apply = %) (partition 2 1 [1 2 3 4]))) |
| 04:04 | clojurebot | false |
| 04:04 | cespare|home | AtKaaZ: ^^ another way. |
| 04:04 | hyPiRion | ,(let [foo [1 2 3 4]] (->> (map #(= %1 (inc %2)) foo (rest foo)) (every? true?))) |
| 04:04 | clojurebot | false |
| 04:05 | AtKaaZ | :) 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:05 | SegFaultAX | If it's acceptable to process the entire list maybe. |
| 04:05 | SegFaultAX | AtKaaZ: What difference does it make? Why does it need to be from clojure.core? |
| 04:06 | amalloy | cespare|home: what on earth is that function supposed to do? |
| 04:06 | AtKaaZ | SegFaultAX: it's because i wanted to know the name of that function xD to see if other langs have it |
| 04:06 | cespare|home | amalloy: which function? |
| 04:06 | cespare|home | oh oops. |
| 04:06 | amalloy | the one you just offered. it seems to return true if either all the elements are the same or they are all pairwise different |
| 04:07 | AtKaaZ | amalloy: assert thatfun(testfn, a,b,c,d,e) where thatfun applies testfn to a and b then to b and c etc... |
| 04:07 | AtKaaZ | so my use case was for = but still |
| 04:07 | cespare|home | ,(every? true? (map #(apply = %) (partition 2 1 [1 1 1 2]))) |
| 04:07 | clojurebot | false |
| 04:08 | cespare|home | amalloy: ^^ is what I meant |
| 04:08 | SegFaultAX | Your use case is for =... we answered that 10 minutes ago. |
| 04:08 | amalloy | cespare|home: but like hyPiRion and SegFaultAX have already said, that's just a bad way to write (apply = [1 1 1 2])) |
| 04:08 | cespare|home | is there an easier way to do (every? true? ...)? |
| 04:08 | AtKaaZ | SegFaultAX, was it with apply = ? |
| 04:08 | cespare|home | SegFaultAX: false, you can put any other function instead of = |
| 04:08 | hyPiRion | cespare|home: reduce = |
| 04:09 | cespare|home | hyPiRion: not the same |
| 04:09 | hyPiRion | cespare|home: reduce = true |
| 04:09 | hyPiRion | ,(reduce = true [false]) |
| 04:09 | clojurebot | false |
| 04:09 | hyPiRion | ,(reduce = true []) |
| 04:09 | clojurebot | true |
| 04:09 | cespare|home | ok, that's more characters though |
| 04:09 | hyPiRion | it's obviously not easier though |
| 04:10 | SegFaultAX | ,(reduce = true [false false]) |
| 04:10 | clojurebot | true |
| 04:10 | SegFaultAX | So no. |
| 04:10 | cespare|home | ruby has all?, i was hoping for the same. |
| 04:10 | SegFaultAX | ,(reduce = true [true false false]) |
| 04:10 | clojurebot | true |
| 04:10 | SegFaultAX | ^ that was amalloy's point |
| 04:11 | hyPiRion | yeah, bugger. |
| 04:11 | SegFaultAX | cespare|home: That's what every? is, but more general. |
| 04:11 | hyPiRion | apply = true it is then |
| 04:11 | SegFaultAX | cespare|home: You could do (every? identity ...) and that's the same. |
| 04:12 | SegFaultAX | cespare|home: To match ruby's impl, we don't care that they all equal exactly true... only true in a boolean context ("truthy") |
| 04:13 | SegFaultAX | Which for clj is anything other than nil and false. |
| 04:13 | AtKaaZ | ,(and true true false) |
| 04:13 | clojurebot | false |
| 04:13 | cespare|home | SegFaultAX: right, it would be convenient if, if you didn't specify a pred, it used a default check for truthiness |
| 04:14 | cespare|home | haha, 'and' would indeed do that heh. |
| 04:14 | hyPiRion | convenient sure, but it wouldn't increase your productivity by some factor. |
| 04:14 | SegFaultAX | cespare|home: Doubtful. How often are you really checking if every item is not nil or false? |
| 04:14 | cespare|home | uh, in the context where it just came up? |
| 04:14 | cespare|home | where I know each item is true or false? |
| 04:14 | SegFaultAX | cespare|home: But AtKaaZ's case is after applying a predicate function :) |
| 04:15 | AtKaaZ | yeah, I remember it could take a function |
| 04:15 | SegFaultAX | cespare|home: So why have (every? (map pred L))? |
| 04:15 | hyPiRion | (every? true? ...) is more evident than (every? ...) though. |
| 04:15 | AtKaaZ | and 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:15 | SegFaultAX | hyPiRion: If you only care about /actually true/, right. |
| 04:16 | cespare|home | SegFaultAX: ah this is true. |
| 04:16 | SegFaultAX | cespare|home: (every? pred L) is clearly cleaner and more general. |
| 04:16 | hyPiRion | SegFaultAX: Sure. And if not, do (not-any? #{nil false} ...) instead |
| 04:17 | SegFaultAX | cespare|home: In ruby, you most often apply all? with a block anyway. |
| 04:17 | SegFaultAX | [1,2,3].all? { |e| e % 2 == 0 } |
| 04:17 | hyPiRion | (every? even? [1 2 3]) |
| 04:18 | hyPiRion | see, you're using pred the same way really |
| 04:18 | AtKaaZ | maybe 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:18 | SegFaultAX | hyPiRion: Exactly. |
| 04:18 | cespare|home | SegFaultAX: yes i saw your point, which is why i agreed with you. |
| 04:19 | SegFaultAX | Ruby's iterator protocol is pretty neat. Implement 1 method (#each) and you can mixin Enumerable to get a bunch of stuff for free. |
| 04:20 | cespare|home | lol, took me forever. Does this work then? (defn atkaaz [f s] (every? #(apply f %) (partition 2 1 s))) |
| 04:20 | cespare|home | (atkaaz = [1 1 1 1]) -> true |
| 04:20 | cespare|home | (this is literally my first day writing clojure btw) |
| 04:20 | AtKaaZ | cool then, seems to do the job :) |
| 04:20 | AtKaaZ | (I don't really know clojure though, as if that's not obvious haha) |
| 04:20 | SegFaultAX | You could have a second clause that takes n, the size of the slice to use. |
| 04:21 | cespare|home | (atkaaz < [1 2 3 4]) -> true |
| 04:21 | AtKaaZ | SegFaultAX, i'm glad i found functional ruby aka elixir :) |
| 04:22 | SegFaultAX | ,((fn atkaaz ([f s] (atkaaz 2 f s)) ([n f s] (every? #(apply f %) (partition n 1 s)))) = [1 1 1 1]) |
| 04:22 | clojurebot | true |
| 04:22 | SegFaultAX | ,((fn atkaaz ([f s] (atkaaz 2 f s)) ([n f s] (every? #(apply f %) (partition n 1 s)))) 3 = [1 1 1 1]) |
| 04:22 | clojurebot | true |
| 04:22 | SegFaultAX | Not a good test case, but yea. |
| 04:23 | AtKaaZ | almost hurts my head trying to understand it lol |
| 04:31 | AtKaaZ | almost like map-indexed except it doesn't pass the index but the previous element heh |
| 04:32 | AtKaaZ | almost like reduce... hmm maybe I remember reduce wrongly |
| 04:49 | AtKaaZ | oh 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:57 | Guest__ | how do i put the contents of a vector into a map? i use (into {} (partition 2 [1 2 3 4])). |
| 04:58 | Guest__ | what am i doing wrong here? |
| 04:58 | Guest__ | thanks. :) |
| 05:00 | hyPiRion | ,(conj {} '(1 2)) ; no work |
| 05:00 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry> |
| 05:00 | hyPiRion | ,(conj {} [1 2]) ; works |
| 05:00 | clojurebot | {1 2} |
| 05:00 | hyPiRion | But even better, use ##(apply hash-map [1 2 3 4]) |
| 05:00 | lazybot | ⇒ {1 2, 3 4} |
| 05:00 | Guest__ | hyPiRion thanks! |
| 05:03 | ucb | beat me to it |
| 05:04 | ucb | :) |
| 05:41 | ddellacosta | is there a way to ensure I'm using the === operator in ClojureScript? |
| 05:42 | ddellacosta | ah, from looking at source, looks like I use "==" |
| 07:05 | mmarczyk | ddellacosta: identical? actually |
| 07:06 | mmarczyk | ddellacosta: unless dealing with numbers, in which case it's indeed == |
| 07:07 | ddellacosta | mmarczyk: thanks! |
| 07:07 | mmarczyk | np |
| 09:12 | stuartsierra | An experiment: clojure.walk reimplemented with protocols https://github.com/stuartsierra/clojure.walk2 |
| 10:02 | dsapala | Does 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:05 | dsapala | I'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:01 | futile | what's the point of interning clojure symbols if it always creates a new one? |
| 11:02 | gfredericks | ,(identical? (symbol "foo") (symbol "foo")) |
| 11:02 | clojurebot | false |
| 11:03 | gfredericks | futile: you might be referring to a different thing? |
| 11:03 | futile | possibly the same thing |
| 11:03 | gfredericks | what interning are you talking about? |
| 11:03 | futile | gfredericks: https://groups.google.com/forum/#!topic/clojure/crmUDnGIVCg |
| 11:04 | futile | ,(Symbol/intern. "foo") |
| 11:04 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: Symbol, compiling:(NO_SOURCE_PATH:0:0)> |
| 11:04 | futile | ,(clojure.lang.Symbol/intern. "foo") |
| 11:04 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: No matching method: intern., compiling:(NO_SOURCE_PATH:0:0)> |
| 11:04 | futile | ,(clojure.lang.Symbol/intern "foo") |
| 11:04 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 11:04 | futile | that one |
| 11:05 | gfredericks | futile: I don't know for sure but I think the point here is to avoid duplicating the String objects |
| 11:05 | futile | ok |
| 11:05 | gfredericks | symbols themselves can't be interned simply (like keywords can) because of metadata |
| 11:05 | futile | oh right |
| 11:06 | gfredericks | or conversely, keywords can't have metadata so that they can be interned simply :) |
| 11:29 | futile | $mail brehaut btw hopefully this gets rid of the confusion: https://github.com/sdegutis/zephyros |
| 11:29 | lazybot | Message saved. |
| 12:03 | mbarbieri | hi, 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:04 | mbarbieri | if 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:06 | futile | mbarbieri: 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:06 | futile | mbarbieri: 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:07 | asteve | does anyone have examples on parsing dates? |
| 12:08 | asteve | I'd like to take a string in the format YYYYmmdd and create a java.util.Date object from it |
| 12:08 | asteve | I'm not sure if that's the clojure way |
| 12:08 | futile | ,(.parse (SimpleDatFormat. "yyyy") "1985") |
| 12:08 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: SimpleDatFormat, compiling:(NO_SOURCE_PATH:0:0)> |
| 12:09 | futile | ,(.parse (java.text.SimpleDateFormat. "yyyy") "1985") |
| 12:09 | clojurebot | #inst "1985-01-01T00:00:00.000-00:00" |
| 12:09 | futile | re asteve |
| 12:09 | mbarbieri | futile: 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:10 | futile | mbarbieri: 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:10 | futile | mbarbieri: 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:11 | futile | it just causes fragility problems |
| 12:12 | mbarbieri | futile: ok now I get it: have functions that create the data structure. Noted. Thanks! |
| 12:13 | futile | mbarbieri: yeah, let the data structure be *entirely* encapsulated in your src/ file, dont let test/ files know anything about it |
| 12:19 | mbarbieri | futile: *entirely* is a dynamically binded var right? :) |
| 12:20 | futile | #<Unbound Unbound: #'mbarbieri/*entirely*> |
| 12:31 | g06|in | why doesn't this work -- (.printf System/out "!") ? |
| 12:36 | ToxicFrog | g06|in: interesting. System/out is a java.io.PrintStream, which has two printf methods, printf(Locale, String, Object...) and printf(String, Object...) |
| 12:36 | gfredericks | having java varargs means you need to pass an array |
| 12:36 | ToxicFrog | Something like (.printf System/out "!" nil) works |
| 12:36 | ToxicFrog | Aah |
| 12:36 | gfredericks | (.printf System/out "!" (into-array [])) |
| 12:36 | gfredericks | also works |
| 12:36 | g06|in | thanks! |
| 12:36 | gfredericks | g06|in: note clojure.core/format |
| 12:36 | gfredericks | in case that's what you really want |
| 12:38 | scgilardi | or clojure.core/printf |
| 12:38 | gfredericks | oh right |
| 12:38 | gfredericks | of course :) |
| 12:38 | g06|in | thanks!! |
| 12:46 | redderhs | Hi, 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:56 | aka | there are commercials in this channel? |
| 12:56 | gfredericks | not welcomed, no |
| 12:59 | aka | :) |
| 13:09 | wink | damn ubuntu zealots |
| 13:35 | callen | what a bastard. |
| 13:50 | futile | just 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:51 | callen | futile: do you have a facebook or twitter account? |
| 13:54 | seangrove | Uhg, NPE when running cljsbuild test. Incredibly frustrating |
| 13:57 | wei_ | poll: which clojurescript data binding library do you use? cljs-binding, purnam, something else? |
| 13:58 | futile | callen: no |
| 13:58 | futile | callen: why? |
| 13:58 | seangrove | wei_: Please update us on the poll results when they're in ;) |
| 13:59 | callen | futile: it's a good outlet for random thoughts like that |
| 13:59 | callen | futile: you should try 'em. |
| 13:59 | futile | callen: oh. didnt realize i was doing irc wrong. |
| 13:59 | futile | it was about Clojure, does that make it relevant? |
| 14:00 | callen | futile: try to think in terms of the utility others might derive from it. |
| 14:00 | callen | futile: you couldn't tell you were talking about Clojure, or what book you were talking about |
| 14:00 | wei_ | seangrove: will do, if there's enough responses! |
| 14:00 | callen | futile: you speak for your own benefit and it's obvious. |
| 14:00 | futile | callen: oh i see. |
| 14:01 | futile | you're just a prick. a total prick. |
| 14:01 | futile | well i think maybe we'd be better off if you were banned. |
| 14:01 | futile | callen: you make this channel horrible to be in. |
| 14:01 | futile | or rather, you're horrible to be around. |
| 14:01 | justin_smith | look who's talking |
| 14:02 | callen | I'll get some gauze and ointment for that burn. back in a flash. |
| 14:02 | callen | (inc justin_smith) |
| 14:02 | lazybot | ⇒ 4 |
| 14:13 | ToBeReplaced | will mapply or something like it make its way into clojure core? |
| 14:15 | bbloom | ToBeReplaced: monad apply? |
| 14:15 | bbloom | ToBeReplaced: i don't foresee any kind of monad stuff making it into core any time soon |
| 14:15 | ToBeReplaced | ,mapply? |
| 14:15 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mapply? in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:15 | bbloom | even if it was of interest, it's always best to assume core won't change fast enough for your needs |
| 14:15 | ToBeReplaced | hm...i thought there was a clojurebot thing for mapply |
| 14:16 | bbloom | ~mapply |
| 14:16 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 14:16 | bbloom | ooooh that kind of mapply |
| 14:16 | pgr0ss | does 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:18 | ToBeReplaced | bbloom: yeah i seem to use it a fair amount |
| 14:18 | pgr0ss | i 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:19 | bbloom | ToBeReplaced: i haven't felt the need, or maybe i just think about it differently. curious: what do you use it for? |
| 14:19 | justin_smith | pgr0ss: what about conditionally bypassing the friend code by wrapping the handler in a conditional? |
| 14:20 | justin_smith | something like (if (= (System/getProperty "debug") "true") (handler request) (handler (friend request))) |
| 14:21 | ToBeReplaced | optional 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:21 | ToBeReplaced | ie (pool db :max-statements 10), or (pool db) |
| 14:22 | pgr0ss | justin_smith: I suppose I could, but then I can't test that some routes require auth, some don't |
| 14:22 | pgr0ss | justin_smith: also, what about code that relies on the current logged in user? |
| 14:22 | justin_smith | pgr0ss: yeah, that would be an issue, I don't know enough about friend to know how to best handle that |
| 14:22 | bbloom | ToBeReplaced: ah. i try to avoid optional keyword arguments like that or provide an alternative "plumbing" function that takes a normal map |
| 14:23 | justin_smith | pgr0ss though you could manufacture a request map that is sure to be denied if auth is required, and succeed otherwise |
| 14:23 | ToBeReplaced | bbloom: my default is to expose the unrolled version, and use the collected version internally |
| 14:23 | justin_smith | pgr0ss: and similarly, you could manufacture a map with the user data when you bypass friend |
| 14:23 | bbloom | ToBeReplaced: 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:23 | bbloom | but even then, i tend to prefer maps |
| 14:23 | pgr0ss | justin_smith: yeah, that's what i'm trying to do - i can't seem to get a request map that satisfies friend authentication |
| 14:24 | justin_smith | pgr0ss: this is how I unit test web apps with session / auth at least |
| 14:24 | justin_smith | that is why I suggested optionally turning the auth off |
| 14:24 | ToBeReplaced | bbloom: 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:25 | ToxicFrog | bbloom: why (apply concat (butlast args) (last args)) rather than (apply concat args)? |
| 14:25 | justin_smith | ie. 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:25 | bbloom | ToxicFrog: i find that the map versions are much easier to work with and don't mind the extra two chars in general :-) |
| 14:25 | bbloom | not the least of which, is the need for something like that mapply function |
| 14:26 | ToxicFrog | bbloom: not the question I'm asking. |
| 14:26 | pgr0ss | justin_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:26 | bbloom | ToxicFrog: (last args) is assumed to be a map |
| 14:26 | ToxicFrog | Aah |
| 14:26 | bbloom | sorry, that previous message was for ToBeReplaced |
| 14:27 | justin_smith | pgr0ss: the way I generally test controllers is to mock up the request as it hits the controller |
| 14:27 | justin_smith | since my controllers are less stable than my request handler (generally) |
| 14:27 | ToBeReplaced | ToxicFrog: the last argument is assumed to be a map, so concat flattens it out |
| 14:28 | justin_smith | and then I test each handler fn in isolation, if it tests well, it should compose properly |
| 14:28 | ToxicFrog | bbloom: so the result basically ends up as [arg1 arg2 .. argn [k1 v1] [k2 v2] [k3 v3]] |
| 14:28 | ToxicFrog | ? |
| 14:28 | bbloom | ToxicFrog: 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:29 | bbloom | er, only with a correctly typed map: {:kwarg1 1 :kwarg2 2} |
| 14:30 | ToBeReplaced | bbloom: i'm wondering whether if map were available, the unrolled version would be more widely used |
| 14:30 | ToBeReplaced | *mapply |
| 14:31 | Raynes | Which Haskell web framework is trying the least to be rails? |
| 14:31 | ToBeReplaced | it's in the library coding standards, and is practical i think |
| 14:32 | Raynes | That sounds like something totally non confrontational to put on twitter! |
| 14:32 | hexa | Hi 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:33 | troydl | Howdy, 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:33 | bbloom | ToxicFrog: *shrug* |
| 14:33 | Raynes | <smug>sounds like you want a monad, hexa</smug? |
| 14:33 | justin_smith | hexa: juxt? |
| 14:33 | ToxicFrog | bbloom: ? |
| 14:33 | Raynes | > |
| 14:33 | Raynes | hexa: juxt is probably what you want, but it's hard to tell unless we saw what the code takes and returns for real. |
| 14:33 | bbloom | ToxicFrog: 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:34 | justin_smith | hexa: if the functions should all receive the same args, and you don't want laziness, juxt is a perfect match |
| 14:34 | ToxicFrog | bbloom: what need for it? I'm confused |
| 14:34 | hexa | Looks like this : https://www.refheap.com/16937 |
| 14:34 | hexa | checking juxt :) |
| 14:34 | bbloom | ToxicFrog: gah, sorry |
| 14:34 | bbloom | ToBeReplaced: that was for you again ^^ |
| 14:34 | bbloom | ToxicFrog: you're a victim of my two-characters-then-tab expansion strategy that my fingers have memorized |
| 14:35 | ToxicFrog | troydl: (->> (range (int \a) (int \z)) (map char)) ? |
| 14:35 | hexa | Right juxt is it thx! |
| 14:35 | justin_smith | hexa: in that code, should test-map1 and test-map2 see the same args or different? |
| 14:35 | justin_smith | if they should see the same args, yeah juxt |
| 14:35 | Raynes | bbloom: Whenever Raynos talks after me, people start exploding into flames because their clients usually prefer tab completion for whoever talked last. |
| 14:35 | ToxicFrog | ,(->> (range (int \a) (int \k)) (map char)) |
| 14:35 | clojurebot | (\a \b \c \d \e ...) |
| 14:36 | Raynes | It's quite entertaining. |
| 14:36 | hexa | justin_smith, same args |
| 14:36 | bbloom | Raynes: damn irc clients need fuzzy completion or CamelHumpsOrSomething |
| 14:36 | Raynes | snaplets make no sense. |
| 14:36 | bgilbert | troydl: I've used this before: (def all-chars |
| 14:36 | bgilbert | (map char (range 97 123))) |
| 14:37 | bgilbert | ,(take 10 (map char (range 97 123))) |
| 14:37 | clojurebot | (\a \b \c \d \e ...) |
| 14:37 | justin_smith | ,(char 96) ; is jealous to not be considered a char |
| 14:37 | clojurebot | \` |
| 14:38 | troydl | Thanks 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:38 | antares_ | troydl: Neo4j does not like dealing with numbers as keywords, so does Neocons |
| 14:38 | troydl | Right |
| 14:40 | justin_smith | neocons huh, someone should make a sbcl backend for clojure and call it newleft (sbcl - steel - stalin getitlol) |
| 14:40 | Raynes | callen: Oh callen, look at you hiding in the twitters. |
| 14:41 | troydl | justin_smith: Lol, yeah the name neocons makes for some interesting google results when I have problems |
| 14:41 | callen | Raynes: Scotty. |
| 14:41 | Raynes | callen: Have you played with snap at all? |
| 14:41 | justin_smith | *2g1c |
| 14:41 | justin_smith | that is |
| 14:42 | Raynes | callen: 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:42 | callen | Raynes: it's a combinatorial framework |
| 14:42 | callen | Raynes: I avoided it like the plague. |
| 14:42 | Raynes | It's like the antithesis of all things that are good in functional languages. |
| 14:42 | callen | beyond using some lower level tooling |
| 14:42 | callen | Raynes: I mean, you're describing a lot of Haskell in general. |
| 14:42 | callen | "COOL SHIT JUST CUZZZZZ" |
| 14:42 | Raynes | I just don't get why it's all so terrible. |
| 14:43 | Raynes | Yesod 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:43 | callen | That's why Yesod gets its own book. |
| 14:43 | callen | not for making web apps, just for explaining/apologizing for Yesod. |
| 14:44 | Raynes | I feel mean for saying all this, but goodness. |
| 14:44 | callen | Raynes: I don't think Haskellers have ever had a notion of making a thing that does things. |
| 14:44 | justin_smith | I 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:44 | callen | at least the Scala people get work done in-between hacking on scalaz and making periodic table of operator libraries. |
| 14:45 | Raynes | callen: And now I'm sad because the homepage for Scotty is a .edu page. |
| 14:45 | callen | Raynes: it's the best way to make a web app in Haskell I've found. Sorry :) |
| 14:45 | callen | justin_smith: they don't talk about Clojure in #haskell because they're too busy ENDOFUNCTOR MONOID HILBERT SPACE |
| 14:45 | Raynes | I wonder if anyone has written actual websites in snap or yesod. Like. ones humans can look and interact with. |
| 14:46 | justin_smith | I think there are mathematical jargon spaces that are compact enough that a markov chain could hold its own for a while |
| 14:46 | callen | Raynes: lots of Haskeller blogs. |
| 14:46 | callen | Raynes: also I just checked the FPComplete Yesod tutorial |
| 14:47 | callen | the *first* line of the *first* example is the following: {-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-} |
| 14:47 | callen | ^^ lol. |
| 14:47 | Raynes | lol |
| 14:47 | callen | second line? import Yesod |
| 14:47 | Raynes | callen: 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:48 | callen | Raynes: do it in Elixir. |
| 14:48 | Raynes | But, 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:48 | callen | Raynes: Elixir+Dynamo |
| 14:48 | callen | practical, fun, interesting. |
| 14:48 | callen | (Dynamo in this case refers to the elixir cowboy wrapper, not the data store) |
| 14:48 | Raynes | I 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:49 | Raynes | Which to be fair includes me because I do not intend to dig into the Erlang C code. |
| 14:49 | ToxicFrog | Raynes: do it in Scala~ |
| 14:49 | callen | Raynes: Chicago Boss is Elixir compatible and doesn't require digging around in too much Erlang. |
| 14:49 | Raynes | He already does Scala. |
| 14:49 | callen | Raynes: I really think you're not giving Elixir and Chicago Boss a fair shake here. |
| 14:49 | Adeon | I know someone who made his blog in sed |
| 14:49 | Raynes | callen: Because if I decide I need to shell out then I'm screwed and that bothers me. |
| 14:50 | Raynes | I can't really get over it. |
| 14:50 | Raynes | If Erlang ports stop sucking, I'll be a big Elixir guy again. |
| 14:50 | callen | Raynes: that bad? ow. |
| 14:50 | callen | I know ports suck, but damn. |
| 14:50 | callen | Raynes: Racket? Common Lisp? |
| 14:51 | Raynes | I 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:51 | ToxicFrog | wait what |
| 14:52 | callen | Raynes: OCaml? |
| 14:52 | Raynes | Racket isn't a terrible idea. |
| 14:52 | Raynes | I 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:53 | Raynes | callen, 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:53 | Raynes | :p |
| 14:53 | callen | Raynes: Common Lisp + Clack + Caveman is cool. |
| 14:55 | callen | Racket doesn't have a very serious/good web stack though |
| 14:55 | callen | CL's is more mature |
| 14:56 | Raynes | callen: https://github.com/mattsta/erlang-stdinout-pool This is the result of the Erlang port issues. |
| 14:56 | callen | this is why I just write Clojure and thereby not suffer unnecessary problems. |
| 14:56 | callen | I'd still really like the ability to produce self-contained binaries that start and die quickly |
| 14:57 | Raynes | callen: I never actually figured out how to report this as an actual issue to Erlang though. |
| 14:57 | Raynes | They have like 12 different mailing lists for issues and 'proposals' and all this nonsense. |
| 14:57 | callen | Raynes: they're a political hive in emulation of their VM process model. |
| 14:57 | Raynes | callen: 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:57 | callen | LOL |
| 14:58 | Raynes | At which point I gave up entirely and just started complaining to everyone who would listen instead. |
| 15:03 | callen | Raynes: these sorts of problems are also why Python is still my default glue language, to my eternal chagrin. |
| 15:03 | Raynes | Heck, I might write the site in Python just for shits and giggles. |
| 15:03 | Raynes | At least you can actually do things with it. *shrug*. |
| 15:04 | callen | Raynes: if you write in Python then I could probably answer any questions off the top of my head limitlessly. |
| 15:05 | callen | Raynes: not to mention being able to recommend some pimp-ass libraries. |
| 15:05 | seangrove | monocle |
| 15:05 | seangrove | Very dapper o_ |
| 15:05 | callen | seangrove: no. |
| 15:06 | seangrove | I've been thinking about monocle compared to core.async a bit recently |
| 15:06 | callen | async in Python is dumb. |
| 15:07 | callen | Twisted is the purest form of Pythonic evil I've ever seen. |
| 15:07 | seangrove | callen: Async in every language seems to be pretty unpleasant overall |
| 15:07 | seangrove | And yes, twisted is an amazing achievement |
| 15:07 | callen | "amazing" |
| 15:07 | seangrove | Probably should have put amazing in quotes, yes |
| 15:07 | callen | seangrove: not really. |
| 15:08 | callen | http-kit is quite pleasant. |
| 15:08 | callen | lacks thread affinity, otherwise quite nice. |
| 15:08 | seangrove | Hrm, I used the http-kit client in a small test project, really didn't care for it |
| 15:08 | seangrove | Consuming twitter's streaming api with it was unpleasant |
| 15:09 | callen | I've not had occasion to use the client, I've only used it server-side. |
| 15:09 | callen | and for that, it's very nice. |
| 15:09 | seangrove | But 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:09 | seangrove | It looks very solid though |
| 15:12 | callen | async has been done well before |
| 15:13 | seangrove | Where? Really curious to see different approaches to make it easier to reason about |
| 15:13 | seangrove | Ahk, but I have ot catch the bus |
| 15:13 | seangrove | Will ask again in a bit |
| 15:17 | futile | anyone have experience with HTTP 30? codes? |
| 15:18 | callen | I gotta say, 30 is a new one for me. |
| 15:19 | callen | when did they start doing 2-digit HTTP status codes? |
| 15:19 | bbloom | sounds like somebody fat-fingered a 301 or 203 |
| 15:19 | bbloom | er 302, i'm apparently number dyslexic |
| 15:19 | futile | and i thought 30* would not be so clear as 30? |
| 15:19 | bbloom | and/or have fat fingers |
| 15:19 | futile | ffs |
| 15:20 | upwardindex | Is this the idiomatic way to get an element deep inside maps: (reduce get {:a {:b {:c {:d 4}}}} [:a :b :c :d]) ? |
| 15:20 | bbloom | upwardindex: get-in |
| 15:20 | futile | upwardindex: get-in |
| 15:20 | upwardindex | Thank you both! |
| 15:21 | ystael | I'm clearly missing something fundamental about dynamic vars; can someone explain? https://www.refheap.com/16938 |
| 15:21 | bbloom | ystael: they interact badly with laziness |
| 15:21 | bbloom | change map to mapv |
| 15:21 | bbloom | or (doall (map ...)) |
| 15:21 | ystael | *facepalm* of course. thank you very much! |
| 15:21 | ystael | i had completely forgotten about that part |
| 15:22 | ztellman | I'm not sure "of course" is the right reaction to that |
| 15:22 | yedi_ | callen: you google "user authentification in clojure" and friend comes up |
| 15:22 | yedi_ | but you're right, i should roll my own |
| 15:23 | ystael | ztellman: in the sense of "i'm pretty sure i saw a post last month where somebody else ran into this, but i forgot" :) |
| 15:24 | ztellman | ystael: fair enough, but no one will ever convince me that's an intuitive interaction between clojure primitives |
| 15:25 | ystael | ztellman: the evidence proves there can be no argument from me :D |
| 15:26 | gfredericks | ztellman: is this a "clojure should be different" objection or a "it's hard to write a useful language that isn't complicated" lament? |
| 15:27 | ztellman | gfredericks: I suppose lazy-seqs could close over the thread-local context on creation, but that would cause a host of other problems |
| 15:27 | ztellman | so the latter, I guess |
| 15:28 | gfredericks | k just curious :) |
| 15:28 | muhoo_ | 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:28 | gfredericks | I don't actually know of any problems with the former approach, unless perf is an issue |
| 15:28 | muhoo | i tried dire, it doesn't seem to have any way to showwhat args exactly broke the thing. |
| 15:29 | ztellman | gfredericks: it lets thread-local data escape the local context |
| 15:29 | ztellman | can cause resource leaks of all kinds |
| 15:29 | muhoo | also {:post [()]} just throws an exception, doesn't tell me what exactly was the incorrect args going in to the function |
| 15:29 | gfredericks | ztellman: oh I guess that could be weird |
| 15:30 | gfredericks | muhoo: for debugging I normally do an alter-var-root |
| 15:30 | gfredericks | muhoo: easy to make general helpers that use that approach |
| 15:30 | gfredericks | rather than changing a function itself |
| 15:30 | muhoo | gfredericks: any examples out there of that technique? |
| 15:31 | gfredericks | (alter-var-root #'foo (fn [f] (fn [& args] (or (apply f args) (throw (ex-info "" {:poop! args})))))) |
| 15:32 | muhoo | thanks. actually i'm pretty sure dire use alter-var-root under the hood. |
| 15:33 | muhoo | i'm hoping to put stuff in place for production to make the exceptions more helpful. |
| 15:33 | gfredericks | I've been noodling the idea of logging helpers that let you declaratively add interesting logging in an aspect-oriented style |
| 15:33 | muhoo | an 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:34 | callen | muhoo: this is pretty standard enterprise style logging |
| 15:34 | PuercoPop | is there something like * from the cl repl in clojure? |
| 15:34 | callen | fn + args + exception, sometimes with full trace. |
| 15:37 | muhoo | gfredericks: well thanks, the above is a lot cleaner than the (if-let [res (stuff)] res (throw ...)) approach |
| 15:37 | `cbp | PuercoPop: *1, *2, *3 |
| 15:39 | callen | gfredericks: I've been considering the same thing! |
| 15:39 | callen | defn-traced, defn-logged, etc |
| 15:41 | gfredericks | callen: oh mine would be alter-var-root style helpers to put after the functions |
| 15:41 | gfredericks | and combined with a logging lib that uses data rather than strings |
| 15:41 | muhoo | dire 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:42 | muhoo | i've used the erlang-style "supervise" functions of dire with good results |
| 15:42 | PuercoPop | `cbp: thanks |
| 15:42 | callen | gfredericks: sounds solid. |
| 15:44 | PuercoPop | is there a way to do partial aplication in a way I bind the second and third params but not the first? |
| 15:46 | llasram | PuercoPop: Just use an anonymous function: #(some-function % arg1 arg2) |
| 15:46 | PuercoPop | thanks |
| 15:48 | ivan | &(((fn [f y z] #(f % y z)) - 5 6) 13) |
| 15:48 | lazybot | ⇒ 2 |
| 16:00 | tbaldridge | llasram: but...but...I want all my code to be point free! |
| 16:00 | ivan | and running on a point-free CPU |
| 16:01 | bbloom | tbaldridge: 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:02 | tbaldridge | interesting...I've had a passing intrest in Forth in the past. How would this be done in a concatenative language? |
| 16:02 | bbloom | a "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:03 | bbloom | give it a try with https://github.com/brandonbloom/factjor :-) |
| 16:03 | bbloom | somethingg like (cat/run {:the "state"} (foo 1) (bar 2 3)) |
| 16:03 | bbloom | where foo and bar have stack effects [state x -- state*] and [state x y -- state*] |
| 16:05 | bbloom | i 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:06 | bbloom | https://github.com/brandonbloom/domscript/blob/master/src/domscript/cat.clj |
| 16:06 | bbloom | tbaldridge: ^^ that's a good example of the "jquery monad" basically |
| 16:08 | bbloom | but in the case of your state monad, you have essentially stacks of bindings, which you can implement as dynamic variables |
| 16:09 | bbloom | factor calls them "namespaces": http://docs.factorcode.org/content/article-namespaces.html |
| 16:09 | bbloom | unfortunately, factor's primary data structures are all mutable, so you can't really do speculative execution, but that's not an inherent limitation |
| 16:12 | tbaldridge | bbloom: 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:13 | bbloom | tbaldridge: you can mix and match |
| 16:13 | tbaldridge | bbloom: 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:13 | bbloom | Factor is sorta "extremist programming" to see how far they can push the idea |
| 16:13 | bbloom | but the answer is "surprisingly far" |
| 16:14 | bbloom | tbaldridge: factor supports lexical variables with full closure semantics: http://docs.factorcode.org/content/article-locals-examples.html |
| 16:14 | bbloom | so you can do whatever you need to do in the style that is most appropriate |
| 16:15 | bbloom | personally, i think the applicative style is a better default, but that doesn't mean the concatenative style isn't super useful |
| 16:15 | bbloom | basically every time you reach for ->, you're programming concatenatively in a very limited way |
| 16:15 | tbaldridge | agreed. |
| 16:16 | bbloom | tbaldridge: while i've got you here. SSA questions.... |
| 16:17 | tbaldridge | yes |
| 16:17 | bbloom | i know that core.async's SSA is very limited to it's particular use case |
| 16:17 | bbloom | but would it make sense to do an SSA -> JVM or JS backend? |
| 16:17 | bbloom | or are the lambda-calculus-ish clojure primitives a better match for the underlying hosts? |
| 16:19 | tbaldridge | No, 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:20 | bbloom | sorry, No to which question? |
| 16:20 | tbaldridge | as 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:20 | tbaldridge | are sexprs better....no |
| 16:20 | tbaldridge | they're simpler that's all. |
| 16:20 | bbloom | ok, that's what i thought |
| 16:21 | bbloom | i'm wondering if it would make sense to define a dynamically typed SSA language that had good backends for JVM ByteCode & JavaScript |
| 16:21 | bbloom | ie so that more of the compiler front ends can be recycled |
| 16:22 | tbaldridge | I'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:24 | bbloom | oh yeah, big project for sure |
| 16:24 | tbaldridge | I 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:24 | bbloom | :-/ |
| 16:26 | bbloom | i 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:26 | bbloom | since i figured SSA->JVM was a no brainer |
| 16:26 | bbloom | but i realized that you're doing SSA back to CLJ, which is probably close enough to SSA->CLJ |
| 16:26 | bbloom | er i mean close enough to SSA->JS |
| 16:28 | tbaldridge | a 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:28 | bbloom | heh cool |
| 16:39 | futile | hey so has anyone figured out how to get rid of clojure's s-exps? |
| 16:40 | justin_smith | why would you want to? |
| 16:40 | futile | i think the only thing left to solve is how to disambiguate between a value or a fn call with no args |
| 16:40 | bbloom | we have a solution to that… they are called parenthesis… |
| 16:40 | gfredericks | this comes up every few months |
| 16:40 | futile | i know, im reading old threads, thats how i found this topic |
| 16:40 | gfredericks | there was even an april fools language devoted to it |
| 16:41 | gfredericks | the name of which escapes me |
| 16:41 | justin_smith | oh, yeah, I almost chuckled out loud at that one |
| 16:41 | mthvedt | gfredericks: squarejure? |
| 16:41 | futile | i dont care for it myself, i like parens. im just wondering if theres any news on its progress |
| 16:41 | mthvedt | no, that's wrong |
| 16:41 | gfredericks | oh nevermind |
| 16:41 | gfredericks | that was about swapping square brackets and parens |
| 16:41 | mthvedt | clochure |
| 16:42 | gfredericks | futile: I don't think anybody expects progress |
| 16:42 | gfredericks | any "solution" you come up with is bound to be much more complicated and problematic than whatever "problems" are associated with the normal syntax |
| 16:42 | malyn | https://github.com/one-more-minute/clarity (although I don't actually want to use that :) |
| 16:42 | callen | Raynes: http://www.stephendiehl.com/posts/haskell_web.html |
| 16:42 | Raynes | I saw that. |
| 16:42 | callen | damn |
| 16:42 | Raynes | Made me want to punch a kitten. |
| 16:43 | callen | Raynes: "javascript code generation" KITTY_SCARED.JPG |
| 16:43 | Raynes | "LOOK. HERE'S A TRIVIAL USELESS EXAMPLE THAT IS SIMPLE. HASKELL IS EASY. WEB DEV IN HASKELL IS EASY SEE" |
| 16:43 | callen | Raynes: "disk-backed key-value store that only works in Haskell" |
| 16:43 | Derander | I was incredibly amused by that intro example |
| 16:44 | gfredericks | malyn: hah is that just a macro that uses :column metadata? |
| 16:44 | Derander | my first thought: "wtf is forM_" |
| 16:44 | Raynes | I know what forM_ is. Still think it's all silly. |
| 16:45 | arrdem | malyn: wat no |
| 16:45 | malyn | gfredericks: Not sure how it works. At first it sounded interesting, but any non-trivial example started making me uncomfortable. |
| 16:45 | malyn | ("interesting" in a theoretical sense) |
| 16:46 | gfredericks | I wonder how it handle double-open-parens |
| 16:47 | Raynes | callen: I've been contemplating offering money for the first person to submit a pull request to fix the port issues I've had. |
| 16:47 | Raynes | It'd be a fun social experiment. |
| 16:47 | Raynes | submit and get accepted, of course. |
| 16:48 | callen | Raynes: gittip is neat, but I'd still really like to see a github-aware bounty system. |
| 16:48 | callen | or just a bounty system in general that actually works and lets people pitch in if they want it to happen too. |
| 16:50 | callen | Raynes: is there such a thing? An escrow/bounty system for OSS? |
| 16:50 | Raynes | I saw something recently. |
| 16:51 | Raynes | callen: http://coderbounty.com/ here is one thing. |
| 16:52 | callen | Raynes: looks so horrendously ghetto. |
| 16:52 | ToBeReplaced | just 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:53 | callen | ToBeReplaced: ...you are aware of bonecp right? |
| 16:53 | futile | ToBeReplaced: ive heard bone cp is better |
| 16:53 | Raynes | callen: 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:53 | callen | Raynes: I was thinking of something more generic. |
| 16:54 | Raynes | callen: Because apparently you aren't supposed to send issues without patches or some shit. |
| 16:54 | futile | ~mapply |
| 16:54 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 16:54 | ToBeReplaced | i've heard yeah -- just not currently used in my work environment |
| 16:55 | ToBeReplaced | maybe should have named it jdbc-c3p0-pool ... probably would have been better... should have asked first |
| 16:55 | callen | ToBeReplaced: well there are existing c3p0 libs for clojure too :P |
| 16:55 | futile | oh, mapply is neat |
| 16:56 | futile | although i think a better solution is just write fns that take an optional map at the end |
| 16:56 | ToBeReplaced | the pooling we use internally is all down-and-dirty, so i'm not one to understand diff between either lib |
| 16:56 | ToBeReplaced | callen: links? quick google didn't show |
| 16:57 | ToBeReplaced | i also didn't want to do anything other than provide a thin wrapper for easy setup into a org.clojure/java.jdbc specification |
| 16:58 | Derander | ~mapply |
| 16:58 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 16:58 | ToBeReplaced | futile: i think it depends -- use cases for both for sure |
| 16:58 | futile | ToBeReplaced: i like that answer a lot |
| 16:58 | futile | its not the fanboyish all-or-nothing approach of some idiots. |
| 16:58 | futile | :) |
| 17:04 | callen | not duplicating effort is valuable and reduces clojars noise. |
| 17:10 | ToBeReplaced | callen: what is that in reference to? |
| 17:12 | callen | I don't think it needs a prompt. |
| 17:13 | bbloom | callen: do you have a twitter account? |
| 17:14 | callen | bbloom: I feel like this is a setup for something. |
| 17:14 | callen | bbloom: I do. |
| 17:14 | bbloom | callen: not a few hours ago you were giving futile shit for saying something without context. now you're doing it. |
| 17:14 | justin_smith | I swear #clojure is turning into an epistolary novel with all the subtle intregues and indirect insults |
| 17:15 | callen | bbloom: it was in reference to the conversation about the connection pooling libraries. |
| 17:15 | callen | bbloom: I said it didn't need a prompt, I didn't say it didn't have one. |
| 17:15 | callen | bbloom: there are more valid reasons to harangue me than this. Find them and then raise cane with me. |
| 17:15 | rattboi | raise cain |
| 17:16 | futile | hey guys |
| 17:16 | futile | remember how we all love Clojure? |
| 17:16 | futile | lets agree that Clojure is pretty great, yeah? |
| 17:16 | rattboi | Clojure is awesome |
| 17:16 | futile | (inc rattboi) |
| 17:16 | lazybot | ⇒ 1 |
| 17:16 | callen | rattboi: so it is, thank you. |
| 17:16 | callen | (inc rattboi) |
| 17:16 | lazybot | ⇒ 2 |
| 17:16 | futile | is it pronounced Closure or Clo-jure? |
| 17:17 | callen | futile: Clozhure |
| 17:17 | callen | but quickly, you don't rest on the zh |
| 17:17 | callen | in french it'd be a dj |
| 17:17 | futile | do you emphasise the U or the O? |
| 17:17 | callen | errrr, j |
| 17:17 | callen | derp. |
| 17:18 | callen | futile: 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:18 | rattboi | I emphasize the O |
| 17:18 | futile | also, why does the Clojure wikipedia article have an example that does defn inside a let? that seems wrong |
| 17:18 | futile | rattboi: ive just been saying Closure. |
| 17:19 | Okasu | futile: Wikipedia seems mostly wrong, do not rely on it too much. |
| 17:19 | futile | Okasu: but surely *we* can fix the Clojure page up? |
| 17:19 | callen | futile: last time we tried to use Wikipedia, they deleted Hickey's page. |
| 17:19 | callen | I think we're scurred now. |
| 17:20 | futile | uhh |
| 17:20 | justin_smith | def[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:20 | futile | heh http://en.wikipedia.org/wiki/Rich_Hickey |
| 17:20 | futile | justin_smith: we should change it to look more idiomatic. |
| 17:20 | futile | the examples there. |
| 17:20 | futile | not that im qualified to do it.. |
| 17:22 | futile | ok, 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:22 | callen | futile: irish name. |
| 17:23 | futile | oh |
| 17:23 | callen | originally from "John" |
| 17:23 | callen | the sound went from "John" to "zhawn" to "shawn" |
| 17:23 | Okasu | Yawn. |
| 17:24 | Okasu | Extreme form John. |
| 17:24 | Okasu | of* |
| 17:24 | futile | ok thx guys |
| 17:26 | Okasu | callen: Wow, you mean like when time passes clojure well go forl "Clojure" to "Clozha" to "Closhaw"? |
| 17:26 | Okasu | s/well go forl/will go from/ |
| 17:28 | gtrak | justin_smith: not only is it not idiomatic, it'll break with threads |
| 17:28 | justin_smith | yet it claims to be threadsafe |
| 17:29 | callen | Okasu: lol |
| 17:29 | gtrak | where? |
| 17:29 | clojurebot | where is forget where |
| 17:30 | Okasu | gtrak: |
| 17:30 | Okasu | >A thread-safe generator |
| 17:30 | Okasu | https://en.wikipedia.org/wiki/Clojure |
| 17:30 | gtrak | doh.. that is fine |
| 17:30 | gtrak | sorry, I was thinking scheme's nested 'define' |
| 17:31 | justin_smith | gtrak: wait, I see an atom there, won't that be thread safe - or was that a recent edit? |
| 17:31 | justin_smith | heh, our conversation threads lost sync for a second there |
| 17:32 | gtrak | yea, I use defs within lets occasionally just to screw with my team |
| 17:32 | justin_smith | hey, sometimes you gotta keep secrets! |
| 17:33 | gtrak | sometimes you gotta understand when/how top-level things actually get evaluated ;-) |
| 17:34 | justin_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:34 | justin_smith | gtrak: so what is the pitfall with something like that? |
| 17:35 | justin_smith | I suspect it is probaly just some vestigal cl-based instinct being followed - but is it something that actually breaks things? |
| 17:35 | gtrak | oh, 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:35 | justin_smith | oh, yeah, sure |
| 17:35 | gtrak | and also during compile-time |
| 17:35 | justin_smith | yeah, so you don't want any state modifications in the let bindings |
| 17:36 | gtrak | generally, you should move your state to the top of your app |
| 17:36 | gtrak | so it's not bound to a namespace lifecycle, vars have the same problem. |
| 17:36 | gtrak | in that case of the symbol generator it doesn't matter |
| 17:36 | futile | gtrak: thanks for sharing about Datomic |
| 17:37 | gtrak | do you like it? |
| 17:37 | futile | After reading about 5 documents and blog posts and stuff on it, I finally get it. |
| 17:37 | justin_smith | we 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:37 | futile | I 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:38 | justin_smith | then rather than setting an atom in the lib, you pass config into lib functions |
| 17:38 | futile | gtrak: 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:39 | futile | srsly, 6 lines per single attribute! |
| 17:39 | Raynes | callen: 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:40 | callen | Raynes: I'm surprised it flew under Joe's radar. |
| 17:40 | gtrak | justin_smith: yea, that makes testing much easier (tractable at all) |
| 17:40 | callen | Raynes: in the meantime, use Elixir! |
| 17:40 | callen | Raynes: with Dynamo or Chicago Boss :D |
| 17:40 | futile | whoa, elixir looks crazy |
| 17:41 | Raynes | futile: 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:42 | futile | Raynes: oh neat |
| 17:43 | callen | Raynes: Jose is a very nice person. |
| 17:43 | callen | he's probably the only nice Rails core dev. |
| 17:43 | Raynes | He holds a special place in my heart. |
| 17:43 | futile | oh man, is he into Rails 'magic' philosophy? |
| 17:44 | callen | I don't think so. He's definitely into having nice tools though. |
| 17:44 | Raynes | Well, he made Elixir. |
| 17:44 | Raynes | So I don't think so. |
| 17:44 | noncom|2 | hi, 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:45 | noncom|2 | smth like (ns-resolve 'that-another-ns-alias (symbol (name defn-name))) does not work... |
| 17:45 | noncom|2 | says cant find that-another-ns-alias |
| 17:45 | justin_smith | noncom|2: (ns foo) (defn bar [] ...) (ns user) (require '[foo :as f]) (f/bar) |
| 17:46 | gtrak | noncom|2: (def the-new-var old-var-ns/old-var) |
| 17:47 | noncom|2 | i have the defn-name unknown at compile-time, so i think that i have to formulate somehting like that require |
| 17:47 | gtrak | ah, I thought you wanted to make an alias to the function |
| 17:47 | noncom|2 | like (require '[foo :as (symbol (name user-defined-name))]) |
| 17:48 | noncom|2 | gtrak: yeah, but that is dynamic, so i'm knoking my head at the wall now :) |
| 17:48 | gtrak | what is dynamic, the old one? |
| 17:48 | noncom|2 | oh nono, i mean it is known only at compile-time |
| 17:48 | gtrak | not sure what you mean |
| 17:48 | gtrak | what isn't known at run-time in clojure? |
| 17:49 | noncom|2 | a 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:49 | noncom|2 | but they are specified in different places |
| 17:49 | noncom|2 | namespace first |
| 17:49 | gtrak | ah, you want ns-resolve with aliases? |
| 17:50 | noncom|2 | yeah, i tried, but did not work. i guess maybe the require thing will work? |
| 17:51 | gtrak | check it out: https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L3943 |
| 17:51 | noncom|2 | i mean, ns-resolve does not accept smth like (ns-resolve (symbol (name use-defined-ns-name))) |
| 17:51 | gtrak | you can build up the env parameter from your current namespace, I believe |
| 17:51 | noncom|2 | i am fully unaware of what is env in clojure |
| 17:52 | noncom|2 | i mean envirinemnet |
| 17:52 | noncom|2 | oh my spelling/... |
| 17:52 | gtrak | user> (take 20 (ns-map *ns*)).....([sorted-map #'clojure.core/sorted-map] [read....... |
| 17:52 | gtrak | you should be able to figure it out from there |
| 17:52 | noncom|2 | ah that is |
| 17:52 | noncom|2 | yeah, i will have to go to study things |
| 17:53 | noncom|2 | this is basic, but i did not use it before |
| 17:53 | gtrak | the functions are here: http://clojure.org/namespaces |
| 17:53 | gtrak | it's nice that it's all data, like a lot of clojure |
| 17:54 | noncom|2 | not a word on envs though.. will have to dig up additional sources. |
| 17:54 | gtrak | ns-aliases? |
| 17:54 | gtrak | it's probably fastest just to read the impl |
| 17:54 | noncom|2 | yeah, about data - one day i found out that clojure namespaces are not maps! |
| 17:54 | noncom|2 | yeah, i think i will do it |
| 17:55 | gtrak | it's not something people do a lot.. |
| 17:56 | noncom|2 | btw, knowing that clojure nss are not maps, terrifies me in some way... |
| 17:56 | noncom|2 | :) |
| 17:56 | gtrak | objects are data too? ;-) |
| 17:56 | gtrak | or can be viewed as such |
| 17:57 | noncom|2 | hmmm.. all is data and all is code.. but not all is valid ahaha :) |
| 17:57 | noncom|2 | yeah, that's like hebrew. all their data is code and vice-versa |
| 17:58 | gtrak | all this fuss to flip some bits on the screen |
| 17:58 | noncom|2 | true and i won't even remember that in 1000 years after... |
| 17:59 | noncom|2 | or no, i'll be sitting and rememberin, contemplating on it, specially.. |
| 17:59 | noncom|2 | :)) |
| 18:02 | justin_smith | noncom|2: user> (require '[clojure.string :as s]) ;;; nil ;;; user> (resolve 's/join) ;;; #'clojure.string/join |
| 18:02 | justin_smith | |
| 18:02 | justin_smith | something like that should work for what you want, yes? |
| 18:03 | justin_smith | using (comp resolve symbol) on whatever the user provides (if they are providing a string) |
| 18:03 | squidz | dnolen: is it possible to create source maps yet for clojurescript |
| 18:03 | justin_smith | ,((comp resolve symbol) "clojure.string/join") |
| 18:03 | clojurebot | #'clojure.string/join |
| 18:04 | noncom|2 | so i will try now! |
| 18:04 | gtrak | clojures docs says 'same as (ns-resolve *ns* symbol)' |
| 18:05 | justin_smith | oh, ok |
| 18:05 | justin_smith | but does ns-resolve work with ns aliases in that way? |
| 18:05 | gtrak | *ns* isn't going to give you what you want at runtime |
| 18:05 | noncom|2 | hmmmm |
| 18:05 | gtrak | yea, seems like ns-resolve will do it |
| 18:06 | gtrak | but you should pass in a hardcoded ns symbol I guess |
| 18:06 | noncom|2 | but hey! looks like it went just fine! |
| 18:06 | gtrak | call it from another namespace? |
| 18:06 | gtrak | see how that goes |
| 18:06 | noncom|2 | i have this now: |
| 18:07 | noncom|2 | (let |
| 18:07 | noncom|2 | [mk-grabber ((comp resolve symbol) (str "jcv/" (name grabber-type))) |
| 18:07 | noncom|2 | ... |
| 18:07 | gtrak | if *ns* is a var.. then it's not going to work, I'm not sure if it is or not |
| 18:07 | noncom|2 | and 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:08 | noncom|2 | ,(type *ns*) |
| 18:08 | clojurebot | clojure.lang.Namespace |
| 18:08 | noncom|2 | oh |
| 18:08 | noncom|2 | well, (resolve) is same as (ns-resolve *ns*).... |
| 18:08 | gtrak | ,(class #'*ns*) |
| 18:08 | clojurebot | clojure.lang.Var |
| 18:08 | noncom|2 | oO |
| 18:08 | gtrak | it's for repl stuff |
| 18:09 | justin_smith | will ns-resolve work with aliased namespaces? |
| 18:09 | noncom|2 | let me try |
| 18:09 | gtrak | meaning, it's not getting reset all the time when your code runs, only at the repl and read/eval time. |
| 18:10 | noncom|2 | what you mean not getitng reset? |
| 18:10 | justin_smith | I have done (require '[clojure.string :as s]) - (resolve (symbol "s/join")) works, (ns-resolve 's 'join) does not |
| 18:11 | justin_smith | or am I using ns-resolve wrong? |
| 18:11 | noncom|2 | ahaha |
| 18:11 | noncom|2 | here:mk-grabber (ns-resolve (resolve 'jcv) (name grabber-type)) |
| 18:11 | noncom|2 | NullPointerException java.util.concurrent.ConcurrentHashMap.hash (:-1) |
| 18:12 | noncom|2 | (resolve 'a) |
| 18:12 | noncom|2 | ,(resolve 'a) |
| 18:12 | clojurebot | nil |
| 18:12 | squidz | stuartsierra: or do you maybe know? |
| 18:12 | stuartsierra | eh, what? |
| 18:12 | noncom|2 | hmmm, creating a meaningful example for clojurebot takes thinking... |
| 18:13 | noncom|2 | it's just that jcv is surely already aliased before it gets to that line |
| 18:13 | noncom|2 | in my code. |
| 18:13 | noncom|2 | ,(ns-aliases) |
| 18:13 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$ns-aliases> |
| 18:13 | noncom|2 | ,(ns-aliases *ns*) |
| 18:14 | clojurebot | {} |
| 18:14 | noncom|2 | oO |
| 18:14 | squidz | stuartsierra: what the status is about sourcemaps with clojurescript |
| 18:14 | stuartsierra | squidz: no idea |
| 18:14 | gtrak | hope 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:15 | noncom|2 | squidz: a little off-topic: in my experience clojurescript debugs like heaven with standard browser console |
| 18:15 | gtrak | *ns* isn't where the function lives. |
| 18:16 | bbloom | squidz: seangrove is the guy most recently tooling around w/ source maps |
| 18:16 | noncom|2 | gtrak: right, it's where it was called from, this is fine i guess? |
| 18:16 | gtrak | I thought you cared about aliases defined in your namespace? |
| 18:17 | gtrak | not the namespace that the user is in |
| 18:17 | squidz | bbloom: oh okay, does he get on the channel? |
| 18:17 | noncom|2 | ah, i see |
| 18:17 | noncom|2 | i seee waht you meen |
| 18:17 | gtrak | cool :-) |
| 18:17 | bbloom | squidz: yeah, he's here relatively frequently |
| 18:17 | gtrak | was hard to explain :-) |
| 18:17 | noncom|2 | sorry :)) |
| 18:18 | noncom|2 | i'll make a test now |
| 18:18 | seangrove | squidz: What do you need to know? |
| 18:19 | squidz | seangrove: if it is possible to create sourcemaps for clojurescript |
| 18:19 | noncom|2 | gtrak: yes, surely you're right, it fails when i'm not there |
| 18:19 | noncom|2 | oh man |
| 18:20 | gtrak | so.. back to 15 minutes ago :-), you'll have to hardcode the ns if that's what you want |
| 18:21 | noncom|2 | but is there a way to not hardcode it? |
| 18:21 | gtrak | unless there's a more convenient way... not sure |
| 18:21 | gtrak | ah, I have a terrible idea, let me try it |
| 18:21 | squidz | I 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:21 | noncom|2 | :)) |
| 18:22 | bbloom | squidz: clojurescript source maps are a work in progress, they are not available for general use yet |
| 18:22 | gtrak | simple :-) |
| 18:23 | gtrak | ,(namespace `ljldfljdfjldfljdsfljsdfljsdf) |
| 18:23 | clojurebot | "sandbox" |
| 18:23 | seangrove | bbloom: I think they're in there already |
| 18:23 | bbloom | seangrove: ok, you know better than me :-) you help squidz |
| 18:23 | seangrove | They 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:23 | seangrove | Let me try it... |
| 18:24 | squidz | seangrove: wow cool I really want to try it out |
| 18:24 | noncom|2 | gtrak: yeah, and when you said you have an idea, i recalled ns-find also! |
| 18:25 | noncom|2 | and it like wox with strs.. ? (namespace) is close to (ns-find) afaik.. |
| 18:25 | gtrak | right, backtick means the symbol doesn't have to actually exist... though, so that's not hardcoding anything :-) |
| 18:26 | noncom|2 | well, that's super-great! |
| 18:26 | noncom|2 | so now i can have fun with even more bad style dynamically resolving code :D |
| 18:26 | gtrak | heh, yes. I'd be curious if there's a better way. |
| 18:27 | gtrak | ah! |
| 18:27 | gtrak | it all comes back around, close over the value of *ns* at compile-time |
| 18:27 | gtrak | in a let |
| 18:27 | noncom|2 | ))) |
| 18:27 | noncom|2 | i'll try |
| 18:27 | noncom|2 | now |
| 18:28 | seangrove | Ah, I get an NPE with it. Lame. |
| 18:28 | gtrak | noncom|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:29 | noncom|2 | heh)) |
| 18:29 | squidz | seangrove: hmmm I would really like to test it out even though it's one line off |
| 18:29 | noncom|2 | good hacking this is |
| 18:31 | seangrove | squidz: I haven't used it from cljsbuild, checking it now |
| 18:32 | noncom|2 | but that feels a little crazy |
| 18:32 | squidz | seangrove: wow i'm crossing my fingers, that would be so cool |
| 18:33 | gtrak | noncom|2: pretty sure it'll work |
| 18:33 | seangrove | I'm getting an NPE, let me see if I can track it down |
| 18:33 | noncom|2 | yeah, it does! :) fun stuff. thank you! |
| 18:34 | squidz | I had no idea it was so close until I saw something about it yesterday |
| 18:34 | seangrove | squidz: What did you see yesterday? |
| 18:35 | squidz | I saw an article where somebody mentioned having the :source-map option in the cljsbuild options |
| 18:35 | justin_smith | gtrak: what was that we were saying about defn inside let? |
| 18:35 | justin_smith | lol |
| 18:35 | gtrak | justin_smith: right :-) |
| 18:35 | seangrove | Yeah, looks like it works, but you can't use optimizations :whitespace, it has to be at least :simple |
| 18:35 | gtrak | like i said, it's helpful to know how eval works.. |
| 18:36 | gtrak | especially if you like being nasty |
| 18:36 | seangrove | And 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:36 | seangrove | And after *that*, you have to copy all your source code somewhere the browser can find it |
| 18:37 | seangrove | Ah, and edit the *.js.map.merged file to point to the relative location of the copied source |
| 18:37 | squidz | seangrove: can you put an example in a gist. I really want to try it out |
| 18:37 | seangrove | I 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:37 | squidz | seangrove: it't really exciting |
| 18:37 | seangrove | Sure, One second |
| 18:38 | squidz | seangrove: thanks a ton. It's really nice of you |
| 18:39 | seangrove | squidz: No proble, just be ready to write me a clojure backend for reliably downloading imap emails |
| 18:39 | seangrove | Which is what I'm escaping from by making this gist... |
| 18:41 | justin_smith | sounds like a fair trade |
| 18:42 | seangrove | Gotta leverage all this source map work I've been doing somehow |
| 18:42 | squidz | seangrove: hehe, well I have no idea about imap emails. But if I could, I would |
| 18:42 | seangrove | It's not very pleasant, I wouldn't recommend it |
| 18:42 | squidz | is it for business? |
| 18:43 | seangrove | The imap stuff is, not source maps |
| 18:43 | squidz | because I can't imagine it's for pleasure |
| 18:43 | seangrove | It turns out to be pretty cool to query your inbox for all sorts of things from clojure |
| 18:43 | seangrove | But That's only after you have a local copy of it, etc. |
| 18:44 | squidz | for some kind of app? Do you have ideas of what you would do with the emails? |
| 18:48 | seangrove | Yup, works, one line off |
| 18:48 | seangrove | One second, will post the gist |
| 18:49 | squidz | seangrove: awesome work I really owe you one |
| 18:59 | seangrove | squidz: Try this https://gist.github.com/sgrove/6092756 |
| 19:00 | seangrove | Let me know if it works for you |
| 19:00 | squidz | okay i'll try it out now. Thanks so much. I'll tell you if I get it going |
| 19:01 | seangrove | Hopefully this can all be folded into cljsbuild at some point |
| 19:02 | seangrove | And 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:02 | seangrove | But there's remarkably little written about this stuff for source maps that I've been able to find so far |
| 19:03 | squidz | yeah i'm sure other poeple would like to see your write up |
| 19:04 | squidz | i'm getting this whin i try to run lein cljsbuild -> java.lang.Exception: Unknown build identifier: prod |
| 19:04 | squidz | is prod for production|/ |
| 19:04 | squidz | ? |
| 19:05 | seangrove | yeah |
| 19:05 | seangrove | Should be dev |
| 19:05 | seangrove | Updated |
| 19:06 | squidz | it says Unknown build identifier: dev |
| 19:06 | callen | Raynes: if not Elixir, there's always Go too >:) |
| 19:06 | Raynes | if I wanted to kill myself there are easier ways to do it, callen. |
| 19:06 | seangrove | squidz: Do you have a dev build id? |
| 19:07 | squidz | no |
| 19:07 | seangrove | Can you paste your project.clj somewhere? |
| 19:08 | squidz | seangrove: https://www.refheap.com/16946 |
| 19:08 | Raynes | Oh dear. |
| 19:08 | Raynes | That's impressive. |
| 19:09 | seangrove | squidz: Looks like you haven't updated it like the example in my gist |
| 19:10 | seangrove | You'll need to give your builds ids, and also to pass :source-map to the compiler section |
| 19:10 | squidz | h now I see the build id |
| 19:10 | seangrove | squidz: https://github.com/emezeske/lein-cljsbuild#multiple-build-configurations look at "optionally assign an id" |
| 19:11 | squidz | okay it compiled on to the next step |
| 19:14 | egghead | is there a 'best choice' for websockets in clj currently (preferably easily working w/ ring/compojure) |
| 19:17 | egghead | err, I guess I'll just want two web servers and a main method instead of lein ring, right? |
| 19:18 | squidz | seangrove: 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:19 | seangrove | squidz: Ignore them |
| 19:19 | seangrove | They're inside jar files anyway, browser won't be able to open them up |
| 19:21 | tomjack | hmmmmm https://www.refheap.com/0fdbc1b0180c4af8d46db6b10 |
| 19:26 | Raynes | O.O |
| 19:27 | squidz | seangrove: so if it works I should be able to see the clojurescript files in chromes debugger(I enabled source-maps in the settings) |
| 19:28 | callen | tomjack: hahahahahah what the fuck did you do? |
| 19:28 | seangrove | squidz: Yeah, more or less |
| 19:28 | seangrove | You should see them listed under sources |
| 19:30 | seangrove | squidz: Example: http://dl.dropbox.com/u/412963/Screenshots/ce.png |
| 19:31 | Raynes | AJ! |
| 19:31 | Raynes | AH! |
| 19:31 | Raynes | What is this it's scary. |
| 19:33 | callen | seangrove: source maps are live?! |
| 19:33 | seangrove | callen: They've been live for awhile, it's just not a full implementation |
| 19:33 | seangrove | But it'll get you down to the line number at least |
| 19:33 | callen | seangrove: :D :D :D |
| 19:34 | callen | seangrove: version? |
| 19:34 | seangrove | 0.0-1844 |
| 19:34 | seangrove | But as you can see from the gist above, it's *not* a smooth process |
| 19:34 | seangrove | A lost of it needs to be rolled into cljsbuild probably |
| 19:35 | squidz | shit i really want to get it but its not showing up |
| 19:35 | seangrove | squidz: What's the source-map comment at the end of the compiled js file, and from what url are you serving it? |
| 19:36 | squidz | oh i skipped the js comment |
| 19:38 | squidz | holy shit it works |
| 19:38 | squidz | thanks seangrove |
| 19:43 | seangrove | Ah, glad to hear it |
| 19:43 | seangrove | Spread the word squidz ;) |
| 19:43 | squidz | yeah I really should |
| 19:44 | squidz | my clojurescript file is found but it appears to be empty |
| 19:44 | seangrove | Try right-clicking and opening in a new tab |
| 19:44 | seangrove | What url is it at? |
| 19:45 | squidz | okay yeah its the wrong url |
| 19:47 | squidz | oh my god I can't believe this is working |
| 19:47 | squidz | with break points and everything |
| 19:47 | squidz | i'm as giddy as a school girl |
| 19:48 | squidz | I will spread the word |
| 21:11 | tomjack | callen: no clue.. |
| 21:11 | tomjack | not my POM.. |
| 21:19 | akurilin | Need 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:20 | akurilin | On 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:25 | callen | akurilin: NSDictionary is fine. |
| 21:25 | callen | that's a standard choice for any kind of JSON data. |
| 21:36 | akurilin | callen, as in, most people don't bother wrapping it in container classes with cozy typed properties/ |
| 21:36 | akurilin | *? |
| 21:36 | clojurebot | * is just for when you are lazy and sloppy |
| 22:13 | isaacbw | you guys |
| 22:13 | isaacbw | I love you so much |
| 22:17 | isaacbw | is there a function in core like C's strstr? |
| 22:17 | isaacbw | i.e get the position of a substring |
| 22:31 | isaacbw | does clojure have a core function for finding substrings? |
| 22:32 | bbloom | use regex |
| 22:32 | bbloom | (find-doc "re-") |
| 22:32 | r0bgleeson | my hair is awesome |
| 22:32 | isaacbw | I guess I can just use java.lang.String's indexOf as well |
| 22:33 | bbloom | or that |
| 22:56 | callen | akurilin: not necessarily. |
| 23:26 | isaacbw | would 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:26 | futile | isaacbw: for idiomaticity i would use refheap.com |
| 23:27 | futile | isaacbw: it looks like you're just recursing, which means you can ditch letfn and use recur |
| 23:27 | futile | ,(doc recur) |
| 23:27 | clojurebot | It's greek to me. |
| 23:27 | futile | aw |
| 23:27 | futile | isaacbw: also its usually more idiomatic in Clojure to rely on (possibly lazy) sequences rather than recursion |
| 23:28 | futile | and functions which act on sequences, like filter, reduce, etc. |
| 23:28 | futile | isaacbw: can you show me some sample usage for this function? |
| 23:29 | isaacbw | futile: here's a simple (not very useful) example https://www.refheap.com/16951 |
| 23:30 | isaacbw | this is for processing line-based network streams |
| 23:31 | futile | i guess i just dont understand it well enough |
| 23:31 | r0bgleeson | i am a line-based network stream |
| 23:31 | futile | i mean, that code prints "hi" but returns "there!". |
| 23:31 | isaacbw | more importantly, it prints "hi" and puts "there!" into the buffer |
| 23:31 | futile | isaacbw: so, itll do whatever function you give it to each line, and return the last one? |
| 23:32 | futile | hmm |
| 23:32 | isaacbw | so when more input comes in, line-buffering can continue where it left off |
| 23:32 | futile | isaacbw: i think i see. |
| 23:32 | isaacbw | though I guess I can get rid of the atom swapping in line-buffer and do that outside |
| 23:33 | futile | isaacbw: why not use clojure.string/split ? |
| 23:33 | futile | isaacbw: or even better: http://clojuredocs.org/clojure_core/clojure.string/split-lines |
| 23:33 | isaacbw | because I can't differentiate the result between (split "ab\nc") and (split "ab\nc\n") |
| 23:33 | futile | isaacbw: oh i think i see why you wouldnt want that, because you might not have a completed line at the end. |
| 23:34 | isaacbw | both return ["ab" "c"] |
| 23:34 | futile | heh i think i did this a few years ago when parsing irc messages. |
| 23:34 | isaacbw | yea |
| 23:34 | futile | ok let me think for a bit on this |
| 23:44 | futile | isaacbw: https://www.refheap.com/16952 |
| 23:44 | futile | im not perfectly content with it |
| 23:45 | futile | feels a bit wordy somehow. but this is the general approach i'd take |
| 23:45 | futile | yeah, wait, this is stupid. |
| 23:45 | futile | i got too juxt-happy |
| 23:47 | futile | ok second try: https://www.refheap.com/16953 |
| 23:49 | futile | i still dont like it. dont know why though. |
| 23:49 | isaacbw | ah, that's much more readable than what I had! |
| 23:49 | isaacbw | thank you! |
| 23:50 | isaacbw | this all requires a pretty different way of thinking |
| 23:50 | futile | yeah, ive been doing clojure full-time for 9 months and its still not natural for me yet |
| 23:51 | futile | i think the only way i get by is because i keep forcing myself to think in terms of sequences |
| 23:52 | futile | ,(conj [1 2 3] [4]) |
| 23:52 | clojurebot | [1 2 3 [4]] |
| 23:52 | futile | ,(concat [1 2 3] [4]) |
| 23:52 | clojurebot | (1 2 3 4) |
| 23:52 | futile | ok yeah thats what i should use. i dont trust conj ever. |
| 23:53 | futile | isaacbw: this always returns a string that you can append more data to and process in the same way. |
| 23:54 | futile | isaacbw: and by append i really mean pass (str old-buffer new-data) to the function |
| 23:55 | futile | ,(concat [1 2 3] []) |
| 23:55 | clojurebot | (1 2 3) |
| 23:55 | futile | oh hey that makes it simpler i think |
| 23:56 | futile | ,(concat [1 2 3] nil) |
| 23:56 | clojurebot | (1 2 3) |
| 23:56 | futile | woo! |
| 23:56 | futile | https://www.refheap.com/16954 |
| 23:56 | futile | its even simpler isaacbw |
| 23:58 | futile | guys, is there a way to do destructuring that works like butlast/last ? |
| 23:58 | futile | oh duh, reverse the seq. |
| 23:59 | futile | hmm, i cant tell if this made it better or worse: https://www.refheap.com/16955 |