2014-01-11
| 00:00 | KeithPM | TEttinger: Hmmmm… Let me try that. |
| 00:01 | gtrak | KeithPM: shortcut is (if-let [s (seq my-seq] blah)... (seq ..) will return nil when it's empty, which is falsy |
| 00:02 | KeithPM | gtrak: OK thanks…. Will check it out |
| 00:02 | hansel-han | amalloy: what's a simple way to run a loop within the app that handles evictions every, say, 10 seconds? |
| 00:03 | amalloy | hansel-han: you don't really have to do the evictions every ten seconds. you can just do the evictions whenever you want to read or write the thing |
| 00:03 | amalloy | that is, it doesn't have to be a separate asynchronous process |
| 00:03 | hansel-han | amalloy: haha, of course. yeah, thanks. |
| 00:07 | amalloy | KeithPM: what is permx supposed to do? compute permutations of a sequence or something? |
| 00:08 | KeithPM | amalloy: Yes, that's the plan :) |
| 00:08 | jonasen | andyf: ping |
| 00:08 | andyf | jonasen: pong |
| 00:08 | KeithPM | amalloy: I kinda described my algorithm in the gist. |
| 00:09 | jonasen | I can make the release if when you're ready |
| 00:09 | TEttinger | hm is there a way to (using a macro or something) fill out a for comprehension's bindings at run-time? or compile-time for a macro |
| 00:09 | jonasen | andyf: we should still change README.md to not mention Leiningen 1 installation |
| 00:09 | andyf | jonasen: cool. I think the known issues are pretty well described in the README.next.md, so as long as that gets moved to README.md when the release is done, it should be good enough to go. |
| 00:10 | andyf | Yes, that vestigial mention is still in README.next.md, with a question of whether we care about Leiningen 1 any more. I have not done any testing with Leiningen 1 |
| 00:10 | TEttinger | the chas. |
| 00:11 | technomancy | andyf: putting :min-lein-version "2.3.0" will at least let people with old versions know why if things aren't working for them. |
| 00:12 | andyf | technomancy: thanks for the tip |
| 00:13 | jonasen | andyf: Also, should we bump the version number a bit higher. You and Bronsa has done more work than 0.0.2 -> 0.0.3 |
| 00:13 | andyf | jonasen: Sure. Pick what sounds good to you. Do you want me to make any of these edits? Don't want to interfere with any changes you want to make. |
| 00:14 | amalloy | are you averse to solving it differently, KeithPM? https://gist.github.com/amalloy/8367369 is a much simpler way to do it |
| 00:14 | jonasen | andyf: you can make the changes if you want to. Ping me when its done and I cut a release. |
| 00:14 | andyf | ok |
| 00:15 | andyf | what version #? 0.1.0? |
| 00:15 | KeithPM | amalloy I solved it once before with a list comparehension, lemme check |
| 00:15 | jonasen | andyf: sure |
| 00:15 | amalloy | using a sorted-map of {int, x} instead of a vector of xs to support efficient removal-in-the-middle, and then a nested for instead of the rather involved map/concat/recursion thing |
| 00:17 | KeithPM | amalloy: Definitely takes some study :) Thanks |
| 00:17 | TEttinger | nice amalloy |
| 00:17 | TEttinger | that thing's a work of art |
| 00:39 | andyf | jonasen: I think it should be ready to go. README.next.md moved over, project.clj is updated. Version number is 0.1.0 in all of the places I think it needs updating. |
| 00:40 | andyf | 'lein test' passes, and the crucible projects re-run are under way, and so far (about 10% through) look the same as my last run except for the version number update. |
| 00:41 | jonasen | andyf: I'll ping you when it's released |
| 00:45 | gcganley | are there any meetups around boston anytime soon? |
| 00:45 | jonasen | andyf: it's on Clojars now :) |
| 00:46 | andyf | jonasen: Awesome! I will try it out on a machine where I haven't been developing it, to ensure the install goes smoothly. |
| 00:46 | jonasen | andyf: will you [ANN] it on the mailing list? |
| 00:46 | andyf | You are welcome to. Either way is fine with me. |
| 00:47 | jonasen | andyf: since it's your work and you know what's new I think maybe you should announce it |
| 00:47 | andyf | Will do. |
| 00:56 | wei__ | is there a good way to execute db functions in java.jdbc without bashing together strings? |
| 00:57 | noonian | you can use something like honeysql or kormasql |
| 01:20 | andrewchamb | hello |
| 01:20 | andrewchamb | I have a question about core.logic |
| 01:21 | andrewchamb | in a conde does the goal tests go top down> |
| 01:21 | andrewchamb | ? |
| 01:22 | andrewchamb | I want a certain goal to succeed first, then the others |
| 01:22 | andrewchamb | so kind of priority |
| 01:33 | dnolen | andrewchamb: there is no order that can be guaranteed |
| 01:36 | andrewchamb | dnolen: oh ok, i was playing around trying to make a system which converts bytecode to assembly using core logic http://pastebin.com/rEcQJXQh |
| 01:36 | andrewchamb | and i was trying to make it match more complicated patterns first |
| 01:37 | andrewchamb | i guess i can just run the rules one after the other to get order |
| 01:38 | andrewchamb | in that i was trying to make it convert a divide and a mod into a single divmod, but if that fails it just converts it into seperate divides and modulos |
| 01:39 | andrewchamb | im really new to clojure |
| 01:40 | dnolen | andrewchamb: core.logic is not a good introduction to clojure :) |
| 01:41 | andrewchamb | haha yeah, but i started clojure cause core.logic is something python doesnt have :P |
| 01:41 | dnolen | andrewchamb: trying to do things dependent on order with core.logic will be very frustrating, as order is not a very declarative property |
| 01:41 | andrewchamb | thats not really dependent on order since that bytecode is in single static assignment form |
| 01:42 | andrewchamb | memory access needs another field represesnting time though |
| 01:43 | dnolen | andrewchamb: I mean order of goals |
| 01:43 | andrewchamb | oh ok |
| 01:43 | andrewchamb | yeah |
| 01:43 | andrewchamb | i suppose i can enumerate matches then select the longest |
| 01:43 | andrewchamb | though that might not be efficient |
| 01:44 | andrewchamb | my problem is once i find a match, i must rewrite the things im matching against, so it doesnt make sense to find all the matches |
| 01:45 | andrewchamb | My understanding of how minikanren worked was that it just goes top down trying to unify, i guess its probably more complicated than that |
| 01:48 | andrewchamb | dnolen: does it try and prove the goals in (parallel/concurrently) and then returns them in the order it finds them? |
| 01:53 | andrewchamb | thanks for the help btw, core.logic is pretty neat |
| 02:07 | seangrove | Ah, ff, cljs compiler, why you OoM me... |
| 02:18 | seangrove | Getting to the point that we can't compile with :advanced compilation on pretty consistently |
| 02:19 | seangrove | dnolen: Is there some jvm flags we can set to use 16G of memory or something to get past this? |
| 02:20 | Arafangion | seangrove: I'm confused. |
| 02:21 | Arafangion | seangrove: You previously mentioned cljs. Now you're asking about the jvm? Is it the compiler that is causing the problem, or the output? |
| 02:21 | Arafangion | (I suspect the compiler) |
| 02:21 | seangrove | Arafangion: the compiler |
| 02:21 | Arafangion | Cool. I actually have very little experience with clojure. (None, infact). However, you can indeed configure teh memory limit for the JVM. |
| 02:22 | Arafangion | But from memory, the JVM tends to like contigious memory, which gets problematic on 32-bit systems. |
| 02:30 | amalloy | what does contiguous memory have to do with a 32-bit system? or with the jvm? |
| 02:32 | Arafangion | amalloy: I dunno. Maybe they felt it simplified their memory model? I did notice that on Solaris at the time, the JVM was able to use all the memory space. |
| 02:32 | Arafangion | amalloy: But not on other systems. |
| 02:33 | Arafangion | amalloy: And 64-bit systems have a freaking rediculously large memory space, even with 41 or 47 bits available, so that's not a limitation anymore. (surely) |
| 02:34 | andyf | jonasen: [ANN] finally sent (got sidetracked with other things for a bit) |
| 02:39 | jonasen | andyf: Great! Hopefully people will find it useful. You've put a lot of effort into this release. And the fact that tools.analyzer(.jvm) has now been seriously battle tested is awesome! |
| 02:39 | andyf | jonasen: Thanks. I may slow down a bit on further enhancements for a while, but would like to make some more improvements to it in the future. Thanks for writing the original! |
| 02:40 | jonasen | improvements always welcome! :) |
| 02:45 | rurumate_ | I have a tree (nested sequence) of symbols, now trying to replace all '<> with 'foo everywhere. I figure it's best to use clojure.zipper, but have never used it. Any hints how to do it? |
| 02:46 | jonasen | rurumate: maybe http://clojure.github.io/clojure/clojure.walk-api.html#clojure.walk/postwalk-replace |
| 02:47 | amalloy | oh man, don't use zip for that. that won't work at all. use clojure.walk/postwalk, or writing your own recursive function isn't too hard |
| 02:47 | rurumate | jonasen: thanks |
| 02:47 | rurumate | just curious, what would be a typical use for clojure.zipper then? |
| 02:50 | rurumate | postwalk-replace works just fine |
| 02:58 | amalloy | clojure.zip is, i suppose, for when you care about the relationships between nearby nodes in a tree, or the relative positions of two nodes |
| 02:58 | amalloy | in practice i've never had a real use for it |
| 03:27 | bitemyapp | http://i.imgur.com/QXqJJju.jpg |
| 03:46 | andrew______ | anyone in here at the moment? |
| 03:46 | rurumate | I am |
| 03:48 | andrew______ | i'm just curious if anyone can explain why some functions would accept other expressions vs function literals with zero arguments, such as working with (future). it seems any function literal, with zero arguments, is the same as an actual expression, no? |
| 03:48 | andrew______ | why differentiate between them? |
| 03:50 | alexyakushev | andrew______: It's not clear to me what you are talking about, can you show an example? |
| 03:51 | amalloy | andrew______: it's just more convenient to not have to write the (fn [] ...), and it avoids cluttering your code with uninteresting artifacts |
| 03:51 | amalloy | the only downside is that future has to be a macro instead of a function then, but iirc there's ##(doc future-call) if you need the function version |
| 03:51 | lazybot | java.lang.SecurityException: You tripped the alarm! future-call is bad! |
| 03:51 | andrew______ | consider the difference between pcalls and pvalues. they are the same, but one takes expressions, the other #() functions with zero arguments. Seems unnecessary, since any function literal with zero arguments can be written even easier as a simple expression |
| 03:52 | andrew______ | #(+ 5 6) rather than just (+5 2) |
| 03:53 | amalloy | wait, are you asking why the version taking a function literal exists?/ because it's nice to have available functions that work with values rather than (in addition to) macros that work with expressions |
| 03:53 | andrew______ | but if the function is not allowed to accept any arguments, then how is this different than an actual expression? |
| 03:54 | amalloy | it's different because a function is a value that exists at runtime, and an expression is a thing that only exists in the mind of the programmer and the compiler |
| 03:57 | amalloy | you can write a function that calls some other function twice: (defn twice [f] [(f) (f)]) |
| 03:58 | amalloy | how do you make that take an expression instead of a function? it has to be a macro, and then you can't, say, map it over a list of functions |
| 03:58 | andrew______ | in the case of pcalls vs pvalues, it just seems odd to me that the programmer would prefer to add the # to the expression and make it a function when otherwise it is the same thing you are doing |
| 03:59 | andrew______ | pcalls will only accept functions with ZERO arguments, so your (twice) wouldn't be available; so what is the point of passing a no-argument function rather than just an expression? |
| 03:59 | amalloy | (defmacro twice* [expr] `[~expr ~expr]) is a pretty poor translation for several reaspons, but ignoring those, you can (map twice f g h), which you can't do for twice* |
| 03:59 | amalloy | er, (map twice [f g h]) |
| 04:02 | andrew______ | amalloy: your point makes sense when talking about functions with arguments, but what is the difference between passing a no-argument function and passing an expression, as is the difference between pcalls and pvalues functions? |
| 04:04 | andrew______ | perhaps if you had a stored function with no arguments, but the function referred to outside state, like an atom? then it would make sense to pass a no-argument function, of course this would not be a pure function if it used outside state. is that the purpose of pcalls, what it expects? |
| 04:05 | amalloy | you're missing the analogy. in my example, twice* is like pvalues, and twice is like pcalls. those take an expression and a function, respectively. twice* is nicer to work with sometimes, but isn't compatible with map. in the same way, pvalues is not a function that you can pass to any other function, whereas pcalls is |
| 04:06 | amalloy | another example: i can write a function (defn decorate-with-logging [f] (fn [x] (...magic using f...))), and i can call that function on the *value* pcalls, but i can't call it on pvalues |
| 04:06 | amalloy | (decorate-with-logging pvalues) => "compiler exception what is this i don't understand, pvalues isn't a value" |
| 04:07 | amalloy | (decorate-with-loggin pcalls) => "sure thing bro, here's your new decorated function" |
| 04:07 | andrew______ | both pcalls and pvalues return a lazy sequence. |
| 04:09 | andrew______ | you seem to be talking more about the implementation of pcalls vs pvalues, but to the programmer, why would you choose one over the other? writing #(+ 6 4) is no different than the expression (+ 6 4) |
| 04:09 | amalloy | i haven't called pvalues at all, or pcalls, in any of my examples |
| 04:09 | amalloy | i don't care what their return value is; i'm talking about what their values, the functions themselves, are |
| 04:09 | andrew______ | you said your twice function was like pcalls, and you were pointing out how twice implements differently than twice*, but I'm talking about the programmer using pcalls or pvalues |
| 04:10 | andrew______ | (pcalls #(+ 4 5) #(* 5 7)) vs (pvalues (+ 4 5) (* 5 7)) |
| 04:10 | andrew______ | I just don't see why the pcalls version is necessary |
| 04:11 | amalloy | nobody would ever write that call to pcalls in that scenario |
| 04:11 | amalloy | it's there for when your f or g are already functions, or when you need to use pcalls itself as a function for whatever reason |
| 04:11 | andrew______ | ah so maybe the book I'm reading (Practical Clojure) is just using a poor example |
| 04:12 | andrew______ | if your f and g are already functions, then since pcalls requires that the functions accept zero arguments, then what would these functions be doing that would make them necessary to stand alone as functions? would they typically be referring to outside state? |
| 04:13 | andrew______ | if I write a pure function with zero arguments, it would be meaningless I would think, since it's really just a single value return, like an expression |
| 04:14 | amalloy | pure functions of zero arguments are perfectly sensible. for example, it's a way to say "here's some computation i might need you to perform in the future, but don't do it yet because it's expensive" |
| 04:15 | andrew______ | that makes sense. ok, i'm just trying to understand the point of it all. i guess one could generate no-argument functions at runtime via a macro, and pass those to pcalls for parallel processing, that would make sense, perhaps. |
| 04:16 | andrew______ | or if those function were not pure and did something with outside state, that would make sense too for pcalls |
| 04:16 | amalloy | andrew______: that's what the ##(doc delay) macro is, really, a pretty wrapper around a no-argument function |
| 04:16 | lazybot | ⇒ "Macro ([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?" |
| 04:17 | andrew______ | i see. |
| 04:18 | andrew______ | well, it makes me think, that's for sure |
| 04:22 | andrew______ | i think the book i'm reading is outdated. i shows metadata maps as being prefixed by #^ but I think now it is just the ^ right? |
| 04:24 | ro_st | anyone using cljx here? |
| 04:24 | amalloy | copyright four years ago, andrew______. so, yes, miles out of date, but that doesn't really have anything to do with pcalls/pvalues |
| 04:25 | andrew______ | i know, different topic. |
| 04:26 | amalloy | all the p* functions are just marketing anyway. "look how easy it is to make your whole program magically parallel!". but in practice you have to work harder to make things usefully concurrent |
| 04:26 | amalloy | but yes. ^ is preferred over #^ in all cases, since...1.1? maybe 1.2 |
| 04:40 | andrew______ | the one issue I would think it quite necessary often is to know when a task ends that you sent to another thread. i know there are Watches for, is it agents? but what about all the other thread tools? |
| 05:27 | ro_st | i'm using cljx and prismatic's Schema. requiring Schema in my cljx for some reason doesn't put the schema source in out (with :optimizations :none). however, if i manually make a cljs file and require Schema, then it works. which is odd, because cljsbuild is just reading the cljs produced by cljx |
| 05:28 | ro_st | prismatic schema is itself a cljx project |
| 05:29 | ro_st | dnolen: any ideas? or should i check with cemerick? |
| 05:31 | ro_st | gah. timezones :-| |
| 05:45 | AeroNotix | can I add methods to a java type using extend-type (or anything else)? |
| 05:46 | AeroNotix | It looks like extend-type is to extend a type to implement protocols |
| 05:46 | AeroNotix | But I just want to add methods, I suppose I could wrap a java class with my own type, but it seems a bit meh |
| 05:47 | AeroNotix | hmm, proxy/ |
| 05:47 | AeroNotix | ? |
| 05:53 | AeroNotix | and can I have private methods on def{record,type} ? |
| 06:13 | bitemyapp | AeroNotix: ick. So much java stuff. |
| 06:14 | bitemyapp | AeroNotix: are you integrating with some Java necessity foisted upon you? |
| 06:14 | pyrtsa | What would "private" even mean for a Clojure record where all fields are "public" and "final" in the Java terminology? :) |
| 06:14 | bitemyapp | yeah the private part is pretty baffling. |
| 06:16 | AeroNotix | bitemyapp: exactly, yeah. I need to use an SDK from authorize.net |
| 06:17 | AeroNotix | bitemyapp: which otherwise I'd have to write SOAP bindings to their API. Which is woefully undocumented. |
| 06:17 | AeroNotix | pyrtsa: if I deftype something, I wanted to have a field which is not accessible. |
| 06:18 | AeroNotix | with def{record,type} they *need* to implement a protocol/interface? |
| 06:19 | AeroNotix | bitemyapp: this is what I have so far: https://gist.github.com/AeroNotix/17904c5daef83d1cbe05 |
| 06:20 | AeroNotix | feels like I'm hacking a type there with the Reporter interface |
| 06:20 | AeroNotix | protocol* |
| 06:21 | AeroNotix | This is my first non-toy clojure code. |
| 06:22 | mercwithamouth | how would one go about listening out for for links clicked with enfocus. say if i want to chain selectors.. #thisid.link with 'blah' title? https://gist.github.com/anonymous/8369691 |
| 06:26 | ggherdov | Hi. What's the canonical answer to the question "what book should I pick to get started in clojure" ? |
| 06:26 | mercwithamouth | Programming Clojure(oreilly) |
| 06:26 | ggherdov | mercwithamouth: thanks |
| 06:26 | mercwithamouth | To be honest i'm enjoying reading that one and clojure in action together. |
| 06:26 | mercwithamouth | I find it's better to pic a given subject then flip through several books.... |
| 06:28 | ggherdov | mercwithamouth: I see |
| 06:29 | mercwithamouth | pick* |
| 06:29 | ggherdov | mercwithamouth: any tought to "the joy of clojure" by that guy with a dragon face on twitter ? |
| 06:29 | ggherdov | fogus |
| 06:30 | ggherdov | preface by steve yegge sounds cool |
| 06:30 | ggherdov | anyways |
| 06:33 | wei__ | is there a good way to execute a .sql file with java.jdbc? |
| 06:33 | mercwithamouth | i bought it...i glance at it from time to time but i'm sill new to clojure as well. |
| 06:34 | mercwithamouth | it can't hurt. |
| 06:36 | mercwithamouth | any enfocus gurus? |
| 06:40 | mercwithamouth | ahh i see now |
| 07:24 | bitemyapp | ggherdov: joy of clojure is cool, don't listen to anything yegge says. |
| 07:25 | bitemyapp | ggherdov: JoC is good for people that have some degree of familiarity with either Lisp or FP. |
| 07:29 | ggherdov | bitemyapp: thanks. It's kinda my case, did some Ocaml in a past life |
| 07:34 | ddima_ | bitemyapp: why so harsh regarding yegge? ;) |
| 07:38 | Glenjamin | i found it a tad dry and difficult to get into |
| 07:38 | Glenjamin | but i think i was looking for something a bit more "do this, do that" |
| 07:46 | daGrevis | hi |
| 07:46 | daGrevis | looks okay? https://github.com/daGrevis/Project-Euler-in-Clojure/blob/master/004.clj |
| 07:49 | bitemyapp | ggherdov: close enough. |
| 07:49 | bitemyapp | Glenjamin: do this, do that is clojurebook.com |
| 07:50 | bitemyapp | ddima_: doesn't think, not much indication he's learned much in the last (counts in head) 9 years or so I've followed his writing. |
| 07:52 | andrew_____ | no doubt |
| 07:54 | andrew_____ | favorite programming bloggers? |
| 07:55 | bitemyapp | my favorite programmers don't blog. They have better uses for their time. |
| 07:55 | bitemyapp | I usually end up trying to extract information out of them on the occasion I catch them on twitter/reddit/IRC/stack overflow/haskell wiki |
| 07:56 | bitemyapp | or, at the very least, I don't know any of them for what blog they might or might not have. |
| 07:57 | andrew_____ | well there certainly are some good ones out there blogging, but none who deal with my new interests in FP and Clojure |
| 07:57 | andrew_____ | at least none that i've found |
| 07:57 | andrew_____ | for example there are some amazing bloggers in the iOS world, objective-C stuff |
| 07:59 | bitemyapp | andrew_____: the best resources I've found for Haskell and FP have mostly involved the wiki, Stack Overflow, white papers, books...code. |
| 08:01 | andrew_____ | i'm thinking about getting this book on FP: http://tinyurl.com/oy6fdwp |
| 08:03 | bitemyapp | andrew_____: do you know ML or Haskell? |
| 08:03 | andrew_____ | no, but i'd learn some ML quick with that book (there is actually very little Haskell in that book) |
| 08:03 | daGrevis | I have a coll. how can I check that all items in it are true? |
| 08:03 | bitemyapp | andrew_____: the original was only ML. IIRC, the author switches it up to flip between with strict-by-default and lazy-by-default. |
| 08:03 | andrew_____ | daGrevis map a simple if over the collection |
| 08:04 | bitemyapp | andrew_____: no. |
| 08:04 | bitemyapp | ,(every? identity [true false true]) |
| 08:04 | clojurebot | false |
| 08:04 | bitemyapp | ,(every? identity [true true true]) |
| 08:04 | clojurebot | true |
| 08:04 | daGrevis | andrew_____, i'm using map already ;) |
| 08:04 | andrew_____ | could do that too, of course |
| 08:04 | bitemyapp | daGrevis: what I just demonstrated is the idiom to use in Clojure. |
| 08:04 | daGrevis | bitemyapp, thanks ) |
| 08:04 | bitemyapp | you can't actually do it with a map. |
| 08:04 | bitemyapp | it's a fold. |
| 08:04 | andrew_____ | oh yes, you are right |
| 08:04 | andrew_____ | could reduce it, then? |
| 08:05 | bitemyapp | but why would you? |
| 08:05 | daGrevis | is fold a func? |
| 08:05 | andrew_____ | for fun, of course! |
| 08:05 | bitemyapp | andrew_____: I don't think it's the right time for that okasaki book. |
| 08:05 | bitemyapp | daGrevis: fold is a catamorphism. reduce is a function. In Haskell, foldl, foldl', and foldr are functions. |
| 08:05 | bitemyapp | daGrevis: reduce is foldl, ie, left. |
| 08:06 | bitemyapp | daGrevis: Clojure's reduce is augmented with a weird hack to make it a short-circuiting left fold. |
| 08:06 | daGrevis | bitemyapp, i see |
| 08:09 | andrew_____ | well, it's been fun, fellas |
| 08:09 | andrew_____ | i'm going to read some more now |
| 08:09 | andrew_____ | i'll save okasaki for next week |
| 08:12 | ddima_ | bitemyapp: ahk, thanks. haven't followed him too closely, but he gets mentioned a lot ;) |
| 08:18 | daGrevis | hey how could I say (range 1 infinity)? |
| 08:19 | hyPiRion | (iterate inc 1) |
| 08:19 | hyPiRion | or (rest (range)) |
| 08:19 | daGrevis | hyPiRion, thanks |
| 08:24 | hyPiRion | np |
| 08:35 | daGrevis | how can I say (take-while fn-with-args coll) |
| 08:35 | TimMc | daGrevis: (range 1 Double/POSITIVE_INFINITY) |
| 08:35 | TimMc | (another approach) |
| 08:36 | daGrevis | TimMc, cool ;) |
| 08:36 | TimMc | But bear in mind that if you really expect to hit some truly large numbers, range will not give you an infinite seq. |
| 08:36 | daGrevis | I guess I can use anon-fn |
| 08:36 | hyPiRion | daGrevis: that depends on the arguments. Usually you can wrap it in an anonymous function or use partial |
| 08:36 | hyPiRion | yeah |
| 08:36 | daGrevis | :) |
| 08:36 | TimMc | You want (iterate inc' 1) for that, since inc' will autopromote to BigInteger as needed. |
| 08:37 | daGrevis | what's '? TimMc |
| 08:37 | TimMc | Just part of the name of in' |
| 08:37 | TimMc | err, inc' |
| 08:37 | TimMc | (doc inc') |
| 08:37 | clojurebot | "([x]); Returns a number one greater than num. Supports arbitrary precision. See also: inc" |
| 08:37 | hyPiRion | TimMc: Now I want to check if that's actually a problem |
| 08:39 | daGrevis | TimMc, in that case,what's the difference between inc and inc'? |
| 08:39 | daGrevis | shit it shounds like ink in my head |
| 08:39 | hyPiRion | daGrevis: It's usually easier to explain with an example |
| 08:39 | hyPiRion | ,(inc Long/MAX_VALUE) |
| 08:39 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 08:39 | hyPiRion | ,(inc' Long/MAX_VALUE) |
| 08:39 | clojurebot | 9223372036854775808N |
| 08:50 | TimMc | daGrevis: See the "N" at the end of the latter result? That's how Clojure prints BigInteger, which isn't a fixnum. |
| 08:51 | daGrevis | TimMc, I see, thanks :) |
| 08:51 | TimMc | hyPiRion: That'll take a while... maybe try starting higher? :-P |
| 08:51 | hyPiRion | TimMc: No, that's why I want to try it :p |
| 08:52 | TimMc | &(time (/ 1 0)) |
| 08:52 | lazybot | java.lang.ArithmeticException: Divide by zero |
| 08:53 | hyPiRion | TimMc: JVM_OPTS='' time lein eval '(last (iterate inc 1))' |
| 08:54 | TimMc | heh |
| 08:55 | TimMc | hyPiRion: You don't think JVM startup time won't significantly affect the measurement? ;-) |
| 08:55 | hyPiRion | TimMc: I'll subtract a minute or two, for good measure :p |
| 08:55 | daGrevis | (take 1 coll) gives back (x). is there a better way to get back x without (first (take 1 coll)) |
| 08:56 | TimMc | (first coll) will do it |
| 08:56 | hyPiRion | daGrevis: (first coll) works, or (nth coll 1) |
| 08:56 | hyPiRion | (nth coll 0) I mean. Silly me |
| 08:57 | daGrevis | hyPiRion, ye, stupid me. :) |
| 08:58 | Morgawr | ibdknox: I noticed https://github.com/LightTable/LightTable/commit/e184b1b982cdd0b7aa8d2cb3276d54f13d98db53 this merge in LT, aside from the common flamewarsy issues... it's just a regex that changed "he" with "they" even in places where it doesn't make sense (they's, they doesn't, etc etc), shouldn't this be reverted or fixed in these places? |
| 09:01 | TimMc | haha |
| 09:02 | TimMc | A friend of mine who writes fiction often complains about not having a tool that can automatically swap out genders when he's midway through writing a story. |
| 09:02 | hyPiRion | Morgawr: yeah, looks a bit out of place. |
| 09:03 | Morgawr | hyPiRion: I know that "feminist software foundation" is just a troll/satire thing and I don't want to get into the matter (not worth the internet hate because of it), but objectively that merged request is just wrong because unmatched verbs lol |
| 09:03 | Morgawr | (regardless of the legitimacy of changing he/she with they/one) |
| 09:04 | TimMc | (But being a programmer, acknowledges that this would be mucho difficult.) |
| 09:04 | Morgawr | TimMc: bonus points if somebody finds how to do that in a single regex |
| 09:06 | hyPiRion | Morgawr: I don't know much about FSF, but I've realised the problems with he/she in documentation. At least they are attempting to remedy the issue, whether that's automated or not. |
| 09:07 | TimMc | hyPiRion: https://github.com/LightTable/LightTable/pull/1055 It's a troll. |
| 09:07 | Morgawr | hyPiRion: http://knowyourmeme.com/memes/events/c-plus-equality-c |
| 09:07 | hyPiRion | Oh, and by FSF I meant Feminist Software Foundation, not Free Software Foundation |
| 09:08 | TimMc | I doubt a legit request would confuse male defaulting with transphobia. |
| 09:08 | Morgawr | I just call Poe's Law in these cases and move on |
| 09:08 | Morgawr | because it's really not worth it to argue |
| 09:09 | bitemyapp | it says something that the PR was merged. |
| 09:10 | TimMc | bitemyapp: Yeah, that makes me sadpanda. It sets a bad precedent at the very least. |
| 09:10 | bitemyapp | One day, I'll have a library popular enough to get a PR from the feminist software foundation. |
| 09:10 | Morgawr | it was merged mostly because ibdknox can't be arsed to bear with this bullshit (at least that's what I infer from his tone), after all it's from upstream code so it shouldn't even be his concern (it will be re-merged as it was when the upstream code is updated anyway so who cares) |
| 09:11 | TimMc | Ah. Fair point. |
| 09:12 | bitemyapp | my antipathy for post modernism is glowing red. |
| 09:12 | Morgawr | bitemyapp: I feel you |
| 09:13 | bitemyapp | I think half of po-mo is an excuse for the developed world to navel-gaze so hard that western society collapses in on itself. |
| 09:13 | bitemyapp | and we'll deserve it. |
| 09:28 | Glenjamin | bitemyapp: cheers for the tip, i've done enough now that i'm ready to properly tackle JoC once the 2nd edition is done :) |
| 09:28 | Glenjamin | these testimonials sound good though, i might pick up clojure programming anyway |
| 09:29 | RickInAtlanta | I am reading the MEA right now |
| 09:29 | RickInAtlanta | MEAP |
| 09:29 | bitemyapp | I just learned this exists: http://en.wikipedia.org/wiki/Grand_Canal_(China) |
| 09:29 | Glenjamin | i've got the meap, but too lazy to read it all as pdf :D |
| 09:29 | bitemyapp | Mind boggling. |
| 09:30 | RickInAtlanta | I downloaded it as .mobi, using kindle reader |
| 09:30 | Glenjamin | i'm pretty sure i did the one that involves a paper book arriving at some point, so i expect a surprise present in the springtime |
| 09:38 | daGrevis | what is this line doing? let [ns (sort > nums) |
| 09:39 | daGrevis | exactly, sort > nums |
| 09:39 | daGrevis | sort isn't defined in that file and I can't find it in core api |
| 09:39 | Morgawr | dmi3y: defines 'ns' within the let binding by sorting "nums" using > comparator |
| 09:39 | Glenjamin | sort nums using > |
| 09:39 | lumafi | ,(sort > [3 2 4 1 5]) |
| 09:39 | clojurebot | (5 4 3 2 1) |
| 09:39 | Morgawr | ,(doc sort) |
| 09:39 | clojurebot | "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array." |
| 09:39 | daGrevis | lumafi, Morgawr it's not here :( http://clojuredocs.org/quickref/Clojure%20Core |
| 09:40 | daGrevis | thanks |
| 09:40 | hyPiRion | TimMc: (last (iterate inc 1)) takes more than one hour, at least |
| 09:40 | hyPiRion | I gave up at that point |
| 09:40 | Morgawr | daGrevis: http://clojuredocs.org/clojure_core/clojure.core/sort using the "search" at the top |
| 09:40 | Morgawr | but yeah, I usually use "doc" and "source" because they are great tools |
| 09:40 | Morgawr | one of the reasons I love clojure |
| 09:41 | RickInAtlanta | hyPiRion: Isn't that an infinite sequence? |
| 09:41 | Morgawr | hyPiRion: not sure if serious |
| 09:41 | hyPiRion | RickInAtlanta, Morgawr: No |
| 09:41 | hyPiRion | well, yes, but it errors |
| 09:41 | hyPiRion | ,(last (iterate inc (- 100 Long/MAX_VALUE))) |
| 09:42 | clojurebot | Execution Timed Out |
| 09:42 | hyPiRion | whops, wrong way |
| 09:42 | hyPiRion | ,(last (iterate inc (- Long/MAX_VALUE 100))) |
| 09:42 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 09:42 | Morgawr | ah, I see, it errors |
| 09:46 | expez | How do you load your project when using cider? Do you have to use C-c C-k on each file? Right now cider-jump et. al does nothing when acting on my own code. |
| 09:52 | progo | C-c C-k on core.clj does the trick |
| 09:55 | expez | thanks |
| 10:15 | mklappstuhl | whats the best place to jump start into clojurescript knowing javascript and some clojure? |
| 10:16 | insamniac | http://www.youtube.com/watch?v=MTxNnYfWHOw |
| 10:16 | insamniac | unless you don't like watching videos |
| 10:18 | insamniac | Really I shouldn't be answering, 'cause you and I are in the same boat. |
| 10:18 | RickInAtlanta | https://github.com/magomimmo/modern-cljs |
| 10:19 | insamniac | Neat. Thanks, Rick. |
| 10:19 | RickInAtlanta | np |
| 10:19 | insamniac | Are you in the atl-clj meetup group? |
| 10:19 | RickInAtlanta | Yep |
| 10:20 | RickInAtlanta | Are you? |
| 10:20 | insamniac | I wanted to go to that Datomic presentation |
| 10:20 | insamniac | yeah, but I live in Augusta |
| 10:20 | RickInAtlanta | That is tuesday |
| 10:20 | RickInAtlanta | ah, ok |
| 10:20 | insamniac | yeah.. I have like 2 vacation hours, otherwise I'd be going. |
| 10:21 | RickInAtlanta | Is there much Clojure in Augusta? |
| 10:22 | insamniac | I have no idea. Certainly not where I work. I don't socialize too much, but I don't think I've met anyone who's even heard of it. Unless they heard it from me. |
| 10:23 | Morgawr | Amsterdam clojure meetup representative checking in! :D |
| 10:23 | insamniac | I work with Java people who are reluctant to even adopt Groovy. |
| 10:24 | RickInAtlanta | There seem to be a few companies using Clojure in Atlanta. We probably have about half a dozen people who attend the meetings that get to use it for work |
| 10:25 | edw | When I was in Philly, we have an FP meet-up, which was always fun because you'd have the Clojure and Scala people there, feeling complete mutual hostility. |
| 10:27 | RickInAtlanta | There has been some talk about starting a FP group in Atlanta. The Clojure group meets every month, but Scala only met a couple of times last year |
| 10:27 | edw | My company is a next door to Foursquare, and one of my guys' gf works there, and so he was at the company Xmas party, where once of their alpha nerds ridiculed him for working at a company that used Clojure. |
| 10:27 | mklappstuhl | insamniac: don't really like videos. want to setup a quickstart stack and get my hands dirty kind of :) |
| 10:28 | RickInAtlanta | mklappstul, did you see my link, to modern-cljs |
| 10:28 | RickInAtlanta | https://github.com/magomimmo/modern-cljs |
| 10:28 | mklappstuhl | RickInAtlanta: that link (modern cljs) looks good :) |
| 10:28 | insamniac | Oh look at Rick's link |
| 10:28 | RickInAtlanta | :) |
| 10:28 | edw | (This ridiculing guy was a big Scale guy.) |
| 10:29 | Morgawr | edw: sounds like sour grapes :P does he get to work in Scala at the company? |
| 10:29 | insamniac | I think Foursquare is one of the first mentioned when you ask who uses Scala. |
| 10:30 | insamniac | early adopters |
| 10:30 | Morgawr | oh okay, I didn't know that (not much into the Scala world or companies world :P) |
| 10:30 | edw | Morgawr: I think so. I think he's a true believer. Some people aren't content to do their thing, they need to convince everyone else that what they're doing is wrong. For my part, I tell people to STFU about our Clojure use because I see it as a competitive advantage. |
| 10:31 | edw | Morgawr: Twitter's big into Scala. |
| 10:31 | edw | Is there a JVM-hosted Haskell? |
| 10:32 | Morgawr | I'm waiting for the day the world realizes that all these new language iterations are eventually going to converge into something that a few people have been using since the late 50s/early 60s, known as "Lisp" |
| 10:32 | Ember- | most likely no since JVM doesn't support TCO and that's kinda mandatory for Haskell |
| 10:32 | Pupnik_ | edw, yeah but i dont remmeber the name |
| 10:32 | Ember- | this one guy I know started to create a Haskell to java bytecode compiler |
| 10:32 | Morgawr | a quick googling gave me this http://jaskell.codehaus.org/ not sure if relevant |
| 10:33 | Ember- | he said it was pretty straightforward until he had to implement TCO where he hit a brick wall |
| 10:33 | edw | Ember-: Ah, good point. That's why I'm basically not a Scheme programmer anymore. |
| 10:33 | Pupnik_ | while you're at it give haskell lisp syntax |
| 10:34 | Morgawr | Pupnik_: it's called typed clojure ;) |
| 10:35 | edw | Pupnik_: While I'm a parens (and brackets and brockets and braces) man, Haskell's syntax is justifiable IMO because it's basically maths notation in seven-bit ASCII. |
| 10:37 | AeroNotix | So much misunderstandings in the last few sentences |
| 10:37 | insamniac | yeah, what the hell is a brocket |
| 10:37 | insamniac | hah |
| 10:38 | edw | E.g. "x <- A" can be read like "x is an element of A" and <- sort of looks like "∈". |
| 10:38 | edw | insamniac: Sorry, spent too much time in #scheme with Riastradh: angle brackets. |
| 10:38 | Morgawr | insamniac: a two-year-old red deer with its first horns |
| 10:38 | Morgawr | http://www.thefreedictionary.com/brocket |
| 10:38 | insamniac | haha |
| 10:39 | edw | Wow, the Free Dictionary wants to send notifications to my Message Center. Umm, no, but thank you. |
| 10:40 | edw | http://mumble.net/~campbell/scheme/style.txt |
| 10:40 | Morgawr | edw: sorry, I use that becaue duckduckgo redirects me there when I use !d |
| 10:40 | Pupnik_ | AeroNotix, care to elaborate? |
| 10:40 | edw | Actually, he uses "brokets". |
| 10:41 | edw | http://en.wiktionary.org/wiki/broket |
| 10:41 | edw | Not _his_ neologism. Perhaps an MIT AI Lab thing. |
| 10:41 | AeroNotix | Pupnik_: Morgawr saying that everything will eventually converge on everything being a lisp. It's just fail |
| 10:42 | AeroNotix | and the JVM supports tail recursive calls |
| 10:42 | Morgawr | AeroNotix: it was mostly a joke of mine |
| 10:42 | Morgawr | but trends seem to go that way feature-wise :P |
| 10:42 | AeroNotix | just not eliminating the stack at tail calls |
| 10:42 | AeroNotix | but recursive ones work, AFAIK |
| 10:43 | edw | I've been very fortunate in that I had a lot of experience on the metal in assembly, bit twiddling in C, etc, but also with Scheme. I think you need nice mix of high and low. The stars and the gutter. |
| 10:43 | AeroNotix | Morgawr: sure, go write a typesafe applicative monad in Clojure. I'll wait. |
| 10:44 | edw | AeroNotix: Isn't sime Quixote working on typed Clojure? |
| 10:44 | edw | s/sime/some/ |
| 10:44 | insamniac | ambrose |
| 10:44 | Morgawr | ^ |
| 10:44 | AeroNotix | What kind of typesystem is it going to have, though? |
| 10:45 | edw | What's the term the Scala true believers throw around imperiously? |
| 10:45 | Morgawr | AeroNotix: https://github.com/clojure/core.typed |
| 10:45 | Morgawr | (I don't personally know much about the details in typed clojure, the repo and docs probably know more) |
| 10:45 | Morgawr | but yeah, interesting project yadda yadda might be worth considering for the future yadda yadda |
| 10:45 | Pupnik_ | theres a clojure lib that ports haskells monad stuff over |
| 10:45 | Pupnik_ | thought not the type system |
| 10:45 | edw | Very odd how Haskell programmers seem to have less of a chip on their shouder than Scala one do. |
| 10:46 | AeroNotix | Pupnik_: and therein lies the fail |
| 10:46 | edw | s/one/ones/ |
| 10:46 | AeroNotix | ( |
| 10:46 | AeroNotix | (I'm not saying these things are needed, but they are different features which don't exactly fit in Clojure, and thus, mean that it is not converging on Lisp) |
| 10:47 | edw | AeroNotix: Good of you to keep the "fail" thing going. I was afraid that we might be living in a world where people didn't say "rofl" instead of laughing. |
| 10:48 | AeroNotix | edw: what on Earth are you talking about? Address my points instead of using ad hominem. |
| 10:49 | insamniac | Take a coffee break.. |
| 10:49 | AeroNotix | Morgawr: I just dislike fanaticism |
| 10:49 | AeroNotix | there's no need for it |
| 10:49 | insamniac | Who's being fanatical? |
| 10:50 | AeroNotix | Morgawr was bordering the line, insamniac |
| 10:50 | AeroNotix | but w/e. No big deal. |
| 10:50 | Morgawr | it was a joke D: |
| 10:50 | Morgawr | I'm far from a lisp fanatic |
| 10:50 | Morgawr | only lisp I've ever used is Clojure after years of coding in C (and I still consider that my favorite language) |
| 10:51 | edw | AeroNotix: Sigh. A bit quick on the ad hominem trigger, yes? I've simply got sick of people saying "FAIL!" and "EPIC FAIL!" |
| 10:51 | AeroNotix | edw: cool |
| 10:52 | edw | s/got/gotten/ |
| 10:52 | AeroNotix | Typed clojure sounds annoyingly like Dialyzer |
| 10:52 | edw | AeroNotix: Please recall that I was defending Haskell's syntax supra. |
| 10:53 | AeroNotix | edw: ok, standing down. I don't care. |
| 10:53 | edw | AeroNotix: Sounds good to me. |
| 10:53 | AeroNotix | Anyone with experience of typed clojure and dialyzer? |
| 10:54 | AeroNotix | Watching a video here seems to make it look very similar in usage |
| 10:54 | dnolen | AeroNotix: Typed Clojure is not really all that related to dialyzer at all |
| 10:54 | dnolen | AeroNotix: dialyzer is not a type system |
| 10:54 | Morgawr | isn't dyalizer more like a linter? |
| 10:54 | dnolen | AeroNotix: Typed Clojure is a fully typed dialect of Clojure, based on Typed Racket, tons of prior research |
| 10:54 | Morgawr | dialyzer* |
| 10:55 | AeroNotix | Morgawr: bit of both, really |
| 10:55 | AeroNotix | dnolen: hmm ok |
| 10:55 | dnolen | Morgawr: yes |
| 10:55 | dnolen | AeroNotix: good chunk of ML derived type system ideas are present in Typed Clojure and then some, like typed heterogenous maps |
| 10:56 | edw | I wonder, on the topic of type inference, how much it even makes sense in Clojureland, since so many data structures are simply maps. Maps that could theoretically by checked against schemas, I suppose, which could constitute a sort of type membership test. Hmm. |
| 10:56 | AeroNotix | dnolen: interesting. Are people using it in production? |
| 10:56 | dnolen | AeroNotix: yep |
| 10:56 | AeroNotix | wicked |
| 10:56 | insamniac | dnolen: Is there gonna be a talk on Om that will make it to ClojureTV any time soon? |
| 10:56 | Morgawr | talking about linters, saw this a few minutes ago https://groups.google.com/forum/#!msg/clojure/uITu1sT3SaQ/c85ih4zM4qwJ |
| 10:56 | dnolen | insamniac: don't think so, but I expect to giving talks about it plenty this year |
| 10:57 | insamniac | Come on down to Georgia |
| 10:57 | insamniac | You'll have at least one person in the audience. |
| 10:57 | dnolen | insamniac: heh :) |
| 10:57 | edw | dnolen: Is the name inspired by the restaurant? |
| 10:58 | dnolen | edw: no play on DOM, and Om from sanskrit |
| 10:59 | edw | Good restaurant though. UES. Fugue states have been entered after meals there. |
| 11:02 | RickInAtlanta | sorry, was away.... insamniac two |
| 11:05 | insamniac | RickInAtlanta: Are there any big conferences in ATL? I've only just started to try and be less antisocial. |
| 11:06 | insamniac | The wife does like going to ATL for the vegan restaurants though. |
| 11:06 | RickInAtlanta | insamniac: DevNexus is next month. |
| 11:06 | RickInAtlanta | I think there is going to be an open source conference in late spring or early summer... |
| 11:06 | insamniac | Interesting. Now to get my boss to pay for it. |
| 11:07 | RickInAtlanta | conference isn't expensive. $240 for 2 day event. but it is a monday and tuesday... I was going to go last year, but I just started a new job the week before, and didn't feel like asking for time off right away |
| 11:10 | RickInAtlanta | http://greatwideopen.org/ open source conference in Atlanta, April 2 and 3 |
| 11:14 | dnolen | lsdafjklsd: you there? |
| 11:14 | insamniac | RickInAtlanta: Cool. I will make an effort to attend both of those. |
| 11:14 | lsdafjklsd | dnolen: ya man |
| 11:15 | dnolen | lsdafjklsd: this is yours right? https://github.com/swannodette/om/issues/54 |
| 11:15 | lsdafjklsd | dnolen: no |
| 11:15 | dnolen | lsdafjklsd: oh hmm, very similar looking code :) |
| 11:15 | dnolen | lsdafjklsd: k thanks |
| 11:17 | lsdafjklsd | dnolen: that's wierd :p |
| 11:22 | webstonne | hello |
| 11:23 | insamniac | Hell-o |
| 11:24 | webstonne | what is the hot jobs in Clojure right now? |
| 11:24 | webstonne | web apps? |
| 11:25 | Morgawr | I'm working on game development but I'm probably one of the few people (maybe 5? 10?) doing so in clojure |
| 11:25 | webstonne | you use HTML5 with that? |
| 11:25 | Ember- | I can guarantee that there are more than 10 ppl worldwide doing game development with clojure |
| 11:25 | webstonne | and Clojure as the scripting? |
| 11:25 | Morgawr | I've done a couple of ClojureScript games with HTML5 yeah but now I'm working on a Clojure (JVM) engine |
| 11:25 | Morgawr | non-html5 |
| 11:25 | Morgawr | Ember-: I hope so :D |
| 11:26 | webstonne | I see ... |
| 11:26 | Ember- | the very least I could see clojure as a server side language for mmorpgs and such |
| 11:26 | Ember- | that's game development too |
| 11:26 | webstonne | I'm just trying to get a feel on where things are |
| 11:27 | RickInAtlanta | have you seen moorepl? It is a browser based mud that allows players to script the environment in Clojure. |
| 11:27 | Glenjamin | dnolen: can cljs/om run server-side? is there a suggested approach for rendering the initial page load in a crawler-friendly way? |
| 11:27 | RickInAtlanta | Not production ready, but it looked like a neat experiment |
| 11:27 | edw | webstonne: We (at my start-up) use Clojure extensively for web service development and data processing. |
| 11:27 | dnolen | Glenjamin: https://github.com/swannodette/om/issues/47 |
| 11:28 | Glenjamin | awesome, thanks |
| 11:28 | dnolen | Glenjamin: but also you could easily make a small library that generates the type of markup that React expects |
| 11:28 | dnolen | Glenjamin: I think this is the real solution versus running CLJS server side |
| 11:28 | Glenjamin | the thought struck me as i was watching the react presentation from jsconfeu |
| 11:28 | webstonne | yes, data processing ... thanks. I was thinking about that |
| 11:29 | Morgawr | RickInAtlanta: can't find it via google, got a link? |
| 11:29 | edw | webstonne: Cascalog was actually, about three years ago, the catalyst for my dropping Scheme (for fun) and Python (for profit) and using Clojure in production. |
| 11:29 | edw | ...for both fun and profit. |
| 11:29 | Glenjamin | the "big data" team at my work seem to just be using hive - which seems like cheating to me |
| 11:30 | RickInAtlanta | ah I spelled it wrong, murepl https://github.com/nathanielksmith/murepl |
| 11:33 | edw | Glenjamin: We wound up moving from Heroku Pg to Redshift for a lot of our reportorial work. |
| 11:34 | Glenjamin | they mostly just have a big oracle db, i think hadoop was just an excuse to spend some cash |
| 11:36 | delihiros | hi all. I'm reading IFn.java (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java) now, but I can't understand why invoke being defined like this. Is there any reason for that? |
| 11:37 | webstonne | You think ClosureScript will give Hive a run for it's money? |
| 11:38 | edw | Glenjamin: I spent a lot of time working with Hadoop in the context of Cascalog a few years ago, and we've spent a lot of time with EMR at the current gig. The esteem in which I hold Hadoop monotonically decreases. It works--or can be made to work--but it's a skanky kludge. |
| 11:38 | edw | It drove me away from Cascalog. |
| 11:38 | webstonne | and become a first class query language working with big data? |
| 11:38 | edw | webstonne: Not sure what you mean; are you suggesting a MongoDB-style DB using CLJS as a query language? |
| 11:39 | Glenjamin | SQL is so good because it's a declarative approach to extracting data, and its been around long enough that pretty much everyone knows it |
| 11:39 | Glenjamin | to be better than SQL for querying data, you'd have to be *very* good |
| 11:39 | Glenjamin | meanwhile someone will take whatever you've done, and write a way to translate SQL into it |
| 11:39 | Glenjamin | and the cycle begins again :p |
| 11:39 | webstonne | MongoDB-style DB using CLJS as a query language? ... yes something on that order |
| 11:40 | Glenjamin | delihiros: it's a speed trick for the JVM afaik |
| 11:40 | Glenjamin | "Object... args" is slow |
| 11:40 | Glenjamin | so if you can avoid that, you'll be faster |
| 11:41 | edw | A good friend of mine (who is very opinionated) has said that you can either make MongoDB safe or fast. Sort of like the MySQL of old. |
| 11:41 | delihiros | Glenjamin: oh, didn't know that, thank you |
| 11:41 | Glenjamin | i think neither is true |
| 11:41 | Glenjamin | we're using it as a non-primary |
| 11:41 | Glenjamin | so we turned off fsync, and write concerns, and journalling |
| 11:41 | Glenjamin | and it's still not that fast |
| 11:42 | edw | I think, uncharacteristically, my friend was being generous. |
| 11:42 | Morgawr | RickInAtlanta: wow, murepl looks cool as hell, thanks for the link! |
| 11:42 | RickInAtlanta | Glenjamin: I am getting ready to start a project, I was going to use Mongo. Do you have an alternative I should explore? |
| 11:42 | edw | Redis, on the other hand, has become my hammer. |
| 11:42 | Glenjamin | RickInAtlanta: i hear good things about rethink, but it depends on your problem space |
| 11:43 | Glenjamin | mongo will probably be good-enough |
| 11:43 | RickInAtlanta | Morgawr: yeah, he did a talk about it at the Atlanta meetup group. I thought it was fantastic. |
| 11:43 | Glenjamin | as would postgres/mysql |
| 11:43 | edw | RickInAtlanta: It comes down to what your data looks like, and how you want to query it, and what you're willing to be slow vs fast, and whether you're willing to spend shit-tonnes of money. |
| 11:44 | RickInAtlanta | edw: cost is a much bigger issue than speed in this case |
| 11:44 | Morgawr | RickInAtlanta: is there a video of such talk? |
| 11:44 | Glenjamin | someone was pointing out to me the other day that for most side-projects, in-memory maps + slurp/spit to disk is probably "good enough" |
| 11:44 | edw | For example, if your data set is big, Redis is out of the question. (Or if you want to, you know, not program atop a fairly primitive datastructure store.) |
| 11:44 | RickInAtlanta | Morgawr: no, no video. sorry |
| 11:45 | Morgawr | RickInAtlanta: aw, shucks, but still great project |
| 11:45 | edw | Glenjamin: Yes, that or Pg. |
| 11:45 | Glenjamin | mm |
| 11:45 | Glenjamin | my main complaint about pg |
| 11:45 | Glenjamin | is that its a proper database |
| 11:45 | Glenjamin | with strict types |
| 11:45 | Glenjamin | and i'm lazy when i use dynamic languages |
| 11:45 | edw | Glenjamin: I say Pg because it's easy to provision and writing to a local disk is not always possible. |
| 11:46 | Glenjamin | yeah, i'm on heroku for my app so currently thinking i'll use pg |
| 11:46 | edw | Glenjamin: Yes, I hear you on that. There's always serializing to TEXT/BLOB columns. |
| 11:46 | Glenjamin | but so far i'm managing to get away with only using cookies + logs :D |
| 11:47 | edw | Glenjamin: Exactly. I'm becoming a big fan of HTML local storage. If only iClould would sync that across my devices. |
| 11:47 | webstonne | maybe this is the video I need to watch to see some of the future possibilities of Clojure may be heading ... http://www.youtube.com/watch?v=2WLgzCkhN2g |
| 11:47 | Glenjamin | oo, that'd be neat |
| 11:47 | Glenjamin | i've got a /hax URL on mine that spits out a QR code containing the whole session data |
| 11:47 | webstonne | Master Plan for Clojure Enterprise Mindshare Domination - Neal Ford |
| 11:48 | edw | QR codes can hold an aribtrary amount of data? Do they just get larger? |
| 11:48 | Glenjamin | my session is small :D |
| 11:48 | Glenjamin | but technically, yes i think they can be arbitrarily large |
| 11:48 | edw | That would be the first justifiable use of QR I've come across. |
| 11:49 | Glenjamin | and if you know you're in a high-fidelity situation you can turn down the error correction to decrease entropy |
| 11:49 | Glenjamin | login on desktop, transfer to mobile is a nice flow |
| 11:49 | webstonne | thanks for all the great input. catch you all later |
| 11:49 | edw | Back in the old days, there was a product that would scan paper and turn it into binary files. It was big (to the extent that it was ever big) back when computer magazines had pages of code in them. |
| 11:50 | Glenjamin | do you recall when TV shows about games used to broadcast the binary at the end of the credits? |
| 11:50 | edw | What was that? Shit, that was almost thirty years ago. |
| 11:50 | edw | Glenjamin: Sadly, I missed that. |
| 11:55 | Glenjamin | i'm failing to find any reference to this on the internet |
| 11:55 | Glenjamin | but i'm sure it was a thing |
| 12:03 | Glenjamin | do you guys think i should invest my time learning emacs, or learning lighttable & making plugins for the bits it doesn't do yet? |
| 12:05 | AeroNotix | Depends how much you care |
| 12:05 | AeroNotix | emacs really integrates well with Lisps, LightTable is not really proven in the sense that emacs is |
| 12:06 | varioust | eme |
| 12:06 | edw | Glenjamin: Emacs but keep an eye on Lighttable. |
| 12:06 | Glenjamin | yeah, i'm trying to guess whether the learning curve of emacs is more of a problem than the immaturity of lighttable |
| 12:07 | edw | Glenjamin: Emacs will be around in fifty years. |
| 12:07 | Morgawr | edw: not if lighttable beats it ;) |
| 12:07 | edw | I've been using Emacs for over twenty. |
| 12:08 | edw | Morgawr: I hear you. And I wouldn't mind, I suppose. |
| 12:09 | edw | Let me know when I can M-C-h to select a top-level form in Lighttable. But again, I'm a big fan of it. |
| 12:09 | edw | Morgawr: It being LT. |
| 12:14 | mercwithamouth | i switch between emacs and light tablee every few weeks. |
| 12:16 | gcganley | im thinking of moving from vim to emacs because i'm learing clojure. is there a way to adapt keystrokes from vim to emacs? |
| 12:16 | mercwithamouth | evil |
| 12:16 | mercwithamouth | ...if i'm not mistaken though vim as fireplace is it? |
| 12:17 | edw | Not to be confused with 'vile'. |
| 12:17 | gcganley | oh wow thats exactly what im looking for, but is it more worth it to relearn the keystrokes of emacs or just use evil |
| 12:18 | edw | gcganley: In general, I think, when learning something new, you should let the essence of that thing wash over you, and not try to constantly be thinking about it in relation to something which has a completely differen gestalt. |
| 12:19 | edw | s/differen/different/ |
| 12:20 | edw | gcganley: These days, Emacs is fairly approachable if used with a windowing system. We had web designers using XEmacs in an X11 session back in '98 at CDNOW. Now _that_ was a nightmare. |
| 12:21 | edw | gcganley: I used to be Emacs-in-a-terminal true believer, but I've been using Emacs as a Cocoa app for the last six months, and I'm OK with that now. |
| 12:21 | gcganley | edw: im dual booting windows 8.1 and arch linux but i mainly use windows for the gameing and rebooting into archlinux is a bit of a hassel, is the win32 version of emacs as mature and powerful as the *nix version/ |
| 12:21 | gcganley | *? |
| 12:21 | clojurebot | * is just for when you are lazy and sloppy |
| 12:22 | mrhanky | does anybody know a good resource for using cljs.async? i don't get this whole stuff :/ |
| 12:22 | edw | gcganley: I don't know, but I believe that there's a Windows build of Emacs 24.4, which means it's the same Emacs we Unix/Mac users are using. |
| 12:23 | edw | Or a 24.3, which is the latest stable release. |
| 12:23 | edw | Lots of great polish in 24.4 though. |
| 12:24 | gcganley | edw: is it strictly needed to learn elisp to use emacs to its full potential or is it just something you use for key binding customization |
| 12:24 | gcganley | edw: also thanks for helping out |
| 12:24 | edw | gcganley: You should consider starting up Emacs, typing Control-H then 't' and then spending an afternoon learning Emacs. |
| 12:24 | edw | gcganley: No, you don't need to know elisp at all for Emacs to be an awesome editor. |
| 12:25 | edw | gcganley: You're welcome. |
| 12:25 | Glenjamin | i've done C-h t twice now |
| 12:25 | Glenjamin | after the first time i didn't touch emacs for a month or two |
| 12:26 | Glenjamin | then accidentally opened it in my shell and couldn't remember how to exit |
| 12:27 | edw | Glenjamin: C-x C-c. I was utterly traumatized by vi when I first encountered in back in '89. I pissed off the sysadmin because I would hang his serial line because I'd disconnect. ESC ":q!" |
| 12:27 | Glenjamin | yeah, i found it in the end |
| 12:28 | Glenjamin | it doesn't help that cocoa emacs allows cmd+q |
| 12:28 | edw | Glenjamin: Maybe the point is that you _can't_ quit until you learn how. :P |
| 12:28 | gcganley | yeah my Visual Studio buffers are full of :x |
| 12:28 | Glenjamin | i was doing C-h a and looking for "quit" |
| 12:28 | Glenjamin | not knowing the term i needed was kill |
| 12:28 | Glenjamin | for years the only vim i knew was :q! |
| 12:28 | edw | gcganley: A friend and colleague would send me email messages filled with stuff like that. |
| 12:29 | edw | Glenjamin: Right! ":q! EDITOR=emacs crontab -e ..." |
| 12:29 | Glenjamin | heh, even worse |
| 12:29 | Glenjamin | EDITOR=nano |
| 12:40 | gtrak | how do I make this work? ## (read-string "cljs.core//") |
| 12:40 | lazybot | java.lang.RuntimeException: Invalid token: cljs.core// |
| 12:40 | Glenjamin | gtrak: what are you trying to do? |
| 12:41 | gtrak | slurp the spitted output of the cljs analyzer back into a data structure. |
| 12:41 | gtrak | chokes on the '/' var. |
| 12:41 | Glenjamin | oh, i see |
| 12:41 | gtrak | so, prn is creating something that read can't handle |
| 12:43 | Glenjamin | ## (read-string "clojure.core//") |
| 12:43 | lazybot | ⇒ clojure.core// |
| 12:43 | gtrak | special-case? |
| 12:44 | Glenjamin | interesting |
| 12:44 | echosa | Hey, all. Google has failed me. What can I do about this: "Don't know how to write JSON of class org.h2.jdbc.JdbcClob" (using clojure.data.json and clojure.java.jdbc) |
| 12:44 | gtrak | well, I can special case it in mine with some replaces |
| 12:44 | echosa | The issue seems to be with SQL tables defined with "text" columns |
| 12:44 | gtrak | then replace it later... |
| 12:45 | Glenjamin | ## (let [/ 1] /) |
| 12:45 | lazybot | ⇒ 1 |
| 12:45 | gtrak | ##(symbol "cljs.core//") |
| 12:45 | lazybot | ⇒ cljs.core// |
| 12:45 | gtrak | ##(name (symbol "cljs.core//")) |
| 12:45 | lazybot | ⇒ "" |
| 12:45 | gtrak | hmm |
| 12:45 | gtrak | ##(name (symbol "cljs.core/" "/")) |
| 12:45 | lazybot | ⇒ "/" |
| 12:46 | gtrak | ah, lol |
| 12:46 | gtrak | ##(symbol "cljs.core/" "/") |
| 12:46 | lazybot | ⇒ cljs.core/// |
| 12:46 | Glenjamin | hrm |
| 12:46 | gtrak | that makes no sense |
| 12:47 | gtrak | ah, my fault, actually, extra slash |
| 12:47 | gtrak | ##(symbol "cljs.core" "/") |
| 12:47 | lazybot | ⇒ cljs.core// |
| 12:47 | Glenjamin | i think it's a reader thing |
| 12:47 | Glenjamin | i can assign to "user//" |
| 12:47 | Glenjamin | and access as "/" |
| 12:47 | Glenjamin | but not as "user//" |
| 12:47 | gtrak | it's definitely a reader thing |
| 12:48 | Glenjamin | i guess either prn should turn it into a call to symbol, or the reader should handle it |
| 12:49 | Glenjamin | weird that clojure.core// works though |
| 12:49 | Glenjamin | although it wants a second newline on the repl for some reason |
| 12:52 | gtrak | I'm doing a string/replace on input, followed up by a clojure.walk |
| 12:53 | gtrak | not the worst thing in the world |
| 12:54 | echosa | Ah, had to add a custom :row-fn to my (sql/query) call that does this: (with-open [rdr (java.io.BufferedReader. (.getCharacterStream value))] |
| 12:54 | echosa | {:id (:id row) :name (apply str (line-seq rdr))}) |
| 12:54 | echosa | Oops. That shouldn't have been two lines/messages. |
| 12:57 | Glenjamin | hrm, seems inelegant - is there a protocol you can extend to tell clojure.java.jdbc what to do? |
| 12:59 | Glenjamin | echosa: it looks like you should be able to extend the http://clojure.github.io/java.jdbc/#clojure.java.jdbc/ISQLValue to your type |
| 13:00 | Glenjamin | or actually, it's the json bit that's missing the protocol |
| 13:00 | Glenjamin | http://clojure.github.io/data.json/#clojure.data.json/JSONWriter |
| 13:01 | echosa | Ah, JdbcClob is not in the list of "known implementations" |
| 13:01 | Glenjamin | mm |
| 13:01 | echosa | Not sure how to add an implementation. Off to Google I go! |
| 13:01 | Glenjamin | you can just implement that protocol for JdbcClob, and it should work nicely |
| 13:02 | Glenjamin | http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/extend |
| 13:02 | echosa | This is my first clojure experience and project. Trying to learn it. I've written Lisp stuff before, just never clojure. |
| 13:03 | Glenjamin | if you've used haskell at all, this is similar to type classes |
| 13:05 | gtrak | efff yes |
| 13:05 | gtrak | about 20 minutes away from a cljs-autodoc proof of concept :-) |
| 13:07 | TimMc | hyPiRion: I think I left (last (iterate inc 1)) running overnight once. |
| 13:07 | Glenjamin | presumably it runs forever? |
| 13:08 | gtrak | more importantly, start of infrastructure to do more |
| 13:08 | TimMc | What you should do is (time (try (last (iterate inc (- Long/MAX_VALUE 100000))) (catch ArithmeticException ae :whoops!))) |
| 13:08 | TimMc | hyPiRion: ^ then you can estimate how long it would take starting at 1 |
| 13:09 | Glenjamin | i guess clojure doesn't automatically coerce a long into a double? |
| 13:10 | Glenjamin | (like JS) |
| 13:24 | echosa | really dumb, newbie question: Can someone explain reify? |
| 13:26 | xificurC | ,(doc reify) |
| 13:26 | clojurebot | "([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args+] body)* Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for meth... |
| 13:27 | andersf | echosa: if you're familiar with java, reify is very much like creating anonymous classes |
| 13:27 | echosa | xificurC: I've read the docs, but I still get confused when I see "reify" or "reified" in the stuff I'm reading. |
| 13:27 | gfredericks | "reified" would be a more general idea |
| 13:28 | echosa | andersf: Ah. Hm. I need to keep that in mind when I'm reading about it. Might help me understand better. Thanks. |
| 13:28 | xificurC | you can take a protocol or interface and extend it or override some of its methods |
| 13:28 | gfredericks | echosa: "reify" could refer to that general concept or to the macro clojure.core/reify |
| 13:29 | Glenjamin | "make this instance respond to these protocols in this way" - is that the idea? |
| 13:29 | gfredericks | ,(deref (reify clojure.lang.IDeref (deref [this] {:this this :foo 42}))) |
| 13:29 | clojurebot | {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: #>, :foo 42}>, :foo 42}>, :foo 42}>, :foo 42}>, :foo 42} |
| 13:29 | gfredericks | lol |
| 13:29 | gfredericks | fantastic example there :P |
| 13:30 | echosa | There's a bot in here that executes code? That is fantastic. |
| 13:30 | xificurC | e.g. you can return an object that implements ISeq but change its seq method |
| 13:30 | gfredericks | ,(count (reify clojure.lang.Counted (count [this] 30000))) |
| 13:30 | clojurebot | 30000 |
| 13:31 | echosa | So, similar to method overloading? At least that's what the (count) example seems to show. |
| 13:31 | gfredericks | echosa: what other langs are you familiar with? |
| 13:32 | echosa | PHP, JavaScript, Java, in that order |
| 13:32 | gfredericks | aw dang PHP is the one I know the least :) |
| 13:33 | Glenjamin | var a = {}; a.toString = function() { return "abc" }; console.log("" + a) |
| 13:33 | Glenjamin | kinda like that, if i'm following correctly |
| 13:34 | matt444 | emacs newb question. I'm using clojure mode, can wrap with parens using M-( |
| 13:34 | matt444 | But cannot wrap brackets |
| 13:34 | matt444 | How are people doing this? |
| 13:34 | gfredericks | matt444: I always make an empty pair of brackets and then use slurp |
| 13:34 | xificurC | C-<right> |
| 13:34 | gfredericks | I don't often do things optimally though |
| 13:35 | echosa | matt444: I let paredit handle my braces/parens/brackets/quotes for me. |
| 13:35 | matt444 | echosa: not sure what you mean |
| 13:35 | echosa | paredit is an emacs package you can install |
| 13:36 | echosa | and it's awesome for handling all those things I mentioned |
| 13:36 | matt444 | i know, i have it |
| 13:36 | echosa | takes a few minutes to get used to it |
| 13:36 | matt444 | it comes with clojure mode |
| 13:36 | echosa | ah, then specifically you can do what gfredericks sais about slurping |
| 13:36 | echosa | *said |
| 13:36 | gfredericks | which is M-) I think |
| 13:37 | echosa | I believe so |
| 13:37 | gfredericks | at least for me |
| 13:37 | gfredericks | (from inside the []) |
| 13:37 | matt444 | maybe paredit isn't on be default with clojure mode, should check |
| 13:37 | echosa | so given: "thing to wrap" |
| 13:37 | gfredericks | matt444: the modes are usually listed at the bottem |
| 13:37 | gfredericks | M-x paredit-mode to toggle on/off |
| 13:37 | echosa | I would do this: () "thing to wrap" |
| 13:37 | echosa | then inside the () type M-) |
| 13:37 | matt444 | gfredericks: bottom of what? |
| 13:37 | gfredericks | matt444: right below the buffer |
| 13:37 | echosa | check your modeling for "Paredit" |
| 13:38 | Glenjamin | just above the minibuffer in the bottomright |
| 13:38 | echosa | *mode-line |
| 13:38 | gfredericks | usually inside parens |
| 13:38 | gfredericks | it lists the major mode and all the minor modes |
| 13:39 | xificurC | echosa: back to reify, take an interface like ISeq that supports first and rest/next etc. You could take this interface and extend it with a new method or substitute some of its method with another |
| 13:39 | matt444 | (Clojure Paredit Fill) |
| 13:39 | matt444 | I guess those are my modes? |
| 13:39 | xificurC | so you could change rest to e.g. drop the first 2 values instead of just 1 |
| 13:40 | matt444 | So with paredit what is the keybinding to wrap brackets? |
| 13:40 | echosa | xificurC: Awesome. I think I get it now. :) |
| 13:40 | echosa | matt444: See my example above for the paredit way of doing it. |
| 13:40 | xificurC | anyway, I have a question of my own: how should I test a function's side effects? |
| 13:40 | clojurebot | excusez-moi |
| 13:40 | echosa | Otherwise, there's another excellent packages called wrap-region |
| 13:41 | xificurC | matt444: ctrl+right |
| 13:41 | gfredericks | xificurC: what sort of side effects? |
| 13:41 | matt444 | echosa: I don't get your example. You want me to type: () "thing to wrap"? |
| 13:41 | gfredericks | xificurC: I'm not sure what you meant by "extend it with a new method" but it sounds wrong |
| 13:41 | xificurC | should work when you are inside a bracketed expression. You will 'slurp' the next s-expression/symbol/... |
| 13:41 | matt444 | echosa: I'm trying to wrap text that already exists |
| 13:42 | gfredericks | matt444: type literally: [ C-f M-) |
| 13:42 | danno | Question: The reader. I read a few books on it, and I seem to think that the reader is like java.io.Reader, but it reads clojure forms, unevaluated. |
| 13:42 | danno | I am in the right frame of mind? |
| 13:42 | gfredericks | danno: java.io.Reader is an interface for doing IO |
| 13:42 | danno | yeah, just doing an analogy |
| 13:42 | gfredericks | danno: the clojure reader is more like a function that converts textual data to clojure data |
| 13:42 | xificurC | gfredericks: like a function that takes a csv file and splits it into many? |
| 13:42 | gfredericks | danno: not necessarily anything to do with IO |
| 13:43 | matt444 | what is the meta key on osx? |
| 13:43 | danno | gfredericks, doesn't it read in chunks? |
| 13:43 | echosa | matt444: "thing to wrap" was just some example text that, in my example, would end up wrapped in parens |
| 13:43 | danno | much like IO does? (I know it is not IO, I am just trying to make mental bridge) ;) |
| 13:43 | echosa | I was basically just saying you should put () before whatever you want to wrap, then inside the parens type M-) |
| 13:44 | matt444 | echosa: I want to wrap brackets, not parens |
| 13:44 | gfredericks | danno: it has a lot more to do with parsing than IO; e.g., read-string will convert a string to a clojure data structure |
| 13:44 | muhoo | is it wrong to find it worrisome that so many web tools rely on macros, to the point that stuff like this is necessary? https://github.com/flyingmachine/liberator-templates/blob/master/src/com/flyingmachine/liberator_templates/core.clj#L42 |
| 13:44 | danno | gfredericks: thanks, that helped! ;) |
| 13:45 | echosa | Then type [] instead of () and do the same thing |
| 13:45 | gfredericks | danno: ##(read-string "[1 2 {3 4}]") |
| 13:45 | lazybot | ⇒ [1 2 {3 4}] |
| 13:45 | echosa | Sorry, I wasn't clear on that |
| 13:45 | matt444 | echosa: so type: [] before the thing I want to wrap, then M-) |
| 13:45 | matt444 | ? |
| 13:45 | gfredericks | matt444: yes |
| 13:45 | echosa | type M-) with your cursor inside or on the [], yes |
| 13:45 | gfredericks | M-) will slurp the next thing into the form your point is over |
| 13:46 | gfredericks | the paredit cheatsheet has a nice before/after syntax showing you what things do |
| 13:46 | matt444 | ok, will try it once I can figure out what the meta key is, thanks |
| 13:46 | xificurC | matt444: meta is usually Alt |
| 13:46 | Glenjamin | matt444: meta is either tap <esc> or hold alt |
| 13:46 | Glenjamin | depending on your terminal |
| 13:46 | Glenjamin | in default Terminal alt isn't meta by default, but you can change it |
| 13:47 | matt444 | holy wow it worked |
| 13:47 | matt444 | thank you |
| 13:47 | Glenjamin | http://cdn.osxdaily.com/wp-content/uploads/2013/02/meta-key-mac-os-x-terminal.jpg |
| 13:47 | Glenjamin | taken from http://osxdaily.com/2013/02/01/use-option-as-meta-key-in-mac-os-x-terminal/ |
| 13:48 | xificurC | so, any cool ideas how to test if a function that splits one csv file into several ones could be put in a test? |
| 13:48 | matt444 | i use iterm, thanks though |
| 13:48 | gfredericks | xificurC: oh sorry I thought you were commenting on the reader discussion |
| 13:48 | gfredericks | xificurC: start test by creating a CSV file, run the function, then check that the split ones are there |
| 13:49 | xificurC | gfredericks: I did that but I thought I could put some test cases in a file, you know, automated testing |
| 13:50 | echosa | Correction: my slurp command is C-), not M-) |
| 13:50 | xificurC | but since its a function that only does side effects testing (is (= nil (function-here))) doesnt make much sense :) |
| 13:52 | Glenjamin | you probably have to either abstract away the filesystem, or actually interact with the filesystem |
| 13:53 | echosa | Once you write an (extend) do you have to do anything to activate it or have it picked up? It's like mine isn't getting run. Does it need to be in the same namespace as the original protocol? |
| 13:56 | arrdem | -*/ |
| 13:56 | arrdem | 0 |
| 13:59 | danno | Noob Q: (println (1 2 3)) //java.lang.Long cannot be cast to clojure.lang.IFn |
| 13:59 | danno | (println 1 2 3) of course is fine |
| 14:00 | hyPiRion | danno: 1 is not a function name |
| 14:00 | hyPiRion | (1 2 3) would be the same as doing 1(2, 3) in C-like languages |
| 14:01 | danno | hyPiRion: Got it, thanks |
| 14:01 | danno | (+) is interesting that it returns 0, since I was expecting some sort of function |
| 14:02 | hyPiRion | ,(+ (*) (+)) |
| 14:03 | clojurebot | 1 |
| 14:03 | danno | hyPiRion: Wow |
| 14:04 | danno | hyPiRion: I am sure I will read about the comma here shortly, is that a macro of some sort? |
| 14:04 | Glenjamin | the comma just tells the irc bot to eval |
| 14:04 | danno | oh |
| 14:05 | hyPiRion | yeah, in clojure code, it's considered whitespace |
| 14:05 | danno | So (+ (*) (+)) will evaluate to (+ 1 0) which evaluates to 1? |
| 14:05 | danno | checking |
| 14:05 | hyPiRion | yes |
| 14:05 | danno | ,(*) |
| 14:05 | clojurebot | 1 |
| 14:05 | danno | boom |
| 14:05 | danno | nice |
| 14:06 | Glenjamin | echosa: as long as it gets evalled, and the protocol matches it should "just work" |
| 14:06 | echosa | That's what I thought, but it doesn't seem to be working |
| 14:07 | Glenjamin | if you try it in a repl |
| 14:07 | echosa | (extend org.h2.jdbc.JdbcClob json/JSONWriter {:-write write-clob}) |
| 14:08 | echosa | with a require of [clojure.data.json :as json])) |
| 14:08 | Glenjamin | now try (json/-write <clobinstance>) |
| 14:08 | Glenjamin | wait, no |
| 14:08 | danno | Noob Q: So quote is meant for representing data that will not be evaluated unless you want it to be evaluated? |
| 14:09 | echosa | ick.. making a clobinstance by hand doesn't sound like a good time :-/ |
| 14:09 | Glenjamin | (json/pprint <clobinstance>) |
| 14:12 | echosa | Well, I figured it out. The (extend) was find, but the function I was calling was not. Fixed that and it fixed the issue. |
| 14:12 | echosa | However, now I've run into another issue which, I think, will mean I can't use the (extend) and will have to go back to defining the :row-fn in my sql/query calls. |
| 14:12 | echosa | "The object is already closed." |
| 14:13 | echosa | By the time I get to where json needs to do it stuff, the DB connection/object is closed, so I can't get the string text value out of the JdbcClob object |
| 14:13 | echosa | which is really frustrating |
| 14:13 | echosa | JdbcClob is starting to seem really useless, but that's what my SQL stuff is using for columns defined as type "text" |
| 14:14 | Glenjamin | echosa: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/IResultSetReadColumn |
| 14:15 | Glenjamin | i think that will let you do what you need |
| 14:21 | echosa | this clob really seems like more trouble than it's worth |
| 14:22 | Glenjamin | the usual assumption is if its in a text/blob field, you don't want to eagerly read it |
| 14:22 | Glenjamin | because its "big" |
| 14:22 | Glenjamin | and therefore requires special handling |
| 14:23 | Glenjamin | ideally you'd want to only read the stream when sending it down the wire as a response - so you never need the whole thing in memory. Although that might be far trickier |
| 14:23 | echosa | I understand that, however it seems that special handling needs to take place during the query, which makes sense and is how I had it working before, but keeps me from being able to extend the JSONWriter protocol to do the processing for me. |
| 14:24 | Glenjamin | can you just keep the database resource open until the end of the request? |
| 14:25 | echosa | instead, I have to add a custom function I found online as the :row-fn for sql/query calls, passing in the row and the clob value to be converted |
| 14:25 | echosa | hm, maybe? not exactly sure how that would work or how clean it would be |
| 14:30 | kristof | Oh |
| 14:30 | kristof | Does Clojure have finalizers? |
| 14:30 | kristof | This was something I sometimes missed in Common Lisp, since you could potentially leak file handles and resources because GC is so arbitrary |
| 14:31 | bbloom | kristof: java has finalizers, yes |
| 14:31 | kristof | Ok |
| 14:31 | kristof | Is there any clojure-interface to that or do you have to use the interop? |
| 14:33 | bbloom | kristof: i could be wrong, but i don't think overriding finalize is exposed at the CLJ level. you need to write a java class & use that |
| 14:33 | bbloom | somebody else may correct me if i'm wrong |
| 14:33 | bbloom | but it's definitely a host-only feature, since javascript doesn't have finalizers, for example |
| 14:34 | kristof | Ah, alright |
| 14:34 | bbloom | it's pretty rare you need finalizers for cleanup though, unless you're wrapping something native/external, b/c everything in the java base class library already has finalizers for managing external resources |
| 14:34 | kristof | Oh, my Java is lacking, so I didn't know that |
| 14:34 | bbloom | kristof: see also ##(doc with-open) for deterministic cleanup |
| 14:34 | lazybot | ⇒ "Macro ([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order." |
| 14:35 | echosa | fuck it, I'm going back to the :row-fn solution. I can't get anything else to work. |
| 14:35 | kristof | bbloom: Right, but with-*** macros are good for when only one body of code is accessing a resource, but sometimes you need to keep the resource open for many different functions, potentially |
| 14:36 | kristof | and then close when they're all out of scope. Which is the point of finalizers, of course, which ties resource deallocation to the object instead of the accessing functions |
| 14:36 | gfredericks | huh; I just tried to do a finalizer and it looks like it was called twice |
| 14:36 | kristof | But yes, I suppose I'll learn more Java :) |
| 14:36 | gfredericks | then I looked at the docs and it said they're never called twice o_O |
| 14:36 | bbloom | kristof: i'm quite familiar with the problems, just trying to let you know what tools are available |
| 14:37 | bbloom | gfredericks: yeah, sooo turns out they are never called twice... unless they wind up keeping the object aline |
| 14:37 | bbloom | alive* |
| 14:37 | bbloom | gfredericks: a pointer to the object might escape during finalization, i dunno.. say to *1 in your repl or something like that :-P |
| 14:37 | gfredericks | bbloom: *1 isn't the case here |
| 14:37 | gfredericks | yeah it's consistently called twice |
| 14:37 | kristof | bbloom: Oh, alright. :) So the answer is that the JVM is going to do finalizing automatically for a lot of common resources, and if it doesn't then I can simply write a Java class. |
| 14:37 | bbloom | gfredericks: i've seen taht for sure |
| 14:37 | gfredericks | I put the thing in a var and then redef the var |
| 14:37 | gfredericks | I'll try making it a local |
| 14:38 | gfredericks | still twice |
| 14:38 | gfredericks | I did (let [x (reify ...)] "not using x") |
| 14:38 | gfredericks | maybe something weird about the clojure compiler |
| 14:39 | bbloom | kristof: yes. or use a custom scheme such as a ref count or something like that |
| 14:39 | bbloom | kristof: gfredericks: there is also a finalization queue thinggie i don't know much about |
| 14:40 | hyPiRion | gfredericks: It's because Clojure is twice as good as java |
| 14:40 | bbloom | gfredericks: http://docs.oracle.com/javase/7/docs/api/java/lang/ref/ReferenceQueue.html |
| 14:41 | bbloom | gfredericks: are you using reify or something? |
| 14:41 | hyPiRion | bbloom: gfredericks| I did (let [x (reify ...)] "not using x") |
| 14:43 | bbloom | there was something about with-meta too at some point |
| 14:43 | bbloom | oooh yeah |
| 14:44 | gfredericks | I'll try a deftype |
| 14:44 | bbloom | ,(instance? clojure.lang.IObj (reify)) |
| 14:44 | clojurebot | true |
| 14:44 | bbloom | reify creates an object, then promptly creates another one with metadata on it :-/ |
| 14:45 | gfredericks | actually let me log the object id |
| 14:45 | bbloom | good thinking |
| 14:46 | gfredericks | yeah two different objects |
| 14:46 | gfredericks | good ole' reify |
| 14:47 | gfredericks | yep just once with deftype |
| 14:47 | mercwithamouth | hmm what's the purpose of using 'declare'? |
| 14:47 | gfredericks | mercwithamouth: referencing things before defining them |
| 14:47 | bbloom | mercwithamouth: lets you definite mutually recursive top-level functions |
| 14:48 | bbloom | mercwithamouth: declare creates a mutable Var object but doesn't initialize it like def does |
| 14:48 | mercwithamouth | o_O |
| 14:49 | gfredericks | clojure clojure mutable clojure redefine mutate clojure clojure |
| 14:49 | mercwithamouth | https://github.com/ckirkendall/chatter-box/blob/master/src/client/chatter_box/chat_view_component.cljs like line 19 |
| 14:50 | bbloom | mercwithamouth: that's just sloppiness actually |
| 14:50 | steerio | let me think up an easy example for you |
| 14:50 | bbloom | mercwithamouth: somebody wrote the functions in a haphazard order & then added a declare to the top to let them use things before they were defined |
| 14:50 | mercwithamouth | bbloom: the example i showed? yeah it didn't seem beneficial to me |
| 14:51 | bbloom | mercwithamouth: yeah, you can just re-order that file to be def-before-use and the declare will go away |
| 14:51 | mercwithamouth | ahh so if you do that...you don't have to worry about what order your functions are? |
| 14:51 | steerio | it's _not_ for that |
| 14:51 | steerio | :) |
| 14:51 | steerio | i mean what you say is technically true |
| 14:51 | bbloom | lol thanks steerio i was trying to figure out how to say that |
| 14:51 | steerio | but let's say your function "foo" calls "bar" at some point, which calls "baz", which in turn uses "foo" |
| 14:51 | steerio | there would be no right order without using declare |
| 14:52 | mercwithamouth | lol well thank you for stopping me before before i mapped that usage to my mind =P |
| 14:52 | mercwithamouth | steerio: i see |
| 14:52 | mercwithamouth | ok that makes sense. |
| 14:53 | bbloom | mercwithamouth: i basically only ever use it when i have some tree traversal & there is like a top-level traverse function & all the other functions need to call it, but it can't be defined until all the other functions exist |
| 14:53 | steerio | but in this example, using declare on exactly one function's var is enough |
| 14:54 | mercwithamouth | bbloom: i gotcha |
| 14:54 | mercwithamouth | useful... |
| 14:55 | steerio | i used it in other situations but it's definitely rarely needed |
| 15:08 | mercwithamouth | hrmm now is anyone here awesome as far as enfocus is concerned? |
| 15:11 | Raynes | ~anyone |
| 15:11 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 15:12 | mercwithamouth | Raynes: lol i was waiting for that =P |
| 15:12 | Raynes | Sorry <3 |
| 15:13 | mercwithamouth | i'll save it for tomorrow when I can form intelligent questions. i'm trying to figure out how to get defsnippet to work...and i have quite a few other things i'd like to try |
| 15:27 | dubonlin | hi all... I've got a question about things evaluating to themselves in clojure. Here it says that "Strings, numbers, characters, true, false, nil and keywords evaluate to themselves." http://clojure.org/evaluation |
| 15:27 | dubonlin | And basically every single book and blog and whatnots about Clojure repeats this. |
| 15:27 | TEttinger | dubonlin, yeah. for example... |
| 15:27 | TEttinger | ,(+ 1 2) |
| 15:27 | clojurebot | 3 |
| 15:27 | TEttinger | ,1 |
| 15:27 | clojurebot | 1 |
| 15:27 | dubonlin | Yes, I know that |
| 15:27 | dubonlin | My question is: what about regexp? |
| 15:28 | TEttinger | hm |
| 15:28 | dubonlin | don't they also evaluate to themselves? |
| 15:28 | TEttinger | ,#"/s+" |
| 15:28 | clojurebot | #"/s+" |
| 15:28 | TEttinger | ,#"\s+" |
| 15:28 | clojurebot | #"\s+" |
| 15:28 | TEttinger | interesting |
| 15:28 | TEttinger | they actually evaluate to a pattern IIRC |
| 15:28 | dubonlin | Isn't that "missing" from that page? |
| 15:29 | TEttinger | ,(class #"\s+") |
| 15:29 | clojurebot | java.util.regex.Pattern |
| 15:29 | dubonlin | ,(class (eval #"\s+")) |
| 15:29 | clojurebot | java.util.regex.Pattern |
| 15:29 | TEttinger | so there you go, they evaluate to something that could be construed as being different from the literal |
| 15:30 | ddima | dubonlin: i think its mentioned in the doc-page of 're-pattern' |
| 15:31 | dubonlin | TEttinger: and so it's the REPL which knows how to print the Pattern? And what it prints happens to look like the literal? |
| 15:31 | ddima | hm, its not. well. |
| 15:31 | TEttinger | I'm guessing that, dubonlin |
| 15:31 | TEttinger | ,(java.util.regex.Pattern.) |
| 15:31 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.util.regex.Pattern, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:31 | TEttinger | ,(java.util.regex.Pattern. "\s+") |
| 15:31 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \s> |
| 15:31 | hyPiRion | dubonlin: Regexes doesn't evaluate to themselves because you cannot compare them |
| 15:33 | ddima | a little confused, my repl doesnt print the pattern "string" itself when evaluated |
| 15:33 | ddima | more like #<user$eval151$fn__152 user$eval151$fn__152@2b22a363> |
| 15:35 | sandbags | Is there a way to do a "global require"? I'm using print-foo for debugging and would rather not have to require it in every file |
| 15:36 | joegallo | sandbags: https://code.google.com/p/clj-nstools/ |
| 15:36 | ddima | sandbags: you could "monkey patch" clojure.core ;) |
| 15:38 | sandbags | hrmm... thanks for the suggestions ;-) |
| 15:38 | Morgawr | joegallo: that's pretty cool, thanks for sharing |
| 15:38 | `cbp | you could probably make leiningen do that? |
| 15:38 | ddima | its not really something you shoud want to do imho |
| 15:38 | joegallo | i'm actually with ddima on this one |
| 15:38 | `cbp | maybe bind one of the less used dynamic vars to your fn :-D |
| 15:38 | sandbags | yes i was hoping for something built in |
| 15:38 | joegallo | but, yeah, sure, if you must do it, then there's this thing over here |
| 15:38 | joegallo | and may god have mercy on your soul |
| 15:38 | sandbags | or in lein |
| 15:39 | ddima | joegallo: well, at first it will be awesome, and then two months later... world of hurt ;) |
| 15:39 | joegallo | yup |
| 15:39 | sandbags | ah well, it's not such a big deal, i am just lazy |
| 15:39 | sandbags | and easily irritated by such things :) |
| 15:40 | `cbp | maybe use slamhound to write your ns declarations |
| 15:41 | sandbags | thing is, if i have to modify my ns declarations that defeats the purpose of not having to modify my ns declarations :) |
| 15:42 | technomancy | IMO that belongs in your editor rather than your project config |
| 15:42 | gtrak | cemerick: working autodoc on a cljs analyzer dump :-) http://i.imgur.com/BrAc61U.png?1 Will work on an writing up the issue for cljsbuild. |
| 15:42 | technomancy | it should be an nrepl -op |
| 15:42 | `cbp | i thought the purpose was to be lazy |
| 15:42 | technomancy | then there's no way it can pollute your source accidentally |
| 15:42 | cemerick | gtrak: sweet |
| 15:42 | Morgawr | yeah I agree with ddima, I wouldn't want to use something as obfuscate as hiding namespace inclusion, just thought joegallo's link was still cool (To show stuff you can do with Clojure) |
| 15:42 | sandbags | technomancy: yes that makes sense to me |
| 15:44 | sandbags | anyone used jamii's strucjure library? |
| 15:44 | sandbags | https://github.com/jamii/strucjure |
| 15:49 | technomancy | sandbags: sorry, I should have mentioned that it's not reasonably easy to implement right now |
| 15:50 | rurumate | ##java has 386 nicks, #clojure 684 8o |
| 15:50 | technomancy | just that's the way it "should" be |
| 15:50 | sandbags | technomancy: yes that's what i understood you to mean :) |
| 15:50 | technomancy | working on it though |
| 15:51 | sandbags | better yet |
| 15:52 | dubonlin | I still don't get it. |
| 15:52 | dubonlin | ,(eval (eval 3)) |
| 15:52 | clojurebot | 3 |
| 15:52 | dubonlin | ,(eval (eval #"[0-9]")) |
| 15:52 | clojurebot | #"[0-9]" |
| 15:52 | dubonlin | so regexp don't eval to themselves but they eval to something that evals to itself? |
| 15:54 | hyPiRion | dubonlin: Well, sort of |
| 15:55 | arohner | has anyone gotten a datomic peer running on heroku to connect to a cloudformation transactor? How does authentication work? |
| 15:56 | hyPiRion | regexes prints a version of themselves which gives the exact same semantics as the original one |
| 15:56 | arohner | I have a tiny app that I'd like to avoid starting another AWS instance for |
| 15:56 | ddima | ohdamn, when i asked why my repl didn't behave the same way, my muscle memory actually typed #(" instead of just #". I should put the wine aside ;) |
| 15:59 | dubonlin | ddima: ^ ^ |
| 16:00 | gfredericks | ,(nth (iterate eval 42) 1000) |
| 16:00 | clojurebot | 42 |
| 16:00 | gfredericks | wait since when does clojurebot support eval? |
| 16:00 | gfredericks | &(eval 42) |
| 16:00 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 16:00 | gfredericks | ,(def foo 12) |
| 16:00 | clojurebot | #'sandbox/foo |
| 16:00 | gfredericks | ,(System/exit 1) |
| 16:00 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 16:00 | TEttinger | haha |
| 16:00 | gfredericks | ,(eval '(System/exit 1)) |
| 16:00 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 16:00 | TEttinger | nice try gf3 |
| 16:00 | TEttinger | gfredericks |
| 16:00 | gfredericks | hooray |
| 16:01 | gfredericks | ,eval |
| 16:01 | clojurebot | #<core$eval clojure.core$eval@c1f463> |
| 16:01 | gfredericks | I always found it odd that eval bots didn't support eval |
| 16:02 | gfredericks | ,(alter-var-root #'eval (constantly identity)) |
| 16:02 | clojurebot | #<core$identity clojure.core$identity@153bf5b> |
| 16:02 | gfredericks | ,(eval 'foo) |
| 16:02 | clojurebot | (eval (quote foo)) |
| 16:02 | gfredericks | oops I broke it |
| 16:03 | gfredericks | ,(+ 1 2 3) |
| 16:03 | clojurebot | (+ 1 2 3) |
| 16:03 | dubonlin | ,(eval (eval (re-pattern "\\d+"))) ; so a java.util.regex.Pattern evals to itself? |
| 16:03 | clojurebot | (eval (eval (re-pattern "\\d+"))) |
| 16:03 | dubonlin | erf |
| 16:04 | dubonlin | gfredericks: thanks for breaking the bot ^ ^ |
| 16:04 | dubonlin | gfredericks: now fix it :) |
| 16:05 | abaker | so for getting into using EDN as a local config file - looks like spit/pr-str and slurp/read-string is that the idiomatic way of doing it? |
| 16:05 | gcganley | (def life 42) |
| 16:06 | abaker | or is there an edn library out there that's more commonly used for managing config files |
| 16:06 | hyPiRion | dubonlin: (eval (eval x)) always return x, unless it is a seq or list |
| 16:06 | bja_ | abaker, I use environ |
| 16:07 | abaker | bja_: that looks like it abstracts environment variable access across shell env, JVM properties, and lein.. I was thinking more of reading a config file like, ~/.my-app-config, where the file was EDN and could very quickly read/write it out |
| 16:08 | bja_ | what kind of config do you need that is more complicated than strings and ints? |
| 16:08 | abaker | lists of stuff, some stuff with their own lists of properties, etc |
| 16:09 | bja_ | then I don't really know of anything in general use, spit/slurp would be my solution |
| 16:09 | dubonlin | hyPiRion: thanks a lot, copy/pasting all these explanation down : ) |
| 16:10 | abaker | ok thanks |
| 16:10 | abaker | lots of innovation compels me to ask what the latest thoughts are ;) |
| 16:11 | steerio | environ does support vectors, maps, etc. |
| 16:12 | steerio | through profiles |
| 16:12 | steerio | https://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.md |
| 16:13 | abaker | thanks |
| 16:14 | bja_ | steerio, that requires you to have lein around when you're in prod thought right? |
| 16:14 | abaker | related EDN question - is there a standard Java library out there for exposing non-clj code via EDN data structures (e.g. adding an EDN serializer to a web service) ? |
| 16:14 | bja_ | i.e. you can't just uberjar and ship an example properties file or a shell file to be sourced and integrated in your ops platform? |
| 16:15 | abaker | ah looks like there is: https://github.com/bpsm/edn-java |
| 16:17 | bja_ | abaker, you could always write a wrapper in clojure and AOT it |
| 16:17 | bja_ | around something proven like tools.reader |
| 16:18 | gtrak | bja_: clojure's a little heavy to be used for just one thing like that, for most java proejcts |
| 16:19 | technomancy | bja_: you can use environ without lein; no problem |
| 16:19 | technomancy | whatever daemonization tool you use just gets pointed at a config file containing k=v stuff |
| 16:20 | bja_ | technomancy, I know that. the question was relating to if you use advanced data structures in a lein profile for environ, it probably wouldn't also work with environment variables or properties files |
| 16:20 | technomancy | bja_: oh right; didn't read that far back =) |
| 16:20 | technomancy | bja: yes, environment variables aren't good for nested config; try carica for that |
| 16:23 | bja_ | I wish I had access to the config wrapper I wrote over environ at my last job. I liked being able to specify config settings with defaults in a single place (foo.config) and then reference them throughout the project in a sane manner |
| 16:23 | bja_ | it was nice being able to look at one place and know all the settings and all the defaults |
| 16:23 | technomancy | carica gets you that |
| 16:24 | bja_ | carica doesn't load stuff via environment variable though does it? |
| 16:25 | technomancy | no, just maps on disk |
| 16:25 | bja_ | it seems to let you override stuff, so you could easily build a function/macro that uses environ to override stuff while providing sane defaults |
| 16:25 | gfredericks | ,(+ 1 2) |
| 16:25 | clojurebot | 3 |
| 16:25 | gfredericks | ,(eval (Object.)) |
| 16:25 | clojurebot | #<Object java.lang.Object@e1b565> |
| 16:26 | technomancy | bja_: oh yeah; that's practically a must with environ--not being able to change config without restarting is terribad |
| 16:28 | bja_ | I used my system to implement config changes via the server's http interface if you had the right credentials |
| 16:28 | bja_ | made it easy for the ops guys |
| 16:29 | bja_ | also let them do things like use curl to find out system state |
| 16:29 | bja_ | makes debugging easier |
| 16:29 | gfredericks | I'm digging through five year old files to figure out what to keep; just found a repo called "meajure" with a bunch of php in it o_O |
| 16:29 | gf3 | TEttinger: WHAT DID I DO!?!? |
| 16:29 | gf3 | oh gfredericks |
| 16:29 | gf3 | rude |
| 16:29 | TEttinger | sorry |
| 16:29 | pcn | Oh, that's a sonian project |
| 16:29 | gfredericks | gf3: yeah nice try |
| 16:29 | amalloy | (inc gfredericks) |
| 16:29 | lazybot | ⇒ 35 |
| 16:30 | gfredericks | gf3: fix all my other mistakes too |
| 16:30 | gf3 | ugh |
| 16:30 | technomancy | more like meaculpa |
| 16:32 | gfredericks | oh I think it was a mediawiki install for tracking stuff _about_ a project called "meajure" |
| 16:32 | gfredericks | phew |
| 16:32 | ddima | there should totlally be a package named "meaculpa" |
| 16:32 | ddima | what could it be? hmm. |
| 16:32 | ddima | probably something for ignoring failing tests, like to good old -DskipTests |
| 16:37 | ddima | sorry if i broke any conversational thread, im just not funny ;) |
| 16:37 | gfredericks | ooh I even found some stuff from before I knew how to do version control |
| 16:38 | gfredericks | files name foo.MMDDYY |
| 16:39 | gfredericks | a python file that contains one line: def zToQ(i, |
| 16:41 | arohner | If I have s3-wagon-private set up, can I resolve deps 'normally', through central + clojars, then upload everything to my private s3 repo? |
| 16:50 | gtrak | what emacs bits end up calling the rizt nrepl complete middlewares? |
| 16:50 | gtrak | ritz*, rather. |
| 16:53 | gtrak | nrepl-ritz, I'm guessing |
| 16:58 | logic_prog | in core.async, is there a way to do _rate limited_ channels ? |
| 17:01 | dnolen | logic_prog: it's not difficult to make a throttle chan |
| 17:02 | logic_prog | dnolen: something that requires taking a (timeout 10ms) |
| 17:02 | logic_prog | before every [msg (<! ...) ] ... |
| 17:02 | dnolen | logic_prog: yes a throttle channel |
| 17:02 | logic_prog | i.e. something like (let [_ (<! (timeout limit)) \n msg (<! ... )] ... ) ? |
| 17:02 | dnolen | logic_prog: it worth figuring out how to write it yourself, it's pretty informative |
| 17:08 | grandy | hello, just curious if clojurescript supports aspect oriented constraints? |
| 17:13 | dnolen | grandy: it probably can with some work |
| 17:13 | grandy | dnolen: cool |
| 17:18 | logic_prog | if a channel is full, and multiple sources do (>! ) on the channel, is it fifo ? |
| 17:20 | dnolen | logic_prog: yes unless you use a dropping or sliding buffer |
| 17:20 | Kaini1123 | I am learning Clojure and wrote a program that can execute WHILE-programs (usage example: https://gist.github.com/anonymous/8376364 ) Code: https://gist.github.com/anonymous/8377244 I need some feedback: Is this code ugly or doing not idiomatic things? How can I make this code "better" (more Clojure-style)? |
| 17:31 | tbaldridge | is there any way at all to gen a class that inherits an abstract class, while at the repl? |
| 17:31 | tbaldridge | besides proxy that is. |
| 17:33 | amalloy | Kaini1123: looks pretty good to me, with a few small issues |
| 17:33 | hyPiRion | Kaini1123: It's a very long "snippet", but most things look fine by me. Only thing I'd do different is to make the execute-statement to a multimethod |
| 17:34 | amalloy | eg, execute-statements should just be (reduce execute-statement vars code) |
| 17:35 | amalloy | and line 58, read-variables, should be using the same into/{} as ask-variables is - apply hashmap mapcat is not very nice |
| 17:35 | Kaini1123 | hyPiRion, I think 170 lines is ok for this kind of problem, multimethod, I'll look into that |
| 17:36 | Kaini1123 | amalloy, looks like I didn't know about into/{} when I wrote this method :) |
| 17:37 | hyPiRion | Kaini1123: yeah, it's fine for the problem, but people on IRC would probably not be as tempted to look at it |
| 17:38 | hyPiRion | That's what I meant |
| 17:40 | Kaini1123 | probably true, but you two did |
| 17:40 | Kaini1123 | however thanks for the feedback |
| 17:45 | steerio | bja_: yes, that's right about leiningen. sorry, got distracted. |
| 17:45 | steerio | i mean about environ vs leiningen |
| 17:53 | rhg135 | hello * |
| 17:54 | rhg135 | https://www.refheap.com/22781 anybody got an idea why that inner loop isn't running untiul AFTER the client disconnects? |
| 17:55 | rhg135 | according to a trace i know that but it doesn't help much |
| 17:56 | rhg135 | it worked a few moments ago but i can't recall what i changed |
| 17:58 | justin_smith | is accept-seq both lazy and blocking? |
| 17:58 | rhg135 | hmm |
| 17:58 | rhg135 | i think |
| 17:59 | justin_smith | also, are you certain that the io/writer flushes on newline? |
| 17:59 | justin_smith | you may need to explicitly flush |
| 17:59 | rhg135 | now |
| 17:59 | rhg135 | no* |
| 17:59 | rhg135 | hence why i manually flush |
| 18:00 | justin_smith | ahh, so jim/write! flushes? |
| 18:00 | rhg135 | yup |
| 18:00 | justin_smith | oh and sorry, now I see that the def of accept-seq is right there |
| 18:01 | rhg135 | i think the server socket doesn't get created until it's closed |
| 18:01 | rhg135 | that's weird |
| 18:01 | FatsDT | Why doesn't (group-by .isDirectory (.listFiles (clojure.java.io/file "."))) work? |
| 18:01 | justin_smith | that is weird |
| 18:01 | TEttinger | hm, any ideas why an uberjar would be far slower at runtime than running with lein run ? I have a bunch of resources in the project's root/resources , if that helps |
| 18:01 | justin_smith | FatsDT: .isDirectory is not callable |
| 18:01 | rhg135 | i thought clojure wasn't that lazy |
| 18:01 | justin_smith | it is a method |
| 18:02 | justin_smith | FatsDT: to group-by you need something callable, try #(.isDirectory %) |
| 18:02 | TEttinger | or memoize |
| 18:02 | TEttinger | ,(doc memoize) |
| 18:02 | clojurebot | "([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use." |
| 18:02 | TEttinger | err that wasn't it |
| 18:02 | TEttinger | ,(doc memfn) |
| 18:02 | clojurebot | "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn. name may be type-hinted with the method receiver's type in order to avoid reflective calls." |
| 18:03 | FatsDT | justin_smith: Thank you! |
| 18:03 | justin_smith | TEttinger: memfn is depricated, I think |
| 18:05 | bbloom | justin_smith: eh, i wouldn't say "deprecated" as if there were anythign wrong with it |
| 18:05 | bbloom | it's just not all that useful any more now that we have the #() syntax |
| 18:07 | rhg135 | nope |
| 18:07 | rhg135 | i tried returning the socket |
| 18:07 | rhg135 | still doesn't run |
| 18:16 | mrhanky | folks, i need some hint on using core.async with clojurescript |
| 18:17 | rhg135 | mrhanky, elaborate |
| 18:19 | mrhanky | i have a piece of code, it runs a repl with print and read-line on clojure. i now want to run this with clojurescript on a webpage. this code starts a loop and freezes the rest of my webpage. how can i run this piece of code async so i wont freeze my browser and i'm able to block it when it calls my defined read-line? |
| 18:19 | mrhanky | https://www.refheap.com/22782 |
| 18:19 | mrhanky | the code itself runs just fine, but freezes the browser |
| 18:19 | mrhanky | i just dont get it how to make it async |
| 18:24 | rhg135 | mrhanky, tbh i'm rather confused by all this async stuff too |
| 18:24 | mrhanky | glad i'm not the only one :) |
| 18:24 | rhg135 | all the callbacks |
| 18:26 | logic_prog | is there any high performnace logging frameworks for clojure? I want things on the orer of 1000 ops / second |
| 18:28 | pcn | What does logging mean? |
| 18:28 | pcn | Do you mean like a database that does mvcc for fast writes, or do you mean writes messages to a file? |
| 18:29 | logic_prog | pcn: I have a data structure, I am doing lots of (assoc obj ...) 's to it |
| 18:29 | logic_prog | err, (assoc-in obj keys value) ... |
| 18:29 | logic_prog | and I want to log all these [keys value] pairs |
| 18:30 | logic_prog | so I can "replay" the datastructure" |
| 18:32 | rhg135 | another small question |
| 18:32 | hyPiRion | logic_prog: When do you want to read the data? Is there any need to consider concurrency? |
| 18:32 | rhg135 | how do you apply a js method on a iseq |
| 18:33 | rhg135 | ? |
| 18:33 | bacon1989 | Hi, so I want to follow the clojureone tutorial, so I can get a better idea on how to make a website using clojure, but it doesn't seem to be working |
| 18:33 | bacon1989 | for this site http://clojurescriptone.com/ |
| 18:33 | logic_prog | hyPiRion: I don't need to support concurrency, there's one writer, and many readers |
| 18:33 | logic_prog | hyPiRion: what are my options for "how do you want to read the data?" |
| 18:33 | bacon1989 | it suggests to type lein bootstrap, which doesn't seem to be an actual command |
| 18:34 | bacon1989 | is the tutorial possibly out of date? |
| 18:35 | hyPiRion | logic_prog: Well, you could either read it after the operations have been done, or while the operations are performed. If you do it while the operations are performed, you may either want a snapshot or don't care about such a snapshot |
| 18:37 | hyPiRion | If you don't need a snapshot, I recommend to just use an ArrayList. It has effectively no time overhead. |
| 18:38 | michaniskin | bacon1989: I am not sure about cljs1, but another option is http://hoplon.io |
| 18:39 | michaniskin | bacon1989: the "getting started" page has the practical info there |
| 18:39 | michaniskin | bacon1989: and http://github.com/tailrecursion/hoplon-demos <-- demo apps |
| 18:39 | bacon1989 | michaniskin: ok thanks, I'll check it out |
| 18:40 | michaniskin | bacon1989: you can ask questions in #hoplon if you run into problems |
| 18:47 | steerio | i wonder why it takes 1.5 seconds to require clj-http |
| 18:48 | logic_prog | what hapened to fleetdb ? |
| 18:49 | logic_prog | is there any other database implemente din pure java |
| 18:50 | steerio | cassandra, neo4j? :) |
| 18:52 | justin_smith | for sql there is h2 (has in-memory and on-disk storage options) |
| 18:53 | eevar_ | there's also Derby |
| 18:55 | rhg135 | logic_prog, h2 |
| 18:55 | rhg135 | ohh |
| 18:56 | rhg135 | dat damn lag |
| 18:56 | logic_prog | err, sorry |
| 18:56 | logic_prog | by "pure java", I meant "pure clj" |
| 18:56 | rhg135 | ohhhhhhh |
| 18:57 | eevar_ | logic_prog: in other words you're asking for Datomic? |
| 18:57 | logic_prog | eevar_ : hmm |
| 18:58 | logic_prog | I didn't get a Christmas gift. |
| 18:58 | logic_prog | Can someone open source datomic and we'll call it even? |
| 19:14 | logic_prog | is there a way to tell clojure/split to "create the directorie structure if they don't exist" ? i.e. (spit "foo/bar/cat/test.txt" ...) will create direcotires foo/, foo/bar, foo/bar/cat if they don't alreay exist |
| 19:15 | Tolstoy | logic_prog: something like (.mkdirs (.getParentFile (as-file "foo/bar/whatever.txt"))) |
| 19:17 | logic_prog | Tolstoy: nice, thanks |
| 19:19 | Tolstoy | logic_prog: Raynes has a nice little collection of file related convenience functions over at: https://github.com/Raynes/fs if you don't mind an extra dependency. |
| 19:59 | bitemyapp | arrdem: bloody steak and coffee might be the optimal way to start a day. |
| 20:04 | Raynes | bitemyapp: I've always been fond of looking in the mirror and sobbing, myself. |
| 20:10 | bitemyapp | Raynes: followed by...ADVENTURE?! |
| 20:10 | Raynes | Always |
| 20:10 | bitemyapp | Raynes: http://www.youtube.com/watch?v=-EWDMHwZ064 |
| 20:40 | TEttinger | hm, does anyone know a way to make an uberjar run with specific JVM options (namely '-server') when double-clicked? |
| 20:40 | michaniskin | TEttinger: unix or windows? |
| 20:41 | TEttinger | windows, but maybe also linux/mac OS X |
| 20:41 | TEttinger | (OS X versions that don't support Java 7) |
| 20:41 | michaniskin | oh, dunno then, sorry |
| 20:41 | TEttinger | michaniskin, were you going to suggest a shell script |
| 20:41 | TEttinger | ? |
| 20:42 | michaniskin | JAR files can have arbitrary trash at the beginning of the file |
| 20:42 | justin_smith | http://stackoverflow.com/questions/1667830/running-a-jar-file-without-directly-calling-java |
| 20:42 | michaniskin | including a shebang and shell command like `java -server -jar "$0"` |
| 20:42 | hyPiRion | make the program check its input arguments, and if none, make it call itself with specified arguments and shutdown |
| 20:43 | justin_smith | TEttinger: see second answer using cat (for linux at least) |
| 20:43 | hyPiRion | lazybot uses this for its --background startup, see https://github.com/flatland/lazybot/blob/master/src/lazybot/run.clj |
| 20:44 | justin_smith | clojure is also shebang compatible |
| 20:44 | justin_smith | #! is a comment until end of line |
| 20:45 | michaniskin | justin_smith: wow, i didn't know that, awesome |
| 20:46 | michaniskin | ,(read-string "#! asdf\n[1 2]") |
| 20:46 | clojurebot | [1 2] |
| 20:46 | justin_smith | hrm... |
| 20:47 | mrhanky | can anybody tell me why this is not run async? i call start by js console after page load: https://www.refheap.com/22783 |
| 20:47 | justin_smith | michaniskin: oh, wait, I thought that wasn't working, I missed the \n :) |
| 20:48 | justin_smith | but yeah, that shows it working as expected |
| 20:48 | noonian | its either because you aren't calling any async operations or because of the indentation :P |
| 20:48 | TEttinger | wait hyPiRion... that solution won't work if Java isn't on the PATH will it? |
| 20:49 | hiredman | zip files (which jars are) can also contain abitrary stuff at the begining |
| 20:49 | mrhanky | noonian, i dont really understand this async stuff, i'm trying the whole day now with no result :/ |
| 20:49 | hiredman | so you can prepend a shell script |
| 20:49 | justin_smith | hiredman: yeah, that is what the cat solution in the SO link above does |
| 20:51 | hiredman | I use shebang clojure scripts a lot |
| 20:52 | hiredman | I have an uberjar of pomegranate on a public url on s3, so the first thing I do in the script is load that, then use pomegranate to load the rest of the deps I want |
| 20:52 | noonian | mrhanky: what are you trying to do asynchronouslu? |
| 20:53 | hiredman | https://gist.github.com/hiredman/6664075 makes a youtube playlist from the list of strangeloop music alex posted after the conference |
| 20:53 | justin_smith | hiredman: wow, cool |
| 20:55 | hiredman | I have a home automation project that is a single file ring app using the same pattern |
| 20:55 | mrhanky | noonian, the (println "Consize returns ...), it runs a another piece of code and prints the result at the end of execution. this can take some seconds. i'm using clojurescript so calling the start function freezes my browser until ready |
| 20:58 | TEttinger | hyPiRion, I think that Java by default for non-JDK installs does not add the java executable to PATH on windows |
| 20:59 | TEttinger | so would exec still work? |
| 21:02 | justin_smith | TEttinger: what does double clicking a regular jar do under windows? |
| 21:02 | noonian | mrhanky: you example might work if you use >! instead of put! |
| 21:03 | TEttinger | justin_smith, I assumed it used the OS to associate a filetype with a default command |
| 21:03 | TEttinger | which could use an absolute path |
| 21:03 | mrhanky | noonian, i dont use put! |
| 21:03 | noonian | mrhanky: here's a version where I broke out the function into a helper: https://www.refheap.com/22784 |
| 21:04 | noonian | sorry, my bad heh |
| 21:05 | noonian | basically, the go block isn't going to make normal synchronous code run in the background or anything, but it does make the blocking channel operations not block the thread if they are used inside a go block |
| 21:06 | noonian | mrhanky: it might be easier to start with a simpler example, without the (VM ...) stuff |
| 21:12 | mrhanky | noonian, are there any resources you can recommend on this topic? |
| 21:16 | noonian | mrhanky: i've just started with core.async myself, but i think this video by David Nolen gives a pretty good introduction: http://www.youtube.com/watch?v=AhxcGGeh5ho |
| 21:22 | mrhanky | noonian, a bit too long for this night, but i'll boomark and watch tomorrow, thanks |
| 21:23 | noonian | np, have fun |
| 21:26 | Tolstoy | mrhanky: Looking at your refheap, and removing the comments, the reason it doesn't block is 1) because you're in a go block (which doesn't block), and because you're use <! (println...) and println isn't a queie. |
| 21:26 | Tolstoy | Er, queue. |
| 22:44 | logic_prog | is there any database that allows efficient _append_ operations? |
| 22:47 | logic_prog | hiredman: is https://github.com/hiredman/Amontillado/blob/master/src/amontillado/core.clj complete? |
| 22:47 | logic_prog | I was searching for "bitcask clojure" |
| 22:47 | logic_prog | hiredman: and I got your github repo above |
| 23:50 | kanja | I played around with clojure a few years ago - I use emacs so I had slime/swank. Are things the same, or is there a new toolset to use? |
| 23:51 | Tolstoy | kanja: https://github.com/clojure-emacs/cider |
| 23:52 | Tolstoy | kanja: But the plugins for eclipse, intellij are reasonably mature, and there's LightTable. |
| 23:53 | kanja | @Tolstoy LightTable looks pretty cool and the recent opensource-ing of it is super awesome |
| 23:53 | kanja | I could see trying that out |
| 23:53 | kanja | but I'm pretty baked into emacs |
| 23:54 | kanja | I do a significant amount of python/javascript development in it |
| 23:54 | Tolstoy | At this point, it's not better than Emacs, IMHO, if you're already Emacs fluent. |
| 23:54 | kanja | ah k |
| 23:55 | kanja | @Tolstoy I'm going to try cider then, thanks! |
| 23:55 | Tolstoy | No prob. ;) |
| 23:56 | kanja | Actually another question :) I want to play around with cloact - what's a good entry point for http dev? pedestal? |
| 23:59 | Tolstoy | Personally, I think pedestal is a bit heavyweight and opinionated. |
| 23:59 | Tolstoy | For server side, I'd use compojure. |