2014-01-25
| 00:02 | akurilin | technomancy: Fair enough, this sounds "good enough" for the vast majority of cases. |
| 00:03 | technomancy | I would like to move everything in the test task into a lib though |
| 00:04 | akurilin | technomancy: Any tips on reloading the app's code as you test it from a test ns? Do you just require reload? |
| 00:05 | technomancy | akurilin: I use cider |
| 00:08 | akurilin | technomancy: I see, I guess as a vim user I'm not invited to that party. |
| 00:08 | akurilin | :P |
| 00:08 | technomancy | eh, fireplace should work fine |
| 00:08 | technomancy | just recompile after every edit you do |
| 00:09 | akurilin | I see, so it sounds like you don't spin up a secondary repl just for the tests, right? You do everything through nrepl |
| 00:09 | akurilin | I tend to nrepl into the running ring app from fireplace, and I thought it was better to have a separate repl for UTs, to minimize corruption |
| 00:10 | technomancy | hm; I wouldn't worry about that |
| 00:10 | akurilin | But I can certainly see the one less step if you already reload everything in nrepl. |
| 00:10 | technomancy | I don't think it's worth having two; just make a second fresh pass over your full suite before merging |
| 00:11 | akurilin | Fair enough, I'll try that, simple is better. Do you do Sierra's flow btw, or do you not bother? |
| 00:12 | technomancy | I haven't tried it |
| 00:12 | technomancy | don't really see the appeal |
| 00:13 | akurilin | Fair enough, good to know. |
| 00:21 | JacobGood1 | When I use clojure.repl/source on a function that I have redifined through the repl, it returns nothing... is there a way around this? |
| 00:21 | technomancy | JacobGood1: no, clojure.repl/source is kind of a hack |
| 00:21 | technomancy | try running it on itself to see what I mean |
| 00:22 | JacobGood1 | well is there anything like it that i could use to reread the source of a redifined fn? |
| 00:23 | technomancy | no, it's gone forever |
| 00:23 | koreth_ | Any good ideas for learning how to shift my thinking to FP? I think I have a decent handle on Clojure syntax and am able to think in functional style for small-scale stuff (using map or reduce instead of looping, etc.) but when I start thinking about how to structure a larger application, what pops into my head are things like DAOs and service provider objects rather than whatever the idiomatic approaches would be in Clojure. |
| 00:23 | technomancy | unless you used https://github.com/technomancy/serializable-fn |
| 00:24 | JacobGood1 | ok i will give that a shot thanks techno |
| 00:25 | technomancy | JacobGood1: I don't know that I'm recommending that as a practical thing |
| 00:25 | technomancy | just that it's what you'd need to do if you wanted to get what you're asking |
| 00:28 | JacobGood1 | oh, well I am trying something impractical anyway |
| 00:28 | technomancy | don't let me stop you |
| 00:31 | Raynes | technomancy: https://www.dropbox.com/s/x1tqocwdn0l7ter/Photo%20Jan%2024%2C%209%2023%2047%20AM.jpg Triscreen yo :3 |
| 00:31 | technomancy | Das Respect |
| 00:34 | seangrove | Damnit, how can I get korma not to print out this exception? https://github.com/korma/Korma/blob/master/src/korma/db.clj#L221 |
| 00:34 | seangrove | I don't often want CL's restarts, but wouldn't mind it here |
| 00:34 | technomancy | Raynes: wait, does your das have labeled keycaps?? |
| 00:34 | lazybot | technomancy: Definitely not. |
| 00:35 | seangrove | It's printing out a sql statement that completely fucks the terminal |
| 00:35 | seangrove | This is the repl prompt after the error is thrown: |
| 00:35 | seangrove | C┌⎺⎽☃┼± c⎺┼┼ec├☃⎺┼: |
| 00:35 | tomjack`` | I want to stop defining things at the repl |
| 00:35 | technomancy | I thought all Dases were otaku-style |
| 00:35 | technomancy | tomjack``: it's a little late for a new years resolution ,but whatever |
| 00:35 | seangrove | That's supposed to be zensight.support.repl-work: |
| 00:35 | Raynes | technomancy: Yes, and I'm getting another one with labeled caps as well. |
| 00:36 | tomjack`` | or, I guess I want the repl to do something different |
| 00:36 | Raynes | technomancy: Lance polled my desk neighbors and my keys are too loud. Gotta switch to cherry reds. :p |
| 00:36 | technomancy | Raynes: noooo =( |
| 00:36 | Raynes | Gotta do what you gotta do m8 |
| 00:36 | technomancy | I have reds in my shift keys |
| 00:36 | seangrove | Do I have to alter-root-var and redefine handle-exception in korma to stop it from spewing stuff out? |
| 00:36 | technomancy | they're fine for modifiers, but I wouldn't want to type on them all day |
| 00:36 | tomjack`` | surely someone's built an nrepl plugin that records everything I eval somewhere |
| 00:36 | seangrove | There's no hook otherwise to control the behavior... |
| 00:37 | technomancy | Raynes: have you looked into o-rings? |
| 00:37 | Raynes | I haven't |
| 00:37 | technomancy | supposedly they damp the sound without sacrificing much of the tactile feel |
| 00:38 | technomancy | Raynes: also: unless you're going to be doing a lot of gaming you should consider clears over reds |
| 00:38 | Raynes | technomancy: Das comes in browns, blues, and reds. |
| 00:38 | Raynes | Browns would probably have still been too loud, and reds seem less bad than you claim :p |
| 00:38 | technomancy | oh. |
| 00:39 | Raynes | I probably would have went with clears. |
| 00:39 | seangrove | Also, what causes the shell to freak out like that - is it something being printed out that triggers a control character and sets the shell into bizarro-mode? |
| 00:39 | Raynes | But I really like das keyboards. |
| 00:39 | technomancy | I have browns in my keyboard too, for the non-modifier pinkies |
| 00:39 | technomancy | they're not any louder than reds |
| 00:39 | scottj | Raynes: I'm not sure if browns are quieter, but since they're not as high pitched I find them much less annoying |
| 00:39 | technomancy | they're a lot quieter than blues |
| 00:40 | Raynes | Anyways, I think reds are still probably better than using a stock apple keyboard, and I'm not paying for it so... |
| 00:40 | Raynes | :p |
| 00:40 | Raynes | And the order is already out/ |
| 00:40 | JacobGood1 | Is there a way to make a clojure function work across all namespaces without having to type require everywhere? |
| 00:41 | technomancy | oh, sure. yeah, definitely better than giving up on das for sure |
| 00:41 | Raynes | Thankfully not really. |
| 00:41 | technomancy | JacobGood1: typically you want editor support for that |
| 00:41 | technomancy | doing it inside the namespaces themselves would be a mess |
| 00:41 | ivan | never ever buy blue switches unless you like 70 dB clicking noises |
| 00:41 | Raynes | I do. |
| 00:41 | technomancy | ivan: who does'nt though? |
| 00:42 | ivan | they're high-pitched noises that raise my blood pressure, not satisfying clicks (to me, anyway) |
| 00:42 | scottj | technomancy: I can't stand the sound of blues |
| 00:42 | Raynes | technomancy: Also, this means I get to take my das home now. |
| 00:42 | Raynes | :D |
| 00:42 | ivan | you can also make it activate without a click, which is kind of insulting :) |
| 00:42 | technomancy | Raynes: I predict an increase in work-from-home days for you |
| 00:43 | Raynes | I cause small earthquakes with each das keystroke, ivan. |
| 00:44 | technomancy | is there a trick to it? |
| 00:44 | Raynes | Write Python. |
| 00:44 | technomancy | no, getting it to activate without a click |
| 00:44 | technomancy | I can't get mine to od it |
| 00:44 | ivan | just hover right below the activation threshold |
| 00:45 | ivan | it worked on my quickfire pro |
| 00:45 | ivan | get it to click, then go up as little as possible |
| 00:45 | Raynes | I can definitely activate mine without clicking |
| 00:46 | kristof | Pretty soon you all are going to talk about WASD keyboards |
| 00:46 | technomancy | oh yeah, if you activate and then bring it back up; I see |
| 00:46 | Raynes | Presumably we'll talk about Clojure again one day. |
| 00:46 | kristof | Clojure? Nothing to see there :P |
| 00:46 | technomancy | not exactly something that could happen on accident |
| 00:47 | dsrx | oh, keyboard chat? |
| 00:47 | kristof | no, that's #clojure-keyboard |
| 00:47 | dsrx | the perfect time for me to be smug about my topre keyboard |
| 00:47 | scottj | btw realforce 87u 45g topre on sale right now for $199 |
| 00:47 | ivan | has your topre spacebar ground your thumb to the bone yet? |
| 00:48 | technomancy | I was hacking in the library the other day; first time I've felt somewhat bad about my clicky level |
| 00:48 | dsrx | scottj: hmmm not in white/gray though |
| 00:48 | technomancy | but it was right next to the coffee shop in the seattle public library, so I don't think anyone got too worked up |
| 00:48 | scottj | dsrx: my arms are too hairy for white :) |
| 00:49 | dsrx | haha |
| 01:01 | cnl | if i use defrecord or deftype to create nodes for my tree would I expect them to take less space or more then if I use maps? I ended up writing a thing like {child1: '(value {2ndlevelchild: ...})} but its taking massive (gb) space with my data set |
| 01:02 | technomancy | cnl: yeah, records take up less memory |
| 01:03 | technomancy | however, if it's possible to express things lazily, that's usually a better way of consuming less memory |
| 01:04 | cnl | well, im indexing names from a file (line per article name) and i want fast lookups, ended up with https://www.refheap.com/27168 (I am new yet so not very good) |
| 01:04 | cnl | so i probably have to load them all into memory |
| 01:04 | akurilin | technomancy: made a post on the mailing list to poll the community a little bit about people's UTing flow habits, curious to see what folks say. |
| 01:04 | akurilin | included the flow you recommended in there. |
| 01:05 | technomancy | cnl: at first glance: use swap! instead of reset |
| 01:05 | technomancy | cnl: or better yet, use reduce instead of an atom |
| 01:06 | cnl | i tried that initially but was having problems calling reduce on the line-seq, ended up with stack overflows |
| 01:06 | cnl | although i might of just been doing somthing stupid |
| 01:07 | technomancy | cnl: reduce is conceptually similar to doseq changing an atom every time |
| 01:08 | technomancy | akurilin: my talk proposal to clojurewest is kind of about writing tools like that in a cross-editor way |
| 01:08 | technomancy | http://p.hagelb.org/clojurewest-2014.org.html |
| 01:08 | technomancy | so if it gets accepted I'll probably polish off that lib some more |
| 01:29 | akurilin | technomancy: sounds like a very worthwhile goal |
| 01:31 | akurilin | technomancy: the holy grail for clojure would be what the old scheme / CL farts always talk about when they say they used to have some of the most advanced and convenient step-through debuggers of the time with all sorts of ways of exploring the context. |
| 01:31 | akurilin | I'm personally ok with something like Chrometools for Clojure |
| 01:31 | technomancy | CL-level interactivity will probably never be feasible on the JVM |
| 01:32 | technomancy | but we can sure do a lot better than what we have now |
| 01:34 | cnl | so i end up with stack overflows if I use reduce (https://www.refheap.com/27173) |
| 01:35 | cnl | ahh, for a different reason though |
| 01:36 | dsrx | funny how when we end up with stack overflows, that's also where we end up ;) |
| 01:39 | akurilin | zing! |
| 02:41 | quizdr | A little trip to the grocery store brought to my attention a most fascinating revelation about clojure. |
| 02:46 | xuser | quizdr: are you going to tell us? :) |
| 02:50 | quizdr | yes i am |
| 02:51 | quizdr | please allow 30 seconds for completion |
| 02:51 | quizdr | so, the revelation and answer to a common question, "Clojure is awesome, but what happens if I combine Clojure with Clojure itself?" And the answer is... that it is always fluffy and pure. |
| 02:51 | quizdr | https://www.dropbox.com/s/a5gbhhtpqg0hra3/Clojure%20Times%20Two.jpg |
| 03:31 | koreth_ | Is there a non-hacky way to create a var at the root level whose name is dynamically computed? My naive attempt using (def (make-the-name) ...) just gives me a "PersistentList cannot be cast to Named" error. This isn't for anything serious, just a programming puzzle whose test case wants zillions of near-identical helper functions and I am too lazy to type them all out by hand. |
| 03:32 | fredyr | koreth_: yes i think so |
| 03:32 | koreth_ | (And yes, make-the-name returns a Symbol, not a string) |
| 03:32 | fredyr | koreth_: https://github.com/swannodette/om/blob/master/src/om/dom.clj |
| 03:32 | fredyr | koreth_: here's an example |
| 03:32 | koreth_ | Sweet, thanks. |
| 03:37 | rurumate_ | is there something like doseq-indexed? |
| 03:38 | rurumate_ | because I'm tired of creating let-scoped atoms for counting line numbers |
| 03:38 | fredyr | hmm i think ive seen something like that |
| 03:39 | fredyr | ,(doc map-indexed) |
| 03:39 | clojurebot | "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item." |
| 03:39 | fredyr | not really the same |
| 03:39 | rurumate_ | almost but map is not quite the same as doseq |
| 03:40 | fredyr | apparently there was an indexed in contrib |
| 03:40 | fredyr | https://gist.github.com/halgari/4136116 |
| 03:41 | rurumate_ | splendid |
| 03:44 | rurumate_ | I would prefer it like this: https://www.refheap.com/27189 |
| 03:47 | michaniskin | (def indexed (partial map-indexed vector)) |
| 03:48 | michaniskin | i use that all the time |
| 03:49 | rurumate_ | cool michanis |
| 03:49 | rurumate_ | that's even more concise |
| 03:49 | Bracki | Very dumb question. I do a 'lein new default some-stuff'. In src/some_stuff/core.clj I find a (def foo...). How do I execute this in the repl? |
| 03:50 | Bracki | lein repl always tells me about CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context |
| 03:50 | logic_prog | holy shit lighttable is awesome; I do have one concern now: how will light table make $ / ensure future development of light table? |
| 03:50 | Bracki | So what exactly do I need to type once i started the repl? |
| 03:53 | Bracki | Hm, so when do I use - or _? |
| 03:53 | Bracki | Or what's the reason that the directory leiningen contains _ instead of an -, yet the namespace is still with a -? |
| 03:54 | michaniskin | Bracki: did you do (require 'some-stuff.core) first? |
| 03:54 | quizdr | logic_prog what have you used before trying lighttable? |
| 03:54 | michaniskin | Bracki: the _ is because java |
| 03:54 | Bracki | michaniskin: no I tried some_stuff first |
| 03:54 | logic_prog | quizdr: emacs |
| 03:55 | logic_prog | hmm, and the instarepl is broken |
| 03:55 | michaniskin | Bracki: i mean, when you get a repl do: (require 'some-stuff.core) and then (in-ns 'some-stuff.core) |
| 03:56 | michaniskin | Bracki: then you should be able to evaluate (foo) or whatever |
| 03:56 | quizdr | logic_prog you like it more than emacs? |
| 03:56 | logic_prog | quizdr: it's programmable in clojure rather than, say elisp |
| 03:56 | quizdr | i tried it and found various things rough around the edges. it's beautiful but not very functional for me at this point after using emacs |
| 03:57 | logic_prog | yeah, it's slightly rough around the edgers for me too |
| 03:57 | logic_prog | i.e. the instarepl is broken |
| 03:57 | quizdr | i had a number of problems |
| 03:57 | logic_prog | however, I thikn it's the future |
| 03:58 | quizdr | i agree it has potential |
| 03:58 | quizdr | i also think justin bieber has a lot of potential but he needs to be careful first |
| 03:59 | auser | hello all |
| 04:00 | fredyr | ello! |
| 04:01 | quizdr | auser, allow me to join fredyr and wishing you a bon jolly hello, good sir or madame |
| 04:01 | auser | I'm a bit newish to clojure... I feel like I'm struggling a bit with a relatively trivial problem |
| 04:01 | quizdr | join the club |
| 04:01 | fredyr | auser: don't be shy! |
| 04:01 | auser | I am reading a bunch of files in a directory and want to grab a sequence of all the words in the file |
| 04:02 | auser | rather, a list of them |
| 04:02 | auser | I'm recursively walking a directory and able to get the lines in the file, but not split into words |
| 04:03 | auser | I feel like that can't be that difficult to do |
| 04:03 | quizdr | if you can post a gist of what you have (using github gist or refheap.com) it might be easier to assist |
| 04:03 | auser | I'll do it! |
| 04:04 | auser | https://www.refheap.com/d6a107cf9426ecdd15ea6bed6 |
| 04:04 | auser | so basically I want to open each file in each directory and pull out the words in each file |
| 04:05 | fredyr | auser: if you want you can read files even more easily with slurp |
| 04:06 | fredyr | ,(doc slurp) |
| 04:06 | clojurebot | "([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments." |
| 04:06 | auser | interesting |
| 04:06 | auser | doesn't that load the entire file into memory tho |
| 04:06 | fredyr | it does? |
| 04:07 | fredyr | it returns the entire file as a string |
| 04:07 | auser | the files are variable in size, so that could be reading a huge file |
| 04:07 | fredyr | sure |
| 04:07 | auser | okay, so I might be able to simplify it with slurp, true |
| 04:08 | fredyr | so you need to decide on the use case if it is suitable |
| 04:08 | auser | totally |
| 04:08 | fredyr | i'm just suggesting alternatives |
| 04:08 | fredyr | clojure.string/split seems fine to get the words also |
| 04:08 | auser | sure, so that's not complete, btw |
| 04:08 | auser | still trying to split the lines into words |
| 04:09 | fredyr | auser: where is it that you run into trouble |
| 04:09 | auser | a few places |
| 04:09 | auser | well... two |
| 04:09 | auser | so |
| 04:09 | auser | in the index-file function, I want to get a list of all the words in the file, which is why I started to use reduce |
| 04:09 | fredyr | (clojure.string/split (slurp "/Users/fredyr/afile.txt") #"\s") gets me there :) |
| 04:09 | auser | in some cases, I get nil |
| 04:10 | auser | oh |
| 04:10 | auser | really? |
| 04:10 | fredyr | yeah |
| 04:10 | quizdr | (inc fredyr) |
| 04:10 | lazybot | ⇒ 3 |
| 04:10 | fredyr | wee |
| 04:10 | quizdr | i'm just getting warmed up mister! |
| 04:11 | auser | so I forgot, the actual error right now is: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.CharSequence from line 21 |
| 04:11 | auser | is that because (doall) is returning a lazy sequence? |
| 04:12 | auser | I thought it makes it non-lazy |
| 04:12 | fredyr | map is lazy |
| 04:12 | auser | which begs the question, why am I using it in the first place |
| 04:12 | auser | oh |
| 04:12 | michaniskin | doall ensures that it's not returning a lazy seq |
| 04:12 | auser | reduce* |
| 04:12 | fredyr | ,(doc map) |
| 04:12 | clojurebot | "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments." |
| 04:12 | auser | got it |
| 04:13 | metellus | auser: it's because string/split takes a string, but get-lines gives a seq of strings |
| 04:13 | michaniskin | ,(doc doseq) |
| 04:13 | clojurebot | "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil." |
| 04:13 | michaniskin | (doseq [item coll] (prn item)) |
| 04:14 | fredyr | auser: are you using some kind of repl when testing? |
| 04:14 | auser | I am, cider/nrepl |
| 04:14 | quizdr | i would image things are not wise to try doseq on an infinite lazy collection, yeah? |
| 04:16 | fredyr | auser: its usually helpful to run and verify the results of each function in the repl |
| 04:16 | auser | yah |
| 04:16 | auser | good idea |
| 04:17 | fredyr | auser: out of curiosity, are you @auser on twitter? |
| 04:24 | auser | fredyr: yep |
| 04:24 | auser | I am |
| 04:25 | fredyr | auser: i recognized it frmo there, youre one of my few followers :) |
| 04:25 | auser | oh yeah? |
| 04:25 | auser | I am? |
| 04:25 | auser | nifty |
| 04:25 | fredyr | i'm @lexicallyscoped |
| 04:25 | auser | ah cool |
| 04:26 | auser | ah there you are |
| 04:26 | quizdr | fredyr now you gots even more followers |
| 04:26 | fredyr | yay |
| 04:27 | quizdr | sweden eh? cold there this time of year? i was in berlin in September. I think I'd enjoy living Europe |
| 04:27 | fredyr | the cold actually just got here |
| 04:28 | fredyr | we've had a lousy winter before that |
| 04:28 | fredyr | but now its like -5 and we've got some snow |
| 04:28 | quizdr | nice. good times. |
| 04:28 | quizdr | i noticed that while i'm on your site, i can read your content, but as soon as I leave your site, the content is no longer available when I'm on other sites. i think your site must be lexically scoped. |
| 04:29 | fredyr | lol |
| 04:29 | fredyr | (inc quizdr) |
| 04:29 | lazybot | ⇒ 3 |
| 04:29 | auser | hah hah haha |
| 04:29 | quizdr | yay |
| 04:50 | auser | is it possible to get the position in a file that file-seq is currently in? |
| 04:59 | fredyr | do you mean like the index or something? |
| 04:59 | auser | yeah |
| 04:59 | auser | exactly |
| 05:01 | fredyr | there was some discussions earlier here on doseq with index |
| 05:02 | fredyr | (def indexed (partial map-indexed vector)) was suggested |
| 05:02 | auser | oh interesting |
| 05:02 | fredyr | ,(def indexed (partial map-indexed vector)) |
| 05:02 | clojurebot | #'sandbox/indexed |
| 05:03 | fredyr | ,(indexed [1 2 3 4 5 6]) |
| 05:03 | clojurebot | ([0 1] [1 2] [2 3] [3 4] [4 5] ...) |
| 05:06 | auser | perhaps it would help for me to pastie |
| 05:06 | auser | I could actually use some help understanding how I'd implement that |
| 05:06 | auser | in my specific use-case |
| 05:07 | auser | https://www.refheap.com/d6a107cf9426ecdd15ea6bed6 |
| 05:07 | auser | I want to parse that on line 23, I think |
| 05:09 | auser | fredyr, mind taking a quick gander at that real quick? |
| 05:16 | auser | oh nm |
| 05:16 | auser | docs |
| 05:43 | TEttinger | auser, there's also ##(map vector (range) [1 2 3 4 5]) |
| 05:43 | lazybot | ⇒ ([0 1] [1 2] [2 3] [3 4] [4 5]) |
| 05:52 | fredyr | auser: sorry time's up -- family calls |
| 05:52 | auser | np |
| 05:52 | auser | I got it |
| 05:52 | auser | enjoy! |
| 05:52 | fredyr | ty |
| 05:52 | fredyr | u2 |
| 05:52 | fredyr | :D |
| 06:32 | quizdr | here's an odd one: |
| 06:33 | quizdr | ,((juxt inc dec) 6) |
| 06:33 | clojurebot | [7 5] |
| 06:33 | quizdr | well, i guess clojurebot doesn't like that one |
| 06:34 | quizdr | what's odd is that it returns a vector, which is expected, but if you map this across a vector, it instead returns a sequence of functions? i.e. (map #(juxt inc dec %) [1 2 3 4 5]) |
| 06:35 | quizdr | ahh it should have been (map #((juxt inc dec) %) [1 2 3 4 5]) forgot to next the juxt |
| 06:36 | quizdr | *nest |
| 06:39 | quizdr | that was a hard one clojurebot eh? i also stared at it for 3 minutes when I first saw it |
| 07:35 | voldyman | can someone suggest a library for websocket client? |
| 07:35 | voldyman | (with some documentation) |
| 07:35 | AeroNotix | aleph? |
| 07:36 | voldyman | AeroNotix: couldn't find the docs for it |
| 08:15 | hyPiRion | ,(map (juxt inc dec) [1 2 3 4 5]) ;; quizdr |
| 08:15 | clojurebot | ([2 0] [3 1] [4 2] [5 3] [6 4]) |
| 08:15 | hyPiRion | oh, he left |
| 08:32 | coventry | cljs question: I'm trying to install austin in bhauman's dotster game, and I'm getting "JSC_MISSING_PROVIDE_ERROR. required "cemerick.austin.repls" namespace never provided" during compilation. Any suggestions for how I might fix this? The one of the project.clj I've tried is https://www.refheap.com/27258 . I've also tried excluding each of the [com.cemerick/austin "0.1.3"] vectors in there |
| 08:33 | coventry | Austin's example project compiles just fine for me, but I can't see what the key difference is. |
| 08:37 | coventry | Never mind, silly mistake. |
| 09:37 | scape_ | using korma, or probably any jdbc, my mysql connection times out over time-- what's the typical method for keeping this alive? |
| 09:38 | scape_ | otherwise when doing a query, korma barks back with a printed error statement-- not exactly great for a lnng running web app |
| 09:50 | rurumate_ | scape_: I don't know about korma. In general your connection pool should take care of preventing timeouts |
| 09:50 | scape_ | korma uses c3p0 and looks like it has a connection pool, but after a while of idle throws an error |
| 09:51 | rurumate_ | ok, with c3p0 this should not happen. then it's a question of configuring c3p0 correctly |
| 09:51 | scape_ | oh, interesting ok |
| 09:54 | scape_ | max idle time is 10800, I should do some research on c3p0 :) here's my current connection setup for c3p0 http://pastebin.com/nJdTfD1Z |
| 09:59 | rurumate_ | scape_: maxConnectionAge is 0, try a positive value like 14400 |
| 10:00 | rurumate_ | also set idleConnectionTestPeriod to 3600 or something |
| 10:02 | rurumate_ | you can set the preferredTestQuery to something explicit like "select 1" or "select now()", not sure if it matters |
| 10:07 | john2x | i'm trying to use Friend, but I can't seem to get my :credential-fn to be called. https://www.refheap.com/create my :login-failure-handler is working correctly, but credential-fn never gets called. (i.e. println doesn't happen) |
| 10:08 | john2x | what am I missing? |
| 10:16 | scape_ | rurumate_: ok thanks, i'll try those settings |
| 10:17 | AeroNotix | ugh, calling variadic functions? |
| 10:18 | AeroNotix | quite painful, huh |
| 10:45 | AeroNotix | how would I make an array of http://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchEvent.Kind.html |
| 10:47 | Cr8 | (into-array java.nio.file.WatchEvent$Kind [kind1 kind2]) |
| 10:47 | AeroNotix | ok, $Kind |
| 10:47 | AeroNotix | lemme try it |
| 10:47 | Cr8 | yeah, "Inner" classes and interfaces are named by $ |
| 10:48 | AeroNotix | Gotcha, what's $ named? |
| 10:48 | Cr8 | hm? |
| 10:48 | Cr8 | I don't think you can have a java class with a $ in it, which is why it can internally use it as a separator |
| 10:48 | AeroNotix | Cr8: but I mean, what can I refer to the symbol as? |
| 10:49 | AeroNotix | Dollar sign sounds stupid |
| 10:49 | Cr8 | oh, *shrug* |
| 10:50 | llasram | You can use '$' in Java classes just fine |
| 10:50 | Cr8 | really |
| 10:50 | llasram | It's not common, but Java doesn't complain |
| 10:51 | Cr8 | ah yep |
| 10:51 | Cr8 | and if you have a class called A$B and a class A with inner class B.. they just conflict and it'll yell at you |
| 10:51 | Cr8 | fun |
| 10:52 | llasram | "fun" yes |
| 10:56 | hyPiRion | Even better, you can use the same variable name for different types according to the JVM spec. |
| 10:57 | hyPiRion | not legal in Java, but you can do it if you emit bytecode yourself |
| 10:59 | llasram | neat |
| 11:00 | llasram | Local variables, for reference vs the prim times? |
| 11:00 | llasram | types even |
| 11:00 | llasram | Actually, what am I talking about -- locals are just slots |
| 11:01 | llasram | I learned just enough JVM bytecode to accomplish one thing I needed via ASM and haven't gone back yet for a deep-dive :-) |
| 11:41 | teslanick | I have a string with a bunch of substrings I want to replace with their index. So my substrings are delimited by backticks, so "The `quick` brown fox `jumps` over…" would be replaced with "The `0` brown fox `1` over …" |
| 11:42 | teslanick | I'm not sure how to attack this problem with the regex/string manipulation functions given. |
| 11:42 | AeroNotix | https://github.com/AeroNotix/awizo |
| 11:42 | AeroNotix | something quick for fs events |
| 12:56 | shiranaihito | is there a standard way to share an instance of X with several modules? .. suppose i instantiate one X but want to use the same instance from other code in other modules.. what's the right way to do this? (yeah, i'm still pretty much a beginner at clojure :p) |
| 12:58 | noonian | if you define a variable in a namespace, other namespaces that require your namespace will have access to that variable |
| 12:59 | shiranaihito | noonian: hm.. sounds good, but is there no trouble with the time of instantiation? i mean, if namespace A has the thing i want, and namespace B wants to use it too, what if namespace B gets evaluated before A.. ? is that possible? |
| 13:00 | steckerhalter | is there a prog1 in clojure? |
| 13:01 | dnolen | steckerhalter: no |
| 13:02 | steckerhalter | dnolen: ok, thanks |
| 13:03 | llasram | steckerhalter: It's pretty easy to define yourself. But you don't need it as often as you might think |
| 13:03 | noonian | shiranaihito: it will be initialized if namespace B requires namespace A, from the first sentence of requires docstring: "Loads libs, skipping any that are already loaded." |
| 13:04 | noonian | so namespace A will be evaluated the first time a file that requires it is evaluated |
| 13:04 | shiranaihito | noonian: alright, thanks.. i realized i should probably just experiment with stuff, but couldn't resist the temptation to ask first :p |
| 13:04 | steckerhalter | llasram: yes, I just discovered it in elisp a few weeks ago and found it pretty handy for some cases |
| 13:05 | shiranaihito | ok, good |
| 13:05 | noonian | np |
| 13:05 | shiranaihito | :) |
| 13:37 | afhammad | what does <! do? |
| 13:38 | bbloom | afhammad: use (doc <!) or read the docstrings in the src: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj |
| 13:39 | afhammad | thanks |
| 13:55 | auser | hey all... question... what does this syntax mean: (concat val [::val]) |
| 13:56 | bbloom | auser: which syntax? the double colon? |
| 13:56 | auser | yes, the double colon |
| 13:56 | auser | sorry |
| 13:56 | bbloom | cmd+f on the reader page <http://clojure.org/reader> for "::" |
| 13:57 | AimHere | ,(type ::val) |
| 13:57 | auser | kk |
| 13:57 | clojurebot | clojure.lang.Keyword |
| 13:57 | auser | interesting |
| 13:57 | bbloom | turns out to be pretty damn useful :-) |
| 13:57 | auser | so then I don't understand the statement: (assoc-in trie (concat word [::val]) word)) |
| 13:57 | bbloom | actually, those docs are a little dated. doesn't mention ::alias/keywords |
| 13:58 | AimHere | auser, it's a trie lookup, 'word', here, is treated as a sequence of keys to an associative structure |
| 13:59 | AimHere | ::val is just the key to find the value at a node, rather than a subtree |
| 13:59 | bbloom | auser: what don't you understand about it? |
| 14:00 | auser | well... The output of the structure is a trie, obviously ({\H {\e {\l {\l {\o {:terminal true, :val "Hello"}}}}}}), but I'm not sure how it got there, over every character |
| 14:00 | auser | Missing that piece |
| 14:00 | AimHere | A string is a sequence of characters |
| 14:00 | bbloom | auser: did you (doc assoc-in) ? :-) |
| 14:00 | bbloom | see also get-in and update-in |
| 14:00 | AimHere | ,(second "Wibble") |
| 14:00 | clojurebot | \i |
| 14:00 | auser | yeah, I've been staring at the docs |
| 14:01 | auser | http://clojuredocs.org/clojure_core/clojure.core/assoc-in |
| 14:01 | auser | oh |
| 14:01 | auser | wait, it's iterating over the word |
| 14:01 | AimHere | (concat word [:val]) just turns a string into a sequence of characters terminated by ::val |
| 14:01 | auser | yeah, got it |
| 14:01 | auser | I think |
| 14:01 | auser | yeah |
| 14:02 | auser | makes sense |
| 14:02 | AimHere | Is the value at the end really necessary? If you know how you got there, you already have the sequence of keys you need! |
| 14:03 | auser | so then one follow-up question now that I kinda get it... is it possible to append a data structure at the end of the sequence? |
| 14:03 | auser | now i need to think about that one |
| 14:03 | bbloom | AimHere: it's cheaper to hold on to it than to recreate it |
| 14:04 | AimHere | Well the way it's done there is more expensive memorywise |
| 14:04 | auser | what would be more efficient AimHere ? |
| 14:04 | bbloom | AimHere: no it isn't, not if you're going to reconstruct the same string multiple times |
| 14:05 | bbloom | AimHere: each time you construct the string, you'll get a new object (sans string interning) |
| 14:05 | bbloom | AimHere: depends on the use case |
| 14:06 | bbloom | AimHere: although i guess if you're using a prefix trie in the first place, it's likely that your usecase only involves having a small number of elements from the trie being used at a time... since the point of the trie is to compress space... so nevermind ignore me :-P |
| 14:07 | auser | actually, my usecase is having an object at the end of each path |
| 14:08 | AimHere | You're not reimplementing scribblenauts in Clojure are you? |
| 14:08 | auser | oh no, but that sounds like fun |
| 14:09 | auser | I'm trying to make the most dead-simple search engine ever |
| 14:09 | auser | to learn clojure |
| 14:11 | AimHere | You want something like: (grep-urls (slurp (str "http://www.google.com/search?q=" (read-string))) |
| 14:11 | auser | okay, not THAT Simple |
| 14:11 | auser | that was line 1 |
| 14:13 | auser | hm, can you create an assoc atom? |
| 14:13 | auser | (def *trie* (atom {})) |
| 14:13 | Anderken1 | sure you can |
| 14:13 | auser | I keep getting an odd error |
| 14:13 | Anderken1 | refheap it? |
| 14:13 | auser | Atom cannot be cast to clojure.lang.Associative |
| 14:13 | auser | oh good idea |
| 14:13 | Anderkent | ah, you need to deref it to read from it |
| 14:13 | auser | o |
| 14:13 | Anderkent | or use swap! to modify |
| 14:14 | auser | got it |
| 14:14 | auser | well, I understand |
| 14:14 | auser | just not sure I *get* it in language yet |
| 14:14 | Anderkent | atoms dont care what's inside of them |
| 14:14 | auser | https://www.refheap.com/cd5132fd82df4e8a517bd0711 |
| 14:14 | Anderkent | they're just dumb containers |
| 14:15 | auser | oh, perhaps the swap! needs to be outside the anonymouse fn |
| 14:15 | auser | gr, fingers |
| 14:15 | auser | anonymous* |
| 14:15 | auser | although anony-mousee sounds delicious |
| 14:18 | Anderkent | I think what you ment to do is one of these two things: https://www.refheap.com/27393 |
| 14:18 | Anderkent | basically, the atom is *not* your map, your map lives inside the atom |
| 14:19 | Anderkent | you either tell the atom 'update your contents with (assoc-in <contents> ...) for every word, or you build a map for all your words and then tell the atom to merge it into its content |
| 14:19 | auser | hm, lemme look over it |
| 14:20 | auser | well... I think I want to do the former for each "Add" operation |
| 14:21 | auser | yeah, that makes sense |
| 14:21 | auser | with the swap |
| 14:21 | auser | but I doubt that'll work for multiple words |
| 14:21 | auser | oh |
| 14:21 | auser | I guess it does |
| 14:21 | auser | fun |
| 14:22 | auser | Anderkent thanks for your help |
| 14:22 | Anderkent | no prob |
| 14:32 | auser | hm |
| 14:33 | auser | Anderkent mind if I ask one more quick q? |
| 14:45 | joshuafcole | How can I turn an arbitrary form (supplied dynamically) into a string? |
| 14:45 | joshuafcole | The form is bound to a variable. |
| 14:57 | dnolen | ,pr-str |
| 14:57 | clojurebot | #<core$pr_str clojure.core$pr_str@1a111fd> |
| 14:57 | dnolen | ,(doc pr-str) |
| 14:58 | clojurebot | "([& xs]); pr to a string, returning it" |
| 14:58 | dnolen | joshuafcole: ^ |
| 14:58 | joshuafcole | Fantastic, thanks |
| 14:58 | joshuafcole | It was tough to google because everybody mentioning s-expressions and strings is trying to read them from strings instead of printing them. :p |
| 15:00 | Anderkent | auser: you should just ask your question, someone will see it and answer eventually ;p |
| 15:01 | auser | oh yes, of course |
| 15:01 | auser | I'm trying to understand why the (concat) is in there |
| 15:02 | Anderkent | in where? |
| 15:02 | auser | https://www.refheap.com/27420 |
| 15:03 | auser | not sure why we have that concat in there |
| 15:03 | auser | that's all |
| 15:04 | Anderkent | I just took it from your original example ;p |
| 15:04 | auser | no I know I know |
| 15:04 | auser | I found that example online and am just trying to parse it |
| 15:04 | Anderkent | it's just a question of what do you want your key to be |
| 15:04 | Anderkent | i agree the concat doesnt make much sense there |
| 15:05 | auser | I want to store an object as the terminal |
| 15:05 | auser | so right now |
| 15:05 | auser | {\h {\e {\l {\l {\o {:trie-add/val "hello"}}}}}} |
| 15:05 | auser | but I want to add keys to that terminal object |
| 15:07 | Anderkent | well the thing is if you make it {\h {\e {\l {\l {\o "hello"}}}}} then you can't store 'hell' or 'helloes'. Thus the ::val, to allow you to have {\h {\e {\l {\l {::val "hell" \o {::val "hello" |
| 15:10 | AeroNotix | I think I implemented a trie in Common Lisp, let me dig it out |
| 15:11 | AeroNotix | it'll be way different because mutability but you might see some similarities |
| 15:11 | AeroNotix | https://github.com/AeroNotix/algostructure/blob/master/Common%20Lisp/prefixtrie.lisp |
| 15:14 | auser | sorry, had a phone call, back |
| 15:14 | auser | I see |
| 15:14 | auser | AeroNotix so basically, I need to store associated information with the word |
| 15:15 | AeroNotix | Uhh, I dunno what you mean by that. |
| 15:15 | auser | right, sorry... let me try again |
| 15:15 | auser | I'm reading a file and I want to store where in the file the word is located |
| 15:16 | AeroNotix | where according to what? |
| 15:16 | auser | so I want to be able to store the word and the line number |
| 15:16 | AeroNotix | so just loop your file and process the lines? |
| 15:16 | auser | in the file, so it's more of a node than a single word entry |
| 15:16 | auser | yeah, I'm doing that, I mean in the trie |
| 15:16 | AeroNotix | Why do you need a trie for this? |
| 15:17 | auser | for search |
| 15:17 | auser | so I am building an index of words in a file |
| 15:18 | AeroNotix | Does this have to be an in-memory datastructure? |
| 15:18 | auser | or perhaps I can store a secondary map that holds object information, but I still need to add additional information to the trie |
| 15:18 | AeroNotix | can't you use something like elasticsearch to do this for you? |
| 15:18 | AeroNotix | it's perfect for textual search |
| 15:19 | auser | well, how does es do this then? |
| 15:19 | gtrak | tpope: ping |
| 15:19 | auser | I'd prefer to do it without extra deps |
| 15:19 | AeroNotix | auser: why? |
| 15:19 | AeroNotix | smells like NIH |
| 15:20 | AeroNotix | if this is server-side..... |
| 15:20 | auser | Really, I just want to be able to associate extra information at the terminal node of the trie |
| 15:20 | AeroNotix | otherwise, you just make a regular prefix trie but store line number as well |
| 15:20 | AeroNotix | Yeah, what's hard about this? |
| 15:20 | auser | not trying to solve a business problem, but a thought problem |
| 15:21 | AeroNotix | Node: {:char c :line 123 :pos N :subnode { ... }} |
| 15:21 | AeroNotix | or subnode(s) |
| 15:21 | AeroNotix | I'd use subnodes |
| 15:21 | auser | ah yeah |
| 15:23 | auser | thanks |
| 15:25 | auser | I think I found a way, doing the operation slightly differently |
| 15:25 | AeroNotix | keigh |
| 15:28 | auser | if it works, I'll update you AeroNotix, if you're interested |
| 15:28 | AeroNotix | auser: I'm not. But thanks |
| 15:28 | auser | oh, okay |
| 15:39 | Bracki | Anybod familiar with vim-fireplace? Once I press cqq to get the command-line window how do I execute code? |
| 15:39 | Bracki | y |
| 15:48 | Bracki | Or maybe anybody familiar with Korma can explain how exec-raw is supposed to work? |
| 15:48 | bridgethillyer | cpp |
| 15:50 | bridgethillyer | I just execute in place in the source file (with cpp) instead of using the command line window |
| 15:51 | Bracki | Ok. |
| 15:51 | Bracki | I was missing a (use foo) |
| 15:51 | Bracki | Hence nothing worked. |
| 15:52 | bridgethillyer | That happens to me all the time; something is broken in the code, so nothing runs. Then I just assume I forgot how to use vim-fireplace. :) |
| 15:53 | AeroNotix | something something cider-mode |
| 15:53 | AeroNotix | really impressed with cider-mode, it's better than SLIME in some ways imho |
| 15:54 | auser | hm |
| 15:55 | Bracki | Does clojure support multiline strings? |
| 15:56 | tpope | gtrak: sup |
| 15:56 | fredyr | Bracki: not yet |
| 15:56 | gtrak | tpope: I'm about to finish up cider integration with the nrepl-complete stuff, was wondering if you've got a middleware started for var-info? |
| 15:56 | gtrak | seems like the design works out |
| 15:56 | Bracki | So what's the way to have a longish string? |
| 15:57 | tpope | still no |
| 15:58 | gtrak | tpope: I might start one up then. |
| 15:58 | tpope | okay |
| 15:58 | tpope | yeah, waiting on me is not your best bet |
| 15:58 | gtrak | np :-), just curious if you had any more thoughts on it. |
| 16:02 | Raynes | Bracki: Hit return. |
| 16:02 | fredyr | Bracki: yes sorry, i was thinking about this one: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes |
| 16:02 | Raynes | Bracki: https://www.refheap.com/27451 |
| 16:02 | Raynes | This works just fine. |
| 16:03 | fredyr | Bracki: you can just have newlines in the string literals |
| 16:03 | Raynes | Bracki: I think fredyr thought you were asking for heredocs. |
| 16:04 | fredyr | im blaming the whishey |
| 16:04 | fredyr | whishkeyeys |
| 16:04 | fredyr | :) |
| 16:04 | devn | btw, re: alternate quote syntaxes, does anyone, literally anyone who has been doing clojure for awhile |
| 16:04 | devn | think that <<HEREDOC ... HEREDOC is a good idea? |
| 16:04 | devn | because it makes me ill just thinking about it |
| 16:05 | devn | """""" is a big win because it would work for docstrings nicely. |
| 16:05 | Bracki | Is there any alternative to Korma for SQL stuff? |
| 16:05 | dobry-den | datomic ;) |
| 16:05 | devn | Bracki: http://www.clojure-toolbox.com/ |
| 16:06 | devn | see "SQL Abstraction" |
| 16:06 | Raynes | clojure.java.jdbc |
| 16:07 | AeroNotix | devn: is anyone actually thinking about <<HEREDOC |
| 16:07 | aaronj1335 | hey folks does anyone know where clojure.contrib.seq went in 1.3 |
| 16:07 | aaronj1335 | ? |
| 16:07 | devn | aaronj1335: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go |
| 16:07 | devn | it went nowhere. |
| 16:07 | dobry-den | When a user registers, I want to hit an avatar-generating API endpoint and download the avatar into a local /avatars folder. What's the general approach to this? |
| 16:07 | aaronj1335 | yea i saw it didn't have a listing, didn't know if that meant it was officially gone |
| 16:07 | Bracki | devn: Any of those support lazy selects? I have a huge result set (10 mio rows) and Korma just get's everything in one go |
| 16:08 | devn | AeroNotix: i dont know, but someone actually added it to Bracki: you can just have newlines in the string literals |
| 16:08 | aaronj1335 | but it sounds like yes, yes it is |
| 16:08 | aaronj1335 | thanks |
| 16:08 | fredyr | AeroNotix: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes |
| 16:08 | devn | Bracki: can't you just batch your selects yourself? |
| 16:08 | devn | get the count and batch it |
| 16:08 | devn | woops, thanks fredyr |
| 16:08 | Bracki | How? |
| 16:10 | devn | Bracki: select * from mytable limit 10000 offset 10000 |
| 16:10 | Bracki | The mysqldb lib in Python has a notion of a server side cursor, looking for something like that |
| 16:11 | devn | i have no idea what that is |
| 16:11 | Bracki | devn: dealing with a weird query with lot's of left joins so it's hard to use LIMIT properly |
| 16:11 | Bracki | http://dev.mysql.com/doc/refman/5.0/en/cursor-restrictions.html |
| 16:12 | devn | mysql is such a bummer dude |
| 16:16 | Bracki | AH, http://niwibe.github.io/clj.jdbc/api/jdbc.html#var-with-query |
| 16:16 | Bracki | That's what I was looking for... |
| 16:16 | Bracki | Weird that Korma doesn't support it |
| 16:20 | Bracki | Also, why isnt clj.jdbc on the toolbox site? |
| 16:20 | tpope | gtrak: is the public cljs-complete library at a point where I can try hooking it up? |
| 16:21 | gtrak | tpope: I think you want nrepl-complete, cljs-complete is just the backend that parses the cljs analyzer. |
| 16:21 | gtrak | I'm working on releasing that now, but you can use it from git. |
| 16:22 | tpope | okay cool |
| 16:22 | gtrak | I load up the project in a repl, then I connect with another nrepl client and run (cemerick.piggieback/cljs-repl) to start up the cljs repl. |
| 16:22 | gtrak | then the nrepl client creates the "complete" op |
| 16:23 | gtrak | here's that code, maybe helpful: https://github.com/clojure-emacs/cider/blob/master/cider-interaction.el#L547 |
| 16:24 | tpope | gtrak: perfect |
| 16:27 | devn | Bracki: make a PR to clojure-toolbox.com get jdbc added there |
| 16:27 | devn | i actually wondered the same thing |
| 16:27 | devn | there are some extremely outdated libs on the toolbox site also |
| 16:28 | devn | Bracki: there's also http://www.clojuresphere.com/ |
| 16:47 | aaronj1335 | hey folks is there a way to do the {:keys [local1 local2]} trick outside the context of function args |
| 16:48 | aaronj1335 | like if i want to return {:foo foo :bar bar} from a function |
| 16:49 | shep-home | Is there an established pattern / library / function for polling a key of an atom until it is a certain value? |
| 16:49 | michaelr525 | hello |
| 16:49 | TEttinger | aaronj1335, so you want the value of evaling foo and the key is :foo ? |
| 16:50 | aaronj1335 | what up michaelr525 |
| 16:50 | aaronj1335 | TEttinger yea |
| 16:50 | aaronj1335 | kinda like the let binding allows {:keys [foo bar]} |
| 16:50 | michaelr525 | aaronj1335: everything is great. i've actually came here tonight to ask a question :) |
| 16:50 | aaronj1335 | michaelr525 well i'm new to clojure, but who knows i might b able to help :) |
| 16:51 | michaelr525 | a kid told me that he wants to get into programming, so immediately thought of my favorite language |
| 16:52 | michaelr525 | i wonder are there resources for teaching kids to program in clojure (as first programming languages) |
| 16:52 | aaronj1335 | c#??!!?! |
| 16:52 | aaronj1335 | srsly tho that's a great question |
| 16:52 | gfredericks | ask technomancy why he uses racket instead ;-) |
| 16:52 | aaronj1335 | i've always thought of python as the easiest to learn, tho it's not my fav |
| 16:52 | michaelr525 | i'm sure i'm not the first one to ask it too |
| 16:53 | gfredericks | I don't think I would recommend clojure for kids; it's elbow-deep in real-world-engineering-dirt |
| 16:53 | michaelr525 | yea, i've seen many recommendations for python, but I'm hesitating to recommend it since I don't know python myself |
| 16:54 | aaronj1335 | honestly michaelr525 as much as i hate to say it (cause i like clojure), it may not b a good one to learn on |
| 16:54 | gtrak | tpope: any luck? I'm writing up some docs and releasing soon. |
| 16:54 | aaronj1335 | i've lectured at my university on python, and for some reason it seems like ppl really struggle when we get to functional-ish paradigms |
| 16:55 | michaelr525 | technomancy: why do you use racket for teaching kids programming? |
| 16:56 | michaelr525 | i'm actually going to ask him what he would like to program first, and i suspect it's mobile apps |
| 16:57 | michaelr525 | in that case i'm pretty limited in the choice of languages |
| 16:58 | aaronj1335 | michaelr525 that's not a bad idea. when i was trying to learn guitar, the first thing i tried was playing the music i liked, and from there i actually learned stuff like theory |
| 16:58 | aaronj1335 | maybe that's a good approach for programming too |
| 16:59 | michaelr525 | yeah well, but learning java as first language is kinda sad ;) |
| 16:59 | TEttinger | michaelr525, there's a few JS derivatives that are meant to be good for teaching IIRC |
| 17:00 | michaelr525 | I actually like c# but java always feels so cumbersome and inellegant |
| 17:00 | TEttinger | and those are probably much easier to get running on a phone |
| 17:01 | michaelr525 | TEttinger: like in a web browser one a phone? |
| 17:01 | Bracki | "Don't know how to create ISeq from: clojure.lang.Symbol" hm, how do I figure out where the symbol is returned...? |
| 17:02 | TEttinger | Jack is a scripting language aimed at kids learning to program as well as professionals who yearn for a simpler language (like me). |
| 17:02 | TEttinger | https://github.com/creationix/jack |
| 17:03 | michaelr525 | TEttinger: thanks i'll check that |
| 17:04 | TEttinger | it seems pretty early, for more practical stuff... heck just JS on its own can probably be decent for beginners, though the HTML and CSS might be a hurdle. |
| 17:05 | tpope | gtrak: heading out soon, not going to get to it today |
| 17:05 | gtrak | tpope: no worries, it's released though. |
| 17:06 | gtrak | I'll start work on var-info sometime. |
| 17:06 | tpope | cool, I'll let you know how it goes on my end |
| 17:06 | gtrak | waiting to hear back from cider folks on what they might want |
| 17:09 | TEttinger | michaelr525, I'm kinda surprised that I'm surprised this exists http://zachbruggeman.me/dogescript/ |
| 17:11 | michaelr525 | TEttinger: .. |
| 17:11 | TEttinger | michaelr525, I'm just going through this list https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS |
| 17:12 | michaelr525 | TEttinger: ok |
| 17:17 | aaronj1335 | michaelr525 yea java as a first language may be less-than inspiring. khan academy (which is pretty good at teaching) employs john resig (pretty good ad JS), so have you thought about http://www.khanacademy.org/hour-of-code/hour-of-code-tutorial/v/welcome-hour-of-code ? |
| 17:22 | gfredericks | Bracki: that particular error is often something in the (ns) form |
| 17:22 | Bracki | Yeah just found it |
| 17:22 | gfredericks | but in general those kinds of errors can be arbitrarily difficult |
| 17:22 | michaelr525 | aaronj1335: hmm.. |
| 17:22 | Bracki | Clojure and JDBC integration is basically a mess. |
| 17:22 | gfredericks | it is? |
| 17:22 | michaelr525 | aaronj1335: looks interesting |
| 17:23 | dobry-den | Making an avatar upload system, how can you prevent users from uploading more than X bytes? |
| 17:23 | Bracki | All the examples i found use the "old" API, but suddenly there's a new more "idiomatic" api. |
| 17:23 | gfredericks | yeah that happens when APIs change |
| 17:23 | Bracki | Half is deprecated, requiring the dprecated one leads to weird errors etc.. |
| 17:23 | aaronj1335 | michaelr525 yea i went thru it, the first hour was basically just conditionals and loops. but seemed like a good start. i dunno. |
| 17:23 | Bracki | As a newbie that kind of sucks. |
| 17:23 | gfredericks | Bracki: the new API is somewhat easier |
| 17:24 | Bracki | No not at all |
| 17:24 | Bracki | The new API is undocumented |
| 17:24 | gfredericks | I learned it from the docstrings |
| 17:25 | Bracki | I don't even understand half of it. |
| 17:26 | Bracki | I'll just stick to Python in this case... |
| 17:27 | Bracki | I think it's weird for a major library to not include an example on how things work. |
| 17:27 | gfredericks | Bracki: it's mostly like the old one but with the db info passed in as the explicit first arg rather than implicitly/magically via with-connection |
| 17:27 | Bracki | Esp. when all the search hits you get are polluted with the old one. |
| 17:28 | gfredericks | I saw a good set of examples the other day |
| 17:28 | gfredericks | looking for them now |
| 17:29 | Bracki | gfredericks: Thanks, I appreciate that |
| 17:29 | Bracki | . |
| 17:29 | gfredericks | Bracki: the main ns docstring links here: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html |
| 17:29 | gfredericks | which is what I was remembering |
| 17:32 | dobry-den | I'm writing my own file store for ring's multi-param upload so that I can replace io/copy with a loop that stops if the stream is larger than X bytes. https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/multipart_params/temp_file.clj#L45 |
| 17:32 | dobry-den | Has anyone already done this? |
| 17:33 | dobry-den | Because I'm fetching my shears |
| 17:44 | Bracki | Argh, java.lang.IllegalArgumentException: Don't know how to create ISeq from: com.mysql.jdbc.JDBC4ResultSet |
| 17:45 | Bracki | These examples are great: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#SELECT |
| 17:45 | inklesspen | is clojurescript discussed here as well? |
| 17:45 | Bracki | But they don't work with new API and I just can't get them to work..... |
| 17:47 | tbaldridge | inklesspen: sure, all the time :-) |
| 17:50 | inklesspen | I saw an article about Om and decided I have to learn this system. But I have a couple of questions. |
| 17:50 | inklesspen | If you need a library, do you look first for a JS library or a Clojure library? |
| 17:50 | tbaldridge | inklesspen: well the author of Om (dnolen) hangs out here a lot. |
| 17:52 | gfredericks | Bracki: check out the docstring for the query function |
| 17:52 | tbaldridge | inklesspen: often a clojure lib, but wrapping JS libs isn't hard |
| 17:53 | gfredericks | Bracki: the link I gave you before has query examples |
| 17:53 | Bracki | What does # and % mean? |
| 17:54 | deadghost | # function % interpolate |
| 17:55 | mischov | #(inc %) = (fn [x] (inc x)) |
| 17:55 | gfredericks | # means various things |
| 17:55 | gfredericks | #() is a function |
| 17:55 | dnolen | inklesspen: there's an active #clojurescript channel now, but you can ask questions here too |
| 17:56 | dnolen | inklesspen: you can use JS libs, that's how Om works w/ React, but you lose the Google dead code elimination juice |
| 17:57 | deadghost | what is Google dead code elimination juice |
| 17:57 | inklesspen | dnolen: cool. it lacked a topic (and any conversation in the last half hour) so I didn't know if it was an active channel |
| 17:57 | inklesspen | deadghost: the Closure js compiler can remove code which will never run |
| 17:57 | gfredericks | clojurebot: Google dead code elimination juice is part of this complete breakfast |
| 17:57 | clojurebot | You don't have to tell me twice. |
| 17:57 | dnolen | inklesspen: if I can find the functionality in Google Closure I'll usually for for that, or a CLJS lib. But lots of people rely on JS libs, it works OK. |
| 17:57 | deadghost | whoa whoa whoa |
| 17:57 | deadghost | so you're saying |
| 17:58 | deadghost | it can remove unused jquery |
| 17:58 | dnolen | deadghost: no only code that follows the Google Closure coding standards |
| 17:58 | dnolen | deadghost: so it works for Google Closure, and ClojureScript (we do the hard work for you) |
| 17:58 | ivan | https://developers.google.com/closure/compiler/docs/api-tutorial3#dangers |
| 18:14 | aaronj1335 | i'd like to define #({:foo %1}), that is a function that returns a hash map w/ the 'foo' key set to the first arg passed in, but i get an error. what's the right way to do this? |
| 18:15 | aaronj1335 | or do i just need to do (fn [arg] {:foo arg}) ? |
| 18:15 | tpope | yes |
| 18:16 | Cr8 | aaronj1335: remember that #(foo %) expands to something like (fn [x] (foo x)), not (fn [x] foo x) |
| 18:16 | S11001001 | ,'#(foo %) |
| 18:16 | clojurebot | (fn* [p1__25#] (foo p1__25#)) |
| 18:16 | Cr8 | so #({:foo %1}) == (fn [x] ({:foo x})) |
| 18:16 | S11001001 | aaronj1335: you can do that to see what your #() thing expands to |
| 18:17 | S11001001 | ,'#({:foo %1}) |
| 18:17 | clojurebot | (fn* [p1__50#] ({:foo p1__50#})) |
| 18:18 | aaronj1335 | Cr8 ah i see, that's why the error was talking about function arity, b/c it was trying to apply {} |
| 18:18 | aaronj1335 | ,''#({:foo %1}) |
| 18:18 | clojurebot | (quote (fn* [p1__75#] ({:foo p1__75#}))) |
| 18:20 | S11001001 | ,'#(do {:foo %1}) |
| 18:20 | clojurebot | (fn* [p1__100#] (do {:foo p1__100#})) |
| 18:23 | Cr8 | ,({:foo :a}) |
| 18:23 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap> |
| 18:23 | Cr8 | ,({:foo :a} :a) |
| 18:23 | clojurebot | nil |
| 18:23 | Cr8 | ,({:foo :a} :foo) |
| 18:23 | clojurebot | :a |
| 18:26 | deadghost | >look over clojurescript for the first time |
| 18:26 | deadghost | sweet jesus |
| 18:26 | deadghost | is it really as good as it looks? |
| 18:30 | S11001001 | well ambrosebs hasn't ported core.typed to it yet, so |
| 18:30 | hyPiRion | is it??? |
| 18:30 | lazybot | hyPiRion: How could that be wrong? |
| 18:30 | hyPiRion | ^ |
| 18:35 | Morgawr | for all the LightTable users + web developers, I wrote a plugin to choose color codes and embed them in your code, https://github.com/Morgawr/lt-color-picker please try it out if you're interested so I can squash out bugs :) |
| 18:41 | bbloom | Morgawr: a screenshot would be nice :-) |
| 18:43 | Notte | Why doesn't this function get realized even with doall? http://hastebin.com/gevuvobitu.lisp |
| 18:43 | Morgawr | bbloom: http://www.morgawr.eu/p/1390693226.png not much to show when it's not in motion |
| 18:44 | Morgawr | you add it under your cursor, click on the color bar and select the color you want, then the color is added at the cursor's position |
| 18:45 | dnolen | Notte: doall is not recursive |
| 18:46 | Notte | dnolen: i think i don't understand your point, but that fn doesn't realize with take also and doseq etc |
| 18:47 | dnolen | Notte: take is lazy |
| 18:47 | bbloom | Morgawr: oh, it uses the browser/system color picker. neat |
| 18:47 | Morgawr | bbloom: yeah, I started out thinking of making my own then realized html5 has input type as color picker |
| 18:47 | Morgawr | so.. why not :) |
| 18:47 | dnolen | Notte: doseq won't help you're producing a tree not a sequence |
| 18:47 | Morgawr | made my work much much easier |
| 18:48 | rm764 | Anyone have an idea why I might get a NullPointerException in LightTable when I try to Cmd+Enter? (Running through Om tutorial https://github.com/swannodette/om/wiki/Tutorial) |
| 18:48 | Morgawr | LightTable plugin system is pretty crazy, I love it so much |
| 18:48 | dnolen | Notte: ever result from tuples (which recursively produces a tree) is a lazy seq |
| 18:48 | dnolen | s/ever/every |
| 18:48 | Morgawr | rm764: at which part do you get it? |
| 18:48 | Morgawr | usually you position the cursor over some code and eval it with ctrl/cmd+enter |
| 18:48 | dnolen | Morgawr: agreed, good stuff |
| 18:49 | Morgawr | dnolen: the editor itself is also really well coded, I spent the last few days fixing bugs and browsing the code and it's amazing how simple it is to get into it without any prior knowledge of the editor itself |
| 18:49 | Notte | dnolen: but the first fn isn't lazy, is it? |
| 18:50 | rm764 | Morgawr: After appending the "swap!" command to core.cljs and typing Cmd+Enter. However, I get it even when I Cmd+Enter the fresh file as pulled by lein. |
| 18:50 | dnolen | Notte: it is since it delegates to the next arity |
| 18:50 | dnolen | which returns a lazy seq |
| 18:53 | Morgawr | rm764: heh, sorry I can't help, I've never used Om nor tried that tutorial :( |
| 18:53 | Notte | ok, thanks dnolen |
| 18:54 | bbloom | Morgawr: experience is a bit wonky on OSX where a big color swatch pops up, but not the color picker dialog itself. you need to click this large ugly black bar to get the dialog |
| 18:55 | rm764 | Okay, thanks anyway. I thought it might be something general about the LightTable Instarepl that I don’t get. (Screenshot btw http://cl.ly/image/380G443D1f2D) |
| 18:58 | Morgawr | bbloom: the black bar is intentional (I should probably fire the "click" event upon creation, now that I think about it), what do you mean with "big color swatch"? I don't have OSX so I can't test, can you show a screenshot? |
| 19:03 | bbloom | Morgawr: that black bar == the color swatch |
| 19:03 | bbloom | Morgawr: yeah, fire the click event immediately |
| 19:04 | Morgawr | bbloom: that also saves me a lot of trouble because I wanted to have it appear directly under the cursor but, now that you point it out, it doesn't make sense to have to click on the color chooser to open it. I'll patch in a few :) thanks |
| 19:17 | akurilin | Random question: do you guys use github over bitbucket for small teams with dozens of repos? |
| 19:17 | akurilin | I'm trying to figure out what people pay the $50-100/mo for |
| 19:17 | akurilin | Just the less-terrible UX? |
| 19:18 | shep-home | If I define a protocol in namespace A, and that protocol defines function `send` |
| 19:18 | shep-home | Why do I get warnings about redefining `send` when I do `(:require [A :as something])` ? |
| 19:19 | shep-home | shouldn't it be underneath A, and not clobbering the define? |
| 19:20 | OlegYch | bitbucket repos are much slower than github |
| 19:20 | dnolen | shep-home: did you exclude `send` on namespace *A* |
| 19:20 | dnolen | s/on/in |
| 19:21 | OlegYch | in my experience i only got like a couple of connection resets from github in years, and i'm experiencing this like every day with bitbucket |
| 19:22 | shep-home | dnolen: I think it figured it out... it's not the protocol definition that is the problem, it's the fact that I implement it too |
| 19:23 | shep-home | so the implementation `send` is overwriting it |
| 19:23 | dnolen | shep-home: yes, you need to exclude `send` from namespace `A` before defining your own |
| 19:24 | shep-home | dnolen: In my case, I really want my defrecord to be in its own ns. |
| 19:24 | shep-home | I'm just in the process of splitting an overly large file |
| 19:24 | shep-home | and I guess I'm halfway though |
| 19:27 | Morgawr | bbloom: mm.. I'm trying to open the color chooser window automatically but when I fire the "click" event nothing happens... I think this is a standard HTML/Javascript problem, how do I open the color chooser window for an input type? |
| 19:27 | Morgawr | also pinging dnolen cause I know he knows a lot about clojurescript/javascript :P |
| 19:27 | dnolen | Morgawr: like you want to generate a synthetic browser event? |
| 19:28 | Morgawr | well, I have an HTML.InputElement, when I click on it (with my mouse) it opens the color chooser window (it's an input of type color) |
| 19:28 | Morgawr | but when I call (.click myelement) it doesn't open the window |
| 19:28 | Morgawr | (if I add the :click event with my own lambda, like a println on console, it fires) |
| 19:29 | shep-home | dnolen: apologies - I now get what you are trying to explain to me :-) |
| 19:30 | warz | Morgawr, perhaps there's a focus event or something that actually triggers the dialog |
| 19:30 | warz | instead of click? |
| 19:30 | Morgawr | https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement I'm checking this page |
| 19:30 | Morgawr | the only relevant methods seem to be click() and focus() |
| 19:30 | Morgawr | maybe select()? |
| 19:31 | Morgawr | nope, select doesn't work |
| 19:38 | dnolen | Morgawr: there is no such thing as a click method, you want synthetic events |
| 19:38 | Morgawr | dnolen: that mozilla page says there's a .click() method for InputElement :| |
| 19:39 | Morgawr | but yeah, I want to raise the window for the color picker as if the user had clicked on the element itself, yeah |
| 19:39 | rhg135 | i have a pretty fundamental question, if ISeqable is an interface how does String implement seq if it's a final class? |
| 19:42 | dnolen | Morgawr: if there's a way to raise the window w/o faking an event it will be a lot simpler for you |
| 19:43 | Morgawr | dnolen: I'd love to find out but I have no idea where to look, it's a standard HTML input element :( |
| 19:43 | bbloom | presumably light table has some dom operations in it somehow somewhere? |
| 19:44 | Morgawr | this is not a LightTable problem, I'm really just writing javascript |
| 19:44 | Morgawr | I have an HTML.InputElement and I need to click on it to raise the window but if I use .click it doesn't raise the window (although it fires the onclick event if I add a function to print to console to it) |
| 19:45 | bbloom | ah, well triggering a click is possible, but i think it's kinda browser quirky |
| 19:45 | bbloom | for security reasons, they might not show the dialog on a forced click |
| 19:46 | Morgawr | ugh, so there might not be a solution to have the color wheel show without manually clicking? :( |
| 19:47 | bbloom | potentially :-( |
| 19:47 | bbloom | dunno for sure |
| 19:47 | dnolen | Morgawr: http://stackoverflow.com/questions/249192/how-can-you-programmatically-tell-an-html-select-to-drop-down-for-example-due |
| 19:47 | bbloom | oh chrome only is fine tho :-) |
| 19:47 | dnolen | Morgawr: would never do this normally because it would only work in Chrome but you're in LT so no big deal |
| 19:47 | bbloom | light table uses webkit |
| 19:47 | bbloom | hurray singular platforms! |
| 19:47 | dnolen | blooberr__: well it's chromium I think it may work |
| 19:48 | Morgawr | dnolen: thanks! I'll check it out :D |
| 19:48 | dsrx | rhg135: i think strings are special cased somehow, you can see here that strings do not implement clojure.lang.Seqable https://github.com/clojure/clojure-contrib/blob/b8d2743d3a89e13fc9deb2844ca2167b34aaa9b6/src/main/clojure/clojure/contrib/core.clj#L78 |
| 19:48 | Morgawr | this looks like such a dirty hack that it almost makes me feel excited :D |
| 19:48 | dsrx | ,(instance? clojure.lang.Seqable "foo") |
| 19:48 | clojurebot | false |
| 19:49 | rhg135 | figured as such |
| 19:49 | rhg135 | 0.0 |
| 19:50 | dnolen | Morgawr: correction it doesn't appear to work in Chrome anymore, but the basics appear to work in LT |
| 19:50 | rhg135 | damn |
| 19:51 | rhg135 | so much for extansability lol |
| 19:51 | rhg135 | in interfaces anyway |
| 19:51 | dsrx | rhg135: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L498 |
| 19:52 | rhg135 | ooh |
| 19:52 | Morgawr | dnolen: the basics? but yeah, I just tried and it doesn't seem to work.. lemme see if I made some mistakes |
| 19:52 | rhg135 | it's hardcoded in the RT? wow |
| 19:53 | bbloom | rhg135: that's not that surprising when you consider protocols didn't come until much later |
| 19:53 | rhg135 | i know but wow |
| 19:54 | rhg135 | now i know why protocols exist |
| 20:01 | bbloom | rhg135: heh, yeah. the problem is that it's unreasonable to assume the type designer will figure out every polymorphic thing you may ever want to do with that type :-) |
| 20:03 | rhg135 | hmm |
| 20:03 | rhg135 | bbloom, ya, i want to make strings represent http requests</dumb-idea> |
| 20:04 | cark | what's the predicate to know if an object is a function in clojurescript ? |
| 20:05 | bbloom | cark: either fn? or ifn? depending on what you want |
| 20:05 | noonian | cark: fn? and ifn? |
| 20:05 | cark | ahyes, thanks |
| 20:05 | bbloom | it's basically fn-object? and callable? respectively |
| 20:07 | rhg135 | hmm i should make a list of things that should not be iseqs |
| 20:12 | Morgawr | alright dnolen & bbloom, looks like this javascript stuff is not really possible... the ugly color bar thing will have to stay (at least until I decide to embed my own form in a div or something) |
| 20:14 | edem_ | hi |
| 21:02 | andyf_ | Bronsa: ping |
| 21:03 | Bronsa | andyf_: hi |
| 21:03 | andyf_ | Bronsa: Howdy. You said in your recent comment the following phrase: "This means that that we're not throwing any :tag-kind anymore since it all got unified." |
| 21:05 | andyf_ | I just ran Eastwood on the crucible again after updating to latest t.a(.jvm), and it seems that it does still sometimes throw exceptions with :tag-kind, since Eastwood is still printing error messages that it only prints when it finds such keys. |
| 21:05 | andyf_ | I can dig some more if that sounds incorrect |
| 21:06 | Bronsa | andyf_: I just did a git grep "tag-kind" in t.a.j to check if I forgot to remove it from somewhere but it returned no matches |
| 21:07 | andyf_ | double-checking ... |
| 21:07 | Bronsa | andyf_: might be that the new snapshot hasn't been published yet? |
| 21:07 | andyf_ | false alarm -- I didn't update properly |
| 21:08 | Bronsa | oh, ok :) |
| 21:09 | andyf_ | I do still see tag-kind in file validate.clj |
| 21:11 | Bronsa | ... I'm an idiot andyf_ |
| 21:11 | andyf_ | Bronsa: I was an idiot first :-) |
| 21:11 | Bronsa | I did not push the commit. |
| 21:12 | dsrx | I don't trust anyone who claims to be anything other than an idiot |
| 21:13 | Bronsa | andyf_: there, pushed now |
| 21:13 | andyf_ | Bronsa: OK, I will actually update both of my local repos and retest |
| 21:13 | chchjesus | dsrx: But I'm a super genius |
| 21:37 | cark | how can I tell if an object is a core.async chan ? |
| 21:37 | cark | (in clojruescript) |
| 21:40 | noonian | cark: looking at the source, you could probably use (satisfies? cljs.core.async.impl.protocols/Channel a-chan) |
| 21:40 | cark | noonian: yes, that's what i'm doing now, but this is easily breakable if the implementation changes |
| 21:41 | cark | there really shoudl be a chan? function in the API |
| 21:41 | noonian | yeah, agree there should be a chan? fn |
| 21:46 | dsrx | add it to your async-utils namespace that you copy between every project until it's inevitably added to the api :D |
| 21:46 | kristof | Every day, someone is talking about core.async |
| 21:46 | kristof | people really like it, I guess |
| 21:46 | cark | it's really good =) |
| 21:47 | cark | dsrx: yes, i guess i'm up for that |
| 21:47 | noonian | especially in cljs where everything uses callbacks |
| 21:48 | kristof | noonian: Why? I suppose I just don't understand where this would be useful but if you're unsure if something is a chan, you shouldn't be putting or taking from it anyway |
| 21:49 | cark | kristof: i have a good use case, won't bother you with the whole story, but it's good |
| 21:49 | kristof | cark: the gist, then |
| 21:49 | kristof | cark: I was actually just referring to noonian's comment "especially in cljs where everything uses callbacks" |
| 21:50 | cark | ahwell ...there it goes. I'm doing a routing library (just like url routing). if you consider an url my.domain/movies/1123 |
| 21:50 | cark | my routing is hierachical |
| 21:50 | cark | so movies is easy, it requires just a string comparison |
| 21:51 | cark | but the movie id thing, it must matched with movie id's in a |
| 21:51 | cark | from a web service |
| 21:51 | cark | this is asynchroneous |
| 21:51 | noonian | kristof: you can convert api's that use callbacks to return channels instead which allows you to write code that feels synchronous inside a go block |
| 21:51 | cark | so my matching function sometimes takes strings an sometimes channels |
| 21:52 | noonian | i'm not sure when you'd need a chan? fn but it seems reasonable since most things in clojure provide a predicate like that |
| 21:53 | cark | i need a chan? function so that i can tell if i'm matching a string (which i can do directly) or a value that will come later via a chan |
| 21:54 | cark | the thing is, there could be more like this : my.domain/customers/12/invoices/5 |
| 21:54 | cark | there i need to match the string customer, then the chan customerid, then invoices (string) and again a chan for invoiceid |
| 21:55 | cark | maybe some more data will come from other requests while i parse the url |
| 21:55 | cark | or apply the url really |
| 21:55 | kristof | noonian: Ah, that makes sense. |
| 21:55 | cark | in the end, i have a nice map, with all the data required to display the page |
| 21:56 | kristof | cark: That also makes sense. |
| 21:57 | cark | and with all this asynchronicity going on, my calls look very much like regular code, no callback anywhere |
| 21:58 | cark | (go (display (<! (parse-url url)))) |
| 22:01 | ToBeReplaced | cark: you might be able to do one better (take! (parse-url url) display) |
| 22:01 | cark | ah indeed =) |
| 22:03 | cark | i could make everything channels, wrap my string matcher in a channel too .... but that seems a bit overkill |
| 22:07 | maravillas | cark: the uniformity might be nice, but barring that, why not just use string? instead of the satisfies? call? |
| 22:08 | cark | maravillas: i might want to compare some data type that i din't think of |
| 22:09 | kristof | maravillas: because string? is not the thing that doesn't exist, it's chan? |
| 22:09 | cark | i'm not really parsing URLs, but a representation of these |
| 22:09 | maravillas | i see |
| 22:09 | cark | so the last case is the = matcher |
| 22:27 | noonian | i'd just put everything in a channel, if it's a string the channel will already have a value and it should make the code a little cleaner |
| 22:27 | dsrx | must fight urge to prematurely refactor |
| 22:27 | cark | noonian: i'm actually trying it in a new branch, see how it performs |
| 22:29 | dsrx | can i get around the 'protocol reloading in a repl' problem if i just defer protocol implementations to outside functions? |
| 22:29 | dsrx | e.g. (deftype Foo ISomething -whatever (foo-whatever)) |
| 22:29 | dsrx | rather than inlining foo-whatever into the protocol implementation |
| 22:32 | dsrx | s/deftype/defrecord |
| 23:05 | dissipate | Trying to convince others to use Haskell is permitted between 0200 and 0500 UTC <---- is that a joke? |
| 23:06 | kristof | dissipate: blame ~bitemyapp for it |
| 23:06 | kristof | dissipate: but yes, it's a joke |
| 23:17 | gfredericks | ,(doc aset) |
| 23:17 | clojurebot | "([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val." |
| 23:17 | gfredericks | "Works on Java arrays of reference types." |
| 23:17 | gfredericks | is that supposed to imply it doesn't work with primitive arrays? |
| 23:18 | lemonodor | i'm having trouble getting my :test dependencies loaded. Am i doing something wrong? https://gist.github.com/wiseman/8628331 |
| 23:19 | lemonodor | (lein 2.3.4) |
| 23:19 | riley526 | So I'm reading this https://github.com/swannodette/om/wiki/Tutorial and at the end it says "proceed to the next section and we'll show how to do it." Where's the next section? (cc dnolen) |
| 23:19 | dnolen | riley526: not yet written |
| 23:20 | riley526 | dnolen: haha ok |
| 23:20 | gfredericks | lemonodor: you have two :profiles entries |
| 23:20 | gfredericks | presumably the first one is being overridden |
| 23:20 | lemonodor | oh :) of course it would be something verrry simple. thanks! |
| 23:21 | gfredericks | np |
| 23:21 | lemonodor | I guess it would be difficult for leoin to issue a warning in this situation, too. |
| 23:22 | gfredericks | I was about to say the exact opposite |
| 23:22 | gfredericks | I don't know for sure but I suspect it'd be an easy patch |
| 23:23 | riley526 | dnolen: for clearing the contents of an input, so far the only way I'm aware of how to do that is to bind the field value to my app state and change the state back to "". I assume that's wrong though, can you hint at how it should be done? |
| 23:24 | dissipate | i know this might be OT but does anyone know the relationship between relevance and cognitect? is relevance a subset of cognitect? |
| 23:24 | dnolen | riley526: that's the way React people do it, so that's a valid solution |
| 23:24 | riley526 | dnolen: feels very roundabout though |
| 23:25 | riley526 | I'm not opposed to going with that |
| 23:25 | dnolen | riley526: some things in React are more work so other things can be easy |
| 23:25 | riley526 | alright then |
| 23:26 | riley526 | thanks for your input |
| 23:26 | gfredericks | lemonodor: if you feel like patching leiningen, I see the defproject macro uses map destructuring and you could modify that to check for dupes ;-) |
| 23:26 | dsrx | react binds one-way from owner to child right? |
| 23:29 | devn | RE: kovas' post on the list. Is this any better? |
| 23:29 | devn | ,(ns-resolve *ns* (symbol (str "map->" 'fooBar))) |
| 23:29 | devn | i know it's still string munging, but his example seemed much more complex |
| 23:29 | clojurebot | nil |
| 23:32 | devn | or is there a way to track when the other constructors are created? |
| 23:38 | gfredericks | devn: why would *ns* be the correct value? |
| 23:38 | gfredericks | probably it's just user |
| 23:45 | d11wtq | Are there any clojure (or java) libraries that can convert fuzzy strings like "3pm tomorrow" into actual Date objects? |
| 23:47 | d11wtq | Ah, found one! http://natty.joestelmach.com/ |
| 23:47 | devn_ | gfredericks: fair enough |
| 23:47 | devn_ | gfredericks: simpler still: |
| 23:48 | devn_ | ,(defrecord fooBar [x y z]) |
| 23:48 | clojurebot | sandbox.fooBar |
| 23:48 | devn_ | ,`~map->fooBar |
| 23:48 | clojurebot | #<sandbox$eval26$map__GT_fooBar__46 sandbox$eval26$map__GT_fooBar__46@10035f0> |