2015-02-09
| 00:38 | julianleviston | At the AST level, does FP build substantially different patterns of form than OOP? |
| 00:41 | justin_smith | julianleviston: you will see more explicit state passing and less mutation, which shows up even at the AST level |
| 00:42 | julianleviston | justin_smith: erm… factoring mutation out. |
| 00:42 | julianleviston | justin_smith: in other words, assuming immutability is used in both. |
| 00:43 | justin_smith | julianleviston: then you will see more passing of opaque structures (and invocation via messages / methods) and less threading of data through first class data processing functions |
| 00:44 | justin_smith | err, I reversed that, but I hope it's clear enough |
| 00:46 | julianleviston | isn’t a method just a function? |
| 00:46 | justin_smith | julianleviston: no, not in java (or thanks to the jvm, clojure) |
| 00:46 | julianleviston | justin_smith: but your main point about immutability holds true - it’s very rare to program OOP with immutable structures. |
| 00:46 | justin_smith | methods are not first class |
| 00:46 | justin_smith | they can't be function arguments |
| 00:46 | julianleviston | justin_smith: at the AST level, I mean... |
| 00:47 | julianleviston | doesn’t a method/message call reify down to a function call? |
| 00:47 | julianleviston | I guess I’d have to look into the JVM. Yeah, nevermind. I don’t really care enough yet to know. |
| 00:47 | justin_smith | julianleviston: still, they are not top level - obj.meth() in strict oo should compile to (send-message obj meth) |
| 00:48 | justin_smith | though I guess that looks almost first class huh? but the thing is "meth" is something totally different, based on what obj you send it to |
| 00:48 | julianleviston | dynamic dispatch |
| 00:48 | justin_smith | sure |
| 00:49 | julianleviston | Makes me wonder how systems like Intentional Programming are even vaguely possible… are they just using tricks? I guess until (if?) it’s open sourced, we won’t really know. |
| 00:54 | julianleviston | justin_smith: and I wonder, therefore, if idiomatic stateful mutable OOP code could somehow be machine transformed into idiomatic immutable FP code if one had captured the intent clearly enough. |
| 00:55 | justin_smith | isn't that part of what haskell is for? translating pure code into side effecting code at compile time, because the monads and the invarients ensure that things will work |
| 00:57 | julianleviston | or at least rather… that if one had captured the intention as source (not *quite* AST, really, but AST around intention, not state transformation or declaration of functional relationship)… that one could machine generate other syntactic and idiomatic forms. I guess this is largely what the other half of SEXPRS were supposed to be… whatever they were called again. I can’t rememeber. Been a while since I last rea |
| 00:57 | julianleviston | JM’s paper. |
| 00:57 | julianleviston | justin_smith: I don’t know. I didn’t get that deeply into haskell (yet?) |
| 00:57 | justin_smith | julianleviston: the other kind were m-expressions |
| 00:58 | julianleviston | ah yeah right. |
| 00:58 | julianleviston | Tho… they were still functional in nature if IIRC. |
| 00:59 | justin_smith | yeah. And ml (the ancestor of haskell) started out pretty similar to mexprs (and was at first implemented in lisp) |
| 00:59 | justin_smith | so we are basically the neanderthals that homo-haskellus somehow never wiped out |
| 01:00 | julianleviston | haha :) |
| 03:13 | slipset | in clj-tagsoup, when parsing a document you're given a hiccup structure |
| 03:14 | slipset | this structure is basically a vector containing a keyword describing the tag [:html {} [:body ...]] |
| 03:14 | slipset | this leads me to two questions. |
| 03:14 | slipset | 1) what's the idiomatic way to pick out a element down a path, if the vector were a map, I'd use get-in |
| 03:15 | slipset | I could of course use get-in here as well, but it would take the form of (get-in html [0 1 4 3]) which is not that readable |
| 03:16 | slipset | 2) The other question, what's the rationale behind letting the hiccup structure be presented a vector and not a map? |
| 03:16 | TEttinger | does hiccup provide something for this? |
| 03:16 | TEttinger | maps can't have duplicate keys |
| 03:16 | slipset | (inc TEttinger) |
| 03:16 | lazybot | ⇒ 40 |
| 03:17 | TEttinger | thanks |
| 03:18 | slipset | doesn't seem like hiccup has this in it's api. |
| 03:18 | julianleviston | also MapEntry order isn’t guaranteed, is it? |
| 03:18 | slipset | julianleviston: I guess it could have been an ordered map? |
| 03:19 | julianleviston | slick: I guess they thought it’d be obvious to someone who knew Clojure data structures, perhaps? |
| 03:19 | julianleviston | oops. |
| 03:19 | julianleviston | -> slipset |
| 03:20 | TEttinger | yeah, I'm not sure what the best way is either here. maybe a zipper |
| 03:21 | julianleviston | this is one of those problems that isn’t as trivial as one might assume at the beginning |
| 03:26 | julianleviston | slipset: this thing I just found could be quite helpful: http://codereview.stackexchange.com/questions/19066/clojure-find-specific-element-in-html-tree |
| 03:27 | julianleviston | slipset: you might have already seen it, but it’s specifically about finding specific named elemets (link in their case) within tagsoup output. |
| 03:28 | julianleviston | something like that should prolly be PR’d into tag soup |
| 03:34 | slipset | julianleviston: thanks, and I agree it should probably be in tagsoup |
| 03:35 | slipset | TEttinger: i guess it kinda smells like zipper. I've carefully avoided getting into zippers (no pun intended) but this might just be the time :) |
| 03:40 | julianleviston | slipset: the only trouble is zippers don’t provide random access… they presuppose a structural awareness. Guess I’m not sure what you’re trying to accomplish, but it’s the equivalent of choosing imperative programming over declarative programming… one is much easier to reason about |
| 03:40 | julianleviston | slipset: zippers are quite good when you know the structure won’t change is what I’m getting at. |
| 03:43 | amalloy | slipset: convert hiccup style vectors (which are absolutely awful to consume, what sadist gave you one of those) to data.xml-style maps of lists, with sexp-as-element from clojure.data.xml. at least then you could use xml-zip or something on the result |
| 03:44 | julianleviston | amalloy: tagsoup gave it to him… he’s pasing html |
| 03:44 | julianleviston | parsing* |
| 03:50 | slipset | amalloy:will look into that, thanks! |
| 03:50 | slipset | (inc amalloy) |
| 03:50 | lazybot | ⇒ 224 |
| 03:51 | julianleviston | There’s a hidden pain when converting html to xml. Hopefully you’re aware of that. HTML parsing is *hard*. |
| 03:51 | slipset | julianleviston:hard? I thought you could just throw a regex at it? |
| 03:52 | julianleviston | slipset: no. |
| 03:52 | julianleviston | slipset: are you just trolling? |
| 03:52 | slipset | julianleviston:yes http://stackoverflow.com/a/1732454/9422 |
| 03:53 | julianleviston | slipset: damn you… you had me going LOL :) |
| 03:53 | julianleviston | slipset: soz :) |
| 03:53 | slipset | :) |
| 03:53 | julianleviston | that’s one of my favourite pages on stack overflow, I think. |
| 04:13 | michaelr` | 'lein cljx once' here first tries to load the code which requires the cljxed namespace (before preproccesing) and fails.. anyone has an idea of what I could possibly be doing wrong? |
| 04:14 | julianleviston | michaelr`: dependencies and targets are especially important to get right. Also, lein clean can often be your friend when building cljx projects |
| 04:16 | michaelr` | thanks |
| 04:16 | michaelr` | I found the little fucker.. |
| 04:16 | michaelr` | ;) |
| 04:17 | michaelr` | It's the component reloaded stuff in user.clj |
| 04:17 | michaelr` | Hits me all the time. How pepole are working with this stuff? |
| 04:17 | michaelr` | damn |
| 04:18 | julianleviston | michaelr`: oh yeah, I didn’t ever get a good state with that stuff either. Had lots of problems with it. I’m currently not doing component stuff… I’ll have to address it again in another month or so tho… |
| 04:19 | julianleviston | I couldn’t work out a nice way to do ongoing dev without restart pain… and yet so many clojurists seem to apparently work in that way with a live REPL… |
| 04:19 | michaelr` | yes, the workflow works great for me actually. just this issue with the 'user' namespace |
| 04:20 | julianleviston | michaelr`: you should definitely make a youtube screencast and then show me :) I’m super keen to see it in action. |
| 04:20 | julianleviston | michaelr`: if you have the time/inclination. |
| 04:20 | michaelr` | i could give up on user.clj of course and load the workflow stuff from a different namespace.. |
| 04:20 | jaen | I'm currently trying the reloaded component workflow and it's all nice until something fails to parse. Then I have to restart the repl from scratch : | I'm not sure if I'm doing something wrong, but that's somewhat annoying |
| 04:22 | michaelr` | julianleviston: nothing too much exciting actually, just when I make some changes in code which are not reloaded automatically with wrap-reload or manually loading the namespace in the repl I type (reset) in the repl and get everything fresh and ready in one sec or less.. |
| 04:23 | michaelr` | jaen: are you using reloaded.repl ? |
| 04:27 | jaen | michaelr`: whatever it is modular generator outputs. Didn't know about reloaded.repl, but checked the code and it's basically doing the same, excep lacking `disable-reload!`. Let me see if it makes a difference. |
| 04:38 | jaen | michaelr`: That's how it behaves and my dev.clj - https://gist.github.com/jaen/4b010b31bfce994549e9 - it seems to do what reloaded.repl is doing and yet if I hace a syntax error I'm stuck. So it's interesting you don't get such behaviour; I'll try using reloaded.repl as is instead of what modular generated and see if it helps. |
| 06:13 | acron^ | morning all |
| 06:18 | noncom | acron^: good morning |
| 06:20 | kaplan | Hi |
| 06:20 | kaplan | I'm a beginner in programming, cna learning Clojure still be useful for me? |
| 06:21 | acron^ | kaplan: of course! clojure is for everyone |
| 06:22 | kaplan | acron^, Thanks, I'm using the book 'Programming Clojure, Second Edition" and the book says Clojure is aimed at expereinced programmers |
| 06:23 | acron^ | Well, I'd disagree with that in broad terms. That book may well make some assumptions about your programming experience, however |
| 06:23 | acron^ | I've not read it |
| 06:27 | vijaykiran | acron^: you can also try http://www.braveclojure.com and other online resources too |
| 06:28 | acron^ | kaplan: ^ |
| 06:29 | kaplan | Nah, it uses Emacs |
| 06:29 | kaplan | I'm more of a Vim person |
| 06:30 | profil | kaplan: I use vim and read through braveclojure, just skip the chapter about emacs |
| 06:31 | kaplan | profil, ah, thanks |
| 06:35 | vijaykiran | acron^: sorry - misread the id. |
| 06:35 | vijaykiran | kaplan: or use spacemacs :P |
| 06:40 | profil | or lighttable? |
| 06:42 | acron^ | i use lighttable |
| 06:43 | kaplan | profil, acron^ , I used lighttable a year ago but couldn't figure anything out |
| 06:43 | acron^ | it's gotten a lot better since |
| 06:43 | kaplan | Maybe it can be a good candidate for my ByteSize tutorials program |
| 06:44 | kaplan | My objective learning Clojure is to make a small MOOC platform where you can upload small tutorials and maybe sell them for something like $5 |
| 06:45 | profil | I tried to switch to emacs but its too hard.. tried lighttable, but didnt feel right |
| 06:55 | acron^ | emacs and vim scare me.,... |
| 06:55 | kaplan | acron^, which OS do you use? |
| 06:56 | toad | quick stupid question for anyone that has worked with light table |
| 06:56 | acron^ | windows mostly |
| 06:56 | acron^ | then ubuntu |
| 06:56 | uris77 | I'm trying out ring + friend on my first clojure project. I started out without using friend, and my app booted up fine. As soon as I added friend I get this exception when I try to start the app No such var: clojure.core.cache/through . Can't figure out how to fix that. |
| 06:56 | toad | i am able to connect to a remote leiningen repl |
| 06:57 | toad | but i can't view the repl in light table. i can't enter commands like in instarepl |
| 06:57 | kaplan | acron^, can you help me a bit to set it up on windows |
| 06:57 | acron^ | kaplan: lighttable? of course, it's easy, just download the zip :) |
| 06:58 | kaplan | acron^, how to link it to clojure and all? |
| 06:58 | kaplan | acron^, I get an error saying java not found |
| 06:58 | acron^ | interesting |
| 06:58 | acron^ | do you have the latest JDK > |
| 06:59 | acron^ | http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html |
| 07:01 | toad | help... someone... |
| 07:02 | toad | i have connected to a remote lein repl in lighttable but can't for the life of me figure out where i enter commands... i can see the connection is live and i can use the repl from the terminal. the question is: how do i use the repl from inside light table??? |
| 07:03 | acron^ | if you then start an instarepl, it should ask you which connection to resolve with |
| 07:04 | toad | ah, thanks, let me try |
| 07:05 | toad | acron^ looks like that did the trick. thanks again |
| 07:05 | acron^ | :) |
| 07:31 | toad | ok, so now i'm trying to connect leiningen to a local maven repository by adding this to project.clj -> :repositories ["local" "/home/my-name/Desktop/asdf/my-stuff/maven"] however lein deps throws an exception... i'm certain this line is the problem, because if i remove it there is no error. any ideas? |
| 07:43 | vijaykiran | toad: what do you mean by local maven repo ? |
| 07:43 | toad | vijaykiran http://stackoverflow.com/a/9917149 i'm trying to add a local jar as a dependency on my project |
| 07:44 | tcrayford____ | toad: what error do you get |
| 07:44 | toad | vijaykiran actually i should use {} instead of [], now the exception goes away, but i still can't make lein deps work: it tries to interpret the path as an online resource, not as a local folder |
| 07:45 | tcrayford____ | toad: did you copy the exact thing from that? It uses a java.io.file constructor |
| 07:45 | toad | i've also tried "file:/home..." etc |
| 07:45 | toad | i tried that and it doesn't work |
| 07:46 | vijaykiran | can you gist your exception ? |
| 07:46 | toad | i've solved the exception part. i was using a vector while a map was expected |
| 07:46 | toad | now i only get a message from lein deps that it couldn't file the online resource |
| 07:47 | tcrayford____ | toad: what happened when you tried the java.io.File constructor? |
| 07:47 | toad | same thing. sec... |
| 07:48 | toad | Retrieving jlink/jlink/1.0.0/jlink-1.0.0.pom from local Could not transfer artifact jlink:jlink:pom:1.0.0 from/to local (file:/home/my-name/Desktop/asdf/my-stuff/maven/): no supported algorithms found This could be due to a typo in :dependencies or network issues. If you are behind a proxy, try setting the 'http_proxy' environment variable. |
| 07:48 | toad | tcrayford____ |
| 07:49 | toad | so, that java.io.File stuff expands to file:/home/my-name/Desktop/asdf/my-stuff/maven/ |
| 07:49 | tcrayford____ | ah |
| 07:49 | tcrayford____ | yeah, no idea here after that. Try asking in #leiningen? |
| 07:49 | toad | k thx anyway |
| 07:50 | tcrayford____ | though there are some other answers in that stackoverflow that might help after the first one |
| 07:50 | tcrayford____ | e.g. https://github.com/kumarshantanu/lein-localrepo |
| 07:50 | toad | i guess i'll check those out too |
| 07:50 | toad | thanx |
| 09:06 | michaelr` | how should I deal with a stackoverflow in the cljs compiler? |
| 09:07 | michaelr` | something with the namespace somewhere: |
| 09:07 | michaelr` | at cljs.analyzer$macro_autoload_ns_QMARK_.invoke(analyzer.clj:1237) |
| 09:07 | michaelr` | at cljs.analyzer$desugar_ns_specs$to_macro_specs__20592$fn__20595.invoke(analyzer.clj:1268) |
| 09:13 | michaelr` | looks like cyclic ns definitions |
| 09:16 | dnolen | michaelr`: which aren't supported |
| 09:19 | dnolen | michaelr`: http://dev.clojure.org/jira/browse/CLJS-1023, but it's a regression w/ regard to error reporting for sure http://dev.clojure.org/jira/browse/CLJS-1023 |
| 09:19 | dnolen | oops sorry for linking to the issue twice |
| 09:21 | acron^ | hey david |
| 09:23 | dnolen | acron^: hello |
| 09:34 | ticking | trying to teach somebody new on the team how to get clojurescript up and running makes me never want to touch it again... |
| 09:36 | ticking | has anybody found a reliable workflow that doesn't generate/requrie 200 lines of boilerplate lein config and gives a straightforward route from lein new to a running cljs repl? |
| 09:38 | Glenjamin | lein new mies works pretty well for me |
| 09:38 | Glenjamin | or figwheel if you want browser reloading |
| 09:40 | ticking | Glenjamin: yeah but mies comes with weird build scripts, and figwheel comes with a giant project.clj |
| 09:41 | Glenjamin | this was what i ended up with last time i did something |
| 09:41 | Glenjamin | https://github.com/defshef/defshef12/blob/master/project.clj |
| 09:41 | dnolen | ticking: you don't need any of the build scripts that come w/ mies, those are optional if you care to understand them. |
| 09:42 | ticking | Glenjamin: yeah this is what mine look a like most of the time too, but if you're new to cljs your head will just go boom ;) |
| 09:43 | Glenjamin | i found that nothing was particularly complex once i read the docs - but when i used that config for a beginner workshop i just said "download this, run lein dev, start coding" |
| 09:44 | Glenjamin | then they get the hang of how to use it before looking into how it works |
| 09:45 | dnolen | ticking: heh, the complexity of cljsbuild info is not qualitatively different from anything else JS asset related I've used before. |
| 09:48 | michaelr` | dnolen: yes thanks, I got used to the improved error reporting in clj ;) |
| 09:48 | ticking | dnolen: yeah I know but getting a repl running is still a huge pain point |
| 09:48 | dnolen | michaelr`: yeah just a regression |
| 09:49 | ticking | being able to start a cljs nrepl directly would be a lot nicer than having to bootstrap it from a clojure repl for example |
| 09:50 | dnolen | ticking: that isn't a ClojureScript problem. That's a 3rd party CLJS nREPL problem. |
| 09:50 | michaelr` | ticking: figwheel does that in latest versions (SNAPSHOTS) |
| 09:50 | Glenjamin | having ./script/repl "just work" in mies is awesome |
| 09:50 | ticking | dnolen: yeah I'm quite happy with clojurescript, just not with the toolchain surrounding it |
| 09:51 | dnolen | ticking: granted recently there's been some churn around CLJS nREPL since we were fixing general CLJS REPLs brokenesss |
| 09:51 | ticking | michaelr`: yeah but figwheel also adds live reloading which can't be turned off afaik |
| 09:51 | ticking | dnolen: yeah much apreciated btw thanks a lot :D |
| 09:52 | michaelr` | ticking: i think you can in latest versions |
| 09:52 | ticking | michaelr`: hrm interesting :) |
| 09:52 | michaelr` | ticking: but ohmpf live reloading is super cool ;) |
| 09:53 | michaelr` | my f5 thanks me a lot |
| 09:53 | ticking | michaelr`: yeah but also super opaque :D |
| 09:54 | michaelr` | what do you mean by opaque? |
| 09:55 | ticking | michaelr`: it's nice when it works but boy does it break when it breaks |
| 09:55 | kaplan | Anybody uses Lighttable here? |
| 09:57 | ticking | dnolen: I think the new repl stuff you implemented makes a really nice repl workflow possible. One could have a repl build target that just generates a :output-to file with minimal repl bootstrapping code and then starts an nrepl. |
| 09:57 | michaelr` | ticking: i've started a new project a week ago and *everything* is breaking around me like it's world war III, but eventually things should stabilize - once you learn where the mines are you stop steping on them |
| 09:58 | michaelr` | i thought of using a horse training analogy, but I've never trained horses so.. |
| 09:58 | ticking | michaelr`: yeah no ;) I like my projects deterministic :D, where I know exactly what code got reloaded, not a js diff foo thing. |
| 10:03 | dnolen | ticking: definitely, we're getting there. there's not much more new coming to REPLs other than proper handling of termination. |
| 10:04 | AWizzArd | I have a 10 gigabyte input stream (with-open [in (io/reader file)] …) |
| 10:04 | AWizzArd | I want to process lines (doseq [line (line-seq in)] …) |
| 10:04 | AWizzArd | But I want to do it in batches. How can I achieve that in a memory efficient way? |
| 10:05 | AWizzArd | (doseq [p (partition-all 5 (line-seq))] …) won’t do the trick, as p is a pointer to the head. |
| 10:05 | AWizzArd | So, the memory consumption would grow. |
| 10:06 | stuartsierra | AWizzArd: in that example, p is a pointer to each batch. |
| 10:07 | ticking_ | dnolen: btw I don't think breaking all the repls out there was a bad thing :D, it forced people to look at how to run a cljs repl without the billion onion shells of tooling around it |
| 10:07 | AWizzArd | stuartsierra: yes true. |
| 10:08 | AWizzArd | stuartsierra: I need to try something quickly. |
| 10:08 | dnolen | ticking_: yes, it's really not that hard nor that magical :) |
| 10:08 | ticking_ | dnolen: yeah no magick is goot :D |
| 10:09 | ticking_ | s/t/d |
| 10:23 | AWizzArd | stuartsierra: Seems to be working. The funny thing is that I tried something similar a few days ago, and for some reason it didn’t work. |
| 10:27 | stuartsierra | If your batch size was very large you could run out of memory on a single batch I suppose |
| 11:41 | kaplan | Hi! I'm a beginner to programming, can anyone explain Atoms and Reference Types in simple language? |
| 11:43 | johann | kaplan: if you had to take your best shot at what a reference type was what would you say? its easier to explain if i can work with your intuitions instead of talk at you :) |
| 11:44 | kaplan | johann, absolutely no idea |
| 11:45 | justin_smith | kaplan: values cannot change. Atoms and other Reference types (atoms, vars, refs, agents etc.) can have different contents over time. |
| 11:45 | sm0ke | is there an efficient way to look up in map of regex keys for matching string? |
| 11:45 | kaplan | justin_smith, hmmn so, what exactly is an atom? |
| 11:45 | sm0ke | filtering is only way i can think of |
| 11:46 | Glenjamin | sm0ke: you can compile them into a Trie |
| 11:46 | Glenjamin | but that's non-trivial |
| 11:46 | Glenjamin | essentially every regex is a FSM, and FSMs compose |
| 11:46 | sm0ke | hurmm sounds complex |
| 11:46 | Glenjamin | libraries may already exist |
| 11:46 | hyPiRion | sm0ke: what are you trying to do in the first place? |
| 11:47 | justin_smith | kaplan: http://clojure.org/atoms I think this is the best writeup on atoms specifically |
| 11:47 | justin_smith | see also clojure.org/refs clojure.org/vars clojure.org/agents |
| 11:47 | sm0ke | hyPiRion: so given a map like {#".*" 1 #"a.*" 2} i want to get submap which matches string "abc" for e.g. |
| 11:47 | sm0ke | something like select-keys |
| 11:48 | Glenjamin | kaplan: the first 15 minutes of the talk "Are we there yet?" has a good overview of the value/reference separation |
| 11:48 | sm0ke | or even just any matching key-value should be fine |
| 11:48 | justin_smith | kaplan: also, there is a youtube vid by rich hickey (author of clojure) on "identity, state, and time" which is helpful |
| 11:49 | hyPiRion | sm0ke: Any matching key value? Well, you could go full FSM and do https://github.com/ztellman/automat, but I'd just walk the map first. It's easier, and if perf is a problem, you can then consider using that. |
| 11:50 | Glenjamin | justin_smith: do you know which talk that is? |
| 11:50 | justin_smith | Glenjamin: trying to find it |
| 11:50 | sm0ke | wow ztellman make really strange libraries |
| 11:50 | Glenjamin | i wrote a blog post on that recently, and could only find are we there yet which talked about that stuff |
| 11:50 | Glenjamin | which is on infoq |
| 11:51 | justin_smith | Glenjamin: value of values? |
| 11:51 | Glenjamin | could be |
| 11:51 | sm0ke | hyPiRion: i dont see how that can be used here |
| 11:51 | martinklepsch | what's the easiest way to make my -main fn blocking? (future -main) ? |
| 11:51 | Glenjamin | haven't watched that recently |
| 11:52 | justin_smith | Glenjamin: it's the one where he talks about "place oriented programming" |
| 11:52 | Glenjamin | tomorrow night we're doing "Rich Hickey movie night" at the local FP group, so might watch it there |
| 11:52 | sm0ke | facinating code though |
| 11:52 | Glenjamin | place oriented might be from simple made easy? |
| 11:52 | hyPiRion | sm0ke: So regexes are FSMs, so you can just "or" them together. |
| 11:52 | Glenjamin | oh, value of values looks like the right one |
| 11:52 | sm0ke | hyPiRion: would it be really that fast using automat? |
| 11:53 | justin_smith | kaplan: value of values https://www.youtube.com/watch?v=-6BsiVyC1kM |
| 11:53 | sm0ke | hurmm i will just filter map for now and will have a look at automat later as you suggested |
| 11:53 | sm0ke | thanks hyPiRion |
| 11:54 | hyPiRion | sm0ke: it'd be linear to the size of your input, whereas iterating over every regex will be linear* to the amount of regexes you have |
| 11:54 | hyPiRion | idk about constant factors. Might be faster, might not. |
| 11:54 | Glenjamin | regexes are also linear on input, no? |
| 11:54 | hyPiRion | Glenjamin: yeah, so max(|input|, |regexes|) is more technically correct |
| 11:55 | hyPiRion | dangit, I don't |
| 11:55 | sm0ke | hyPiRion: yes true filter would be propotional to key space |
| 11:55 | justin_smith | kaplan: also, this is a good writeup on values / identity / state in clojure http://clojure.org/state |
| 11:55 | hyPiRion | |regexes|*|input| worst case. |
| 11:56 | sm0ke | hyPiRion: but how does that automata works ? is it based on that string matching algo |
| 11:56 | sm0ke | i dont remember the name |
| 11:56 | kaplan | thanks justin_smith |
| 11:56 | sm0ke | KMP |
| 11:56 | hyPiRion | sm0ke: it's just FSMs (finite state machines) |
| 11:56 | justin_smith | kaplan: and feel free to ask here about any questions you have about that material |
| 11:57 | hyPiRion | sm0ke: regexes are based upon FSMs, and although they are a superset, you can most likely model all reasonable regexes as a FSM |
| 12:03 | doritostains | how can I add an item to a collection that is nested inside a map? (assoc-in res [:rows label] item) replaces the collection. Do I have to first pull out the collection with get-in, conj the new item and then assoc it back in? |
| 12:05 | sm0ke | doritostains: update-in should do that i guess |
| 12:06 | sm0ke | ,(update-in {:a {:b []}} [:a :b] conj 1) |
| 12:06 | clojurebot | {:a {:b [1]}} |
| 12:06 | doritostains | doh! thank you! sm0ke |
| 12:07 | sm0ke | :) heh there is always a function for something in clojure |
| 12:13 | sm0ke | usng automat i am able to figure out the fsm (a/compile (a/or #"a.*" "foo" #"b.*")) |
| 12:14 | sm0ke | but how do i use it |
| 12:14 | sm0ke | like equality for strings and matches for regex |
| 12:14 | sm0ke | btw (view..) is awesome! |
| 12:56 | sdegutis | What's the most popular React.JS wrapper for ClojureScript right now? |
| 12:58 | dnolen | sdegutis: probably Reagent & Om |
| 12:59 | sdegutis | dnolen: which do you prefer? |
| 12:59 | dnolen | sdegutis: I don't use Reagent. |
| 12:59 | sdegutis | dnolen: is there something about its design you don't like? |
| 13:00 | dnolen | sdegutis: not really, but I prefer single store model over a multiple store one. |
| 13:00 | sdegutis | dnolen: ah, so you mean just to store the root node in an object graph, and let every sub-component have access to a specific node in this graph, rather than owning their own root nodes? |
| 13:01 | dnolen | sdegutis: that's part of it yeah, but in general I dislike state being held in multiple locations for React based apps |
| 13:01 | dnolen | sdegutis: unavoidable for something of course, but preferable to minimized |
| 13:01 | seangrov` | sdegutis: I strongly agree with dnolen |
| 13:02 | sdegutis | dnolen: or maybe I misunderstood you |
| 13:02 | seangrov` | sdegutis: And I'd even go a bit further than him on some of the points :) |
| 13:03 | sdegutis | dnolen: your philosophy seems compatible with my use-case, as I'm writing a budget app whose state is a large object graph with a single top-level node; so if Om works better for this than Reagent, I may very well go with Om |
| 13:04 | sdegutis | seangrov`: oh? |
| 13:06 | seangrov` | sdegutis: Yeah, I don't think you want a big graph of state. Really you want a datomic-like store, queries for components (rather than state directly), and the "illusion" of local state that's acutally mapped back to a datomic/datascript-entity |
| 13:07 | sdegutis | This is what I have right now using Reagent, but I'm really unhappy with it: https://github.com/sdegutis/simplebudget/blob/master/client.cljs |
| 13:07 | sdegutis | I have a single global state, and each subcomponent has a "path" (like an x-path) to update that state via update-in. |
| 13:08 | seangrov` | sdegutis: Sounds pretty similar to the CircleCI frontend |
| 13:08 | sdegutis | This solution it feels quite a bit unwieldly. |
| 13:10 | sdegutis | Another solution I was thinking of was to give every sub-node a UUID string as an identifier, and to have a single function which knows how to traverse my graph entirely to find the node matching a given UUID, and then just do (graph-with-updated-node some-uuid attr-key new-value) |
| 13:11 | sdegutis | (That's horrible pseudo-code but you get the idea. It would be used in conjunction with swap!) |
| 13:12 | seangrov` | sdegutis: What about using DataScript instead? |
| 13:13 | seangrov` | Each component sends a parameterized signal on an event, and that's handled somewhere else that transacts! into the db with some insertion, and rerender |
| 13:16 | sdegutis | seangrov`: I haven't seen this before. |
| 13:16 | sdegutis | seangrov`: it sounds like a very nice concept, in the sense that you have more-or-less a database. |
| 13:16 | seangrov` | sdegutis: It has a learning curve, but it's great on the other side |
| 13:17 | sdegutis | seangrov`: that said, the "path" into a Clojure data tree is very similar to a set of "relationship" restraints in a database update. |
| 13:18 | sdegutis | seangrov`: and actually I have a hard time thinking that the advanced query functionality (1) can play nicely with React's efficient state-diffing, and (2) is useful for a simple case like a budgeting app |
| 13:19 | seangrov` | sdegutis: Fair enough, yeah |
| 13:20 | sdegutis | I just have a large (JSON) tree, which is read-only 99% of the time, except when you want to update a specific field (e.g. on an expense), or add or delete items (e.g. create a new expense), etc. |
| 13:20 | sdegutis | That said, I do have some "relationship" things which might make sense here. |
| 13:20 | seangrov` | sdegutis: In that case, the path is presumably a function of a few inputs |
| 13:20 | sdegutis | e.g., an expense has a relationship to another field, i.e. a funding source (e.g. bank or credit, &c.) |
| 13:21 | seangrov` | Instead of building up the paths in your components, derive them in your update fn (or a helper fn) |
| 13:23 | sdegutis | seangrov`: but the sub-components still need to know the path to whatever they represent, so that they can give this information to the updater function |
| 13:24 | sdegutis | seangrov`: viz., passing some data with the exact same purpose as the [update-in]-friendly path is still essential even using DataScript |
| 13:25 | sdegutis | My goal here today is to use as many Latin abbreviations as possible. |
| 13:26 | sdegutis | Both in quantity and variety. |
| 13:37 | m1dnight_ | Is it possible to modify what lein clean does? I would like it to remove temporary files from emacs |
| 13:37 | sdegutis | m1dnight_: why not just have emacs store them somewhere deep within ~/.emacs.d/ instead? |
| 13:38 | sdegutis | m1dnight_: that's what I do |
| 13:38 | m1dnight_ | hmmm, good point |
| 13:38 | m1dnight_ | didnt think of that, thanks for the hint :) |
| 13:42 | m1dnight_ | yeah, that works great, thanks! :) |
| 13:44 | sdegutis | :) |
| 13:55 | sdegutis | Cortex seems to take the same approach as Om: https://github.com/mquan/cortex/ |
| 14:21 | hiredman_ | http://stackoverflow.com/questions/12412038/in-clojure-are-lazy-seqs-always-chunked/12412553#12412553 I was trying to explain chunked seqs to someone and came across this, which is a perfect storm of terriblness, and yet it has a green check mark next to, which I can only assume means it was thought to be good? |
| 14:23 | tbaldridge | hiredman_: what the.... |
| 14:24 | tbaldridge | that's the worst SO post I've seen in a long time |
| 14:25 | hiredman_ | no, look, there is no saving anything, burn it all down |
| 14:26 | justin_smith | maybe he meant agent instead of atom? |
| 14:27 | justin_smith | because yeah, an atom will in no way ensure things are not re-evaluated |
| 14:27 | hiredman_ | (also look what chunked seqs have wrought) |
| 14:28 | hyPiRion | ,((fn namespaced/fact [n] (if (zero? n) 1 (* n (fact (dec n))))) 10) |
| 14:28 | clojurebot | 3628800 |
| 14:28 | hyPiRion | ,((fn fact [namespaced/n] (if (zero? n) 1 (* n (fact (dec n))))) 10) |
| 14:28 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't use qualified name as parameter: namespaced/n, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:28 | amalloy | it seems i have upvoted the question but none of the answers. that's unusual for me: i usually upvote answers and forget to upvote questions |
| 14:29 | hyPiRion | Should the first error out? I can't see any reason why you'd like to have namespaced fns |
| 14:30 | amalloy | hyPiRion: i think it's basically the same as namespace prefixes on symtols in a reify form |
| 14:30 | justin_smith | do tell? |
| 14:30 | amalloy | well like, they get ignored |
| 14:31 | justin_smith | oh, OK |
| 14:31 | amalloy | because otherwise macros like `(reify Foo (bar [x#] ...)) would be tedious |
| 14:31 | justin_smith | ahh, right |
| 14:31 | amalloy | `(reify ~'Foo (~'bar [x#] ...)) |
| 14:33 | hyPiRion | amalloy: I get the reifies and such, but not fns. `(fn fact [n#] (if (zero? n#) 1 (* n# (fact (dec n#))))) will still error out |
| 14:34 | hyPiRion | do they share code? |
| 14:34 | amalloy | well, in that they both involve calls to clojure.core/name |
| 14:35 | amalloy | like, iirc the code for (fn x ...) is like "create a local variable called (name x)" |
| 14:35 | amalloy | which does the same thing whether or not x is namespaced |
| 14:36 | hyPiRion | ,(macroexpand-1 `(fn a [] (+ 1 2))) |
| 14:36 | clojurebot | (fn* sandbox/a ([] (clojure.core/+ 1 2))) |
| 14:44 | hyPiRion | well, that gave me no answer. *shrug* |
| 14:45 | hyPiRion | Only thing is that Compiler.java seemingly ignores the ns |
| 14:46 | TimMc | Tons of things do that. |
| 14:46 | TimMc | "I want to get from Symbol to String, so I will call clojure.core/name (or equivalent.)" |
| 14:47 | amalloy | right |
| 14:48 | hyPiRion | oh well |
| 14:58 | sdegutis | hi can you see this |
| 14:58 | sdegutis | my whole mac is crashing except my irc client |
| 14:58 | sdegutis | all thanks to chrome mega-crashing (not kidding) |
| 14:58 | justin_smith | sdegutis: hello, sorry to hear about the crashes |
| 14:59 | sdegutis | :) |
| 14:59 | sdegutis | im holding out that chrome might finally force-quit like i told it to (twice), and might not have to reboot |
| 14:59 | noonian | in my experience you should reboot :P |
| 14:59 | sdegutis | oh sweet, other apps are still working |
| 15:00 | sdegutis | i just cant cmd-tab to them or click the dock icon to focus them |
| 15:00 | sdegutis | but if i click their windows, all is well :) |
| 15:00 | justin_smith | wat, apps in use other than chrome? |
| 15:00 | sdegutis | firefox ;) |
| 15:00 | sdegutis | also emacs and terminal |
| 15:00 | sdegutis | (im writing a web app!) |
| 15:01 | arrdem | http://www.catb.org/jargon/html/koans.html#id3141171 |
| 15:01 | justin_smith | arrdem: that one is awesome |
| 15:02 | sdegutis | arrdem: I can't click your link because I get the popup "The application “Google Chrome.app” is not open anymore." |
| 15:02 | sdegutis | which.. is so just, like.. what!? |
| 15:02 | sdegutis | huh?? |
| 15:03 | sdegutis | also, `ps aux` now freezes too |
| 15:03 | sdegutis | so cool |
| 15:04 | TimMc | Once you've closed basically all your programs, why not just reboot? |
| 15:04 | justin_smith | TimMc: it's the principle of the thing, surely |
| 15:04 | TimMc | Even browsers can restart and preserve session state these days. |
| 15:04 | TimMc | The only thing I don't like doing is setting up all my terminal windows again. |
| 15:05 | TimMc | What sdegutis is describing kind of sounds like what happens sometimes on Linux when you upgrade the kernel and libc out from under all your programs. :-P |
| 15:05 | crash_ep_ | TimMc just do all your work in a Xen instance |
| 15:06 | justin_smith | TimMc: yeah, been there, done that :) |
| 15:06 | TimMc | crash_ep_: I recently sat down and figured out how to script gnome-terminal and now everything is a lot happier. |
| 15:06 | justin_smith | TimMc: you can insert new ram without a reboot on linux, as long as your hardware supports it, but libc versions will still fuck you up hard |
| 15:06 | TimMc | don't I know it |
| 15:07 | justin_smith | it's the only manditory reboot thing I really know of |
| 15:07 | TimMc | Even a kernel upgrade is fine as long as you don't need to hibernate. |
| 15:07 | TimMc | Upgrading a browser without restarting it is a pretty bad idea too, though. |
| 15:08 | TimMc | ("Why am I getting blank dialog boxes?") |
| 15:08 | justin_smith | TimMc: right, but at least on Linux "app singletons" are not enforced on an OS type level, so restarting to a new app version is never hard |
| 15:09 | justin_smith | (in my experience at least) |
| 15:09 | TimMc | App singletons? |
| 15:09 | justin_smith | apps where opening a new instance always connects to a running instance |
| 15:09 | justin_smith | where it tries to prevent multiple actual instances from occuring |
| 15:09 | justin_smith | very much the mac paradigm, and some linux apps try to hack that behavior |
| 15:10 | vas | oh man, your discussion reminds me of when someone ran a command in a shell but forgot what it was, needed to preserve the program somehow before exiting it... spent some time hacking away and found the command still written out someplace in RAM. was an awesome article, maybe i can find it xD |
| 15:10 | justin_smith | vas: you can do amazing things with /proc |
| 15:10 | justin_smith | /proc/self/... iirc |
| 15:10 | vas | what does /proc mean or stand for? |
| 15:10 | ticking | vas: coredump and then spin it up everytime you need it :D, emacs generates its lisp image that way iirc |
| 15:11 | justin_smith | vas: it is the virtual system device that treats properties of running programs on a linux machine as generic resources |
| 15:11 | vas | ticking: haha that is a brilliant approach.. you mean like just load it into ram every time :D? |
| 15:11 | justin_smith | vas: can be used to read arbitrary memory as if it were a file, or a commands env vars, etc. |
| 15:11 | ticking | yeah |
| 15:12 | justin_smith | ticking: the core dump thing works as long as the thing dumped is smart enough to re-open any resources that have gone stale |
| 15:12 | ticking | true |
| 15:12 | vas | justin_smith: wow that's awesome. <3 linux |
| 15:12 | justin_smith | my first big "aha" was using gdb to rescue my girlfriend's homework that was in a locked up openoffice instance |
| 15:12 | vas | i noticed some emacs keybindings work in zsh and i was like yay!!! |
| 15:12 | arrdem | justin_smith: well played sir! |
| 15:12 | vas | you ol' charmer, you |
| 15:13 | justin_smith | just killing the program would have lost her work, so I used the gdb debugger to jump the openoffice out of the bad dialog loop it was in back to normal operation |
| 15:13 | ticking | plot twist, his gf used that trick afterwards to blackmail him with porn |
| 15:13 | justin_smith | haha |
| 15:14 | vas | what-a-twist.png |
| 15:14 | tbaldridge | OO doesn't do incremental backups or something? |
| 15:14 | TimMc | justin_smith: Ha, nice job. |
| 15:15 | justin_smith | TimMc: it was mostly having the confidence to do it - it was just a question of connect, show stack, go up a few stack frames, run |
| 15:15 | justin_smith | tbaldridge: this was ages ago |
| 15:15 | justin_smith | tbaldridge: I am sure it does now |
| 15:16 | justin_smith | tbaldridge: in fact, I could be misremembering - it was some word-processing app, maybe something pre-openoffice (but post-wordperfect to be sure) |
| 15:29 | ticking | dnolen: btw after seeing you recent tweets I wonder how you integrate cljs into cursive :D do you start an external repl or did you manage to cook up some config magic from within intellij? |
| 15:30 | dnolen | ticking: I haven't dug deep into using Cursive for application dev with ClojureScript. But I'm very happy with Cursive for Clojure dev on work projects and on ClojureScript *compiler* work |
| 15:32 | ticking | dnolen: ah yeah, its debugger and static analysis is pretty unbeatable for clojure work :D |
| 15:32 | dnolen | yep |
| 15:32 | AeroNotix | What does it use for analysis? |
| 15:33 | AeroNotix | Could that be exported as a standalone joint? |
| 15:33 | ticking | AeroNotix: I'm not sure since it's closed source |
| 15:33 | AeroNotix | ticking: shame :( |
| 15:33 | justin_smith | AeroNotix: you can ask cfleming - he tends to be very helpful |
| 15:34 | AeroNotix | justin_smith: closed source isn't something I'd like to use, if I could help it. |
| 15:34 | justin_smith | I think it uses some combo of eastwood, stuff that is built into intellij idea, and a custom macro expander |
| 15:34 | AeroNotix | for my editor, at least. |
| 15:34 | justin_smith | AeroNotix: fair enough |
| 15:34 | ticking | AeroNotix: yeah but when the choice is between something that works and something that barely works it's pretty convincing :D |
| 15:35 | AeroNotix | ticking: depends what you need |
| 15:35 | AeroNotix | which is what defines "works" |
| 15:36 | ticking | cursive is the only environment I've seen so far that has a working debugger :) |
| 15:36 | AeroNotix | For clojure? |
| 15:36 | ticking | yeah |
| 15:36 | AeroNotix | I rarely properly need debuggers. |
| 15:36 | ticking | trust me, that is something you only say when you haven't used one in a while ;P |
| 15:36 | AeroNotix | They're neat to use, but I often find that literally things with print statements and reading through the code. |
| 15:36 | AeroNotix | literally => littering |
| 15:37 | ticking | but I agree it being open source could increase the chance of getting cljs support earlier than later, but on the other hand things might not have gotten that far at all |
| 15:37 | AeroNotix | I use SLDB quite a lot |
| 15:37 | AeroNotix | which is pretty phenomenal |
| 15:37 | ticking | AeroNotix: yeah ... no :D, print statements won't help with a bug that only occurs in one of many thousand iterations :D |
| 15:37 | AeroNotix | ticking: which is where the reading comes into it |
| 15:38 | AeroNotix | actually, to be honest, reading+print statements+pair programming is how I manage without a debugger. |
| 15:38 | ticking | yeah the classical lisp debuggers are awesome |
| 16:28 | dnolen | ,(let [x :foo {a x} {:foo 1}] a) |
| 16:28 | clojurebot | 1 |
| 16:28 | dnolen | learn something new everyday |
| 16:29 | hyPiRion | ,(macroexpand-1 '(let [x :foo {a x} {:foo 1}] a)) |
| 16:29 | clojurebot | (let* [x :foo map__52 {:foo 1} map__52 ...] a) |
| 16:29 | hyPiRion | well gurr, that completely destroyed the point. |
| 16:34 | martinklepsch | I'm looking for something that takes a jar, analyses dependencies builds up a suitable classpath and runs the jar — anyone aware of such tool? |
| 16:43 | emil0r | martinklepsch: not sure if such a tool exists, but take a look at https://github.com/Raynes/bultitude , https://github.com/clojure/tools.namespace and https://github.com/technomancy/leiningen for a deep dive into libraries that does at least parts of what you're asking about |
| 16:44 | stuartsierra | martinklepsch: Jar files themselves do not necessarily declare dependencies. That metadata lives in a pom.xml file (Maven) or project.clj (Leiningen) |
| 16:46 | martinklepsch | stuartsierra: right, though jars usually contain pom.xml files rihgt? |
| 16:47 | stuartsierra | martinklepsch: If they were generated by a Maven-aware tool, then usually yes. |
| 16:49 | stuartsierra | The "lein-try" plugin will do more or less what you want for anything published in a Maven repository. |
| 16:54 | vas | Anyone here play with monger? I can get a DBObject back and a cursor, but i'm not sure how to iterate over to get it to tell me what's in the Db... |
| 17:00 | justin_smith | vas: (mc/find-maps db coll) |
| 17:00 | justin_smith | (monger.collection/find-maps) |
| 17:00 | justin_smith | vas: http://clojuremongodb.info/articles/querying.html many more docs here |
| 17:01 | vas | justin_smith: yeah I get the map back, still figuring out how to play with it |
| 17:01 | justin_smith | vas: that one gives you a seq of maps, not a cursor |
| 17:02 | vas | okay, cool. so what's the difference between a cursor and map seq? the cursor comes back at 0, ...so there's a way to increase and iterate over the result (?) whereas a seq of maps is just each collection result in a row like ducks? |
| 17:02 | justin_smith | vas: I think so, yeah |
| 17:02 | justin_smith | using a cursor is likely more efficient when you have more data |
| 17:03 | vas | justin_smith: cool cool. that makes sense. i am not worried about efficiency in the least until everything at least functions xD |
| 17:04 | vas | the idea of maps and filters is still very fresh to me. any particular resources that you think might help? |
| 17:05 | justin_smith | maps as in hash-maps or as in mapping over a collection? |
| 17:06 | vas | hash-maps would be clojure native and collections meaning internal mongo representation? i guess i was thinking hash-maps in particular. short of someone bonking me over the head and inducing insight into destructuring syntax |
| 17:07 | justin_smith | well, destructuring syntax is just sugar - there is always a way to do the same thing without destructuring, destructuring is just more concise |
| 17:07 | justin_smith | I think some of the exercises on 4clojure can be pretty helpful with hash-maps and such |
| 17:08 | vas | ah cool. i will have to check them out. |
| 17:08 | vas | okay, say one wanted to return All the documents in a collection with monger... |
| 17:08 | justin_smith | that's what monger.collection/find-maps does as far as I can tell |
| 17:09 | vas | Aha. beautiful. |
| 17:09 | vas | honestly it's kinda crazy how joyful i am programming in clojure |
| 17:10 | vas | even though i only understand it about 4/100ths of the way so far |
| 17:10 | vas | or maybe it was the punch at that party rich hosted... :P |
| 17:11 | vas | Question. I'm opening a new DB connection on every POST. is it better to open up one db connection before I start the jetty server and just hitch a ride on that? |
| 17:13 | justin_smith | vas: it's better to use a connection pool, if the api supports it |
| 17:13 | justin_smith | and ideally enough connections so that any parallel queries can be run effectively |
| 17:14 | vas | justin_smith: so a connection pool sorta acts as a black box for db connections? |
| 17:15 | justin_smith | vas: yes, they are frequently used with jdbc |
| 17:15 | vas | Very cool. |
| 17:15 | crash_ep | doesn't the JDBC driver manage its own connection pool? |
| 17:16 | crash_ep | (usually?) |
| 17:16 | justin_smith | not at all |
| 17:16 | vas | alright, in returning my database results I get a clojure.lang.LazySeq@###### ... how can I use this meaningfully? |
| 17:16 | sdegutis | Is it bad practice to use an if-let to give a more semantically meaningfully name to an expression that would otherwise just be used in an if expression, even though this name wouldn't be used at all within the body of the true-clause's expression? |
| 17:16 | crash_ep | i must be getting JDBC drivers mixed up with application servers… |
| 17:17 | justin_smith | vas: a lazy seq is just a lazily realized list. You can map over it, get an element with nth, etc. |
| 17:17 | amalloy | vas: don't call (str ...) or (println ...) or anything from that family on seqs, it's just not very useful |
| 17:17 | amalloy | prn, pr-str, stuff like that all print seqs usefully |
| 17:18 | sdegutis | amalloy, vas: I use pr-str all the time. Especially in ClojureScript. |
| 17:18 | amalloy | sdegutis: it would look weird to me |
| 17:19 | vas | oo yay news! (println x) and (str x) are a different family than (prn x), (pr-str x) ... briefly may i ask what the families are? or i can just google it i suppose. |
| 17:21 | justin_smith | (doc pr-str) |
| 17:21 | clojurebot | "([& xs]); pr to a string, returning it" |
| 17:21 | justin_smith | (doc pr) |
| 17:21 | clojurebot | "([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader" |
| 17:21 | noonian | println prints human readable representation (print and println are in the same family). The pr family of functions prints representations that are readable by clojure into data structures. |
| 17:22 | justin_smith | that last sentence in the doc |
| 17:22 | vas | you guys are the best. |
| 17:23 | {blake} | OK, guys, I'm getting flack from deployment over the JDBC deployment. Is there any way to get to MSSQL with just lein, and no maven fiddling? |
| 17:23 | hiredman_ | jdbc deployment? |
| 17:24 | justin_smith | {blake}: because of the fact that mssql is not available via maven? |
| 17:24 | {blake} | justin_smith: Yessir. |
| 17:25 | justin_smith | {blake}: microsoft refuse to make it available in that manner. You could put it in your own private repo via that wagon lib. |
| 17:25 | justin_smith | or make it part of an uberjar |
| 17:25 | AeroNotix | Do people really just throw builds over the wall to a deployment team? |
| 17:25 | {blake} | justin_smith: Oh, uber--well, crap he wants to build the uberwar. |
| 17:25 | justin_smith | AeroNotix: more likely a CI server like jenkins I'd imagine |
| 17:25 | {blake} | But if I put the jdbc driver in the directory uberwar might bundle it up anyway? |
| 17:25 | justin_smith | AeroNotix: they expect to be able to check out your source and auto-compile |
| 17:25 | lunk | AeroNotix: sometimes on fire, with the documentation as fuel |
| 17:25 | AeroNotix | justin_smith: same difference, you write it, you deploy it |
| 17:26 | hiredman_ | {blake}: you are deploying to some kind of app container, correct? |
| 17:26 | justin_smith | AeroNotix: with CI the server wants to check out your git repo and build |
| 17:26 | AeroNotix | justin_smith: that's a reasonable assumption. Clone repo -> make -> voila |
| 17:26 | justin_smith | AeroNotix: so any deps have to be available |
| 17:26 | hiredman_ | {blake}: you don't want to bundle classes provided by the app container in the jar/war/etc you are deploying |
| 17:26 | justin_smith | AeroNotix: then we have mssql, which you can't get via maven, thus problems |
| 17:26 | AeroNotix | justin_smith: check in the jar to the repo :) |
| 17:26 | AeroNotix | tyranny is as tyranny does |
| 17:27 | justin_smith | AeroNotix: that is one approach |
| 17:27 | {blake} | hiredman_: Making an uberwar to use with WildFly |
| 17:28 | vas | lunk: lol |
| 17:28 | hiredman_ | {blake}: likely are are including classes that wildfly provides in your uberwar |
| 17:29 | hiredman_ | changing how you include them isn't going to change how that potential breaks things |
| 17:32 | {blake} | hiredman_: Wait, what has that to do with WildFly? Does WildFly have JDBC built int? |
| 17:32 | {blake} | er in? |
| 17:33 | hiredman_ | {blake}: hard to tell, your initial question didn't make much sense, so I am just guessing |
| 17:33 | {blake} | I thought I could maybe just drop the JDBC into the project root. |
| 17:34 | {blake} | hiredman_: In order to use the MS JDBC driver, I had to muck with Maven to get it to point to a local directory. |
| 17:34 | {blake} | hiredman_: My deployment guy won't do that. |
| 17:34 | hiredman_ | {blake}: good for him |
| 17:35 | {blake} | hiredman_: So I'm trying to figure out if there's another way to get the JDBC driver in there that doesn't require that. |
| 17:35 | {blake} | We have an Archiva server, but that's too new, too. |
| 17:35 | justin_smith | {blake}: this is the "wagon" lib I was mentioning https://github.com/technomancy/s3-wagon-private |
| 17:35 | justin_smith | too new? |
| 17:36 | {blake} | justin_smith: Yeah, in order to use something in production, a bunch of people have to be educated on it. |
| 17:36 | {blake} | justin_smith: We just set this up last week. Nobody really knows about it. So they won't deploy with it. |
| 17:37 | justin_smith | {blake}: s3-wagon-private allows lein to find things on s3 |
| 17:37 | {blake} | justin_smith: So, wagon lets us use S3 as a repo? That--he might go for that. He's big on Amazon. |
| 17:37 | justin_smith | {blake}: right, and all the config goes in your lein config |
| 17:38 | justin_smith | no system level setup (beside setting up the s3 repo of course) |
| 17:38 | hiredman_ | {blake}: if what the guy is doing is deployments he should just be getting the war somehow, not caring about how the war is built |
| 17:41 | hiredman_ | (unless where ever you are does "deployments" by checking out code from git and doing a build, which is terrible so things will be terrible for you) |
| 17:41 | {blake} | hiredman_: Yes. That. It is. We know. It's all tied up in security and government audits and all kinds of arbitrary crap. |
| 17:41 | jcrossley3 | {blake}: there are a few alternatives listed here: http://stackoverflow.com/questions/2404426/leiningen-how-to-add-dependencies-for-local-jars |
| 17:42 | {blake} | jcrossley3: Thanks! |
| 17:43 | {blake} | It takes two weeks to code something and six months to deploy. =( |
| 17:49 | {blake} | I cant really just put the jar in "/lib" can I? I thought I tried that first. |
| 17:53 | rhg135 | oops |
| 17:55 | sritchie | DomKM: hey man, around? |
| 17:55 | sritchie | DomKM: had a Q about silk. |
| 17:55 | sritchie | DomKM: We’re using it in a new site that’s gonna launch in a week or two, and I’ve taken your stuff on server / client side rendering pretty far |
| 17:56 | sritchie | DomKM: tackling the last unknown, which is authorization in a Silk / websocket world |
| 17:57 | justin_smith | {blake}: you would need to have the jar itself in the classpath |
| 17:57 | justin_smith | {blake}: having the jar in a dir in the classpath isn't enough |
| 17:58 | {blake} | justin_smith: OK, that fits with what I learned. There'd have to be some thing in project.clj, right? |
| 18:01 | DomKM | sritchie: Hey, happy to hear you're using Silk :) |
| 18:01 | sritchie | yeah, thanks for it, and for omelette |
| 18:01 | DomKM | my pleasure |
| 18:01 | sritchie | DomKM: I extended omelette with a pubsub pattern for talking to and fro the server |
| 18:01 | sritchie | and some macros and multimethods to make page state and nav declarations easier |
| 18:02 | sritchie | DomKM: so, here’s my Q |
| 18:02 | sritchie | following omelette, if you know a route’s not authenticated you can navigate to it immediately, then ask the server for more data and replace whatever loading screens you have |
| 18:02 | sritchie | if a route has some authorization function attached, I want to have the server deal with that exclusively, so I need to defer the client nav - |
| 18:03 | sritchie | which seems to require some way of adding metadata to a rotue |
| 18:03 | sritchie | route* |
| 18:03 | sritchie | “:protected?” or something. Sort of a query param that’s baked into the route. |
| 18:03 | sritchie | DomKM: have you thought about how to deal with stuff like this? |
| 18:04 | sritchie | DomKM: Another feature I’d love to contribute would be something like Compojure’s “context”, so I could nest a bunch of routes under something like “/api” without having to repeat... |
| 18:04 | sritchie | but the auth is the important thing for now :) |
| 18:05 | DomKM | sritchie: I hear you, context would be great. Hold off on a PR for that until the next major version. I'm rewriting it in terms of finite state machines instead of regexes; should be wicked fast. |
| 18:06 | sritchie | nice |
| 18:06 | xnull | flying spaghetti monsters are always better than regexes |
| 18:07 | sritchie | DomKM: what do you think of adding a slot for metadata to the route records? |
| 18:08 | DomKM | sritchie: I haven't thought about the auth problem much since Silk is fairly minimal now. It's basically just URL <-> params. Could you have a map of route names -> protected status and look up the route there after matching? |
| 18:08 | sritchie | yeah, I’d just rather not have a bunch of maps with duplicate keys |
| 18:08 | DomKM | xnull: indeed ;) |
| 18:09 | xnull | ramen, brother |
| 18:09 | sritchie | but sure, I can do that. Or I can keep my own routing table with both, and process the silk routes out of it... |
| 18:09 | sritchie | DomKM: rather than protected status I’d want to use a function of route and user session on server side, |
| 18:09 | sritchie | and probably just a boolean on client side |
| 18:10 | sritchie | I can hack something like that up w/o changing silk |
| 18:13 | DomKM | sritchie: Yeah I hear you; I'd rather avoid the duplicate routes as well. I've received some other comments about attaching metadata to routes before so I'll have to put some thought into this |
| 18:13 | DomKM | sritchie: Open to suggestions, as well :) |
| 19:10 | vas | So i've been able to get my database to play nicely so far ^.^ thanks for all the help you guys. I have a question as this develops, and it is probably simple for a seasoned clojurian... I've been able to extract each document as such: [:_id #<ObjectId 54d92ab79c521eb276553f17>][:msg_content "Bird flyin' high, you know how I feel."] ... how can I programatically just take :msg_content from this |
| 19:10 | vas | meant to hit delete but i hit send |
| 19:10 | vas | figured it out. clojure is so awesome |
| 19:10 | vas | ( (messages) :msg_content) |
| 19:27 | killfill | hi, whats the normal way to add a dependency to lein?.. just edit the project.clj file by hand, find out the dep-tag in its github repo and write it down? |
| 19:28 | {blake} | killfill: That's what I do. |
| 19:29 | killfill | i guess forcing you to write down exactly the version you want, is a good thing.. :P (instead of i.e. 'latest') |
| 19:29 | {blake} | killfill: There have been some debates on that. I kind of like it. |
| 19:30 | {blake} | killfill: Other times, I'm more "Why do I have to care what the version is?" |
| 19:30 | {blake} | killfill: In my limited experience, it's helped with dependency clashes, tho'. |
| 19:31 | killfill | yah. would be nice to 'install lates version' and make it write the latest exact available version tho :) |
| 19:32 | {blake} | killfill: That would be convenient. Though, honestly, in most cases, the version number is staring right at you when you type in the lib name. |
| 19:35 | AeroNotix | there are lein plugins for updating things. |
| 19:35 | AeroNotix | lein-ancient, for example. |
| 19:35 | killfill | ah sure. i mean in a way to bypass the 'open browser, search lib, get latest tag name, copy, paste' thing.. its just a dummy little detail anyway.. just ignore me.. :P |
| 19:36 | {blake} | killfill: Well, when I'm doing the lib-hunt thing, I'm almost always looking at my options first. There's no way I'm not in github to begin with. |
| 19:37 | {blake} | killfill: If I can remember the name (to where I don't have to go to github), I probably know the version, too. =P |
| 19:37 | killfill | :) |
| 19:39 | killfill | lein-ancient looks nice |
| 19:42 | vas | any suggestions on how I can apply two enlive-html/emit* transforms to the same page? |
| 19:43 | dnolen | ClojureScript 0.0-2814 released, Node.js v 0.12 support, Nashorn REPL, built in directory watching, unified source mapping, async testing and more |
| 20:10 | justin_smith | vas: what specifically are you trying to do? |
| 20:11 | justin_smith | vas: emit* doesn't transform anything - do you want to emit two transformations from the same source data? |
| 20:13 | vas | justin_smith: yes. i've got two different chunks of the page. the static html just has one instance of each div that will be cloned, then using enlive selectors and cloning i get a nice string vector back. so i can get two of these vectors back... i think i figured it out, but it's still wonky. basically (apply str (eh/emit* ___)) needs to happen twice, once for each transformed content vector, so i was thinking about grouping them both und |
| 20:13 | vas | er a momma (str (first transform with emit) (second transform with emit)) |
| 20:16 | justin_smith | that's just (apply str (transform with emit)) |
| 20:19 | vas | justin_smith: cool. awesome, i am getting a better feel for vectors of strings vs strings... feels nice |
| 20:22 | vas | one strange thing though, is that if i apply a single transform (first chunk i wanna clone or second chunk i wanna clone) the original information gets wiped out (behavior i like) but, if i do both transforms as (str (apply str (first emit result) (second emit result))) it keeps the original divs in the html output... |
| 20:26 | tvanhens | What could cause the following error? "Attempting to call unbound fn: #'msg.core/serialize-bidi-route clojure.lang.Var$Unbound.throwArity (Var.java:43)" I'm using data_readers.clj to define the following map {bidi/route msg.core/serialize-bidi-route} and the function msg.core/serialize-bidi-route is defined in that namespace and has been evaluated. |
| 20:27 | TEttinger | tvanhens: it looks like you're calling it with the wrong number of arguments |
| 20:27 | TEttinger | is this in a -> or ->> type of form? |
| 20:28 | vas | yeah $Unbound.throwArity ... probably # arguments |
| 20:28 | amalloy | tvanhens: you need to require the namespace your reader is in |
| 20:29 | tvanhens | amalloy: like (:require data-readers) ? |
| 20:29 | amalloy | tvanhens: msg.core |
| 20:29 | tvanhens | the number of arguments appears to be right |
| 20:29 | amalloy | i don't think it's an arity issue at all |
| 20:29 | tvanhens | the coresponding function takes one argument and thats what I'm passing in |
| 20:30 | tvanhens | still geting the same error even when I require in msg.core |
| 20:31 | tvanhens | (require '[msg.core]) |
| 20:31 | tvanhens | => nil |
| 20:31 | tvanhens | {:hello #bidi/route {:hello :world}} |
| 20:31 | tvanhens | IllegalStateException Attempting to call unbound fn: #'msg.core/serialize-bidi-route clojure.lang.Var$Unbound.throwArity (Var.java:43) |
| 20:31 | tvanhens | RuntimeException Unmatched delimiter: } clojure.lang.Util.runtimeException (Util.java:221) |
| 20:32 | amalloy | okay, and what happens when you evaluate this? msg.core/serialize-bidi-route |
| 20:33 | tvanhens | works as expected |
| 20:34 | amalloy | oh hm, is the issue coming from nrepl trying to read your form? i don't remember how nrepl handles data readers |
| 20:34 | tvanhens | it was working fine about an hour ago as well. But I tried reverting to previous commits and none of the previous commits that used to work work anymore |
| 20:34 | tvanhens | only thing thats changed is I upgraded cursive |
| 20:34 | tvanhens | but its not working in command line lein repl either anymore |
| 20:36 | tvanhens | so strange |
| 20:38 | tvanhens | works when I bind data_readers.clj to anything clojure.core |
| 20:41 | tvanhens | any ideas? |
| 20:54 | justin_smith | tvanhens: do you get the same error if you run lein check (which will load and compile all your files)? that could help narrow down which part of the problem is nrepl or cursive specific |
| 20:54 | tvanhens | one sec trying |
| 20:56 | tvanhens | lein check appears to be fine |
| 20:57 | justin_smith | tvanhens: I wonder if it might have anything to do with the fancy macro expander in cursive? (this is a total wild guess) |
| 20:57 | tvanhens | could be. Ugh I really need to stop updating cursive eagerly |
| 20:58 | tvanhens | I can't think of anything else that changed |
| 20:58 | tvanhens | its so strang though that it wont work in lein repl now either |
| 20:58 | justin_smith | oh wait, so it breaks in lein repl, totally outside cursive? |
| 20:59 | tvanhens | yeah |
| 21:00 | tvanhens | and it works if I map it to any clojure.core function |
| 21:56 | cfleming | tvanhens: Did you get that sorted out? |
| 21:57 | tvanhens | nah I decided to work around it for now until I have more time to debug it. But open to try suggestions if you got any |
| 22:13 | SegFaultAX | Is lein-module fairly stable at this point? |
| 22:14 | justin_smith | SegFaultAX: not lein-modules? |
| 22:14 | SegFaultAX | Yea that one. |
| 22:16 | justin_smith | I have no idea, just making sure you were talking about the one I thought |
| 22:56 | Shayanjm | has anyone done anything with the instagram API and geolocation data? |
| 23:25 | gzmask | Can I eliminate the risk of Stackoverflow by using "recur" in corecursion ? |
| 23:26 | TEttinger | gzmask: you're probably after trampoline |
| 23:26 | TEttinger | http://clojuredocs.org/clojure.core/trampoline |
| 23:26 | gzmask | Thanks, I will look that up |
| 23:29 | TEttinger | http://jakemccrary.com/blog/2010/12/06/trampolining-through-mutual-recursion/ seems like the best walkthrough I can fined, gzmask |
| 23:29 | kir | For Clojure newbies : If you know the basic Clojure Syntax and are looking for a logical exposition of lisp-style declarative programming : http://htdp.org/2003-09-26/Book/ |
| 23:30 | kir | Don't mind that it starts some what slowly and that it's Scheme code; it translates easily to Clojure |
| 23:30 | gzmask | awesome, thanks! |