2014-02-21
| 00:08 | chare | is there an ubuntu ppa for leiningen |
| 00:16 | jgmize | chare why are you looking for a ppa? are the install instructions on http://leiningen.org/ not working for you? |
| 00:40 | jairtrejo | Hello! Does anyone know of a Light Table plugin that enables selection inside parenthesis? I'm used to surround.vim and miss it very much. |
| 00:46 | chare | jgmize uh so what do I do after i run the script |
| 00:46 | chare | it dumps stuff in .lein |
| 00:47 | jgmize | I'd probably start with the tutorial: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md |
| 00:48 | chare | jgmize where is the lein binary |
| 00:49 | chare | jgmize so there is no lein binary to run after install script???? |
| 00:49 | jgmize | right, the script itself is what you execute |
| 00:50 | jgmize | you just download it, make it executable, put it on your path |
| 01:00 | chare | jgmize lein run went to fetch clojure |
| 01:01 | chare | where did it put it |
| 01:07 | jgmize | chare: you should be able to play with clojure with just "lein repl" and you can learn more about lein itself with "lein help tutorial". |
| 01:14 | xuser | chare: somewhere in ~/.m2 |
| 01:47 | boltR | Leiningen seems like such a big hassle to set up |
| 01:49 | systemfault | What? The way it's show on the main website... even someone mentally challenged could install it without much trouble. |
| 01:50 | Cr8 | boltR: you put the lein script on your PATH and then.. |
| 01:50 | Cr8 | well |
| 01:50 | Cr8 | you're done |
| 01:50 | DomKM | boltR: https://github.com/technomancy/leiningen/wiki/Packaging |
| 01:50 | dsrx | it's amazing how weak something like LiveReload feels in retrospect now that I can send code right to my browser from the editor with a cljs repl |
| 01:51 | systemfault | dsrx: How do you do it? |
| 01:53 | systemfault | dsrx: Just give me a hint... an editor... a plugin... anything :P |
| 01:55 | dsrx | if you're using light table already you can do that... otherwise with a standard editor/nrepl setup (like cider for emacs or vim-fireplace for vim), you can use austin for most cases https://github.com/cemerick/austin |
| 01:55 | systemfault | Thank you, what do you use personally? |
| 01:56 | dsrx | i have sort of an exotic setup that fills something of a niche need of mine (one of the rare cases where austin won't work) |
| 01:57 | systemfault | Ah ok, still.. thanks a lot :) |
| 02:41 | djcoin | Allow me to post here the question I posted on stackoverflow 2 days ago :) http://stackoverflow.com/questions/21886982/consistency-atomicity-or-even-acid-properties-in-multiple-sql-nosql-databases ; I think it must be a classic set up but I'm struggling to find in-depth analysis of this set up. I guess pragmatic Clojure programmers commonly deals with various set-up/databases, so well, if anyone has some |
| 02:41 | djcoin | insight on this, I would be really nice. |
| 02:41 | djcoin | * it would be really nice |
| 02:41 | djcoin | Thanks! :) |
| 02:47 | chare | djcoin if you're using a database with no acid transactions you're just screwed |
| 02:47 | chare | so why are you using a non acid database |
| 02:51 | djcoin | chare: I'm using one, but I also want to bring other databases in that have very nice features as ElasticSearch, Redis, etc. My point is that we sregularly see this kind of architecture but rarely content on how to keep it consistent |
| 02:52 | djcoin | You are telling me to _just use_ acid (eg: SQL?) and that's all ? Like you will never use any other db ? |
| 02:52 | djcoin | I need more fun :) |
| 02:53 | chare | so you want to turn a nonacid database into a acid database |
| 02:53 | chare | and add it too a bunch of other acid databases? |
| 02:53 | systemfault | djcoin: Even if you use elasticsearch... your "source of truth" will still be your DB... |
| 02:54 | systemfault | If you're really motivated, you could even take a look at more funky BASE architecture like CQRS |
| 02:54 | djcoin | chare: no, i'm looking for advices on what's the best mindset, advices, on maintaining a system like this |
| 02:56 | djcoin | If you tell me "ACID only" well that's fine - but If you could provide more details for example as to what issue I will be facing and why it will be damn complex |
| 02:56 | djcoin | Then I will be really grateful |
| 02:57 | chare | djcoin if each individual database supported acid transactions it would be possible to use XA distributed transactions (http://en.wikipedia.org/wiki/X/Open_XA) to keep everything consistent assuming each database supported the XA standard. |
| 02:57 | djcoin | But I mean, let's take the hypothesis that I only use "ACID" databases but multiple one like say datomic and a NoSQL db |
| 02:57 | djcoin | And attack this subset if a non-acid database is game over from the start |
| 02:58 | chare | djcoin suppose you had a postgresql db and a neo4j db, then you could do a distributed transactions on both since they both support XA. |
| 02:59 | djcoin | nice chare ! |
| 02:59 | chare | neo4j is an acid graph db |
| 02:59 | chare | so it doesn't have to be sql |
| 02:59 | djcoin | Indeed, I wasn't aware that such a standard existed |
| 02:59 | djcoin | Thanks |
| 03:00 | chare | at least I "believe" postgres supports XA, never actually tried it |
| 03:16 | devn | "reify Fruit", heh |
| 03:37 | muhoo | i just did a project where the "database" was just an atom backed by a file. it was a breath of fresh air. |
| 03:38 | muhoo | assoc-in and update-in ftw. |
| 03:41 | clgv | muhoo: yeah that works pretty well for small projects |
| 03:41 | djcoin | muhoo: was it a transient db, or could you persist/backup it ? |
| 03:42 | muhoo | https://github.com/kenrestivo/utilza/blob/master/src/utilza/memdb.clj if you're curious |
| 03:42 | lvh | the only difference between assoc-in and update-in is the (let [new (f old)] ...) right? |
| 03:43 | muhoo | lvh: update-in takes a function to transform the value, assoc-in just takes the value |
| 03:44 | muhoo | it's like the difference between swap! and reset! |
| 03:44 | lvh | gotcha :) |
| 03:45 | djcoin | muhoo: thanks! |
| 03:46 | muhoo | clgv: yeah, it was fun doing queries with just (->> @db vals (filter ..)) and map etc, but i'm ready at any time to swap it out with a real db like datomic if the queries get really hairy |
| 03:47 | muhoo | djcoin: np, enjoy |
| 03:47 | lvh | It is unfortunate that datomic isn't free. I don't mind them getting monies, but it makes it harder for me to convince free/open source projects to use it |
| 03:47 | muhoo | it's beer free |
| 03:48 | clgv | muhoo: but you only get the cheap local beer and not the good german export ;) |
| 03:49 | muhoo | true :-) |
| 03:49 | lvh | clgv: Ahem! |
| 03:50 | clgv | :P |
| 03:50 | djcoin | yeah in this case the local beer is awesome :) |
| 03:51 | ro_st | datomic is free. it isn't open source. |
| 04:13 | rurumate | I'm looking for a function f so that (= (f [1 2 3]) [[1] [1 2] [1 2 3]]) |
| 04:14 | rurumate | edge-ngram style, so not exactly what partition is doing |
| 04:14 | lvh | oh, derp, I thought you meant subsets and then I read properly :) |
| 04:14 | ssafejava | :) is this a 4clojure problem? |
| 04:15 | lvh | so, for [1 2 3 4] it's [[1] [1 2] [1 2 3] [1 2 3 4]]? |
| 04:15 | lvh | that's pretty easy to do with a reduce, last and into :) |
| 04:15 | rurumate | yes |
| 04:17 | lvh | rurumate: I don't think there's a function like that ready to use if that is what you are asking |
| 04:23 | elfenlaid__ | rurumate, well, may be (loop [xs (reverse [1 2 3]) ys []] (if (seq xs) (recur (rest xs) (conj ys (vec xs))) (reverse ys))) would serve as start point |
| 04:24 | djcoin | rurumate: (defn x [coll] (reduce #(conj %1 (vec (conj (or (last %1) []) %2))) [] coll) ;; note: i'm not a clojure expert yet! |
| 04:26 | djcoin | (the vec call can be trashed) |
| 04:33 | wink | anyone got a clue how to force a postgres nextval() in korma? |
| 04:34 | wink | my problem is that I'm using (insert table (values param)) instead of (insert table (fields) {..map..}) |
| 04:44 | kohyama | ,(#(mapv (fn [i _] (vec (take i %))) (iterate inc 1) %) [1 2 3 4]) |
| 04:44 | clojurebot | [[1] [1 2] [1 2 3] [1 2 3 4]] |
| 04:48 | rurumate | thx kohyama |
| 04:52 | kohyama | rurumate: you're welcome. |
| 04:58 | rurumate | ,((fn ngrams [x] (mapv #(vec (take (inc %) x)) (range (count x)))) [1 2 3 4]) |
| 04:58 | clojurebot | [[1] [1 2] [1 2 3] [1 2 3 4]] |
| 05:08 | kohyama | rurumate: I prefer to be lazy. |
| 05:09 | kohyama | ,(#(map (fn [i _] (take i %)) (iterate inc 1) %) [1 2 3 4]) |
| 05:09 | clojurebot | ((1) (1 2) (1 2 3) (1 2 3 4)) |
| 05:09 | kohyama | ,(take 4 (#(map (fn [i _] (take i %)) (iterate inc 1) %) (iterate inc 1))) |
| 05:09 | clojurebot | ((1) (1 2) (1 2 3) (1 2 3 4)) |
| 05:09 | kohyama | ,((fn [x] (map #(take (inc %) x) (range (count x)))) [1 2 3 4]) |
| 05:09 | clojurebot | ((1) (1 2) (1 2 3) (1 2 3 4)) |
| 05:10 | kohyama | but (take 4 ((fn [x] (map #(take (inc %) x) (range (count x)))) (iterate inc 1))) never ends |
| 05:11 | tomjack`` | dnolen_: I finally looked at Om :) |
| 05:11 | tomjack`` | thanks for the tutorials |
| 05:16 | clgv | rurumate: ,(reductions (fn [_ n] (take n [1 2 3 4])) nil (range 4)) |
| 05:17 | clgv | ,(reductions (fn [v n] (conj v n)) [] [1 2 3 4]) |
| 05:17 | clojurebot | ([] [1] [1 2] [1 2 3] [1 2 3 4]) |
| 05:18 | clgv | rurumate: ^^ |
| 05:48 | silasdavis | what's a nice way to avoid iterating over the list twice in ((juxt filter remove) f coll) ? |
| 05:50 | Anderkent | silasdavis: something like (let [{filtered true removed false} (group-by f coll)]) |
| 05:51 | Anderkent | ,(let [{ft true rm false} (group-by odd? [1 2 3 4 5 6])] [ft rm]) |
| 05:51 | clojurebot | [[1 3 5] [2 4 6]] |
| 05:51 | silasdavis | Anderkent, f does not return a boolean |
| 05:52 | Anderkent | right, so (group-by (comp bool f)) |
| 05:52 | silasdavis | ah good thanks |
| 06:05 | sm0ke | is there something like medium.com with private posts? |
| 06:05 | sm0ke | offtopic question |
| 06:07 | DerGuteMoritz | org-mode |
| 06:07 | sm0ke | DerGuteMoritz: umm i would like to share it with other people |
| 06:07 | sm0ke | not using emacs |
| 06:08 | DerGuteMoritz | org-mode html export then :-) |
| 06:08 | AimHere | Share emacs with other people first, thereby reducing the problem to the previously solved one! |
| 06:08 | sm0ke | :P |
| 06:08 | sm0ke | umm although word docs have comments but they suck |
| 06:09 | sm0ke | DerGuteMoritz: oh i would like other to add comments |
| 06:31 | certainty | DerGuteMoritz: o/ |
| 06:34 | DerGuteMoritz | certainty: JAVA! |
| 06:36 | certainty | DerGuteMoritz: :) |
| 06:36 | DerGuteMoritz | :-D |
| 07:35 | arcatan | google docs have comments, too, if you're into inline commenting |
| 07:49 | sm0ke | thanks will look into it, but google is evil |
| 08:18 | rurumate | ,((fn [[x & xs]] (reductions conj [x] xs)) [1 2 3 4]) |
| 08:18 | clojurebot | ([1] [1 2] [1 2 3] [1 2 3 4]) |
| 08:42 | scape_ | ,(map #(bit-and 23 (bit-shift-left 1 %)) (range 8))) ;;byte of 23 |
| 08:42 | clojurebot | (1 2 4 0 16 ...) |
| 08:42 | scape_ | that's handy |
| 09:13 | fredyr | ,(defmacro L->> [& forms] `(fn [x#] (->> x# ~@forms))) |
| 09:13 | clojurebot | #'sandbox/L->> |
| 09:13 | fredyr | ,(map (L->> (bit-shift-left 1) (bit-and 23)) (range 8)) |
| 09:13 | clojurebot | (1 2 4 0 16 ...) |
| 09:15 | scape_ | ,(map (comp not zero?)(map #(bit-and 23 (bit-shift-left 1 %)) (range 8)))) ;;byte of 23 |
| 09:15 | clojurebot | (true true true false true ...) |
| 09:20 | hyPiRion | in this case, `(comp not zero?)` could be replaced with `pos?` |
| 09:21 | scape_ | oh that's good, didn't know about that |
| 09:31 | rurumate | is there also a shorter way to write (comp not neg?) ? |
| 09:32 | hyPiRion | #(<= 0 %) ? |
| 09:33 | rob3 | hyPiRion: is that your poker face |
| 09:33 | hyPiRion | (some-fn pos? zero?) |
| 09:33 | hyPiRion | rob3: hah, not far off |
| 09:33 | rob3 | :) |
| 09:44 | mdrogalis | Is anyone here using Storm with Clojure > 1.4.0? |
| 10:10 | sm0ke | mdrogalis: i think storm needs to be upgraded |
| 10:11 | sm0ke | i tried once, didnt work |
| 10:12 | sm0ke | i think thats obvious, are you asking if anyone upgraded it? |
| 10:13 | sm0ke | storm is like duke nukem forever |
| 10:13 | sm0ke | specially the zmq part, its ancient! |
| 10:23 | simonh | hi - has anyone got any experience of connecting to a nrepl server running on vagrant with cider on the host machine? I'm forwarding the port but getting a connection error: |
| 10:23 | simonh | Connecting to nREPL on 127.0.0.1:9898... |
| 10:23 | simonh | nREPL connection closed: connection broken by remote peer |
| 10:23 | simonh | |
| 10:23 | simonh | error in process sentinel: if: Wrong type argument: stringp, nil |
| 10:23 | simonh | error in process sentinel: Wrong type argument: stringp, nil |
| 11:00 | wink | anyone using korma with postgres? any clue how I can insert when I'd write nextval() in pure sql? |
| 11:14 | mskou72 | Being used to Python, the functional way of working with 2-4 leves deep maps and vectors seems tricky. I'm using map/filter/update-in and a lot of small functions. Is there a library making this sort of work easier? |
| 11:15 | hyPiRion | mskou72: perhaps flatland's useful |
| 11:15 | hyPiRion | $google flatland useful github |
| 11:15 | lazybot | [thinkpixellab/flatland · GitHub] https://github.com/thinkpixellab/flatland |
| 11:15 | hyPiRion | well, that wasn't the right one |
| 11:16 | hyPiRion | https://github.com/amalloy/useful |
| 11:20 | TravisD | why is it called flatland? |
| 11:20 | mskou72 | not the right one, but funny. Ok thanks for the link, will check it out. |
| 11:20 | technomancy | because it's a romance in many dimensions |
| 11:20 | TravisD | heh |
| 11:21 | devn | (inc technomancy) |
| 11:21 | lazybot | ⇒ 98 |
| 11:21 | devn | lol |
| 11:22 | cgriego | If Regular Clojure/West Registration ends today, is there a higher rate or do ticket sales just stop? |
| 11:24 | TimMc | technomancy: Holy cow, your number of karma points since lazybot's last karma database purge has almost reached a new number of digits when represented in a base system whose base is equal to the number of fingers on my hands! |
| 11:24 | TimMc | This calls for a celebration. |
| 11:25 | technomancy | I'll break out the romulan ale |
| 11:26 | technomancy | for some reason that really sounds like as smbc strip |
| 11:28 | famous34627 | Please like this video, regarding humanitarian purposes for little girl who need new heart... https://www.youtube.com/watch?v=E2t0HX3hNys |
| 11:40 | craigbro | earthlings |
| 11:40 | craigbro | when writing a defrecord, I would like to have my methods call other methods in the same protocol, but I get fail |
| 11:41 | craigbro | can I just declare the symbols in the local namespace? |
| 11:47 | pbostrom | craigbro: the defrecord is in a different namespace than the protocol? |
| 11:48 | craigbro | yes |
| 11:48 | shep-werk | craigbro: Something like this works for me https://gist.github.com/shepmaster/9137965 |
| 11:48 | shep-werk | oh, multiple ns... |
| 11:49 | noprompt | dnolen_: got the basic generic inspection component working. https://github.com/noprompt/ankha |
| 11:49 | noprompt | dnolen_: based some of the code off of work stuartsierra did a couple years ago. |
| 11:52 | pbostrom | craigbro: you should be able to refer to the protocol's symbols like any other fn from that namespace: proto-ns/proto-sym, or am I misunderstanding |
| 11:52 | noprompt | dnolen_: there's an example of what it looks like `lein with-profile build cljsbuild once a`. |
| 11:52 | noprompt | dnolen_: any feedback would be welcome. |
| 12:07 | pbostrom | craigbro: https://gist.github.com/pbostrom/9138456 |
| 12:08 | craigbro | thanks pbostrom, I think I may have confused myself in REPL hell yesterday. that seems the obvious solution |
| 12:08 | shep-werk | pbostrom: I like your example code ^_^ |
| 12:08 | pbostrom | np, I actually got hung up on that trying to reify a protocol a few weeks ago |
| 12:11 | hyPiRion | oh ey, is there a reason why Cons doesn't allow pop and peek, but allows conj? |
| 12:11 | craigbro | hmm |
| 12:12 | craigbro | I "use" the namespace with the protocl |
| 12:12 | craigbro | however, just discovered that if I fully name the symbol.. it works |
| 12:12 | craigbro | I think befoe I was doing soething stupid like |
| 12:12 | craigbro | ns.it.is.in.Protocol/method |
| 12:13 | craigbro | query raro |
| 12:13 | craigbro | err.. que raro… |
| 12:13 | noprompt | craigbro: fyi avoid :use or (:require [x :refer :all]) |
| 12:13 | dnolen_ | noprompt: sweet! will give it a look! |
| 12:13 | craigbro | it won't resolve the short symbol, even tho I "use" the namespace |
| 12:14 | craigbro | noprompt: yah, heard that advice…. |
| 12:14 | craigbro | noprompt: what is the rational? |
| 12:14 | noprompt | dnolen_: it needs a bit of refactoring/cleaning up. |
| 12:14 | craigbro | I control both namespaces in this case |
| 12:14 | noprompt | craigbro: you lose sight of where things are coming from. |
| 12:16 | noprompt | craigbro: even if you control the namespaces, it's still a good habit to form. but i suppose if you're just banging around it's not a big deal. |
| 12:16 | craigbro | Turns out that in the actual code in question (not my scratch) that I use require refer... |
| 12:20 | craigbro | derptastic — it works exactly as it should, I was just confused by too many hours of hacking yesterday |
| 12:24 | jcromartie | why should .lein-classpath be ignored by source control? |
| 12:25 | hyPiRion | jcromartie: because it's autogenerated by lein |
| 12:25 | jcromartie | oh I see, I have a /.lein-* in my .gitignore |
| 12:26 | jarjar_p_ | if I have a lazyseq that contains a hash, how do i get the hash out of the lazy seq to find the key? |
| 12:27 | dnolen_ | noprompt: ankha is a fantastic start! |
| 12:30 | noprompt | dnolen_: awesome! thanks! were you able to see the example? |
| 12:30 | dnolen_ | noprompt: yep |
| 12:31 | noprompt | dnolen_: nice, any tips in the code or does it look about right? |
| 12:33 | dnolen_ | noprompt: skimming it looks pretty good to me, I definitely have some use cases for this in mind so I will get back to you or send you pull requests if I have any good changes in mind. |
| 12:33 | heath | would someone upload the video to this talk? http://www.infoq.com/presentations/clojure-core-async |
| 12:33 | heath | it was available just a couple of weeks ago |
| 12:33 | dnolen_ | noprompt: it's already great as a simple EDN viewer |
| 12:34 | dnolen_ | noprompt: somebody should wire this up into an EDN Chrome Extension :) |
| 12:34 | noprompt | dnolen_: next steps. :) |
| 12:37 | michaniskin | does anyone know of a list of html meta tags that can't be installed into the document after the html source is parsed by the browser? for example <meta charset="utf-8"> can't be created via clojurescript because the charset has already been set |
| 12:38 | noprompt | dnolen_: i think it might be worth exposing a simple protocol as well. with a few lines of code you could create a generic dom inspector. |
| 12:38 | dnolen_ | noprompt: yes |
| 12:39 | dnolen_ | noprompt: the first thing I want to hook this up to is an editable |
| 12:39 | dnolen_ | so you can manipulate an Om component via direct interaction |
| 12:39 | TimMc | michaniskin: Any of the http-equiv forms. |
| 12:39 | noprompt | dnolen_: oh that would be awesome. |
| 12:40 | michaniskin | TimMc: thanks! |
| 12:40 | Anderkent | dnolen_: noprompt: link? sounds interesting |
| 12:41 | Anderkent | nevermind, found it |
| 12:41 | Anderkent | wasn't on google, for some reason! |
| 12:41 | TimMc | michaniskin: I would assume any meta tag is irrelevant after the HTML is received. There might be a few exceptions, though. |
| 12:42 | michaniskin | TimMc: fwiw http-equiv="Refresh" seems to work okay |
| 12:42 | michaniskin | actually let me qualify that: it works in _chrome_ |
| 12:43 | michaniskin | testing all the permutations in all the browsers is not feasible |
| 12:43 | noprompt | Anderkent: https://github.com/noprompt/ankha |
| 12:44 | noprompt | Anderkent: haven't pushed to clojars yet. but you could clone the repo and build the example w/ `lein with-profile build cljsbuild once a`. |
| 12:45 | Anderkent | noprompt: cheers. |
| 12:46 | TimMc | michaniskin: Fascinating. |
| 12:51 | jcromartie | can I easily call another Leiningen task from my custom task? |
| 12:51 | jcromartie | wait, of course |
| 12:56 | jcromartie | very nice! the result of leiningen.uberjar/uberjar is the path to the created Jarfile |
| 12:57 | technomancy | functions: they're what's for dinner |
| 12:58 | noprompt | technomancy: i've had that thought man times. |
| 13:01 | bmuk | Does anyone have any experience with stevedore? I found this article http://hugoduncan.org/post/shell_scripting_in_clojure_with_pallet/ which seems to suggest you can execute commands like they are native functions, but the documentation makes you wrap all commands in a string. |
| 13:03 | arcatan | my very remote recall is that it originally was like native functions, but it was later changed to be strings only |
| 13:04 | bmuk | That's too bad. I was really intrigued by it. |
| 13:09 | hugod | bmuk: symbols in function position are resolved if they are not strings, so you can write script returning functions |
| 13:10 | hugod | bmuk: pallet has a library of these in its pallet.script.lib ns |
| 13:40 | pczaj | ,(+ 1 2) |
| 13:40 | clojurebot | 3 |
| 13:44 | tomjack | can I use data readers in a test .clj file without data_readers.clj? |
| 13:44 | tomjack | and without putting it in a string in the test file.. |
| 14:15 | amalloy | tomjack: (binding [*data-readers* x] ...)? |
| 14:16 | tomjack | (binding [*data-readers* {'foo #'foo}] #foo 42) ? |
| 14:17 | tomjack | "No reader function for tag foo" |
| 14:18 | amalloy | tomjack: no, you can't do that |
| 14:18 | tomjack | ah |
| 14:18 | tomjack | (set! *data-readers* {'foo #'foo}) |
| 14:18 | tomjack | yes, hence my question :) |
| 14:18 | amalloy | (binding [*data-readers* {'foo #'foo}] (read-string "#foo 42")) |
| 14:18 | tomjack | didn't I say "without putting it in a string" ? |
| 14:19 | amalloy | you did, but i didn't understand what you meant |
| 14:19 | tomjack | sorry :) |
| 14:19 | tomjack | hmm, alter-var-root assoc? :/ |
| 14:20 | amalloy | i don't understand your goal here |
| 14:20 | tomjack | hmm |
| 14:20 | tomjack | when I thought about describing it, I realized it's stupid :) |
| 14:21 | tomjack | I was thinking of having many auto-generated data readers |
| 14:21 | tomjack | and I didn't want to put them in data_readers.clj really.. |
| 14:21 | tomjack | it would be nice if I could just have one data reader that can be used for all of these cases |
| 14:21 | tomjack | then I can put that in data_readers.clj |
| 14:22 | tomjack | basically my goal is "data readers for protobufs" |
| 14:25 | technomancy | erhm; aren't data readers limited to string input? |
| 14:25 | tomjack | other way around |
| 14:25 | amalloy | you want #my/proto {:x 1} to read as a Protobuf object? |
| 14:26 | tomjack | I'm considering it |
| 14:26 | tomjack | anyway |
| 14:26 | technomancy | ah |
| 14:26 | amalloy | that's like...a disaster. just write (my/proto {:x 1}). there's no reason for the reader to do it |
| 14:26 | tomjack | right |
| 14:26 | amalloy | the compiler wouldn't know what to do with the resulting form anyway |
| 14:27 | tomjack | oh, hmm |
| 14:33 | tomjack | you mean AOT? |
| 14:34 | tomjack | the place I actually wanted them was in .edn files |
| 14:34 | stuartsierra | If you're reading EDN files, you can pass a map of data reader functions to edn/read. |
| 14:34 | tomjack | right |
| 14:35 | tomjack | then I was like "ooh tests" for no good reason :) |
| 14:35 | tomjack | because I've been writing tests with protobuf in Java |
| 14:35 | tomjack | :( |
| 14:36 | sdegutis | I'm trying to get away from running `lein server` in production, but there's a problem with nREPL: once you connect via `lein repl :connect 8181`, you can't kill the web server itself via Ctrl-C. |
| 14:37 | sdegutis | Any idea what could be causing that? |
| 14:37 | ToBeReplaced | on a type-hinting rampage... is there a way to type-hint the return type of a protocol method? |
| 14:38 | jcromartie | sdegutis: you mean 'lein ring serve'? |
| 14:38 | sdegutis | "lein ring server-headless" |
| 14:39 | sdegutis | Yep. |
| 14:39 | jcromartie | why are you trying to get away from it? |
| 14:39 | amalloy | ToBeReplaced: you could try using alter-meta! on the var that the protocol method produces, but i think that var gets mangled when new implementations are added |
| 14:39 | jcromartie | (I can think of a few reasons) |
| 14:39 | sdegutis | jcromartie: ideally we'd compile the uberjar locally and then deploy just the jar to production and run that by itself |
| 14:39 | jcromartie | yes |
| 14:39 | jcromartie | a -main function will do nicely there |
| 14:40 | tomjack | when I read the tagged literals I was actually thinking of, I actually can't return a protobuf message |
| 14:40 | sdegutis | First of all we don't want source code in production. Secondly it uses less memory and we don't have to worry about lein trampoline. |
| 14:40 | jcromartie | yes |
| 14:40 | tomjack | because there can be a symbols in any field value |
| 14:40 | ptcek | Is it possible to get quoted form from a function (I would like the function to call the form but extract the form during test for comparison and avoid databases, etc...). Does it even make sense? |
| 14:41 | jcromartie | sdegutis: so, you should have a "main" namespace that takes care of starting the standalone server |
| 14:41 | amalloy | ptcek: not with ordinary functions, but see technomancy/serializable-fn |
| 14:41 | tomjack | but with clojure.edn I can bind readers for those tags which accept symbols, performing .proto validation but not returning protobufs |
| 14:41 | sdegutis | jcromartie: that's already taken care of with `lein ring uberjar` |
| 14:41 | tomjack | hmm.. |
| 14:42 | jcromartie | OK so, the problem is that if you have ever connected to the remote nREPL, you can't kill the server process? |
| 14:43 | sdegutis | Yep. |
| 14:45 | technomancy | sdegutis: why don't you want source in production? |
| 14:45 | mklappstuhl__ | how can I dynamicise the "abc" part of a regex like #"^abc" |
| 14:45 | sdegutis | You can try it locally. Spin up a simple lein ring app, do `(defonce nrepl-server (start-server :port 8181))`, connect to it as mentioned earlier, then try killing the server with Ctrl-C. |
| 14:46 | jcromartie | sdegutis: checking it out now |
| 14:46 | SegFaultAX | mklappstuhl__: What do you mean? |
| 14:46 | sdegutis | technomancy: Heh you've got a good sense of humours. |
| 14:46 | joegallo | mklappstuhl__: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/re-pattern |
| 14:46 | technomancy | sdegutis: phlegmatic humours? |
| 14:46 | joegallo | (re-pattern (str "^" abc-like-things)) |
| 14:46 | sdegutis | The cardinal humors, so maybe. |
| 14:47 | mklappstuhl__ | joegallo thanks! |
| 14:47 | jcromartie | sdegutis: I can quit with Ctrl-D |
| 14:47 | sdegutis | That may be cheating sir. |
| 14:47 | jcromartie | but that's from starting the nREPL server via "lein repl" |
| 14:47 | sdegutis | Oh no, not quit the repl. |
| 14:47 | sdegutis | The server process itself, which you run with `lein ring server-headless` |
| 14:47 | technomancy | sdegutis: does it happen with other nrepl clients, or just lein's? |
| 14:48 | sdegutis | Only tried it with lein. May try it with nrepl.el soon. |
| 14:48 | technomancy | something to check |
| 14:48 | jcromartie | sdegutis: I can Ctrl-C with "lein run" |
| 14:49 | jcromartie | still not your use case though right? |
| 14:49 | sdegutis | Let me reproduce it as a repo. |
| 14:51 | ptcek | amalloy: do not understand anything from the 26 lines of code but seems it will do the job. Thanks! |
| 14:51 | jcromartie | I so very much like the fact that I can run a web server by adding lein-ring and defining a single function, though |
| 14:52 | jcromartie | I can kill it with "lein ring server" too |
| 14:52 | technomancy | ptcek: it relies on an (I think) undocumented feature of defmacro, the implicit &env argument |
| 14:52 | technomancy | need to search the mailing list for how that works I think |
| 14:52 | jcromartie | sdegutis: why are you trying to kill it with Ctrl-C anyway? you should be starting up your headless server, writing the pid, and then killing the pid |
| 14:52 | jcromartie | e.g. with an init scrit |
| 14:52 | jcromartie | script |
| 14:53 | sdegutis | jcromartie: in production we will, but when developing we use sigint |
| 14:53 | technomancy | why use an uberjar in dev though? |
| 14:53 | sdegutis | we use `lein ring server-headless` in dev |
| 14:53 | sdegutis | `lein ring uberjar` for deploying to production |
| 14:54 | technomancy | hm... I guess that's a thing you can do |
| 14:54 | technomancy | not sure what the appeal is though |
| 14:54 | jcromartie | technomancy: the appeal of a uberjar? |
| 14:54 | technomancy | jcromartie: no, the appeal of embedded nrepl during dev |
| 14:54 | technomancy | vs lein repl |
| 14:55 | sdegutis | technomancy: oh no, i plan to just use lein repl locally |
| 14:55 | jcromartie | ah yes |
| 14:55 | sdegutis | but when you start the ubarjar, this happens. |
| 14:55 | sdegutis | sorry, theres a lot of variables. its hard to remember which ones are affecting it |
| 14:55 | jcromartie | sdegutis: I'm not seeing it in any case |
| 14:56 | jcromartie | sdegutis: starting the nrepl server and a ring handler, connecting, and Ctrl-C kills it |
| 14:59 | jcromartie | I'm having some real revelations here though… I can use lein-ring and alter my handler var root!? |
| 15:06 | sdegutis | Steps: https://github.com/sdegutis/testcase |
| 15:07 | sdegutis | Clone that repo and follow the steps to reproduce the bug. |
| 15:07 | sdegutis | Haven't figured out who's bug it is yet so I haven't filed an issue yet. |
| 15:07 | sdegutis | Trying it in nrepl.el now. |
| 15:08 | sdegutis | Confirmed: it does *not* happen with nrepl.el! |
| 15:10 | sdegutis | Could be REPLy, trying now. |
| 15:13 | borkdude | Is this expected behavior? https://www.refheap.com/44271 |
| 15:13 | borkdude | I mean, the dynamic var is bound to the root var inside map? |
| 15:13 | borkdude | root value |
| 15:14 | borkdude | *inside the function executed by map |
| 15:15 | borkdude | argh probably lazyness again |
| 15:16 | borkdude | yup, that's it |
| 15:18 | jcromartie | sdegutis: yeah it's definitely something about lein ring uberjar |
| 15:20 | jcromartie | But I'm kinda warming up to lein ring |
| 15:21 | akurilin | Note to self: don't place authorization middleware outside of compojure route matchers or you'll hit the authz logic on every matching attempt, derp. |
| 15:21 | grzm | often clojure projects have foo-project/sub/core.clj, foo-project/sub/bar.clj . Is there a reason to have a core.clj (sub/core.clj) rather than sub.clj? |
| 15:22 | amalloy | grzm: single-segment namespaces cause issues |
| 15:23 | amalloy | foo/core.clj is a workaround; you should try to work around it "better", by using a meaningful two+ segment namespace like mylib.server |
| 15:23 | sdegutis | jcromartie: I don't think it is about lein ring ubarjar. |
| 15:23 | sdegutis | Because the bug doesn't happen with an uberjar when I use nrepl.el to connect. Only when I use lein repl. |
| 15:23 | sdegutis | So it's either lein repl, or reply. |
| 15:24 | sdegutis | Trying to use REPLy now to reproduce. |
| 15:25 | grzm | amalloy: so foo/bar.clj and foo/bar/baz.clj fine, just not foo.clj |
| 15:25 | amalloy | yes |
| 15:25 | grzm | gotcha. |
| 15:26 | jcromartie | sdegutis: but it doesn't happen with "lein ring server", which leads me to believe it's something with the generated main class |
| 15:26 | amalloy | and all this is under src/, of course |
| 15:27 | grzm | amalloy: right. I don't think I would have tried a single-segment namespace (I specifically was thinking about subdirectories and naming files with the same name), but it's a good piece of info to know. |
| 15:27 | sdegutis | Aha, it is REPLy. Just reproduced. |
| 15:33 | sdegutis | Updated the repro repo. |
| 15:53 | jcromartie | hm |
| 15:53 | jcromartie | never mind |
| 15:53 | jcromartie | :P |
| 16:08 | AeroNotix | What sucks about clojure? |
| 16:09 | technomancy | AeroNotix: good question. I've collected a few things here: https://raw.github.com/technomancy/dotfiles/master/.gripes.org |
| 16:09 | technomancy | cemerick also gave a talk on this a year or two ago |
| 16:09 | AeroNotix | technomancy: currently loading that talk! |
| 16:09 | AeroNotix | :) |
| 16:09 | arcatan | "nil is everywhere and causes bugs that are difficult to find the source" +1 |
| 16:10 | AeroNotix | technomancy: this is such an amazing idea for a list, I will start one of these myself. |
| 16:10 | technomancy | AeroNotix: I got the idea from twb in #emacs, who is a world-class curmudgeon |
| 16:10 | technomancy | http://www.cyber.com.au/~twb/doc/grumbling.txt |
| 16:10 | AeroNotix | :) |
| 16:11 | AeroNotix | wait a sec, I know twb |
| 16:11 | AeroNotix | Small world |
| 16:11 | technomancy | «Sometimes when I declare "<technology> is shit!" an enquiring mind asks "how so?". Due to my porous memory and appalling command of rhetoric, my answer is rarely articulate, let alone convincing. The purpose of this document is to preserve and refine the rationales behind my hatred, and thereby lend it credibility.» |
| 16:12 | scape_ | haha |
| 16:12 | hyPiRion | I am not going to write such a list. I'll just be depressed over the whole software industry and change profession. |
| 16:12 | technomancy | hyPiRion: well, having a list that's actually comprehensive is kind of cathartic |
| 16:12 | jcromartie | help me out here folks: what part of speech is "compute"? and how does it end up being used like "compute cloud" or "compute engine" |
| 16:13 | AeroNotix | technomancy: in polish you can prefix things with "Sr" to make it kind of like the americanism "Something Schmomthing" to disregard something as bad. At the office when something breaks, we just say "srotfware" in a dejected tone. |
| 16:13 | AeroNotix | "sroftware"* |
| 16:13 | technomancy | hehe; sounds useful |
| 16:13 | jcromartie | if compute is a noun like gasoline ("gasoline engine" or "gasoline cloud" make sense) then I should be able to say "I have a lot of compute" or "I need to get some compute" |
| 16:13 | jcromartie | because I can say "I have a lot of gasoline" |
| 16:14 | AeroNotix | jcromartie: compute is a verb |
| 16:14 | dkinzer | nice links |
| 16:15 | hyPiRion | jcromartie: "compute engine" is a command to an engine, same for "compute cloud" |
| 16:15 | jcromartie | AeroNotix: yes it is defined as a verb, but this is a new use |
| 16:15 | hyPiRion | ,(recur) ;; compute clojurebot |
| 16:15 | AeroNotix | jcromartie: which use where? |
| 16:15 | clojurebot | Execution Timed Out |
| 16:15 | hyPiRion | It just lacks a comma, and a period. |
| 16:17 | AeroNotix | technomancy: I'm a professional Erlang dev if you ever want to pick a fight |
| 16:17 | AeroNotix | Reading through your points now |
| 16:17 | technomancy | AeroNotix: please show me how I'm wrong =) |
| 16:17 | aperiodic | jcromartie: english is weird, basically. english loves verbing nouns, but recently it's started nouning verbs (see "a ride", "a smoke", "a read") |
| 16:17 | AeroNotix | re: no automated tool for record upgrades. Records are just kind of like proplists with compiler magic. |
| 16:18 | AeroNotix | so there's no "type" at runtime which can allow you to properly introspect the records. |
| 16:18 | jcromartie | aperiodic: I guess I also see "bake shop" and I've heard "camp trip" |
| 16:18 | technomancy | AeroNotix: sure, except you can inspect the definition and describe the change you need in order ot create matches against the old and new tuples |
| 16:18 | jcromartie | I find that really unnatural |
| 16:19 | AeroNotix | technomancy: Kind of like a diff? Yeah, well in practice the idea is to just have versioned records if this is a problem. |
| 16:19 | aperiodic | jcromartie: those are both new on me. "camp trip" sounds very wrong; I would say "camping trip" |
| 16:19 | AeroNotix | technomancy: also R17 is bringing real maps, finally. |
| 16:19 | AeroNotix | also, re: No way to enter a module. This is seriously a problem |
| 16:19 | scape_ | jcromartie: that might be because people like to shorten things |
| 16:19 | AeroNotix | (from the repl) |
| 16:19 | technomancy | AeroNotix: yeah, working with anonymous funs only is tedious =\ |
| 16:20 | AeroNotix | technomancy: also that's fixed in R17 |
| 16:20 | AeroNotix | :) |
| 16:20 | AeroNotix | you can now name funs in the shell |
| 16:20 | technomancy | whaaaaaat! |
| 16:20 | AeroNotix | seriously! |
| 16:20 | technomancy | oh |
| 16:20 | technomancy | yeah, ok |
| 16:20 | technomancy | but you still can't enter a module |
| 16:20 | AeroNotix | No, no you can't. |
| 16:20 | technomancy | that's the real problem |
| 16:20 | technomancy | anonymous funs are just a symptom |
| 16:20 | AeroNotix | Yeah, it really is. Many times I have to recompile a module with -compile(export_all). |
| 16:20 | AeroNotix | just to get access to functions |
| 16:21 | technomancy | I really like how erlang maps have the notion of distinguishing between updating a field and adding one <3 |
| 16:21 | AeroNotix | (in-ns 'whatever) is my goto tool for debugging broken stuffs |
| 16:21 | technomancy | and having no nil is *awesome* |
| 16:21 | hyPiRion | technomancy: yeah, they've been smart |
| 16:21 | technomancy | hyPiRion: still no update-in |
| 16:21 | technomancy | it's less tedious to not have update-in when you have pattern matches, but it still bugs me. very little HOF usage in erlang =( |
| 16:22 | AeroNotix | dialyzer... ah dialyzer. People say it's helpful but it's really just a masturbatory feel good tool. It catches only the glaringly obvious bugs* and misses extremely obvious cases. |
| 16:22 | technomancy | AeroNotix: well I haven't actually got it to successfully run on our codebase yet =( |
| 16:22 | technomancy | our codebase causes it to go into an infinite loop |
| 16:23 | AeroNotix | We have a very, very large Erlang code base and I've never seen it catch anything which unit tests wouldn't immediately catch. |
| 16:23 | AeroNotix | technomancy: really? Never seen that happen |
| 16:23 | aperiodic | /part/go dork |
| 16:23 | AeroNotix | technomancy: do you have a .plt already built? |
| 16:23 | technomancy | AeroNotix: yep, confirmed as a bug with the dializer maintainer |
| 16:23 | AeroNotix | some people confuse building a plt with it getting caught in a loop, since it's a very lengthy process |
| 16:23 | AeroNotix | ohhh ok, very interesting technomancy |
| 16:23 | technomancy | no, I let it run overnight =) |
| 16:23 | AeroNotix | Ouch! |
| 16:24 | AeroNotix | technomancy: was it kostis? |
| 16:24 | technomancy | I think so |
| 16:24 | technomancy | still, I'd take "misses things" over "won't run on un-annotated code" |
| 16:24 | AeroNotix | technomancy: no, it genuinely misses things even on annotated. I'll try to find an example. |
| 16:25 | AeroNotix | How does typed clojure compare to Dialyzer? |
| 16:25 | hyPiRion | AeroNotix: I usually prefer to create property-based tests with PropEr instead of using dialyzer. Mostly because I feel PropEr describes more in less space. |
| 16:25 | AeroNotix | hyPiRion: this |
| 16:25 | AeroNotix | PropEr is seriously good stuff |
| 16:25 | AeroNotix | and the proper_statem? All over that |
| 16:26 | hyPiRion | hehe |
| 16:26 | technomancy | AeroNotix: typed clojure won't do anything without annotations iiuc |
| 16:26 | AeroNotix | _so_good_ |
| 16:26 | AeroNotix | technomancy: without annotations or without GOOD annotations? Does it work on just the annotations or does it try to figure some additional stuff out? |
| 16:26 | AeroNotix | Dialyzer does both (starting with annotations and doing some deduction on its own) |
| 16:26 | technomancy | AeroNotix: my understanding is it only does inference on locals |
| 16:27 | technomancy | no inference crossing defn boundaries |
| 16:27 | AeroNotix | Hmm, I will have to check it out some time |
| 16:27 | technomancy | which is why I haven't looked into it much |
| 16:27 | technomancy | apart from not doing a lot of clojure in general |
| 16:27 | AeroNotix | technomancy: seriously? |
| 16:27 | AeroNotix | I thought you were writing Clojure @ heroku |
| 16:28 | technomancy | not really; just a bit of lein maintenance here and there |
| 16:28 | AeroNotix | I and the rest of the (ex-rebar users!!) are very happy about lein |
| 16:28 | xuser | technomancy: mostly java? |
| 16:29 | AeroNotix | Lein is a million times better than rebar. It makes rebar look like Fischer Price my first dependency management tool |
| 16:29 | technomancy | xuser: haha, no. erlang. |
| 16:29 | AeroNotix | technomancy: erlang @ heroku???? |
| 16:29 | technomancy | there is one small clojure codebase still in production, but I'm not even on that team any more |
| 16:29 | technomancy | AeroNotix: since the beginning |
| 16:29 | AeroNotix | technomancy: oh I didn't know that |
| 16:29 | technomancy | https://github.com/heroku/logplex and the HTTP router |
| 16:29 | technomancy | (but I don't work on the latter) |
| 16:30 | AeroNotix | technomancy: in fact I read that blog. What an incredible write up! |
| 16:30 | AeroNotix | I'm interested really in what you think moving from clojure->Erlang |
| 16:30 | AeroNotix | because Erlang->Clojure is like OMFG WOW |
| 16:31 | AeroNotix | technomancy: ^ |
| 16:31 | technomancy | AeroNotix: https://news.ycombinator.com/item?id=7278018 <- short thoughts |
| 16:32 | sdegutis | I'm surprised to hear that Heroku is using mostly Erlang. |
| 16:32 | AeroNotix | Erlang is a bad FP language, it has bad tooling, as a language it's downright awful. But as a system and for people who have the kinds of problems Erlang solves, then it's amazing. |
| 16:32 | sdegutis | I'd have guessed Ruby/Rails for front-end and Scala for back-end. |
| 16:32 | AeroNotix | sdegutis: seriously |
| 16:32 | sdegutis | Not that I think that's a good choice of tools, just that it seems to be pretty popular with large websites. |
| 16:33 | sdegutis | Personally I think Ruby, Rails, and Scala are all gross. |
| 16:33 | AeroNotix | I guarantee what the company I work for is larger than what they're doing |
| 16:33 | technomancy | sdegutis: "mostly"? |
| 16:33 | AeroNotix | and we're using primarily Erlang with a small part in Clojure |
| 16:33 | technomancy | sdegutis: there are only 6 of us out of ~120 |
| 16:34 | sdegutis | technomancy: Oh then I misinterpreted that last thing. |
| 16:34 | hyPiRion | I though Heroku used a bit of Go |
| 16:34 | technomancy | hyPiRion: yeah =\ |
| 16:34 | hyPiRion | Which I know technomancy loves so dearly. |
| 16:34 | xuser | whatsapp is a good example of using of erlang, is there anything they had use? I don't think so |
| 16:34 | sdegutis | Oh but Go is great! |
| 16:34 | sdegutis | You have first-class functions! |
| 16:34 | xuser | *better |
| 16:34 | technomancy | still a lot more erlang than go right now |
| 16:34 | AeroNotix | xuser: what was your question |
| 16:35 | technomancy | AeroNotix: pretty much full ack on your assessment ("bad FP language, but amazing for certain problems") |
| 16:35 | xuser | AeroNotix: if there is anything better whatsapp could have used |
| 16:35 | AeroNotix | technomancy: 10 4 |
| 16:35 | technomancy | http://thisotplife.tumblr.com/post/66878750907/when-i-discovered-everything-is-traceable-in-erlang |
| 16:35 | sdegutis | Also you have complete compile-time safety with Go! |
| 16:35 | sdegutis | And concurrency! |
| 16:36 | sdegutis | Not to mention a lack of inheritance, which is a good thing! |
| 16:36 | AeroNotix | xuser: well, not really. The goto use-case for Erlang is a distributed chat server. |
| 16:36 | AeroNotix | xuser: also, my friend works for them. It's just ejabberd really. |
| 16:36 | AeroNotix | (Obviously a bit more than that, but essentially.) |
| 16:36 | hyPiRion | sdegutis: you have inheritance actually |
| 16:37 | AeroNotix | hyPiRion: you have composition |
| 16:37 | sdegutis | Nope, you have embedding. |
| 16:37 | AeroNotix | composition/embedding, same difference |
| 16:37 | sdegutis | I was responding to hyPiRion. |
| 16:37 | technomancy | we have a lot of fun on the erlang team making fun of google go at work |
| 16:37 | sdegutis | !! |
| 16:37 | AeroNotix | lol |
| 16:37 | sdegutis | What's there to make fn of? |
| 16:37 | AeroNotix | Go's a great replacement for Python, though |
| 16:38 | AeroNotix | equally shitty package management, equally shitty typesystem, but HEY no GIL |
| 16:38 | xuser | AeroNotix: how many languages do you know? ;) |
| 16:38 | AeroNotix | Dunno |
| 16:38 | AeroNotix | Well? |
| 16:38 | AeroNotix | Probably 8 quite well |
| 16:39 | sdegutis | AeroNotix: Is C++ in that list? |
| 16:39 | AeroNotix | sdegutis: I don't think C++ is in anyone's "Know quite well" list |
| 16:39 | sdegutis | Hint: don't answer, it's flamebait. |
| 16:39 | sdegutis | :) |
| 16:39 | hyPiRion | (inc AeroNotix) |
| 16:39 | lazybot | ⇒ 2 |
| 16:40 | sdegutis | Go is fine, what's wrong with it? It's pretty good for what it aims to do. |
| 16:40 | sdegutis | You have a simple but powerful type system, a simple but powerful compiler toolchain, a simple but powerful syntax. |
| 16:41 | sdegutis | A simple but powerful standard library, a simple but powerful garbage collector. |
| 16:41 | technomancy | the type system might have qualified as powerful in the 70s |
| 16:41 | hyPiRion | the GC is not powerful, trust me on that. I've had issues with it for quite some time =/ |
| 16:41 | sdegutis | A simple but powerful concurrency model. |
| 16:41 | xuser | no generics |
| 16:41 | sdegutis | Go is very simple but powerful. |
| 16:42 | sdegutis | Let me be clear: I'm really just making fun of that empty and overused phrase "simple but powerful". |
| 16:42 | xuser | Go is a half implementation of Java but less verbose :D |
| 16:42 | sdegutis | Especially when Go users use it. Or Rubyists or Python. |
| 16:42 | sdegutis | Or Clojurians! |
| 16:42 | hyPiRion | sdegutis: Only Clojurians know the definition of simple though. |
| 16:42 | sdegutis | (lol jk, clojurians are the best!) |
| 16:43 | sdegutis | xuser: and it starts up faster! |
| 16:43 | amalloy | &((promise)) is not a very useful error message at all |
| 16:43 | lazybot | java.lang.AbstractMethodError |
| 16:43 | sdegutis | See? Simple! |
| 16:43 | sdegutis | (but powerful, too) |
| 16:44 | xuser | sdegutis: the small java programs I have write start up very faste, clojure on the hand... |
| 16:44 | xuser | *other |
| 16:44 | sdegutis | Yes, Clojure isn't fast, but it's simple, yet powerful. |
| 16:44 | aaelony | Hi all, I'm wrapping my head around pulling data from surveymonkey via oauth2. Specifically, I'm looking at https://github.com/ddellacosta/friend-oauth2-examples/tree/master/src/friend_oauth2_examples and seeing how it would work for surveymonkey. Has anyone done this? |
| 16:44 | sdegutis | I mean, it is fast, but it doesn't start up fast. |
| 16:45 | xuser | is the Clojure team working on startup time or are they waiting for Java 9? |
| 16:45 | xuser | (project jigsaw) |
| 16:45 | sdegutis | Ah, yes, Java 9: simple, yet powerful. |
| 16:45 | technomancy | it's funny how the startup time of the JVM improved since it got bought by a company that no longer sells big-iron server hardware |
| 16:47 | jonh | i thought it was more related to a company that has money to invest in it |
| 16:48 | technomancy | I don't think the size of the team changed drastically |
| 16:48 | sdegutis | Now what I want is a language where I can mutate the state of an object just by inspecting it: i.e. heisenstate. |
| 16:48 | sdegutis | That would be epic. |
| 16:48 | technomancy | sdegutis: but the state has to degrade over time oo |
| 16:49 | technomancy | too |
| 16:49 | technomancy | entropy and all |
| 16:49 | sdegutis | Imagine if you could just query a simple property such as "system.isUp();" and if it returns false, it'll also restart the system in the background! |
| 16:49 | sdegutis | Then all you'd need to do is ask `system.isUp();` all the time, you'd never need to write such methods as `system.restart()` etc. |
| 16:49 | sdegutis | How simple! How powerful! |
| 16:50 | xuser | such wow |
| 16:50 | technomancy | sdegutis: you need to use interrobang for those names |
| 16:50 | technomancy | destructive predicates |
| 16:50 | delluminatus | sdegutis: sounds like something someone would have done at my workplace |
| 16:50 | delluminatus | and then never told anybody about the side effect |
| 16:51 | sdegutis | Oh! Even better: all you'd have to do is hook up that function call to a web request, so that when you hit https://production:3000/is-system-up, it'll restart it for you if need be! Then all you have to do is bookmark that page and check it every day, which will not only tell you if the system is up, but restart it if it's not! |
| 16:51 | sdegutis | Ruby: system.isUp!? |
| 16:52 | technomancy | oh come on, don't do it half-assed |
| 16:52 | technomancy | is-up‽ |
| 16:52 | sdegutis | <<<<3333 |
| 16:52 | sdegutis | Oh yeah! Go allows UTF8 symbols in the source code, so that would be valid! |
| 16:53 | sdegutis | Oh sorry, not symbols, "runes". |
| 16:53 | sdegutis | Man, Go is awesome. |
| 16:53 | delluminatus | wait |
| 16:53 | turbofail | it should just be system.is‽ |
| 16:54 | sdegutis | turbofail: no, the system could be without being up. |
| 16:54 | turbofail | well maybe it should have both then |
| 16:54 | turbofail | maybe it can be up, without being |
| 16:54 | delluminatus | Now we're talking metaphysics. If the system sin't up, does it still exist as the same system? |
| 16:54 | sdegutis | Look, let's just all agree that Go is perfect for this job. |
| 16:55 | sdegutis | delluminatus: Yes. It just doesn't work, that's all. |
| 16:55 | sdegutis | delluminatus: And yes, we made sure it's plugged in and the power button is on. |
| 16:55 | sdegutis | It says Windows ME on the bottom-right of the desktop, so I don't see why it's not working. |
| 16:55 | delluminatus | But if you define a system as a complex interaction between processes |
| 16:55 | sdegutis | OH MAN THIS IS TOO FN I HAVE TO LEAVE OR ILL NEVER GET WORK DONE |
| 16:55 | delluminatus | and the processes aren't running anymore |
| 16:56 | sdegutis | s/fun/fn/ |
| 16:57 | sdegutis | delluminatus: is a refrigerator still a refrigerator when you break the cooling pipe thing? |
| 16:57 | delluminatus | It's like, if a server's http daemon is down, is it still a web server? |
| 16:57 | sdegutis | Short answer: no. Long answer: yes. |
| 16:57 | delluminatus | But you wouldn't call a refridgerator a system, it's an object |
| 16:57 | delluminatus | if you are referring to the refrigeration system inside the refrigerator, that's a different story |
| 16:58 | antithesis | How can Clojure code run slower than Java code when they're both compiled to Java bytecode? |
| 16:58 | delluminatus | its like with the human brain, what matters is the pattern and the interaction, not the physical material |
| 16:58 | amalloy | antithesis: i mean...you can compile all sorts of really slow code to java bytecode |
| 16:58 | sdegutis | Okay hold on now, let's not get too close to legitimate discussions. |
| 16:59 | technomancy | antithesis: how can slow java programs run more slowly than fast java programs? |
| 16:59 | technomancy | they're both compiled to Java bytecode |
| 16:59 | amalloy | why is ((fn [x] x) 1) faster than ((fn [x] (recur x)))? |
| 16:59 | antithesis | kthx |
| 16:59 | sdegutis | Oh no, dangit, I went offtopic again. I forgot this was #clojure and not #clojure-social. |
| 16:59 | sdegutis | Sorry yall. |
| 17:00 | sdegutis | amalloy: they're the same speed. |
| 17:01 | sdegutis | Oh no wait, the latter is slower. |
| 17:01 | certainty | -.^ |
| 17:01 | `szx | has anyone tried using something like github.com/weavejester/reagi for RFP/elm style game programming? |
| 17:02 | `szx | FRP, sorry |
| 17:10 | TravisD | Give some iteration, where you assume each iteration takes the name number of operations, can you actually estimate the number of cycles per iteration by timing many iterations and using your CPU speed? |
| 17:11 | TravisD | Given* |
| 17:11 | hyPiRion | TravisD: well, you have cache, memory and I/O destroying that fun for you. You could probably calculate an estimate though |
| 17:11 | TravisD | Ah, yeah. And generally would you expect it to be an underestimate or an overestimate? |
| 17:12 | TravisD | ah, obviously an overestimate |
| 17:14 | hyPiRion | It depends on the program (surprise!) |
| 17:14 | hyPiRion | I'm not too good at microbenchmarks, but from what I've understood, you could get fairly accurate if you know enough about the iteration/loop. |
| 17:14 | TravisD | Ah, really? It seems like all the things you mentioned would only increase the running time |
| 17:15 | hyPiRion | TravisD: Oh, I mean you take a sample of the total run time, and extrapolate based on that |
| 17:16 | liflash | hi everybody, i'm trying to create a namespace for development in a directory 'dev', but i can't get it to be loaded on repl startup. it just keeps being unknown |
| 17:16 | hyPiRion | I'd assume it's really, really hard to do analytical reasoning on actual time for a program these days. A computer with an OS is just too complex. |
| 17:17 | liflash | I added the folder to the :source-paths in my project.clj, but it doesn't seem to be recognized |
| 17:17 | TravisD | hyPiRion: Ah, yeah. I was wondering because I'm reading through http://www.learningclojure.com/2010/09/clojure-is-fast.html and with the newer version of clojure. The estimates on the number of operations used (computed by comparing the time taken to the number of iterations and the CPU speed) are very close to the minimum possible number of operations |
| 17:17 | TravisD | Like, some places where his code reports 80 operations, mine is using 9 |
| 17:17 | TravisD | (same code, different computer, different version of clojure) |
| 17:20 | TravisD | anyways, not a big deal :) I mostly want to implement numerical algorithms in clojure and I am pretty curious to see how the speed will compare to other languages |
| 17:20 | hyPiRion | TravisD: Well, that's benchmarking 1.2. I'm fairly certain a lot of optimisations has been done related to primitives since then |
| 17:21 | TravisD | hyPiRion: Yeah, that's great :) |
| 17:21 | TravisD | very exciting |
| 17:22 | hyPiRion | yeah, love it |
| 17:24 | liflash | can someone give a hint, why the :source-paths config in the project.clj isn't recognized? |
| 17:27 | hyPiRion | liflash: first off, what do you mean by "loaded on repl startup"? |
| 17:29 | liflash | hyPiRion: I want to be able to call functions declared in files that are in another folder than src |
| 17:30 | hyPiRion | right, and (require '[my.namespace.name :as n]) doesn't work in the repl? |
| 17:31 | liflash | hmmm, ok, that works |
| 17:32 | liflash | but why can't i use (tool/some-function) like with everything else within src |
| 17:33 | liflash | (where tool is ns within the dev folder) |
| 17:35 | TravisD | Will Lieningen share copies of dependencies so that they don't need to be downloaded for every project? (Assuming versions match and everything) |
| 17:35 | hyPiRion | I'm guessing it's because the namespaces are lazily loaded, i.e. not loaded unless required. |
| 17:35 | hyPiRion | TravisD: yes, shares them with |
| 17:36 | hyPiRion | *shares them with maven |
| 17:36 | TravisD | Cool, I don't know much about maven |
| 17:36 | S11001001 | TravisD: don't worry about it |
| 17:36 | hyPiRion | yeah, what S11001001 said |
| 17:37 | TravisD | Ah, I just wanted to make sure :) It is taking quite a long time to download all of the dependencies of incanter. That would be quite a barrier to creating new projects |
| 17:37 | hyPiRion | Essentially, all dependencies are just stored in a directory (usually ~/.m2) and if not found at a specific path there, they are downloaded |
| 17:39 | liflash | hmmmm, this is strange... i have a namespace project.repl in the folder src and whenever i start the repl i can call (project.repl/some-fn) |
| 17:39 | liflash | I expected my own files and ns to work in the same way in the repl |
| 17:39 | liflash | i'm not exactly sure, but i don't think project.repl is required somewhere |
| 17:41 | liflash | either |
| 17:44 | liflash | or is there a possibility to turn off the lazy loading? i got this setup from http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded where the setup is "I create a :dev profile with an extra :source-paths directory: (defproject com.example/my-project "0.1.0-SNAPSHOT".... :profiles {:dev {:source-paths ["dev"]... |
| 17:47 | hyPiRion | Wish I knew enough about it to help you, but unfortunately I don't. |
| 17:48 | liflash | :-/ too bad |
| 17:48 | liflash | thanks anyway |
| 18:00 | michaniskin | is there a handy example of an immutant+jenkins setup for a ring app? |
| 18:14 | dsrx | I was just going over a brief architectural discussion with my boss and it hit me that if we were using datomic, the solution would be stupidly simple |
| 18:14 | gtrak | is it possible to get a list of protocol implementations? Seems like the protocol var only has what's in extend-protocol, I don't think that catches reifies and records. |
| 18:14 | gtrak | I guess reflection may work in the other cases. |
| 18:15 | qbg | I don't think that's going to be easy |
| 18:16 | gtrak | I'd really like file/line info out the other end :-) |
| 18:16 | gtrak | maybe tools.analyzer is the way to do it. |
| 18:21 | stuartsierra | JVM reflection can't tell you all the subclasses of a class or interface. It's an open set. |
| 18:36 | bbloom | dnolen_: worlds, huh? |
| 18:40 | bbloom | dnolen_: i read that paper a while back, if i recall correctly they memoize on read, so that what changes you see from the parent world is non-deterministic. seems like a weird design to me |
| 18:41 | bbloom | dnolen_: although the general idea of a mutable map w/ snapshotting makes sense to me |
| 18:57 | yeoj___ | how come i can't pass a even number of bindings into a let form? such as (let [two-forms] () ) |
| 18:58 | amalloy | yeoj___: that's only one form |
| 18:59 | amalloy | (ie, not an even number) |
| 18:59 | gtrak | yeoj___: if you're making a macro, you might want to do unquote-splicing |
| 18:59 | yeoj___ | amalloy: but two-forms is defined as something like this: (def two-forms [blah "blah?")) |
| 19:00 | yeoj___ | it's not really a macro, i'm trying to read parts of a text file (configuration) into a let |
| 19:00 | gtrak | why? |
| 19:00 | clojurebot | http://clojure.org/rationale |
| 19:01 | gtrak | XY? |
| 19:01 | yeoj___ | gtrak: it's an etl program that moves data, and i want to pass params in. the param file needs to be let-ish in that values can reference values previously defined. |
| 19:01 | yeoj___ | it's all a trusted source (from me, command line program) |
| 19:01 | gtrak | sounds like a hashmap |
| 19:02 | gtrak | or you can write an interpreter |
| 19:02 | yeoj___ | for instance, i didn't think the the third entry in the hash map be defined based on the concat of values 1 and two ? |
| 19:03 | `cbp | xy? |
| 19:03 | clojurebot | xy is http://mywiki.wooledge.org/XyProblem |
| 19:03 | gtrak | I made a little toy interpreter here: https://github.com/gtrak/webbedfeet/blob/master/src/com/garytrakhman/webbedfeet.clj#L79 |
| 19:05 | gtrak | if you really want to emit clojure code ('let'), then you're probably writing macros, but sounds like that's the Y part of the XY |
| 19:05 | gtrak | you want to store a value in something, and you want to be able to reference that value |
| 19:05 | gtrak | sounds like something a hash-map and a key can handle |
| 19:09 | yeoj___ | gtrak: this is what i'm tring to do. i'll try to step back and see the Y. https://www.refheap.com/44306 |
| 19:10 | yeoj___ | i don't see how source-sql can take values from source-base-name and table-name without being eval'd somehow |
| 19:10 | gtrak | you can just use a function for that |
| 19:10 | yeoj___ | (i.e. hashmap) |
| 19:10 | gtrak | (fn [table-name source-base-name source-sql] ..) |
| 19:11 | gtrak | not sure I see what's the complicated part. |
| 19:11 | gtrak | what's in config.config? |
| 19:12 | gtrak | ah, nm |
| 19:12 | `cbp | yeoj___: if you really need a config file and you control it, you should probably turn it into edn |
| 19:12 | gtrak | yea, don't make your own config format. |
| 19:12 | yeoj___ | `cbp: ok i'll look at that. i was trying to use literal sexp's |
| 19:12 | gtrak | why do you need to str it? |
| 19:13 | yeoj___ | it's more than that... the config file has multiple things |
| 19:13 | yeoj___ | it could even potentially have source->target transformations |
| 19:13 | gtrak | I see, so you're treating it like a massive let binding |
| 19:14 | yeoj___ | gtrak: yeah, i was trying to |
| 19:14 | yeoj___ | gtrak: maybe not seeing the Y |
| 19:14 | yeoj___ | i think i need to read up on edn and potentially how folks make dsl's |
| 19:14 | gtrak | if you want to keep the format like it is.. then you can parse out symbols and replace them |
| 19:14 | TravisD | I'm really enjoying reading the examples of the XY problem, lol |
| 19:15 | gtrak | basically create a 'let interpreter' |
| 19:15 | `cbp | yeoj___: it might be more sane to just include in your config file the let and have the let return a map |
| 19:15 | gtrak | I would avoid calling eval |
| 19:15 | `cbp | yeoj___: and probably just wrap it all in a function and make it an actualy clojure file :-) |
| 19:16 | yeoj___ | yeah, thats fine if it's a clojure file i guess, i could load-file at runtime? |
| 19:16 | `cbp | yeoj___: edn doesnt let you have anything other than constants |
| 19:16 | `cbp | yeoj___: I mean if it's in your classpath you can just require it |
| 19:17 | gtrak | you could implement your own eval that uses a hash-map as the environment, just use apply for stuff. |
| 19:17 | gtrak | probably overkill :-) |
| 19:17 | yeoj___ | it's like in my ~/.bashrc, i setup how i want to use bash, and if i set something on line 1 i can reference it on line 10 type of thing. |
| 19:17 | yeoj___ | thats the functionality i'm looking for i think (y problem?) |
| 19:18 | gtrak | if you limit what you can do in your format, then your life is easier. |
| 19:18 | gtrak | for instance, hadoop uses a configuration format that expands placeholders |
| 19:18 | gtrak | that would handle the str case |
| 19:19 | gtrak | without having to parse sexps |
| 19:20 | yeoj___ | gtrak: ok. i'll think about that. |
| 19:20 | gtrak | like: hadoop.tmp.dir = /tmp/hadoop-${user.name} |
| 19:20 | gtrak | where user.name is another property |
| 19:20 | yeoj___ | yeah |
| 19:21 | yeoj___ | would let* let me combine one let into another? like list*? |
| 19:21 | gtrak | no |
| 19:22 | gtrak | you could use a macro, but it's probably a bad idea. |
| 19:22 | yeoj___ | yeah. i've used a product that had a pretty powerful "parameter definition language" built in, and we did some dynamic metaprogramming for data migration. thats what i'm trying to explore/etc. |
| 19:22 | gtrak | `(let [~@(read (slurp "config.config))] ...) |
| 19:23 | gtrak | though read probably won't work either |
| 19:23 | `cbp | read-string |
| 19:23 | gtrak | right, I think read-string might also not work |
| 19:23 | gtrak | unless you wrap the string in a vector or something |
| 19:24 | yeoj___ | i haven't gotten either to work yet, tried both but i have just read the docs and not used frequently |
| 19:24 | yeoj___ | string cannot be cast to pushbackreader |
| 19:24 | `cbp | yeoj___: read-string |
| 19:24 | `cbp | instead of read |
| 19:24 | gtrak | it's just kind of a bad idea, it's just as powerful as code, but not fully code. |
| 19:25 | gtrak | why not just code. |
| 19:25 | `cbp | yeoj___: you would also need to wrap your config file in a vector |
| 19:25 | yeoj___ | well, i didn't really want to have lein on this server, and wanted to just have a jar |
| 19:25 | gtrak | saves you an indent, (let [ and a ]) |
| 19:26 | gtrak | yeoj___: lein has nothing to do with it |
| 19:26 | gtrak | can dynamically load a file or a classpath-resource in any jvm environment. |
| 19:26 | yeoj___ | i could just leave a file to be loaded from the classpath and have this function in there, with the let binding (with the cool precedence-var-replacement stuff) and then load-file as it's on the classpath |
| 19:27 | `cbp | load-file doesn't need it on the classpath |
| 19:27 | yeoj___ | it would save me from all the typo's of having "table-name" 15 places throughout the config file, etc. |
| 19:27 | `cbp | that would be the simplest and the most dangerous :-D |
| 19:28 | `cbp | or easiest rather than simplest |
| 19:28 | yeoj___ | i'm not too worried about dangerous, i simply am going to use this program only this weekend |
| 19:28 | yeoj___ | to move 500+ tables from MSSQL -> another database type |
| 19:28 | yeoj___ | then it's a throw away |
| 19:28 | gtrak | then.. it doesn't even matter. :-) use a clj file. |
| 19:29 | yeoj___ | ok. i'll call it "config.clj". done. |
| 19:29 | yeoj___ | thanks everyone. |
| 19:29 | `cbp | farewell |
| 19:29 | gtrak | lol |
| 20:09 | TravisD | Can qualified symbols access anything on my class path? If so, what is the purpose of require? |
| 20:10 | alandipert | TravisD, finding and compiling .clj sources |
| 20:10 | amalloy | TravisD: qualified symbols can only refer to vars that have been loaded; require loads files |
| 20:10 | TravisD | Ah, that makes sense |
| 20:11 | TravisD | I guess clojure.string is loaded by default? |
| 20:11 | amalloy | yes |
| 20:11 | amalloy | clojure.core, clojure.string, clojure.set, and i think one other |
| 20:11 | TravisD | aha - I guess that was a bad choice to experiment with |
| 20:11 | amalloy | require also allows you to use shorthand qualified symbols |
| 20:12 | amalloy | (require '[clojure.string :as s]) (s/join " " [1 2 3]) |
| 20:12 | TravisD | ah, yeah |
| 20:12 | TravisD | I was mostly wondering about why you needed to load things, since it didn't look like clojure.string needed to be loaded |
| 20:13 | amalloy | huh. when i `lein uberjar`, a number of classes with names like null$fn__3133.class are generated |
| 20:14 | amalloy | does someone really have a bunch of lambdas defined in a namespace named "null", or is there some issue giving these the wrong name, i wonder |
| 20:14 | TravisD | Actually, http://java.ociweb.com/mark/clojure/article.html#Namespaces should probably not use clojure.string as the example there |
| 20:14 | TravisD | since it is loaded by default |
| 20:14 | hiredman | amalloy: *ns* is nil for some reason |
| 20:15 | hiredman | which, I dunno, might happen if you a pop-thread-bindings at the top level |
| 20:16 | hiredman | have and extra |
| 20:16 | hiredman | an |
| 20:23 | TravisD | Is there a mapping from file names to namespaces? |
| 20:25 | TravisD | Like, in any file I can switch the default namespace to whatever I want. But when you're requiring a library, how does it know where to look? Does it look for "my.first.namespace" in "my/first/namespace.clj" or something |
| 20:25 | alandipert | TravisD, basically, and dashes are underscores |
| 20:26 | TravisD | ah okay. So is it important that the namespace used in a file match the files location? |
| 20:26 | TravisD | file's* |
| 20:26 | dsrx | aghhh.... spent all that time writing a websocket repl for clojurescript so i could use it in spotify, only to find that the project I was going to use it for is intractable |
| 20:26 | dsrx | :C |
| 20:26 | alandipert | TravisD, for require to work, yes |
| 20:27 | TravisD | alandipert: cool, thanks |
| 20:27 | alandipert | TravisD, np |
| 20:38 | dnolen_ | ClojureScript 0.0-2173 going out, bunch fixes around library resolution - also you can now provide your own reference types that act like atoms via IReset & ISwap protocols |
| 20:41 | mlb- | A few of my coworkers are used to C++ and often fall back on to C++ idioms when writing Clojure. What is an equivilent idiom for C++'s RAII in Clojure? |
| 20:42 | qbg | mlb-: are there resources to be closed? |
| 20:43 | qbg | dnolen_: Sweet! |
| 20:44 | mlb- | qbg: For an abstract sense of "resources", yes. I was thinking of something like a try/finally, but that has a hackish feel to me. |
| 20:44 | qbg | Check out with-open |
| 20:45 | dnolen_ | the IAtom stuff is particularly useful I think, it allows you to build custom data types that act like atoms but can maintain internal history |
| 20:45 | dnolen_ | https://github.com/swannodette/worlds/blob/master/src/worlds/core.cljs |
| 20:45 | dnolen_ | so you can do VPRI like worlds stuff |
| 20:47 | mlb- | qbg: ah, cool. I was referring to cases with more open ended/general initialization/cleanup code. |
| 20:47 | qbg | In the more general case, a macro may be best |
| 20:49 | alandipert | mlb-, i haven't seen RAII on JVM because of lack of destructors. for clojure though, beyond with-open, there is the neat https://github.com/pjstadig/scopes (i haven't used it yet) |
| 20:54 | qbg | For fun, I've written a small parametric filtering library for Clojurescript. Does that sound useful, or is there already a good solution for that? |
| 20:57 | mlb- | alandipert: Hmm, interesting, I'll look into that |
| 20:57 | clojurebot | It's greek to me. |
| 21:14 | TravisD | Does clojure have a built in not equal operator? |
| 21:14 | gfredericks | ,not= |
| 21:14 | clojurebot | #<core$not_EQ_ clojure.core$not_EQ_@57c24c> |
| 21:14 | TravisD | Ah, thanks |
| 21:23 | Guest66083 | Does anyone know if there's a way (or project) to "scaffold" a CRUD interface from a MySQL DB? So tell clojure a DB name, and get the CRUD operations on the tables.... Anything like that available? |
| 21:24 | Guest66083 | before I roll my own... It's basically like PHPmyAdmin. anyone ported that? |
| 21:46 | ruzu | no idea.. but any time i see the letters "p", "h" and "p" in sequence i am filled with uncrollable hulk-like rage |
| 21:46 | ruzu | s/uncr/uncontr |
| 22:11 | tlewis | Hi all. Started learning Clojure recently and had a question about doseq if anyone has a minute. |
| 22:11 | dsrx | don't ask to ask, just ask |
| 22:12 | tlewis | Basically, I am writing to a file, and I need to make a specific write on the last iteration, as it were. |
| 22:15 | pbostrom | tlewis: you can run your doseq on (butlast seq), and then run (last seq) to do your special write |
| 22:24 | tlewis | So something like (doseq [running (butlast seq)] (spit file-name running) (spit file-name (last seq)) ? |
| 22:28 | pbostrom | yes, if (spit file-name (last seq)) is out side of the doseq, also you need to pass :append true if you don't want to overwrite the file each time |
| 22:40 | chare | does anyone have a pdf copy of this book: https://leanpub.com/fp-oo |
| 22:42 | tlewis | I have the :append true part down. Most of my problem is coming from the fact that I have triple nested calls to (doseq) and I need to put a special EOF at the end of each file. |
| 22:42 | tlewis | I am parsing xml and generating a file from the xml |
| 22:43 | bob2 | are you sure you don't want to use an xml generator thing |
| 22:43 | bob2 | chare, it's on that site, for $15 |
| 22:44 | tlewis | It is quite possible I do. I have only been doing Clojure for about a week. |
| 22:44 | tlewis | I am currently using clojure.xml |
| 22:44 | bob2 | what's the 'special EOF'? |
| 22:45 | tlewis | I am parsing xml and generating Objective-C code, so I need "@end" at the end of each file. |
| 22:46 | bob2 | ah |
| 22:46 | chare | join #dynamo |
| 22:46 | chare | ignore that |
| 22:47 | pbostrom | tlewis: I thought you were doing something special with the last value of the seq, if that's not the case than you can just write @end outside of the doseq |
| 22:49 | pbostrom | tlewis: you also may want to consider building up the entire file as a string and then writing it once |
| 22:49 | tlewis | I didn't think if building it as a string, that might be the better way. |
| 23:04 | chare | nobody has the book "Functional Programming for the Object-Oriented Programmer"? |
| 23:06 | amalloy | brian marick probably has a copy |
| 23:06 | chare | amalloy you think you're funny? |
| 23:06 | amalloy | but that's not the question you're asking: you're asking "will someone give me a free pdf copy of this book?" |
| 23:06 | chare | yes that is true |
| 23:07 | amalloy | i surely hope nobody does, and i doubt they will |
| 23:07 | chare | ok just let me borrow the book then |
| 23:08 | bob2 | chare, please buy it or be quiet |
| 23:17 | pmonks | Good evening gurus! |
| 23:18 | pmonks | Am I right to assume the following behaviour is a leaky abstraction from Java: |
| 23:18 | ruzu | clojurus? |
| 23:18 | pmonks | ;-) |
| 23:18 | pmonks | '(= #"foo" #"foo") |
| 23:18 | pmonks | doh - how do I trigger clojurebot? |
| 23:18 | qbg | ,(= #"foo" #"foo") |
| 23:18 | clojurebot | false |
| 23:18 | pmonks | ty |
| 23:19 | pmonks | I assume that result is a Javaism inherited from Pattern or wotnot? |
| 23:19 | pmonks | *Pattern.equals |
| 23:19 | pmonks | (or rather lack thereof) |
| 23:19 | Cr8 | pmonks: you can check |
| 23:19 | Cr8 | ,(.equals #"foo" #"foo") |
| 23:19 | clojurebot | false |
| 23:20 | pmonks | Yeah I'm pretty certain that's the explanation, but being a n00b wanted to verify. |
| 23:20 | pmonks | Didn't think to call native .equals though - thanks for the reminder! ;-) |
| 23:20 | Cr8 | pmonks: Object has a .equals, so anything that doesn't define its own will have that one |
| 23:21 | Cr8 | which will just be object identity |
| 23:21 | pmonks | Yep, which only checks precise object equality (i.e. ==) |
| 23:21 | Cr8 | ,(let [foo-re #"foo"] [(.equals foo-re foo-re) (= foo-re foo-re)]) |
| 23:21 | clojurebot | [true true] |
| 23:21 | pmonks | Doesn't look like java.util.regex.Pattern overrides the default… ;-( |
| 23:21 | Cr8 | indeed it does not |
| 23:21 | pmonks | #sadpanda |
| 23:21 | Cr8 | you can str them |
| 23:22 | Cr8 | ,(str #"foo") |
| 23:22 | clojurebot | "foo" |
| 23:22 | Cr8 | ,(= (str #"foo") (str #"foo")) |
| 23:22 | clojurebot | true |
| 23:22 | pmonks | Yeah that's my workaround. |
| 23:22 | pmonks | (str #"\s([Ss]omething [cC]omplicated)") |
| 23:22 | Cr8 | or maybe .pattern is more correct, i expect they're the same though |
| 23:22 | pmonks | ,(str #"\s([Ss]omething [cC]omplicated)") |
| 23:23 | clojurebot | "\\s([Ss]omething [cC]omplicated)" |
| 23:23 | Cr8 | ,(.pattern #"\s([Ss]omething [cC]omplicated)") |
| 23:23 | clojurebot | "\\s([Ss]omething [cC]omplicated)" |
| 23:23 | Cr8 | yep |
| 23:24 | dsrx | now make it check that the regexes are equivalent even if their strings aren't equal |
| 23:27 | TravisD | is there a non-nested version of update-in? |
| 23:29 | pmonks | @dsrx :-D |
| 23:31 | pmonks | Mind blown: http://stackoverflow.com/questions/8961632/how-should-one-proceed-to-prove-or-find-if-two-regular-expressions-are-same-or |
| 23:32 | dsrx | that only works with truly regular expressions, not some (useful) abomination like PCRE |
| 23:32 | pbostrom | TravisD: just specify a single key |
| 23:33 | TravisD | pbostrom: Yeah, it's just that some other functions have both versions, like get and get-in. Seems like if you don't need the nested functionality, it might be easier to understand if the non-nested version is used |
| 23:34 | dsrx | pmonks: _understanding computation_ by tom stuart is a great book if you want to learn more about that kind of thing |
| 23:34 | pbostrom | TravisD: yeah, there's no update for some reason |
| 23:35 | TravisD | Hm, there's probably a good reason |
| 23:48 | ambrosebs | this ticket has a patch to support (update-in m [] f) as being equiv to update |
| 23:48 | ambrosebs | http://dev.clojure.org/jira/browse/CLJ-373 |
| 23:51 | TravisD | ambrosebs: That seems to be discussing a different issue ,no? |
| 23:51 | TravisD | some inconsistency in the behaviour of get-in and update-in |
| 23:52 | TravisD | We're wondering why there isn't an update function that is equivalent to (update [m k f & args] (apply update-in m [k] f args)) |
| 23:53 | TravisD | er, (defn update ...) |
| 23:56 | chare | lets talk about cool stuff |
| 23:57 | ambrosebs | TravisD: ah yes |
| 23:58 | nido` | not actually very cool, but I'm starting to learn clojure and I'm having a hard time getting cider to work for me in emacs |
| 23:59 | TravisD | nido`: I installed cider using packege.el. Worked like a charm! |
| 23:59 | nido` | Yeah, that's what I did too, but when I try to m-x cider-jack-in it says it fails to connect to a server. |
| 23:59 | TravisD | nido`: Are you on Mac OS? |
| 23:59 | nido` | I've also been unable to get it to connect to the lein repl |