2014-07-14
| 00:08 | justin_smith | Fare: have you tried flet or trampoline for said issues? |
| 00:09 | Fare | justin: not sure what exactly you propose |
| 00:10 | justin_smith | sorry, not flet, letfn |
| 00:10 | justin_smith | d'oh |
| 00:10 | justin_smith | both letfn and trampoline turn mutual recursion into looping that does not grow the stack |
| 00:11 | Fare | justin: right now I have 82 entries in the grammar and 9 forward references |
| 00:11 | Fare | in 260 lines. |
| 00:13 | justin_smith | trampoline can use functions defined outside the trampoline block - each step should return the next function to be called |
| 00:13 | Fare | so I'd like to keep it top-level definitions instead of one big form |
| 00:14 | Fare | justin_smith, my problem isn't tail recursion, it's plain mutual definition |
| 00:14 | justin_smith | too many declare blocks? |
| 00:26 | drusellers | if i have a function that takes in a sequence of functions how can I apply them all to the same 'object' / 'value'? |
| 00:26 | justin_smith | (doc juxt) |
| 00:26 | clojurebot | "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]" |
| 00:26 | drusellers | thanks |
| 00:27 | justin_smith | ,((apply juxt [inc identity dec]) 0) |
| 00:27 | clojurebot | [1 0 -1] |
| 00:27 | justin_smith | if they are in a list, you should use apply, as above |
| 00:28 | justin_smith | ,(map #(% 0) [inc identity dec]) drusellers: if you need laziness there is also this |
| 00:28 | clojurebot | (1 0 -1) |
| 00:31 | drusellers | ok. i'm looking for something a bit more like the thread macro |
| 00:31 | drusellers | if i could pass a seq of functions to a thread macro that would be what i'm looking for. I think. |
| 00:32 | drusellers | that or I'm doing this all wrong. |
| 00:32 | justin_smith | maybe you want comp |
| 00:32 | drusellers | (-> {} array-of-func) |
| 00:32 | justin_smith | or reduce |
| 00:33 | drusellers | comp looks good |
| 00:33 | justin_smith | ,((comp inc inc inc) 0) |
| 00:33 | clojurebot | 3 |
| 00:33 | drusellers | yes, closer to comp |
| 00:33 | justin_smith | with apply of course |
| 00:33 | drusellers | with apply |
| 00:33 | justin_smith | ,((apply comp [inc inc inc]) 0) |
| 00:33 | clojurebot | 3 |
| 00:34 | drusellers | YES |
| 00:34 | drusellers | apply comp was the magicness |
| 00:34 | justin_smith | the one trick is that the first function to use goes last in the list |
| 00:34 | drusellers | now I will go learn the crap out this |
| 00:34 | drusellers | order doesn't matter thankfully |
| 00:34 | drusellers | but good to know. |
| 00:35 | justin_smith | it uses the standard mathematical rules for functional composition, is why |
| 00:35 | justin_smith | ,((apply comp [:c :b :b]) {:a {:b {:c "buried"}}}) |
| 00:35 | clojurebot | nil |
| 00:35 | justin_smith | ,((apply comp [:c :b :a]) {:a {:b {:c "buried"}}}) oops |
| 00:35 | clojurebot | "buried" |
| 00:41 | drusellers | justin_smith thanks!! |
| 00:54 | kristof | Who was I talk to yesterday about dynamic scope? |
| 00:54 | kristof | https://www.gnu.org/software/emacs/emacs-paper.html#SEC18 |
| 00:55 | benkay | does anyone use system v init scripts to persist clojure apps? i'm having the damndest time setting environment variables (LEIN_ROOT=true, among them) and getting those passed to leiningen correctly |
| 00:56 | Fare | if I use a deftype or a defrecord, is it easy to (1) destructure the object, and (2) build a new object with just one or two fields modified? |
| 01:00 | ambrosebs | Fare: only with a record |
| 01:03 | Fare | ambrosebs, how do I do the destructuring and/or incremental modification of a record? |
| 01:03 | Jaood | benkay: any reason you are not using an uberjar instead of using lein? |
| 01:03 | ambrosebs | Fare: get/assoc |
| 01:05 | ambrosebs | kioos is spamming me |
| 01:05 | Fare | ambrosebs, wonderful! |
| 01:06 | benkay | Jaood: yeah. this app writes files to disk (at resources/public/output) and then serves those files via ring's wrap-resource. i need to keep these files around and back up other things getting written to various directories in resources/, and don't know how to get access to the inside of a jar. |
| 01:07 | webus | hello. why clojure official repo have very little num of commits ? is clojure developing stop ? |
| 01:07 | ambrosebs | webus: we think a lot. |
| 01:08 | Fare | wow, I'm impressed by clojure once again |
| 01:09 | benkay | Jaood: do you know how to backup files written to the classpath of a jar? |
| 01:10 | benkay | maybe i'm going about this the entirely wrong way. i could use the ring wrap-resources function to wrap resources off of the classpath, but i recall reading that it's only willing to serve resources off the classpath and not the host filesystem. is this at all true? |
| 01:14 | benkay | ugh i want to be using ring.middleware.file/wrap-file, writing to that dir and then serving out of there. |
| 01:20 | puredanger | webus: most feature development happens in branches, most defects/enhancements work is done in patches. at the moment work is focusing on some feature stuff. |
| 01:21 | puredanger | webus: definitely not stopped! :) |
| 01:21 | webus | cool |
| 01:25 | benkay | lisp is dead |
| 01:25 | benkay | ;) |
| 01:25 | xk05 | (never) |
| 01:37 | xk05 | the cardinality of lispyness may rise and fall and rise again or cruise through long periods of stability, but it will go on |
| 02:04 | Fare | (inc ambrosebs ) |
| 02:04 | lazybot | ⇒ 1 |
| 02:45 | Fare | how do I get the ref for a symbol? |
| 02:46 | mthvedt | Fare: you mean the var corresponding to a symbol in a ns? |
| 02:46 | Fare | a var |
| 02:47 | Fare | find-var maybe |
| 02:47 | mthvedt | #' |
| 02:48 | mthvedt | ,(println #’println) |
| 02:48 | clojurebot | #<ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException: 8217> |
| 02:48 | mthvedt | that is supposed to say #’clojure.core/println |
| 02:52 | mthvedt | fare: what are you trying to do with parser combinators |
| 02:57 | Fare | mthvedt, parse python |
| 02:59 | mthvedt | fare: consider a parser i wrote, https://github.com/mthvedt/clearley |
| 02:59 | mthvedt | parser generator, that is |
| 03:00 | Fare | how does it deal with line / column information? |
| 03:01 | Fare | I have a lexer that gives it |
| 03:02 | mthvedt | fare: nothing built in, but you can parse any seq of objects |
| 03:02 | mthvedt | so you could for example embed that into your lexer tokens |
| 03:02 | Fare | nice |
| 03:03 | Fare | well, I'll keep it in mind for the next rewrite |
| 03:03 | Fare | that's the kind of software I was looking for |
| 03:03 | Fare | but not having found it, I wrote my own parser combinators |
| 03:05 | Fare | how do you deal with debug information and tracing the errors to the source location? |
| 03:07 | mthvedt | you can print out parse trees and incomplete parse trees |
| 03:07 | mthvedt | it’s hard to do that stuff in a standard way. practical parsers usually have error detecting parse rules, and/or manual intervention in the code. since clearley didn’t take off as much as i hoped, i never got around to adding better ways |
| 03:09 | Fare | ok |
| 03:10 | Fare | right now, I track source location, but don't print very useful error messages. I have ideas how to: track the furthest lookahead you've got, and print a tree of the options that were expected then. |
| 03:11 | Fare | I don't know how well your framework supports it, but I'm *really* enjoying higher-order combinators |
| 03:12 | Fare | I have a (&non-empty-maybe-terminated foo) pattern where foo is one of the parser combinators |
| 03:13 | rritoch | Hi, is there anyone here who thinks they can help me with an IllegalStateException? This is a java-interop situation where there are two definterfaces and two gen-classes. One definterface inherits the parent definterface, the class implementing the child interface inherits a class that implements the parent interface. |
| 03:14 | rritoch | This is leading to an illegal state exception because the child interface accepts an argument for one of its methods, and the parent has the same method that doesn't accept an argument. |
| 03:15 | mthvedt | fare: rules before the parser builds them are just objects, you can combine arbitrary rules using ordinary functional programming |
| 03:27 | rritoch | Never mind this, I had syntax issues, it looks like I was able to clear up the illegal state using gen-class ... :exposes-methods |
| 04:07 | rritoch | Hi, does anyone know a good way to add java ee support to a clojure project? I'm trying to create a custom servletcontext for evaluating JSP templates from clojure but I'm not sure how to utilize the version of JavaEE installed on the users computer from project.clj |
| 04:10 | rbarraud_ | rritoch: what's the deployment environment look like? |
| 04:12 | rritoch | rbarraud: Eventually I plan on deploying these from tomcat servers, but I'm using ring |
| 05:28 | rritoch | After going the wrong direction repeatedly, I finally solved the javaee problem, I simply needed to add [javax/javaee-api "7.0"] to my dependencies >:) Much easier than expected, and magically this one line of code repaired everything |
| 05:37 | augustl | rritoch: didn't know that package existed, nice :) |
| 05:37 | augustl | I've usually added dependencies directly to jms, servlets, etc |
| 06:07 | mr-foobar | in clojure is there an alternate for mutexes ? need to sequence build-ish tasks |
| 06:12 | augustl | mr-foobar: there's always queues :) |
| 06:13 | mr-foobar | atom + q ? |
| 06:13 | augustl | or just a queue, and consume one item at a time |
| 06:14 | mr-foobar | hmm i don't know when the task1 or task2 will finish. their output is a file on the disk. |
| 06:15 | augustl | ah, you need mutexes for task completion, not ensuring only one task runs |
| 06:16 | augustl | mr-foobar: sounds like a good problem for core-async |
| 06:19 | mr-foobar | i could use messages like :task-done, :run-next i suppose. will give it a shot |
| 06:19 | rritoch | mr-foobar: You can use agents for what your trying to do if each operation "sent" to the agent triggers the next send but doesn't return until it's job is complete |
| 06:20 | rritoch | mr-foobar: agents only allow one operation at a time so calling the next send, the operation will stay on hold until the current one completes |
| 06:20 | mr-foobar | rritoch: sweet, that's exactly what i want |
| 07:02 | kras | Hi, I am reading Joy Of Clojure, I am at section 2.4 titled "Vars are not variables" |
| 07:02 | kras | I don't find a concrete description of why this statement is true anywhere in the section |
| 07:03 | kras | But the description of the Var tempts me into thinking its a variable |
| 07:03 | kras | any ideas? |
| 07:03 | scape_ | kras: from my experience, I rarely use vars like I do in other languages |
| 07:04 | scape_ | you rarely set and reset a var |
| 07:04 | scape_ | http://clojure.org/vars |
| 07:06 | scape_ | read that first paragraph, it explains it well |
| 07:06 | kras | scape_: thanks this explanation is way better than the one given in the book |
| 07:07 | kras | So a Var is special in the sense it has a root binding and it can be dynamically binded on a per thread basis |
| 07:07 | kras | right? |
| 07:07 | kerneis | yes |
| 07:07 | scape_ | I almost always use atom if I need to mutate something repeatedly, otherwise I use let and bind variables within a scope |
| 07:09 | kras | seem to get it now, thanks folks |
| 07:09 | kerneis | you can think of Vars as thread-local storage with a default (shared) value |
| 07:10 | kras | so if a thread changes it, the others still have the root binding with them? |
| 07:11 | kerneis | I'm not quite sure what happens for threads created within the new binding; but for other threads, created before you rebind, yes, definitely |
| 07:11 | yotsov | if a thread changes a var, the other threads will see the new value |
| 07:13 | yotsov | unless the var is ^:dynamic |
| 07:15 | kerneis | oh right… but is there any common use-case for non-dynamic vars in practice? |
| 07:15 | scape_ | yes |
| 07:15 | kerneis | like scape_, I tend to use atoms most of the time, except when I need per-thread bindings |
| 07:16 | kerneis | such as? |
| 07:16 | scape_ | constants |
| 07:16 | yotsov | non-dynamic vars are the usual vars, the ones you create with def or defn, and so on, so there are a lot of usecases for them. I guess you mean use cases for dynamic vars. I have not yet encountered one |
| 07:16 | scape_ | dynamic vars are less common |
| 07:17 | kras | back to square one I guess :-) |
| 07:17 | kras | So the non-dynamic vars are like variables but thread safe? |
| 07:17 | kerneis | then I probably don't understand the point of Vars either |
| 07:17 | yotsov | ah you mean if there is a practice promoting storing data in vars I guess, as oposed to in atoms. as scape_ said, for constants |
| 07:18 | yotsov | kras, vars are not intended to be modified except in exceptional circumstances. They are for functions, for constants |
| 07:19 | rritoch | kerneis brought up a important issue that I've been wondering about myself. What value do new threads inherit if the value has been rebound in the thread. This behavior seems to be undefined in the documentation. |
| 07:20 | scape_ | the root val |
| 07:20 | kerneis | the doc says "Bindings created with binding cannot be seen by any other thread" so I guess they see the root |
| 07:21 | kerneis | oh, of course static vars are used all the time when you define new functions, etc. - I'm a bit slow |
| 07:21 | Dutchsmoker_ | can someone help me with the peoplesign captcha? |
| 07:21 | Dutchsmoker_ | i just cant seem to find a way to beat it |
| 07:21 | kras | if "Vars provide a mechanism to refer to a mutable storage location that can be dynamically rebound (to a new storage location) on a per-thread basis." is true |
| 07:22 | kras | why then by default have non-dynamic vars |
| 07:22 | kras | all vars should be dynamic by default |
| 07:23 | kerneis | kras: Vars are what is used under the hood each time you use def/defn/etc. |
| 07:23 | kerneis | you don't want something dynamic for this, I guess |
| 07:24 | kerneis | but arguably, the doc is a bit confusing because it starts by presenting the dynamic use-case |
| 07:24 | kerneis | and only at the end mentions the use of static vars for defn |
| 07:24 | kerneis | it feels backwards |
| 07:25 | kras | "Functions defined with defn are stored in Vars, allowing for the re-definition of functions in a running program. This also enables many of the possibilities of aspect- or context-oriented programming. For instance, you could wrap a function with logging behavior only in certain call contexts or threads" |
| 07:25 | kras | this defnitely is useful |
| 07:25 | kras | in this case you want a dynamic var |
| 07:25 | kras | not a static one, right? |
| 07:26 | yotsov | if you want to be able to redefine a function on the repl, you want the function to be in a static var, otherwise it will only change in the thread of the repl |
| 07:27 | kras | Ok, so can I say that the non-dynamic vars are similar to variables in other languages? |
| 07:27 | kras | Global variables to be specific |
| 07:27 | yotsov | not really |
| 07:28 | yotsov | they are not intended to be used as variables |
| 07:28 | nbeloglazov | How are variables intended to be used, then? |
| 07:28 | nbeloglazov | To be fair, I rarely find myself changing variable in other languages too |
| 07:29 | silasdavis | I've noticed a strange bit of behaviour with a record when running tests using lein test-refresh |
| 07:29 | yotsov | nbeloglazov: fair point... |
| 07:29 | silasdavis | I have a record with a protocol implemented inline |
| 07:29 | silasdavis | from a repl, lein test, and other contexts my code works as expected |
| 07:30 | silasdavis | from test-refresh if I print the record object to console it shows up as #my.custom.Record{ ... } |
| 07:30 | kras | or this: static or non-dynamic vars are only to refer to some values and the dynamic vars are the real and only use cases? |
| 07:30 | silasdavis | but unlike in a repl it does not implement the interface my.custom.Protocol |
| 07:30 | yotsov | dynamic vars are a very exotic thing that is used almost never afaik |
| 07:31 | silasdavis | it seems to be a different version of the class, that has somehow missed implementing the protocol interface |
| 07:31 | silasdavis | so the protocol methods cannot be called on it |
| 07:31 | silasdavis | it is created with the (->Record ...) method that is generated for 'Record' |
| 07:33 | nbeloglazov | silasdavis: code + step-by-step instructions how to reproduce the issue would be helpful |
| 07:33 | silasdavis | it feels like a load order or revaluation thing, but I'm still getting a object of class #my.custom.Record |
| 07:33 | silasdavis | yeah maybe I can try and put together a minimal example |
| 07:41 | TimMc | yotsov: "Almost never" is overstating it. I see them from time to time. |
| 07:41 | TimMc | It often ends up being a bad idea, though! |
| 07:42 | scape_ | I see it mostly in libraries |
| 07:43 | scape_ | kras: http://blog.rjmetrics.com/2012/01/11/lexical-vs-dynamic-scope-in-clojure/ |
| 07:43 | TimMc | Anyone else getting spammed by "lammy"? |
| 07:43 | scape_ | the conclusion sums it up a bit |
| 07:44 | TimMc | scape_: Another problem is library instancing (or the lack thereof); if an app needs to use the library for two different things, it still only has one copy of that dynamic var. |
| 07:45 | scape_ | that's an interesting point, I never came across this but that makes sense |
| 07:46 | scape_ | TimMc: yes I did too |
| 07:46 | scape_ | mods awake? |
| 07:46 | scape_ | :) |
| 07:50 | kras | scape_: going back to my original question, yes vars are not variables in that they can have dynamic binding |
| 07:50 | kras | but then there are not many cases where this is useful |
| 07:50 | kras | and hence treat them as global constants |
| 07:50 | kras | is that is? |
| 07:50 | yotsov | TimMc: I was spammed too |
| 07:51 | kras | TimMc: yeah, I was spammed too |
| 07:51 | TimMc | OK, reported in #help. |
| 07:52 | honza | i was wondering if anyone could enlighten me as to the reason why all existing lisp tools in the editor realm (emacs, vim) now have clojure-specific alternatives? for example, SLIME for emacs has been replaced by cider and slimv by fireplace |
| 07:52 | honza | what is it about clojure that makes us abandon existing tools? are they not cool enough? |
| 07:52 | scape_ | kras: yes I do, I make use of thread safe mutations when necessary-- like atom |
| 07:53 | TimMc | Well, for one, developing in elisp apparently sucks. |
| 07:53 | honza | (i'm honestly asking, not trolling) |
| 07:53 | TimMc | (Actually, is cider written in elisp? I don't use it.) |
| 07:53 | honza | TimMc: everything for emacs is elisp, no? |
| 07:54 | Glenjamin | does slime have something equiavlent to nrepl? |
| 07:54 | TimMc | Yeah, except where it's done via embedded shell. |
| 07:54 | Glenjamin | editor/repl transport protocol with middleware |
| 07:57 | honza | you can add swank to lein and use that with slime, i think |
| 08:13 | TimMc | I just use lein repl. -.- |
| 08:13 | andyf | honza: I don't know the motivation for nREPL development myself, but you may be interested in this: https://github.com/clojure/tools.nrepl#why-nrepl |
| 08:23 | nobodyzzz | btw, is there a way to make lein faster on MacOS? I've tried several recipes I've googled but none of them seems to help |
| 08:24 | honza | here is the reason, i guess http://technomancy.us/163 |
| 08:24 | honza | old, quirky code essentially |
| 08:29 | kerneis | is it considered bad style to throw IllegalArgumentException in clojure (when a function gets parameters violating its invariants)? |
| 08:41 | scape_ | if your checking arguments in a function consider :pre and :post |
| 08:41 | scape_ | kerneis: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ |
| 08:42 | visof | hello |
| 08:43 | visof | in this page http://grepcode.com/file/repo1.maven.org/maven2/com.orientechnologies/orient-commons/1.0rc9/com/orientechnologies/common/profiler/OProfiler.java i want to import (import 'com.orientechnologies.common.profiler OProfiler$OProfilerHookValue)) with ClassnotFoundException |
| 08:43 | visof | how can i import OProfileHoodValue |
| 08:43 | visof | ? |
| 08:43 | kerneis | scape_: thanks |
| 08:45 | visof | also how can i convert this line to clojure OServer server = OServerMain.create(); (let [server OServerMain/create nil]) ?? |
| 08:45 | lazybot | visof: Definitely not. |
| 08:45 | visof | lazybot: what do you mean? |
| 08:45 | lazybot | It's AWWWW RIGHT! |
| 08:45 | nbeloglazov | visof : (let [server (OServerMain/create)] ...) |
| 08:46 | visof | nbeloglazov: i got CompilerException java.lang.IllegalArgumentException: No matching method: create, compiling:(/tmp/form-init7885630799929940797.clj:1:1) |
| 08:46 | visof | https://github.com/orientechnologies/orientdb/blob/master/server/src/main/java/com/orientechnologies/orient/server/OServerMain.java |
| 08:47 | scape_ | try OServer. or OServerMain. first, then run create; perhaps |
| 08:51 | visof | scape_: i did and i got NoClassDefFoundError Could not initialize class com.orientechnologies.orient.core.config.OGlobalConfiguration com.orientechnologies.orient.server.OServer.defaultSettings (OServer.java:726) |
| 08:53 | nbeloglazov | visof: are you sure you have all necessary dependencies? |
| 08:54 | visof | nbeloglazov: i'm using this https://github.com/orientechnologies/orientdb/wiki/Embedded-Server |
| 08:56 | nbeloglazov | visof: are you using lein? What dependencies are you using in project.clj? |
| 08:57 | visof | nbeloglazov: yeah i'm using lein deps : https://www.refheap.com/88149 |
| 08:59 | scape_ | maybe you have to instantiate it with some config info? IDK sorry :-\ |
| 09:01 | nbeloglazov | visof: I'm not sure what set of jars you need to run it. Have you tried to add "orientdb-core" as dependency? And where did you get this list of deps from? |
| 09:16 | mirf | hi peeps |
| 09:17 | mirf | C# refugee here |
| 09:17 | mirf | finding it hard to wrpa my noodle round some core concepts I think :) |
| 09:17 | mirf | of clojure, that is |
| 09:17 | ToxicFrog | Welcome! |
| 09:18 | mirf | :) thanks |
| 09:19 | onr | (he never welcomed me) |
| 09:32 | tbaldridge | mirf: I left the C# world about 3 years ago. The amount of anger I experience at my day job has dropped by 99% since then ;-) |
| 09:33 | tbaldridge | C# is a nice language, the frameworks around .NET....not so much |
| 09:33 | tbaldridge | mirf: but welcome! |
| 09:38 | bsima | Does anyone have experience working with complex numbers in Clojure? |
| 09:39 | bsima | This is really the only thing I found that was up to date: http://rosettacode.org/wiki/Arithmetic/Complex#Clojure |
| 09:55 | boxed | I have a datastructure like [:foo “foo data” :bar {:bar :data} :bar {:bar :data2}]… is there a way to destructure that nicely? |
| 09:56 | bsima | (get-in map [:bar :bar]) |
| 09:57 | bsima | http://grimoire.arrdem.com/1.6.0/clojure.core/get_DASH_in/ |
| 09:57 | bsima | That will return :data in your case |
| 09:59 | boxed | ,(get-in [:foo "foo data" :bar {:bar :data} :bar {:bar :data2}] [:bar :bar]) |
| 09:59 | clojurebot | nil |
| 09:59 | boxed | nope :P |
| 09:59 | bsima | oh I thought it was all a map, not a map inside a vector, oops |
| 09:59 | boxed | notice the duplicate :bar |
| 10:00 | boxed | yea, it’s a pretty shitty data structure, but I’m trying not to change it since it’s someone elses code |
| 10:00 | kerneis | boxed: I have a list->map function to convert such vectors to maps |
| 10:00 | nbeloglazov | boxed: what do you mean by "destructure nicely"? Regular destructure doesn't meet your needs? |
| 10:00 | bsima | Maybe combine it with get http://grimoire.arrdem.com/1.6.0/clojure.core/get/ |
| 10:01 | kerneis | (should be called vec->map obviously) |
| 10:01 | kerneis | (apply hash-map (map-indexed #(if (even? %1) (keyword %2) %2) vec) |
| 10:02 | tbaldridge | boxed: yeah, change that structure asap, unless the structure truly is order dependent |
| 10:02 | kerneis | boxed: oh, in your case (apply hash-map vec) would even be enough |
| 10:02 | kerneis | (I have strings as keys in my case) |
| 10:02 | boxed | tbaldridge: not my structure, it’s https://github.com/jafingerhut/clojure-cheatsheets/blob/master/src/clj-jvm/clojure-cheatsheet-generator.clj and I want to be able to consume that and convert it into something usable… and I don’t want to change the structure because then I can’t keep using changes to the original repo |
| 10:03 | boxed | ,(apply hash-map [:foo "foo data" :bar {:bar :data} :bar {:bar :data2}]) |
| 10:03 | clojurebot | {:bar {:bar :data2}, :foo "foo data"} |
| 10:04 | boxed | kerneis: that throws away the first :bar thingie |
| 10:04 | scape_ | try merge maybe |
| 10:05 | boxed | tbaldridge: tell me about it.. I was just gonna throw something nice together real quick and then I find that this is the data structure >_< |
| 10:05 | tbaldridge | And kids, this is why we don't use vectors to imply meanings of things. ["Some Command" :cmds '[foo bar]] tells me nothing. {:desc "Some Command" :type :cmds :symbols '[foo bar]} tells me lots. |
| 10:05 | tbaldridge | </rant> |
| 10:06 | boxed | maybe I should just destructure it to [x y z w q] and assert x = :foo, z = :bar, w = :bar |
| 10:07 | boxed | feels icky |
| 10:07 | nbeloglazov | boxed: do you know the structure of the vector? |
| 10:07 | nbeloglazov | Like, what it consists of. Does it consist of name-value pairs? Or something else |
| 10:08 | boxed | nbeloglazov: yea, see the above URL.. but I want something that breaks in a usable way if that structure changes |
| 10:10 | kerneis | in this specific case, you will need ad-hoc conversion, yeah (because of stuff like :subsection "foo" :table t :subsection "bar" :table v, which really should be {:subsections {"foo" t "bar" v}} imho |
| 10:13 | nbeloglazov | Ok, it's still not clear not me what we're talking about. Are we talking about top-level structure, or page-desc, or box-desc, or something else? :) |
| 10:15 | boxed | nbeloglazov: well all of it I guess :P I want to convert that fugly data structure into something that doesn’t suck |
| 10:20 | boxed | I guess I’ll have another go at seqex again :/ |
| 10:29 | scape_ | boxed: what about? (merge-with union {:b [:d1]} {:b [:d2]}) |
| 10:31 | boxed | ,(merge-with clojure.set/union [:foo "foo data" :bar {:bar :data} :bar {:bar :data2}]) |
| 10:31 | clojurebot | #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)> |
| 10:33 | boxed | bah, well.. anyway the result is [:foo "foo data" :bar {:bar :data} :bar {:bar :data2}] when I tried it, which is the input |
| 10:35 | scape_ | ,(use 'clojure.set) |
| 10:35 | clojurebot | nil |
| 10:35 | scape_ | ,(merge-with union {:b [:d1]} {:b [:d2]}) |
| 10:35 | clojurebot | {:b [:d1 :d2]} |
| 10:35 | scape_ | probably still not what you need tho |
| 10:36 | tbaldridge | boxed: clojure.set/* only works with hashsets |
| 10:37 | boxed | yea, not what I want :( |
| 10:37 | tbaldridge | more correctly it works with others, but does odd things |
| 10:37 | scape_ | why the {:bar {:bar ..}} seems redundant |
| 10:37 | AeroNotix | do people still use Korma and if so, how well does it integrate with stuartsierra's components? |
| 10:38 | philandstuff | ,(let [{foo 1, bar 3} [:a :b :c :d]] [foo bar]) |
| 10:38 | clojurebot | [:b :d] |
| 10:38 | boxed | scape_: it is. As I said, not my code… it’s a format that is made just to print the output into HTML/Latex and it shows |
| 10:40 | boxed | seems like seqex should be a perfect match for this problem, but I can’t figure it.. fuck it, I’ll just bind everything and assert a bunch of crap |
| 10:42 | whodidthis | korma is dumdum, yesql is where its at |
| 10:50 | geardev | What are some issues I might run into when scaling a clojure app? |
| 10:50 | tbaldridge | geardev: depends on the app, depends on what you mean by scaling |
| 10:51 | geardev | What does clojure and community do better than erlang? What does erlang and community do better? What are their weaknesses compared to the other? I'm trying to figure out when you would use one or the other |
| 10:52 | tbaldridge | Well to be honest I think Erlang adds a bunch of complexity that most apps don't need. Just setup RabbitMQ, JMS, etc, and then have your clojure apps connect to that. |
| 10:53 | geardev | tbaldridge: I have no clue what I mean. I'm guessing it means able to handle all the requests coming from users? |
| 10:53 | tbaldridge | Let distributed queues handle all the message retrying and all the complex distributed stuff, your clojure app can then be put on multiple machines, machines are free to die as needed. |
| 10:55 | tbaldridge | As a co-worker told me once "what's the first thing people do with Erlang? Build a distributed message queue...why not just start with one written in Erlang like RabbitMQ. Let the queue people worry about that stuff, let your app worry about the app stuff." |
| 10:56 | boxed | gear: “from users”? you mean from a browser? or do you mean from a telephone system like what erlang was originally made for? |
| 10:57 | philandstuff | geardev: well what's your expected volume of users? what are their needs? |
| 10:58 | geardev | boxed: browser, i only know how to build browser apps |
| 10:58 | geardev | s/browser/web |
| 10:58 | philandstuff | some apps can scale massively just by sticking a CDN in front of them |
| 10:58 | tbaldridge | (inc philandstuff) |
| 10:58 | lazybot | ⇒ 1 |
| 10:58 | philandstuff | others need to put more effort in |
| 10:59 | philandstuff | read-heavy vs write-heavy workloads, fully up-to-date vs okay-to-be-a-little-stale, etc etc |
| 10:59 | geardev | philandstuff: expected volume ~2,000,000 tranactions max at any one time |
| 10:59 | tbaldridge | geardev: philandstuff: my favorite blog post about the CDN approach (or one like it) http://www.colinsteele.org/post/27929539434/60-000-growth-in-7-months-using-clojure-and-aws |
| 10:59 | geardev | i've never built anything this big before, so it's exciting but scary |
| 10:59 | tbaldridge | geardev: 2M transactions max at any one time |
| 11:00 | tbaldridge | define one time. throughput needs a X per Y where Y is time |
| 11:00 | gfredericks | tbaldridge: one time! |
| 11:00 | geardev | gfredericks: :) |
| 11:00 | geardev | tbaldridge: ~5minutes |
| 11:00 | geardev | or less |
| 11:00 | gfredericks | it's like how I'm seven lengths tall |
| 11:01 | tbaldridge | , (/ 2000000 5 60) ; in sec |
| 11:01 | clojurebot | 20000/3 |
| 11:01 | geardev | gfredericks: hah, that's a good analogy :) |
| 11:01 | tbaldridge | DANGIT CLOJURE! |
| 11:01 | tbaldridge | , (int (/ 2000000 5 60)) ; in sec |
| 11:01 | clojurebot | 6666 |
| 11:02 | tbaldridge | that's not bad, a sufficiently sized queue service should be able to handle something like that, but test first. |
| 11:05 | bozhidar` | I'm thinking of submitting a talk proposal for clojure/conj about the evolution of CIDER and the transition from eval-based to middleware based tooling. Do you think such a talk might be of interest to the broader Clojure community? |
| 11:06 | tbaldridge | geardev: take a look at Kafka (immutable distributed queue) or Amazon Kinesis (if on AWS) |
| 11:07 | philandstuff | bozhidar`: LIKE |
| 11:08 | Glenjamin | (inc bozhidar`) |
| 11:08 | lazybot | ⇒ 1 |
| 11:10 | tbaldridge | bozhidar`: I'm on the fence with that one, this switch to middleware has added a ton of complexity, meaning that CIDER ends up being quite a bit more buggy (in my experience). Perhaps a bit of the talk could focus on how this new approach is simpler? Not just easier? |
| 11:13 | bozhidar` | tbaldridge: I'm surprised to hear that. In my own experience the pre-middleware approach was extremely buggy. :-) |
| 11:13 | bozhidar` | (not to mention it was impossible to support ClojureScript properly back then) |
| 11:14 | tbaldridge | and perhaps that sort of comment is too open to interpretation. So perhaps a few minutes spent on the rationale behind the switch to middleware, and how it simplifies things? |
| 11:16 | bozhidar` | Yeah, of course. I'm planning to start the talk with a retrospective on the pre-middleware era and discuss its virtues (simple setup) and shortcomings (like complex inlined code, the need for a tooling session, the implicit dependency on libs like core.complete, etc) |
| 11:16 | boxed | https://github.com/dcolthorp/matchure seems to be more like what I need |
| 11:17 | tbaldridge | (inc bozhidar`) |
| 11:17 | lazybot | ⇒ 2 |
| 11:19 | bozhidar` | This was definitely not a decision that was taken lightly. Most of the problems introduced by the middleware switch are caused by CIDER's need for sync evaluation here and there (due to Emacs limitations) and this was originally implemented as an infinite loop that was often causing deadlocks in case of server-side exceptions |
| 11:20 | geardev | tbaldridge: thank you so much for your helpful responses |
| 11:20 | tbaldridge | geardev: np |
| 11:21 | bozhidar` | it's still an infinite loop, but at least now it has a timeout which should prevent the nasty deadlocks |
| 11:21 | martinklepsch | (sort (map :key (-> aggregation :aggregations :inventors :buckets))) — suggestions how to make this simpler? |
| 11:22 | bozhidar` | martinklepsch: seems pretty simple as it is :-) |
| 11:22 | tbaldridge | (->> aggregation :aggregations :inventors :buckets (map :key) sort) |
| 11:22 | tbaldridge | not sure if it's simpler, but maybe? |
| 11:22 | Glenjamin | i'd use a get-in |
| 11:22 | Glenjamin | it's a bit more explicity |
| 11:22 | martinklepsch | tbaldridge, hah, that was what I tried first but used the wrong threading macor |
| 11:23 | Glenjamin | (sort (map :key (get-in aggregation [:aggregations :inventors :buckets])) |
| 11:23 | kerneis | martinklepsch: -> appends as first param, ->> as last |
| 11:23 | kerneis | both are really the same, it just depends whether where the functions you are using expect their parameters |
| 11:23 | bozhidar` | martinklepsch: expand a few with macroexpand and will all become clear |
| 11:24 | martinklepsch | kerneis, I tried something like (-> x :a :b #(map :key %) sort) |
| 11:24 | justin_smith | martinklepsch: you need an extra () around the lambda |
| 11:24 | justin_smith | otherwise it expands to #(map <something> :key %) |
| 11:25 | martinklepsch | justin_smith, ah, ok. that makes sense |
| 11:26 | martinklepsch | thanks! :) |
| 11:41 | mwelt | hi |
| 11:42 | mwelt | (deftest foo (testing "bar") (is nil nil)) |
| 11:42 | mwelt | FAIL in (foo) (test.clj:33) |
| 11:42 | mwelt | expected: nil actual: nil |
| 11:42 | mwelt | bug or feature? |
| 11:42 | bozhidar` | (is (= nil nil)) |
| 11:42 | justin_smith | mwelt: is tests if its arg is truthy |
| 11:42 | justin_smith | the second arg is an optional reporting string |
| 11:43 | puredanger | prob want (deftest foo (testing "bar" (is (= nil nil)))) |
| 11:43 | mwelt | ah k ty :) |
| 11:43 | justin_smith | or (deftest foo (is (= nil nil) "nil is nil")) |
| 11:44 | mwelt | this does make sense to me now ^^ |
| 11:44 | mwelt | i overread (= ...) in documentation examples |
| 11:44 | mwelt | thx a lot |
| 11:46 | Fare | ok, my python parser is basically working. Now to transform the parse tree into clojure code... |
| 11:46 | tbaldridge | Fare: oh, now that sounds interesting |
| 11:47 | tbaldridge | esp when it comes to mutable objects.... |
| 11:47 | tbaldridge | or are you just mapping Python syntax to clojure? |
| 11:54 | mlb- | does the community have an opinion on a binary data manipulation library? |
| 11:59 | Fare | tbaldridge, so far, I'm not doing anything yet with the parse tree. My immediate plan is to trivially generate s-expression trees, and leave the source code location in meta-information. |
| 11:59 | Fare | then write a bunch of macros to give a semantics to that tree |
| 12:00 | Fare | then maybe write a micropass compiler. |
| 12:01 | tbaldridge | Fare: have you taken a look at tools.analyzer? |
| 12:01 | tbaldridge | Write a few tree transformations and you should be good to go. |
| 12:02 | Fare | interesting |
| 12:03 | tbaldridge | tools.emitter.jvm takes ASTs from tools.analzyer (they're just hashmaps) and spits out compiled java classes. |
| 12:04 | Fare | it looks promising, but the README is a bit sparse — where is the documentation? |
| 12:04 | arrdem | Fare: the code is the documentation T_T |
| 12:04 | Fare | my ASTs so far are vectors [tag data source-information] |
| 12:04 | Fare | arrdem, Works For Me(tm)... or not. |
| 12:05 | arrdem | Fare: the good news is that Bronsa, tbaldridge and I are the only people on earth who do use it and we're pretty active here :P |
| 12:05 | Fare | examples? |
| 12:05 | clojurebot | examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples |
| 12:06 | arrdem | brb I seem to have nuked ~/ |
| 12:12 | hiredman | cd sa-safe |
| 12:12 | hiredman | whoops, pardon me |
| 12:14 | devn | What talks, blog posts, etc. are your favorite on: "Why Clojure?" written towards someone who spends more of their time on the business side than the programming side? |
| 12:15 | puredanger | this is not exactly that, but I love this talk by Stu http://www.infoq.com/presentations/Clojure-tips |
| 12:16 | devn | puredanger: Thanks. it's weird because I feel like I've read posts or seen talks that tackle this |
| 12:16 | devn | but i think for the most part they are still aimed pretty squarely in the direction of "developer" |
| 12:17 | bbloom | devn: trying to sell clojure to your boss? :-P |
| 12:18 | devn | bbloom: nah, just trying to write something up for potential clients who are like: "Wait, why clojure?" |
| 12:18 | Glenjamin | simple made easy is the big one for me |
| 12:18 | puredanger | yeah, I think we could be better at telling this story. Stu's talk above does address this (but also other things) |
| 12:18 | Glenjamin | oh sorry |
| 12:18 | Glenjamin | didn't fully read |
| 12:18 | arrdem | devn: I think the TL;DR of "Out Of The Tarpit" and Clojure's design philosophy is that Clojure is a tool for programmers designed to help programmers escape obvious pitfalls and be able to spend more time working on the business side of the project and less time just bludgeoning it into working. |
| 12:18 | bbloom | devn: are they concerned about maintaining your work after you've completed the project? |
| 12:19 | devn | bbloom: it might be, it might also be to someone who has no business picking the technology, in which case we would probably feel pretty comfortable saying: look, this is the right answer, so we're going to do it in clojure, but if you're curious about why we're doing that, check this out. |
| 12:20 | bbloom | devn: often i find you can better address such concerns by not answering the question they have, but by uncovering their fears and reassuring them |
| 12:20 | tbaldridge | devn: have you read Colin's posts? http://www.colinsteele.org/tagged/clojure |
| 12:20 | devn | not all of them, but ill trawl through them |
| 12:20 | arrdem | tbaldridge: I list your "feature request" in my "Of Mages and Grimoires" as something I'd like to build :P |
| 12:22 | devn | puredanger: im surprised i missed this talk. this is helpful. thanks. |
| 12:22 | bbloom | devn: my suggestion would be to avoid "why clojure" and focus on "*JAVA's* jvm: an industry standard" and "Clojure" a "java-based programming language favored by some of the smartest most productive" startups in silicon valley |
| 12:23 | bbloom | devn: i suspect that would quash the primary fears |
| 12:23 | devn | bbloom: yeah, that's kind of the route i'm looking at |
| 12:23 | tbaldridge | bbloom: cargo-culting FTW!!!! |
| 12:23 | tbaldridge | :-P |
| 12:23 | devn | BUT -- i think some people will roll their eyes at the startup thing |
| 12:23 | devn | and rightly so |
| 12:23 | bbloom | tbaldridge: that's what you gotta do to get the deal closed to protect clients from themselves |
| 12:23 | bbloom | that's part of the job :-) |
| 12:23 | devn | they work 120 hour work weeks |
| 12:23 | devn | so of course they're "productive" |
| 12:23 | devn | ;) |
| 12:24 | bbloom | devn: basically you make them not afraid of a word they haven't heard before, and make them feel special for being among silicon valley's finest |
| 12:24 | bbloom | then go back to work :-) |
| 12:25 | devn | there are a few audiences: "So you're building an app..." "So you've been building apps for years and you want us to help build part of it..." "So you've been building apps for years and you need a new app that lives in the same ecosystem..." |
| 12:25 | mbac | what's the answer if the client says "how are we going to find people who can maintain this clojure thing after you leave?" |
| 12:26 | devn | mbac: depends a lot on who they are as a client: what their resources are, etc. |
| 12:27 | devn | for companies who can afford to have decent programmers, that's not an issue. for companies which can't, then finding someone smart who is willing to get paid a lower rate and work on it is possible. for companies with lots of devs, there are lots of options: "Do you want to train a dev to maintain this by having them work with me/us?" etc. |
| 12:28 | bbloom | mbac: more likely to get a smarter candidate for less money :-P |
| 12:28 | devn | ding ding |
| 12:28 | devn | big value proposition in that, but it's also not free |
| 12:28 | mbac | why less money? |
| 12:28 | puredanger | Neal Ford's talk from the Conj is maybe useful https://www.youtube.com/watch?v=2WLgzCkhN2g |
| 12:28 | devn | since recruiting and interviewing and so on costs time |
| 12:28 | devn | and money |
| 12:29 | bbloom | mbac: because there's lots of young aspiring hackers who would rather work on something fun and be the hero, than be yet another faceless number in a big shop w/ dull tools |
| 12:29 | bbloom | mbac: less experience, so they command a lower rate |
| 12:29 | mbac | oh i see |
| 12:29 | bbloom | mbac: but greater exposure & curiosity, so likely to be better than even quite a bit experienced folks |
| 12:30 | devn | bbloom: that was me early on in my career. not much experience but a strong desire to do something interesting, new |
| 12:30 | bbloom | it's quite common |
| 12:30 | devn | bbloom: step 1, start a clojure meetup group, step 2, hire most of the people who go to it more than once, step 3 profit |
| 12:30 | bbloom | plus, you get to stay on as a consultant to onboard that guy :-P |
| 12:32 | devn | bbloom: yeah, honestly i think my answer these days is still: "ill find you someone." |
| 12:32 | bbloom | yup |
| 12:33 | devn | because ive seen recruiters reallllly fail to hire clojure programmers |
| 12:33 | bbloom | recruiters are, almost without exception, useless |
| 12:33 | devn | totally missing the boat on what makes those kinds of people tick |
| 12:34 | devn | i once offered a local company my help and rewrote their job posting for them |
| 12:34 | bbloom | did you bill them for that? haha |
| 12:34 | devn | they then proceeded to contact me 3 different times for the job |
| 12:34 | devn | "we see that you're a clojure programmer" |
| 12:34 | bbloom | d'oh |
| 12:36 | tbaldridge | I can't tell you how many times I've been contacted by recruiters "I see on your resume you know .NET and live in the Madison area", "what's the date on that PDF you have", "2012" "yeah about that...." |
| 12:36 | technomancy | honza: saw your Q about slime from hours ago. the main problem was that slime doesn't have a documented, stable network protocol to build from. it's totally implementation-defined, and at the time the slime devs were not very interested in supporting anything other than the emacs<->CL combination. |
| 12:37 | justin_smith | add to that, the fact that the recommended way of using slime was to check it out of git and keep updated with master |
| 12:37 | technomancy | justin_smith: oh man, if only |
| 12:37 | technomancy | it was CVS |
| 12:37 | bbloom | tbaldridge: when i worked at msft fulltime, i got so many vendor-company recruiters trying to get me a contract at microsoft |
| 12:37 | devn | tbaldridge: i think madison's recruiting is particularly weird and bad |
| 12:38 | tbaldridge | I've worked with some groups that ended up being okay, but yeah in general recruiting is just weird |
| 12:38 | devn | the same people trying to fill a clojure position are the people who are hiring a safety engineering manager at kraft foods or something |
| 12:38 | devn | spread too thin in terms of expertise about certain types of industries and the people who inhabit them |
| 12:39 | tbaldridge | bbloom: there was a story on the Daily WTF the other day about a guy who was trying to find his replacement while looking for a new job. A recruiter never caught on that his candidate and the interviewer were the same guy. |
| 12:40 | bbloom | i particularly enjoy this story: http://www.ewherry.com/2012/06/the-recruiter-honeypot/ |
| 13:01 | Kneiva | is it possible to solve this kind of problems with core.logic? http://oi59.tinypic.com/s27ddw.jpg |
| 13:01 | justin_smith | woah the "also enjoy" on that page was intense |
| 13:02 | arrdem | [NSFW] ^ |
| 13:03 | arrdem | Kneiva: core.logic probably buys you nothing, that's a linear algebra problem not a constraint solving problem. |
| 13:03 | justin_smith | oh of course, it's because it was tagged [balls], for a ball puzzle, that explains it |
| 13:03 | cbp | o dear |
| 13:03 | hiredman | Kneiva: core logic includes some finite domain stuff which lets you reason over numbers, so if you turn the pictures in to algebra I think it can solve it |
| 13:07 | Kneiva | hiredman: I tried that but failed miserably |
| 13:07 | magopian | ,(-> "test" #(str "you can't do that it seems:" %1)) |
| 13:07 | clojurebot | #<CompilerException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.ISeq, compiling:(NO_SOURCE_PATH:0:0)> |
| 13:07 | arrdem | magopian: look at that with macroexpand and it'll make sense |
| 13:07 | magopian | ,(macroexpand (-> "test" #(str "you can't do that it seems:" %1))) |
| 13:07 | clojurebot | #<CompilerException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.ISeq, compiling:(NO_SOURCE_PATH:0:0)> |
| 13:08 | arrdem | you have to quote the expression for macroexpand. |
| 13:08 | arrdem | &(macroexpand '(-> "test" #(str "you can't do that it seems:" %1))) |
| 13:08 | lazybot | ⇒ (fn* "test" [p1__20805#] (str "you can't do that it seems:" p1__20805#)) |
| 13:08 | magopian | ah, thanks arrdem ;) |
| 13:09 | arrdem | magopian: does the error make sense now? |
| 13:09 | magopian | not sure i understand the output though :/ |
| 13:09 | magopian | it's not a function anymore |
| 13:09 | arrdem | right. #() is a reader macro that expands into (fn [..] ..). |
| 13:09 | magopian | let me look at the docs for fn* |
| 13:09 | arrdem | fn* is a special form. |
| 13:10 | arrdem | http://grimoire.arrdem.com/1.6.0/clojure.core/fn_STAR |
| 13:10 | arrdem | hum... |
| 13:10 | arrdem | that should be a thing. |
| 13:10 | tbaldridge | it's a special form ;-) |
| 13:10 | arrdem | http://grimoire.arrdem.com/1.6.0/clojure.core/fn/ |
| 13:10 | magopian | wow, this looks nice! |
| 13:11 | arrdem | tbaldridge: right. I added special forms on friday :P |
| 13:11 | magopian | this webste |
| 13:11 | magopian | it looks very sexy |
| 13:11 | magopian | i'll bookmark that straight away |
| 13:11 | arrdem | :D |
| 13:12 | honza | technomancy: thanks for the clarification |
| 13:14 | hiredman | Kneiva: you might have an easier time with https://github.com/clojure-numerics/expresso |
| 13:14 | magopian | honza: hey, you here? :) |
| 13:14 | hiredman | (dunno, I've never used it) |
| 13:14 | magopian | honza: is elasticsearch going to be rewritten in clojure? :) |
| 13:15 | honza | magopian: i think you might have the wrong honza :) |
| 13:15 | magopian | ah, sorry ;) |
| 13:15 | magopian | there's a "honza kral" who is a core contributor of elasticsearch |
| 13:15 | magopian | sorry ;) |
| 13:15 | honza | magopian: mr honza kral is a celebrity, i get this a lot |
| 13:16 | magopian | :) |
| 13:16 | magopian | arrdem: anyway, not sure I understand how/why it's not working from reading the macroexpand, but i understand that a reader macro get "expanded" before a standard macro |
| 13:17 | magopian | so i understand it may just go awry ;) |
| 13:17 | magopian | (and is there some documentation somewhere to explain what fn* does?) |
| 13:24 | Kneiva | hiredman: thanks, I'll give it a try |
| 13:25 | geardev | all data structures in clojure aren't necessarily lazy, correct? |
| 13:25 | technomancy | geardev: only seqs |
| 13:26 | nathan7 | and delays, if you can call them data structures |
| 13:27 | geardev | technomancy: ty |
| 13:29 | bbloom | i wish somebody would fix the reflection warnings in nrepl, etc |
| 13:30 | bbloom | clojure/tools/nrepl/... and complete/core.clj produce quite a few warnings when i start lein repl w/ reflection warnings on |
| 13:32 | puredanger | i wish that stuff was open source ;) |
| 13:33 | puredanger | (sorry, feeling saucy :) ) |
| 13:33 | bbloom | puredanger: i dunno about wherever "complete" comes from |
| 13:33 | technomancy | https://github.com/ninjudd/clojure-complete |
| 13:34 | technomancy | weird that it reflects at boot though |
| 13:34 | bbloom | puredanger: but whenever i see a project w/ clojure/... in front, i tend to assume that complaining is just as effective as fixing it myself (not very) |
| 13:34 | bbloom | technomancy: https://gist.github.com/brandonbloom/4ba5cac0acc34275e07d |
| 13:35 | bbloom | let's see... maybe i can fix up complete quickly |
| 13:35 | puredanger | looks like some great practice for someone in fixing reflection warnings! :) |
| 13:36 | technomancy | oh cool; old swank code |
| 13:36 | bbloom | technomancy: old? why is it in my lein :-P |
| 13:36 | bbloom | seems pretty current to med! |
| 13:36 | bbloom | s/med/me |
| 13:37 | technomancy | bbloom: I mean it was copied from swank |
| 13:39 | bbloom | technomancy: this code hasn't been changed in 6 months to 2 years... what are the odds that ninjudd would take a PR ? :-P |
| 13:41 | andyf_ | boxed: What do you want to do with that data, out of curiosity? |
| 13:43 | andyf_ | bbloom: I have written patches attached to tickets for most reflection warnings in Clojure. You can take those patches in a private version of your own if you wish |
| 13:44 | bbloom | andyf_: these are in nrepl etc |
| 13:44 | daGrevis | ,(map #(println 42) (range 10)) |
| 13:44 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval25/fn--26> |
| 13:44 | daGrevis | why isn't that working |
| 13:44 | cbp | daGrevis: #(println 42) takes 0 arguments |
| 13:44 | cbp | it should take 1 |
| 13:44 | andyf_ | I've written patches for some of those, too, although the ones cemerick wanted May have already been merged |
| 13:45 | andyf_ | That and new ones have probably appeared on the last year |
| 13:45 | daGrevis | cbp, ohh i didn't know it checks what I do so strictly |
| 13:45 | daGrevis | thanks! |
| 13:46 | cbp | it's only slightly more strict than javascript ;) |
| 13:47 | technomancy | bbloom: ninjudd is pretty good about that stuff |
| 13:49 | bbloom | puredanger: i honor of your sauciness: https://github.com/ninjudd/clojure-complete/pull/20 /cc technomancy ninjudd |
| 13:49 | technomancy | bbloom: brackets on :imports? =\ |
| 13:49 | technomancy | oh, I guess it's honoring the existing convention |
| 13:49 | bbloom | oh, i probably don't want that set! in there... |
| 13:50 | technomancy | heh |
| 13:50 | bbloom | fixed |
| 13:50 | technomancy | but you are aware of http://p.hagelb.org/import-indent.html, right? |
| 13:50 | bbloom | technomancy: i don't subscribe to your school of thought that the first element of vectors can't be special |
| 13:51 | bbloom | i do [:keyword "style" 'stuff] all the time :-P |
| 13:51 | technomancy | bbloom: do you manually indent? |
| 13:52 | boxed | andyf_: I want to write a nicer web frontend with reagent.. seems pretty silly to me to have a bunch of javascript powering various such sites when clojurescrip exists |
| 13:52 | bbloom | technomancy: only the first line. i had guns fix vim indenting to satisfy my preferences :-) https://github.com/guns/vim-clojure-static/issues/47 |
| 13:53 | andyf_ | boxed: You have read the comments describing that data structure? |
| 13:53 | andyf_ | It hasn't changed its structure on quite some time |
| 13:54 | bbloom | puredanger: but i don't wanna deal w/ nrepl :-/ |
| 13:54 | andyf_ | Grr. iPhone fat fingers today. "In quite some time" |
| 13:54 | daGrevis | any idea why this isn't printing out anything? https://gist.github.com/072b5dc3e9032299bedf i'm sure tweets are there. outer-most map isn't working together with println :( |
| 13:55 | boxed | andyf_: skimmed it… it’s pretty tightly coupled to the html and latex output, it’s not semantic. But yea, I’m counting on it not changing much in order for the maintainability of the code I’m writing now to be ok :P |
| 13:55 | daGrevis | ,(map println [1 2]) |
| 13:55 | clojurebot | (1\n2\nnil nil) |
| 13:55 | daGrevis | my example doesn't work thought |
| 13:55 | boxed | andyf_: I don’t want to refactor the data structure though, because then I’d have to fix all the down stream problems with the html/latex generation that would cause |
| 13:56 | andyf_ | I am open to suggested changes if you think it would make your job easier, if it doesn't make mine too much harder... |
| 13:56 | boxed | andyf_: no problem, I’ve found a lib that makes parsing it… well… reasonable at least |
| 13:57 | boxed | everyone in here should give it a cursory glance I think! It can make some problems much simpler and more elegant: https://github.com/dcolthorp/matchure |
| 13:58 | boxed | I’m just happy I didn’t have to write a lib myself like I had to last time I was in here asking for help transforming a data structure heh |
| 13:58 | TimMc | bbloom, technomancy: It should also be pointed out that import's docstring calls for lists. |
| 13:59 | andyf_ | boxed: Let me know if you hit any snags. Github issue is probably quicker than waiting for me to be on IRC |
| 13:59 | bbloom | TimMc: 1) was matching the existing code and 2) annoying technomancy quasi-intentionally |
| 13:59 | TimMc | Matching the code wins, yes. |
| 14:00 | hiredman | boxed: what does matchure have over https://github.com/clojure/core.match? |
| 14:00 | TimMc | but it sounded like you had moved to discussing which is better in new code. |
| 14:00 | boxed | andyf_: cool thanks. I’ll throw you a mail if I get something useful… maybe it makes sense to have this stuff in your project directly |
| 14:02 | boxed | hiredman: hmm… didn’t know about that. I guess matchure has “I found it on google” over it… plus the documentation is optimized for my use case |
| 14:03 | technomancy | bbloom: it's an art form |
| 14:03 | technomancy | relevant: http://penny-arcade.com/comic/2014/07/14/winston-smith |
| 14:03 | daGrevis | why https://gist.github.com/anonymous/a5bda24626de3a953ade |
| 14:03 | hiredman | boxed: looks like it hasn't been touched in years, has bugs and issues related to the 1.2 release, the current version of clojure being 1.6, so much for the "cursory glance" |
| 14:05 | TimMc | daGrevis: map is lazy |
| 14:05 | boxed | hiredman: pity no one in here managed to direct me to core.match before ^_- |
| 14:05 | daGrevis | TimMc, oh. how can I explicitly say to it that I need it to be executed? |
| 14:06 | TimMc | daGrevis: Try dorun. That will force the sequence and throw away the result. |
| 14:07 | daGrevis | TimMc, thanks, you're awesome! |
| 14:08 | twiceaday | if i want someone that is so kind to explain me a bit of the code |
| 14:08 | twiceaday | what is appropriate way to paste it here? |
| 14:08 | cbp | paste? |
| 14:08 | clojurebot | paste is https://refheap.com/ |
| 14:15 | daGrevis | so i have two functions. can i somehow say map 1st-function then 2nd-function? |
| 14:15 | gfredericks | ,(doc comp) |
| 14:15 | clojurebot | "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc." |
| 14:15 | cbp | (map (comp second first) ..) |
| 14:16 | daGrevis | thanks:) |
| 14:36 | celwell | Is there an easy way to change the name of a lein project (and the namespace)? Or do I have to go through all the files and do it manually (including pom.properties and idk what else)? |
| 14:38 | TimMc | celwell: Changing the maven coordinates can be done just by editing the project.clj. |
| 14:38 | TimMc | (pom.properties is irrelevant, that will be regenerated.) |
| 14:38 | celwell | ah, ok. so just change that and the namespaces? |
| 14:39 | TimMc | If you want to change a namespace, something like sed -i will change many files at once. The more annoying bit is renaming directories and such to match the namespaces. Maybe rename will do it. |
| 14:40 | arrdem | &(inc Long/MAX_VALUE) |
| 14:40 | lazybot | java.lang.ArithmeticException: integer overflow |
| 14:41 | celwell | TimMc: thanks |
| 14:42 | amalloy | arrdem: there was some bug in c.l.Numbers that made a particular kind of overflow happen silently, wasn't there? i can't remember what version it was in, or how to expose it |
| 14:43 | arrdem | amalloy: I'm just watching Rich's old video with Brian Beckman in which he says "Numbers silently extend to bignums" which I believed to be no longer the case and that seems to be correct above. |
| 14:43 | Raynes | alandipert: What does Sean mean by custom build system? |
| 14:43 | amalloy | arrdem: that's definitely not the case; hasn't been since 1.2 |
| 14:43 | amalloy | ,(inc' Long/MAX_VALUE) |
| 14:43 | clojurebot | 9223372036854775808N |
| 14:44 | Bronsa | amalloy: http://dev.clojure.org/jira/browse/CLJ-1222 ? |
| 14:44 | arrdem | right but we have the inc/inc' */*' split. |
| 14:44 | amalloy | ah, multiplication! i tried (- Long/MIN_VALUE), but no luck |
| 14:46 | amalloy | (inc Bronsa) |
| 14:46 | lazybot | ⇒ 31 |
| 14:46 | amalloy | &(* Long/MIN_VALUE -1) |
| 14:46 | lazybot | ⇒ -9223372036854775808 |
| 14:46 | technomancy | "We've secretly replaced amalloy's arithmetic operations with ones that return correct results. Let's see if he notices." |
| 14:46 | amalloy | good old lazybot, living in the past |
| 14:46 | arrdem | heh |
| 14:49 | andyf_ | amalloy: Also CLJ-1225 and the 2 similar tickets linked in its description, still in 1.6 |
| 14:49 | amalloy | *chuckle* i got a poorly-worded email about a game that's getting ready to release a beta: "Within the next 2 to 3 days we'd like to get as many major game-breaking issues (such as [...]) in as we can." |
| 14:59 | averell | must be EA |
| 15:03 | alandipert | Raynes, dunno |
| 15:07 | stuartsierra | TimMc:, celwell: tools.namespace has a semi-experimental `move-ns` function |
| 15:07 | celwell | Thanks Stuart! |
| 15:08 | martinklepsch | when using emacs + cider is there a way to eval the ()-expression the pointer is in? like (+ 3 (- 1 | 2)) will eval (- 1 2) ? |
| 15:09 | amalloy | martinklepsch: the problem is that pointer is in many sexps at once, and you don't really want the inner-most one (which is, in fact, just 1!) |
| 15:09 | amalloy | so you need a way to specify "how far up" you want to go before evaluating |
| 15:09 | martinklepsch | amalloy,yeah that's why I wrote ()-expression and not s-expression |
| 15:10 | stuartsierra | C-x C-e will evaluate the *previous* S-expression, so if you place the point after the closing ) you can evaluate just one expression. |
| 15:10 | stuartsierra | Sorry, C-c C-e or something like thate |
| 15:10 | amalloy | stuartsierra: you had it the first time: C-x C-e |
| 15:10 | stuartsierra | ha, it's both! |
| 15:11 | amalloy | oh, really? |
| 15:11 | amalloy | in slime/swank C-c C-e is a different thing |
| 15:11 | amalloy | i'd be surprised if that feature (prompt for a string in minibuffer, then eval it) isn't in cider |
| 15:11 | martinklepsch | stuartsierra, yeah I know but for that I need to move to the end. |
| 15:11 | amalloy | martinklepsch: paredit-forward-up |
| 15:12 | amalloy | if you want you can just write a function that does all of those things: (defun eval-innermost-expr () (interactive) (save-excursion (paredit-forward-up) (cider-eval-last-expr))) |
| 15:19 | Raynes | alandipert: ANSWER ME HEATHEN |
| 15:19 | Raynes | alandipert: So you're not using a custom build tool? |
| 15:19 | Raynes | He seemed pretty angry about that nonexistent build tool. |
| 15:20 | Raynes | What I usually do in these situations is create the thing that is making the guy angry then remove it to make him happy. |
| 15:20 | alandipert | Raynes, oh, he was talking about boot https://github.com/tailrecursion/boot |
| 15:20 | Raynes | Oh, so you do have a custom build tool. |
| 15:20 | Raynes | What's wrong with you Alan |
| 15:20 | alandipert | what build tools aren't custom? |
| 15:20 | Raynes | Leiningen. |
| 15:20 | Raynes | It's too old to be custom. |
| 15:21 | alandipert | weird, i wonder why i'm not using it |
| 15:21 | Raynes | :P |
| 15:21 | Raynes | So why boot? |
| 15:21 | alandipert | asset compilation/coordination |
| 15:21 | Fare | International Lisp Conference 2014 in Montreal, Aug 15-17 — today is last day for early bird pricing (even cheaper if you get ALU membership). I bought my ticket. Will some of you join me there? |
| 15:22 | Raynes | alandipert: So there is functionality that couldn't have been elegantly expressed as plugins for leiningen? |
| 15:22 | alandipert | Raynes, among a few other advantages one need never 'clean' |
| 15:22 | Raynes | technomancy doesn't believe in clean. |
| 15:22 | alandipert | Raynes, give the readme a whirl, you may enjoy it |
| 15:23 | amalloy | clojurebot: technomancy |likes| things dirty |
| 15:23 | clojurebot | In Ordnung |
| 15:23 | alandipert | Raynes, as a fellow custom build tool |
| 15:23 | Raynes | I highly doubt it. |
| 15:23 | alandipert | haha |
| 15:23 | Raynes | As a person who helped write a Clojure build tool, I'm gonna go hide behind leiningen. |
| 15:23 | alandipert | may i direct you then to cuteoverload.com which almost certainly has something you may enjoy |
| 15:23 | Raynes | This I can get on board with. |
| 15:25 | Fare | I've written and am writing a build tools, but nothing Clojure specific at this point. |
| 15:29 | seancorfield | alandipert: (and Raynes) - it would really help your cause if 1. hoplon's getting started explained _why_ boot is needed in addition to lein and 2. if boot's examples catered to windows - boot's readme says to d/l a JAR and use java -jar ... but ALL the examples talk about a boot _shell_ script and using #!/usr/bin/env boot which makes no sense for Windows users |
| 15:29 | seancorfield | and it's that lack of Windows support that makes boot (and hoplon) a non-starter for clojurebridge |
| 15:30 | alandipert | seancorfield, thanks, i appreciate the feedback |
| 15:30 | Fare | what's hoplon? |
| 15:31 | Raynes | $google clojure hoplon |
| 15:31 | lazybot | [tailrecursion/hoplon · GitHub] https://github.com/tailrecursion/hoplon |
| 15:31 | Raynes | dis |
| 15:31 | alandipert | Fare, http://hoplon.io for soapbox |
| 15:31 | Raynes | What is an epicycle? |
| 15:32 | Raynes | I know what the word means, but not in the context of this README. :P |
| 15:32 | alandipert | Raynes, http://en.wikipedia.org/wiki/Deferent_and_epicycle#Slang_for_bad_science |
| 15:33 | seancorfield | hoplon is beautifully documented and the frp cell stuff is wonderful |
| 15:33 | Raynes | I have come away from this paragraph knowing exactly as much about the purpose of that badge as I did before I read it. |
| 15:33 | alandipert | Raynes, so far we haven't had to bend the model to any one-off circumstances :-) |
| 15:33 | puredanger | seancorfield: sorry for engaging on Twitter where everything goes horribly wrong all the time |
| 15:33 | Raynes | Oh, I see. I think. |
| 15:33 | seancorfield | but this whole discussion was about _clojurebridge_ and thus programming beginners using windows!! |
| 15:34 | seancorfield | boot is really a non-starter for windows users who are new to programming |
| 15:35 | puredanger | seancorfield: I appreciate where you're coming from and maybe Hoplon is just not the right starting place (or maybe the wise and somewhat strange alandipert can make it a happy place) |
| 15:35 | amalloy | is this a continuation of some discussion from elsewhere? i'm confused by the first mention of clojurebridge being "this whole discussion was about clojurebridge" |
| 15:35 | alandipert | we have windows users but they're all experienced programmers |
| 15:35 | puredanger | amalloy: twitter |
| 15:35 | alandipert | which i think is why the documentation is pointy |
| 15:36 | seancorfield | raynes brought the twitter discussion here - and i felt was lampooning me - hence my follow-up here |
| 15:36 | Raynes | I actually was not lampooning you at all. |
| 15:36 | TimMc | That's a great word. |
| 15:36 | seancorfield | alandipert: yeah, i know windows is kind of a second class citizen in the clojure world in a lot of areas :( |
| 15:36 | Raynes | I'm actually super wary of new build tools |
| 15:36 | Raynes | Just not because of Windows support. |
| 15:36 | puredanger | and old build tools |
| 15:37 | seancorfield | Raynes: ok, your tone wasn't clear... written word isn't always good for that :) |
| 15:37 | Raynes | Well I was trolling like hell, so I'm unsurprised. |
| 15:37 | Raynes | Sorry <3 |
| 15:37 | seancorfield | ~guards |
| 15:37 | clojurebot | SEIZE HIM! |
| 15:38 | seancorfield | out of curiosity alandipert can new hoplon projects be created with boot alone or is leiningen needed for that? |
| 15:38 | seancorfield | arrdem: lol |
| 15:39 | michaniskin | seancorfield: we have a lein template for it |
| 15:39 | alandipert | seancorfield, a boot project is defined by its build.boot file, which can be created by hand, like a project.clj if desired |
| 15:39 | arrdem | Bronsa: raw eval should work in the current master, right? |
| 15:39 | seancorfield | yeah, that's what i got from the docs... use lein to create a hoplon project then use boot to run it |
| 15:39 | Raynes | A man after my own heart. <3 |
| 15:39 | alandipert | we use lein because it has the nice template system thing |
| 15:39 | alandipert | for that bit |
| 15:39 | Bronsa | arrdem: correct |
| 15:40 | trap_exit | anyone here go from clojure to haskell (becuase types = awesome), but then switch back to clojure (because laziness = hard to performance debug) |
| 15:40 | technomancy | trap_exit: try ocaml =D |
| 15:40 | Raynes | I use multiple languages. I don't often 'switch' languages. |
| 15:40 | arrdem | Bronsa: hum... lemme reproduce this weirdness but I'm not sure its working. |
| 15:40 | Raynes | Like, I can't 'switch' from Python to language x because I still need to write Python at work. |
| 15:40 | trap_exit | technomancy: but I just spent a week of my life groking monads |
| 15:41 | Raynes | Anyways, I started with Haskell, ended up using Clojure far more. |
| 15:41 | seancorfield | michaniskin: are the windows binaries you refer to (for boot) actual native binaries or just the JAR file? |
| 15:41 | Raynes | I enjoy Haskell's type system, but prefer dynamically typed languages. |
| 15:41 | tbaldrid_ | trap_exit: the lazy part seems to be be a common issue. Apparently even the language designers regret the lazy part of Haskell |
| 15:41 | michaniskin | seancorfield: it's just the uberjar (but before there was only source, so it's an improvement, right?) :) |
| 15:41 | notostraca | heh, I "switched" to C# but I'm still using a java lib in C# via IKVM, so I need to know BOTH standard libs! and I'm offering clojure help here sometimes after the pros go to sleep |
| 15:41 | seancorfield | trap_exit: have you looked at core.typed for optional typing? |
| 15:42 | technomancy | Raynes: re: "switching" https://twitter.com/mjeaton/status/483620293567848449 |
| 15:42 | trap_exit | I spent the past 2 months of my life as folows: (1) use clojurescript (2) I want more compile time bug detection (3) start using typed clojure (4) decide typed clojure is too slow (5) learn Haskell (6) play with Haste/Fay to compile ahskell to js (7) instalal ghcjs to compile haskell to js and (8) banging head against table, wondering why my clojurescript code is 10x faster than my haskell code |
| 15:42 | seancorfield | michaniskin: "improvement"... er, yes... |
| 15:42 | trap_exit | seancorfield: it's slow |
| 15:42 | michaniskin | seancorfield: we're actively assessing various ways to package boot for windows |
| 15:42 | Raynes | technomancy: I know, the wording always makes me twitch. |
| 15:42 | michaniskin | how is launch4j with clojure? |
| 15:42 | trap_exit | clearly, the solution is: I need to write a haskell -> clojurescript compiler |
| 15:42 | trap_exit | so Ican get the type checking of haskell, but the perdictable performance of cljs |
| 15:43 | technomancy | trap_exit: ocaml has monads, they just don't bash you over the head with them within weeks of picking it up. |
| 15:43 | devn | is clojure the first language to make wide use of persistent data structures at the language level? |
| 15:43 | technomancy | devn: wat |
| 15:43 | seancorfield | michaniskin: how about a boot.bat that at least wraps the JAR and makes it easier to use the basic boot commands per the docs? |
| 15:43 | Raynes | No. |
| 15:43 | devn | technomancy: to implement HAMTs is maybe what I meant to say |
| 15:44 | seancorfield | michaniskin: i don't know what to suggest about all the unix-y shell script examples for boot on windows tho'... |
| 15:44 | michaniskin | seancorfield: yes we should do that (the .bat file) |
| 15:44 | tbaldrid_ | devn: well rich invented PersistentVectors, and IIRC had Persistent HM before most other languages |
| 15:44 | seancorfield | i'll be happy to test the experience on my win8.1 tablet :) |
| 15:44 | michaniskin | seancorfield: launch4j wraps the uberjar in a windows .exe |
| 15:45 | seancorfield | michaniskin: ah, ok, haven't looked at that |
| 15:45 | notostraca | michaniskin, there's also packr |
| 15:45 | notostraca | which makes more than windows |
| 15:45 | notostraca | I have used it with uberjars |
| 15:45 | trap_exit | hmm, maybe I will go try idris |
| 15:45 | michaniskin | notostraca: how did it work for you? |
| 15:45 | notostraca | https://github.com/libgdx/packr |
| 15:45 | tbaldrid_ | trap_exit: lol, why? |
| 15:45 | seancorfield | the lein.bat / windows installer has made the leiningen-on-windows experience fairly painless (but it took a long time to get there) |
| 15:46 | notostraca | fantastic, I actually was able to take my hack of a haxe jdk bundler and completely switch out |
| 15:46 | seancorfield | unfortunately to bring more newbies to clojure, we need to be more aware of the windows experience - and the "pointy" nature of the docs (to use alandipert's lovely phrase - thank you!) |
| 15:46 | technomancy | so what does "asset compilation" mean? |
| 15:46 | michaniskin | seancorfield: we're working on boot-ng currently, which will be completely focused on being an "on-ramp" for clojure that beginners can use |
| 15:46 | notostraca | michaniskin, the point of packr is to be used regardless of the installed or not installed jdks on the user's machine |
| 15:47 | technomancy | I mean, how is it different from other types of compilation? |
| 15:47 | boxed | hiredman: just fyi: I managed to change my code to use core.match, works pretty well. Thanks! |
| 15:47 | puredanger | trap_exit: Sounds like you are in PureScript territory https://github.com/purescript/purescript |
| 15:48 | michaniskin | seancorfield: one of my personal goals for the whole hoplon boot thing is to get non-programmer types into the frontend dev |
| 15:48 | seancorfield | michaniskin: nice! def. interested in that... |
| 15:49 | trap_exit | puredanger: holy shit, this looks amazing |
| 15:50 | michaniskin | seancorfield: hoplon was a step toward that goal. we envision frontend dev work to be as accessible as spreadsheets in excel |
| 15:50 | clojurebot | No entiendo |
| 15:50 | seancorfield | trap_exit: if you want just a front-end solution that looks like haskell, check out elm as well - http://elm-lang.org |
| 15:50 | michaniskin | currently though you're right, the on-ramp is not there yet |
| 15:51 | seancorfield | thanx for the discussion... lunch calls... |
| 16:04 | tbaldrid_ | wasn't the only one |
| 16:04 | michaniskin | hahaha, i get ppl talking to me on irc all the time |
| 16:04 | michaniskin | thinking i'm him |
| 16:04 | stuartsierra | technomancy: I had the same problem until I met michaniskin in person. |
| 16:06 | michaniskin | stuartsierra: i used to think you were stuart halloway, but since books are not interactive i never bothered you with instant messages :P |
| 16:06 | nathan7 | Anyone with core.async chops? |
| 16:07 | nathan7 | I'm trying to use pub-sub, but my publication doesn't seem to be taking anything from my channel |
| 16:07 | tbaldridge | nathan7: I know a little about core.async, can I see some code? |
| 16:08 | nathan7 | tbaldridge: a moment, putting an example of my problem together |
| 16:08 | nathan7 | tbaldridge: http://sprunge.us/CZIg?clojure |
| 16:08 | nathan7 | err |
| 16:08 | nathan7 | a line got lost there |
| 16:09 | nathan7 | tbaldridge: http://sprunge.us/DTfb?clojure |
| 16:09 | nathan7 | tbaldridge: this just blocks indefinitely |
| 16:11 | hiredman | nathan7: do you know which line is blocking? |
| 16:11 | hiredman | my guess is the put! |
| 16:11 | nathan7 | hiredman: nope |
| 16:12 | nathan7 | hiredman: the <!! is blocking |
| 16:12 | hiredman | but I forget how put! works, I always just use <!! and >!! |
| 16:12 | tbaldridge | nathan7: your async/pub is publishing to updates I think? |
| 16:12 | hiredman | nathan7: maybe a typo, metric-pub is on an undefined updates channel |
| 16:12 | nathan7 | hiredman: (future (async/>!! …)) gets me the same thing |
| 16:12 | hiredman | should it be on metric-chan? |
| 16:12 | nathan7 | OH |
| 16:13 | nathan7 | goddamn old names hanging around in my ns |
| 16:13 | nathan7 | yep, everything works perfectly now |
| 16:14 | tbaldridge | gotta love the mutable global state of the repl |
| 16:14 | alandipert | mutable languages are key to productivity |
| 16:14 | alandipert | err, dynamic languages i mean |
| 16:16 | stuartsierra | I should be quieter, I just found a bug in it this weekend. |
| 16:18 | arrdem | andyf y u no twitter |
| 16:23 | Fare | so what does tools.analyzer do? |
| 16:24 | tbaldridge | it analyzes clojure forms and emits an AST. it then includes many passes on that AST to add more information |
| 16:24 | tuft | tools.namespace++ |
| 16:24 | Fare | is the AST semantically equivalent to the original code? |
| 16:24 | bbloom | Fare: it's an elaboration in to a tree of maps |
| 16:24 | bbloom | ie 1 becomes {:op :constant :value 1 ...} |
| 16:25 | tbaldridge | Fare: yes, that's the point, you can feed that AST into tools.emitter and you then have a Clojure compiler. |
| 16:25 | Fare | is the point to compile the code to something based on it? |
| 16:25 | Fare | so it's the first half of a compiler that doesn't exist? |
| 16:25 | andyf | arrdem: Everything I have to say about Clojure goes into one of the Google groups. Either that or I'm old and don't trust these newfangled web sites :-) |
| 16:25 | bbloom | Fare: the other half of the compiler is a work in progress here: https://github.com/clojure/tools.emitter.jvm |
| 16:25 | tbaldridge | That emitter actually works pretty well. |
| 16:26 | Fare | oh. Then what's left to do? |
| 16:26 | bbloom | you'd have to ask Bronsa |
| 16:26 | Fare | is this thing in any way related to Andy Keep's presentation on a nanopass compiler? |
| 16:27 | tbaldridge | Fare: nope, it's a been a long running project to build Clojure in Clojure |
| 16:27 | bbloom | well, it's a multi-pass design |
| 16:27 | Fare | in contrast, what does the current implementation do? |
| 16:27 | bbloom | there's no AST validator as far as i know tho |
| 16:27 | bbloom | the current clojure compiler is all single pass java crammed together |
| 16:27 | tbaldridge | Fare: the current compiler is mostly single pass |
| 16:27 | Fare | a straightforward naive compilation? |
| 16:27 | verma | hey guys, I recently saw this pretty cool demo where cljs.async was used to blip little rects on a canvas and I think it was using Om as well, not sure, anyone know what I am talking about? |
| 16:28 | tbaldridge | yeah, and it works pretty well thanks to how fast the JVM is. |
| 16:28 | bbloom | there are some small optimizations for boolean tests and things, but it leans on the jit pretty hard |
| 16:28 | tbaldridge | Fare: but it's easier to add more features in something like tools.analyzer |
| 16:29 | tbaldridge | Fare: IMO, the current compiler isn't very maintainable. It works well for what it does, and for being written in Java, but I'd rather write something like core.async's go macro in tools.analyzer instead of the current compiler. |
| 16:34 | dogonthehorizon | Greetings folks. I'm wrapping an internal http api in Clojure as an exercise and have run into a casting issue. It appears that PersistentArrayMap and ObjectNode (from the jackson JSON lib) are incompatible types. Any pointers on how to go about making these two types friendly? Here's the relevant snippets: https://gist.github.com/dogonthehorizon/fcfe226879354073e969 ...thanks folks! |
| 16:35 | tbaldridge | dogonthehorizon: use cheshire? |
| 16:35 | tbaldridge | https://github.com/dakrone/cheshire |
| 16:36 | dogonthehorizon | tbaldridge: I think clj-http is using cheshire under the hood, so I could try that. My goal is to have this library be usable by some existing Java projects, hence the interest in returning an ObjectNode. |
| 16:40 | stuartsierra | dogonthehorizon: I don't get it. You want to return a Jackson ObjectNode from your function? |
| 16:40 | seancorfield | michaniskin: like technomancy i wasn't initially sure about your name and kept misreading it as mechaniskin... i assume it's Micha Niskin? |
| 16:41 | michaniskin | seancorfield: haha yes, that's me |
| 16:41 | michaniskin | are nicks case sensitive? |
| 16:42 | tuft | yes |
| 16:44 | dogonthehorizon | stuartsierra: So far: yes. Unless there's a better/cleaner way to do so. |
| 16:44 | stuartsierra | dogonthehorizon: then you'll probably have to use the Jackson API directly |
| 16:46 | dogonthehorizon | hmm, alright I'll give that a shot then. Thanks all! |
| 17:04 | dogonthehorizon | stuartsierra: thanks for the suggesetion! Instead of using clj-http's json parsing facilities I accessed jackson directly to parse the response body. Things are working wonderfully now :) |
| 17:05 | aperiodic | |
| 17:05 | stuartsierra | dogonthehorizon: you're welcome |
| 17:10 | mi6x3m | hey clojure, is there a way to get a qualified name from a var? |
| 17:10 | arrdem | mi6x3m: get a fully qualified symbol from a var? |
| 17:10 | mi6x3m | arrdem: get clojure.core/+ from #'+ |
| 17:11 | mi6x3m | I understand I can do it with the meta |
| 17:11 | mi6x3m | but perhaps there's ready code for it |
| 17:11 | stuartsierra | (let [{ns :ns sym :name} (meta the-var)] (symbol (name (ns-name ns)) (name sym))) |
| 17:12 | mi6x3m | stuartsierra: yes, that's what I have now :) |
| 17:12 | stuartsierra | that's all there is |
| 17:12 | mi6x3m | ok, so nothing out of the box |
| 17:18 | verma | How do I get rid of the extra pair of () I am getting around my for form in this macro: https://gist.github.com/verma/a8560f22cdae3e7709fb |
| 17:19 | hiredman | why is it a macro? |
| 17:20 | verma | hiredman, for funsies |
| 17:20 | verma | I am going to attach a bunch of handlers which basically have the same body |
| 17:20 | verma | + I am learning macros, so |
| 17:21 | verma | but you're right, doesn't have to be a macro |
| 17:23 | bteuber | verma: has your question been answered already? if not, I'd like to help you once I understand the problem ^^ |
| 17:23 | verma | bteuber, no it hasn |
| 17:23 | verma | hasn't been |
| 17:23 | bteuber | okay so which pair of () do you mean? |
| 17:24 | verma | right after the cond |
| 17:24 | verma | bteuber, basically cond needs even number of forms right, so it doesn't work |
| 17:24 | bteuber | ah should have read the comments below :) |
| 17:25 | bteuber | well the ~@ "cancels" the list you created with the for |
| 17:25 | bteuber | but not the one you created with the (list `... `...) |
| 17:25 | bteuber | so instead of list try concat |
| 17:25 | verma | bteuber, yeah, but how else do I bring the two statements together that I want for to emit |
| 17:26 | bteuber | erm right |
| 17:26 | aperiodic | verma: you probably want mapcat in place of the for |
| 17:26 | bteuber | ah yes |
| 17:26 | bteuber | or (apply concat (for ...)) |
| 17:26 | bteuber | but mapcat is more idiomatic |
| 17:27 | verma | oh nice, let me look that up |
| 17:27 | bteuber | but before you do, check if (apply concat (for ...)) works |
| 17:27 | bteuber | just for fun ^^ |
| 17:27 | verma | sure :) |
| 17:29 | verma | bteuber, yes (apply concat ...) works :) |
| 17:29 | bteuber | good |
| 17:32 | verma | aperiodic, bteuber mapcat works as well :) |
| 17:33 | verma | nice, thanks guys :) |
| 17:38 | TimMc | I'm going to write a clojure.test utility to check if an iterator is well-behaved unless someone pipes up with an existing library in the next hour or so. :-P |
| 17:42 | hiredman | TimMc: have you seen https://github.com/ztellman/collection-check? it doesn't have an iterator check, but it has some established patterns for testing collection kinds of things |
| 17:43 | TimMc | Nice, thanks! I should have trawled through ztellman's repos first. :-P |
| 17:43 | ztellman | TimMc: feel free to add an iterator check |
| 17:44 | cbp | a |
| 17:44 | hiredman | bmag |
| 17:44 | hiredman | pardon me |
| 17:44 | Glenjamin | ztellman: hello! is iim still due to move into a core lib? |
| 17:45 | ztellman | Glenjamin: yes, work has just been eating into all my open source efforts |
| 17:45 | ztellman | my company's doing a hackathon in a few weeks, was going to do it then |
| 17:45 | Glenjamin | cool, i'll continue to keep an eye out for it |
| 17:45 | ztellman | sorry for the delay, I feel bad about it whenever I have time to remember |
| 17:46 | Glenjamin | doesn't make a huge difference - it works extremely well with the current name |
| 17:46 | notostraca | iim? |
| 17:46 | Glenjamin | i'm on the CLA now, so if you want the rseq stuff it shouldn't be too much hassle |
| 17:49 | _alejandro | notostraca: immutable-int-map? |
| 17:49 | TEttinger | ah, thanks (I am notostraca) |
| 17:49 | Glenjamin | yeah, https://github.com/ztellman/immutable-int-map |
| 17:49 | TimMc | ztellman: I think I'll take that as inspiration but not try to add to it; iterators are stateful and involve exceptions, so they might be hard to wedge in. |
| 17:50 | Glenjamin | makes r/fold magically work on maps |
| 17:50 | ztellman | TimMc: all you do is create a generator that creates iterator actions |
| 17:50 | ztellman | and then run it against your data structure and a Clojure data structure |
| 17:50 | ztellman | and make sure the behavior is equivalent |
| 17:51 | TimMc | Hmm, I see! |
| 17:51 | TimMc | I will give that a shot. |
| 17:52 | schmee | has anyone here implemented the Negamax algorithm in clojure? |
| 17:53 | TimMc | I still need to read up on simple-check. |
| 17:53 | reiddraper | ztellman: a test like that could never find any bugs... ;) |
| 17:54 | ztellman | reiddraper: note that I didn't say compare a Clojure dat structure against itself :) |
| 17:54 | ztellman | data* |
| 17:54 | TimMc | Oh, looks like simple-check moved. |
| 17:55 | reiddraper | ztellman: haha yes, true |
| 17:55 | ztellman | TimMc: oh, yeah, I probably haven't retargeted collection-check yet |
| 17:55 | reiddraper | TimMc: indeed: http://github.com/clojure/test.check |
| 18:39 | alexherbo2 | Hi |
| 19:09 | shanemhansen | I heard about the XY thing in hacker news comments like yesterday. |
| 19:10 | catern | XY problem? |
| 19:10 | shanemhansen | oops, sorry catern wrong channel. |
| 19:11 | shanemhansen | Although it's probably relevant in any irc channel where people ask for support: http://mywiki.wooledge.org/XyProblem |
| 19:11 | catern | yep, XY problem |
| 19:14 | cbp | ~xy |
| 19:14 | clojurebot | xy is http://mywiki.wooledge.org/XyProblem |
| 19:15 | shanemhansen | I feel like I'm one of today's lucky 10k http://xkcd.com/1053/ |
| 20:07 | fifosine | If I have a list and a list of indices, how do I get a sequences of elements at the indices? |
| 20:07 | technomancy | fifosine: put your list in a vector and map it over the indices |
| 20:08 | fifosine | how do you mean? I have '("A" "B" "C") and indices '(0 2), and I want to get '("A" "C") |
| 20:08 | pandeiro` | getting java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil using clojurescript 0.0-2268 with advanced compilation -- is this a tools.reader problem? |
| 20:09 | technomancy | ,(map ["A" "B" "C"] '(0 2)) |
| 20:09 | clojurebot | ("A" "C") |
| 20:11 | fifosine | technomancy: How do I force map to evaluate and not give me a lazy seq? |
| 20:12 | nkozo | fifosine: (doall (map ....) |
| 20:13 | fifosine | nkozo: thanks |
| 20:13 | technomancy | what's wrong with a lazy seq? |
| 20:15 | technomancy | (there are legitimate reasons to avoid them, but it's unlikely you're coming across them if you're unfamiliar with doall) |
| 20:16 | numberten | can someone tell me if there's a neater way to do this than what I just thought of? it feels kinda hacky |
| 20:16 | numberten | ,((reduce comp (map #(partial + %) [1 2 3 4 5])) 0) |
| 20:16 | clojurebot | 15 |
| 20:17 | numberten | obviously I mean the pattern and not summing a vector of ints |
| 20:17 | technomancy | apply comp instead of reducing it |
| 20:18 | hiredman | um |
| 20:18 | hiredman | there is no need at all for the map |
| 20:18 | hiredman | just reduce with + |
| 20:18 | amalloy | numberten: what pattern? the stuff you're doing there is just all contrived |
| 20:18 | numberten | I didn't realize comp worked on functions of n-arity |
| 20:18 | numberten | thanks technomancy |
| 20:18 | amalloy | i can't tell you how to better do that pattern because i don't understand what pattern there you're hoping to promote |
| 20:18 | hiredman | his pattern is just a really weird way to write a reduce |
| 20:18 | numberten | ? |
| 20:19 | hiredman | yay, the spammer is back |
| 20:19 | hiredman | muuunis |
| 20:19 | numberten | I guess I was just wondering if there was a shorter way, since it's kinda verbose |
| 20:19 | hiredman | numberten: (reduce + 0 [1 2 3 4 5]) |
| 20:20 | numberten | I want to be able to take a traversable structure of functions of type a->a and weave some accumlator between them |
| 20:20 | hiredman | there is a shorter way, that whole computation is just a reduce |
| 20:20 | numberten | so i compose all the functions into 1 large a->a |
| 20:20 | numberten | and then apply the initial value |
| 20:20 | hiredman | that is reduce |
| 20:20 | numberten | yeah |
| 20:20 | numberten | but it's verbose |
| 20:20 | numberten | as noted |
| 20:20 | hiredman | no no |
| 20:21 | hiredman | not reduce with comp |
| 20:21 | hiredman | it is just reduce |
| 20:21 | numberten | but the function changes |
| 20:21 | numberten | :/ |
| 20:22 | numberten | right? |
| 20:22 | numberten | the first application of f f=(+1) |
| 20:22 | numberten | the second f=(+2) |
| 20:23 | Jaood | hiredman: do you mean he just wants (reduce + 0 [1 2 3 4 5]) ? |
| 20:23 | numberten | so (reduce + 0 [1 2 3 4 5]) doesn't capture it? Unless I'm just very tired and missing something |
| 20:24 | numberten | what I kinda want is a non-macro ->> I think? |
| 20:25 | hiredman | ,(reduce #(%2 %1) 0 (map #(partial + %) [1 2 3 4 5])) |
| 20:25 | clojurebot | 15 |
| 20:25 | hiredman | you have multiple things, you want one thing, it is reduce |
| 20:25 | numberten | aha |
| 20:25 | numberten | thanks |
| 20:26 | nkozo | can I force evaluation of a macro parameter from outside the macro? like doing (defmacro m [x] x) and (m (get-big-expr)), and get-big-expr will be evaluated in compile-time (by some magic) before the macro call |
| 20:28 | amalloy | nkozo: no, that is not possible. macros don't work that way |
| 20:30 | nkozo | amalloy: thanks, just checking |
| 22:28 | hellofunk | ddellacosta: do you do your Om markup with sablano or something else, or do you just use the built-in om/dom stuff? |
| 22:32 | garrettdreyfus | Hey guys I was wondering if anybody new how to test out plugins for leingen |
| 22:33 | ddellacosta_ | hellofunk: sablono, usually |
| 22:34 | hellofunk | ddellacosta_: is it primarily a syntactic convenience for you or are there additional features you use? |
| 22:35 | numberten | any reason a macro might be evaluated instead of expanded by macroexpand-1 in the repl? |
| 22:35 | hellofunk | numberten are you quoting the macro expression? |
| 22:36 | numberten | yes |
| 22:37 | numberten | the macro is mread-slurp |
| 22:37 | numberten | (mread-slurp "data/b") gives an error |
| 22:37 | hellofunk | and what *exactly* are you typing at the repl? |
| 22:37 | numberten | and (expandmacro-1 '(mread-slurp "data/b")) gives what I would expect |
| 22:37 | numberten | when normally doing (mread-slurp "data/b") |
| 22:37 | numberten | it's strange :/ |
| 22:38 | hellofunk | numberten why not using macroexpand? |
| 22:38 | numberten | sorry was a typo |
| 22:39 | numberten | s/expandmacro-1/macroexpand-1 |
| 22:39 | hellofunk | what is "s" namespace representing for you |
| 22:40 | numberten | s? |
| 22:41 | hellofunk | maybe you are just putting lots of typos here? |
| 22:41 | hellofunk | you typed s/... |
| 22:41 | numberten | that was sed substitution >.> |
| 22:41 | numberten | to correct my typo above |
| 22:43 | numberten | http://pastebin.com/wZD4gb2M |
| 22:43 | numberten | isn't that strange? :/ |
| 22:43 | numberten | the macroexpand-1 line and the last line return the same input which I cut out because it's spammy |
| 22:45 | numberten | wouldn't you expect (macroexpand-1 '(mread-slurp "data/b")) to return (read-string (slurp "data/b")) ? |
| 23:03 | numberten | needed to ~ the argument in my defmacro >.> |
| 23:03 | devn | numberten: i was going to say, i dont have any such problem |
| 23:03 | devn | numberten: why put that in a macro? |
| 23:17 | numberten | for embedding structures into binaries at compile time |
| 23:23 | nathan7 | …whoa, was that a netsplit recovering? |
| 23:23 | nathan7 | looks like it |
| 23:34 | kegund | off-topic... is there a paredit command to cycle between paren type ([{) ? |
| 23:35 | elben | I’m writing a cljs app using Om. Trying to understand the async model. cljs only implements atoms, and om/react seem to use settimeout for its requestanimationframe. Do browser events (e.g. on click) take control of the process on fire? E.g. if I have a do block that is doing a bunch of swap!s, would a button click move the process out of that block? A settimeout I assume does exactly this. |
| 23:42 | elben | Ah, js seems to work like most async systems where the yielded context must give back control to the process (e.g. method ends) |
| 23:59 | kristof | elben: Do you mean "go" block? As far as I know, go blocks are only scheduled out of the thread after a channel operation. |
| 23:59 | kristof | elben: So a go block running a tight loop would not care about any button click until it was finished, oooor it called a put or a take. |