2015-04-07
| 01:05 | ncthom91 | so in clojure I can define multi-arity functions, i.e. functions that have different bodies that correspond to invocations with differet numbers of arguments |
| 01:06 | ncthom91 | can I do the same style of differentiation on the type of a single argument? |
| 01:06 | ncthom91 | (defn example ([^String x] x) ([^Integer y] (* 2 y))) |
| 01:11 | sm0ke | ncthom91: no you will need multimethod which dispatches on type |
| 01:12 | sm0ke | reason being clojure is untyped |
| 01:18 | ncthom91 | cool thanks |
| 02:31 | justin_smith | Well, dynamically typed. There are untyped languages, but they are nothing like Clojure. |
| 02:33 | p_l | yeah, static/dynamic and strict/weak are two different axes in typing |
| 03:52 | Dyana | Hi guys |
| 04:03 | dstockton | Hi |
| 04:11 | TEttinger | hi dstockton |
| 05:17 | nilern | ncthom91: you can also use protocols if you just need to dispatch on the type of the first argument |
| 08:08 | timvisher | anyone aware of a function that obeys this contract? `Compares the keys of two maps, a and b, returning a tuple of sets [things-only-in-a things-only-in-b things-in-both]` |
| 08:08 | timvisher | clojure.data/diff doesn't do quite the right thing here, in that it returns nils for equal values |
| 08:08 | timvisher | the implementation is very straightforward, but this just seems like something that others would have implemented already |
| 08:23 | TEttinger | ,(require '[clojure.set :as s]) |
| 08:23 | clojurebot | nil |
| 08:27 | TEttinger | ,(let [map-a {:a 1 :b 2 :z 26} map-b {:x 24 :y 25 :z 26} key-diff (fn [a b] (let [ak (keys a) bk (keys b)] [(s/difference ak bk) (s/difference bk ak) (s/intersection ak bk)]))] (key-diff map-a map-b)) |
| 08:27 | clojurebot | #error{:cause "clojure.lang.APersistentMap$KeySeq cannot be cast to clojure.lang.IPersistentSet", :via [{:type java.lang.ClassCastException, :message "clojure.lang.APersistentMap$KeySeq cannot be cast to clojure.lang.IPersistentSet", :at [clojure.core$disj invoke "core.clj" 1453]}], :trace [[clojure.core$disj invoke "core.clj" 1453] [clojure.core.protocols$fn__6439 invoke "protocols.clj" 135] [clo... |
| 08:27 | TEttinger | woah, keys aren't a set? |
| 08:28 | TEttinger | (doc keys) |
| 08:28 | clojurebot | "([map]); Returns a sequence of the map's keys, in the same order as (seq map)." |
| 08:28 | justin_smith | TEttinger: no, they have to be in the same order as vals |
| 08:28 | hyPiRion | of course not. It's just (fn [m] /map key m)( |
| 08:28 | TEttinger | mm. |
| 08:28 | hyPiRion | Well that formatted nicely |
| 08:28 | TEttinger | heh |
| 08:28 | TEttinger | ,(let [map-a {:a 1 :b 2 :z 26} map-b {:x 24 :y 25 :z 26} key-diff (fn [a b] (let [ak (set (keys a)) bk (set (keys b))] [(s/difference ak bk) (s/difference bk ak) (s/intersection ak bk)]))] (key-diff map-a map-b)) |
| 08:28 | clojurebot | [#{:b :a} #{:y :x} #{:z}] |
| 08:28 | hyPiRion | ,((fn [m] (map key m)) {:a :b :c :d}) |
| 08:28 | clojurebot | (:a :c) |
| 08:29 | TEttinger | there you go timvisher |
| 08:29 | timvisher | TEttinger, hyPiRion: sorry. tried to be clear that the implementation is really straightforward |
| 08:30 | timvisher | what i was specifically asking about is whether anything like useful or plumbing had already implemented it |
| 08:30 | timvisher | obviously it's trivial to write yourself |
| 08:30 | timvisher | you guys have basically written exactly what i already wrote :) |
| 08:30 | TEttinger | yeah I like trivial tasks |
| 08:30 | justin_smith | I'll take obfuscated Clojure one liners for 500, Alex |
| 08:31 | jcromartie | the docs at https://github.com/clojure/core.cache contains ZERO hints that you need to manage cache state yourself |
| 08:31 | jcromartie | and that caches are immutable values |
| 08:31 | jcromartie | well, sort of immutable... e.g. the TTL cache changes over time |
| 08:33 | Glenjamin | jcromartie: i found that too, without a "how-to" guide it's a bit abstract |
| 08:35 | noncom | if i have a checkout dependency in lein, how can i find a filesystem path to a ns file inside that project? |
| 08:35 | noncom | or, better to a package |
| 08:38 | justin_smith | noncom: there's a trick for getting a path for a resource from a classloader iirc |
| 08:41 | mavbozo_ | jcromartie, Glenjamin is this guide not enough https://github.com/clojure/core.cache/wiki/Using ? |
| 08:41 | mavbozo_ | jcromartie, Glenjamin is this guide not enough https://github.com/clojure/core.cache/wiki/Using ? |
| 08:41 | mavbozo_ | sorry, weird keyboard behavior |
| 08:43 | mavbozo_ | the core.cache wiki is quite good but no mention about it in the README.md |
| 08:45 | noncom | ,(defn z [] [:a :b :c]) |
| 08:45 | clojurebot | #'sandbox/z |
| 08:45 | noncom | ,(-> (z) first) |
| 08:45 | clojurebot | :a |
| 08:53 | Glenjamin | mavbozo: that Intro doesn't mention anything about persisting the cache. iirc you have to back it by at atom or something? |
| 08:58 | TEttinger | ,(defn wat []) |
| 08:58 | clojurebot | #'sandbox/wat |
| 08:58 | hyPiRion | nil |
| 08:58 | TEttinger | ,(wat "wat?") |
| 08:58 | clojurebot | "wat?" |
| 08:59 | justin_smith | haha, bom strikes again |
| 08:59 | TEttinger | heehee |
| 08:59 | TEttinger | that's a good one, it even works in just about any no-arg fn |
| 09:00 | TEttinger | ,(defn unintended-identity [] (+ 1 2 3)) |
| 09:00 | clojurebot | #'sandbox/unintended-identity |
| 09:00 | TEttinger | ,(unintended-identity 1) |
| 09:00 | clojurebot | 1 |
| 09:09 | virmundi | hello. I have defined a protocol, ActionRecord, in ns something.data. In the ns something.core I :require [something.data :refer :all]. When I attempt to use the function "save-record" on ActionRecord, I get an unable to resolve symbol: save-record error |
| 09:09 | virmundi | The code is (save-record implOfActionRecord arg1 arg2) |
| 09:10 | virmundi | if I use (.save-record impl arg...), it works |
| 09:10 | virmundi | is this how Clojure functions? |
| 09:10 | justin_smith | if you have :refer :all save-record should work |
| 09:11 | mavbozo | Glenjamin, yeah, the using guide assumes we know what we are going to do with returned value from those cache operations |
| 09:13 | virmundi | justin_smith: you're right. that works. I had :ref [ActionRecord]. is there a way to refer to the protocol without the whole ns and get it work? |
| 09:15 | dstockton | i want to load a csv (~100s of MB) into some kind of querying engine, run some aggregates/queries based on the columns, and then destroy all traces |
| 09:15 | dstockton | was thinking elasticsearch to be a good fit, are there some names/buzzwords i might be overlooking |
| 09:15 | dstockton | i don't need persistence |
| 09:18 | schmir | dstockton: sqlite may also help |
| 09:18 | dstockton | schmir: indeed, its between those 2 atm |
| 09:18 | virmundi | justin_smith & all: let me redefine my confuse with Clojure. If I (:require [something.data :refer [save-record]), the function appears. It is totally detached from my protocol scoping. Are protocols just syntax sugar for function declarations, but every function ends up in the namespace in which it's defined? |
| 09:19 | dstockton | the advantage of elasticsearch is presumably that i could distribute the work if the data grew |
| 09:19 | dstockton | harder with sqlite |
| 09:19 | mavbozo | dstockton, if you want to put all those rows from the csv into clojure collections, you might want to experiment with datomic datalog https://gist.github.com/stuarthalloway/2645453 |
| 09:23 | dstockton | mavbozo: unfortunately its not a clojure project |
| 09:23 | dstockton | im just stealing smarts from the clojure community |
| 09:25 | schmir | dstockton: I've done the same recently and used sqlite to import around 1GB csv files into sqlite |
| 09:25 | schmir | dstockton: worked like a charm |
| 09:26 | schmir | dstockton: but elasticsearch certainly is also a good choice |
| 09:27 | dstockton | sqlite definitely meets my needs for now, i was mostly thinking of future-proofing it |
| 09:28 | crazydiamond | Hi. Is there version of split, that preserves splitting elements? https://clojuredocs.org/clojure.string/split e.g. (split "q1w2e" #"\d+") to give ["q" "1" "w" "2" "e"] instead of just ["q" "w" "e"]? |
| 09:29 | dstockton | probably optimizing prematurely, if i use decent abstractions i can swap it later |
| 09:43 | oddcully | crazydiamond: something like (let [s "q1w2e" r #"\d+"] (interleave (clojure.string/split s r) (re-seq r s))) ? |
| 09:43 | crazydiamond | oddcully, cool, thanks! |
| 09:44 | crazydiamond | don't yet know all the stuff |
| 09:44 | oddcully | better wait what the gurus here have to say about it ;P |
| 09:47 | TMA | ,(split "q1w2e" #"(\d\+)") |
| 09:47 | clojurebot | #error{:cause "Unable to resolve symbol: split in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: split in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: split in this context", :at [clo... |
| 09:48 | TMA | ,(clojure.string/split "q1w2e" #"(\d\+)") |
| 09:48 | clojurebot | ["q1w2e"] |
| 09:48 | TMA | ,(clojure.string/split "q1w2e" #"(\d+)") |
| 09:48 | clojurebot | ["q" "w" "e"] |
| 09:49 | TMA | perl uses capturing () to preserve the delimiters, a thing that was not carried over apparently :( |
| 09:51 | bja | I thought () in PCRE delimited groups? |
| 09:52 | bja | it certainly does in the python pcre implementation |
| 09:52 | chouser | This would be specifically for split, I think. |
| 09:52 | netroby | When will Clojure 1.7 will be released? |
| 09:53 | TMA | specifically perl's split /(\d+)/, "q1w2e" would exhibit the aforementioned behavior |
| 09:55 | chouser | TMA: Here's a fn from a deprecated lib that splits but also captures the delimiters: https://github.com/clojure/clojure-contrib/blob/13f960559f724521070d761639310d8b1f503216/src/main/clojure/clojure/contrib/string.clj#L208 |
| 09:56 | chouser | Haven't tested it in ages, but it might still work. Dunno if that helps you or not. |
| 09:58 | TMA | crazydiamond: ^^ |
| 09:58 | crazydiamond | thanks TMA and chouser |
| 10:00 | chouser | I don't know why that didn't make the transition from contrib to clojure.string. *shrug* |
| 10:09 | jcromartie | mavbozo: it seems to be missing from any of the official documentation, even the example usages |
| 10:10 | jcromartie | the example usages are even misleading, I'd say, because they look like examples of using a stateful object |
| 10:10 | jcromartie | but it's a wiki |
| 10:10 | jcromartie | so I can edit that, right |
| 10:23 | mavbozo | jcromartie, well, in the code comments there are phrases "returns a cache", "returns a new cache". But, I agree on more clarity on the usage. |
| 10:45 | andyf | netrobyatmobile: They announce when it is released, but do not promise any release dates in advance. My unofficial non-binding best guess: June 2015 or earlier. The list of things left to do is fairly short. |
| 10:55 | andyf | Here is Alex Miller?s list of things left to do before Clojure 1.7 release: https://groups.google.com/forum/#!msg/clojure/D2E4HG1yXBc/C34JWa8ylrQJ |
| 10:57 | phillord | andf: pity they don't have a issue called "write a description of transducers a normal person can understand" |
| 10:57 | phillord | andyf that is... |
| 10:58 | andyf | phillord: Have you watched Rich Hickey?s talk on it? I haven?t yet, but was hoping that would shed light on the topic for me, when I get around to it. |
| 10:58 | phillord | I've watched some of it, but not all |
| 10:58 | phillord | video's don't really fit into my life, which might be the problem |
| 10:58 | andyf | Until then, the short way I keep it in my head is "it is a performance optimization -- useful but not critical until and unless you need that performance" |
| 10:59 | Bronsa | andyf: it's not just about performance |
| 10:59 | andyf | Apparently I keep it in my head wrong, then. |
| 10:59 | Bronsa | I don't even think transducers are *always* faster than "normal" seq ops TBH |
| 11:00 | phillord | I do wonder how many problems are going to be introduced |
| 11:00 | phillord | I mean, calls that would previously given an arity exception will not return a transducers IIUC |
| 11:00 | andyf | Is it "often performance + unifying how to operate on sequences and core.async streams"? How would you summarize the benefits and reasons to create them? |
| 11:01 | andyf | phillord: That is true. Shows how much they wanted to add them :) |
| 11:01 | Bronsa | andyf: s/sequences and core.async.streams/reducibles/ |
| 11:01 | Bronsa | IIUC |
| 11:01 | phillord | seems like a pretty overloaded return type to me |
| 11:02 | phillord | but yes, clearly, they really cared about them |
| 11:02 | phillord | I would have prefered they spent the time on rewriting the docstrings but hey |
| 11:03 | Bronsa | phillord: I'm not a fan of that overloading either and have complained about it when transducers were first introduced. Core is set on making them clojure.core citizens so I don't think there's a chance that will change |
| 11:03 | andyf | There is ClojureDocs for anyone that wants to for enhancing the doc strings. Has been for years. Do not wait for the core team to rewrite the doc strings. Make it happen! |
| 11:04 | andyf | Plus, by making it happen yourself, you find out how time-consuming it can be :) |
| 11:05 | sandbags | as someone who is, a little painfully, using CLJX wondering what the wisdom of the group was on the reader conditions in alpha6? |
| 11:06 | andyf | Depending upon your pain points, they may help, they may not. |
| 11:06 | dnolen | Bronsa: I've never seen seq ops be faster than transducers unless your talked about chunked seqs, also seq ops presume really good GC, while enjoyed on prduction JVMs may or may not be true for CLR or JS |
| 11:06 | sandbags | so far mainly process and tooling support, i guess having everything baked in will alleviate those |
| 11:07 | phillord | andyf: sure, I agree -- I think thalia was a notable push in the "better documentation" category |
| 11:07 | andyf | Some tooling may need updating to support them -- depends upon the tool. |
| 11:08 | andyf | phillord: And there isn't much there, and it took quite a bit of digging and experimenting to get even that little bit written. |
| 11:08 | dnolen | andyf: as Bronsa said transducers not just about perf, they are functional operations decomplected from application strategy |
| 11:08 | Bronsa | dnolen: definitely the case of chunked seqs -- haven't done any benchmarks myself but I recall puredanger talking about it |
| 11:09 | phillord | andyf: I agree, but it does show the necessity and that it can be much better |
| 11:09 | chouser | dnolen: any sense of reader conditionals timeline for clojurescript? |
| 11:10 | phillord | dnolen: I've seen that written before, but I just don't understand what it means. It sounds really nice, but I have no idea what it is for. |
| 11:12 | sobel | can i write a transducer in clojure 1.6? |
| 11:12 | sobel | or is that a waiting-for-1.7 thing |
| 11:13 | chouser | hm, if transducers were *completely* decoupled from "application strategy", wouldn't that mean that they could deliver the same semantics as lazy seqs? The fact that they can't suggests they provide an alternative and perhaps more open and efficient application strategy. |
| 11:20 | andyf | sobel: No need to wait if you are willing to try out 1.7.0-alpha6. It may be possible to write one with 1.6, but you would need to implement some groundwork yourself. |
| 11:21 | sobel | andyf: i'm willing to burn a couple cycles on 1.7-a to try them out. i already found the examples i'd seen on blogs would not work with 1.6 unmodified. |
| 11:21 | sobel | thx |
| 11:24 | matthavard | Does anyone know of a code snippet example where reduce is called with reduce as the second parameter? |
| 11:24 | matthavard | `(reduce reduce <init> <coll>)` |
| 11:25 | sobel | unclear how the outer call would have anything to reduce |
| 11:26 | matthavard | Yeah I don't know how it would work either |
| 11:27 | matthavard | <init> would have to be a function I think.... |
| 11:28 | matthavard | Okay I got a lame one working |
| 11:28 | matthavard | ,(reduce reduce + [[1]]) |
| 11:28 | clojurebot | 1 |
| 11:28 | matthavard | ,(reduce reduce + [[1 2 3]]) |
| 11:28 | clojurebot | 6 |
| 11:29 | sobel | ,(apply reduce + [[1 1]]) |
| 11:29 | clojurebot | 2 |
| 11:29 | sobel | same |
| 11:29 | Glenjamin | chouser: i think you can build lazy-seqs on top of transducers |
| 11:29 | sobel | reduce only destructured for you |
| 11:29 | Bronsa | Glenjamin: not preserving the same characteristics |
| 11:30 | Glenjamin | the way they compose, you mean? |
| 11:30 | matthavard | Yeah because it was passed + and then the first element of [[1 2 3]] which is [1 2 3] |
| 11:30 | Glenjamin | or the caching and laziness bit? |
| 11:30 | Bronsa | Glenjamin: lazy-seq ops can consume 0 elements, transducers need at least 1 |
| 11:30 | Glenjamin | oh, interesting |
| 11:31 | matthavard | ~(+ 1 2) |
| 11:31 | clojurebot | Huh? |
| 11:31 | matthavard | Why does clojurebot eval if you use a comma when clojure evals if you use a tilda? |
| 11:31 | mikerod | Does cljs require Java 7 now? |
| 11:31 | mikerod | I always get "Caused by: java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CompilerOptions : Unsupported major.minor version 51.0" |
| 11:31 | justin_smith | matthavard: ~ is for commands, , is for clojure code |
| 11:31 | mikerod | for cljs projects when I have Java pointed at Java6 |
| 11:32 | matthavard | justin_smith: What commands can I do with ~? |
| 11:33 | justin_smith | matthavard: factoid related commands are pretty much it I think |
| 11:33 | justin_smith | ~books |
| 11:33 | clojurebot | books is book |
| 11:33 | justin_smith | ~book |
| 11:33 | clojurebot | book is http://www.pragprog.com/titles/shcloj/programming-clojure |
| 11:33 | justin_smith | ~books |
| 11:33 | clojurebot | books is book |
| 11:33 | justin_smith | erg. |
| 11:33 | justin_smith | there is also a books answer |
| 11:33 | justin_smith | but the factoids are annoying |
| 11:34 | dnolen | phillord: some things in Clojure take some time to understand, and documentation beyond anything official (tutorials, books). I think it took a year before I really understood lazy seqs - I don't really see this as is problem though. |
| 11:35 | dnolen | chouser: Alex Miller is cranking on that, hopefully tools.reader patch drops today/tomorrow, and then ClojureScript just needs some small tweaks |
| 11:35 | dnolen | chouser: the next big release of ClojureScript is waiting on just this |
| 11:35 | mavbozo | ~book |
| 11:35 | clojurebot | book is http://www.pragprog.com/titles/shcloj/programming-clojure |
| 11:35 | mavbozo | ~book |
| 11:36 | clojurebot | book is http://clojurebook.com/ http://joyofclojure.com/ |
| 11:37 | matthavard | ~macros |
| 11:37 | clojurebot | Barking spiders! |
| 11:37 | matthavard | ~macro |
| 11:37 | clojurebot | macro are just a game with symbols |
| 11:37 | matthavard | ~book |
| 11:37 | clojurebot | book is http://www.pragprog.com/titles/shcloj/programming-clojure |
| 11:37 | matthavard | ~~ |
| 11:37 | clojurebot | Titim gan éirí ort. |
| 11:37 | matthavard | ~~ |
| 11:37 | clojurebot | Excuse me? |
| 11:37 | mavbozo | ~educe |
| 11:37 | matthavard | ~~ |
| 11:37 | clojurebot | educe is a typo |
| 11:37 | matthavard | ~~ |
| 11:38 | matthavard | ~clojure |
| 11:40 | csd_ | Is it right to think of Manifold as a competitor to core.async? |
| 11:40 | justin_smith | csd_: check out ztellman's talk from the last conj |
| 11:41 | justin_smith | manifold is compatible with core.async, but he compares the two (and also prismatic/plumbing) |
| 11:42 | csd_ | justin_smith: the talk titled Always Be Composing? |
| 11:42 | justin_smith | yes |
| 11:43 | chouser | dnolen: fantastic, thanks! |
| 11:44 | sobel | that was a great talk |
| 11:44 | sobel | i'll have to use more core.async before i'm receptive to manifold, i think, though |
| 11:58 | csd_ | is there a curated list of the best conj talks |
| 12:02 | bja | are #inst meant to work with org.clojure/java.jdbc as ISQLValues out of the box? |
| 12:03 | bja | i.e. (jdbc/query db ["SELECT ?;" #inst "2015-04-07T15:54:15.497000000-00:00"]) |
| 12:10 | sobel | ~. |
| 12:10 | sobel | cs csd oaeu |
| 12:10 | clojurebot | Cool story bro. |
| 12:11 | sobel | apparently ^Q still horks up terminal emulators :/ |
| 12:11 | sobel | csd_: i forget the name offhand but there's an easy to find youtube channel with most the good talks on it |
| 12:11 | justin_smith | sobel: it doesn't hork anything, it does exactly what the vt100 spec says it should |
| 12:11 | sobel | but ask here for specific topic advice. i think that's more useful than drinking from the firehose. |
| 12:11 | sobel | justin_smith: you're not wrong |
| 12:12 | justin_smith | sobel: I mean, imagine if I went into my GUI apps and my emacs muscle memory led to me using Control-w instead of Control-c to copy. Should I be surprised that this closes my document? |
| 12:13 | justin_smith | s/copy/cut of course |
| 12:13 | oddcully | justin_smith: that's not only emacs musclememory, but terminal. at least there is a hook to fix gtk apps |
| 12:14 | justin_smith | one that I do all the time: Control-p to go up, and then I get a print dialog. |
| 12:14 | sobel | justin_smith: i have no idea what you are talking about. i bound all my GUI apps to emacs bindings a long time ago. ;) |
| 12:14 | justin_smith | like, who actually prints so often that they need a keyboard shortcut for it? |
| 12:14 | sobel | haha |
| 12:14 | sobel | dongetmestarted |
| 12:15 | oddcully | in (old?) IEs ESC in a textarea just removed the text |
| 12:15 | justin_smith | haha "fuck you vi users we hate you" |
| 12:15 | sobel | but really, my tacit assertion here is, why the fuck are we still emulating terminals so literally? (don't answer that) |
| 12:15 | justin_smith | sobel: software that was invented to run on terminals is still useful |
| 12:16 | justin_smith | in 100 years we will be asking why 2d apps are still emulated |
| 12:16 | sobel | like the irssi/tmux combo i use to get here? |
| 12:16 | justin_smith | :) |
| 12:16 | sobel | upgraded from bX+screen from the olden days |
| 12:17 | justin_smith | hell, our programming languages are still 1 dimensional, with a few notable exceptions |
| 12:17 | sobel | there's plenty of good argument for them staying that way, too |
| 12:17 | justin_smith | indeed |
| 12:18 | sobel | i still play MAME. i shouldn't be allowed to comment on future emulation of 2d apps. :) |
| 12:24 | bja | can I "unextend-protocol"? |
| 12:24 | bja | (in a way other than restarting my jam) |
| 12:26 | justin_smith | ~v1.8 is my jam |
| 12:26 | clojurebot | Roger. |
| 12:27 | justin_smith | sorry, couldn't help it |
| 12:27 | zerokarmaleft | justin_smith: ugh, that gets me so often (ctrl-p) |
| 12:29 | zerokarmaleft | often enough that I'm now realizing I should've found a way already to disable that shortcut |
| 12:31 | oddcully | zerokarmaleft: for gtk there is a config for all apps. e.g. my firefox just moves the cursor up on ctrl-p, ymmv |
| 13:01 | bja | I think I'm going nuts. (doto (.prepareStatement (jdbc/get-connection db-spec) "SELECT ?") (.setTimestamp 1 (java.sql.Timestmap. (.getMillis (clj-time.core/now)))) .execute) throws "PSQLException ERROR: could not determine data type of parameter $1" with the org.postgresql.Driver |
| 13:02 | darthdeus | is there a talk somewhere about component/jig? |
| 13:16 | sobel | bja: if that's literal code, you might adjuste "Timestmap" to "Timestamp" |
| 13:16 | sobel | adjuste, oe.: Adjust |
| 13:17 | bja | err, not literal code, sorry about that |
| 13:17 | bja | the thing is, this works with sqlite3 |
| 13:17 | justin_smith | brb. must adjuste my Timestmaps |
| 13:17 | sobel | (inc justin_smith) |
| 13:17 | lazybot | ⇒ 234 |
| 13:17 | sobel | (inc justin_smith ) |
| 13:17 | lazybot | ⇒ 9 |
| 13:18 | Glenjamin | maps for estimating tim |
| 13:18 | sobel | oof |
| 13:18 | Glenjamin | darthdeus: there was one at clojureX 2014 |
| 13:19 | Glenjamin | i think, or maybe it was EuroClojure |
| 13:19 | Glenjamin | one of those, anyway |
| 13:20 | bja | is there some function or macro that will invoke javac on a string for me? |
| 13:20 | bja | I basically want to eval some Java |
| 13:29 | sm0ke | pmonks: java can be used with 99% ease from clojure |
| 13:30 | pmonks | Right, but bja wants to eval a string as Java source. |
| 13:30 | pmonks | I guess what you could do is throw the string at Groovy. |
| 13:30 | pmonks | Most Java is also valid Groovy, and Groovy includes a full interpreter* |
| 13:30 | pmonks | * on-demand compiler |
| 13:31 | justin_smith | bja: if javac is present on the machine, there is also the possibility of shelling out |
| 13:31 | justin_smith | bja: what do you need to do at runtime with java that clojure couldn't do? |
| 13:31 | bja | oh, nothing for production. I just wanted to test a java code sample I could ask about on #postgresql |
| 13:32 | bja | since nobody responds favorably to questions posed using clojure |
| 13:32 | justin_smith | bja: in that case, why not make a tiny java file and compile and run it? |
| 13:33 | pmonks | bja: I use the Groovy shell for that kind of thing |
| 13:33 | pmonks | Basically a glorified Java interpreter. |
| 13:33 | pmonks | Very handy (even though Groovy itself leaves me with an unclean feeling). |
| 13:34 | bja | I just wanted to avoid doing that outside of my repl. I was hoping to be able to (./pull 'magic-java-compiler) (require '[magic-java-compiler.core :refer [javac]]) (javac "$BORINGJAVAHERE") |
| 13:34 | bja | I'll try groovy |
| 13:35 | pmonks | Yeah I think it'll work ok, even if it's a bit of a hammer to crack a nut. ;-) |
| 13:36 | pmonks | Here's a Java example that should be pretty directly portable to Clojure: http://stackoverflow.com/questions/20905980/how-can-i-evaluate-my-own-groovy-script-from-java |
| 13:37 | bja | I think there's something weird with the way I have org.postgresql.Driver setup (or a bug with it), since .setTimestamp(idx, java.sql.Timestamp-instance) works fine for mysql and sqlite3 |
| 13:38 | oddcully | also be aware, that groovy is not 100% java code compatible |
| 13:40 | pmonks | Yeah - the biggest issue I've had with (ab)using it this way is with some identifier names. Groovy has more keywords etc. so some valid Java identifiers names are not valid Groovy. |
| 13:40 | pmonks | But in practice I run into problems pretty rarely, and for small Java snippets are easy to fix. |
| 13:41 | oddcully | yeah most likely lists in @SomeInterface will trip you over. the keywords are not to many (in, trait, ?) |
| 13:42 | pmonks | Bit more background: http://blogs.alfresco.com/wp/pmonks/2010/08/19/alfresco-and-groovy-baby/ |
| 13:43 | oddcully | * pmonks is now known as austin |
| 13:44 | oddcully | my main groovy visual is Ash |
| 13:45 | justin_smith | am I old? is this is what it's like when you are old? I have no idea what any of these references are. |
| 13:46 | pmonks | Or young. ;-) |
| 13:46 | pmonks | http://www.imdb.com/title/tt0118655/ |
| 13:47 | oddcully | pmonks: guess so ;P |
| 13:47 | justin_smith | oh damn, I saw it so long ago that the references went over my head |
| 13:47 | justin_smith | haha |
| 13:47 | oddcully | and this for Ash: http://www.imdb.com/title/tt0083907/ |
| 13:47 | justin_smith | wait, I know ash, but how did it tie in here? |
| 13:48 | pmonks | Peter Jackson's 2nd best movie: http://www.imdb.com/title/tt0103873/ |
| 13:48 | oddcully | iirc its somewhere in part three. something with the boomstick or the chainsaw |
| 13:48 | oddcully | and Ash says: Groovy! |
| 13:48 | oddcully | i bet there are even tshirts about it |
| 13:48 | justin_smith | pmonks: Meet the Feebles was damned good too |
| 13:48 | pmonks | That's #1. ;-) |
| 13:48 | pmonks | (inc justin_smith) |
| 13:48 | lazybot | ⇒ 235 |
| 13:49 | justin_smith | oddcully: oh man, yeah, I am not hip to the right quotes despite having seen all these things |
| 13:49 | justin_smith | I think its what happens when you've seen too many movies |
| 13:49 | bja | I put up a sample project here: https://github.com/emidln/clj-pg-jdbc-weirdness/blob/master/src/sample/core.clj. Am I just doing something blatently wrong? |
| 13:49 | justin_smith | if I try to quote movies I sound like a hipper-than-thou asshole because its stuff nobody has seen (not on purpose, mind you) |
| 13:50 | oddcully | stuff like: it's time to kick a** and chew bubblegum... and i am all out on bubblegum |
| 13:50 | AimHere | That can still work if the quotes are apposite enough |
| 13:51 | pmonks | "I love the smell of napalm in the morning." |
| 13:51 | AimHere | Just don't let on that they're quotes, and people will think you've got a good epigram |
| 13:51 | justin_smith | AimHere: oh yes, then people think I have a very clever and absurd sense of humor. |
| 13:51 | pmonks | "You're all individuals!" "(mob) We're all individuals!" "(lone voice) I'm not." <- best movie quote ever |
| 13:51 | oddcully | just use them often enough and the kids will pick it up |
| 13:51 | justin_smith | AimHere: had a hilarious experience where I was riffing on Laurie Anderson lyrics with a friend, and another friend starts improvising weird statements in that style because he didn't know any of the quotes, it was great |
| 13:52 | justin_smith | (inc pmonks) |
| 13:52 | lazybot | ⇒ 4 |
| 13:52 | AimHere | Your other friend is the one with the imagination I take it! |
| 13:52 | justin_smith | haha |
| 13:52 | oddcully | :D |
| 13:52 | justin_smith | AimHere: he may have also been high |
| 13:53 | justin_smith | bja: lest you think you are being ignored, I am digging up a project with psql configured to see if I can help out |
| 13:54 | ncthom91 | hi all. Anyone have any good suggestions for a short hashing function which produces a short unique id given a long string input? |
| 13:55 | bja | justin_smith: thanks. I have more configuration, but all of that appears to work okay (extending protocols like jdbc/ISQLValue to convert jodatime, json conversions to/from, etc). This is just distilled to the basic jdbc interop that for whatever reason doesn't appear to be working for me. |
| 13:55 | pmonks | ,(.hashCode "This is where the long string would go") |
| 13:55 | clojurebot | -1611456038 |
| 13:55 | pmonks | ncthom91: not sure if that's what you're after |
| 13:56 | justin_smith | ncthom91: for certain values of "unique" (see Shannon, information theory, etc.) |
| 13:56 | bja | I'm pretty sure I *have* to be doing something wrong because surely .setTimestamp actually works |
| 14:00 | timvisher | is there an analog to the :destroy handler for `lein ring` for in-process http-kit instances? |
| 14:02 | lemonodor | I’m reading https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#declaring-profiles and wondering if it’s possible to have user-wide profiles that will override profiles of the same name specified in a project. |
| 14:02 | justin_smith | bja: so, here it generates "SELECT '2015-04-07 11:03:28.285000 -07:00:00'" |
| 14:03 | lemonodor | it looks like no, user-wide profiles are overridden by project profiles, i would need a system-wide profile. is that correct? |
| 14:03 | justin_smith | bja: and I get the same error, yeah |
| 14:04 | bja | timvisher, I do that as part of my http-kit component. |
| 14:04 | justin_smith | bja: I guess jdbc is generating a timestamp format that postgres doesn't like, or at least finds ambiguous? |
| 14:05 | bja | justin_smith. it seems that way. I don't know how I didn't notice this happening before. I think maybe I need to go back and test older versions to the driver to see if this a regression. |
| 14:06 | justin_smith | bja: clearly it affects both our drivers... one moment, checking what we do with date/time types in Caribou fields |
| 14:07 | lemonodor | basically i want to say ‘use [cider/cider-nrepl "0.9.0-SNAPSHOT”]’ for everything by putting it in my profiles.clj, but that doesn’t work if i have a project that uses, e.g., lein-gorilla which has a dependency on cider-nrepl 0.8.1. |
| 14:09 | bja | lemonodor: can you exclude in your profile? |
| 14:09 | bja | the key is :exclusions |
| 14:10 | lemonodor | bja: in my profiles.clj? what would i exclude? cider-nrepl 0.8.1? |
| 14:10 | bja | cider-nrepl |
| 14:11 | bja | :exclusions [cider-nrepl] |
| 14:11 | bja | you could also add it to lien-gorilla |
| 14:11 | timvisher | bja: in what way? |
| 14:11 | lemonodor | ah, right. man, someday we’ll figure out how to do node-style versioning, but even better. |
| 14:12 | bja | timvisher: https://gist.github.com/add4a2d31fb84977f911 |
| 14:13 | justin_smith | bja: as a starting point, this executes without error -- "SELECT TIMESTAMP '2004-10-19 10:23:54'" |
| 14:13 | timvisher | bja: very cool! thanks! |
| 14:14 | bja | timvishner, the general idea is that you have to hold onto the fn that http-kit returns somewhere |
| 14:14 | bja | and your restart/stop functions can do something prior to calling it |
| 14:14 | timvisher | bja: yep. makes sense. |
| 14:14 | bja | you don't need a full-blown component system if you don't want it (although it's sweet) |
| 14:15 | timvisher | can i access active profiles from my system when running with `lein run`? |
| 14:15 | timvisher | s/from my/in my/ |
| 14:23 | justin_smith | timvisher: what does 'access active profiles' mean? if you mean get info about which profiles are active, environ is a great way to convey that to the runtime |
| 14:23 | timvisher | justin_smith: yeah. that's what it looks like |
| 14:23 | justin_smith | timvisher: idea being you can set environ values per profile, then you can detect profiles via them |
| 14:23 | timvisher | i was looking for a simple way to see if the dev profile was active |
| 14:23 | justin_smith | timvisher: environ is the simple way |
| 14:23 | timvisher | that's what it looks like |
| 14:24 | justin_smith | something like (defmacro when-dev [& body] `(when (env :dev) ~@body)) |
| 14:25 | justin_smith | and then :profiles {:dev {:env {:dev true}}} |
| 14:29 | vas | So I have my handler take requests that go to tings like /post51762 and find the post with the eid 51762 in datomic, but if it doesn't exist I want to capture the exception .. do a 404 page... any tips on learnin' meself some exception handling? |
| 14:29 | justin_smith | vas: you could try |
| 14:29 | justin_smith | yuck yuck yuck |
| 14:29 | justin_smith | (doc try) |
| 14:29 | justin_smith | it's pretty simple |
| 14:29 | clojurebot | Cool story bro. |
| 14:30 | justin_smith | $grim clojure.core/try |
| 14:30 | lazybot | http://grimoire.arrdem.com/1.6.0/clojure.core/try |
| 14:30 | justin_smith | vas: I think the examples in above link will get you going |
| 14:33 | vas | justin_smith hehehe Try. |
| 14:33 | vas | + thanks |
| 14:57 | bja | justin_smith: I filed a bug report on the postgresql jdbc github page: https://github.com/pgjdbc/pgjdbc/issues/276 |
| 15:01 | sritchie | dnolen: can I test against a pattern and bind it in core.match? for example, I can do ([(:or 'F 'T)] :seq) |
| 15:01 | sritchie | but how about ([(:or 'F 'T) :as x] :seq) or something |
| 15:02 | dnolen | sritchie: that should work yes |
| 15:02 | dnolen | though the syntax is not right there |
| 15:02 | dnolen | ((:or 'F 'T) :as x) |
| 15:03 | sritchie | I get “unable to resolve x" |
| 15:03 | sritchie | (match (list 'F) ([((:or 'F 'T) :as x)] :seq) x) |
| 15:03 | sritchie | works without the :or |
| 15:03 | chouser | is there a Right Way to detect, during macroexpansion, whether you're being invoked by the Clojure vs the ClojureScript compiler? |
| 15:03 | sritchie | dnolen: (match ['F] [('F :as x)] x) |
| 15:04 | Bronsa | chouser look at &env |
| 15:04 | dnolen | sritchie: could be a bug |
| 15:04 | sritchie | chouser: https://gist.github.com/sritchie/140200c0c9d013c0438b |
| 15:04 | sritchie | that works for em |
| 15:04 | sritchie | me* |
| 15:04 | sritchie | dnolen: okay, I’ll file |
| 15:05 | dnolen | sritchie: thanks |
| 15:05 | chouser | Bronsa, sritchie: thanks. |
| 15:09 | nkoza | there is some library like core.match but with first-class patterns, so you can compile a bunch of them to a fast dispatch table in runtime... and also working in cljs? (yes, I want also the sky :)) |
| 15:10 | timvisher | how can i get verbose errors from lein uberjar? it's failing during compilation but not telling me where |
| 15:13 | zamaterian | The terminal feature in neovim bloody usefull :) |
| 15:23 | bja | zamaterian: waiting for someone to give me a more compelling story than vim+vim-slime+tmux for my vim+clojure development |
| 15:29 | oddcully | bja: tmux+vim/fireplace? |
| 15:32 | zamaterian | bja: just a fast desc : https://gist.github.com/zamaterian/dfbafbeef178daf5c21b |
| 15:35 | bja | oddcully: I used that for awhile, and realized that I didn't really need/want it very often. I use vim-sexp to select forms and send them via slime to a repl in a different tmux pane |
| 15:36 | bja | which, despite the assertions of the vim-fireplace author, is exactly what I want |
| 15:37 | oddcully | bja: i also run my repl in another tmux window and then just :Eval or cpp them over |
| 15:39 | zamaterian | bja, it should be pretty easy, to replace the fireplace functions in my example. One more reason that I use fireplace is that its omnicomple func work nicely together with YouCompleteMe |
| 15:39 | gastove | I'm having a brain-dumb. Is there a straight-forward way to go from a clojure vector of a type ([Foo, Foo, Foo]) to a java array of the same type (Foo[])? |
| 15:47 | justin_smith | gastove: into-array |
| 15:47 | justin_smith | ,(into-array [1.0 3.0]) |
| 15:47 | clojurebot | #object["[Ljava.lang.Double;" "[Ljava.lang.Double;@49cb4acf"] |
| 15:48 | justin_smith | gastove: it takes an optional argument if you want to override the type of the first arg |
| 15:48 | justin_smith | ,(into-array Number [1.0 3.0]) |
| 15:48 | clojurebot | eval service is offline |
| 15:48 | justin_smith | &(into-array Number [1.0 3.0]) |
| 15:48 | lazybot | ⇒ #<Number[] [Ljava.lang.Number;@45a836ff> |
| 15:54 | borkdude | Today another clojurescript / clojure app I worked on for the last two months went into production. the first serious one for an external customer. Thanks to the peeps in this channel who helped me out with some problems/decisions. Especially ordnungswidrig for his help with liberator. |
| 15:55 | borkdude | First serious one that is entirely in clojure/clojurescript. We've done clojure backend before for another customer. |
| 15:55 | dnolen | borkdude: congrats! :) |
| 15:56 | borkdude | dnolen thanks. :) |
| 16:00 | muraiki | w00t! |
| 16:02 | wackadignhoy | hi |
| 16:02 | wackadignhoy | should all functions with logging get wrapped in a do? |
| 16:02 | gastove | justin_smith: ahhh. Thanks! |
| 16:03 | borkdude | wackadignhoy functions have an implicit do already |
| 16:04 | wackadignhoy | hum. Interesting. So what is do for, then? |
| 16:06 | justin_smith | wackadignhoy: for things like if that don't |
| 16:06 | justin_smith | and then you use do, and it do |
| 16:07 | wackadignhoy | ok. so it's to avoid having to construct a bunch of annon functions for instances like 'if'? |
| 16:08 | justin_smith | yeah - I mean an anon function would be a really roundabout way to do multiple things in one if branch |
| 16:08 | justin_smith | so yeah |
| 16:10 | TimMc | clojurebot: and then you use do, |and| it do |
| 16:10 | clojurebot | A nod, you know, is as good as a wink to a blind horse. |
| 16:12 | wackadignhoy | thanks, justing_smith and borkdude |
| 16:20 | oddcully | sometimes the zen quotes of clojurebot are just overwhelming |
| 16:20 | sritchie | what’s the right syntax for applying a precondition to an anonymous fn? |
| 16:20 | sritchie | ah, got it |
| 16:20 | sritchie | (fn [x] {:pre [(odd? x)]} (* x x)) |
| 16:20 | justin_smith | (fn [a] {:pre [(even> a)]} ...) |
| 16:20 | justin_smith | yup |
| 16:21 | danielglauser | (inc sritchie) |
| 16:21 | lazybot | ⇒ 2 |
| 16:21 | danielglauser | Didn't know that, cool |
| 16:23 | sobel | so, when i was learning sql, knew there were always lots of ways to accomplish something but few of them would be very performant. once i could reason about the combinatorics, i/o costs, and generally understand the challenges the query planner faces, i could write much more effective and clean queries |
| 16:24 | sobel | but once i figured that out, the path was fully documented, etc. is there a similar vein of learning for lisp/clojure? |
| 16:24 | sobel | i can generally do what i want several ways with clojure, but i have no sense of relative merit |
| 16:24 | sobel | (it's ALL better than writing java) |
| 16:25 | oddcully | what's not? |
| 16:25 | justin_smith | sobel: I think following discussion on this channel is very helpful for that |
| 16:25 | justin_smith | sobel: plus, learning how to use the jvm profiling tools |
| 16:25 | aaelony | sobel: I think the only way to know is to profile the code you are interested in... |
| 16:25 | justin_smith | yupyup |
| 16:25 | sobel | justin_smith: i follow and pitch in when i can. i think i might have helped someone today, which is a nominal milestone |
| 16:26 | sobel | ok, i hear profiling. |
| 16:26 | justin_smith | aaelony: well, there are certain things you can figure out - like certain constructs always requiring reflection, so they have an alternate form that always performs much better |
| 16:26 | szatz | can anyone offer suggestions regarding getting an exception that says "Too many files open" using the clojure.data.csv library? |
| 16:26 | aaelony | justin_smith: I agree, but premature optimization is something to consider as well |
| 16:26 | sobel | i know some of the obvious things to avoid, especially when they are familiar from java like reflection performance |
| 16:26 | justin_smith | sobel: also, in general a lot of the best performing stuff revolves around reduce and its variants (transducers, reducers) |
| 16:27 | sobel | i think i am on a better track than i thought, before i asked |
| 16:28 | sobel | thanks |
| 16:28 | justin_smith | also, there is a whole labrynth of stuff to learn about the lazy functions (especially in my experience concat and range), where they can help make code that performs well much simpler, but you can hit some real landmines too |
| 16:29 | bja | justin_smith: so apparently the jdbc pg driver doesn't propagate type information it learns to the backend. So saying s=conn.prepareStatement("SELECT ?"); s.setTimestamp(int, Timestamp) doesn't communicate to PG that the ? is a ::timestamp, although it apparently does for MySQL and Sqlite3 |
| 16:29 | justin_smith | bja: fascinating - is that a bug? |
| 16:29 | bja | Dave Cramer (maintainer) seems to think it is not |
| 16:30 | sobel | oddly, working with Oracle has helped me connect some ideas between databases and clojure. it is pretty overt about sequences, lazy sequences, and related data/data structure issues. |
| 16:30 | justin_smith | bja: what's the justification? |
| 16:30 | bja | I didn't really get one. https://github.com/pgjdbc/pgjdbc/issues/276 |
| 16:30 | sobel | that makes sense |
| 16:31 | sobel | it tried to prepare a statement without knowing the type, and predictably failed |
| 16:31 | justin_smith | bja: "basically we hate the people using our library and want using to be a terrible experience" |
| 16:31 | justin_smith | bja: so the solution is to explicitly use the one with or without the timezone? |
| 16:32 | sobel | if you were using a method that did not prepare the statement, but instead executed "SELECT '2015-04-07'::date" or even without the typecast it would be a different deal |
| 16:32 | justin_smith | hmm, what about SELECT ?::date" |
| 16:32 | justin_smith | err, bad parens there obviously |
| 16:32 | sobel | sure |
| 16:33 | bja | SELECT ?::datetime works |
| 16:33 | sobel | then you have supplied the type hint in the query, so good |
| 16:33 | sobel | also, nominally o/t, always use timestamp with time zone. never use without timezone. |
| 16:33 | bja | yeah, but I was originally under the impression that since I told JDBC that it's a Timestamp that it should have indicated that to postgresql for me. I was wrong. |
| 16:33 | sobel | unless you just hate your data and hate people that will have to use it |
| 16:34 | bja | I mean, you get the same error if you indicate a time zone too |
| 16:34 | sobel | yes, but only when you're counting on it sending that type info to the backend which doesn't happen |
| 16:35 | sobel | i'm talking about general cases of table design. don't use without timestamp. you'll be sorry. :) |
| 16:35 | justin_smith | bja: "ERROR: type "datetime" does not exist" |
| 16:35 | bja | err, timestamp |
| 16:35 | bja | sorry |
| 16:35 | justin_smith | OK |
| 16:35 | bja | SELECT ?::timestamp |
| 16:35 | sobel | i believe the postgresql type is timestamptz |
| 16:35 | irctc_ | can someone help me with the clojure.lang.PersistentQueue/EMPTY exercise |
| 16:36 | justin_smith | OK "SELECT ?::timestamptz" totally worked |
| 16:36 | justin_smith | irctc_: exercise? |
| 16:37 | bja | I'm also unsure how to indicate to clojure.jdbc that I want it to invoke .setTimestamp(int, timestamp, calendar) as opposed to .setTimestamp(int, timestamp) for my #inst |
| 16:37 | irctc_ | I have this function from joy clojure and don't know what the w refers too: (defmethod print-method clojure.lang.PersistentQueue [q w] (print-method '<- w) (print-method (seq q) w) (print-method '-< w)) |
| 16:37 | bja | err, clojure.java.jdbc |
| 16:38 | justin_smith | irctc_: print-method takes a "writer" arg - the thing to write to |
| 16:38 | patrickgombert | irctc_: it refers to the writer |
| 16:38 | justin_smith | (doc print-method) |
| 16:38 | clojurebot | "; " |
| 16:38 | justin_smith | :( |
| 16:38 | irctc_ | Thank you :-) |
| 16:38 | patrickgombert | irctc_: the writer is typically going to be *out* |
| 16:39 | irctc_ | Thanks, I needed that clarification. |
| 17:34 | caryme | I have a large lazy sequence of chars. I want to use a java library that requires I pass a java.io.Reader or java.io.InputStream. is there a good way for me to transform that lazy sequence of chars to a Reader (or inputstream)? |
| 17:38 | amalloy | honestly i'm not aware of anything very good, caryme. we did kinda a mediocre version of this for streams in flatland/io, which you could adapt to readers: https://github.com/ninjudd/io/tree/develop/src/flatland/io/core |
| 17:39 | amalloy | basically wrote an adapter in java, to turn java.io's stream hierarchy into an interface thing instead of inheritance thing, so that it was easy to provide implementations of streams in clojure |
| 17:39 | amalloy | then you could use that to write a reader that's backed by (atom some-lazy-seq) |
| 17:40 | caryme | thanks amalloy, Il'l check that out |
| 17:53 | sobel | what's the easiest way to integrate a clojure generated class into a java build based on eclipse/maven? |
| 17:55 | sobel | minimum-footprint is ideal. i'm willing to write regular java to keep clojure-y tools out of the build. i am taking enough risk to add a jar (clojure.jar) to the mix already. |
| 17:56 | sobel | it seems my standalone executable clojar distribution method won't cut it, after all |
| 17:58 | vas | So when you guys deploy your apps to the intarwebz do you (always?) make an uberjar and go from there? |
| 18:01 | sobel | ...working on delivery of my first commercial clojure this very moment. so far it's an uberjar but i might have to gen a class and drop it in to a traditional servlet project. |
| 18:02 | sobel | anywho, ideally i might even want to paste the clojure src into a class that compiles it at runtime |
| 18:03 | sobel | it's not a clojure app. this is pretty much a batch-job extension. |
| 18:04 | sobel | unrelated: has anyone dumped clojure.jar on their oracle server and written server-side clojure as stored proc? |
| 18:04 | sobel | nevermind, my coworkers would get pitchforks |
| 18:11 | rmarianski | sobel: you can use clojure.lang.rt from java |
| 19:23 | kaiyin | how do you solve this exception in repl? (use 'clojure.data.json ) IllegalStateException pprint already refers to: #'clojure.pprint/pprint in namespace: tincanter.core clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88) |
| 19:40 | bbloom | so i've got a new machine here & `lein repl` just won't start |
| 19:40 | bbloom | or rather it takes like ~3 minutes to start |
| 19:41 | arrdem | foo?? |
| 19:41 | lazybot | arrdem: Uh, no. Why would you even ask? |
| 19:42 | arrdem | foo?! |
| 19:43 | arrdem | foo!? |
| 19:44 | noonian | kaiyin: try (require '[clojure.data.jsoin :as json]); the warning is because clojure.data.json defines its own pprint function and clojure.pprint/pprint is automatically required and refered in the default repl |
| 19:44 | kaiyin | cool, thanks. |
| 19:44 | noonian | note my typo in the lib name also :P |
| 19:45 | noonian | then you would access the json pprint with json/pprint |
| 20:22 | darthdeus | are people using jig? seems it hasn't been updated in a while |
| 20:35 | pcn | If I have a list and I want to pass it to a function that takes varargs like (defn foo [a & b]), I know I can take (first input-list) and pass it as a, but how do I turn (rest input-list) into the arguments for the function? |
| 20:37 | pmonks | ,(doc apply) ; not sure ? |
| 20:37 | patrickgombert | pcn: you could just (apply foo input-list) |
| 20:37 | pcn | Ah,thanks! |
| 20:37 | patrickgombert | np |
| 20:37 | clojurebot | "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args." |
| 20:38 | pcn | Wow, that's such an interesting construct |
| 21:32 | bja | kaiyin, did you get an answer? |
| 21:55 | bmaddy | I'm trying to get cider working with emacs (again). Does anyone know what this error means? The lein executable (specified by `cider-lein-command' or `cider-boot-command') isn't on your exec-path |
| 22:11 | justin_smith | bmaddy: your shell env isn't visible to point an xlick gui apps |
| 22:12 | justin_smith | bmaddy: start emacs from a tty, or manually set up emacs' path |
| 22:14 | justin_smith | bmaddy: emacs' path can be set with the setenv function (altering PATH of course) |
| 22:16 | bmaddy | Well, it does seem to start up when I just do plain emacs. Aqumacs must be the problem. |
| 22:17 | bmaddy | I mean, environment stuff, like you said. |
| 22:17 | justin_smith | yeah, not an infrequent issue on osx |
| 22:18 | justin_smith | you can set your default env but the osx way is weird |
| 22:19 | justin_smith | easier to start from a shell prompt |
| 22:19 | bmaddy | Interesting, I'll try starting aquamacs from a prompt... |
| 22:20 | justin_smith | you may need the "open" command |
| 22:21 | justin_smith | iirc (I am a happy migrant back to linux land) |
| 22:25 | amalloy | clojurebot: Aquamacs |must be| the problem. |
| 22:26 | clojurebot | Ack. Ack. |
| 22:35 | timvisher | anyone have a good comparison between http-kit and jetty? |
| 22:35 | timvisher | i'm trying to write up what the tradeoffs are between them |
| 22:35 | timvisher | http-kit can achieve far higher through put because async i/o? |
| 22:47 | arrubin | timvisher: http-kit appears to use Netty. You will probably have more luck finding comparisons of Jetty and Netty. |
| 22:48 | timvisher | arrubin: my understanding is that it is inspired by netty but not actually implemented with it |
| 22:48 | arrubin | timvisher: Check the project file. |
| 22:48 | timvisher | arrubin: and i went down that route as well and was surprised to not find much information on it |
| 22:49 | arrubin | https://github.com/http-kit/http-kit/blob/master/project.clj |
| 22:49 | arrubin | [io.netty/netty "3.6.5.Final"] |
| 22:49 | timvisher | heh. yep :) |
| 22:49 | timvisher | wonder when that happened |
| 22:49 | timvisher | jetty vs netty seems mostly to talk about async vs. sync support, but jetty 7 even seems to support async |
| 22:50 | arrubin | Jetty implements the servlet spec. |
| 22:50 | arrubin | Netty is more of a library to implement such things. |
| 22:50 | timvisher | so i'm wondering if jetty has evolved to support async i/o since netty came out |
| 22:50 | timvisher | certainly jetty has been far more widely used |
| 22:51 | timvisher | jetty 9 for instance only use nio |
| 22:51 | arrubin | Chances are that your needs will not make either break a sweat. |
| 22:52 | arrubin | Your bottlenecks are almost certainly elsewhere, if there is even a problem. |
| 22:53 | timvisher | arrubin: also, seems like http-kit only uses netty in it's tests https://github.com/http-kit/http-kit/search?utf8=%E2%9C%93&q=netty |
| 22:53 | timvisher | arrubin: i'm sure of that, but i'm tasked with evaluating them. it's looking like jetty is the obvious choice |
| 22:53 | timvisher | which is slightly surprising to me because i felt like http-kit has been sweeping the clojureverse since it came out |
| 22:55 | timvisher | arrubin: do you think you could say what the banner differences are between jetty and http-kit? |
| 22:55 | timvisher | certainly jetty 7 is probably more out of date than http-kit (for some value of out of date) but there's also a jetty9 adapter which would bring in jetty 9 |
| 22:58 | arrubin | timvisher: Sorry, I have not used http-kit. I assume that it does not implement the servlet spec. They seem designed for different purposes. |
| 22:59 | timvisher | arrubin: ok. in terms of clojure and running an embedded jetty server which is then run from `java -jar`, am i even using the servlet spec? |
| 22:59 | timvisher | admittedly i'm fairly uneducated when it comes to servlets |
| 23:06 | ncthom91 | hey y'all. Is there a cleaner way to do something like this? http://pastie.org/10079510 |
| 23:06 | ncthom91 | I just want to replace the second element in each match with the result of applying that element to `fib` |
| 23:07 | amalloy | (set (map #(update-in % [1] fib) matches))? |
| 23:12 | arrubin | timvisher: I honestly do not know. I am only a Clojure dabbler. |
| 23:14 | arrubin | Are you using Ring with the Jetty adapter? |
| 23:37 | tbaldridge | timvisher: one thing I've heard mention more than once by Clojure devs, is that they trust the implementation of Jetty over the implementation of http-kit. In fact I don't know that I've ever seen http-kit in production |
| 23:38 | tbaldridge | Not that there's anything wrong with it, it's just a big unknown. While ex-java teams are probably a bit more comfortable with Jetty. |
| 23:42 | Jaood | tbaldridge: Jetty is also more mature, battle-tested and more actively developed. |
| 23:42 | justin_smith | tbaldridge: I have used http-kit in prod without issue |
| 23:43 | tbaldridge | Jaood: exactly |
| 23:43 | tbaldridge | justin_smith: yeah, I've never really had an issue with it either. But the last time the discussion came up with a client it was a big question of "do we trust the hundreds of Java eyes that have seen the Jetty code...or the dozen of clojure people working on HTTP Kit"". |
| 23:44 | tbaldridge | Not much of a contest there sadly. But I think it depends on your needs/goals |
| 23:48 | justin_smith | the container / servlet abstraction is a difference, but a small one when running standalone |
| 23:49 | Jaood | tbaldridge: I can see why http-kit is attractive, a small, fast http server design for specifically for ring |
| 23:50 | justin_smith | also, you can use dynamic binding in jetty, bevause a request will stay in one thread, last I checked |
| 23:51 | justin_smith | http-kit can break dynamic binding |
| 23:52 | justin_smith | this might be inherent in any server where you can use sockets |
| 23:52 | Jaood | jetty is also a fast web server a la nginx |
| 23:53 | justin_smith | is it hardened like nginx? |
| 23:54 | Jaood | yeah, you can have it public facing |
| 23:55 | justin_smith | I had no idea |
| 23:55 | Jaood | it already supports http2 I think |
| 23:55 | justin_smith | I'll have to look into that |
| 23:56 | Jaood | Is uncertain if http-kit will ever support http2 |
| 23:58 | Jaood | justin_smith: I would still prefer nginx though :) |