2014-12-22
| 00:00 | andyf | arrdem: pong |
| 00:02 | kenrestivo | it isn't my opinion that the people are intending. |
| 00:02 | arrdem | andyf: refactoring the cheatsheet structure to play with a flowing box layout. interested? |
| 00:03 | andyf | I don't know what a flowing box layout means, but if you think it will enhance usability without making it take way more vertical space, I'm curious. |
| 00:03 | andyf | by flowing box, you mean something where it will take more horizontal space if the window has it available? |
| 00:03 | arrdem | yep. |
| 00:04 | andyf | definitely interested. |
| 00:04 | arrdem | kk. I'm starting to work on Grimoire's small screen rendering, and the cheatsheet could use some work so I'm starting there. |
| 00:21 | tenchi | Can anyone help explain what's happening here? |
| 00:21 | tenchi | https://www.refheap.com/95287 |
| 00:26 | fairuz | tenchi: nothing? |
| 00:27 | fairuz | (/ 2_000 2) somehow returns 2 |
| 00:28 | tenchi | fairuz: Ah, and I guess it's not flushed until I hit enter (with or without another command). |
| 00:29 | tenchi | It's the second 2, in particular. |
| 01:15 | tolstoy | Trying out sente, and right away: Exception in thread "main" java.lang.IllegalAccessError: have? does not exist, compiling:(taoensso/sente.clj:1:1) |
| 01:15 | tolstoy | Eek! ;) |
| 01:19 | arrdem | andyf: was the cheat sheet pdf first and then html? |
| 01:20 | tolstoy | Wow. Can't even get the lib itself to compile. |
| 01:20 | andyf | Steve Tayon created it, which I wasn't involved in at first. When I came to it, I believe the more up-to-date version was LaTeX (used to generate PDF), and an HTML version was created from that by hand. |
| 01:21 | andyf | My first step being involved in it was to create the Clojure program that generates both LaTeX and HTML from a common data structure, and I tried fairly hard to keep the initial LaTeX version nearly identical to what I started with. |
| 01:21 | arrdem | gotcha. |
| 01:21 | andyf | If there is some baggage in the code left over from that, I don't mind ejecting it now. |
| 01:22 | arrdem | what I'm working on now basically demands a single column layout rather than the baked in two column assuption so... it's an adventure |
| 01:22 | arrdem | more funny to see what I consider 2014 clojure style vs 2011 clojure style |
| 01:22 | andyf | I wouldn't necessarily say my style in writing that Clojure code was typical of everyone's. |
| 01:22 | arrdem | :P |
| 01:23 | arrdem | if you want me to not go crazy with style changes I won't |
| 01:23 | arrdem | but right now I'm going a little nuts |
| 01:23 | andyf | I don't mind if it changes in significant ways, if I can still understand it and figure out how to make further changes to it when needed. |
| 01:24 | arrdem | ok. I'll let you know when I finish something useful or get really stuck :P |
| 01:24 | arrdem | thanks andy |
| 01:24 | andyf | np |
| 01:27 | sdegutis | For example I'm really liking Swift's syntax right now. |
| 01:28 | sdegutis | It admittedly doesn't allow macros, but so far that hasn't bothered me. |
| 01:43 | kenrestivo | mein gott. i think i finally have this core.async thing wrestled to the ground. |
| 01:44 | kenrestivo | now all we need is someone to whack that pioneering modernist painter from the pm's. |
| 01:45 | kenrestivo | but... 5 separate restartable "daemon" components, all communicating via an async message bus, topics and pub/sub, massive crazy state management all done inside an atom in one of the components, all other components getting their state updates from that and feeding input into it. |
| 01:48 | arrdem | sounds like one hella complex state machine... |
| 01:58 | kenrestivo | it's more update functions than state machine. the network stuff is a proper statemachine, using multimethods |
| 01:59 | kenrestivo | anyways, finally can see the horizon and sharing a happy moment. |
| 01:59 | kenrestivo | interested to see what your mobile grimoire ends up lookign like. are you using bootstrap? |
| 02:06 | arrdem | not yet. a rework atop bootstrap is more or less imminent |
| 02:06 | arrdem | redoing the cheatsheet atop bootstrap first :P |
| 02:07 | arrdem | https://github.com/poole/lanyon is what it's built atop now which leads to some... issues. |
| 02:09 | kenrestivo | ah, css. i'll be back in browser-and-css-land by end of week i expect. |
| 02:10 | arrdem | yeah. I need to really get my hands dirty in that land :c |
| 02:11 | arrdem | programmer art will only take you so far |
| 02:11 | kenrestivo | if you want to sell stuff, yeah, ui is a must. |
| 02:12 | kenrestivo | i'm just a bootstrap jockey at this point when it comes to ui. but it works. |
| 02:15 | kenrestivo | actually looking at grimoire, a bootstrap grid would probably work perfectly. 2 col on wide screens, automatically responsive's to 1 col on phones |
| 02:16 | arrdem | yeah I just need to bludgeon the cheatsheet into supporting that :P |
| 02:16 | kenrestivo | and that menu/sliding-drawer thing, i think it supports that too. |
| 02:16 | arrdem | since it looks like I'd need to totally rewrite the cheatsheet's internals to support this I may just hand edit it.. |
| 02:17 | kenrestivo | where's the source of it? |
| 02:18 | arrdem | https://github.com/arrdem/clojure-cheatsheets |
| 02:19 | andyf | you can't just make the existing 2-column stuff in there a no-op? |
| 02:19 | kenrestivo | oh wow, that goes back a ways |
| 02:19 | kenrestivo | fogus, that was a while ago. |
| 02:19 | arrdem | andyf: I mean yeah I could hack it to get the build I want, but that doesn't count :P |
| 02:20 | arrdem | why would I pass up on a perfectly good yack |
| 02:20 | arrdem | /s |
| 02:20 | kenrestivo | i'd be inclined to start over, and just take the database of content forward. |
| 02:20 | andyf | not when those shears are right there |
| 02:21 | arrdem | the spirit is willing but the body is tired and low on caffeene |
| 02:22 | kenrestivo | yeah i gotta burn an image with this finally-working thing before i pass out. |
| 02:22 | arrdem | I'm just gonna hack it. I'd wind up with two (structurally shared) templates anyway if I really shaved this right. |
| 02:22 | arrdem | another day. |
| 02:22 | arrdem | dang it's late. forget this. |
| 02:22 | arrdem | 'night |
| 02:23 | andyf | g'night |
| 02:33 | rritoch | Can someone explain to me how to send an IRC mail via one of the bots? I am having a problem accessing the development wiki and need to advise an official developer of some issues. |
| 02:35 | andyf | rritoch: The Clojure dev wiki? I may be able to help |
| 02:35 | andyf | What are you trying to do, and what result are you getting? |
| 02:35 | TEttinger | $mail rritoch this is a message. |
| 02:35 | lazybot | Message saved. |
| 02:36 | rritoch | andyf: I have tried to login but it isn't accepting my password. When I attempt to retrieve my password it says I have no account, and when I attempt to create an account I get a validation error and stack trace saying the account already exists. |
| 02:36 | TEttinger | check it by privmsging lazybot with $mail |
| 02:37 | rritoch | TEttinger: Thanks |
| 02:37 | TEttinger | np |
| 02:37 | TEttinger | it's a very useful feature in geographically diverse IRC |
| 02:37 | andyf | I see an account called rritoch, last logged on in Dec 5 |
| 02:38 | andyf | It looks like I have permission to set the password. You want me to set it to something random-ish and email it to rritoch@gmail.com ? |
| 02:39 | rritoch | andyf: Thanks, that would work. I'm unable to reset it. |
| 02:39 | wildnux | hi, https://www.refheap.com/95290 |
| 02:40 | wildnux | that function is supposed to do concat on (take-last 2 theseq) and (drop-last 2 theseq) |
| 02:40 | rritoch | andyf: I suppose the problem is with the password recovery system then. When I enter either my username or email address it says I don't have an account. |
| 02:40 | wildnux | and return (4 5 1 2 3) |
| 02:40 | andyf | On what page are you trying to log in? |
| 02:40 | rritoch | andyf: http://dev.clojure.org/dologin.action |
| 02:40 | wildnux | but, it is returning (3 4 5 1 2), what am i doing wrong? |
| 02:41 | TEttinger | mod is never negative on the jvm, wildnux |
| 02:41 | rritoch | andyf: At http://dev.clojure.org/forgotuserpassword.action if you enter my username or email it says the account doesn't exist. |
| 02:42 | andyf | out of curiosity, try going here and look for a Log in link near upper right: http://dev.clojure.org/jira/browse/CLJ |
| 02:42 | TEttinger | ,(mod -2 5) |
| 02:42 | clojurebot | 3 |
| 02:42 | rritoch | andyf: I am already logged in there |
| 02:42 | wildnux | TEttinger: yes, but f should be bound to take-last, and s should be bound to drop-last and thus result should be (concat (take-last 2 [1 2 3 4 5]) (drop-last 2 [1 2 3 4 5])), which but is not ding it |
| 02:42 | TEttinger | ,(rem -2 5) |
| 02:42 | clojurebot | -2 |
| 02:42 | rritoch | andyf: I'm trying to access the developer wiki |
| 02:43 | TEttinger | no, you're take-last ing by n, which is 3 |
| 02:43 | wildnux | TEttinger: aaah.. ok |
| 02:44 | TEttinger | what is the correct behavior for the args: -2 [1 2 3 4 5 6 7] |
| 02:44 | TEttinger | loop two from the end back to the front, right? |
| 02:44 | andyf | If you go to this page, do you see a Log in link near top right? http://dev.clojure.org |
| 02:45 | andyf | Sorry I'm asking so many questions -- login problems aren't exactly frequent. |
| 02:46 | wildnux | TEttinger: it is supposed to rotate the sequence in negative order |
| 02:46 | rritoch | andyf: No matter what I enter it's now saying you are required to validate your login by entering the word below |
| 02:46 | wildnux | so, 6 7 1 2 3 4 i |
| 02:46 | rritoch | andyf: I'll retry with chrome. |
| 02:46 | wildnux | TEttinger: [6 7 1 2 3 4] |
| 02:47 | TEttinger | no 5? |
| 02:47 | wildnux | TEttinger: 5 as well ;) |
| 02:47 | wildnux | TEttinger: typo |
| 02:47 | rritoch | andyf: I'm having the same problem in chrome |
| 02:48 | rritoch | andyf: If I change my password on JIRA will that change my password on the wiki? Maybe that will solve this issue. |
| 02:49 | TEttinger | ,(#(take (count %2) (drop (mod %1 (count %2)) (cycle %2))) -2 [1 2 3 4 5 6 7]) |
| 02:49 | clojurebot | (6 7 1 2 3 ...) |
| 02:49 | wildnux | TEttinger: so changing the binding of n to: n (mod (Math/abs %) (count %2) fixed it |
| 02:49 | TEttinger | it's a one-liner though! |
| 02:49 | rritoch | andyf: Changing my password on JIRA had no effect, it is just the wiki that I can't access. |
| 02:50 | TEttinger | ,(#(take (count %2) (drop (mod %1 (count %2)) (cycle %2))) -10 [1 2 3 4 5 6 7]) |
| 02:50 | clojurebot | (5 6 7 1 2 ...) |
| 02:50 | andyf | I just changed the password on your JIRA account, and sent it to you in email. |
| 02:50 | andyf | Yeah, that may not help at all in getting wiki access. |
| 02:51 | TEttinger | wildnux, b-b-but one-liners are awesome |
| 02:51 | andyf | Sending email to alex.miller@cognitect.com might be a good idea. I have dealt with Clojure JIRA accounts, and I know there is something kinda parallel but not exactly identical on the wiki side that I'm not as familiar with. |
| 02:53 | wildnux | TEttinger: I know, i wanted one-liner as well, |
| 02:53 | rritoch | andyf: Ok thanks, alex is who I'm trying to reach anyhow but I didn't know his email address. |
| 02:54 | wildnux | TEttinger: but totally forgot about cycle, this is the best i could get :P now looking back the solutions is very helpful |
| 03:28 | rritoch | I'm not sure how relevant this is, but I've made additional changes to the namespace isolation feature (in the andylisp fork) to more easily manage isolation switches, and reparenting for use with thread pools. The feature is now fully functional as intended so I hope to post it to the design wiki since the problems with this feature, at least those using my implementation method, have solutions. |
| 03:40 | kenrestivo | now that's one of the most interesting core.async deaths i've yet seen: https://www.refheap.com/95293 |
| 03:40 | kenrestivo | what. in. the. |
| 03:47 | rhg135 | This is a bit dafuq, kenrestivo |
| 04:27 | borkdude | if I'm using lib-noir, what's the way to add a resource directory to the app handler? In ring I would do a wrap-resource |
| 04:27 | borkdude | with :ring-defaults maybe |
| 04:30 | borkdude | it worked |
| 05:05 | triss | math expressions can be pretty illegible in clojure..... |
| 05:05 | triss | is there a way to write them in BODMAS style? |
| 05:05 | SagiCZ1 | triss: i have found that out too |
| 05:06 | SagiCZ1 | on the other hand, you can have any number of operands which makes some expressions nicer |
| 05:06 | SagiCZ1 | if you want, you can write a macro that manipulates your code in such a way, taht you can write something like (5 + (2 * 3)), but you would limit yourself to two operands |
| 05:07 | triss | true indeed... it's just I'm often converting formula's off of papers or from ohers code. |
| 05:07 | SagiCZ1 | just wrap them in a function, make sure they are correct, and dont worry about it anymore.. its not something you need to be able to read quickly i think |
| 05:07 | triss | cheers SqgiCZ1. I tink i spotted that somewhere. Nobodies been as far as to do the whole bodmas thing yet then? |
| 05:08 | SagiCZ1 | not that i know of |
| 05:08 | triss | with operator precedence and all that shiz |
| 05:08 | SagiCZ1 | i think ive seen a simple example in a book about clojure but it was just a toy |
| 05:09 | SagiCZ1 | triss: actually, check this out https://github.com/tristan/clojure-infix |
| 05:09 | SagiCZ1 | seems like someone bothered to write an infix notation reader |
| 05:10 | SagiCZ1 | also appereantly Incanter has it as a module http://data-sorcery.org/2010/05/14/infix-math/ |
| 05:10 | triss | thanks man I'll take peek. |
| 05:10 | SagiCZ1 | note that incanter is a pretty huge dependency though |
| 05:12 | triss | not heard of that incanter.... might come in handy at some |
| 05:12 | triss | point |
| 05:13 | SagiCZ1 | it wraps some nice stuff from jfreechart for plotting |
| 05:17 | triss | write then next Q. what's the diffreence between doto and -> ? |
| 05:18 | SagiCZ1 | doto is for interop |
| 05:20 | SagiCZ1 | doto basically "mutates" the object that comes first using the functions provided... -> threads the expressions and uses output of one function as input for the next |
| 05:20 | SagiCZ1 | see this: |
| 05:20 | SagiCZ1 | ,(doto (new java.util.HashMap) (.put "a" 1) (.put "b" 2)) |
| 05:20 | clojurebot | {"a" 1, "b" 2} |
| 05:20 | SagiCZ1 | works fine right? |
| 05:20 | SagiCZ1 | ,(-> (new java.util.HashMap) (.put "a" 1) (.put "b" 2)) |
| 05:20 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 05:20 | SagiCZ1 | but this failes, because (.put "a" 1) returns nil |
| 05:20 | SagiCZ1 | which is used as a first parametr for the next .put |
| 05:21 | Bronsa | SagiCZ1: doto is not only for interop |
| 05:21 | SagiCZ1 | in doto, the parameter is always the first form, not the outputs of previous functions |
| 05:21 | SagiCZ1 | Bronsa: well.. it is for objects that are mutable.. thats not a common object in pure clojure |
| 05:22 | triss | ah of course. cheers guys |
| 05:22 | Bronsa | SagiCZ1: I've used it a bunch of times on ref types e.g. (doto (intern ..) (reset-meta! {..})) |
| 05:23 | SagiCZ1 | Bronsa: i see, well my ignorance stems from the fact that i havent used ref types yet :) |
| 05:23 | Bronsa | SagiCZ1: sure you have :) you most definitely use Vars all the time |
| 05:23 | Bronsa | SagiCZ1: I was not talking about clojure.core/ref, I was talking about clojure reference types, vars/refs/atoms/agents etc |
| 05:23 | SagiCZ1 | i use atoms sometimes.. dont know what intern does |
| 05:24 | SagiCZ1 | and dont know what var is.. do i use it? |
| 05:24 | Bronsa | SagiCZ1: definitely :) |
| 05:24 | Bronsa | SagiCZ1: everything you def is a var |
| 05:24 | SagiCZ1 | oh....... so it seems i already understand half of clojures reference types.. hooray |
| 05:46 | borkdude | Hmm, adding :ring-defaults {:static {:resources "/META-INF/resources"}} to my lib-noir app-handler results in form posts with empty parameters in compojure :-S |
| 05:52 | borkdude | http://stackoverflow.com/questions/27601178/how-do-i-add-webjars-resources-to-lib-noirs-app-handler |
| 06:09 | kenrestivo | the awesome thing about schema is that if you have invalid input you get informative error messages like https://www.refheap.com/95297 |
| 06:35 | hellofunk | can update-in work on vectors? (update-in {:a [[1 2] [3 4]]} [:a 1] 5) I would expect the [3 4] to replaced by the value of 5 |
| 06:35 | hellofunk | nevermind, i forgot to wrap the value in a fn |
| 06:35 | hellofunk | (update-in {:a [[1 2] [3 4]]} [:a 1] 5) works as expected |
| 06:36 | hellofunk | sorry, (update-in {:a [[1 2] [3 4]]} [:a 1] (fn [_] 5)) |
| 06:36 | hyPiRion | probably better to use assoc-in then |
| 06:37 | hyPiRion | ,(assoc-in {:a [[1 2] [3 4]]} [:a 1] 5) |
| 06:37 | clojurebot | {:a [[1 2] 5]} |
| 06:38 | hellofunk | true dat, thanks |
| 06:56 | mnngfltg | I always mix up update-in and assoc-in as well |
| 06:57 | mnngfltg | and then I get confused as to why somebody is trying to call my values as a functio |
| 06:57 | mnngfltg | n |
| 07:18 | expez | I'm trying to determine if a macro is in use. If I search for the #"<name>(\b|\B)" am I missing any occurrences of <name>? |
| 07:19 | expez | s/the/the regexp/ |
| 08:06 | hyPiRion | expez: what is the goal of (\b|\B)? Wouldn't that just ensure there's a character after the name itself? |
| 08:06 | expez | it's to eliminate matching 'foo' with 'foobar' |
| 08:07 | expez | \b is word-boundary and \B is non-word-boundary |
| 08:07 | hyPiRion | exactly |
| 08:07 | hyPiRion | ,(re-find #"foo(\b|\B)" "foobar") |
| 08:07 | clojurebot | ["foo" ""] |
| 08:08 | hyPiRion | ,(re-find #"foo\b" "foobar") |
| 08:08 | clojurebot | nil |
| 08:08 | expez | hmm I misread the docs, then |
| 08:08 | expez | I thought a non-word-boundary would be if 'foo' was followed by say ')' or ']' which are non-word characters |
| 08:09 | hyPiRion | expez: oh, I see. I just think \B is the complement of \b |
| 08:09 | hyPiRion | ,(re-find #"foo\b" "(foo)") |
| 08:09 | clojurebot | "foo" |
| 08:10 | hyPiRion | expez: I think #"<name>\b" shouldn't missing any occurrences, but you'd obviously end up with false positives |
| 08:10 | hyPiRion | shouldn't miss* |
| 08:10 | expez | I'm OK with false positives, false negatives would be terrible |
| 08:12 | expez | thanks hyPiRion :) |
| 08:14 | hyPiRion | no problem |
| 08:22 | grumpybat | hi guys, how do I *emit* tagged literals? |
| 08:24 | joegallo | ,(pr (java.util.Date.)) |
| 08:24 | clojurebot | #inst "2014-12-22T13:21:13.221-00:00" |
| 08:24 | grumpybat | joegallo: yep, and what about custom ones? |
| 08:24 | grumpybat | one has to define a writer function or something? |
| 08:24 | joegallo | i was just gonna say something like "i dunno, it just magically works for date and stuff..." |
| 08:25 | joegallo | but yeah, it's possible there's something you need to do, and that it's already been done for you in the case of dates |
| 08:26 | machty | ,(class `(1 2 3)) |
| 08:26 | clojurebot | clojure.lang.Cons |
| 08:26 | grumpybat | well, I didn't find anything about emitting tagged literals, there are only some docs and tutorials on how to parse them |
| 08:26 | machty | ,(class '(1 2 3)) |
| 08:26 | clojurebot | clojure.lang.PersistentList |
| 08:27 | machty | ^ why is one Cons and one persistent list? Also, i thought the job of backtick was to fully qualify symbols, but apparently it also does some implicit `cons` ? |
| 08:36 | TEttinger | ,(str `(1 2 3)) |
| 08:36 | clojurebot | "(1 2 3)" |
| 08:37 | TEttinger | ,(str '(1 2 3)) |
| 08:37 | clojurebot | "(1 2 3)" |
| 08:37 | TEttinger | hm |
| 08:38 | TEttinger | joegallo, there's a way to overwrite the normal print behavior, that I can't remember |
| 08:39 | TEttinger | I made 1d arrays printable with: (defmethod print-dup (Class/forName "[D") [a out] (.write ^java.io.FileWriter out (str "#=" `(double-array ~(vec a))))) |
| 08:40 | TEttinger | ,(defmethod print-dup (Class/forName "[D") [a out] (.write ^java.io.FileWriter out (str "#=" `(double-array ~(vec a))))) |
| 08:40 | clojurebot | #<MultiFn clojure.lang.MultiFn@56a2ed9e> |
| 08:40 | TEttinger | ,(pr (double-array [1.2 3.4])) |
| 08:40 | clojurebot | #<double[] [D@293eaf69> |
| 08:40 | TEttinger | hm |
| 08:41 | joegallo | TEttinger: grumpybat: doesn't look like there's anything magical. it's just print-method https://github.com/clojure/clojure/blob/master/src/clj/clojure/instant.clj#L169-L184 |
| 08:42 | grumpybat | joegallo: rats... looks like kludge |
| 08:44 | TEttinger | you could wrap it of course |
| 08:53 | expez | Bronsa: why does (analyzer.jvm/analyze '(+ 1 unbound)) error? What can I use instead to build an AST that lets me know that 'unbound is in fact an unbound var in this env? |
| 08:54 | Bronsa | expez: https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/validate.clj#L255-L262 |
| 08:55 | Bronsa | expez: you can provide custom pass opts to analyze, https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L435-L437 |
| 08:55 | Bronsa | expez: by default t.a.jvm is a *clojure* analyzer, in clojure an unbound symbol throws an exception |
| 08:56 | Bronsa | expez: if you want to change that behaviour, you'll have to hook in via pass opts, like :validate/unresolvable-symbol-handler |
| 08:57 | expez | Bronsa: Aha. Thanks. So if I want to build an 'extract function' I should use validate with an unresolvable-symbol-handler? |
| 09:00 | Bronsa | expez: yeah. just FYI it might be a bit unpleasant to succesfully use t.a.jvm to analyze expressions that clojure would not be able to evaluate, simply because it wasn't designed with that use-case in mind |
| 09:00 | expez | But is there an alternative? |
| 09:01 | Bronsa | expez: but I know the guys that work on cider have succesfully used t.a.jvm for exactly this use case so it can definitely be done |
| 09:01 | Bronsa | expez: not that I'm aware of |
| 09:01 | expez | cider doesn't use t.a.jvm |
| 09:02 | Bronsa | expez: sorry, refactor-nrepl does |
| 09:03 | expez | mm, which is the project I want to extend with 'extract function' :) |
| 09:04 | expez | https://gist.github.com/74bd3b42968df75f9f24 will I have your attention, what would be the correct way to do this? |
| 09:05 | expez | I ended up just giving up after a while, but it seems to work |
| 09:05 | Bronsa | expez: what should (:type :class) do? |
| 09:05 | expez | I'm trying to find the names of classes that are in use so usage of constructors, methods and static variables |
| 09:07 | expez | (:type :class) is a typo no-op heh |
| 09:08 | Bronsa | expez: I am terribly sorry I have to run away now, if you send me an email with exactly what you're trying to do I'll make sure to reply as soon as I can |
| 09:08 | expez | aight, thanks |
| 10:12 | picasso | sdegutis, arrdem, it is not picasso doing the spamming. there is a spambot named picassoo (two o's). different host. and you'll see that picasso is registered with freenode |
| 10:13 | sdegutis | ha |
| 10:13 | sdegutis | clever bots |
| 10:13 | picasso | anyway, i'll leave to make things easier for ya ;) |
| 10:16 | SagiCZ1 | does anyone feel like this channel is growing quieter last couple weeks? |
| 10:16 | agarman | holidays |
| 10:16 | agarman | it happens |
| 10:17 | SagiCZ1 | i hope that's the reason |
| 10:19 | agarman | Where I am, there are 3 developers in the office, 8 on vacation. This month is so close to zero productivity in the US South that some companies just tell everyone to take the last two weeks off. |
| 10:21 | SagiCZ1 | agarman: where do you live in the south? Texas? |
| 10:24 | justin_smith | SagiCZ1: agarman: similar situation even in the comparatively heathen Pacific Northwest - offices shutting down for two or three weeks around now is not unusual |
| 10:24 | SagiCZ1 | some people were at work today.. but just for 3 hours.. otherwise until last week we worked normally here |
| 10:25 | justin_smith | partially I think it is because it's normal to move so far away from family and still expect to see them regularly |
| 10:25 | SagiCZ1 | justin_smith: is it? why people move so far away? just because they can or because job opportunities? |
| 10:25 | justin_smith | SagiCZ1: it's easy to move between states in the US, and the US is very large |
| 10:26 | SagiCZ1 | it is huge |
| 10:26 | justin_smith | probably work / money related stuff is part of it, yeah. Also the regions are very different, and people find they "fit" better in a different part of the country |
| 10:27 | SagiCZ1 | it's so cool how much diversity you can try out without issues |
| 10:27 | llasram | I think part of it is vacation policies where people lose accumulated unused time off at the end of the year |
| 10:27 | SagiCZ1 | California, Alaska, Texas, New York.. so different |
| 10:28 | justin_smith | SagiCZ1: well "without issues" may be a bit much... the diversity isn't without conflicts |
| 10:28 | SagiCZ1 | no legal issues though.. for us it's very hard to move outside of EU |
| 10:29 | justin_smith | for example, a majority of people are liberal, but because of how pop. density works, a majority of states are conservative, and part of national lawmaking is per-state not per-capita representation |
| 10:29 | SagiCZ1 | that is very interesting.. how come majority of people are liberal and in the elections it is still very equal |
| 10:30 | justin_smith | because electoral votes are not per capita |
| 10:30 | SagiCZ1 | don't you get state representatives according to population count? |
| 10:31 | justin_smith | it is influenced by population, but not strictly representative of population |
| 10:31 | _2_winter | hi |
| 10:31 | justin_smith | otherwise california and new york would control every national election |
| 10:32 | justin_smith | but this is way off topic... |
| 10:32 | SagiCZ1 | yeah sorry, i started the off topic since it was quiet here anyways, thanks for the info though |
| 10:32 | justin_smith | _2_winter: hello |
| 10:38 | justin_smith | SagiCZ1: "For instance, each individual vote in Wyoming counts nearly four times as much in the Electoral College as each individual vote in Texas." http://www.fairvote.org/reforms/national-popular-vote/the-electoral-college/problems-with-the-electoral-college/ |
| 10:38 | SagiCZ1 | how is that fair then? |
| 10:39 | justin_smith | SagiCZ1: arguably it isn't - it was a compromise made for smaller population states when they were convinced to form a national government |
| 10:39 | agarman | it's not fair. it's not supposed to be fair. it's a compromise made to make a federation of states acceptable to states with less population. |
| 10:41 | SagiCZ1 | then again.. does it matter? i feel like americans consider two-party system normal.. but in the democracies in the rest of the world it is common to choose from 4, 5 or even 10 parties.. seems to me that two parties can be very close in their goals, so its not much to choose from.. for example they would be both considered right-wing in traditional EU politics |
| 10:41 | agarman | There are more than two parties in US. It's just that the many smaller parties caucus together under the two party system. |
| 10:44 | SagiCZ1 | i see.. i have never heard of a third party in the US |
| 10:46 | agarman | It's because the two primary parties do what they can to absorb 3rd parties. For a 3rd party to get traction, its goals would have to be so antithetical to the existing two parties that neither could absorb it while still being relevant to a substantial percentage of the electorate. |
| 10:46 | justin_smith | SagiCZ1: bringing this full circle, the project I am working on today is a datomic db of campaign contributions, based on raw data from the Oregon Secretary of State |
| 10:47 | agarman | nice |
| 10:47 | SagiCZ1 | justin_smith: great! so you must undestand the system perfectly |
| 10:47 | justin_smith | currently struggling with normalizing the data and merging duplicate entities |
| 10:47 | justin_smith | SagiCZ1: "understand perfectly" would be a huge overstatement |
| 10:47 | SagiCZ1 | good ol' distinct will solve that i am sure |
| 10:48 | agarman | @SagiCZ1 https://en.wikipedia.org/wiki/Factions_in_the_Republican_Party_(United_States) is a nice article on the factions that make the Republican party. |
| 10:48 | justin_smith | SagiCZ1: campaign a is funded by "Joe Bloggs" campaign b is by "Joe R. Bloggs" - distinct won't help there sadly, sometimes people use variant names... |
| 10:48 | agarman | @SagiCZ1 I don't think anyone has a perfect understanding of US politics because it's truly chaotic. |
| 10:49 | agarman | @justin_smith is this for fun or a work project? |
| 10:49 | justin_smith | work |
| 10:50 | SagiCZ1 | agarman: well i guess that's typical for systems that are brand new.. like java has some things we dont like about it and C# could learn from those mistakes.. people forget that us democracy worked in the same time europe was still in the dark ages almost :) |
| 11:24 | justin_smith | http://i.imgur.com/TChcAwn.jpg |
| 11:49 | hellofunk | SagiCZ1 actually one of America’s most revered presidents also had the largest third-party majority of any election in U.S. history |
| 11:49 | hellofunk | actually, “majority” isn’t the right word, but third party presence |
| 12:24 | EvanR | ,(clojure.string/replace "a \\ b" #"\\" "3") |
| 12:24 | clojurebot | "a 3 b" |
| 12:24 | EvanR | ,(clojure.string/replace "a \\w b" #"\\w" "3") |
| 12:24 | clojurebot | "a 3 b" |
| 12:27 | EvanR | ,(clojure.string/replace "a \\w b" #"\\w" "\\") |
| 12:27 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: character to be escaped is missing> |
| 12:27 | EvanR | ^ |
| 12:28 | EvanR | ,(clojure.string/replace "a \\w b" #"\\w" "\\\\") |
| 12:28 | clojurebot | "a \\ b" |
| 12:28 | EvanR | ffs |
| 12:29 | alejandrozf | Hi!, I want to start making mobile apps but don't like java, do you think clojure would be an option to replace it and could you pointed some links? thanks. |
| 12:35 | xemdetia | alejandrozf, I don't think so. Android is kind of a weird platform to develop for and while eventually you may be able to bring clojure in I would not recommend starting there. |
| 12:38 | justin_smith | EvanR: what are you trying to do? |
| 12:38 | alejandrozf | xemdetia: well, thanks for your reply but how I can avoid Java then? |
| 12:38 | xemdetia | alejandrozf, are you trying to develop for android? |
| 12:38 | justin_smith | alejandrozf: I have heard of good results targetting clojurescript to rhino on android though |
| 12:39 | justin_smith | but cljs is a bit more complex to get set up |
| 12:39 | alejandrozf | xemdetia: yes, but TOTAL newbie in mobile... |
| 12:39 | EvanR | justin_smith: replace backslash K with backslash, for some letter K |
| 12:40 | alejandrozf | thanks justin_smith |
| 12:41 | xemdetia | alejandrozf, I would definitely just suck it up and start with java. The core of the system is built on java and you need to know how that works to be successful. It's not like developing on a normal PC by any stretch as many of the rules are different. Get your sea legs first because you may end up having to write a lot of interface code even if you do use another language |
| 12:42 | xemdetia | There's also the cljs route, or you can try xamarin or phonegap or one of the other things that attempt to target mobile as a universal platform |
| 12:42 | justin_smith | EvanR: backslash prints as \\ in strings |
| 12:42 | EvanR | yes |
| 12:42 | justin_smith | ,(println "hello\\") |
| 12:42 | clojurebot | hello\\n |
| 12:42 | justin_smith | ,"hello\\" |
| 12:42 | clojurebot | "hello\\" |
| 12:42 | EvanR | thats fine, though im not printing anything |
| 12:42 | EvanR | im trying to replace |
| 12:43 | justin_smith | EvanR: point is, the string will look like \ is doubled - that's just the escaping |
| 12:43 | justin_smith | sorry, the println obscured what I meant |
| 12:43 | justin_smith | ,(println "hello \\ backslash") |
| 12:43 | clojurebot | hello \ backslash\n |
| 12:43 | EvanR | correct, my problem was not interpreting the rendering of the result |
| 12:43 | justin_smith | so you got the right result with "a \\ b" that is a single backslash |
| 12:43 | justin_smith | gotcha, so we both understand now :) |
| 12:44 | EvanR | ,(clojure.string/replace "a \\w b" #"\\w" "\\\\") ; this is the final version |
| 12:44 | clojurebot | "a \\ b" |
| 12:44 | EvanR | the set of four backslashes was what was throwing me off |
| 12:45 | alejandrozf | thanks xemdetia, l like a lot Lisp dialects so I imagined clojure, abcl, kawa or something else would be an option :( |
| 12:45 | justin_smith | yeah, because the replacement string is interpreted specially (so you can use \1 etc. for match interpolation) |
| 12:45 | EvanR | one more gotcha like this and backslash will have to be specified by typing eight backslashes |
| 12:45 | justin_smith | haha |
| 12:45 | TimMc | leaning toothpicks |
| 12:45 | EvanR | when all i want is to replace one string with another |
| 12:45 | zB0hs | is there any different between (-> q -.target -.previousSibling -.value) and (.-value (.-previousSibling (.-target q))) |
| 12:45 | TimMc | I've had to do eight before. |
| 12:46 | EvanR | for a generic code that replaces one string with another, you have to run the replacement through an escape? |
| 12:47 | justin_smith | EvanR: then why not ##(.replace "a \\w b" "\\w" "\\") no regexes |
| 12:47 | lazybot | ⇒ "a \\ b" |
| 12:47 | justin_smith | if all you want is exact matches, I suggest just using .replace |
| 12:47 | EvanR | good |
| 12:49 | xemdetia | alejandrozf, eventually maybe but Java is basically the C of what you are normally allowed to touch on Android. If you are just getting started I would work with that because even in my idle experimentation you can and will run into a lot of silly edge cases. Once you know? sure do it in a different language, but there is a lot of tribal knowledge you kind of need for Android. |
| 12:49 | EvanR | im surprised #"\\w" isnt the regex for any word character |
| 12:51 | justin_smith | also, android is not quite complient java implementation - or is at least a weird one |
| 12:51 | TimMc | &(re-seq #"\w" "a1_- ^") |
| 12:51 | lazybot | ⇒ ("a" "1" "_") |
| 12:51 | TimMc | EvanR: Depends how you define "word character". |
| 12:51 | EvanR | oh |
| 12:51 | TimMc | and it's \\w |
| 12:51 | TimMc | ugh |
| 12:51 | EvanR | inside # one \ |
| 12:52 | TimMc | Yeah, #"" takes care of one level of backslashes for you. |
| 12:52 | justin_smith | scsh style sexp regex syntax anyone? |
| 12:52 | TimMc | justin_smith: Yes please. |
| 12:52 | EvanR | confucius |
| 12:53 | TimMc | justin_smith: At least as an option to turn to for uglier ones. |
| 12:53 | alejandrozf | xemdetia, justin_smith and Java is "almost The C" for other mobile platforms too? |
| 12:53 | justin_smith | http://srfi.schemers.org/srfi-115/srfi-115.html |
| 12:53 | justin_smith | alejandrozf: not really - each has its own favored native layer, with very little compatibility |
| 12:54 | justin_smith | TimMc: yeah, I also think regex sexps would be worth implementing |
| 12:54 | justin_smith | maybe when I free up some time in my "cool project" roster... |
| 12:56 | justin_smith | google says "sre scheme regex +clojure" |
| 12:56 | justin_smith | err, no results for that is |
| 13:05 | justin_smith | gfredericks: do you think any of your work with regexes would be helpful in implementing this regex construction syntax in clojure? http://srfi.schemers.org/srfi-115/srfi-115.html |
| 13:07 | andyf | EvanR: Regarding your difficulties with replacements involving backslashes, I?ve tried to make the doc string for clojure.string/replace as explicit as I can for these cases, but it does require careful reading. |
| 13:07 | andyf | The simplest thing for constant strings to replace is not to use regex?s. |
| 13:08 | EvanR | i knew that, but im not at the point where i think to use anything in java for anything |
| 13:08 | EvanR | some basic operations seem to be provided by the "host" system |
| 13:09 | EvanR | and youre expected to use them directly rather than through a standard interface |
| 13:09 | justin_smith | EvanR: yeah, seeing interop as "idiomatic" was a big jump for me, but it can really help with getting things done cleanly, funny enough |
| 13:10 | justin_smith | actually, it was amalloy that finally convinced me of that |
| 13:10 | andyf | EvanR: I don't understand why you say that. How does having clojure.string/replace available mean that Clojure is expecting you to use Java APIs? |
| 13:10 | justin_smith | (inc amalloy) |
| 13:10 | lazybot | ⇒ 208 |
| 13:11 | EvanR | andyf: as you said, i shouldnt be trying to use regex at all so its moot that its available |
| 13:12 | justin_smith | actually yeah, if you don't feed it regex, things do just work ##(clojure.string/replace "a \\w b" "\\w" "\\") |
| 13:12 | lazybot | ⇒ "a \\ b" |
| 13:12 | EvanR | a doc that said "use .replace, not replace and not clojure.string/replace for what you want" somehow... |
| 13:12 | justin_smith | EvanR: see above - just not using a regex is also an option (I had forgotten) |
| 13:12 | EvanR | ok, more magic |
| 13:12 | EvanR | well .replace is shorter |
| 13:13 | justin_smith | EvanR: not magic, type dispatch. Regex and String are not the same type |
| 13:13 | andyf | The doc for clojure.string/replace pretty clearly says that a pattern of a string and replacement of a string is supported, and in that case both are treated literally |
| 13:13 | EvanR | its never magic, im just lashing out at the overloading |
| 13:13 | EvanR | its a huge doc string with poor formating i didnt even really read it |
| 13:14 | andyf | Funny. That is the opposite complaint of most people about Clojure doc strings (i.e. "too long") |
| 13:14 | EvanR | the name of the the function, clojure.string/replace (which i used a total of 6 times in a row, then required me to fidding with the namespacing which i failed to do, because of "replace" already existing, so .replace is a great way out of this |
| 13:16 | EvanR | actually its not that long, thought it was at least a page |
| 13:17 | andyf | 20 lines is a page? |
| 13:17 | EvanR | the thing before or after this i was looking at was the height of my monitor |
| 13:19 | andyf | Anyway, carry on. The overloading of replace and replace-first behaviors depending upon argument types can be confusing. Just avoid regex if you don't need them. And if you do, consider using re-quote-replacement on the replacement string to avoid the first issue you brought up. |
| 13:20 | EvanR | yes, avoiding regex |
| 13:25 | alejandrozf | xemdetia: xamarin is opensource? |
| 13:29 | xemdetia | alejandrozf, I do not think so. I just mention it because it is the top of my mind and it uses C# instead |
| 13:30 | alejandrozf | xemdetia: ok, thanks again :) |
| 13:34 | EvanR | is there an nth which gives nil instead of an exception |
| 13:34 | justin_smith | in order to target all those platforms, I assume it must be using the open source mono stack though (who knows how this turns out now that the clr is open sourcing though) |
| 13:34 | EvanR | ,(nth [1 2 3] 3 nil) |
| 13:34 | clojurebot | nil |
| 13:34 | EvanR | nvm |
| 13:37 | xemdetia | justin_smith, yes I know they are using mono but I don't know how open source it is as an overall whole. I haven't used it- I just have the t-shirt and it was in my laundry this morning |
| 13:39 | Glenjamin | is there a good way to "bail out" of a threading macro? |
| 13:40 | Glenjamin | eg, I want to put an error check halfway down, and not perform the other operations if that's the case |
| 13:42 | Glenjamin | hrm, actually in this case it makes more sense to throw an exception anyway |
| 13:42 | TimMc | Just use goto. |
| 13:44 | Glenjamin | the proper fix is really to separate the "did this work?" part from the "grab an ID out of the response" part |
| 13:45 | Glenjamin | haven't touched this code for a year, so will probably do that after i've warmed up a bit |
| 13:45 | TimMc | Glenjamin: If you don't need extra info, you can yield nil and use some-> |
| 13:45 | EvanR | there can be many levels of correctness the data can be at |
| 13:45 | Glenjamin | i wanted to capture the error message |
| 13:50 | gfredericks | justin_smith: so that's an sexp-based regex thing? is that the main point? |
| 14:04 | justin_smith | gfredericks: yeah, so that you can use macros and standard collection functions etc. to construct and compose regexes |
| 14:04 | justin_smith | gfredericks: may be totally unrelated to what you were doing though |
| 14:05 | daniel_ | im sending a delete request to a liberator resource, :delete! is never called only :handle-ok |
| 14:05 | justin_smith | gfredericks: or maybe after going so deep into regex stuff you would either say "that would be some much better" or "that would be a pointless waste of time" |
| 14:06 | justin_smith | gfredericks simulator: ##(rand-nth ["greate idea" "pointless waste of time"]) |
| 14:06 | lazybot | ⇒ "greate idea" |
| 14:06 | justin_smith | haha, the typo makes it better |
| 14:07 | xemdetia | This should be the standard of all new feature libs |
| 14:07 | joobus | using xamarin requires a license to be able to compile builds, fyi |
| 14:08 | joobus | i currently use xamarin, if there are questions about it |
| 14:09 | xemdetia | sdegutis, somebody asked about starting android development with clojure as a complete novice to avoid using Java |
| 14:09 | sdegutis | ok |
| 14:10 | sdegutis | We really are fortunate. So many people are being killed and abused and starving, and we're faced with the task of choosing which language we prefer to use to write a mobile app. |
| 14:10 | EvanR | so what interface does empty? require, ISeq? how do i test if something can be empty?ed |
| 14:11 | EvanR | sequential and seq both seem to give false negatives |
| 14:13 | justin_smith | (source empty?) |
| 14:13 | sdegutis | (doc empty?) |
| 14:13 | clojurebot | "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))" |
| 14:13 | alejandrozf | yes, was me :), I was reading a lot about xamarin, think I don't like it, looking now for Phonegap |
| 14:14 | justin_smith | anyway, it comes out to "(fn [coll] (not (seq coll)))" |
| 14:14 | EvanR | what can be seqed |
| 14:14 | justin_smith | that's tricky actually - all the collections, plus string and maybe something else I am forgetting |
| 14:15 | EvanR | ,(seq? {}) |
| 14:15 | clojurebot | false |
| 14:15 | joobus | if you are not intending to compile code to multiple platforms, don't use xamarin. |
| 14:15 | EvanR | ,(instance? ISeq {}) |
| 14:15 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ISeq in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:15 | justin_smith | http://stackoverflow.com/questions/4019249/clojure-finding-out-if-a-collection-is-seq-able |
| 14:15 | justin_smith | EvanR: it's not a question of being seq, but being seqable |
| 14:15 | justin_smith | ,(seq "hello") |
| 14:15 | EvanR | ,(seqable? {}) |
| 14:15 | clojurebot | (\h \e \l \l \o) |
| 14:15 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:16 | justin_smith | EvanR: see my SO link above regarding seqable |
| 14:16 | EvanR | clojure.contrib.core |
| 14:16 | justin_smith | right, don't use contrib, but the info there should let you know what can be seqed |
| 14:16 | justin_smith | or you can just steal that one function |
| 14:17 | EvanR | for my case i know a subset of these is all ill encounter, so i can or it |
| 14:26 | alejandrozf | joobus: HTML5 solutions aren't enougth for "multiplatform" mobile devices? |
| 14:30 | justin_smith | alejandrozf: well, that's what phonegap is about, right? |
| 14:30 | daniel_ | im sending a delete request to a liberator resource, :delete! is never called only :handle-ok |
| 14:31 | alejandrozf | justin_smith, yes I'm walking this way :) , what do you think? |
| 14:38 | justin_smith | alejandrozf: I have not tried it, but have strongly considered it (and have worked with frontend people who did similar stuff with things in the site / app uncanny valley) |
| 14:38 | justin_smith | it seems like cljs/om would be an awesome way to make an html5 app (depending on what kind of UI / UE you need of course) |
| 14:40 | alejandrozf | justin_smith: thanks! cljs == clojurescript, but om == ? |
| 14:41 | justin_smith | alejandrozf: om is dnolen_ 's cljs lib wrapping react (which offers cool things leveraging react that react can't do on its own) |
| 14:41 | justin_smith | and react is a facebook UI lib for js |
| 14:42 | alejandrozf | justin_smith: ahh! seems nice! |
| 14:44 | quizdr | yeah |
| 14:44 | atyz | Does anyone have an opinion on this library? https://github.com/ptaoussanis/timbre |
| 14:46 | arrdem | timbre is ok |
| 14:46 | tcrayford____ | atyz: I've used it in the past. These days I just lean for println (with a wrapper to prevent the race conditions in clojure's println) |
| 14:46 | justin_smith | atyz: it works, sometimes I wish it did not have a global config |
| 14:46 | atyz | arrdem: have you used it in production? |
| 14:47 | atyz | justin_smith: they way it does configs is weird. Are you expected to initialize your config on app startup? |
| 14:47 | justin_smith | atyz: you can modify the config at any time, it's just that there is only one global config |
| 14:48 | arrdem | atyz: yeah it's running on http://conj.io right now. |
| 14:49 | atyz | justin_smith: Im confused as to how you set your global config? It doesn't seem like it reads from a file. Which means I'll be setting it in a function on app startup |
| 14:50 | atyz | The profiling part of this library also seems rather foreign? It seems like something that could be a separate library |
| 14:50 | dnolen_ | hrm how do you get lein to print the jvm command it will run with the classpath, options etc.? |
| 14:50 | arrdem | atyz: it has a single var.. I forget whether it's an atom or a dynamic var, that's used to store a single logging configuration for your entire application. |
| 14:50 | justin_smith | dnolen_: :eval-in pprint |
| 14:50 | arrdem | atyz: this means you can't have "logging contexts" that behave differently nicely. |
| 14:51 | atyz | arrdem: in teh docs it just looks like a regular var |
| 14:51 | atyz | But I'm unsure of how I'm supposed to globally set this |
| 14:52 | atyz | I would have probably had it read from a file and allowed the overwrites of the config when needed |
| 14:52 | atyz | But maybe I'm thinking about this wrong |
| 14:53 | justin_smith | dnolen_: that is, just adding :eval-in pprint at the top level, outputs all that stuff instead of running your app with lein run |
| 15:02 | beppu | Is http://tryclj.com/ working for everyone else? I'm trying to defn a function, but I can't seem to call it. |
| 15:05 | justin_smith | beppu: http://i.imgur.com/hlXIv8T.png |
| 15:07 | justin_smith | beppu: "The interpreter deletes the data that you enter if you define too many things, or after 15 minutes" |
| 15:08 | beppu | justin_smith: Yeah, it was working for me earlier today and then it stopped. Do I have to clear my session cookies? |
| 15:09 | beppu | justin_smith: clearing my cookies for tryclj.com made it work again. |
| 15:10 | dnolen_ | justin_smith: thanks |
| 15:16 | daniel_ | im sending a delete request to a liberator resource, :delete! is never called only :handle-ok, anyone have any idea why that would be? |
| 15:25 | mgaare | daniel_: if you turn debugging on, you can see the decision tree in the headers of the response |
| 15:25 | daniel_ | magnars: interesting, thanks |
| 15:25 | daniel_ | forgot about that |
| 15:29 | daniel_ | weird, no headers for the delete request |
| 15:29 | borkdude | I need to save a hashmap with one of the values being a byte array into a file for export and importing, any best practices here? |
| 15:29 | daniel_ | but for get i see them |
| 15:29 | mgaare | borkdude: could look at Fressian |
| 15:29 | borkdude | I could maybe base64 encode the bytes and save it just as a string |
| 15:31 | justin_smith | borkdude: yeah, round tripping via base64 is how I would do it |
| 15:31 | mgaare | daniel_: none at all? perhaps it's not hitting liberator? |
| 15:32 | daniel_ | mgaare: i think its with my route definitions |
| 15:32 | daniel_ | i have /api/files defined but not /api/files/:id for delete |
| 15:32 | mgaare | ah |
| 15:33 | daniel_ | im used to having a resource define all the different http methods and know what the singular routes should be |
| 15:34 | daniel_ | i guess this isnt the liberator way, most example i see define separate list and detail resources |
| 15:35 | daniel_ | indeed mgaare, it was missing the route |
| 15:35 | daniel_ | it kind of pains me to have to write all the routes explicitely for CRUD endpoints |
| 15:37 | justin_smith | daniel_: can you sub in a data driven function instead of defresource? I guess at worst you could write a macro that ingests a big data structure describing endpoints and calls defresource on them |
| 15:48 | daniel_ | justin_smith: indeed i could, i will try and do something along those lines |
| 15:51 | bacon198` | so what's this talk about clojure 1.7 having seamless files between clojure, clojurescript, and clojureclr? |
| 15:51 | justin_smith | daniel_: this was a big motivator in our design of caribou - we ended up replacing compojure so that it would be easier to define routes programmatically based on data in the CMS |
| 15:53 | badyl | hi, can someone tell me how I could integrate an app written with Stuart Sierra's component and compojure to be run as a war/servlet app? |
| 15:53 | bacon198` | *feature expressions* |
| 15:53 | badyl | I was searching the internet but couldn't find any examples. The name of the framework/library don't help with googling :) |
| 15:59 | borkdude | nice, fressian works well |
| 16:04 | mgaare | daniel_: with liberator, I think it's idiomatic to define routes with ALL and let liberator handle the logic for the different verbs |
| 16:06 | mgaare | badyl: do you have a hook to run a main function in your container? |
| 16:06 | mgaare | I only know how to do this in immutant |
| 16:08 | badyl | mgaare: I think it would try to start another web server in the war container |
| 16:09 | badyl | I was thinking about having compojure routes a reference to a "business" or "logic" component from the system object and calling fuctions with that component |
| 16:09 | badyl | so basically the "web" part wouldn't be part of my "componentized" system |
| 16:14 | phood | ∞ |
| 16:14 | mgaare | badyl: I think the idiomatic way to this is define a 'web app' component that has the web handler, and has dependencies on whatever other components you need. on startup, it wraps the handler in some middlewares that add the other components to the request map, and the resulting handler is what you'd pass to the container as the web handler |
| 16:16 | mgaare | stuart talked about this in one of the presentations he did on it |
| 16:18 | badyl | mgaare: thanks for the pointers |
| 16:18 | badyl | I will take a look |
| 16:20 | danielszmulewicz | badyl: Have a look at the example directory in https://github.com/danielsz/system |
| 16:24 | badyl | danielszmulewicz: thanks, I will check it out |
| 16:25 | badyl | danielszmulewicz: can the example project produce a war that can be deployed in servlet container? |
| 16:28 | badyl | danielszmulewicz: I would like to build with lein-ring and its uberwar task |
| 16:28 | danielszmulewicz | badyl: Yes, no reason it wouldn't. It's a standard ring handler. So standard leiningen practices apply. |
| 16:30 | badyl | danielszmulewicz: thanks again, I will try it |
| 18:05 | EvanR | can i get a [a & b] binding to set b to () when binding a singleton list |
| 18:05 | amalloy | EvanR: no, you get nil |
| 18:05 | EvanR | i see that |
| 18:05 | amalloy | that is what you are stuck with. why do you need an empty list instead? |
| 18:06 | EvanR | if i change my check from empty? to nil? i will silently accept bugs that produce nils |
| 18:06 | EvanR | im less likely (maybe?) to get accidental () |
| 18:07 | amalloy | EvanR: so don't destructure it before testing it |
| 18:07 | EvanR | yeah i was just wondering if there was a less verbose way |
| 18:08 | EvanR | seems natural to me, but obviously nil is more natural to some people |
| 18:09 | EvanR | i.e. "in & a, a contains the list of remaining elements", well its not so simple |
| 18:10 | amalloy | EvanR: personally, i would rather that &a were set to () instead of nil, for different reasons |
| 18:10 | amalloy | but it doesn't, and it's way too late to change |
| 18:11 | m1dnight_ | is there a particular reason there is no set! in clojure? |
| 18:11 | m1dnight_ | I was just wondering :) |
| 18:11 | m1dnight_ | like in scheme you can set let bindings and stuff |
| 18:11 | EvanR | there is set! |
| 18:11 | EvanR | but not for let bindings |
| 18:11 | amalloy | m1dnight_: because immutability is a big deal |
| 18:11 | m1dnight_ | i understand yes |
| 18:12 | m1dnight_ | so its more of a way to force functional style? |
| 18:12 | EvanR | not being able to mutate lexical bindings makes me feel better |
| 18:12 | EvanR | you can still do it by using a mutable variable explicitly, like a ref or atom |
| 18:13 | EvanR | or the java array trick |
| 18:14 | amalloy | or also ztellman/proteus, for the real bad boys of clojure |
| 18:17 | m1dnight_ | yeah or you could do a deftype of a node for a list and stuff |
| 18:17 | m1dnight_ | i tried it once but it's just nasty |
| 18:19 | gfredericks | justin_smith: yeah, probably unrelated; most of what I've been doing has been parsing string representations, and learning jvm quirks and unicode stuff |
| 18:34 | justin_smith | gfredericks: if I can pull myself away from my awesome new microphones, I may just try implementing something like resexps |
| 18:35 | m1dnight_ | guys, what happens if an expression throws an error in a binding (threadlocal var), does the binding remain in the handling of the catch? |
| 18:35 | m1dnight_ | I can't think of a quick and easy test scenario :p so perhaps somebody could tell me |
| 18:36 | m1dnight_ | otherwise ill mock something up |
| 18:36 | m1dnight_ | wait, nvm |
| 18:36 | EvanR | x=crash, catch print x ? |
| 18:36 | gfredericks | justin_smith: it'd be fun I'm sure, and you could even generalize it to sequences of arbitrary things |
| 18:36 | EvanR | twilight zone |
| 18:37 | gfredericks | justin_smith: and if you do that, make sure to compile to test.check generators too |
| 18:37 | justin_smith | ohhh yeahhh.... |
| 18:38 | EvanR | in prismatic schema, is it possible to specify a non-empty list |
| 18:38 | gfredericks | with pred at least |
| 18:38 | gfredericks | EvanR: ^ |
| 18:38 | EvanR | ok |
| 18:39 | m1dnight_ | damnit, the binding is lost |
| 18:39 | m1dnight_ | to the thinkmobile then :( |
| 18:40 | amalloy | m1dnight_: it sounds like the things you are trying to figure out how to do might be evil and misguided |
| 18:40 | amalloy | instead of focusing on this one particular approach to solving your problem, perhaps think more about what your problem actually is, so you can find an approach that's less awful |
| 18:41 | m1dnight_ | amalloy: well, it's for my thesis and im guessing that if somebody read my code a few people would be turning in their graves, i admit that :p |
| 18:41 | m1dnight_ | I'm trying to implement something like transactors in clojure |
| 18:41 | {blake} | Satanic doctorates. |
| 18:42 | m1dnight_ | the gist of it is that I have macro receive and I can nest them (like erlang) like (receive [:message] (something) (receive [:inner] (code))) |
| 18:43 | m1dnight_ | and when the sending actor fails it propagates to all receiving actors |
| 18:43 | SagiCZ1 | how could i use clojure to create simple webpages for my own blogging purposes? i am new to this |
| 18:43 | m1dnight_ | but when :message is received from actor A, and :inner from B, suppose that A fails. then I have to throw the "ParentFail" exception. However, this happens in the inner receive. so I have to propagate the error through to the outer receive |
| 18:44 | hellofunk | SagiCZ1: you could play with Ring and host some static pages somewhere, or you could write a postgres app on heroku which would get you in deeper to backend clojure work |
| 18:44 | m1dnight_ | so if I could handle the error inside the (binding [*sending-context*]..) then I would be out of the woods |
| 18:44 | SagiCZ1 | hellofunk: and what about clojurescript? can i throw that in too? |
| 18:44 | {blake} | SagiCZ1: There are some tutorials online that show blogging as an example. |
| 18:45 | hellofunk | SagiCZ1: blogging usually refers to a server-side setup that is separate from the front end, but of course cljs is great for front end work too |
| 18:45 | {blake} | SagiCZ1: I wouldn't throw in ClojureScript at first. It's a fair-sized chunk just for the server-sde stuff. |
| 18:45 | hellofunk | or you could broaden you pool of web hosts and forget about a clojure server end and just use cljs to host the entire blog in the browser. |
| 18:45 | SagiCZ1 | what database would i use for storing the stuff? |
| 18:46 | hellofunk | SagiCZ1: depends on the server you use. Heroku uses postgres |
| 18:46 | arrdem | With Ring, is there a good hack for updating a parameter in a request and then retrying the request? |
| 18:47 | arrdem | it seems like (handler (update-in req ..)) should work. |
| 18:47 | {blake} | arrdem: That would've been my guess =P |
| 18:48 | arrdem | :c well that's what I've got going on right now in my REPL and it's not behaving as expected so.. |
| 18:49 | {blake} | arrdem: Huh. How is it different from, say, logging in? Like, I use "(assoc (resp/redirect "/") :session {:user username})" to do that. |
| 18:49 | m1dnight_ | I just found a tutorial on a blog in clojure on a website on christianity and clojure. That's a combo you don't see every day. |
| 18:49 | {blake} | Rich Hickey died for your stateful sins. |
| 18:50 | arrdem | {blake}: I suspect there are some headers I'm not reseting or something. |
| 18:51 | TimMc | {blake}: Heart attack before I finished reading your msg, man. |
| 18:52 | {blake} | arrdem: Well, I'm just getting the hang of it myself. :-/ |
| 18:52 | {blake} | TimMc: lol...sorry...it was in poor taste. |
| 18:52 | EvanR | the best kind of taste |
| 18:53 | {blake} | If it wasn't for bad taste, I'd have no taste at all. |
| 18:53 | TimMc | {blake}: I think it was fine in context, I was just reading scrollback backwards. :-P |
| 18:53 | {blake} | heheh the hazards of time travel |
| 18:53 | TimMc | Rich Hickey fell out of a hammock several times for your sins. |
| 18:54 | {blake} | Doesn't sound like much but it's a lot of bruising when you consider how many of us there are. |
| 18:57 | arrdem | Hah gotit! |
| 18:57 | {blake} | And? |
| 18:58 | arrdem | there was some routing stuff you had to dissoc out of the map |
| 18:59 | arrdem | but we were basically there |
| 18:59 | {blake} | Cool. Interesting. |
| 19:15 | arrdem | Grimoire 0.4.5 up, now with an official API driver: https://github.com/clojure-grimoire/lib-grimoire |
| 19:27 | dbasch | {blake}: Rich Hickey is immortal. Dying would require changing state. |
| 19:28 | {blake} | dbasch: I assume he's declared as an atom. |
| 19:29 | EvanR | hes in a singleton java array |
| 19:29 | amalloy | maybe that's why he's always telling us not to use too many atoms? highlander-style, there can be only one |
| 19:33 | gfredericks | ,(nth (iterate atom 42) 7) |
| 19:33 | clojurebot | #<Atom@51158898: #<Atom@4c76ae6e: #<Atom@6923e1ad: #<Atom@5def363a: #<Atom@20c33457: #<Atom@59bffbff: #<Atom@2fe747ec: 42>>>>>>> |
| 19:34 | amalloy | oh interesting, that's not impacted by *print-level* |
| 19:34 | EvanR | nooo youll run out |
| 19:34 | amalloy | er, *print-depth*? |
| 19:34 | amalloy | whatever it is |
| 19:34 | gfredericks | clojurebot: swap-in! is like update-in but for nested atoms |
| 19:34 | clojurebot | Ack. Ack. |
| 19:36 | arrdem | gfredericks: |is| |
| 19:39 | gfredericks | ~swap-in! |
| 19:39 | clojurebot | swap-in! is like update-in but for nested atoms |
| 19:39 | gfredericks | arrdem: what would that accomplish? |
| 19:40 | amalloy | gfredericks: it's voodoo for wimps who don't know how clojurebot works as well as you do |
| 19:50 | gfredericks | clojurebot: foo? is an experiment |
| 19:50 | clojurebot | A nod, you know, is as good as a wink to a blind horse. |
| 19:51 | gfredericks | ~foo?? |
| 19:51 | lazybot | gfredericks: What are you, crazy? Of course not! |
| 19:51 | clojurebot | foo? is an experiment |
| 19:51 | gfredericks | this is the weirdest AOL chat room I've ever been in |
| 19:58 | amalloy | gfredericks: i'd be surprised if there weren't |
| 20:00 | amalloy | gfredericks: i'm trying to find this interesting article i read a few months ago about how AOL didn't want AIM to succeed |
| 20:00 | gfredericks | do they still have a web browser that I can download from my physical mailbox? |
| 20:02 | amalloy | gfredericks: found it! http://mashable.com/2014/04/15/aim-history/ |
| 20:04 | gfredericks | amalloy: cool, thanks |
| 20:13 | gfredericks | I'm having a hard time not seeing this regex-feature-nobody-uses as super buggy |
| 20:14 | gfredericks | ,(re-matches #"[x&&[x]]" "x") |
| 20:14 | clojurebot | "x" |
| 20:14 | gfredericks | ,(re-matches #"[x&&[x]y]" "x") |
| 20:14 | clojurebot | nil |
| 20:14 | gfredericks | ^ there's just no excuse for that |
| 20:14 | gfredericks | and nothing in the spec that suggests you can't do it |
| 20:15 | amalloy | gfredericks: is there anything in the spec at all? |
| 20:15 | gfredericks | the Pattern.java docs I mean |
| 20:16 | gfredericks | their only example for using intersection is: [a-z&&[aeiou]] |
| 20:16 | amalloy | well maybe that's the only way you're supposed to use it |
| 20:16 | amalloy | ruby is the only other engine that supports this feature, right? is theirs documented? |
| 20:17 | gfredericks | they talk about them as "operators" with "precedence" |
| 20:17 | amalloy | ... |
| 20:17 | gfredericks | looks like it |
| 20:17 | amalloy | gfredericks: i know you've read http://www.regular-expressions.info/charclassintersect.html, but have you read it recently? |
| 20:17 | gfredericks | ruby's example in fact is /[a-w&&[^c-g]z]/ # ([a-w] AND ([^c-g] OR z)) |
| 20:18 | amalloy | specifically, "Intersection of Multiple Classes" |
| 20:18 | gfredericks | which they claim is equivalent to /[abh-w]/ |
| 20:18 | gfredericks | "Java has bugs" is what that link says :) |
| 20:19 | gfredericks | so...right then. |
| 20:20 | amalloy | is your goal with this still to produce a test.check generator from an arbitrary regex? |
| 20:21 | gfredericks | yes |
| 20:21 | gfredericks | well |
| 20:21 | gfredericks | or to tell you if I can't/won't |
| 20:21 | gfredericks | which applies here |
| 20:22 | gfredericks | but I gotta determine the scope of the bug so I can recognize it |
| 20:22 | amalloy | (regex-gen #"[x&&[x]y]") ;=> "c'mon man, y u do dis" |
| 20:23 | gfredericks | e.g. (regex-gen #"[a&&b]") throws an exception since it's unmatcheable |
| 20:25 | TEttinger | I would just not implement that particular regex feature |
| 20:25 | TEttinger | if it has && or ||, it fails the test |
| 20:25 | TEttinger | because it will in practice |
| 20:26 | gfredericks | but it's so easy to implement the non buggy cases :P |
| 20:26 | amalloy | i don't think || exists, TEttinger |
| 20:26 | gfredericks | || is implicit |
| 20:26 | TEttinger | good |
| 20:26 | gfredericks | oh man http://stackoverflow.com/questions/21934168/bug-in-double-negation-of-regex-character-classes |
| 20:26 | gfredericks | TEttinger: I'd consider that but there's actually a few things that are difficult to express without && |
| 20:27 | gfredericks | I think. |
| 20:27 | gfredericks | don't ask me for an example. |
| 20:29 | amalloy | gfredericks: i dunno, isn't #"[a&&b]" equivalent to like #"(?=[a])(?=[b])." for any a/b? |
| 20:30 | gfredericks | huhwhat? |
| 20:30 | gfredericks | I'm saying it's an empty character class, I can't tell if you're contradicting that or not |
| 20:31 | gfredericks | or you're arguing that it's expressable with lookahead |
| 20:31 | amalloy | gfredericks: i'm using a and b as variables here, not literal characters a and b |
| 20:31 | gfredericks | ok |
| 20:31 | gfredericks | well I don't support lookahead anyhow so :P |
| 20:31 | amalloy | !!!!!! |
| 20:31 | gfredericks | patches welcome |
| 20:31 | amalloy | that feature is way more important than this intersection bullshit |
| 20:31 | TEttinger | lookahead sounds much more important than intersection agreed |
| 20:31 | TEttinger | (inc amalloy) |
| 20:31 | lazybot | ⇒ 209 |
| 20:32 | TEttinger | it's probably used at least two orders of magnitude more frequently |
| 20:32 | amalloy | like, i can get behind skipping lookahead because it's hard |
| 20:32 | gfredericks | I don't doubt that |
| 20:32 | amalloy | it doesn't need to be perfect to be useful |
| 20:32 | gfredericks | but implementing it is harder |
| 20:32 | gfredericks | at least in a solid way |
| 20:32 | amalloy | but supporting intersected character classes is something i would drop way before that |
| 20:32 | amalloy | because nobody in the world will ever use that feature, and if they do you should shoot them |
| 20:33 | gfredericks | but I've spent so much time on them so far, so the sunk cost falacy says I have to press on |
| 20:33 | amalloy | well, no arguing with that |
| 20:33 | amalloy | if only you could lookahead in your own life, and see the further sunk costs coming |
| 20:33 | gfredericks | alright fine you've convinced me |
| 20:33 | TEttinger | clojurebot: character class intersection |is| <amalloy> because nobody in the world will ever use that feature, and if they do you should shoot them |
| 20:33 | clojurebot | Alles klar |
| 20:33 | gfredericks | now how do I do lookahead |
| 20:34 | TEttinger | check java's impl first? |
| 20:34 | gfredericks | for what? |
| 20:34 | TEttinger | lookahead |
| 20:34 | gfredericks | and do what with that? |
| 20:34 | amalloy | TEttinger: remember he's doing it in reverse |
| 20:34 | TEttinger | eh? amalloy? |
| 20:34 | amalloy | gfredericks: man, i dunno. i'd support it by not supporting it, but i don't know anything about your implementation |
| 20:35 | amalloy | i'm just saying if you are willing to drop features at all (and like i said, dropping support for lookaround seems fine), you might as well drop intersection |
| 20:36 | amalloy | TEttinger: he is not writing a regex matcher, but a regex generator: given a regex, produce strings that it matches |
| 20:36 | TEttinger | ok |
| 20:36 | gfredericks | it's actually probably easy |
| 20:37 | gfredericks | to do rudimentary lookahead |
| 20:37 | gfredericks | well no wait positive is hard |
| 20:37 | gfredericks | negative is easy, just filter |
| 20:37 | gfredericks | which has its own thorns but is good enough to start with |
| 20:37 | gfredericks | but positive lookahead sounds sooper hard |
| 20:37 | amalloy | gfredericks: well, both sorts of lookahead have the problem that the most obvious way to solve them involves a lot of luck |
| 20:38 | amalloy | like, #"(?=a)(?=b)." |
| 20:38 | gfredericks | amalloy: yeah I guess they are the same, negative just seemed like it required less luck in common cases |
| 20:38 | amalloy | it's pretty hard to see that this will never match |
| 20:38 | gfredericks | but I don't actually know much about common cases |
| 20:38 | gfredericks | heck I'd have to implement a generic matcher :P or just compile a subset of the regex via the jvm |
| 20:39 | gfredericks | yep I give up |
| 20:44 | numberten | is there a 'preduce'-esque function? |
| 20:44 | numberten | for when your function is associative? |
| 20:45 | TEttinger | numberten, pmap is rarely the answer |
| 20:46 | TEttinger | not sure how preduce would be any better |
| 20:46 | numberten | i've used pmap for a lot of things :/ |
| 20:46 | numberten | rough and dirty parallelism at the drop of a keystroke is really nice sometimes :) |
| 20:46 | TEttinger | clojure's other concurrency primitives are generally a lot better though |
| 20:47 | numberten | is there a primitive for parallel reductions? |
| 20:48 | amalloy | guys i finally reached my limit: found a scenario where i can't bear to use -> and doto instead of just naming a local. https://www.refheap.com/592e994b1727f4c72de79ddc7 |
| 20:48 | gfredericks | wtf amalloy |
| 20:49 | TEttinger | one line difference, amalloy |
| 20:49 | amalloy | TEttinger: well, the one line is just because emacs indents doto inside of a -> a little weirdly |
| 20:50 | amalloy | really the problem is that the soup of ->/doto is completely illegible |
| 20:50 | TEttinger | yes |
| 20:50 | amalloy | even though i love ->/doto soups usually |
| 20:51 | amalloy | ,(-> (java.util.ArrayList.) (doto (doto (doto (doto (.add 1)))))) |
| 20:51 | clojurebot | [1] |
| 20:51 | amalloy | <3 |
| 20:51 | adu | it sounds like you love doto almost as much as haskellers love monads |
| 20:52 | gfredericks | a doto is like a burrito |
| 20:52 | amalloy | i have feelings about -> and doto that are inappropriate to discuss in public |
| 20:57 | gfredericks | pop quiz: what does #"\v" match |
| 20:57 | kenrestivo | i'm a linux shell guy so i love -> (and not so much doto). if i were a haskell guy i suppose i'd have monadic religion |
| 20:57 | amalloy | gfredericks: same as #"v" i'd guess |
| 20:58 | gfredericks | nopes |
| 20:58 | amalloy | oh |
| 20:58 | amalloy | vertical line feed? |
| 20:58 | amalloy | vertical tab or something |
| 20:58 | amalloy | yeah |
| 20:58 | gfredericks | yeah |
| 20:59 | kenrestivo | those java interop boluses with all the dotos, lets, and ->'s are ugly, but consider the alternative: writing actual java |
| 21:02 | otti | hm did someone experience that, when creating a uberjar, that leiningen just hangs at some point |
| 21:03 | otti | without any errors or anything it just sits there and does nothing, thus it never finishes compiling the uberjar |
| 21:03 | amalloy | otti: your namespace does side effects at the top level instead of inside -main, eg starting up a webserver |
| 21:04 | amalloy | those are happening at compile time, so the jar can't be made until the webserver is done |
| 21:04 | otti | amalloy: thanks |
| 21:06 | amalloy | that's not the only possible issue, but it is by far the most common |
| 21:06 | adu | kenrestivo: in Haskell the monads that appear in do-notation usually only have one argument, so it's equivalent to doto and -> at the same time |
| 21:12 | tomjack | one argument? |
| 21:23 | adu | tomjack: well, the functions must have one remaining argument by the time the Monad sees it, it could be a 10-argument function that has 9 arguments given |
| 21:25 | adu | but that's just because Haskell functions are always in curried form |
| 22:00 | amalloy | yeah, i'm not sure what this one-argument thing is about either. do x <- f a b; g x c d desugars to: f a b >>= (\x -> g x c d); obviously that lambda has one arg, but it's not clear how that means "the monads have one argument" |
| 23:44 | tomjack | instead of "doto and ->" I think I'd say "generalized let" |