2014-01-13
| 00:05 | amalloy | ah yes, nicola's patch fixes the issue that i carefully checked for but still failed to notice |
| 00:26 | logic_prog | is the semantics for "throwing an uncaught exception inside a go block" well defined ? |
| 00:26 | logic_prog | if so, what is it defined as? |
| 00:49 | cerealklr | Hey folks. Is there any way to have comments at the end of lines in multiline strings? |
| 00:49 | cerealklr | I've got a kind of gnarly regexp that I'd like to document |
| 00:52 | amalloy | cerealklr: well, a regex isn't a string. i don't think there's an answer for strings, aside from just writing (str "foo" ;; blah <RET> "bar" ;; duh) |
| 00:53 | cerealklr | My bad, I'd assumed the same rules would apply. |
| 00:53 | amalloy | but java's regular expressions support extended mode with the (?x) embedded flag (most regex engines do, even if they may have a more convenient syntax like /foo/x) |
| 00:53 | amalloy | so #"foo # comment RET bar # comment2 ..." |
| 00:53 | amalloy | ought to work |
| 00:53 | amalloy | er |
| 00:53 | amalloy | #"(?x)foo # comment RET bar # comment2 ..." |
| 00:55 | amalloy | for more details about how extended mode changes the way regular expressions are compiled...well, look up extended mode, i guess |
| 00:55 | cerealklr | Dang. JS Regexps don't suppport extended mode, and I'm working in clojurescript. Didn't stop to consider the difference. |
| 00:56 | cerealklr | I suppose I can shim out to JS's Regexp ctor if there isn't a more elegant in language way. |
| 01:00 | amalloy | well, js does support extended mode, but it doesn't support inline flags |
| 01:00 | amalloy | whereas clojure has no way to specify flags other than inline (or interop) |
| 01:04 | deadghost | hmm ordinarily you'd use vectors instead of lists except when writing macros right? |
| 01:05 | deadghost | I have a few places where I'm using lists as tuples and vectors seem more appropriate |
| 01:07 | seangrove | cerealklr: Sounds like a good opp for a library |
| 01:07 | cerealklr | seangrove: I ended up using re-pattern with str |
| 01:08 | cerealklr | a macro would probably bundle that nicely |
| 01:08 | amalloy | cerealklr: well, not very nicely, really, right? because you have to double-escape things in a string but not in a regex |
| 01:09 | amalloy | eg, #"\d{4}" vs (re-pattern (str "\\d" "{4}")) |
| 01:09 | cerealklr | fair enough. Didn't consider that |
| 01:09 | cerealklr | it's a tradeoff either way |
| 01:10 | amalloy | yeah |
| 01:10 | ruzu | `(println "yay") |
| 01:12 | amalloy | deadghost: huh? you use vectors and lists pretty much the same in macros as you would otherwise |
| 01:14 | deadghost | probably worded that poorly |
| 01:14 | deadghost | you'd typically use vectors instead of lists right? |
| 01:15 | deadghost | except in macros where you need to build an s-exp |
| 01:15 | deadghost | which requires lists |
| 01:16 | amalloy | i mean, your output will include lists (seqs, really), but so does the output of many functions; and you'll probably type as many () and []s as you do when writing any other function |
| 01:17 | amalloy | and the output will include vectors too, eg for emitting let-blocks |
| 01:53 | mischanix | Trying to pprint a seq that's basically the result of filter and getting ClassCastException: clojure.lang.PersistentHashMap cannot be cast to java.util.Map$Entry |
| 01:54 | mischanix | Here's relevant code/stack trace: https://www.refheap.com/23162 |
| 02:07 | amalloy | the formatting of that code is really weird, mischanix - it makes it very hard to read what is going on. but here it looks like the problem is that you're calling (vals (:heroes s)), and (:heroes s) is a list of maps, rather than a single map |
| 02:07 | Raynes | Holy shit. |
| 02:08 | Raynes | Gotta say, I couldn't have come up with that layout myself. |
| 02:10 | mischanix | Ah, nice find, thanks. |
| 02:11 | amalloy | if i were going to make a whitespace-only rewrite of your code, it would look like https://www.refheap.com/23176 |
| 02:13 | mischanix | Yeah. First project in clojure, never touched a lisp before either. |
| 02:17 | mischanix | Got 600 more lines of stuff that looks exactly like that if you're into the horror genre. |
| 02:20 | amalloy | haha no thanks, i saw that a newcomer to the language was trying to write hearthstone and that one snippet was enough for me |
| 02:21 | mischanix | Might end up redoing it in C once I know my data structures, heh |
| 02:23 | logic_prog | with http://clojure.github.io/core.async/#clojure.core.async/>! , is there any defined behavior for using >! / >!! on a closed channel? |
| 02:23 | logic_prog | i.e. is the behavior undefined, throw, or nil ? |
| 02:28 | proteneer_ | anyone play around with ClojureC to be able to comment on its maturity? |
| 02:33 | amalloy | i would be astonished if clojurec were mature, proteneer_. aside from the readme itself saying it's experimental and not-polished, one of the two commits made in december was "make things compile again" after a two-month period of no commits, in which presumably things did not compile |
| 02:33 | proteneer_ | hm |
| 02:33 | proteneer_ | ok |
| 02:34 | proteneer_ | thanks. I've been itching to dive into a FP language, but I don't know any java |
| 02:39 | TEttinger | proteneer_, there's a few people in here who are users of haskell, it's a solid choice if you are averse to java stuff |
| 02:41 | seangrove | Anyone have good suggestions for parsing a string as html in clojurescript? |
| 02:52 | bitemyapp | seangrove: jquery |
| 02:52 | bitemyapp | wait, lemme think about that for a moment. |
| 02:52 | seangrove | bitemyapp: I suppose actually I should rephrase |
| 02:52 | bitemyapp | seangrove: http://api.jquery.com/jquery.parsehtml/ |
| 02:52 | seangrove | I would like to parse a string into an html representation, but not actual html (could be unsafe), and then pull out the text content of the nodes. |
| 02:53 | bitemyapp | seangrove: then my link seems a good fit. |
| 02:53 | seangrove | So they never need to become dom nodes |
| 02:53 | seangrove | bitemyapp: heh, "jQuery.parseHTML uses a native DOM element creation function to convert the string to a set of DOM elements, which can then be inserted into the document. |
| 02:53 | Raynes | lol |
| 02:53 | bitemyapp | seangrove: but you skip the "inserted into the document" part |
| 02:53 | bitemyapp | seangrove: and just iterate over the contents |
| 02:54 | seangrove | bitemyapp: Hrm, I need to look up when a resource is downloaded - at tag cration time, or dom insertion time |
| 02:55 | seangrove | Google is also epicly failing me at that query |
| 02:55 | seangrove | I'll ask in an html channel tomorrow |
| 02:55 | bitemyapp | seangrove: what sort of resource? |
| 02:56 | seangrove | src tag, img tag, a bgaudio tag, etc. |
| 02:56 | seangrove | Anything that could trigger an external resource and be used to track a load |
| 02:56 | bitemyapp | seangrove: it depends on where they're located and what sort of tag they are. |
| 02:56 | bitemyapp | for example, there's a reason you put src tags at the tail of the body, rather than at the top. |
| 02:57 | mischanix | fwiw just doing document.createElement().innerHTML= does trigger a load with an <img> tag |
| 02:57 | bitemyapp | mischanix: without inserting it into the DOM? |
| 02:59 | mischanix | bitemyapp: no insertion: http://i.imgur.com/vB8B4uu.png ; I think the fragments API prevents this, though |
| 03:01 | mischanix | actually no, I think I'm thinking of something else but I don't remember |
| 03:04 | bitemyapp | DOM Stuff. |
| 03:13 | seangrove | bitemyapp: Yeah, DOM + JS... it's enough to shake one's faith in the idea of progress and understanding what came before |
| 03:13 | seangrove | But enough for tonight, off to dream of the doms, in whatever form they take |
| 03:13 | seangrove | Xb |
| 03:16 | ddellacosta | seangrove: based on testing, seems pretty clear that for an image tag, at least, the resource is requested on creation of the element. |
| 03:17 | seangrove | If that's the case, I'll have to find a nice library for parsing strings into clj data structures |
| 03:17 | ddellacosta | seangrove: seems like this may have something to do with being a "replaced element:" http://www.whatwg.org/specs/web-apps/current-work/#replaced-elements |
| 03:17 | ddellacosta | seangrove: yah, I was gonna say, may be better (and faster) to generate strings |
| 03:18 | ddellacosta | I'm curious if this behavior varies based on the browser, however. I wouldn't put it past IE to do something different. |
| 03:18 | ddellacosta | seangrove: Anyways, don't let me keep you from DOM dreams. ;-) 'night! |
| 03:19 | seangrove | ddellacosta: Oh, I have html strings already. I want data structures, then some filtering on them, then turn them back into (possibly different) dom nodes |
| 03:19 | seangrove | But yes, tomorrow! |
| 03:19 | ddellacosta | gotcha. |
| 03:38 | logic_prog | given that (>! ... ...) always returns nil, regardless of whether the channel is open or closed |
| 03:38 | logic_prog | is htere anyway to quer whether a core.async channel is open or closed? |
| 03:49 | alew | what's the difference between drop and nthnext? |
| 03:55 | rurumate1 | logic_prog: according to the doc string, (<!! ch) will only ever return nil when the channel is closed |
| 03:55 | logic_prog | rurumatel, yeah, this doesn't work well since I don't want to be reading from channels |
| 03:55 | rurumate1 | oh, and !< has the same behaviour |
| 03:55 | logic_prog | to actually figure out if they're closed |
| 03:55 | rurumate1 | I see because that would change them |
| 03:56 | logic_prog | i'd prefer soething that didn't alter the state ot the channel, say |
| 03:56 | logic_prog | close? |
| 03:58 | rurumate1 | maybe you can use core.async/filter or core.async/remove on the channel, to prevent it from returning anything non-nil? |
| 03:59 | scape | channels should not pass nil |
| 03:59 | rurumate1 | except when closed, no? |
| 04:00 | rurumate1 | (!< (filter nil? ch)) can return nil |
| 04:00 | rurumate1 | I'd wager |
| 04:02 | rurumate1 | alew: maybe one is more lazy, like the difference between next and rest? |
| 04:02 | logic_prog | lol |
| 04:02 | logic_prog | what a hack |
| 04:04 | rurumate1 | yeah, there should be a better way. maybe the core.async developers can give a better answer? |
| 04:07 | amalloy | alew: drop can return (), nthnext can return nil |
| 04:08 | em-dash | where can I put code (e.g., protocol extensions) that I want loaded everywhere? do I have to require it in to every namespace? |
| 04:08 | amalloy | uh, protocol extensions only have to be required once |
| 04:13 | em-dash | then I'm likely doing something (else) stupid and not yet aware of it |
| 04:15 | em-dash | amalloy: hmm, does that hold for clojurescript (I would suppose so)? |
| 04:15 | amalloy | indeed |
| 05:09 | mattyw | real newbie question here - I've got a list of maps that I'm trying to flatten into one map - but it doesn't work as I expect: |
| 05:09 | mattyw | (into {} (map (fn [x] {:a x}) '(:b :c :d))) |
| 05:09 | mattyw | ^^ Must be because I've got a lazy list from doing the map call? |
| 05:10 | kzar | ,(into {} (map (fn [x] {:a x}) '(:b :c :d))) |
| 05:10 | clojurebot | {:a :d} |
| 05:11 | kzar | ,(map (fn [x] {:a x}) '(:b :c :d)) |
| 05:11 | clojurebot | ({:a :b} {:a :c} {:a :d}) |
| 05:11 | mischanix | map keys must be unique |
| 05:11 | kzar | (apply into {} (map (fn [x] {:a x}) '(:b :c :d))) |
| 05:11 | kzar | ,(apply into {} (map (fn [x] {:a x}) '(:b :c :d))) |
| 05:11 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core/into> |
| 05:12 | andyf | (apply merge sequence-of-maps) might be what you want |
| 05:12 | kzar | ,(apply merge (map (fn [x] {:a x}) '(:b :c :d))) |
| 05:12 | clojurebot | {:a :d} |
| 05:12 | kzar | ,(mapcat (fn [x] {:a x}) '(:b :c :d))) |
| 05:12 | clojurebot | ([:a :b] [:a :c] [:a :d]) |
| 05:12 | andyf | See also merge-with |
| 05:17 | alew | amalloy: thanks, I also discovered nthnext returns a chunkedcons while drop returns a lazyseq |
| 05:18 | amalloy | i guess that's truee, but it's too specific |
| 05:18 | amalloy | nthnext is eager, while drop is lazy; the particular classes returned are implementation details (and not always the same) |
| 05:21 | mattyw | kzar, mischanix thanks very much for your help |
| 05:21 | kzar | yw |
| 05:23 | alew | amalloy: by eager you mean it realizes the entire sequence? because it doesn't |
| 05:23 | amalloy | no, why would i mean that? i mean it eagerly does work the moment you call it |
| 05:24 | alew | I misunderstood eager |
| 05:24 | amalloy | (nthnext n xs) immediately calls next n times on xs, whereas (drop n xs) returns a lazy sequence that will call next, or rest, as many times as needed |
| 05:25 | alew | Ah ok |
| 05:25 | amalloy | &(time (do (drop 1e7 (range)) nil)) |
| 05:25 | lazybot | ⇒ "Elapsed time: 26.189066 msecs" nil |
| 05:25 | amalloy | &(time (do (nthnext 1e7 (range)) nil)) |
| 05:25 | lazybot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Double |
| 05:25 | amalloy | &(time (do (nthnext (range) 1e7) nil)) |
| 05:25 | alew | arg order is swapped |
| 05:25 | lazybot | ⇒ "Elapsed time: 1887.946738 msecs" nil |
| 05:25 | alew | right |
| 05:51 | honza | Looking for some ideas on how to move from the intermediate Clojure dev to something higher... anyone? |
| 06:05 | fredyr | honza: build cool things? :) |
| 06:06 | Southy | contribute to an open source project that you think is cool? |
| 06:08 | Southy | Look at ClojureScript if you are into Web stuff? |
| 06:09 | mischanix | Is there a function for this? |
| 06:09 | mischanix | ,(let [l '(1 2 3 4 5)] (concat (take 2 l) (nthrest l 3))) |
| 06:09 | clojurebot | (1 2 4 5) |
| 06:10 | mischanix | Or a proper way to do it? |
| 06:11 | Sfiv | mischanix, you mean remove an element? |
| 06:12 | mischanix | So to speak, yeah. Get the list without the nth element |
| 06:23 | amalloy | mischanix: generally if you want to remove an element by index, your algorithm isn't very functional; if it really is the way you need to do things, you should pick a data structure for which random removal is more efficient than a list or a vector |
| 06:26 | amalloy | for example, a set of objects, or a sorted map of some kind, like a map from index to object |
| 06:31 | mischanix | amalloy: I'm choosing randomly between all possible user actions. Some of these actions can lead to an invalid state, and that ends up returning nil up to the function that's choosing; when this happens, I'm simply recurring the choose function with the nil-resulting function removed from the possible choices. If there are no choices, choose also returns nil |
| 06:31 | amalloy | so use a set |
| 06:32 | mischanix | mmkie |
| 06:36 | mischanix | Though, how do I pick randomly from a set? Do I end up making it a seq so I can use nth on it? |
| 06:37 | mischanix | Is that not wasteful? |
| 06:39 | mischanix | Also, there theoretically can't be more than ~20 choices |
| 06:44 | rurumate1 | I need a shingle-producing function; the input would be a vector like ["the" "big" "black" "box"], output would be all 2-shingles: ["the big" "big black" "black box"] |
| 06:45 | rurumate1 | is there something to help it, or should just write a loop? |
| 06:45 | ddima | rurumate1: partition is your friend |
| 06:45 | rurumate1 | ddima: thx |
| 06:46 | DerGuteMoritz | how does partition help here? |
| 06:46 | ddima | ,(partition 2 1 ["the" "big" "black" "box"]) |
| 06:46 | clojurebot | (("the" "big") ("big" "black") ("black" "box")) |
| 06:46 | DerGuteMoritz | ah! |
| 06:47 | DerGuteMoritz | nice |
| 06:47 | DerGuteMoritz | forgot about those arguments |
| 06:49 | AeroNotix | In a doto form, can I conditionally apply some of the functions? |
| 06:50 | AeroNotix | hmm, I could just put a fn there |
| 07:00 | AeroNotix | hm, doesn't seem to call it |
| 07:00 | rurumate1 | AeroNotix: I've asked myself the same thing, also inside a -> form. Please paste your solution if you find it |
| 07:02 | rurumate1 | AeroNotix: maybe -<> from swiss-arrows can help? |
| 07:02 | AeroNotix | wat |
| 07:02 | rurumate1 | but the diamond can only appear once per form.. |
| 07:02 | AeroNotix | oh I see |
| 07:02 | AeroNotix | it's a real thing |
| 07:02 | rurumate1 | I've started a discussion there, wanna join? https://github.com/rplevy/swiss-arrows/issues/22 |
| 07:03 | clgv | AeroNotix: but there is `as->` as well |
| 07:03 | clgv | and that one is in clojure core since 1.5 |
| 07:04 | clgv | &(doc as->) |
| 07:04 | lazybot | java.lang.RuntimeException: Unable to resolve var: as-> in this context |
| 07:04 | clgv | ,(doc as->) |
| 07:04 | clojurebot | "([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form." |
| 07:04 | rurumate1 | I have no idea what that docstring means. Where are the examples? |
| 07:07 | rurumate1 | ,(as-> 1 x (inc x) (inc x)) |
| 07:07 | clojurebot | 3 |
| 07:08 | rurumate1 | brilliant |
| 07:08 | rurumate1 | ,(as-> 1 x (inc x) (inc (inc x))) |
| 07:08 | clojurebot | 4 |
| 07:08 | rurumate1 | it's a dream come true |
| 07:09 | locks | rurumate1: if only any of the docstrings had examples |
| 07:13 | rurumate1 | locks: I've heard the clojure maintainers are trying to keep them short. It's okay as long as you can find examles easily via google, but could not find easily for as-> |
| 07:14 | hcumberdale | (into {} (map (fn [[a b]] (hash-map a b)) '(["1" "a"] ["2" "b"]))) |
| 07:14 | hcumberdale | is there a better way to do this? |
| 07:15 | DerGuteMoritz | ,(into {} '(["1" "a"] ["2" "b"])) |
| 07:15 | clojurebot | {"1" "a", "2" "b"} |
| 07:15 | DerGuteMoritz | hcumberdale: ^ |
| 07:15 | hcumberdale | DerGuteMoritz: thx, but why does it work? |
| 07:16 | hcumberdale | ahh it uses conj and that is working with pairs? |
| 07:16 | amalloy | (into x [a b c]) is (conj x a b c) |
| 07:16 | amalloy | and conj on a map wants vector pairs |
| 07:16 | DerGuteMoritz | indeed |
| 07:16 | rurumate1 | (conj {} ["a" "b"]) |
| 07:16 | rurumate1 | ,(conj {} ["a" "b"]) |
| 07:16 | clojurebot | {"a" "b"} |
| 07:22 | hcumberdale | Also a better way to do: (into {} (map #(hash-map (str (:fieldname1 %)) (:fieldname2 %)) (j/query db [selectstatement]))) ? |
| 07:22 | jcromartie | how can I make use of Clojure STM while dealing with external transactions? |
| 07:22 | hcumberdale | where j is clojure.java.jdbc |
| 07:23 | jcromartie | i.e. outside APIs |
| 07:23 | locks | rurumate1: yeah, I guess clojuredocs could serve as an example repo, but it does seem a bit oudated? |
| 07:24 | DerGuteMoritz | hcumberdale: one way would be (into {} (map str (map (juxt :fieldname1 fieldname2) (j/query db [selectstatement])))) -- you might consider using ->> here |
| 07:25 | DerGuteMoritz | hcumberdale: sorry, that wasn't exactly the same actually |
| 07:26 | DerGuteMoritz | or was it :-) |
| 07:26 | jcromartie | I obviously can't do external calls inside a dosync |
| 07:26 | jcromartie | (HTTP etc) |
| 07:26 | DerGuteMoritz | hcumberdale: nah, it's buggy, sorry |
| 07:27 | hcumberdale | also thought about using juxt |
| 07:27 | hcumberdale | but can't create anything with it that works :( |
| 07:28 | DerGuteMoritz | hcumberdale: how about something like (apply hash-map (map str (map (j/query db [selectstatement]) [:fieldname1 :fieldname2]))) |
| 07:29 | rurumate1 | locks: searching for as-> on clojuredocs' search engine gives me only one less-relevant result |
| 07:29 | rurumate1 | maybe the poor search performance is a factor why it's not being used so much? |
| 07:30 | hcumberdale | DerGuteMoritz: changes everything to strings, doesn't it? |
| 07:30 | rurumate1 | or maybe it really has no example for as->, which would be sad |
| 07:31 | hcumberdale | (map (j/query db [selectstatement]) [:fieldname1 :fieldname2])) << don't know that this is actually working |
| 07:31 | amalloy | (into {} (map (juxt (comp str :field1) :field2) (j/query ...))) looks equivalent to the originalm hcumberdale |
| 07:31 | DerGuteMoritz | hcumberdale: oh yeah sorry, I misread your original version |
| 07:32 | hcumberdale | thx amalloy! |
| 07:32 | amalloy | hashmap is a function you should almost never apply - into {} just works better so often |
| 07:33 | DerGuteMoritz | ah, right, query returns a list of maps |
| 07:33 | DerGuteMoritz | zing |
| 07:33 | DerGuteMoritz | ok I should not do this on the side :-) |
| 07:34 | rurumate1 | ,(as-> 1 x (inc x) (inc (inc x)) (or (odd? x) (as-> 1 y y))) |
| 07:34 | clojurebot | 1 |
| 07:34 | rurumate1 | smashing |
| 07:36 | sm0ke | guys how do i compare this? |
| 07:36 | sm0ke | ,(= {:a 0.4} {:a 0.4}) |
| 07:36 | clojurebot | true |
| 07:36 | sm0ke | ,(= {:a 0.4 :b 0.7} {:a 0.4 :b .7}) |
| 07:36 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .7 in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 07:36 | sm0ke | ,(= {:a 0.4 :b 0.7} {:a 0.4 :b 0.7}) |
| 07:36 | clojurebot | true |
| 07:36 | sm0ke | err |
| 07:37 | rurumate1 | you're comparing it well imho |
| 07:38 | sm0ke | well wtf |
| 07:38 | sm0ke | let me check again |
| 07:40 | rurumate1 | recur will never consume the stack, even when used without loop, right? |
| 07:42 | rurumate1 | (when the enclosing function is used as recursion point) |
| 07:42 | rurumate1 | ,((fn [x] (if (< x 10000) (recur (inc x)) x)) 1) |
| 07:42 | clojurebot | 10000 |
| 07:43 | sm0ke | yes recur is optimized |
| 07:43 | sm0ke | so i was asking this ##(= 0.7 (float 0.7)) |
| 07:43 | lazybot | ⇒ false |
| 07:43 | sm0ke | so i was asking this ##(== 0.7 (float 0.7)) |
| 07:43 | lazybot | ⇒ false |
| 07:43 | sm0ke | so i was asking this ##(=== 0.7 (float 0.7)) |
| 07:43 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: === in this context |
| 07:43 | sm0ke | hmm weird |
| 07:44 | rurumate1 | floats are weird |
| 07:44 | sm0ke | jeez this will make unit testing hard |
| 07:44 | sm0ke | whats the dfault thingy? |
| 07:44 | sm0ke | ,(type 0.1) |
| 07:44 | clojurebot | java.lang.Double |
| 07:45 | rurumate1 | smoke, usually when unit testing with floats, you specify a margin of error, e.g. 0.000001 |
| 07:46 | rurumate1 | see http://junit.sourceforge.net/javadoc/org/junit/Assert.html#assertEquals%28double,%20double,%20double%29 |
| 07:46 | clgv | sm0ke: comparing floating points numbers via equality is seldom right. |
| 07:46 | clgv | maybe deterministic testing is the only exception. |
| 07:47 | sm0ke | clgv: what do you mean? |
| 07:47 | clgv | otherwise you always want to know if two floating point numbers are approximately the same , i.e. have only a difference of at most epsiolon (being a small constant, e.g. 1E-10) |
| 07:50 | sm0ke | well i cannot have a epsilon based testing as i am comparing deeply nested maps |
| 07:52 | gnzh | hi guys, is there any way to stub function behaviour in midje using another function? I want function in my tests to behave like identity function. |
| 07:52 | clgv | gnzh: you can do that via (provided ...) for regular functions |
| 07:52 | good1 | Hi there, what's the proper way to accomplish this CL code in clojure? |
| 07:53 | good1 | (let ((foo '()) |
| 07:53 | good1 | (bar '(1 2 3))) |
| 07:53 | good1 | (dolist (x bar) |
| 07:53 | good1 | (setf foo (cons x foo))) |
| 07:53 | good1 | foo) |
| 07:53 | gnzh | clgv, can you provide simple example? (provided (a s) => s) doesn't work |
| 07:54 | clgv | gnzh: but it should. is `a` defined via `defn` ? |
| 07:55 | clgv | gnzh: `provided` does not work for protocol methods on regular deftypes/defrecords afair |
| 07:55 | gnzh | clgv, it just function, nothing fancy |
| 07:58 | gnzh | clgv, I'm not sure that what I wan't is possible to implement |
| 08:02 | clgv | gnzh: this works (fact (f 1 2) => 3 (provided (a 1) => 1 :times 1 (a 2) => 2 :times 1)), but I am not sure if you can achieve a general identity function |
| 08:03 | gnzh | clgv, well i don't want to stub manually all possible inputs |
| 08:03 | clgv | yeah I guessed that |
| 08:04 | clgv | gnzh: there is clojure.core/with-redefs |
| 08:08 | gnzh | clgv, thanks, that works. I was hoping that midje can provide cleaner way. |
| 08:08 | fredyr | good1: this is pretty similar perhaps |
| 08:09 | fredyr | good1: making a gist instead of pasting |
| 08:09 | fredyr | good1: https://gist.github.com/fredyr/8399958 |
| 08:10 | good1 | fredyr: You're right sorry! |
| 08:10 | clgv | good1: what is the task in general? build a list from a list? concatenation of two lists? |
| 08:11 | clgv | good1: ##(concat [1 2 3] []) |
| 08:11 | lazybot | ⇒ (1 2 3) |
| 08:12 | fredyr | clgv: if i understand correctly, the CL code was reverse with an accumulator |
| 08:12 | fredyr | pop and cons |
| 08:14 | good1 | I am trying to get a new list (foo in this case) so that i can us dstinct to remove duplicates! |
| 08:14 | fredyr | good1: oh in that case |
| 08:14 | fredyr | you alway get new lists in clojure |
| 08:15 | fredyr | since they're immutable |
| 08:16 | fredyr | ,(distinct [1 2 3 3 4 6 4]) |
| 08:16 | clojurebot | (1 2 3 4 6) |
| 08:16 | good1 | fredyr: Thank you! |
| 08:17 | fredyr | good1: np |
| 08:29 | nones | hi |
| 08:29 | I_play_2_win | hi |
| 08:30 | nones | is there ways to get current imported namespaces? |
| 08:30 | clgv | good1: you should read about Clojure's immutable/persistent datatypes. you never need to copy clojure datastructures to be able to use the unmodified and modified structure after that |
| 08:34 | rurumate1 | immutability is a no-brainer unless you're used to doing it wrong |
| 08:35 | clgv | well he obviously is not used to it and seems to not know about it, so no reason to insult him |
| 08:37 | good1 | clgv: Exactly! That was my problem, i see clearly now. |
| 08:37 | rurumate1 | sorry I didn't want to sound rude |
| 08:37 | rurumate1 | it's just that people seem to think it's a hard concept simply because there is this funny word |
| 08:38 | clgv | good1: as always, I'd recommend to read one of the clojure books to get you fast on track |
| 08:38 | rurumate1 | where in reality there should be a complicated word for NOT using immutable structures |
| 08:38 | clgv | rurumate1: well, it's different from what most are used to from industry/mainstream (C/C++, Java) |
| 08:38 | rurumate1 | like, "destructive programming" |
| 08:39 | rurumate1 | clgv: I'm painfully aware of that |
| 08:45 | ddima | nones: maybe you can try something like (.getAliases (find-ns 'clojure.core)) (or .getMappings, depending on what you want to see) |
| 08:48 | nones | ddima: thanks, I'll search in that direction |
| 08:48 | ddima | nones: though in the case of current namespace you might use (the-ns *ns*) |
| 08:49 | ddima | oh |
| 08:49 | ddima | you dont even need the-ns then |
| 08:49 | ddima | k |
| 08:49 | nones | ,*ns* |
| 08:49 | clojurebot | #<Namespace sandbox> |
| 08:50 | nones | yes |
| 08:52 | ddima | nones: thought, forget the manual method-calling, there's ns-imports, ns-aliases, ns-refers etc |
| 08:52 | ddima | -t |
| 08:52 | AeroNotix | I want to use assert-args, is there a public replacement? |
| 08:52 | AeroNotix | since assert-args is private. |
| 08:53 | nones | ddima: yes, I already found them |
| 08:53 | ddima | ahk. I was just poking around myself, just to see what exists, so |
| 09:00 | tbaldridge | AeroNotix: it's open source, so you could always copy what's in core.clj |
| 09:01 | clgv | AeroNotix: you can create a public `def` to that private function, e.g. (def assert-args #'clojure.core/assert-args) |
| 09:01 | clgv | or macro... |
| 09:09 | gtrak | et voila. |
| 09:22 | AeroNotix | hmm |
| 09:33 | edw | Anyone happen to know the currently least deprecated, least painful way of recursively deleting a directory? |
| 09:37 | edbond | edw, commons io has deleteDirectory - http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#deleteDirectory%28java.io.File%29 |
| 09:38 | edw | edbond: I was reading in the list archives that delete-file-recursively got the axe because Java 6 cannot tell between a symlink and a real file. I'm guessing the Commons code has the same problem. |
| 09:39 | edw | I'm going to non-recursively delete a single level of files, since what I'm working with (Cascading local textline files) have only a depth of one. |
| 09:39 | edbond | it seems commons.io skips symlinks, see source http://commons.apache.org/proper/commons-io/apidocs/src-html/org/apache/commons/io/FileUtils.html#line.1550 |
| 09:40 | edw | edbond: Huh. Let me check that out then! |
| 09:40 | edbond | edw, did you look at file-seq? You can list files, filter and call #delete |
| 09:41 | edw | edbond: That's what I'm doing. Just reversing the sequence and deleting each file. |
| 09:45 | edw | edbond: https://www.refheap.com/23322 |
| 09:46 | edbond | edw, looks good. It does remove recursively, right? |
| 09:46 | edw | edbond: Yeah, for better or worse. |
| 09:46 | edbond | edw, I don't understand how you want to improve that |
| 09:47 | edw | Scary having a very easy-to-use "rm -rf...". |
| 09:47 | edw | edbond: Oh, I just wrote that since asking my original question. |
| 09:48 | edbond | you can add a global filter to remove only in *working-directory* |
| 09:49 | edbond | or not remove at all, move somewhere to /tmp/<timestamp> :) |
| 09:50 | edw | edbond: I was looking at the code you referred me to, and, yeah, if you filtered based on the canonical name, removing only those files that are inside the canonical name of the directory you're deleting. |
| 09:50 | edw | ...then you'd be a lot safe. |
| 09:50 | edw | s/safe/safer/ |
| 09:55 | deadghost | good morning #clojure |
| 09:55 | deadghost | how are you today |
| 09:56 | hyPiRion | silent, mostly. |
| 10:05 | mikerod | I'm guessing that a .cljx source file cannot be compiled via clojure-maven-plugin ( from https://github.com/lynaghk/cljx ) . |
| 10:14 | edbond | om question: what is the difference bw set-state! and transact! ? |
| 10:17 | fredyr | edbond: transact and update work on the the om state via cursors |
| 10:17 | fredyr | edbond: set-state updates the react state |
| 10:18 | fredyr | edbond: the latter is same as doing setState on a normal react component |
| 10:18 | edbond | cursor is like pointer in react state? |
| 10:18 | fredyr | yes pretty much |
| 10:18 | fredyr | edbond: denoting a particular sub state |
| 10:19 | edbond | how can I (should I) convert map to cursor? I have a go block that set-state! and om says 'cannot build from non-cursor' |
| 10:20 | edbond | I call set-state in go block and got that 'non-cursor' error |
| 10:20 | fredyr | edbond: not exactly sure |
| 10:20 | fredyr | edbond: but do you create your om state in the om/root |
| 10:21 | edbond | yes, initial state is defined in om/root. Let me try refheap |
| 10:21 | fredyr | edbond: sure |
| 10:24 | edbond | fredyr, here is a code - https://www.refheap.com/23335 |
| 10:24 | edbond | I misuse build-all I think |
| 10:25 | edbond | added w-row functions to refheap |
| 10:26 | edbond | I'm totally lost in components and state :) |
| 10:28 | fredyr | edbond: im not really following where load-watchlist come into play here |
| 10:28 | fredyr | edbond: and that's the only place i can see a set-state call? |
| 10:28 | edbond | ah, it's called from will-mount |
| 10:29 | fredyr | ah okay, in watchlist-table? |
| 10:29 | edbond | yes, I updated paste |
| 10:30 | fredyr | so in your code now, you only have the top level cursor |
| 10:30 | fredyr | `state` coming into watchlist-table |
| 10:31 | edbond | yes, how can I create cursors to some key in that state? |
| 10:31 | fredyr | you create new components using build |
| 10:32 | fredyr | with `build` you can take the current state and specify a path to say which "substate" corresponds to that component |
| 10:33 | fredyr | edbond: here's an example, https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/app.cljs#L160 |
| 10:34 | fredyr | edbond: oh, i might be wrong here |
| 10:34 | fredyr | edbond: the api has changed a bit since last i tried some code on it |
| 10:38 | edbond | fredyr, Thanks, I'll dig more into todomvc |
| 10:38 | fredyr | edbond: sure, i would've digged more into it as well, but i have to get back to work unfortunately :) |
| 10:39 | fredyr | before you could use it like this: (om/build comment-list app {:path []}) |
| 10:40 | fredyr | where the last part was a path that was used similar to get-in and update-in |
| 10:40 | fredyr | but now im not sure |
| 10:43 | fredyr | :s |
| 10:43 | mrhanky | anybody used the servants library? does every function used in the worker need a defservantfn ? |
| 11:00 | gfredericks | what's the current situation for round-tripping clojure code? |
| 11:01 | gfredericks | (in the sense of parsing the code into a data structure and printing it back out) |
| 11:05 | nDuff | gfredericks: ...okay, now I'm curious too. I'm sure I've seen a library built for the purpose (retaining reader metadata &c), but I'm having trouble finding it. |
| 11:08 | stuartsierra | I think cgrand had some experimental stuff for that. |
| 11:10 | hyPiRion | Are you guys talking about rewrite-clj? |
| 11:10 | hyPiRion | (https://github.com/xsc/rewrite-clj) |
| 11:10 | karls | a question about protocols: say i define a protocol in a namespace A and then want to use a method declared in that protocol in a different namespace B. i don't understand the mechanism that allows me to require the protocol namespace A and then do A/some-desired-method. can someone explain this quickly? |
| 11:13 | `cbp | karls: you want an explanation on how it works or how you're supposed to use it? |
| 11:13 | karls | how it works |
| 11:14 | karls | does defprotocol somehow make that method available in the namespace the protocol was declared in? |
| 11:14 | gfredericks | stuartsierra: hyPiRion: thanks! |
| 11:14 | `cbp | karls: you might wanna look at the source? :P |
| 11:15 | matt444 | lein-cljsbuild documentation is a little week, how do you get it to bundle your external javascript dependencies? |
| 11:15 | matt444 | I'm doing: :libs ["lib/base64.js"] |
| 11:15 | stuartsierra | karls: Protocol methods are real Clojure functions. You can require/refer them just like any other function defined in that namespace. |
| 11:15 | matt444 | and it doesn't work |
| 11:19 | nDuff | matt444: :libs takes a list of directories, not files. |
| 11:19 | karls | aha! that clears things up. thanks `cbp and stuartsierra |
| 11:19 | nDuff | matt444: (at least, as I follow the example docs) |
| 11:19 | nDuff | matt444: ...beyond that, (1) are you sure the 3rd-party library in question survives the Closure Compiler? (2) Is a reproducer available? |
| 11:19 | matt444 | nDuff: are those javascript files or clojurescript? |
| 11:20 | matt444 | nDuff: lein-cljsbuild doesn't complain |
| 11:20 | nDuff | matt444: the former. |
| 11:21 | nDuff | matt444: "doesn't complain" isn't the same as "leaves your code in a runnable state when it's done". |
| 11:21 | matt444 | my code is in a runnable state |
| 11:21 | nDuff | matt444: keep in mind that it's not cljsbuild that does the (potential) mangling here, it's Google Closure. |
| 11:21 | nDuff | matt444: uhh. If your output included a runnable copy of the third-party library in question, you wouldn't be complaining (if I correctly understand the question). |
| 11:22 | matt444 | ahh, misunderstood the question |
| 11:22 | matt444 | No, my output doesn't contain the third-party library |
| 11:22 | nDuff | matt444: Which level of optimization are you using? |
| 11:22 | matt444 | none |
| 11:22 | nDuff | Then I'd need a reproducer to investigate with. |
| 11:23 | matt444 | k |
| 11:23 | nDuff | (someone like dnolen might have an off-the-top-of-their-head answer, but I'm not...) |
| 11:23 | matt444 | nDuff: do you happen to know the diff between :extern and :libs |
| 11:23 | matt444 | :externs i mean |
| 11:23 | nDuff | matt444: :externs takes a set of headers and uses them to avoid name-mangling. |
| 11:23 | nDuff | matt444: it doesn't actually include those libraries into the output |
| 11:24 | nDuff | matt444: it just makes sure your output will be able to successfully call things having those headers. |
| 11:24 | nDuff | matt444: that's actually how I've always done interaction with third-party libraries -- I've never used :libs |
| 11:24 | matt444 | so then how do you include them? |
| 11:24 | nDuff | matt444: ...from the same place I'm including the javascript that cljsbuild emits? |
| 11:25 | matt444 | ok, i don't understand what you mean |
| 11:25 | matt444 | cljsbuild emits javascript that it compiles from clojurescript |
| 11:26 | nDuff | the what and why of :externs is documented at https://developers.google.com/closure/compiler/docs/api-tutorial3#mixed |
| 11:28 | matt444 | ok, I have a example project, where should I upload it? |
| 11:29 | nDuff | matt444: github is always good. refheap, gist, &c. |
| 11:31 | TimMc | hyPiRion: Do you think you can get ahold of eval in swearjurescript? |
| 11:31 | hyPiRion | TimMc: wish I could |
| 11:31 | nDuff | matt444: ...to restate what I was trying to communicate above -- I *don't* directly include external libraries into cljsbuild's output, and don't try to. I pull them into the document or runtime being invoked the same way I'm pulling in cljsbuild's output. |
| 11:31 | TimMc | hyPiRion: I feel like there should be a way to iterate over the properties of something. |
| 11:32 | hyPiRion | TimMc: Only way I've discovered yet is by iterating the metadata of a ns |
| 11:32 | nDuff | matt444: AFAIK, the mechanisms for including raw javascript into cljsbuild's output all require that javascript to be written in such a way as to be compliant with the Closure Compiler's specifications. |
| 11:32 | nDuff | matt444: ...and, well, rather a lot of 3rd-party code isn't. |
| 11:32 | matt444 | nDuff: ok thanks, script tags it is |
| 11:32 | Uruk | Question from a new user - what's the best idiomatic way to loop across/map across a java object array []? I'm looking at the amap docs and that looks right, but not sure what the ^arguments are about. |
| 11:33 | nDuff | matt444: ...if you're going to turn on advanced-mode compilation eventually, you'll need to use :externs. |
| 11:33 | llasram | Uruk: Just use `map` unless you have specific need (known performance issue) |
| 11:33 | matt444 | ok, i will when i get there, thanks again |
| 11:33 | llasram | Uruk: All JVM arrays are `seq`able, so the normal Clojure sequence functions work on them just fine |
| 11:34 | sveri | hi, how would i add n-times the same element to a collection? (defn addXtoXsNTimes [xs x n]... |
| 11:34 | llasram | sveri: (into xs (repeat n x)) ? |
| 11:35 | dnolen | matt444: if you have some random JS that won't play with Google Closure you can use :preamble now |
| 11:36 | sveri | llasram: thx, i try thaqt |
| 11:36 | nDuff | Ooh, nice. |
| 11:37 | matt444 | dnolen: what does preamble do? |
| 11:37 | dnolen | matt444: it just concatenates files to the beginning of the final output |
| 11:37 | matt444 | perfect, thanks |
| 11:38 | TimMc | hyPiRion: To clarify, this also applies to CLJS? |
| 11:38 | hyPiRion | TimMc: oh, that really depends I guess? |
| 11:38 | hyPiRion | You need to be able to use ns-map on namespaces |
| 11:39 | TimMc | I think JS exposes some new things that CLJ doesn't provide, like being able to iterate over the properties of things. |
| 11:39 | dnolen | matt444: CLJS React users share this problem - you might find the dev and prod build settings described here useful http://github.com/swannodette/om |
| 11:40 | matt444 | i'm a cljs react user :) |
| 11:40 | matt444 | thanks |
| 11:41 | hyPiRion | TimMc: hm, interesting |
| 11:42 | hyPiRion | anyway, the way I get eval in clj is by doing something like this |
| 11:42 | hyPiRion | ,(-> #'+ meta (#((`[~@%](*))(*))) ns-map (#((`[~@%](*(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*))(-(*(+(*)(*))(+(*)(*))(+(*)(+(*)(*))))(*))))(*)))) |
| 11:42 | clojurebot | #'clojure.core/eval |
| 11:42 | hyPiRion | it works better in clojure 1.0 because of the meta reader (^), so I only need ns-map by then |
| 11:43 | TimMc | No vars in cljs, I think. |
| 11:43 | hyPiRion | TimMc: right, ns stuff is compile time? Not worked with cljs |
| 11:43 | bbloom | hyPiRion: right |
| 11:43 | TimMc | Neither have I. :-P |
| 11:43 | bbloom | probably can do some hackery with aget and window |
| 11:43 | matt444 | @dnolen using cloact right now but plan on trying om |
| 11:43 | hyPiRion | heh |
| 11:44 | hyPiRion | TimMc: Alright, we have a decent challenge then :p |
| 11:44 | TimMc | I think I can do it all with just "window". |
| 11:45 | dnolen | matt444: nice Cloact looks pretty cool. |
| 11:46 | TimMc | Hmm, maybe not. I can make "eval", but I can't just grab it off of window as easily as I could a map in CLJ. |
| 11:49 | ro_st | cemerick: thanks for all your awesome work on cljsbuild and cljx. can you tell me if it's possible to using both plugins' hooks in a project to get the auto build mode for each of them? or do i have to `lein cljx auto` and `lein cljsbuild auto` separately? |
| 11:50 | ro_st | i'm hoping i can somehow get a repl and both auto modes in a single jvm |
| 11:53 | Uruk | What am I doing wrong here? I have a java array; (alength my-array) returns 28. I'm doing this: (map my-array (defn blah [x] (do-some-stuff-with x))) -- and the inner function blah is not getting called. |
| 11:53 | klrr | are there any intro to clojure for people new to java? |
| 11:54 | ro_st | you need to realise the result; map is lazy. wrap the (map) in (doall) |
| 11:54 | ro_st | also |
| 11:54 | chronno | Uruk: also, defn is intended to be used as a top-level form |
| 11:54 | ro_st | instead of defn, just fn |
| 11:55 | ro_st | defn also places a var in the current ns |
| 11:55 | Uruk | klrr: try this -- http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Clojure_for_Java_Programmers |
| 11:55 | ro_st | so (fn [x]) rather than (defn blah [x]) |
| 11:55 | Uruk | ro_st: so fn is same form as defn, but without method name (anonymous fn)? |
| 11:55 | ro_st | correct |
| 11:55 | Uruk | gotcha. Old hat to the concepts, completly new to clojure syntax |
| 11:55 | ro_st | defn is actuall just sugar around (def blah (fn …)) |
| 11:56 | Uruk | so but the syntax is (map array function) and *NOT* (map function array) correct? |
| 11:56 | ro_st | http://www.braveclojure.com/ http://aphyr.com/tags/Clojure-from-the-ground-up |
| 11:56 | Wild_Cat | just checking, is there a difference between (defn- foo ...) and (defn -foo ...) ? |
| 11:56 | ro_st | that's right Uruk |
| 11:56 | ro_st | Wild_Cat: defn- marks the fn as ^:private metadata |
| 11:56 | ro_st | -foo is just a var name starting with - |
| 11:57 | klrr | so there are no resources for people who want to learn clojure and utiliaze java interop but with no previous java knowledge? |
| 11:57 | ro_st | conventionally used in 'internal' protocols and such |
| 11:57 | Wild_Cat | ro_st: OK, so what's the purpose of the latter? I've seen it a couple times, but can't grasp what it's used for? |
| 11:57 | ro_st | klrr: java interop is pretty minimal. clojure.org/java_interop |
| 11:58 | klrr | do you need to know java in-depth to utiliaze it? |
| 11:58 | ro_st | no java knowledge: there must be loads of info out there :-) it's a fairly popular language |
| 11:58 | ro_st | i'm ok and i've never written any java. lots of other similar things, but not java itself |
| 11:58 | klrr | okey |
| 11:59 | nDuff | Wild_Cat: the cases you've seen it probably have been situations where gen-class is used with its default settings |
| 11:59 | ro_st | pick one of the links above and go through it. you'll learn enough to get moving |
| 11:59 | klrr | do you need to know OOP to utilize it is it just to call functions from java? |
| 11:59 | Wild_Cat | nDuff: probably, yeah |
| 11:59 | nDuff | Wild_Cat: ...where the prefix it's expecting for functions exposed to Java is - |
| 11:59 | ro_st | gotta run |
| 12:00 | Wild_Cat | nDuff: ah, I see. Thanks. |
| 12:00 | Uruk | Clojure java interop -- good documentation: http://clojure.org/java_interop |
| 12:12 | mikerod | Hmm, looks like the latest counter clockwise 0.22.0 stable doesn't upgrade in (my) Eclipse; with error concerning: Missing requirement: Counterclockwise Fragment for Eclipse 4 0.22.0 (ccw.core.e4 0.22.0) requires 'bundle org.eclipse.e4.core.contexts 1.3.1' but it could not be found Cannot satisfy dependency: |
| 12:13 | mikerod | anyone familiar with that one? |
| 12:13 | clgv | mikerod: upgrade worked just fine this morning |
| 12:15 | mikerod | clgv: What Eclipse version? I am dealing with version 4.2.1 here I believe |
| 12:16 | mikerod | I came across a similar error on 0.21.0 @ http://marketplace.eclipse.org/content/error/report/1414545 |
| 12:16 | clgv | from 0.20 |
| 12:17 | clgv | I upgraded on two computers so far with no problems from 0.20.0 |
| 12:20 | mikerod | I'm coming form 0.12.3 stable |
| 12:20 | mikerod | I don't see where this version fits in the pattern |
| 12:20 | clgv | mikerod: oh. maybe thats the reason |
| 12:21 | mikerod | does this need to be deleted perhaps? |
| 12:21 | clgv | clean install, or try to install 0.20.0 before 0.22.0 |
| 12:21 | mikerod | hmm ok |
| 12:21 | mikerod | thanks for advice, I'll try it out |
| 12:21 | clgv | I'd go for "clean eclipse install" |
| 12:21 | clgv | there were changes on the update site which might be the reason for your problem |
| 12:22 | mikerod | ok, that's what I am planning on trying |
| 12:22 | mikerod | I noticed the site seems to have changed |
| 12:22 | clgv | yes indeed |
| 12:23 | clgv | good luck (should work) I gotta go |
| 12:23 | mikerod | cool, thanks |
| 12:25 | zerokarmaleft | what's with the inconsistency URL-parsing between java.sql.DriverManager/getConnection and clojure.java.jdbc/with-connection? |
| 12:28 | zerokarmaleft | seems like I have to dance b/w strings...e.g. "jdbc:postgresql:<subname>" vs "jdbc:postgres://<host>/<subname>" |
| 12:32 | turbopape | Hi guys, |
| 12:33 | turbopape | I have a project that litterally makes heavy use of java interop, |
| 12:33 | turbopape | any bad or good vibes you mind sharing in doing projects that basically are like writing java in clojure ? |
| 12:34 | technomancy | turbopape: if you can isolate all the interop to a handful of namespaces it makes things a lot more tidy |
| 12:34 | technomancy | possibly not always practical, but it's more pleasant |
| 12:35 | turbopape | okay, but can we fairly say, that this is not where clojure shines technomancy ? |
| 12:35 | turbopape | I mean, all of this importing and implicit casting,... |
| 12:36 | turbopape | Do I pay a huge price for that ? |
| 12:36 | technomancy | it's still a hell of a lot nicer than doing it in Java if that's what you mean |
| 12:37 | gfredericks | turbopape: more opportunity for refactoring via macros compared to java |
| 12:37 | turbopape | technomancy I am sure, that's why I don't want to leave Clojure world :) |
| 12:38 | gfredericks | areduce is a good example of using macros to sane-ify low-level things |
| 12:38 | technomancy | I guess the question is whether it's practical to do the bulk of your work in terms of immutable values |
| 12:39 | turbopape | Yes technomancy cc gfredericks . |
| 12:39 | turbopape | It is basically a mahout project |
| 12:39 | turbopape | it uses their arrays, etc... |
| 12:40 | turbopape | And I'm afraid of the shift, so... besides, after googling, you don't see much people do mahout in clojure |
| 12:40 | turbopape | but you find couple using mahout via scala, for instance, |
| 12:40 | turbopape | so that's why I asked ! |
| 12:40 | llasram | turbopape: I'm using it some. Mostly the vector and matrix impl |
| 12:41 | turbopape | llasram and are you okay with the shift code-wise and performance-wise ? |
| 12:41 | llasram | turbopape: I've got a 95% finished core.matrix implementation in terms of Mahout, but honestly mostly am using the Mahout API fairly directly, because startup time for core.matrix is a *beast* |
| 12:42 | llasram | turbopape: Yeah, it isn't too bad. I've got a small wrapper lib for doing a few of the most-common operations w/o hinting and letting you use IFns and Mahout Double/DoubleFunctions |
| 12:43 | llasram | I mostly do mutation w/in `reduce` loops, so I'm getting the benefits of mutable vectors, but the mutation is hidden across interface boundaries |
| 12:43 | turbopape | How heavy java projects compare, say, to scala , llasram ? cc technomancy ? |
| 12:44 | llasram | I'm afraid I don't understand your question :-) |
| 12:44 | technomancy | eh I've never actually written java; no idea |
| 12:44 | rurumate | turbopape: I don't know what mahout does exactly, but I've made friends with cascalog, which is pure clojure |
| 12:45 | rurumate | maybe it's worth a look for you |
| 12:45 | llasram | rurumate: Er. It's built on Cascading, which shows through if you work with it a lot / deeply. For something much closer to "pure Clojure on Hadoop" check out https://github.com/damballa/parkour/ |
| 12:46 | rurumate | hmm that's news |
| 12:46 | turbopape | llasram, technomancy rurumate : it's okay guys :) I need mahout for the machine learning algorithms, hadoop is just a backend there... |
| 12:47 | llasram | turbopape: For that it can vary quite a bit. Some things like the SSVD implementation are pretty flexible -- get your data in the right shape and you can essentially just invoke it |
| 12:47 | rurumate | llasram: methinks it's a "good thing" being based on cascading |
| 12:48 | turbopape | I ask about scala as a fall back option : if it is a better java, and if I unfortunately need to write some raw java, just to benefit from "simpler interop", can something like scala save me ? |
| 12:48 | llasram | turbopape: For the classification and clustering algorithms, you end up needing to descend into a deep morass of partially-documented interfaces |
| 12:48 | turbopape | and can I interop with Clojure ? |
| 12:48 | turbopape | llasram, ok. any pure Clojure options you heard about ? |
| 12:48 | turbopape | for ML ? |
| 12:49 | llasram | rurumate: Depends on what you're doing. If you have a lot of joins, it helps. If not, in my experience it is a liability |
| 12:49 | dnolen | I don't suppose anyone's done a CSS grammar for Instaparse? |
| 12:50 | llasram | turbopape: It really depends on your needs. Weka has reasonable implementations of some algos if your data isn't too large. There's special-purpose libraries for doing SVMs like libsvm. Clojure-specific, I'm not aware of much |
| 12:51 | rurumate | llasram: I do some joins, yes. Have you tried a join in parkour? |
| 12:51 | llasram | But ML algorithms are just algorithms -- rolling your own is always an option |
| 12:52 | turbopape | yeah llasram ... that would also be an option... |
| 12:52 | llasram | rurumate: It depends on the join. Doing a "replicated" join is trivial just by directly loading your replicated data from the distributed cache. Doing a reduce-side join where you know one or both sides will fit in RAM is simple. |
| 12:53 | llasram | Parkour has no direct support for Cascading-style reduce-side joins with arbitrary numbers of records on both sides, but IMHO those are a huge anti-pattern, and you should re-write any job depending on them |
| 12:55 | rurumate | llasram: well in the joins I do, usually both inputs are over 10 GB so would not try to fit any of them in memory / distributed cache |
| 12:55 | rurumate | but access to distibuted cache is a plus for parkour, yes |
| 12:55 | llasram | rurumate: For the reduce-side "fit in RAM" I meant for an individual grouping key |
| 12:56 | rurumate | oh. well then, got any example code? |
| 12:56 | llasram | For joins? Not yet, but I should add one to the Parkour examples |
| 12:56 | riley526 | For somebody familiar with Backbone for typical JS applications, is it worth trying to shoehorn Backbone in to ClojureScript for the REST-y models? Better alternatives? |
| 12:56 | rurumate | yes please |
| 12:57 | rurumate | joins are super useful |
| 12:57 | rurumate | they are what drove me from clojure-hadoop to cascalog |
| 13:03 | bbloom | riley526: i'd definitely not use backbone w/ cljs, since what backbone does is so hilariously simple you can just recreate it yourself in a few dozen lines using our proper immutable data structures |
| 13:03 | dnolen | riley526: there's going to be significant impedance mismatch |
| 13:04 | dnolen | riley526: integration with React and Angular.js seems to involve less friction |
| 13:05 | riley526 | dnolen: I've never used Angular though. You think the data model meshes with cljs? |
| 13:05 | dnolen | riley526: I can't say myself, but people seem to like using it with CLJS |
| 13:05 | katox | I'd recommend to start with something like react ;) |
| 13:06 | riley526 | dnolen: Ok I'll look into it |
| 13:06 | riley526 | bbloom, dnolen: thanks guys |
| 13:06 | riley526 | katox: The question is really about syncing models via REST, which Backbone does and React has nothing to do with. |
| 13:07 | katox | riley526: angular is a mutation in a box, I can't image how to make that simple |
| 13:07 | dnolen | riley526: but routing isn't a particularly complex thing, there's an opportunity to construct something generic here for the ClojureScript community |
| 13:08 | katox | riley526: you need to put everything into angular scope and broadcast + watch everything |
| 13:09 | katox | riley526: the mismatch is right in the core |
| 13:09 | riley526 | katox: yeah I hear you |
| 13:09 | katox | riley526: that doesn't mean that angular isn't _very_ productive in js itself |
| 13:09 | dnolen | riley526: I personally prefer React myself, but I don't know Angular.js well enough to have an informed opinion - from the outside seems overly complex |
| 13:11 | katox | it is complex once you dive into directives |
| 13:12 | katox | I've never wrapped my head around when I'm inside and when I'm outside of angular processing |
| 13:12 | riley526 | dnolen: how do you typically handle syncing data if all you're using is React? or do you even have that need? |
| 13:13 | cespare | Is visualvm the state of the art for clojure profiling? |
| 13:13 | riley526 | I mean I could always right an ajax request for every endpoint |
| 13:13 | riley526 | But that's been solved before for JS. |
| 13:17 | nDuff | cespare: YourKit is also pretty awesome. |
| 13:18 | dnolen | riley526: I would probably write a simple router |
| 13:19 | nDuff | cespare: ...unfortunately, they only occasionally offer personal licenses (at less than full price) -- they had that running for a bit this month, but it looks like the window closed. |
| 13:19 | cespare | nDuff: would it supplant or supplement visualvm? |
| 13:20 | nDuff | ...waitaminute, today's the 13th, so that should still be open. |
| 13:20 | nDuff | cespare: full replacement. |
| 13:20 | cespare | nDuff: s'ok, i'm sure my company will buy it if it's useful |
| 13:21 | Wild_Cat | dakrone: just submitted a clj-http pull request for the {:as :json-strict} we talked about the other day. |
| 13:21 | dakrone | Wild_Cat: great! |
| 13:22 | cespare | nDuff: can it operate from the commandline? Or at least collect a profile that way? Right now I'm using visualvm over ssh -X and it's quite painful |
| 13:22 | Wild_Cat | dakrone: this is my first non-basic-typo pull request to a Clojure project, so be sure to review it thoroughly before merging :p |
| 13:22 | dakrone | Wild_Cat: will do |
| 13:22 | nDuff | cespare: yes, collection can happen via CLI only, or over a socket. |
| 13:22 | nDuff | cespare: ...I'm surprised you can't do that with VisualVM too. |
| 13:24 | cespare | nDuff: alright, thanks for the suggestion. I'll check it out. |
| 13:24 | katox | does anyone know what's the current state of cider regarding cljs? |
| 13:24 | dnolen | katox: seems like people are working on improving it |
| 13:26 | cespare | nDuff: are you aware of a way to generate a blocking profile? |
| 13:26 | cespare | the profilers i've found generate cpu and memory profiles only |
| 13:26 | katox | dnolen: good to hear, what'll be next? code completion or even evals? |
| 13:27 | dnolen | katox: gtrak is working on code completion, evals would be really simple |
| 13:27 | katox | dnolen: awesome! |
| 13:28 | cemerick | katox: evals? Like, a REPL? |
| 13:28 | dnolen | katox: the ClojureScript analyzer exposes a lot of information, cider support could be awesome |
| 13:28 | katox | cemerick: I got REPL working, thank to your austin |
| 13:29 | cemerick | katox: ok, good. What do you mean by 'evals', then? |
| 13:29 | katox | cemerick: buffer-to-repl connection |
| 13:30 | katox | cemerick: I can eval stuff from clj into the repl, not the same from cljs |
| 13:30 | nDuff | cespare: "blocking" meaning lock contention? |
| 13:31 | cespare | nDuff: yes |
| 13:31 | nDuff | cespare: intrinsic locks it handles. Not sure about higher-level primitives. |
| 13:33 | katox | another super cool thing would be inspectable repl results |
| 13:34 | katox | light table has this gratis because of chrome developer tools |
| 13:34 | katox | but I'm on debian so I'll have to wait for 0.6 a bit to try it out |
| 13:36 | cemerick | katox: still not sure what you mean; you should be able to evaluate files, top-levels, and individual expressions directly into ClojureScript from cider |
| 13:36 | cemerick | worksforme, anywa |
| 13:37 | katox | cemerick: ok, then I have my setup broken in some ways |
| 13:37 | cemerick | katox: Either that, or something has changed in cider (I'm still using nrepl.el, and C-M-x and C-c C-k both work well) |
| 13:39 | katox | cemerick: not sure, but cider is trying to send the eval to clj not cljs repl, so it bombs out |
| 13:40 | katox | cemerick: the repl itself is fine though I can get new stuff into it via cljsbuild auto |
| 13:45 | cemerick | katox: yeah, that's broken somehow |
| 13:45 | cemerick | I'll bet cider is wrapping the expressions to be evaluated with its own (Clojure-only) code. Filing a bug would be appropriate. |
| 13:47 | katox | cemerick: yeah, it could be something like that... I need to update to latest cider before filing a bug report though ;) |
| 13:47 | katox | cemerick: did you try with the latest cider or was that a guess? |
| 13:48 | cemerick | katox: total guess; sorry, I (foolishly) assumed you were already running the latest |
| 13:49 | katox | cemerick: I'm running some very recent, but not the very latest |
| 13:57 | cemerick | katox: ok; well, I'll be rebuilding my environment later this month, so cider will be fully cljs / Austin / piggieback-capable one way or the other. :-) |
| 14:06 | katox | cemerick: okay, I updated and it certainly did something |
| 14:07 | katox | cemerick: I got one command through (defn eval) but now I'm looking at frozen emacs ;) |
| 14:07 | katox | cemerick: but at least it can differentiate between clj and cljs buffer |
| 14:10 | loliveira | Can I use http-kit without calling httpkit/run-server? I am using lein ring server-headless to start the server and I believe I can't change it. |
| 14:10 | technomancy | uuuuuuse lein-run with a -maaaaaaaaain |
| 14:12 | shep-werk | technomancy: instructions not clear; stuck in ceiling |
| 14:12 | loliveira | technomancy: I *need* to create a war file. I can't run "lein-run" in our production. =( |
| 14:13 | katox | cemerick: but it seems to be (sort of) working, good, certainly not worse than before |
| 14:13 | technomancy | loliveira: oh, bummer =( |
| 14:14 | loliveira | =( |
| 14:15 | loliveira | technomancy: so.. no http-kit inside a war file? |
| 14:15 | technomancy | sorry, I've never used http-kit or war files |
| 14:17 | wink | WAR! Hoo! What is it good for? YAY! Absolutely.. nothing! |
| 14:17 | katox | dnolen: what's the intent of saving state on every change in wrap-form-element in om? |
| 14:17 | squidz | how can I apply a funciton with variable arguments to a number of vectors and that returns a vector of each corresponding result? Example: (+ args) with [[1 2 3] [1 2 3] [1 2 3]] ===>>> [3 6 9] |
| 14:18 | loliveira | technomancy: thank you. |
| 14:18 | dnolen | katox: our requestAnimationFrame model doesn't play well with form elements, this is just a hack to fix it |
| 14:18 | dnolen | katox: "doesn't play well with *React* form elements" |
| 14:19 | squidz | nvm I found you just pass map to apply as a second argument |
| 14:20 | katox | dnolen: I though that it's there just to force a refresh if there is no change on app-state atom |
| 14:20 | dnolen | katox: no |
| 14:21 | loliveira | wink: We are java software house. They decided that all apps must be delivered as war file. Corp stuff. =/ |
| 14:22 | wink | loliveira: https://www.youtube.com/watch?v=r-bA9FYB8HY#t=0m55s in case oyu missed the joke ;) |
| 14:22 | loliveira | wink: =) |
| 14:22 | tbaldridge | "You-all" |
| 14:25 | loliveira | wink: thank you. I believe the reason for such restriction is that war files are "web scale". =) http://www.youtube.com/watch?v=b2F-DItXtZs |
| 14:25 | wink | lol |
| 14:26 | egghead | lol war file deployments |
| 14:37 | justin_smith | loliveira seems to be gone, but you don't need a war file on production, an uberjar plus java -jar works just fine |
| 14:37 | justin_smith | and yes, lein on production should not be done |
| 14:37 | TimMc | I've got the build gremlins from hell over here. |
| 14:38 | TimMc | When I run against a dependency pulled from a jar repository, I get one behavior, but when I lein install the same git tag I get different behavior. |
| 14:38 | TimMc | I compared the JARs and everything is identical except for some minor stuff in pom.xml and manifest.mf. |
| 14:39 | ipostelnik | can someone explain the difference between (nil?) function and #(= nil %) |
| 14:40 | joegallo | the difference is a few characters of typing |
| 14:40 | Wild_Cat | ipostelnik: they do the same thing |
| 14:40 | Wild_Cat | (nil?) is nicer because it tells whoever's reading your code your intent much more succintly. |
| 14:41 | ipostelnik | (nil?) calls (clojure.lang.Util/identical x nil) |
| 14:41 | TimMc | I've confirmed that I'm not running with lein checkouts, and I'm trying again with a fresh m2 and source checkout -- what else should I check? |
| 14:41 | ipostelnik | and it's 5-7x slower on my machine |
| 14:41 | TimMc | ipostelnik: According to what test? |
| 14:42 | rurumate | not sure if in clojurescript, (= nil (aget x "foo")) (nil? (aget x "foo")) would be the same if x does not have property x |
| 14:42 | rurumate | property foo I mean |
| 14:42 | dobry-den | noHistory is used in datomic for any facts that have no semantic of accreting, right? |
| 14:42 | technomancy | TimMc: slurp the .clj file's resource and diff that |
| 14:42 | ipostelnik | TimMc, according to my unscientific test on my machine |
| 14:42 | TimMc | ipostelnik: Try with criterium |
| 14:42 | gfredericks | I'm trying right now |
| 14:43 | TimMc | technomancy: As in, find a file that *could* have changed and make sure the REPL sees the same thign in both cases? |
| 14:43 | technomancy | right |
| 14:44 | technomancy | if you can isolate it to one ns |
| 14:45 | TimMc | technomancy: I can't, but I'll give it a shot. |
| 14:45 | gfredericks | 3.8 ns for nil? and 5.2 ns for (= nil x) |
| 14:46 | nDuff | hrm. |
| 14:49 | ipostelnik | gfredericks, that makes sense reading the code |
| 14:52 | dnolen | rurumate: the same |
| 14:53 | TimMc | technomancy: I cloned a new repo, I temporarily moved m2, could not reproduce it -- and then I switched everything back and *it is working now*. |
| 14:53 | TimMc | Maybe I should remove [lein-gremlins "0.0.1-SNAPSHOT"] from my profiles.clj. |
| 14:54 | technomancy | yeah that one has a dependency on [lein-hallucinations "LATEST"] which you really don't want |
| 14:55 | TimMc | Note that I didn't even run 'lein clean' at any point in this process. |
| 14:56 | stuartsierra | dobry-den: Not exactly sure what you mean. noHistory is usually for things like counters where you only care about the latest value. |
| 15:10 | ro_st | cemerick: that was me about cljx + cljsbuild on twitter. thanks for the responses. if you don't use lein-cljsbuild, how do you use cljsbuild ? via some nrepl middleware? |
| 15:10 | sw1nn | hi, anyone have opinions about the oldest version of clojure a library could/should legitimately depend on? I'm looking to update clj-aws-s3 and it's currently referencing 1.2.1? One of the deps [clj-time "0.5.0"] depends on 1.5.1 tho. |
| 15:11 | ro_st | austin is great but you don't want to manually evaluate all your code into the browser with it when resuming work on a project |
| 15:11 | ro_st | just curious what your workflow is, because i really don't want to use `lein blah auto` if i can automate things better than that |
| 15:13 | technomancy | sw1nn: 1.2 is old enough that you could see subtle weirdness around dynamic vars that it's probably not worth bothering with; no one's on anything older than 1.3 these days |
| 15:13 | mrhanky | how do i write this in clojurescript? if(self.document === undefined) |
| 15:13 | technomancy | or anyone still on 1.2 is already going to expect nothing to work with their code |
| 15:13 | mrhanky | what's "===" and "undefined" in cljs? |
| 15:14 | sw1nn | technomancy: that was my thoughts, 1.3 + profiles for 1.4 and 1.5. sound right? |
| 15:15 | technomancy | sw1nn: sounds good to me |
| 15:15 | rurumate | mrhanky: I think there's no way to write or obtain undefined |
| 15:15 | cemerick | ro_st: generally only for automated testing, and build prior to deployment; piggieback handles all REPL use cases. |
| 15:15 | noonian | i think nil is equal to undefined in cljs but not sure |
| 15:15 | rurumate | aget will never return undefined, it will convert it to nil for you |
| 15:16 | gfredericks | nil is null I think |
| 15:16 | ro_st | cemerick: just so i'm clear, you start your repl up, start austin up, and then evaluate your top-level cljs ns and that gets everything loaded into the browser |
| 15:16 | bbloom | mrhanky: === is clojure.core/identical? |
| 15:16 | gfredericks | last time I checked which was likea year ago |
| 15:16 | rurumate | (.-x y) is probably the same as (aget x |
| 15:16 | logic_prog | is there a more efficient way of doing (into #{} (filter ... set)) ? |
| 15:16 | mrhanky | i'll try (nil? self/document) |
| 15:16 | bbloom | rurumate: mrhanky: you can get undefined with js/undefined |
| 15:17 | logic_prog | i.e. I want to filter on the set, but right now, it's set -> list -> filter -> list -> set |
| 15:17 | gfredericks | logic_prog: reduce |
| 15:17 | logic_prog | whereas, I'd prefer set -> filter -> set |
| 15:17 | noonian | yeah, but if you have a value returned from some js call that is undefined, i bet (= undefined-obj nil) would return true or (nil? undefined-obj) |
| 15:17 | rurumate | bbloom: oh |
| 15:17 | gfredericks | logic_prog: or apply disj I guess |
| 15:17 | logic_prog | how does reduce help? |
| 15:17 | gfredericks | (apply disj set (remove ... set)) |
| 15:17 | gfredericks | or |
| 15:17 | logic_prog | is this known to be faster |
| 15:17 | logic_prog | or we are premature optimizing ? |
| 15:17 | mrhanky | both are working, (nil? self/document) and (identical? self/document js/undefined) |
| 15:18 | mrhanky | thx |
| 15:18 | gfredericks | logic_prog: it was your question :P I'm sure it's gota be assymptotically faster; dunno about small sets |
| 15:18 | noonian | what is self? |
| 15:18 | bbloom | mrhanky: rurumate: undefined is kinda a leaky interop thing. it gets coerced to nil in many cases |
| 15:18 | gfredericks | logic_prog: well asymptotically better on GC at least |
| 15:18 | mrhanky | noonian, self = this in this case |
| 15:19 | dsrx | does anyone know of any idiomatic-ish cljs bindings for webgl? or if not, is three.js relatively painless to use from cljs? |
| 15:19 | gfredericks | logic_prog: if you want to get really premature, use a transient since disj doesn't do that for you |
| 15:19 | logic_prog | lol |
| 15:19 | logic_prog | screw this |
| 15:20 | logic_prog | let's write jvm bite code |
| 15:20 | logic_prog | and hack fht ejit to make sure this hotpath is optimized for |
| 15:20 | mrhanky | just tried to find out if my code is really running as webworker noonian |
| 15:20 | logic_prog | gfredericks: this was very useful |
| 15:20 | logic_prog | I'm going to stop worrying about this micro optimization until it becomes a bottleneck |
| 15:25 | dsrx | I tell myself that all the time and it never works :) |
| 15:25 | dobry-den | I have a dynamic Compojure app running on Ubuntu/Nginx. What kind of solutions should I start looking at if I want to get a better picture of what's actually going on? For instance, if someone is brute-forcing my /login path, what's the sort of solution people use to visualize that kind of stuff |
| 15:26 | dobry-den | I guess it would start with nginx's access logs |
| 15:26 | gfredericks | logic_prog: I usually spring for things that at least honor how data structures were intended to be used |
| 15:43 | dnolen | dsrx: https://github.com/Asakeron/cljs-webgl ? |
| 15:43 | dnolen | dsrx: Three.js could probably work too. |
| 15:45 | dsrx | oh, as it turns out I had accidentally blocked github.com with the google personal blocklist extension |
| 15:46 | dsrx | dnolen: thanks! |
| 15:50 | piranha | dnolen: I'm a bit confused concerning update!/transact! in om. What's the right way to update nested map? (transact! cursor [:my :path] assoc :q) or (update! cursor assoc-in [:my :path] :q)? I'm just unsure what transact! is. |
| 15:51 | dnolen | piranha: transact! and update! are conceptually the same, just different signature |
| 15:51 | piranha | ok, I was somehow confused by transact's name |
| 15:51 | piranha | so I guess transact is intended to be used here, in other case it just wouldn't exist? :) |
| 15:51 | dnolen | piranha: transact! is conceptually the important one |
| 15:52 | dnolen | piranha: update! is just a sugar for the case where you don't need to provide a path |
| 15:52 | piranha | I see |
| 15:52 | piranha | dnolen: thanks for clarification! |
| 15:52 | dnolen | piranha: transact! name was intended to give a clue, you're changing the global application state, not component local state |
| 15:53 | dnolen | piranha: it's a bit important as the global application state may have changed by the time an event handler fires |
| 15:53 | dnolen | piranha: so in some cases you need to recheck your assumptions |
| 15:54 | piranha | makes sense... |
| 15:56 | sveri | hi, i just had a look at the repeat function in clojure and i dont get how this works, does someone know a blog post or something that explains repeat? why does it call itself? why doesnt it use recur? |
| 15:58 | hyPiRion | sveri: It has to do with laziness. I'll see if I can find a blogpost with the topic |
| 15:58 | nDuff | sveri: look into what lazy-seq does. |
| 15:58 | `cbp | sveri: it doesn't use recur because recur must be in tail position |
| 16:00 | sveri | hyPiRion: that would be nice |
| 16:00 | noonian | basically, you can write recursive functions that return lazy seqs without blowing the stack if you wrap your fn in (lazy-seq ...); it's like magic on crack |
| 16:00 | sveri | noonian: ok, that explains it a little bit |
| 16:06 | gfredericks | sveri: a lot of lazy-seq-producing functions are structured like that |
| 16:06 | hyPiRion | sveri: Yeah, I have some issues finding a good explanation of it, but it's essentially like this: lazy-seq is actually a macro, which makes a LazySeq object containing an anonymous function with the the body. If you try to do recur inside that anonymous function, you won't call the function you intended to cal |
| 16:06 | hyPiRion | *call |
| 16:07 | gfredericks | that's half; the other half is why it doesn't blow the stack when you _don't_ user recur |
| 16:07 | hyPiRion | ,(macroexpand-1 '(lazy-seq (this is my body))) |
| 16:07 | clojurebot | (new clojure.lang.LazySeq (fn* [] (this is my body))) |
| 16:10 | gfredericks | ,(format "foo" 42) |
| 16:10 | clojurebot | "foo" |
| 16:10 | gfredericks | ,(format "foo %s") |
| 16:10 | clojurebot | #<MissingFormatArgumentException java.util.MissingFormatArgumentException: Format specifier 's'> |
| 16:10 | sveri | ok, i think i get it, at least enough to use it |
| 16:10 | sveri | thank you all very much :-) |
| 16:24 | bmath | ,(+ 1 2) |
| 16:24 | clojurebot | 3 |
| 16:25 | bmath | ,"clojurebut does what I probably think it does" |
| 16:25 | clojurebot | "clojurebut does what I probably think it does" |
| 16:32 | matt444 | Does anyone have a minimal http script that just serves static files? |
| 16:33 | matt444 | nm, there's one in the guides |
| 16:33 | technomancy | `python -m SimpleHTTPServer 3991` |
| 16:34 | TimMc | clojurebot: Are you just gonna take that? |
| 16:34 | clojurebot | No entiendo |
| 16:41 | gfredericks | (inc clojurebut) |
| 16:41 | lazybot | ⇒ 1 |
| 16:43 | justin_smith | (inc clojurebutt) |
| 16:43 | lazybot | ⇒ 1 |
| 16:43 | gfredericks | but...could we do it with 3 t's??? |
| 16:43 | lazybot | gfredericks: Yes, 100% for sure. |
| 16:43 | gfredericks | lazybot: I'm sure you're enjoying this game |
| 16:44 | justin_smith | *lazybutt |
| 17:04 | bitemyapp | akurilin: http://www.meetup.com/SF-Types-Theorems-and-Programming-Languages/events/155960462/ |
| 17:04 | bitemyapp | justin_smith: excellent name. |
| 17:05 | slpsys | china basin? too far |
| 17:06 | bitemyapp | slpsys: that isn't China Basin. |
| 17:06 | bitemyapp | slpsys: it's SOMA |
| 17:07 | slpsys | is china basin just across the channel? i've actually been unclear on that |
| 17:07 | bitemyapp | slpsys: yes. |
| 17:07 | bitemyapp | slpsys: 164 Townsend is solidly in SOMA. |
| 17:08 | bitemyapp | slpsys: having checked the map, all but the NE tip of townsend is in SOMA. |
| 17:08 | bitemyapp | slpsys: how long have you lived here? |
| 17:09 | slpsys | haha. five years, but i've only worked in the city for about 7 months, and i didn't really think about what to call that neighborhood when i was living in the city |
| 17:27 | Node_347 | Would someone with experience in Ragtime and Korma mind taking a look at this gist to see if I'm performing migrations correctly? https://gist.github.com/arlandism/8408370 |
| 17:28 | mrhanky | anybody here used servant library? |
| 17:30 | bitemyapp | Node_347: tried it with something that isn't h2? |
| 17:33 | Node_347 | <bitemyapp> No, I haven't |
| 17:34 | daydreamt | Damn you encog. |
| 17:35 | daydreamt | Is anyone using neural networks in clojure? |
| 17:35 | bitemyapp | Node_347: well. |
| 17:36 | mrhanky | (:require [foo.bar :as bar] [foo.baz :as baz] [foo.bat :as bat]) |
| 17:37 | mrhanky | how do i write this shorter? something like [foo [bar :as bar] [baz :as baz] [bat :as bat]] ? |
| 17:38 | justin_smith | that is valid, but not many people use that syntax |
| 17:38 | bitemyapp | Node_347: that's cool, I can tell you the same thing on the mailing list. |
| 17:38 | bitemyapp | Node_347: if you check the mailing list, you'll see I've suggested you try using something other than H2 to see if there's still a repro. |
| 17:38 | stuartsierra | mrhanky: That feature exists as "prefix lists" — see the docs for `require` — but I find it hard to read and grep for. |
| 17:39 | mrhanky | good point with grep stuartsierra |
| 17:40 | Node_347 | bitemyapp: Thanks! |
| 17:40 | rasmusto | wtb gsexpp |
| 17:42 | AWizzArd | daydreamt: yes, I do. |
| 17:42 | technomancy | mrhanky: check out slamhound for stuff like that |
| 17:43 | daydreamt | What libraries do you use AWizzArd? Everything I looked at, I looked at pybrain, then I looked back, then I cried. |
| 17:43 | AWizzArd | daydreamt: same here, so I implemented it myself :-) |
| 17:43 | AWizzArd | I have implemented an MLP and an RBM in Clojure which runs on nvidia’s CUDA. |
| 17:44 | ruzu | what about NFL or NBA |
| 17:44 | daydreamt | AWizzArd how easy would it to extend it to create arbitrary structures? |
| 17:44 | daydreamt | I wanted to do RNNs. |
| 17:45 | daydreamt | AWizzArd is it opensource? |
| 17:45 | AWizzArd | Well, probably this year I will add an LSTM. |
| 17:45 | AWizzArd | Not yet open, but not much speak against opening it. |
| 17:45 | rasmusto | CUDA MLP, RBM w/ LSTM? |
| 17:46 | rasmusto | wikipedia disambiguation isn't helping me much :< |
| 17:46 | daydreamt | rasmusto they are types of neural networks |
| 17:46 | AWizzArd | rasmusto: cuda means it runs my code on the gpu. An MLP is a Multilayer Perceptron network, and an RBM is a restricted Boltzmann machine. |
| 17:46 | technomancy | you get more ROI with an NIH TLA tohugh |
| 17:46 | rasmusto | gotcha, didn't realize this was part of the neural network convo still :D |
| 17:47 | AWizzArd | daydreamt: which rnn are you interested in? |
| 17:47 | rasmusto | I tried to do a game of life on cuda once, with limited success |
| 17:47 | AWizzArd | And how you train it? :-) |
| 17:48 | bitemyapp | I don't think clj would be my first pick for CUDA stuff. |
| 17:48 | daydreamt | AWizzArd, probably backprop |
| 17:49 | daydreamt | AWizzArd, not sure about the structure. That's why I wanted the library to be extendable |
| 17:49 | bmath | PCMCIA |
| 17:49 | AWizzArd | Well, total flexibility doesn't mix with gpus. |
| 17:49 | ruzu | MLB |
| 17:49 | AWizzArd | For example, all neurons use the same propagation function, which is just the weighted sum for example. |
| 17:50 | AWizzArd | This way everything can be expressed in Matrix operations and run on the GPU with massive speed. |
| 17:50 | daydreamt | The fewer types of operations the better? |
| 17:50 | AWizzArd | It can be many operations, but in principle every neuron needs to be treated in the same way. |
| 17:51 | AWizzArd | In our brains each neuron has its own propagation and activation function. |
| 17:51 | AWizzArd | But that beast also has a hundred billion processors <3 |
| 17:51 | AWizzArd | vs 2k on gpu ;-) |
| 17:51 | TimMc | brb, mining bitcoin on brains |
| 17:51 | AWizzArd | haha |
| 17:52 | rasmusto | yeah, lots of neurons are wasted thinking about lunch in a real human brain, its not apples to apples |
| 17:52 | daydreamt | TimMc: whose brains? |
| 17:52 | daydreamt | TimMC: You just opened the door to a very dystopian future |
| 17:52 | jjido | TimMc: always the pragmatic :) |
| 17:52 | AWizzArd | daydreamt: do you think backprop would work on RNNs? |
| 17:53 | ruzu | won't be long before the nsa will require access to all of humanity's brains "because terrorism" |
| 17:53 | AWizzArd | ruzu: you are aware that your words were logged, yes? |
| 17:53 | bitemyapp | TimMc: Da Matrix. |
| 17:54 | daydreamt | AWizzArd, I'm just getting into RNNs, but the paper I read, I could swear they used some form of backprop. |
| 17:54 | ruzu | should i be concerned? |
| 17:55 | AWizzArd | Well, it’s planned to have such. I have one candidate that seems it can be trained. |
| 17:55 | AWizzArd | daydreamt: read Kurzweil’s book “How to create a mind”. |
| 17:56 | bitemyapp | people take Kurzweil seriously? |
| 17:56 | AWizzArd | This book is actually pretty good. |
| 17:56 | bitemyapp | that's like asking a scientologist for advice on your psych medication. |
| 17:56 | ruzu | i'm notifying the scientology administration of your slander. |
| 17:57 | daydreamt | AWizzArd: they do use backprop. "Backpropagation through time" or something like that |
| 17:57 | bitemyapp | ruzu: spookay. |
| 17:57 | logic_prog | what is the clojure.core.async stance on ">!" can't be used across functions (i.e. has to be within a lexical async/go block) ? Is the stance: (1) this is the way we like it and it will always be this way , (2) this is due to sucikness of the JVM and we will fix it , or (3) none of the above ? |
| 17:58 | AWizzArd | bitemyapp: just have a look at what guys wrote reviews to his book. Some top brain researchers. And even more important: I say it’s good \o/ |
| 17:59 | bitemyapp | AWizzArd: well, if you cherry-pick the right subset, you can find climatologists that deny global warming too |
| 17:59 | bitemyapp | AWizzArd: I used to work alongside and live with a neuroscientist, we're a long ways away but making steady progress. Kurzweil is not the person you want status updates from, he's an enthusiast, not an authority. |
| 18:00 | AWizzArd | This however is his bestest book. |
| 18:00 | AWizzArd | Nothing new for a neuroscientist though. |
| 18:00 | bitemyapp | AWizzArd: I liked L Ron Hubbard's Battlefield Earth the most, out of them all. |
| 18:00 | bitemyapp | you all should definitely read that one, since it was his bestest book. |
| 18:03 | bitemyapp | Always nice to see my beautiful compact little handler code get destroyed and sullied by the arrival of reality. |
| 18:03 | dnolen | logic_prog: shallow yield is a good solution that sits well with Clojure, any more requires far, far more compiler support |
| 18:03 | dnolen | "well with Clojure's compilation model" |
| 18:04 | logic_prog | dnolen: https://www.google.com/#q=clojure+shallow+yield is not very useful |
| 18:04 | logic_prog | dnolen: can you point me at api docs to read ? |
| 18:04 | dnolen | logic_prog: http://www.cs.indiana.edu/~sabry/papers/yield.pdf |
| 18:05 | turbofail | if you want to get around that you'll need delimited continuation support |
| 18:05 | logic_prog | dnolen: does this mean "use https://github.com/swannodette/delimc " or is there another library you have in mind? |
| 18:05 | dnolen | logic_prog: no |
| 18:06 | dnolen | logic_prog: core.async gives you a weaker form of delimited continuations that's good enough for most problems w/o complicating the compilation model |
| 18:06 | logic_prog | dnolen: let me rephase my question. how do I use shallow yield in clojure? what are good examples of shallow yifled in clojure? |
| 18:06 | dnolen | logic_prog: core.async gives you shallow yield |
| 18:06 | logic_prog | err, so the ansewr is "shallow yifled does NOT provide what was asked" but is the best clojure does ? |
| 18:07 | logic_prog | it's infuriating :-) that I can't put >! in functions unless I wrap them in go blocks .... |
| 18:07 | logic_prog | go blocks encourage me to write giant functions, whereas for all these years, I've been trying to get better at writing smaller, composable functions |
| 18:07 | dnolen | logic_prog: you break things about into smaller go blocks |
| 18:08 | dnolen | s/about/apart |
| 18:08 | noonian__ | logic_prog: can't you just call >! on a channel in the go block and return the value on a new channel then return the channel? |
| 18:09 | logic_prog | yeah, but then I end up putting <! everywhere |
| 18:09 | logic_prog | basically I have to sprinkled <! all over the palces, becuase functions on longer return values, but instead, return go channels that I have to read from |
| 18:10 | jjido | logic_prog: sounds like continuations |
| 18:10 | logic_prog | dnolen: what is the best continuations library for clojure right now? |
| 18:10 | dnolen | logic_prog: core.async |
| 18:10 | logic_prog | lol |
| 18:11 | bitemyapp | logic_prog: call/cc was a bad idea anyway. |
| 18:11 | dnolen | logic_prog: it sounds like you need to think about your problem domain more, or organize things at level higher then the abstraction core.async gives you out of the box. |
| 18:11 | jjido | bitemyapp: agreed |
| 18:11 | powrtoc | dnolen: does anyone know how core.logic LCons works? I know it implements cons from scheme, but how does it work? |
| 18:11 | turbofail | you wouldn't need full call/cc to provide a better yield, in fact it'd be easier to implement it using delimited continuations |
| 18:11 | dnolen | powrtoc: the implementation is not that long :) |
| 18:12 | bitemyapp | logic_prog: there are better, less opaque, more reliable abstractions that can be composed in programs. Functions. |
| 18:12 | turbofail | that said, supporting even delimited continuations would be difficult |
| 18:12 | ruzu | anyone happen to have read Clojure Data Analysis Cookbook, and have an opinion on it? |
| 18:12 | jjido | turbofail: the trampoline works fine. |
| 18:12 | bitemyapp | arrdem: god fucking dammit I was typing it |
| 18:12 | powrtoc | dnolen: yes I've looked at it :-) I guess the likes of cache are confusing me... |
| 18:12 | turbofail | jjido: sure but you'd have to recompile all of clojure's standard library in that style |
| 18:12 | technomancy | arrdem: you jinxed it |
| 18:13 | bitemyapp | I was going to say, a better abstraction is continuations from monads. Like: http://hackage.haskell.org/package/mtl-1.1.0.2/docs/Control-Monad-Cont.html |
| 18:13 | turbofail | and you pay a performance cost for all code even if you only use delimitd continuations in a small portion |
| 18:13 | bitemyapp | Not least bececause it doesn't need to be reified to the compiler. |
| 18:13 | jjido | turbofail: it's slow yes |
| 18:13 | bitemyapp | But also because it's fairly simple to understand algebraically. |
| 18:13 | dnolen | powrtoc: cache is just to cache hashCode |
| 18:14 | dnolen | turbofail: jjido: and eventually you realize that core.async is an acceptable performant tradeoff |
| 18:14 | powrtoc | ahh so that's why it's mutable |
| 18:14 | bitemyapp | having dnolen ignore me is proving advantageous so far. |
| 18:14 | dnolen | Erik Meijer said so, so it must be true :) |
| 18:14 | bitemyapp | I can teach without being interrupted, except by arrdem. |
| 18:14 | bitemyapp | Erik Meijer is an apostate. |
| 18:14 | turbofail | anyway many other languages have decided that a shallow-yield is good enough, and i agree for the most part |
| 18:15 | jjido | bitemyapp: away with monads |
| 18:15 | bitemyapp | jjido: no |
| 18:15 | jjido | waah |
| 18:15 | technomancy | there we go |
| 18:16 | bitemyapp | Using monads to teach a concept doesn't fall under convincing others to use Haskell, they're the just the only ones with documentation for things like Cont. |
| 18:16 | bitemyapp | not my fault >:) |
| 18:17 | technomancy | just saying; got my eye on you |
| 18:18 | bitemyapp | technomancy: you use monads too. Async. :P |
| 18:19 | technomancy | I was kind of amazed that when they introduced it, they were like "(by the way, this is technically called a monad, but you don't have to care about that right now)" |
| 18:19 | technomancy | I have never heard anyone introduce monads in a way that wasn't shouting from the rooftops about how amazing they are; it was quite unexpected. |
| 18:19 | technomancy | (in the ocaml book) |
| 18:20 | jjido | technomancy: nice closure |
| 18:20 | bitemyapp | technomancy: it's not as much about amazingness as that they're the natural next-step from the relatively trivial HOFs Clojure leverages. |
| 18:21 | bitemyapp | you could hold your nose and pretend protocols were typeclasses to accomplish the same in Clojure. |
| 18:21 | bitemyapp | not that you'd enjoy it. |
| 18:21 | bitemyapp | ie, Fluokitten. |
| 18:23 | bitemyapp | technomancy: you can do monads in OCaml but I haven't seen anybody mix different kinds of monads in a single function. |
| 18:23 | bitemyapp | technomancy: I'm actually headed to a type theory meetup tonight where at least one or two people that worked at Jane Street will be present, I'll ask them about it. |
| 18:24 | technomancy | bitemyapp: mostly talking about people who blog about "I finally understand monads and now you can too" |
| 18:24 | bitemyapp | technomancy: every single one of those blogs I've seen have been unconscionably horrible. |
| 18:24 | technomancy | followed by incomprehensible rambling, right |
| 18:24 | jjido | Jane Street? |
| 18:24 | bitemyapp | Monads are too generic to be explained like that. It's better to move into practical implementation and the algebra directly. |
| 18:24 | technomancy | jjido: Jane Street Async, yeah |
| 18:24 | bitemyapp | jjido: Minsky's crew. |
| 18:25 | technomancy | "We don't have concurrency, but through the Power of Monads we can fake it!" |
| 18:25 | bitemyapp | that's pretty much it right there. |
| 18:25 | bitemyapp | technomancy: functional inversion of control goes a long way :) |
| 18:26 | technomancy | it's much nicer than any other callback system in single-threaded runtimes I've used |
| 18:26 | mrhanky | are there any additional steps when installing jayq? i get this: Uncaught ReferenceError: jQuery is not defined |
| 18:26 | powrtoc | Wow core.logic has a datomic dependency? What's that for? |
| 18:27 | bitemyapp | technomancy: I'd tend to agree. I'd still rather have 1:1 and N:M threading though. |
| 18:27 | bitemyapp | powrtoc: datalog? |
| 18:28 | powrtoc | bitemyapp: Why would core.logic need that? |
| 18:28 | arrdem | technomancy: the main reason that I lurk here isn't that I like clojure, it's that bitemyapp is an unending font of cheap shot targets |
| 18:28 | arrdem | technomancy: the clojure is an added benifit |
| 18:28 | akurilin | bitemyapp: cool. I'm afraid I can't go tonight, demo day tomorrow, gotta wake up at 5 :| |
| 18:29 | akurilin | bitemyapp: Btw I'd love to know more about the ACL library/pattern you mentioned on the mailing list. |
| 18:29 | technomancy | arrdem: yah, I haven't written clojure in months |
| 18:29 | akurilin | bitemyapp: Is there anywhere I could read up more about on it? |
| 18:29 | technomancy | I'm here for the lulz |
| 18:30 | arrdem | technomancy: can't blame you. this is a really sharp croud :D |
| 18:32 | dnolen | powrtoc: it doesn't have a datomic dep |
| 18:35 | powrtoc | dnolen: on master datomic-free is listed as a dependency in project.clj... just wondering why... am I right in thinking datomic.clj extends core.logic unification etc... to datomic types? |
| 18:35 | dnolen | powrtoc: "provided" |
| 18:35 | dnolen | powrtoc: there's no hard dependency on datomic at all |
| 18:36 | dnolen | powrtoc: the datomic namespace won't even compile if datomic isn't on your classpath |
| 18:36 | dnolen | powrtoc: yes, it just an experimental namespace, Datomic still doesn't provide the right hooks for it to work |
| 18:36 | powrtoc | dnolen: ah cool... I think leiningen has moved on a bit since I last did Clojure in anger... |
| 18:36 | powrtoc | dnolen: interesting... |
| 18:41 | powrtoc | dnolen: is the nominal logic and finite domain stuff complete these days? |
| 18:42 | dnolen | powrtoc: more or less, there's more work to do w/ finite domain w/ respect to perf |
| 18:43 | powrtoc | dnolen: cool |
| 18:44 | technomancy | powrtoc: Central won't accept poms with dependencies on non-OSS code |
| 18:44 | technomancy | unfortunately clojars is not as careful about that =\ |
| 18:44 | powrtoc | technomancy: ahh |
| 18:44 | bitemyapp | technomancy: proper way to interact with a jar from Clojure code is lib/ right? |
| 18:44 | bitemyapp | confirming for a coworker that apparently needs to fiddle with some NLP whatevers. |
| 18:44 | technomancy | bitemyapp: proper way to interact with a jar is from a repository |
| 18:45 | bitemyapp | technomancy: is lein-localrepo a good idea? We don't have our own maven repo. |
| 18:45 | technomancy | if it's just for local exploration you can use lein deploy to get a jar into ~/.m2 for your own machine |
| 18:45 | technomancy | otherwise all it takes is a directory served over HTTP |
| 18:46 | bitemyapp | technomancy: it's a flat standalone jar provided by a third party. |
| 18:47 | bitemyapp | technomancy: thanks! |
| 18:48 | technomancy | you can tell your co-worker it is totally OK to yell at anyone who thinks it's reasonable to distribute a jar that's not in a repository in 2014 |
| 18:48 | technomancy | tell them technomancy sent you |
| 18:48 | matt444 | I'm following the ClojureScript getting started guide and when I attempt to compile I get this: http://pastebin.com/guqrk4Ue |
| 18:48 | technomancy | I mean if you're getting this from a 3rd-party |
| 18:48 | bitemyapp | technomancy: I did, actually. I said who you were in the email :) |
| 18:48 | technomancy | nice |
| 18:50 | powrtoc | Is alphaKanren described at all in reasoned schemer? |
| 18:50 | powrtoc | or is it only in the alpha kanren paper? |
| 18:51 | matt444 | following these steps: https://gist.github.com/ninjudd/1098120 |
| 18:51 | matt444 | java 1.6.0_65 |
| 18:52 | noonian__ | matt444: what version of cljs are you trying to compile? |
| 18:53 | matt444 | version of cljs? |
| 18:53 | matt444 | i'm not compiling cljs |
| 18:53 | matt444 | i'm compiling a .cljs file |
| 18:53 | matt444 | https://github.com/clojure/clojurescript |
| 18:53 | matt444 | master |
| 18:54 | noonian__ | matt444: ah, from your gist you are using the cljs compiler directly and i've never tried that |
| 18:54 | matt444 | then how do you compile? |
| 18:55 | noonian__ | matt444: most people use the leiningen plugin lein-cljsbuild to compile cljs in a leiningen project |
| 18:55 | matt444 | yes, i use that |
| 18:55 | matt444 | but i have client side and node |
| 18:55 | matt444 | so I use lein-cljsbuild for client side |
| 18:55 | noonian__ | you can use it for both |
| 18:56 | matt444 | hm, example project.clj? |
| 18:57 | matt444 | just have a second :build |
| 18:57 | matt444 | ? |
| 18:58 | matt444 | so how do you arrange your folder? |
| 18:58 | matt444 | my client stuff is in src/ |
| 18:58 | noonian__ | yeah, second build |
| 18:58 | noonian__ | something like this: https://www.refheap.com/23531 |
| 18:58 | bitemyapp | "actual: java.lang.ClassCastException: datomic.db.Datum cannot be cast to clojure.lang.Associative" dATOMIC rage. |
| 18:58 | noonian__ | just arrange your src directories accordingly |
| 18:59 | matt444 | so if I move my files in src/ it's still going to be able to find the references? |
| 18:59 | matt444 | where does your package.json go? |
| 18:59 | matt444 | src/cljs/node ? |
| 19:00 | noonian__ | i'm not sure what that is, i haven't really used node |
| 19:00 | noonian__ | if you want to share code then you should have 2 src-paths for each cljsbuild build where one is shared between the builds |
| 19:00 | bitemyapp | "java.lang.IllegalArgumentException: Don't know how to create ISeq from: datomic.db.Datum" I am going to kill something. |
| 19:00 | matt444 | i don't want to share code |
| 19:01 | arrdem | bitemyapp: core.typed talk in an hour.. let you know how it goes. |
| 19:01 | noonian__ | i mean, share code between both your builds, like share a common set of cljs utilities for instance |
| 19:02 | matt444 | yeah, i don't need that |
| 19:02 | bitemyapp | arrdem: I am atomic-raging at some type error / stupid data-type stuff in Datomic, let you know how many bodies I have to dispose of later. |
| 19:02 | bitemyapp | arrdem: type theory meetup in ~3 hours. |
| 19:02 | matt444 | that example doesn't have a output-dir |
| 19:02 | matt444 | how do i handle that? |
| 19:03 | noonian__ | :output-to "some/path/for/node/node-cljs.js" |
| 19:03 | noonian__ | will stick your compiled js wherever you specify |
| 19:04 | matt444 | yes, but there is also a :output-dir |
| 19:06 | noonian__ | just make it different for each build |
| 19:06 | matt444 | I don't think that project.clj is right, it doesn't have :target :nodejs |
| 19:06 | noonian__ | https://www.refheap.com/23532 |
| 19:07 | noonian__ | yeah, i don't know about any node specific settings |
| 19:09 | bitemyapp | (bean dat) |
| 19:09 | bitemyapp | ClassCastException java.util.Date cannot be cast to java.lang.Number datomic.db.Datum (db.clj:219) |
| 19:09 | bitemyapp | breathe. Breathe Chris. Find your center. |
| 19:11 | mrhanky | why does jayq.core gives me this: Uncaught ReferenceError: jQuery is not defined |
| 19:11 | mrhanky | :/ |
| 19:11 | bitemyapp | the answer for the Daily Double was: (let [{:keys [e a v tx]} dat] (into {} [[:e e] [:a a] [:v v] [:tx tx]])) |
| 19:12 | noonian__ | mrhanky: you probably need to include jquery in your page first |
| 19:12 | mrhanky | i have, i tried 2.x and now 1.9.x |
| 19:13 | ivan | is jQuery defined in the console? |
| 19:13 | mrhanky | yes |
| 19:14 | Bronsa | bitemyapp: wouldn't (select-keys dat [:e :a :v :tx]) do? |
| 19:14 | matt444 | I've had so many problems with lein-cljsbuild |
| 19:14 | ivan | mrhanky: are you using some Google API loader that will asynchronously load jQuery after your other JS runs? |
| 19:15 | matt444 | Does anyone know where, with lein-cljsbuild I should put :target :nodejs |
| 19:15 | noonian__ | stick it inside the :compiler map of each build |
| 19:15 | bitemyapp | Bronsa: lets find out! |
| 19:16 | bitemyapp | Bronsa: berossus.api-test> (select-keys dat [:e :a :v :tx]) |
| 19:16 | bitemyapp | ClassCastException datomic.db.Datum cannot be cast to java.util.Map clojure.lang.RT.find (RT.java:733) |
| 19:16 | bitemyapp | Bronsa: no dice grandma. |
| 19:16 | matt444 | noonian__ thanks for your patient help, i'll pastebin my config |
| 19:16 | technomancy | bitemyapp: man; things that aren't maps |
| 19:16 | bitemyapp | Bronsa: confer with my previous angry messages to see why that didn't work. |
| 19:16 | matt444 | noonian__: https://www.refheap.com/23536 |
| 19:17 | bitemyapp | technomancy: I was spittin' mad but my tests are passing now so just this once: http://i.imgur.com/J9NLYcI.gif |
| 19:17 | noonian__ | matt444: np, here a blog post for nodejs setup with an example config that shows the compiler option: http://dannysu.com/2013/01/14/clojurescript-for-nodejs/ |
| 19:17 | noonian__ | matt444: looks good to me hehe |
| 19:17 | technomancy | nice |
| 19:17 | matt444 | hm |
| 19:17 | matt444 | Why do they do :optimizations :advanced for node? |
| 19:18 | matt444 | there's no reason to do that |
| 19:18 | noonian__ | it will make your code compile down much smaller |
| 19:18 | matt444 | code size doesn't matter in node |
| 19:18 | matt444 | it's not going over the wire |
| 19:18 | mrhanky | ivan, seems like codemirror produces this ._. |
| 19:18 | matt444 | is :builds a vector or a map? I've seen both |
| 19:19 | matt444 | mine is currently a map |
| 19:19 | matt444 | it seems that almost no one is using clojurescript with Node |
| 19:19 | noonian__ | i've seen both also, mine's a map |
| 19:20 | matt444 | The word node only appears twice in lein-cljsbuild's project, both issues |
| 19:21 | noonian__ | i've seen a few posts on people doing it but mainly for fun |
| 19:22 | `cbp | lol @ those tweets |
| 19:22 | matt444 | thanks for your help, i'll log an issue |
| 19:23 | bitemyapp | `cbp: I'm glad you enjoy my tweets of sorrow. |
| 19:25 | mrhanky | ivan, i hade cljs code using (set! (.-onload js/window) (fn [] ...)), switched to jqueries ready |
| 19:25 | mrhanky | solved it |
| 19:26 | Bronsa | bitemyapp: ouch, that sucks. what's wrong with {:e e :a a :v v :tx tx} anyway? |
| 19:27 | bitemyapp | Bronsa: it's absurdly tedious. I shouldn't have to create maps by specifying each attr/value pair and destructuring accordingly. |
| 19:27 | bitemyapp | Bronsa: datoms are printed as if they're maps, they should behave like ACTUAL maps. |
| 19:27 | bitemyapp | there is no reason at all for them to do otherwise except for projected Hickeysian torment. |
| 19:28 | bitemyapp | the pedantry in pretending they're not maps is doubly pointless in an untyped language where there's no real safety to be had anyway. |
| 19:28 | bitemyapp | if you're in the mud already, play fuckin' ball. |
| 19:29 | technomancy | bitemyapp: but inheritance is bad always |
| 19:31 | bitemyapp | I'm anticipating my next resolved ticket to involve some (= (class ...) blah.WhoCares) |
| 19:31 | bitemyapp | kill for a pattern match. |
| 19:33 | technomancy | I don't understand why every clojure codebase out there isn't using core.match now that the AOT bugs are gone |
| 19:33 | technomancy | is it still in the middle of a rewrite? |
| 19:34 | technomancy | not having pattern matching is pretty terrible |
| 19:34 | bitemyapp | I gave up on it after having it breaking my code multiple times at different points in time. |
| 19:34 | bitemyapp | break* |
| 19:34 | bitemyapp | similarly to how I stopped bothering with c.j.j after the massacre of 0.3.x |
| 19:34 | `cbp | rip |
| 19:35 | bitemyapp | (inc `cbp) |
| 19:35 | lazybot | ⇒ 2 |
| 19:35 | bitemyapp | (inc cbp) |
| 19:35 | lazybot | ⇒ 1 |
| 19:35 | bitemyapp | for good measure. |
| 19:35 | `cbp | :p |
| 19:42 | scape | bitemyapp: cjj? |
| 19:42 | rasmusto | java jdbc I assume |
| 19:42 | coventry` | Is this really the cleanest way to prepare a jar for submission to a storm cluster? https://github.com/nathanmarz/storm-starter/issues/51 |
| 19:44 | bitemyapp | I write some really dense test code. |
| 19:45 | Wild_Cat | quick question: What's the accepted way in a Clojure test to check that some returned value is a specific vector (and specifically *not* the equivalent list)? |
| 19:45 | bitemyapp | Wild_Cat: vector? |
| 19:45 | bitemyapp | Wild_Cat: =? |
| 19:45 | Wild_Cat | bitemyapp: I want the test to pass when the returned value is ["foo" "bar"] but not when it's '("foo" "bar") |
| 19:45 | bitemyapp | ,(= [0 1 2] '(0 1 2)) |
| 19:45 | clojurebot | true |
| 19:45 | bitemyapp | well that's fucking stupid. |
| 19:45 | Wild_Cat | yup, that's the issue :p |
| 19:46 | bitemyapp | :| |
| 19:46 | bitemyapp | Wild_Cat: (and (= ...) (vector? ...)) |
| 19:46 | Wild_Cat | right now I'm checking (= (type ret) clojure.lang.PersistentVector) but that's horrible |
| 19:46 | hyPiRion | ^ |
| 19:46 | bitemyapp | Wild_Cat: dude no. use vector? |
| 19:46 | Wild_Cat | oh, I didn't know that function existed. Thanks. |
| 19:47 | scape | :) |
| 19:47 | noonian__ | Wild_Cat: (and (vector? ret) (= ret v)) |
| 19:47 | bitemyapp | scape: I'm still scowling at the badness of that equality. |
| 19:47 | Cr8 | ,(map vector? [1 [] '() {} #{}]) |
| 19:47 | clojurebot | (false true false false false) |
| 19:47 | bitemyapp | Cr8: good paranoia. |
| 19:47 | bitemyapp | lol. |
| 19:47 | hyPiRion | or eventually (identical? x coll) if you know that a specific vector will be returned |
| 19:47 | bitemyapp | That makes = untrustworthy because vector is associative and '() is not. |
| 19:48 | Wild_Cat | hyPiRion: oh! Even easier. Thanks. |
| 19:48 | noonian__ | most of the ops you do on vectors return lazy seqs though so you want that equality |
| 19:48 | bitemyapp | so we still haven't learned anything from the egal paper. Sweet. |
| 19:48 | bitemyapp | noonian__: it's not really about that. |
| 19:48 | Cr8 | = "do these things have similar insides" |
| 19:48 | bitemyapp | Cr8: sounds like JavaScript's == to me. |
| 19:49 | bitemyapp | Cr8: are you coming to the type theory meetup |
| 19:49 | bitemyapp | SegFaultAX: ^^ |
| 19:49 | Wild_Cat | ,(= '(0 1 2) [0 1 2]) |
| 19:49 | clojurebot | true |
| 19:49 | Wild_Cat | (phew, thankfully that's commutative :p ) |
| 19:50 | Cr8 | Cr8: prolly not, I didn't sleep much |
| 19:50 | bitemyapp | commutatively...wrong. |
| 19:50 | bitemyapp | Cr8: be a man. Do the right thing. |
| 19:50 | technomancy | bitemyapp: it's a bit weird, but I can understand the stance that laziness would be unbearably tedious without that quirk |
| 19:50 | TEttinger | ok uh... my clojure game is really fast when run with lein, which defaults to a server JVM (an example command that does the same thing: java -server -jar myGame.jar). it's also really fast if I have a JDK installed and used for the java command. but... the java that is installed by default for users is the client vm, which seems at least 3x slower |
| 19:50 | technomancy | but it's definitely not egal |
| 19:50 | bitemyapp | technomancy: Right. |
| 19:50 | Wild_Cat | bitemyapp: yeah, sure, that sucks, but it's still better than it not being commutative or transitive |
| 19:50 | bitemyapp | technomancy: if the lazy semantics were universal instead of ghettoized in a coll it wouldn't be necessary to fuck up the equality. |
| 19:51 | Wild_Cat | (not that I'm implying that Clojure is influenced by PHP or anything :p ) |
| 19:51 | bitemyapp | technomancy: one wrong decision causes another... |
| 19:51 | bitemyapp | Wild_Cat: well they're both untyped. |
| 19:51 | technomancy | bitemyapp: right; because that doesn't cause *any* weird problems |
| 19:51 | TEttinger | (it takes a half second to process a keypress on client, it is almost instantaneous on server) |
| 19:51 | bitemyapp | technomancy: I'm sorry, I can't hear you from my shining ivory tower. |
| 19:51 | bitemyapp | where things just work |
| 19:51 | Bronsa | Wild_Cat: what if I told you == isn't commutative in 1.5.1? |
| 19:52 | Bronsa | ,*clojure-version* |
| 19:52 | clojurebot | {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"} |
| 19:52 | Bronsa | &*clojure-version* |
| 19:52 | lazybot | ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil} |
| 19:52 | bitemyapp | that's old. |
| 19:52 | Bronsa | &[(== 1 1N 1.0) (== 1 1N 1.0 1M) (== 1 1N 1.0 1.0M) (== 1 1.0 1N 1.0M)] |
| 19:52 | lazybot | ⇒ [true true true false] |
| 19:52 | TEttinger | does anyone have any tips for speeding up JVM clojure without the trick lazybot uses to launch another java command? |
| 19:52 | bitemyapp | Bronsa: oh sweet. |
| 19:52 | Wild_Cat | eew. |
| 19:52 | bitemyapp | PHP-jure. |
| 19:53 | technomancy | TEttinger: are you sure your users don't have access to the server JVM? |
| 19:53 | Bronsa | bitemyapp: it's fixed since 1.6.0-alphasomething though |
| 19:53 | TEttinger | technomancy, kinda |
| 19:53 | Wild_Cat | all right, thanks for helping me make my pull request prettier. |
| 19:53 | bitemyapp | Bronsa: not really comforting. |
| 19:53 | TEttinger | I tried it on a JRE only java 7 install, up to date |
| 19:53 | TEttinger | no -server option there |
| 19:53 | technomancy | TEttinger: who are these mysterious users running on 32-bit boxes? |
| 19:53 | TEttinger | my mom. |
| 19:53 | hyPiRion | bitemyapp: that's just because loljava bigdecimals |
| 19:54 | hyPiRion | ,(== 1.0M 1.00M) ;; etc |
| 19:54 | TEttinger | technomancy, is it really a 64-bit only thing? |
| 19:54 | clojurebot | true |
| 19:54 | hyPiRion | oh, that's fixed on master |
| 19:54 | hyPiRion | &(== 1.0M 1.00M) |
| 19:54 | lazybot | ⇒ false |
| 19:54 | technomancy | TEttinger: no, it's only that 64-bit machines are server-only |
| 19:54 | bitemyapp | hyPiRion: Datomic already drained my ability to care today. |
| 19:54 | hyPiRion | bitemyapp: hurray. |
| 19:55 | technomancy | most users don't even have access to client hotspot |
| 19:55 | TEttinger | on JRE, not JDK??? |
| 19:55 | lazybot | TEttinger: Oh, absolutely. |
| 19:55 | Wild_Cat | TEttinger: yeah, even on JRE |
| 19:55 | technomancy | TEttinger: pretty sure it's the same on both |
| 19:55 | technomancy | they never bothered implementing -client |
| 19:55 | Wild_Cat | AFAIK the JVM installed by the JRE and the JDK is the same. |
| 19:55 | bitemyapp | TEttinger: betcha wish ya had native binaries right about now >:) |
| 19:56 | Wild_Cat | the main difference being that one comes with the Ask toolbar -.- |
| 19:56 | TEttinger | bitemyapp, yeah. except haskell doesn't have any game libs. |
| 19:56 | technomancy | TEttinger: never heard of -server being missing |
| 19:56 | technomancy | you could try tiered compilation maybe |
| 19:57 | bitemyapp | TEttinger: well that's not true at all. |
| 19:57 | bitemyapp | TEttinger: there's Helm, HGame3d, there's a whole channel devoted to it at #haskell-game |
| 19:57 | TEttinger | oh neat |
| 19:57 | bitemyapp | TEttinger: you can use any dyn-libs via the FFI you want. |
| 19:57 | technomancy | RainCat! |
| 19:57 | bitemyapp | TEttinger: most people use SDL for 2d, OpenGL for 3d. |
| 19:57 | technomancy | is adorable |
| 19:57 | Cr8 | java hates me today |
| 19:57 | TEttinger | ouch bitemyapp |
| 19:57 | bitemyapp | technomancy: yes it is. |
| 19:58 | bitemyapp | TEttinger: ouch? |
| 19:58 | bitemyapp | TEttinger: I mean, if you want something like Unity3d, you're not going to get it. |
| 19:58 | TEttinger | raw OpenGL is not something I have had a good time with |
| 19:58 | TEttinger | I usually have used wrappers |
| 19:58 | bitemyapp | TEttinger: so use GLUT or GLEW |
| 19:59 | bitemyapp | TEttinger: http://www.haskell.org/haskellwiki/OpenGL http://www.haskell.org/haskellwiki/OpenGLTutorial1 http://hackage.haskell.org/package/GLUT http://www.reddit.com/r/haskell/comments/1tay08/modern_opengl_in_haskell/ |
| 19:59 | bitemyapp | TEttinger: OpenGL and GLUT are included in the Haskell platform by default. |
| 19:59 | bitemyapp | at most, you'd install some headers. |
| 19:59 | technomancy | dammit bitemyapp |
| 19:59 | bitemyapp | technomancy: I'm helping him! |
| 19:59 | technomancy | you're like one hour early |
| 19:59 | Wild_Cat | Haskell has no games. It has generalized abstract game engine transformer transformer combinator transformers. |
| 19:59 | TEttinger | yeah, total rewrite is not helping |
| 19:59 | Wild_Cat | :p |
| 20:00 | bitemyapp | :( |
| 20:00 | bitemyapp | TEttinger: is it on Github? |
| 20:00 | TEttinger | yeah, not the latest yet, because my current local copy is kinda broken ATM |
| 20:00 | bitemyapp | TEttinger: link please. |
| 20:00 | technomancy | TEttinger: does tiered compilation work? |
| 20:00 | TEttinger | https://github.com/tommyettinger/dungeon-kingpin |
| 20:01 | TEttinger | technomancy, I don't know what it is yet |
| 20:01 | TEttinger | and it seems to be Java 7 only? |
| 20:01 | technomancy | no, it's been around a long time |
| 20:01 | technomancy | it's faster in 7 though |
| 20:01 | Cr8 | COME ON |
| 20:01 | bitemyapp | TEttinger: your dangling ))'s are unholy in the eyes of god |
| 20:01 | Cr8 | i keep getting outofmemoryerror java heap space |
| 20:01 | bitemyapp | Cr8: jack dat Xmx yo. |
| 20:02 | technomancy | TEttinger: it's a way of telling -server to start out as fast-launching and shift to high-perf over time |
| 20:02 | technomancy | an attempt at getting best of both worlds of -client and -server |
| 20:02 | Cr8 | bitemyapp: I jacked it up to 8G :[ |
| 20:02 | bitemyapp | Cr8: hahahahaha ouch. |
| 20:02 | Cr8 | and all i'm trying to do is start a repl |
| 20:02 | TEttinger | technomancy, but it needs to be the other way around...? |
| 20:03 | bitemyapp | Cr8: wat. |
| 20:03 | Cr8 | lein repl; empty project; empty profiles.clj; out of heap |
| 20:03 | technomancy | TEttinger: not sure; it might be a way to force it into high-perf mode even if you can't invoke -server |
| 20:03 | Cr8 | not really .. |
| 20:03 | Cr8 | okay now it works |
| 20:03 | TEttinger | http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html |
| 20:03 | Cr8 | wait i lied |
| 20:03 | Cr8 | it started a repl |
| 20:04 | Cr8 | then i typed a character and i got it again |
| 20:04 | amalloy | https://github.com/tommyettinger/dungeon-kingpin/blob/master/src/dk/herringbone.clj -- best source file ever, TEttinger? |
| 20:04 | TEttinger | amalloy,I know right |
| 20:05 | TEttinger | code is data! |
| 20:05 | Cr8 | https://www.evernote.com/shard/s17/sh/95196df9-343c-4170-ae86-214aeb84fd53/04497dbef41ff7e8b1c904a35d0fb1f4/deep/0/1.-apage43@Tyrathect----proj-tiny-(zsh).png |
| 20:05 | TEttinger | Cr8, heh |
| 20:05 | bitemyapp | Cr8: what in god's name did you do to your JVM? |
| 20:05 | TEttinger | it is probably trying to load a ns |
| 20:05 | Cr8 | i think i'm going to reboot my computer |
| 20:06 | bitemyapp | Cr8: Tyrathect! |
| 20:06 | bitemyapp | Cr8: I just read that book! |
| 20:06 | bitemyapp | Cr8: fantastic. |
| 20:06 | TEttinger | and then dying because you have a massive def or something |
| 20:06 | Cr8 | that's my computer's name |
| 20:06 | noonian__ | Cr8: if you have a :main key in your project.clj try commenting it out |
| 20:06 | clojurebot | It's greek to me. |
| 20:06 | Cr8 | bitemyapp: cool :D |
| 20:06 | Cr8 | noonian__: I don't. This is a fresh lein new |
| 20:06 | bitemyapp | Cr8: reboot and try again? |
| 20:07 | Cr8 | doing so |
| 20:07 | noonian__ | lol, that sucks then |
| 20:08 | arrdem | technomancy: I love the new topic |
| 20:08 | bitemyapp | arrdem: I'm very proud of that. |
| 20:09 | gtrak | hahaha |
| 20:09 | Cr8 | well |
| 20:09 | Cr8 | everything's fine now |
| 20:09 | llasram | Another hour to go! |
| 20:09 | Cr8 | user=> 1 |
| 20:09 | Cr8 | 1 |
| 20:09 | Cr8 | success! |
| 20:09 | arrdem | llasram: that means I have an hour to give my talk and get bitemyapp on dota so he doesn't steal more souls... |
| 20:09 | gtrak | vote for cljs compiler dumps! http://dev.clojure.org/jira/browse/CLJS-748 |
| 20:10 | technomancy | bitemyapp has set his alarm |
| 20:10 | technomancy | two hours after ALLBALLS |
| 20:10 | llasram | heh |
| 20:11 | Cr8 | ,(vector? (first {:a 1})) |
| 20:11 | gtrak | once we have that, we'd be about an hour away from an autodoc. |
| 20:11 | clojurebot | true |
| 20:11 | bitemyapp | Cr8: seq of vecs |
| 20:12 | bitemyapp | Cr8: I have to memorize the types because I use an untyped language. |
| 20:12 | Cr8 | ,(class (first {:a 1})) |
| 20:12 | clojurebot | clojure.lang.MapEntry |
| 20:12 | bitemyapp | pseudo-vecs. |
| 20:12 | bitemyapp | fine. |
| 20:12 | bitemyapp | inheritance? |
| 20:12 | Cr8 | &(-> {:a 1} first class supers) |
| 20:12 | lazybot | ⇒ #{java.lang.Iterable clojure.lang.Sequential java.io.Serializable clojure.lang.IPersistentStack clojure.lang.IPersistentVector java.util.Collection java.lang.Comparable clojure.lang.AFn java.util.concurrent.Callable java.lang.Runnable clojure.lang.ILookup clojure.lan... https://www.refheap.com/23557 |
| 20:13 | bitemyapp | A and I anyway. |
| 20:13 | Cr8 | has APersistentVector |
| 20:13 | Cr8 | yeah |
| 20:20 | bitemyapp | for datomic.db.Datum: #{clojure.lang.ILookup java.lang.Object clojure.lang.Counted clojure.lang.Indexed clojure.lang.IType datomic.impl.db.IDatum datomic.Datom datomic.db.IDatumImpl} |
| 20:20 | bitemyapp | well that's not nice. |
| 20:20 | Cr8 | that's.. |
| 20:20 | Cr8 | short |
| 20:20 | bitemyapp | Cr8: did you see my smashing my head into them earlier? |
| 20:20 | Cr8 | I did |
| 20:26 | Cr8 | speaking of books, Don't Sleep, There Are Snakes was good, I read it on a plane a bit back |
| 20:28 | Cr8 | w.r.t. your rt there |
| 20:29 | Cr8 | though it doesn't actually go into much detail on the piraha language, the story was interesting |
| 20:35 | insamniac | TEttinger: Is dungeon-kingpin supposed to work? I can't pull down all the deps |
| 20:35 | TEttinger | insamniac, that's odd |
| 20:35 | TEttinger | which deps can't it get? |
| 20:36 | bitemyapp | insamniac: I really like your name. |
| 20:37 | bitemyapp | insamniac: please tell me your given name is Sam. |
| 20:37 | seangrove | Deploying Clojure to Heroku in what seem like off-hours? Grab a drink, sit back, relax. You got loads of time. |
| 20:38 | arrdem | seangrove: really? it's always been pretty fast for me.. |
| 20:38 | seangrove | arrdem: And you uberjar? |
| 20:39 | bitemyapp | uberjars start faster, but are fatter. |
| 20:39 | arrdem | seangrove: I don't think so. I just used their git target with an uberjar->slug for their end. |
| 20:39 | arrdem | *configuration |
| 20:39 | bitemyapp | but I don't use Heroku. |
| 20:40 | bitemyapp | because I build my own lightsabers. |
| 20:40 | seangrove | bitemyapp: Yeah, but I can compile them quickly locally, but letting whatever scraps heroku uses to compile them is painful |
| 20:40 | technomancy | bitemyapp: whatever; I saw your keyboard |
| 20:40 | _eric | I have some tests where I want to slurp in some files to use in the tests |
| 20:40 | _eric | is there a convention for where to put the files and how to read them? |
| 20:41 | bitemyapp | technomancy: that's @work, I use a MX cherry thingamajig at home with Linux. |
| 20:41 | technomancy | seangrove: we just opened up the API to accept 3rd-party slugs though so you can do it from a CI server or something |
| 20:41 | technomancy | please don't build on your laptop =( |
| 20:41 | bitemyapp | we build uberjars on our dev machines here, lol. |
| 20:41 | arrdem | _eric: $PROJECT_ROOT/resources/* |
| 20:41 | seangrove | technomancy: That sounds good, but I'm wondering if we get much benefit from heroku/clojure over just using ansible + uberjar |
| 20:41 | arrdem | _eric: leiningen will put that stuff on the classpath for you. |
| 20:41 | bitemyapp | seangrove: very neutral source. |
| 20:42 | arrdem | _eric: (slurp <filename>) should work. |
| 20:42 | seangrove | going on ~6 minutes on this push... |
| 20:42 | _eric | cool |
| 20:42 | technomancy | bitemyapp: http://p.hagelb.org/disappointed.gif |
| 20:42 | _eric | is it only $PROJECT_ROOT/resources/ or is there a $PROJECT_ROOT/test/resources? |
| 20:42 | seangrove | technomancy: The API sounds nice though, it's the next piece of the workflow I'd like to setup - jenkins + push-button deploys of passing uberjars |
| 20:43 | bitemyapp | technomancy: I knew what the gif was going to be before I clicked. |
| 20:43 | hyPiRion | you know what |
| 20:43 | arrdem | _eric: you can put files wherever you want on the classpath |
| 20:43 | technomancy | bitemyapp: damn; too predictable |
| 20:43 | hyPiRion | clojurebot: mystery |is| http://p.hagelb.org/mystery.gif |
| 20:43 | clojurebot | Roger. |
| 20:43 | bitemyapp | technomancy: it's the first time you haven't surprised me though. |
| 20:43 | bitemyapp | other than the rather common mystery.gif, but that one is always a delight. |
| 20:43 | technomancy | bitemyapp: http://p.hagelb.org/tastes-mature.png |
| 20:45 | hyPiRion | bitemyapp: hey, I bet you've not seen this one before: http://hypirion.com/imgs/lenanign.png |
| 20:45 | seangrove | Go home hyPiRion, you're drunk |
| 20:45 | bitemyapp | hyPiRion: why? |
| 20:45 | bitemyapp | seangrove: francophones. |
| 20:46 | hyPiRion | bitemyapp: people misspell leiningen in many ways |
| 20:46 | gtrak | hyPiRion: she's in every image processing textbook. |
| 20:47 | seangrove | technomancy: Admit it, Clojure is so despised at Heroku that the only build servers allotted to clojure projects are the old coffee-grinders thrown out running in the back of McGranaghan's station wagon. |
| 20:47 | hyPiRion | gtrak: What do you want me to do? Attach a mustache to every single one of those images? |
| 20:48 | r00k_ | Anybody here make much use of :pre and :post conditions for your functions? Do you feel like it pays off? |
| 20:48 | seangrove | r00k_: I use :pre in quite a few places, it's pretty handy for sanity checks |
| 20:48 | gfredericks | hiredman: oh man I did not realize sneakyThrow was actually sneaky |
| 20:48 | technomancy | seangrove: I could show you some horrifying graphs that involve scala |
| 20:48 | hyPiRion | Maybe I should make an image detection plugin for my browser which automatically adds a mustache to Lena |
| 20:48 | gfredericks | I suddenly feel like I don't understand the java type system |
| 20:48 | technomancy | seangrove: we get tickets for 15-minute scala builds timing out on a regular basis |
| 20:50 | r00k_ | seangrove: And you find those asserts blowing up often enough to feel worth the cost (time writing them, visual weight)? |
| 20:50 | bitemyapp | seangrove: hahahahaha |
| 20:50 | bitemyapp | r00k_: well in the absence of a sensible type system... |
| 20:50 | llasram | gfredericks: http://james-iry.blogspot.com/2010/08/on-removing-java-checked-exceptions-by.html |
| 20:50 | seangrove | technomancy: Well, we'll port over to RoR ASAP ;) |
| 20:50 | bitemyapp | whew, just typed defun in Clojure code. |
| 20:50 | amalloy | gfredericks: in fairness, neither does java |
| 20:50 | seangrove | r00k_: They're generally tiny |
| 20:51 | seangrove | e.g. {:pre [(not (empty? api-key))]}, {:pre [(integer? org-id)]} |
| 20:51 | gfredericks | llasram: thanks! |
| 20:51 | r00k_ | bitemyapp: Yeah, I was going to ask if maybe we're just adding a poor man's type system. |
| 20:51 | seangrove | Poor, poor-man's type-system |
| 20:51 | hyPiRion | gfredericks: yeah, sneakythrow is generic abuse to the max |
| 20:52 | arrdem | bitemyapp: 10 minutes till you can start pushing haskell |
| 20:52 | amalloy | seangrove: "tiny...(not (empty? x))" :( (seq x) |
| 20:52 | seangrove | ,(seq "") |
| 20:52 | clojurebot | nil |
| 20:52 | seangrove | ffs |
| 20:53 | r00k_ | seangrove: Do they tend to blow up just when you're first writing the code that calls your function, or later when your data gets screwy? |
| 20:53 | seangrove | r00k_: I put them in in the beginning when I don't want to write a full test, and take them out when things start looking solid |
| 20:53 | r00k_ | Hah. (seq x) makes it *really* look like you just want a type system. |
| 20:53 | amalloy | seangrove: (empty? x) is literally implemented as (not (seq x)). there's never a reason to write (not (empty? x)) |
| 20:53 | gfredericks | I guess the suggested idiom of "throw sneakyThrow(...)" is just to make it syntactically obvious that you're throwing something? |
| 20:53 | seangrove | amalloy: What about (not (not (seq x?))) ? |
| 20:54 | seangrove | ;) |
| 20:54 | r00k_ | Hah. |
| 20:54 | amalloy | maybe if someone put a gun to your head and said "start your preconditions with (not...or DIE" |
| 20:54 | gfredericks | ,'not...or |
| 20:54 | clojurebot | not...or |
| 20:54 | r00k_ | Thanks for the input, seangrove. I appreciate it! |
| 20:55 | Wild_Cat | hey, that's pretty cool: http://blog.travisthieman.com/write-you-a-starcraft-ai-in-clojure/ |
| 20:55 | gfredericks | ,(let [not...or identity, DIE 42] (not...or DIE)) |
| 20:55 | clojurebot | #<CompilerException java.lang.ClassFormatError: Illegal field name "not...or" in class sandbox$eval73, compiling:(NO_SOURCE_PATH:0:0)> |
| 20:55 | hyPiRion | gfredericks: close, but no cigar |
| 20:56 | insamniac | this game should be called dancing with ogres |
| 20:57 | gfredericks | ,(def not...or identity) |
| 20:57 | clojurebot | #'sandbox/not...or |
| 20:57 | gfredericks | ,(let [DIE 42] (not...or DIE)) |
| 20:57 | clojurebot | #<CompilerException java.lang.ClassNotFoundException: not///or, compiling:(NO_SOURCE_PATH:0:0)> |
| 20:58 | gfredericks | huh. |
| 20:58 | llasram | I'm really amazed you can `def` that |
| 20:58 | gtrak | ,(read-string "clojure//") |
| 20:58 | gfredericks | ,(let [DIE 42] (sandbox/not...or DIE)) |
| 20:58 | clojurebot | clojure// |
| 20:58 | clojurebot | 42 |
| 20:58 | gtrak | ,(read-string "cljs//") |
| 20:58 | clojurebot | cljs// |
| 20:58 | gfredericks | llasram: ooh you can use it fully qualified too |
| 20:58 | llasram | niiiice |
| 20:58 | gtrak | ,(read-string "cljs.core//") |
| 20:58 | clojurebot | cljs.core// |
| 20:58 | TEttinger | insamniac, haha |
| 20:58 | gtrak | damn... I forget which one was broken :-) |
| 20:59 | gfredericks | ,(def .......... 7) |
| 20:59 | clojurebot | #'sandbox/.......... |
| 20:59 | llasram | gtrak: It's been fixed |
| 20:59 | gtrak | oh really? |
| 20:59 | gfredericks | ,(* sandbox/.......... 2 3) |
| 20:59 | clojurebot | 42 |
| 20:59 | llasram | ,*clojure-version* |
| 20:59 | clojurebot | {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"} |
| 20:59 | gtrak | aha |
| 20:59 | gfredericks | oh man we can make unary helpers |
| 20:59 | gfredericks | ,(def .. 2) |
| 20:59 | clojurebot | #<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)> |
| 20:59 | gfredericks | ,(def ... 3) |
| 20:59 | clojurebot | #'sandbox/... |
| 20:59 | gfredericks | ,(def . 1) |
| 21:00 | clojurebot | #'sandbox/. |
| 21:00 | gfredericks | waaat |
| 21:00 | llasram | ,`. |
| 21:00 | clojurebot | . |
| 21:00 | gfredericks | what is going on with 2 |
| 21:00 | gfredericks | ,(def .... 4) |
| 21:00 | clojurebot | #'sandbox/.... |
| 21:00 | hyPiRion | gfredericks: lol |
| 21:00 | gfredericks | ,(* sandbox/... sandbox/. sandbox/....) |
| 21:00 | clojurebot | 12 |
| 21:00 | bitemyapp | yum. more arity type errors. |
| 21:00 | hyPiRion | ,(+ . .) |
| 21:00 | clojurebot | 2 |
| 21:01 | darthdeus | for all the light table fans out there http://blog.jakubarnold.cz/light-table-plugin-tutorial :P |
| 21:01 | bitemyapp | hyPiRion: dafuq. |
| 21:01 | gfredericks | ,#'clojure.core/.. |
| 21:01 | clojurebot | #'clojure.core/.. |
| 21:01 | gfredericks | oh maybe that is why |
| 21:01 | llasram | Ohhhhh |
| 21:01 | llasram | Yes |
| 21:01 | llasram | That makes "sense" |
| 21:01 | gfredericks | :) |
| 21:01 | gfredericks | ,(+ ... ...) |
| 21:01 | clojurebot | 6 |
| 21:01 | Cr8 | wat |
| 21:01 | hyPiRion | oh, I got this |
| 21:01 | gfredericks | ,(def ...... 6) |
| 21:01 | clojurebot | #'sandbox/...... |
| 21:01 | hyPiRion | ,(* ... (+ . ...)) |
| 21:01 | clojurebot | 12 |
| 21:02 | gfredericks | clojure is a DSL for fans of unary who are allergic to 2 |
| 21:02 | hyPiRion | "And today, in Swearjure part 2, we'll have a look at periods." |
| 21:02 | TEttinger | ,(. toString 4) |
| 21:02 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: toString in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 21:02 | TEttinger | no! |
| 21:02 | TEttinger | ,(.toString 4) |
| 21:02 | clojurebot | "4" |
| 21:02 | amalloy | not so much clojure as clojurebot, gfredericks |
| 21:02 | TEttinger | ,(. 4 toString 4) |
| 21:02 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: toString for class java.lang.Long> |
| 21:02 | TEttinger | hm |
| 21:03 | TEttinger | there is one though |
| 21:03 | amalloy | ,(. 4 toString) |
| 21:03 | clojurebot | "4" |
| 21:03 | gfredericks | amalloy: oh good point |
| 21:03 | amalloy | you can define .. for real in a repl you own |
| 21:03 | TEttinger | ,(Long/toString 4 4) |
| 21:03 | clojurebot | "10" |
| 21:03 | gfredericks | you mean I can own my very own repl? |
| 21:03 | TEttinger | there we go, it's static |
| 21:07 | hyPiRion | oh, that's an interesting identity |
| 21:07 | hyPiRion | ,(map #(->> % (Long/toString %) read-string (Long/toString %) read-string) (range 1 20)) |
| 21:07 | clojurebot | (1 2 3 4 5 ...) |
| 21:09 | gfredericks | ...it is? |
| 21:09 | akurilin | If I wanted to keep my site's static html/css/assets separate from the .jar, it doesn't really matter where I place them, right? As long as I have a path to them and file system permissions, I should be able to keep those outside of the jar resources? |
| 21:10 | akurilin | I just feel dumb for putting assets in the jar, I have to build the ring app and restart it every time I need to make the smallest change. |
| 21:10 | abaker | sure, but you can also build a war, explode the war, put in tomcat, and then mess with stuff all day long |
| 21:11 | Cr8 | ^~ |
| 21:11 | akurilin | Is that still pretty simple? Because right now my setup is jetty daemonized by runit, which is as bare-bones as it gets and works reallyw ell. |
| 21:12 | Cr8 | jetty should be able to run exploded WARs as well |
| 21:12 | hyPiRion | akurilin: You can place it separate from the .jar. That's what I've done so far. |
| 21:12 | rovar | I'm working through http://www.learndatalogtoday.org/ I see that they solve a combinatorial problem rather elegantly, and I also see that there was a bit of discussion on the mailing list about core.logic and datalog.. |
| 21:13 | rovar | I guess my question is has anyone tried to tackle more complex problems with datalog.. like the travelling salesman or other optimization problems? |
| 21:13 | rovar | I'm actually interested in vehicle routing with constraints.. |
| 21:13 | akurilin | hyPiRion: good to know that people do it. |
| 21:13 | rovar | or some variant therein |
| 21:14 | hyPiRion | akurilin: For me, I just placed `(route/files "/" {:root "my-directory"})` at the bottom of my main compojure defroutes, where my-directory are the static files |
| 21:14 | hyPiRion | er, the directory containing the static files |
| 21:16 | akurilin | hyPiRion: ok so it's just a regular unix path, I imagine through an env var or something of that sorts? |
| 21:16 | hyPiRion | akurilin: yeah, it's an env var for me, (and it can be relative) |
| 21:17 | abaker | rovar: sure, with SPARQL, which can map 1-to-1 with datalog |
| 21:17 | akurilin | hyPiRion: ok perfect, I love to shove everything into environ through our CM. |
| 21:18 | akurilin | I guess for some reason I thought there's be special rules to accessing files outside of the jar due to some JVM permission rules, but I guess an app is an app. |
| 21:19 | hyPiRion | akurilin: nah, standard ACL rules apply |
| 21:21 | akurilin | hyPiRion: great, thanks a bunch for clarifying that :) |
| 21:21 | hyPiRion | no problem |
| 21:21 | hyPiRion | :) |
| 21:22 | afhammad | Hi, what is the base footprint for latest clojurescript projects after advanced compilation? |
| 21:24 | rovar | abaker, so you're saying you've done it on a graph database? |
| 21:26 | abaker | rovar: yeah - I work on Stardog, where sparql + reasoning/rules and such can be used to build all sorts of fun stuff |
| 21:28 | rovar | abaker, neato. I do big data infrastructure for a day job, but have been poking around with scheduling and routing optimization for fun.. |
| 21:30 | abaker | rovar: yeah fun stuff, upcoming release we're adding higher level services for graph analytics, shortest path computations, finding cliques, etc |
| 21:37 | _eric | is there an efficient way to say "if ... else if ... else if ... else ..."? |
| 21:38 | riley526 | _eric: ,(doc cond) |
| 21:38 | _eric | sort of like (case) works |
| 21:38 | riley526 | ,(doc cond) |
| 21:38 | clojurebot | "([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil." |
| 21:38 | gregorstocks | hey bitemyapp should i use haskell |
| 21:38 | _eric | sweeeet |
| 21:38 | _eric | yay! |
| 21:38 | _eric | thanks |
| 21:39 | riley526 | np! |
| 21:39 | _eric | I just spent 10 minutes trying to figure out what I was asking for |
| 21:40 | riley526 | _eric: Yeah some things can be tough to find if you don't know what it's called |
| 21:47 | akurilin | gregorstocks: lol. |
| 22:36 | logic_prog | what's a good name for something that is a message + a return channel |
| 22:38 | Raynes | logic_prog: A portable post office. |
| 22:38 | logic_prog | i'm trying to come up with good names for deftype / defrecord |
| 22:39 | Raynes | PortablePostOffice |
| 22:39 | Raynes | :p |
| 22:44 | Cr8 | SASE |
| 22:45 | llasram | I was just thinking that too, Cr8 :-) |