#clojure logs

2014-02-21

00:08chareis there an ubuntu ppa for leiningen
00:16jgmizechare why are you looking for a ppa? are the install instructions on http://leiningen.org/ not working for you?
00:40jairtrejoHello! 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:46charejgmize uh so what do I do after i run the script
00:46chareit dumps stuff in .lein
00:47jgmizeI'd probably start with the tutorial: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md
00:48charejgmize where is the lein binary
00:49charejgmize so there is no lein binary to run after install script????
00:49jgmizeright, the script itself is what you execute
00:50jgmizeyou just download it, make it executable, put it on your path
01:00charejgmize lein run went to fetch clojure
01:01charewhere did it put it
01:07jgmizechare: 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:14xuserchare: somewhere in ~/.m2
01:47boltRLeiningen seems like such a big hassle to set up
01:49systemfaultWhat? The way it's show on the main website... even someone mentally challenged could install it without much trouble.
01:50Cr8boltR: you put the lein script on your PATH and then..
01:50Cr8well
01:50Cr8you're done
01:50DomKMboltR: https://github.com/technomancy/leiningen/wiki/Packaging
01:50dsrxit'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:51systemfaultdsrx: How do you do it?
01:53systemfaultdsrx: Just give me a hint... an editor... a plugin... anything :P
01:55dsrxif 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:55systemfaultThank you, what do you use personally?
01:56dsrxi 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:57systemfaultAh ok, still.. thanks a lot :)
02:41djcoinAllow 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:41djcoininsight on this, I would be really nice.
02:41djcoin* it would be really nice
02:41djcoinThanks! :)
02:47charedjcoin if you're using a database with no acid transactions you're just screwed
02:47chareso why are you using a non acid database
02:51djcoinchare: 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:52djcoinYou are telling me to _just use_ acid (eg: SQL?) and that's all ? Like you will never use any other db ?
02:52djcoinI need more fun :)
02:53chareso you want to turn a nonacid database into a acid database
02:53chareand add it too a bunch of other acid databases?
02:53systemfaultdjcoin: Even if you use elasticsearch... your "source of truth" will still be your DB...
02:54systemfaultIf you're really motivated, you could even take a look at more funky BASE architecture like CQRS
02:54djcoinchare: no, i'm looking for advices on what's the best mindset, advices, on maintaining a system like this
02:56djcoinIf 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:56djcoinThen I will be really grateful
02:57charedjcoin 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:57djcoinBut I mean, let's take the hypothesis that I only use "ACID" databases but multiple one like say datomic and a NoSQL db
02:57djcoinAnd attack this subset if a non-acid database is game over from the start
02:58charedjcoin 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:59djcoinnice chare !
02:59chareneo4j is an acid graph db
02:59chareso it doesn't have to be sql
02:59djcoinIndeed, I wasn't aware that such a standard existed
02:59djcoinThanks
03:00chareat least I "believe" postgres supports XA, never actually tried it
03:16devn"reify Fruit", heh
03:37muhooi just did a project where the "database" was just an atom backed by a file. it was a breath of fresh air.
03:38muhooassoc-in and update-in ftw.
03:41clgvmuhoo: yeah that works pretty well for small projects
03:41djcoinmuhoo: was it a transient db, or could you persist/backup it ?
03:42muhoohttps://github.com/kenrestivo/utilza/blob/master/src/utilza/memdb.clj if you're curious
03:42lvhthe only difference between assoc-in and update-in is the (let [new (f old)] ...) right?
03:43muhoolvh: update-in takes a function to transform the value, assoc-in just takes the value
03:44muhooit's like the difference between swap! and reset!
03:44lvhgotcha :)
03:45djcoinmuhoo: thanks!
03:46muhooclgv: 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:47muhoodjcoin: np, enjoy
03:47lvhIt 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:47muhooit's beer free
03:48clgvmuhoo: but you only get the cheap local beer and not the good german export ;)
03:49muhootrue :-)
03:49lvhclgv: Ahem!
03:50clgv:P
03:50djcoinyeah in this case the local beer is awesome :)
03:51ro_stdatomic is free. it isn't open source.
04:13rurumateI'm looking for a function f so that (= (f [1 2 3]) [[1] [1 2] [1 2 3]])
04:14rurumateedge-ngram style, so not exactly what partition is doing
04:14lvhoh, derp, I thought you meant subsets and then I read properly :)
04:14ssafejava:) is this a 4clojure problem?
04:15lvhso, for [1 2 3 4] it's [[1] [1 2] [1 2 3] [1 2 3 4]]?
04:15lvhthat's pretty easy to do with a reduce, last and into :)
04:15rurumateyes
04:17lvhrurumate: I don't think there's a function like that ready to use if that is what you are asking
04:23elfenlaid__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:24djcoinrurumate: (defn x [coll] (reduce #(conj %1 (vec (conj (or (last %1) []) %2))) [] coll) ;; note: i'm not a clojure expert yet!
04:26djcoin(the vec call can be trashed)
04:33winkanyone got a clue how to force a postgres nextval() in korma?
04:34winkmy problem is that I'm using (insert table (values param)) instead of (insert table (fields) {..map..})
04:44kohyama,(#(mapv (fn [i _] (vec (take i %))) (iterate inc 1) %) [1 2 3 4])
04:44clojurebot[[1] [1 2] [1 2 3] [1 2 3 4]]
04:48rurumatethx kohyama
04:52kohyamarurumate: you're welcome.
04:58rurumate,((fn ngrams [x] (mapv #(vec (take (inc %) x)) (range (count x)))) [1 2 3 4])
04:58clojurebot[[1] [1 2] [1 2 3] [1 2 3 4]]
05:08kohyamarurumate: I prefer to be lazy.
05:09kohyama,(#(map (fn [i _] (take i %)) (iterate inc 1) %) [1 2 3 4])
05:09clojurebot((1) (1 2) (1 2 3) (1 2 3 4))
05:09kohyama,(take 4 (#(map (fn [i _] (take i %)) (iterate inc 1) %) (iterate inc 1)))
05:09clojurebot((1) (1 2) (1 2 3) (1 2 3 4))
05:09kohyama,((fn [x] (map #(take (inc %) x) (range (count x)))) [1 2 3 4])
05:09clojurebot((1) (1 2) (1 2 3) (1 2 3 4))
05:10kohyamabut (take 4 ((fn [x] (map #(take (inc %) x) (range (count x)))) (iterate inc 1))) never ends
05:11tomjack``dnolen_: I finally looked at Om :)
05:11tomjack``thanks for the tutorials
05:16clgvrurumate: ,(reductions (fn [_ n] (take n [1 2 3 4])) nil (range 4))
05:17clgv,(reductions (fn [v n] (conj v n)) [] [1 2 3 4])
05:17clojurebot([] [1] [1 2] [1 2 3] [1 2 3 4])
05:18clgvrurumate: ^^
05:48silasdaviswhat's a nice way to avoid iterating over the list twice in ((juxt filter remove) f coll) ?
05:50Anderkentsilasdavis: something like (let [{filtered true removed false} (group-by f coll)])
05:51Anderkent,(let [{ft true rm false} (group-by odd? [1 2 3 4 5 6])] [ft rm])
05:51clojurebot[[1 3 5] [2 4 6]]
05:51silasdavisAnderkent, f does not return a boolean
05:52Anderkentright, so (group-by (comp bool f))
05:52silasdavisah good thanks
06:05sm0keis there something like medium.com with private posts?
06:05sm0keofftopic question
06:07DerGuteMoritzorg-mode
06:07sm0keDerGuteMoritz: umm i would like to share it with other people
06:07sm0kenot using emacs
06:08DerGuteMoritzorg-mode html export then :-)
06:08AimHereShare emacs with other people first, thereby reducing the problem to the previously solved one!
06:08sm0ke:P
06:08sm0keumm although word docs have comments but they suck
06:09sm0keDerGuteMoritz: oh i would like other to add comments
06:31certaintyDerGuteMoritz: o/
06:34DerGuteMoritzcertainty: JAVA!
06:36certaintyDerGuteMoritz: :)
06:36DerGuteMoritz:-D
07:35arcatangoogle docs have comments, too, if you're into inline commenting
07:49sm0kethanks will look into it, but google is evil
08:18rurumate,((fn [[x & xs]] (reductions conj [x] xs)) [1 2 3 4])
08:18clojurebot([1] [1 2] [1 2 3] [1 2 3 4])
08:42scape_,(map #(bit-and 23 (bit-shift-left 1 %)) (range 8))) ;;byte of 23
08:42clojurebot(1 2 4 0 16 ...)
08:42scape_that's handy
09:13fredyr,(defmacro L->> [& forms] `(fn [x#] (->> x# ~@forms)))
09:13clojurebot#'sandbox/L->>
09:13fredyr,(map (L->> (bit-shift-left 1) (bit-and 23)) (range 8))
09:13clojurebot(1 2 4 0 16 ...)
09:15scape_,(map (comp not zero?)(map #(bit-and 23 (bit-shift-left 1 %)) (range 8)))) ;;byte of 23
09:15clojurebot(true true true false true ...)
09:20hyPiRionin this case, `(comp not zero?)` could be replaced with `pos?`
09:21scape_oh that's good, didn't know about that
09:31rurumateis there also a shorter way to write (comp not neg?) ?
09:32hyPiRion#(<= 0 %) ?
09:33rob3hyPiRion: is that your poker face
09:33hyPiRion(some-fn pos? zero?)
09:33hyPiRionrob3: hah, not far off
09:33rob3:)
09:44mdrogalisIs anyone here using Storm with Clojure > 1.4.0?
10:10sm0kemdrogalis: i think storm needs to be upgraded
10:11sm0kei tried once, didnt work
10:12sm0kei think thats obvious, are you asking if anyone upgraded it?
10:13sm0kestorm is like duke nukem forever
10:13sm0kespecially the zmq part, its ancient!
10:23simonhhi - 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:23simonhConnecting to nREPL on 127.0.0.1:9898...
10:23simonhnREPL connection closed: connection broken by remote peer
10:23simonh
10:23simonherror in process sentinel: if: Wrong type argument: stringp, nil
10:23simonherror in process sentinel: Wrong type argument: stringp, nil
11:00winkanyone using korma with postgres? any clue how I can insert when I'd write nextval() in pure sql?
11:14mskou72Being 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:15hyPiRionmskou72: perhaps flatland's useful
11:15hyPiRion$google flatland useful github
11:15lazybot[thinkpixellab/flatland · GitHub] https://github.com/thinkpixellab/flatland
11:15hyPiRionwell, that wasn't the right one
11:16hyPiRionhttps://github.com/amalloy/useful
11:20TravisDwhy is it called flatland?
11:20mskou72not the right one, but funny. Ok thanks for the link, will check it out.
11:20technomancybecause it's a romance in many dimensions
11:20TravisDheh
11:21devn(inc technomancy)
11:21lazybot⇒ 98
11:21devnlol
11:22cgriegoIf Regular Clojure/West Registration ends today, is there a higher rate or do ticket sales just stop?
11:24TimMctechnomancy: 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:24TimMcThis calls for a celebration.
11:25technomancyI'll break out the romulan ale
11:26technomancyfor some reason that really sounds like as smbc strip
11:28famous34627Please like this video, regarding humanitarian purposes for little girl who need new heart... https://www.youtube.com/watch?v=E2t0HX3hNys
11:40craigbroearthlings
11:40craigbrowhen writing a defrecord, I would like to have my methods call other methods in the same protocol, but I get fail
11:41craigbrocan I just declare the symbols in the local namespace?
11:47pbostromcraigbro: the defrecord is in a different namespace than the protocol?
11:48craigbroyes
11:48shep-werkcraigbro: Something like this works for me https://gist.github.com/shepmaster/9137965
11:48shep-werkoh, multiple ns...
11:49nopromptdnolen_: got the basic generic inspection component working. https://github.com/noprompt/ankha
11:49nopromptdnolen_: based some of the code off of work stuartsierra did a couple years ago.
11:52pbostromcraigbro: 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:52nopromptdnolen_: there's an example of what it looks like `lein with-profile build cljsbuild once a`.
11:52nopromptdnolen_: any feedback would be welcome.
12:07pbostromcraigbro: https://gist.github.com/pbostrom/9138456
12:08craigbrothanks pbostrom, I think I may have confused myself in REPL hell yesterday. that seems the obvious solution
12:08shep-werkpbostrom: I like your example code ^_^
12:08pbostromnp, I actually got hung up on that trying to reify a protocol a few weeks ago
12:11hyPiRionoh ey, is there a reason why Cons doesn't allow pop and peek, but allows conj?
12:11craigbrohmm
12:12craigbroI "use" the namespace with the protocl
12:12craigbrohowever, just discovered that if I fully name the symbol.. it works
12:12craigbroI think befoe I was doing soething stupid like
12:12craigbrons.it.is.in.Protocol/method
12:13craigbroquery raro
12:13craigbroerr.. que raro…
12:13nopromptcraigbro: fyi avoid :use or (:require [x :refer :all])
12:13dnolen_noprompt: sweet! will give it a look!
12:13craigbroit won't resolve the short symbol, even tho I "use" the namespace
12:14craigbronoprompt: yah, heard that advice….
12:14craigbronoprompt: what is the rational?
12:14nopromptdnolen_: it needs a bit of refactoring/cleaning up.
12:14craigbroI control both namespaces in this case
12:14nopromptcraigbro: you lose sight of where things are coming from.
12:16nopromptcraigbro: 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:16craigbroTurns out that in the actual code in question (not my scratch) that I use require refer...
12:20craigbroderptastic — it works exactly as it should, I was just confused by too many hours of hacking yesterday
12:24jcromartiewhy should .lein-classpath be ignored by source control?
12:25hyPiRionjcromartie: because it's autogenerated by lein
12:25jcromartieoh I see, I have a /.lein-* in my .gitignore
12:26jarjar_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:27dnolen_noprompt: ankha is a fantastic start!
12:30nopromptdnolen_: awesome! thanks! were you able to see the example?
12:30dnolen_noprompt: yep
12:31nopromptdnolen_: nice, any tips in the code or does it look about right?
12:33dnolen_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:33heathwould someone upload the video to this talk? http://www.infoq.com/presentations/clojure-core-async
12:33heathit was available just a couple of weeks ago
12:33dnolen_noprompt: it's already great as a simple EDN viewer
12:34dnolen_noprompt: somebody should wire this up into an EDN Chrome Extension :)
12:34nopromptdnolen_: next steps. :)
12:37michaniskindoes 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:38nopromptdnolen_: 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:38dnolen_noprompt: yes
12:39dnolen_noprompt: the first thing I want to hook this up to is an editable
12:39dnolen_so you can manipulate an Om component via direct interaction
12:39TimMcmichaniskin: Any of the http-equiv forms.
12:39nopromptdnolen_: oh that would be awesome.
12:40michaniskinTimMc: thanks!
12:40Anderkentdnolen_: noprompt: link? sounds interesting
12:41Anderkentnevermind, found it
12:41Anderkentwasn't on google, for some reason!
12:41TimMcmichaniskin: I would assume any meta tag is irrelevant after the HTML is received. There might be a few exceptions, though.
12:42michaniskinTimMc: fwiw http-equiv="Refresh" seems to work okay
12:42michaniskinactually let me qualify that: it works in _chrome_
12:43michaniskintesting all the permutations in all the browsers is not feasible
12:43nopromptAnderkent: https://github.com/noprompt/ankha
12:44nopromptAnderkent: 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:45Anderkentnoprompt: cheers.
12:46TimMcmichaniskin: Fascinating.
12:51jcromartiecan I easily call another Leiningen task from my custom task?
12:51jcromartiewait, of course
12:56jcromartievery nice! the result of leiningen.uberjar/uberjar is the path to the created Jarfile
12:57technomancyfunctions: they're what's for dinner
12:58noprompttechnomancy: i've had that thought man times.
13:01bmukDoes 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:03arcatanmy very remote recall is that it originally was like native functions, but it was later changed to be strings only
13:04bmukThat's too bad. I was really intrigued by it.
13:09hugodbmuk: symbols in function position are resolved if they are not strings, so you can write script returning functions
13:10hugodbmuk: pallet has a library of these in its pallet.script.lib ns
13:40pczaj,(+ 1 2)
13:40clojurebot3
13:44tomjackcan I use data readers in a test .clj file without data_readers.clj?
13:44tomjackand without putting it in a string in the test file..
14:15amalloytomjack: (binding [*data-readers* x] ...)?
14:16tomjack(binding [*data-readers* {'foo #'foo}] #foo 42) ?
14:17tomjack"No reader function for tag foo"
14:18amalloytomjack: no, you can't do that
14:18tomjackah
14:18tomjack(set! *data-readers* {'foo #'foo})
14:18tomjackyes, hence my question :)
14:18amalloy(binding [*data-readers* {'foo #'foo}] (read-string "#foo 42"))
14:18tomjackdidn't I say "without putting it in a string" ?
14:19amalloyyou did, but i didn't understand what you meant
14:19tomjacksorry :)
14:19tomjackhmm, alter-var-root assoc? :/
14:20amalloyi don't understand your goal here
14:20tomjackhmm
14:20tomjackwhen I thought about describing it, I realized it's stupid :)
14:21tomjackI was thinking of having many auto-generated data readers
14:21tomjackand I didn't want to put them in data_readers.clj really..
14:21tomjackit would be nice if I could just have one data reader that can be used for all of these cases
14:21tomjackthen I can put that in data_readers.clj
14:22tomjackbasically my goal is "data readers for protobufs"
14:25technomancyerhm; aren't data readers limited to string input?
14:25tomjackother way around
14:25amalloyyou want #my/proto {:x 1} to read as a Protobuf object?
14:26tomjackI'm considering it
14:26tomjackanyway
14:26technomancyah
14:26amalloythat's like...a disaster. just write (my/proto {:x 1}). there's no reason for the reader to do it
14:26tomjackright
14:26amalloythe compiler wouldn't know what to do with the resulting form anyway
14:27tomjackoh, hmm
14:33tomjackyou mean AOT?
14:34tomjackthe place I actually wanted them was in .edn files
14:34stuartsierraIf you're reading EDN files, you can pass a map of data reader functions to edn/read.
14:34tomjackright
14:35tomjackthen I was like "ooh tests" for no good reason :)
14:35tomjackbecause I've been writing tests with protobuf in Java
14:35tomjack:(
14:36sdegutisI'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:37sdegutisAny idea what could be causing that?
14:37ToBeReplacedon a type-hinting rampage... is there a way to type-hint the return type of a protocol method?
14:38jcromartiesdegutis: you mean 'lein ring serve'?
14:38sdegutis"lein ring server-headless"
14:39sdegutisYep.
14:39jcromartiewhy are you trying to get away from it?
14:39amalloyToBeReplaced: 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:39jcromartie(I can think of a few reasons)
14:39sdegutisjcromartie: ideally we'd compile the uberjar locally and then deploy just the jar to production and run that by itself
14:39jcromartieyes
14:39jcromartiea -main function will do nicely there
14:40tomjackwhen I read the tagged literals I was actually thinking of, I actually can't return a protobuf message
14:40sdegutisFirst 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:40jcromartieyes
14:40tomjackbecause there can be a symbols in any field value
14:40ptcekIs 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:41jcromartiesdegutis: so, you should have a "main" namespace that takes care of starting the standalone server
14:41amalloyptcek: not with ordinary functions, but see technomancy/serializable-fn
14:41tomjackbut with clojure.edn I can bind readers for those tags which accept symbols, performing .proto validation but not returning protobufs
14:41sdegutisjcromartie: that's already taken care of with `lein ring uberjar`
14:41tomjackhmm..
14:42jcromartieOK so, the problem is that if you have ever connected to the remote nREPL, you can't kill the server process?
14:43sdegutisYep.
14:45technomancysdegutis: why don't you want source in production?
14:45mklappstuhl__how can I dynamicise the "abc" part of a regex like #"^abc"
14:45sdegutisYou 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:46jcromartiesdegutis: checking it out now
14:46SegFaultAXmklappstuhl__: What do you mean?
14:46sdegutistechnomancy: Heh you've got a good sense of humours.
14:46joegallomklappstuhl__: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/re-pattern
14:46technomancysdegutis: phlegmatic humours?
14:46joegallo(re-pattern (str "^" abc-like-things))
14:46sdegutisThe cardinal humors, so maybe.
14:47mklappstuhl__joegallo thanks!
14:47jcromartiesdegutis: I can quit with Ctrl-D
14:47sdegutisThat may be cheating sir.
14:47jcromartiebut that's from starting the nREPL server via "lein repl"
14:47sdegutisOh no, not quit the repl.
14:47sdegutisThe server process itself, which you run with `lein ring server-headless`
14:47technomancysdegutis: does it happen with other nrepl clients, or just lein's?
14:48sdegutisOnly tried it with lein. May try it with nrepl.el soon.
14:48technomancysomething to check
14:48jcromartiesdegutis: I can Ctrl-C with "lein run"
14:49jcromartiestill not your use case though right?
14:49sdegutisLet me reproduce it as a repo.
14:51ptcekamalloy: do not understand anything from the 26 lines of code but seems it will do the job. Thanks!
14:51jcromartieI so very much like the fact that I can run a web server by adding lein-ring and defining a single function, though
14:52jcromartieI can kill it with "lein ring server" too
14:52technomancyptcek: it relies on an (I think) undocumented feature of defmacro, the implicit &env argument
14:52technomancyneed to search the mailing list for how that works I think
14:52jcromartiesdegutis: 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:52jcromartiee.g. with an init scrit
14:52jcromartiescript
14:53sdegutisjcromartie: in production we will, but when developing we use sigint
14:53technomancywhy use an uberjar in dev though?
14:53sdegutiswe use `lein ring server-headless` in dev
14:53sdegutis`lein ring uberjar` for deploying to production
14:54technomancyhm... I guess that's a thing you can do
14:54technomancynot sure what the appeal is though
14:54jcromartietechnomancy: the appeal of a uberjar?
14:54technomancyjcromartie: no, the appeal of embedded nrepl during dev
14:54technomancyvs lein repl
14:55sdegutistechnomancy: oh no, i plan to just use lein repl locally
14:55jcromartieah yes
14:55sdegutisbut when you start the ubarjar, this happens.
14:55sdegutissorry, theres a lot of variables. its hard to remember which ones are affecting it
14:55jcromartiesdegutis: I'm not seeing it in any case
14:56jcromartiesdegutis: starting the nrepl server and a ring handler, connecting, and Ctrl-C kills it
14:59jcromartieI'm having some real revelations here though… I can use lein-ring and alter my handler var root!?
15:06sdegutisSteps: https://github.com/sdegutis/testcase
15:07sdegutisClone that repo and follow the steps to reproduce the bug.
15:07sdegutisHaven't figured out who's bug it is yet so I haven't filed an issue yet.
15:07sdegutisTrying it in nrepl.el now.
15:08sdegutisConfirmed: it does *not* happen with nrepl.el!
15:10sdegutisCould be REPLy, trying now.
15:13borkdudeIs this expected behavior? https://www.refheap.com/44271
15:13borkdudeI mean, the dynamic var is bound to the root var inside map?
15:13borkduderoot value
15:14borkdude*inside the function executed by map
15:15borkdudeargh probably lazyness again
15:16borkdudeyup, that's it
15:18jcromartiesdegutis: yeah it's definitely something about lein ring uberjar
15:20jcromartieBut I'm kinda warming up to lein ring
15:21akurilinNote 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:21grzmoften 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:22amalloygrzm: single-segment namespaces cause issues
15:23amalloyfoo/core.clj is a workaround; you should try to work around it "better", by using a meaningful two+ segment namespace like mylib.server
15:23sdegutisjcromartie: I don't think it is about lein ring ubarjar.
15:23sdegutisBecause the bug doesn't happen with an uberjar when I use nrepl.el to connect. Only when I use lein repl.
15:23sdegutisSo it's either lein repl, or reply.
15:24sdegutisTrying to use REPLy now to reproduce.
15:25grzmamalloy: so foo/bar.clj and foo/bar/baz.clj fine, just not foo.clj
15:25amalloyyes
15:25grzmgotcha.
15:26jcromartiesdegutis: but it doesn't happen with "lein ring server", which leads me to believe it's something with the generated main class
15:26amalloyand all this is under src/, of course
15:27grzmamalloy: 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:27sdegutisAha, it is REPLy. Just reproduced.
15:33sdegutisUpdated the repro repo.
15:53jcromartiehm
15:53jcromartienever mind
15:53jcromartie:P
16:08AeroNotixWhat sucks about clojure?
16:09technomancyAeroNotix: good question. I've collected a few things here: https://raw.github.com/technomancy/dotfiles/master/.gripes.org
16:09technomancycemerick also gave a talk on this a year or two ago
16:09AeroNotixtechnomancy: currently loading that talk!
16:09AeroNotix:)
16:09arcatan"nil is everywhere and causes bugs that are difficult to find the source" +1
16:10AeroNotixtechnomancy: this is such an amazing idea for a list, I will start one of these myself.
16:10technomancyAeroNotix: I got the idea from twb in #emacs, who is a world-class curmudgeon
16:10technomancyhttp://www.cyber.com.au/~twb/doc/grumbling.txt
16:10AeroNotix:)
16:11AeroNotixwait a sec, I know twb
16:11AeroNotixSmall world
16:11technomancy«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:12scape_haha
16:12hyPiRionI am not going to write such a list. I'll just be depressed over the whole software industry and change profession.
16:12technomancyhyPiRion: well, having a list that's actually comprehensive is kind of cathartic
16:12jcromartiehelp 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:13AeroNotixtechnomancy: 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:13AeroNotix"sroftware"*
16:13technomancyhehe; sounds useful
16:13jcromartieif 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:13jcromartiebecause I can say "I have a lot of gasoline"
16:14AeroNotixjcromartie: compute is a verb
16:14dkinzernice links
16:15hyPiRionjcromartie: "compute engine" is a command to an engine, same for "compute cloud"
16:15jcromartieAeroNotix: yes it is defined as a verb, but this is a new use
16:15hyPiRion,(recur) ;; compute clojurebot
16:15AeroNotixjcromartie: which use where?
16:15clojurebotExecution Timed Out
16:15hyPiRionIt just lacks a comma, and a period.
16:17AeroNotixtechnomancy: I'm a professional Erlang dev if you ever want to pick a fight
16:17AeroNotixReading through your points now
16:17technomancyAeroNotix: please show me how I'm wrong =)
16:17aperiodicjcromartie: english is weird, basically. english loves verbing nouns, but recently it's started nouning verbs (see "a ride", "a smoke", "a read")
16:17AeroNotixre: no automated tool for record upgrades. Records are just kind of like proplists with compiler magic.
16:18AeroNotixso there's no "type" at runtime which can allow you to properly introspect the records.
16:18jcromartieaperiodic: I guess I also see "bake shop" and I've heard "camp trip"
16:18technomancyAeroNotix: 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:18jcromartieI find that really unnatural
16:19AeroNotixtechnomancy: Kind of like a diff? Yeah, well in practice the idea is to just have versioned records if this is a problem.
16:19aperiodicjcromartie: those are both new on me. "camp trip" sounds very wrong; I would say "camping trip"
16:19AeroNotixtechnomancy: also R17 is bringing real maps, finally.
16:19AeroNotixalso, re: No way to enter a module. This is seriously a problem
16:19scape_jcromartie: that might be because people like to shorten things
16:19AeroNotix(from the repl)
16:19technomancyAeroNotix: yeah, working with anonymous funs only is tedious =\
16:20AeroNotixtechnomancy: also that's fixed in R17
16:20AeroNotix:)
16:20AeroNotixyou can now name funs in the shell
16:20technomancywhaaaaaat!
16:20AeroNotixseriously!
16:20technomancyoh
16:20technomancyyeah, ok
16:20technomancybut you still can't enter a module
16:20AeroNotixNo, no you can't.
16:20technomancythat's the real problem
16:20technomancyanonymous funs are just a symptom
16:20AeroNotixYeah, it really is. Many times I have to recompile a module with -compile(export_all).
16:20AeroNotixjust to get access to functions
16:21technomancyI really like how erlang maps have the notion of distinguishing between updating a field and adding one <3
16:21AeroNotix(in-ns 'whatever) is my goto tool for debugging broken stuffs
16:21technomancyand having no nil is *awesome*
16:21hyPiRiontechnomancy: yeah, they've been smart
16:21technomancyhyPiRion: still no update-in
16:21technomancyit'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:22AeroNotixdialyzer... 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:22technomancyAeroNotix: well I haven't actually got it to successfully run on our codebase yet =(
16:22technomancyour codebase causes it to go into an infinite loop
16:23AeroNotixWe have a very, very large Erlang code base and I've never seen it catch anything which unit tests wouldn't immediately catch.
16:23AeroNotixtechnomancy: really? Never seen that happen
16:23aperiodic/part/go dork
16:23AeroNotixtechnomancy: do you have a .plt already built?
16:23technomancyAeroNotix: yep, confirmed as a bug with the dializer maintainer
16:23AeroNotixsome people confuse building a plt with it getting caught in a loop, since it's a very lengthy process
16:23AeroNotixohhh ok, very interesting technomancy
16:23technomancyno, I let it run overnight =)
16:23AeroNotixOuch!
16:24AeroNotixtechnomancy: was it kostis?
16:24technomancyI think so
16:24technomancystill, I'd take "misses things" over "won't run on un-annotated code"
16:24AeroNotixtechnomancy: no, it genuinely misses things even on annotated. I'll try to find an example.
16:25AeroNotixHow does typed clojure compare to Dialyzer?
16:25hyPiRionAeroNotix: 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:25AeroNotixhyPiRion: this
16:25AeroNotixPropEr is seriously good stuff
16:25AeroNotixand the proper_statem? All over that
16:26hyPiRionhehe
16:26technomancyAeroNotix: typed clojure won't do anything without annotations iiuc
16:26AeroNotix_so_good_
16:26AeroNotixtechnomancy: without annotations or without GOOD annotations? Does it work on just the annotations or does it try to figure some additional stuff out?
16:26AeroNotixDialyzer does both (starting with annotations and doing some deduction on its own)
16:26technomancyAeroNotix: my understanding is it only does inference on locals
16:27technomancyno inference crossing defn boundaries
16:27AeroNotixHmm, I will have to check it out some time
16:27technomancywhich is why I haven't looked into it much
16:27technomancyapart from not doing a lot of clojure in general
16:27AeroNotixtechnomancy: seriously?
16:27AeroNotixI thought you were writing Clojure @ heroku
16:28technomancynot really; just a bit of lein maintenance here and there
16:28AeroNotixI and the rest of the (ex-rebar users!!) are very happy about lein
16:28xusertechnomancy: mostly java?
16:29AeroNotixLein is a million times better than rebar. It makes rebar look like Fischer Price my first dependency management tool
16:29technomancyxuser: haha, no. erlang.
16:29AeroNotixtechnomancy: erlang @ heroku????
16:29technomancythere is one small clojure codebase still in production, but I'm not even on that team any more
16:29technomancyAeroNotix: since the beginning
16:29AeroNotixtechnomancy: oh I didn't know that
16:29technomancyhttps://github.com/heroku/logplex and the HTTP router
16:29technomancy(but I don't work on the latter)
16:30AeroNotixtechnomancy: in fact I read that blog. What an incredible write up!
16:30AeroNotixI'm interested really in what you think moving from clojure->Erlang
16:30AeroNotixbecause Erlang->Clojure is like OMFG WOW
16:31AeroNotixtechnomancy: ^
16:31technomancyAeroNotix: https://news.ycombinator.com/item?id=7278018 <- short thoughts
16:32sdegutisI'm surprised to hear that Heroku is using mostly Erlang.
16:32AeroNotixErlang 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:32sdegutisI'd have guessed Ruby/Rails for front-end and Scala for back-end.
16:32AeroNotixsdegutis: seriously
16:32sdegutisNot that I think that's a good choice of tools, just that it seems to be pretty popular with large websites.
16:33sdegutisPersonally I think Ruby, Rails, and Scala are all gross.
16:33AeroNotixI guarantee what the company I work for is larger than what they're doing
16:33technomancysdegutis: "mostly"?
16:33AeroNotixand we're using primarily Erlang with a small part in Clojure
16:33technomancysdegutis: there are only 6 of us out of ~120
16:34sdegutistechnomancy: Oh then I misinterpreted that last thing.
16:34hyPiRionI though Heroku used a bit of Go
16:34technomancyhyPiRion: yeah =\
16:34hyPiRionWhich I know technomancy loves so dearly.
16:34xuserwhatsapp is a good example of using of erlang, is there anything they had use? I don't think so
16:34sdegutisOh but Go is great!
16:34sdegutisYou have first-class functions!
16:34xuser*better
16:34technomancystill a lot more erlang than go right now
16:34AeroNotixxuser: what was your question
16:35technomancyAeroNotix: pretty much full ack on your assessment ("bad FP language, but amazing for certain problems")
16:35xuserAeroNotix: if there is anything better whatsapp could have used
16:35AeroNotixtechnomancy: 10 4
16:35technomancyhttp://thisotplife.tumblr.com/post/66878750907/when-i-discovered-everything-is-traceable-in-erlang
16:35sdegutisAlso you have complete compile-time safety with Go!
16:35sdegutisAnd concurrency!
16:36sdegutisNot to mention a lack of inheritance, which is a good thing!
16:36AeroNotixxuser: well, not really. The goto use-case for Erlang is a distributed chat server.
16:36AeroNotixxuser: also, my friend works for them. It's just ejabberd really.
16:36AeroNotix(Obviously a bit more than that, but essentially.)
16:36hyPiRionsdegutis: you have inheritance actually
16:37AeroNotixhyPiRion: you have composition
16:37sdegutisNope, you have embedding.
16:37AeroNotixcomposition/embedding, same difference
16:37sdegutisI was responding to hyPiRion.
16:37technomancywe have a lot of fun on the erlang team making fun of google go at work
16:37sdegutis!!
16:37AeroNotixlol
16:37sdegutisWhat's there to make fn of?
16:37AeroNotixGo's a great replacement for Python, though
16:38AeroNotixequally shitty package management, equally shitty typesystem, but HEY no GIL
16:38xuserAeroNotix: how many languages do you know? ;)
16:38AeroNotixDunno
16:38AeroNotixWell?
16:38AeroNotixProbably 8 quite well
16:39sdegutisAeroNotix: Is C++ in that list?
16:39AeroNotixsdegutis: I don't think C++ is in anyone's "Know quite well" list
16:39sdegutisHint: don't answer, it's flamebait.
16:39sdegutis:)
16:39hyPiRion(inc AeroNotix)
16:39lazybot⇒ 2
16:40sdegutisGo is fine, what's wrong with it? It's pretty good for what it aims to do.
16:40sdegutisYou have a simple but powerful type system, a simple but powerful compiler toolchain, a simple but powerful syntax.
16:41sdegutisA simple but powerful standard library, a simple but powerful garbage collector.
16:41technomancythe type system might have qualified as powerful in the 70s
16:41hyPiRionthe GC is not powerful, trust me on that. I've had issues with it for quite some time =/
16:41sdegutisA simple but powerful concurrency model.
16:41xuserno generics
16:41sdegutisGo is very simple but powerful.
16:42sdegutisLet me be clear: I'm really just making fun of that empty and overused phrase "simple but powerful".
16:42xuserGo is a half implementation of Java but less verbose :D
16:42sdegutisEspecially when Go users use it. Or Rubyists or Python.
16:42sdegutisOr Clojurians!
16:42hyPiRionsdegutis: Only Clojurians know the definition of simple though.
16:42sdegutis(lol jk, clojurians are the best!)
16:43sdegutisxuser: and it starts up faster!
16:43amalloy&((promise)) is not a very useful error message at all
16:43lazybotjava.lang.AbstractMethodError
16:43sdegutisSee? Simple!
16:43sdegutis(but powerful, too)
16:44xusersdegutis: the small java programs I have write start up very faste, clojure on the hand...
16:44xuser*other
16:44sdegutisYes, Clojure isn't fast, but it's simple, yet powerful.
16:44aaelonyHi 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:44sdegutisI mean, it is fast, but it doesn't start up fast.
16:45xuseris the Clojure team working on startup time or are they waiting for Java 9?
16:45xuser(project jigsaw)
16:45sdegutisAh, yes, Java 9: simple, yet powerful.
16:45technomancyit'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:47jonhi thought it was more related to a company that has money to invest in it
16:48technomancyI don't think the size of the team changed drastically
16:48sdegutisNow what I want is a language where I can mutate the state of an object just by inspecting it: i.e. heisenstate.
16:48sdegutisThat would be epic.
16:48technomancysdegutis: but the state has to degrade over time oo
16:49technomancytoo
16:49technomancyentropy and all
16:49sdegutisImagine 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:49sdegutisThen 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:49sdegutisHow simple! How powerful!
16:50xusersuch wow
16:50technomancysdegutis: you need to use interrobang for those names
16:50technomancydestructive predicates
16:50delluminatussdegutis: sounds like something someone would have done at my workplace
16:50delluminatusand then never told anybody about the side effect
16:51sdegutisOh! 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:51sdegutisRuby: system.isUp!?
16:52technomancyoh come on, don't do it half-assed
16:52technomancyis-up‽
16:52sdegutis<<<<3333
16:52sdegutisOh yeah! Go allows UTF8 symbols in the source code, so that would be valid!
16:53sdegutisOh sorry, not symbols, "runes".
16:53sdegutisMan, Go is awesome.
16:53delluminatuswait
16:53turbofailit should just be system.is‽
16:54sdegutisturbofail: no, the system could be without being up.
16:54turbofailwell maybe it should have both then
16:54turbofailmaybe it can be up, without being
16:54delluminatusNow we're talking metaphysics. If the system sin't up, does it still exist as the same system?
16:54sdegutisLook, let's just all agree that Go is perfect for this job.
16:55sdegutisdelluminatus: Yes. It just doesn't work, that's all.
16:55sdegutisdelluminatus: And yes, we made sure it's plugged in and the power button is on.
16:55sdegutisIt says Windows ME on the bottom-right of the desktop, so I don't see why it's not working.
16:55delluminatusBut if you define a system as a complex interaction between processes
16:55sdegutisOH MAN THIS IS TOO FN I HAVE TO LEAVE OR ILL NEVER GET WORK DONE
16:55delluminatusand the processes aren't running anymore
16:56sdegutiss/fun/fn/
16:57sdegutisdelluminatus: is a refrigerator still a refrigerator when you break the cooling pipe thing?
16:57delluminatusIt's like, if a server's http daemon is down, is it still a web server?
16:57sdegutisShort answer: no. Long answer: yes.
16:57delluminatusBut you wouldn't call a refridgerator a system, it's an object
16:57delluminatusif you are referring to the refrigeration system inside the refrigerator, that's a different story
16:58antithesisHow can Clojure code run slower than Java code when they're both compiled to Java bytecode?
16:58delluminatusits like with the human brain, what matters is the pattern and the interaction, not the physical material
16:58amalloyantithesis: i mean...you can compile all sorts of really slow code to java bytecode
16:58sdegutisOkay hold on now, let's not get too close to legitimate discussions.
16:59technomancyantithesis: how can slow java programs run more slowly than fast java programs?
16:59technomancythey're both compiled to Java bytecode
16:59amalloywhy is ((fn [x] x) 1) faster than ((fn [x] (recur x)))?
16:59antithesiskthx
16:59sdegutisOh no, dangit, I went offtopic again. I forgot this was #clojure and not #clojure-social.
16:59sdegutisSorry yall.
17:00sdegutisamalloy: they're the same speed.
17:01sdegutisOh no wait, the latter is slower.
17:01certainty-.^
17:01`szxhas anyone tried using something like github.com/weavejester/reagi for RFP/elm style game programming?
17:02`szxFRP, sorry
17:10TravisDGive 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:11TravisDGiven*
17:11hyPiRionTravisD: well, you have cache, memory and I/O destroying that fun for you. You could probably calculate an estimate though
17:11TravisDAh, yeah. And generally would you expect it to be an underestimate or an overestimate?
17:12TravisDah, obviously an overestimate
17:14hyPiRionIt depends on the program (surprise!)
17:14hyPiRionI'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:14TravisDAh, really? It seems like all the things you mentioned would only increase the running time
17:15hyPiRionTravisD: Oh, I mean you take a sample of the total run time, and extrapolate based on that
17:16liflashhi 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:16hyPiRionI'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:17liflashI added the folder to the :source-paths in my project.clj, but it doesn't seem to be recognized
17:17TravisDhyPiRion: 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:17TravisDLike, some places where his code reports 80 operations, mine is using 9
17:17TravisD(same code, different computer, different version of clojure)
17:20TravisDanyways, 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:20hyPiRionTravisD: Well, that's benchmarking 1.2. I'm fairly certain a lot of optimisations has been done related to primitives since then
17:21TravisDhyPiRion: Yeah, that's great :)
17:21TravisDvery exciting
17:22hyPiRionyeah, love it
17:24liflashcan someone give a hint, why the :source-paths config in the project.clj isn't recognized?
17:27hyPiRionliflash: first off, what do you mean by "loaded on repl startup"?
17:29liflashhyPiRion: I want to be able to call functions declared in files that are in another folder than src
17:30hyPiRionright, and (require '[my.namespace.name :as n]) doesn't work in the repl?
17:31liflashhmmm, ok, that works
17:32liflashbut why can't i use (tool/some-function) like with everything else within src
17:33liflash(where tool is ns within the dev folder)
17:35TravisDWill Lieningen share copies of dependencies so that they don't need to be downloaded for every project? (Assuming versions match and everything)
17:35hyPiRionI'm guessing it's because the namespaces are lazily loaded, i.e. not loaded unless required.
17:35hyPiRionTravisD: yes, shares them with
17:36hyPiRion*shares them with maven
17:36TravisDCool, I don't know much about maven
17:36S11001001TravisD: don't worry about it
17:36hyPiRionyeah, what S11001001 said
17:37TravisDAh, 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:37hyPiRionEssentially, all dependencies are just stored in a directory (usually ~/.m2) and if not found at a specific path there, they are downloaded
17:39liflashhmmmm, 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:39liflashI expected my own files and ns to work in the same way in the repl
17:39liflashi'm not exactly sure, but i don't think project.repl is required somewhere
17:41liflasheither
17:44liflashor 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:47hyPiRionWish I knew enough about it to help you, but unfortunately I don't.
17:48liflash:-/ too bad
17:48liflashthanks anyway
18:00michaniskinis there a handy example of an immutant+jenkins setup for a ring app?
18:14dsrxI 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:14gtrakis 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:14gtrakI guess reflection may work in the other cases.
18:15qbgI don't think that's going to be easy
18:16gtrakI'd really like file/line info out the other end :-)
18:16gtrakmaybe tools.analyzer is the way to do it.
18:21stuartsierraJVM reflection can't tell you all the subclasses of a class or interface. It's an open set.
18:36bbloomdnolen_: worlds, huh?
18:40bbloomdnolen_: 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:41bbloomdnolen_: although the general idea of a mutable map w/ snapshotting makes sense to me
18:57yeoj___how come i can't pass a even number of bindings into a let form? such as (let [two-forms] () )
18:58amalloyyeoj___: that's only one form
18:59amalloy(ie, not an even number)
18:59gtrakyeoj___: if you're making a macro, you might want to do unquote-splicing
18:59yeoj___amalloy: but two-forms is defined as something like this: (def two-forms [blah "blah?"))
19:00yeoj___it's not really a macro, i'm trying to read parts of a text file (configuration) into a let
19:00gtrakwhy?
19:00clojurebothttp://clojure.org/rationale
19:01gtrakXY?
19:01yeoj___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:01yeoj___it's all a trusted source (from me, command line program)
19:01gtraksounds like a hashmap
19:02gtrakor you can write an interpreter
19:02yeoj___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`cbpxy?
19:03clojurebotxy is http://mywiki.wooledge.org/XyProblem
19:03gtrakI made a little toy interpreter here: https://github.com/gtrak/webbedfeet/blob/master/src/com/garytrakhman/webbedfeet.clj#L79
19:05gtrakif 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:05gtrakyou want to store a value in something, and you want to be able to reference that value
19:05gtraksounds like something a hash-map and a key can handle
19:09yeoj___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:10yeoj___i don't see how source-sql can take values from source-base-name and table-name without being eval'd somehow
19:10gtrakyou can just use a function for that
19:10yeoj___(i.e. hashmap)
19:10gtrak(fn [table-name source-base-name source-sql] ..)
19:11gtraknot sure I see what's the complicated part.
19:11gtrakwhat's in config.config?
19:12gtrakah, nm
19:12`cbpyeoj___: if you really need a config file and you control it, you should probably turn it into edn
19:12gtrakyea, don't make your own config format.
19:12yeoj___`cbp: ok i'll look at that. i was trying to use literal sexp's
19:12gtrakwhy do you need to str it?
19:13yeoj___it's more than that... the config file has multiple things
19:13yeoj___it could even potentially have source->target transformations
19:13gtrakI see, so you're treating it like a massive let binding
19:14yeoj___gtrak: yeah, i was trying to
19:14yeoj___gtrak: maybe not seeing the Y
19:14yeoj___i think i need to read up on edn and potentially how folks make dsl's
19:14gtrakif you want to keep the format like it is.. then you can parse out symbols and replace them
19:14TravisDI'm really enjoying reading the examples of the XY problem, lol
19:15gtrakbasically create a 'let interpreter'
19:15`cbpyeoj___: it might be more sane to just include in your config file the let and have the let return a map
19:15gtrakI would avoid calling eval
19:15`cbpyeoj___: and probably just wrap it all in a function and make it an actualy clojure file :-)
19:16yeoj___yeah, thats fine if it's a clojure file i guess, i could load-file at runtime?
19:16`cbpyeoj___: edn doesnt let you have anything other than constants
19:16`cbpyeoj___: I mean if it's in your classpath you can just require it
19:17gtrakyou could implement your own eval that uses a hash-map as the environment, just use apply for stuff.
19:17gtrakprobably overkill :-)
19:17yeoj___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:17yeoj___thats the functionality i'm looking for i think (y problem?)
19:18gtrakif you limit what you can do in your format, then your life is easier.
19:18gtrakfor instance, hadoop uses a configuration format that expands placeholders
19:18gtrakthat would handle the str case
19:19gtrakwithout having to parse sexps
19:20yeoj___gtrak: ok. i'll think about that.
19:20gtraklike: hadoop.tmp.dir = /tmp/hadoop-${user.name}
19:20gtrakwhere user.name is another property
19:20yeoj___yeah
19:21yeoj___would let* let me combine one let into another? like list*?
19:21gtrakno
19:22gtrakyou could use a macro, but it's probably a bad idea.
19:22yeoj___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:22gtrak`(let [~@(read (slurp "config.config))] ...)
19:23gtrakthough read probably won't work either
19:23`cbpread-string
19:23gtrakright, I think read-string might also not work
19:23gtrakunless you wrap the string in a vector or something
19:24yeoj___i haven't gotten either to work yet, tried both but i have just read the docs and not used frequently
19:24yeoj___string cannot be cast to pushbackreader
19:24`cbpyeoj___: read-string
19:24`cbpinstead of read
19:24gtrakit's just kind of a bad idea, it's just as powerful as code, but not fully code.
19:25gtrakwhy not just code.
19:25`cbpyeoj___: you would also need to wrap your config file in a vector
19:25yeoj___well, i didn't really want to have lein on this server, and wanted to just have a jar
19:25gtraksaves you an indent, (let [ and a ])
19:26gtrakyeoj___: lein has nothing to do with it
19:26gtrakcan dynamically load a file or a classpath-resource in any jvm environment.
19:26yeoj___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`cbpload-file doesn't need it on the classpath
19:27yeoj___it would save me from all the typo's of having "table-name" 15 places throughout the config file, etc.
19:27`cbpthat would be the simplest and the most dangerous :-D
19:28`cbpor easiest rather than simplest
19:28yeoj___i'm not too worried about dangerous, i simply am going to use this program only this weekend
19:28yeoj___to move 500+ tables from MSSQL -> another database type
19:28yeoj___then it's a throw away
19:28gtrakthen.. it doesn't even matter. :-) use a clj file.
19:29yeoj___ok. i'll call it "config.clj". done.
19:29yeoj___thanks everyone.
19:29`cbpfarewell
19:29gtraklol
20:09TravisDCan qualified symbols access anything on my class path? If so, what is the purpose of require?
20:10alandipertTravisD, finding and compiling .clj sources
20:10amalloyTravisD: qualified symbols can only refer to vars that have been loaded; require loads files
20:10TravisDAh, that makes sense
20:11TravisDI guess clojure.string is loaded by default?
20:11amalloyyes
20:11amalloyclojure.core, clojure.string, clojure.set, and i think one other
20:11TravisDaha - I guess that was a bad choice to experiment with
20:11amalloyrequire also allows you to use shorthand qualified symbols
20:12amalloy(require '[clojure.string :as s]) (s/join " " [1 2 3])
20:12TravisDah, yeah
20:12TravisDI was mostly wondering about why you needed to load things, since it didn't look like clojure.string needed to be loaded
20:13amalloyhuh. when i `lein uberjar`, a number of classes with names like null$fn__3133.class are generated
20:14amalloydoes 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:14TravisDActually, http://java.ociweb.com/mark/clojure/article.html#Namespaces should probably not use clojure.string as the example there
20:14TravisDsince it is loaded by default
20:14hiredmanamalloy: *ns* is nil for some reason
20:15hiredmanwhich, I dunno, might happen if you a pop-thread-bindings at the top level
20:16hiredmanhave and extra
20:16hiredmanan
20:23TravisDIs there a mapping from file names to namespaces?
20:25TravisDLike, 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:25alandipertTravisD, basically, and dashes are underscores
20:26TravisDah okay. So is it important that the namespace used in a file match the files location?
20:26TravisDfile's*
20:26dsrxaghhh.... 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:26dsrx:C
20:26alandipertTravisD, for require to work, yes
20:27TravisDalandipert: cool, thanks
20:27alandipertTravisD, np
20:38dnolen_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:41mlb-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:42qbgmlb-: are there resources to be closed?
20:43qbgdnolen_: Sweet!
20:44mlb-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:44qbgCheck out with-open
20:45dnolen_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:45dnolen_https://github.com/swannodette/worlds/blob/master/src/worlds/core.cljs
20:45dnolen_so you can do VPRI like worlds stuff
20:47mlb-qbg: ah, cool. I was referring to cases with more open ended/general initialization/cleanup code.
20:47qbgIn the more general case, a macro may be best
20:49alandipertmlb-, 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:54qbgFor 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:57mlb-alandipert: Hmm, interesting, I'll look into that
20:57clojurebotIt's greek to me.
21:14TravisDDoes clojure have a built in not equal operator?
21:14gfredericks,not=
21:14clojurebot#<core$not_EQ_ clojure.core$not_EQ_@57c24c>
21:14TravisDAh, thanks
21:23Guest66083Does 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:24Guest66083before I roll my own... It's basically like PHPmyAdmin. anyone ported that?
21:46ruzuno idea.. but any time i see the letters "p", "h" and "p" in sequence i am filled with uncrollable hulk-like rage
21:46ruzus/uncr/uncontr
22:11tlewisHi all. Started learning Clojure recently and had a question about doseq if anyone has a minute.
22:11dsrxdon't ask to ask, just ask
22:12tlewisBasically, I am writing to a file, and I need to make a specific write on the last iteration, as it were.
22:15pbostromtlewis: you can run your doseq on (butlast seq), and then run (last seq) to do your special write
22:24tlewisSo something like (doseq [running (butlast seq)] (spit file-name running) (spit file-name (last seq)) ?
22:28pbostromyes, 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:40charedoes anyone have a pdf copy of this book: https://leanpub.com/fp-oo
22:42tlewisI 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:42tlewisI am parsing xml and generating a file from the xml
22:43bob2are you sure you don't want to use an xml generator thing
22:43bob2chare, it's on that site, for $15
22:44tlewisIt is quite possible I do. I have only been doing Clojure for about a week.
22:44tlewisI am currently using clojure.xml
22:44bob2what's the 'special EOF'?
22:45tlewisI am parsing xml and generating Objective-C code, so I need "@end" at the end of each file.
22:46bob2ah
22:46charejoin #dynamo
22:46chareignore that
22:47pbostromtlewis: 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:49pbostromtlewis: you also may want to consider building up the entire file as a string and then writing it once
22:49tlewisI didn't think if building it as a string, that might be the better way.
23:04charenobody has the book "Functional Programming for the Object-Oriented Programmer"?
23:06amalloybrian marick probably has a copy
23:06chareamalloy you think you're funny?
23:06amalloybut that's not the question you're asking: you're asking "will someone give me a free pdf copy of this book?"
23:06chareyes that is true
23:07amalloyi surely hope nobody does, and i doubt they will
23:07chareok just let me borrow the book then
23:08bob2chare, please buy it or be quiet
23:17pmonksGood evening gurus!
23:18pmonksAm I right to assume the following behaviour is a leaky abstraction from Java:
23:18ruzuclojurus?
23:18pmonks;-)
23:18pmonks'(= #"foo" #"foo")
23:18pmonksdoh - how do I trigger clojurebot?
23:18qbg,(= #"foo" #"foo")
23:18clojurebotfalse
23:18pmonksty
23:19pmonksI assume that result is a Javaism inherited from Pattern or wotnot?
23:19pmonks*Pattern.equals
23:19pmonks(or rather lack thereof)
23:19Cr8pmonks: you can check
23:19Cr8,(.equals #"foo" #"foo")
23:19clojurebotfalse
23:20pmonksYeah I'm pretty certain that's the explanation, but being a n00b wanted to verify.
23:20pmonksDidn't think to call native .equals though - thanks for the reminder! ;-)
23:20Cr8pmonks: Object has a .equals, so anything that doesn't define its own will have that one
23:21Cr8which will just be object identity
23:21pmonksYep, which only checks precise object equality (i.e. ==)
23:21Cr8,(let [foo-re #"foo"] [(.equals foo-re foo-re) (= foo-re foo-re)])
23:21clojurebot[true true]
23:21pmonksDoesn't look like java.util.regex.Pattern overrides the default… ;-(
23:21Cr8indeed it does not
23:21pmonks#sadpanda
23:21Cr8you can str them
23:22Cr8,(str #"foo")
23:22clojurebot"foo"
23:22Cr8,(= (str #"foo") (str #"foo"))
23:22clojurebottrue
23:22pmonksYeah that's my workaround.
23:22pmonks(str #"\s([Ss]omething [cC]omplicated)")
23:22Cr8or maybe .pattern is more correct, i expect they're the same though
23:22pmonks,(str #"\s([Ss]omething [cC]omplicated)")
23:23clojurebot"\\s([Ss]omething [cC]omplicated)"
23:23Cr8,(.pattern #"\s([Ss]omething [cC]omplicated)")
23:23clojurebot"\\s([Ss]omething [cC]omplicated)"
23:23Cr8yep
23:24dsrxnow make it check that the regexes are equivalent even if their strings aren't equal
23:27TravisDis there a non-nested version of update-in?
23:29pmonks@dsrx :-D
23:31pmonksMind blown: http://stackoverflow.com/questions/8961632/how-should-one-proceed-to-prove-or-find-if-two-regular-expressions-are-same-or
23:32dsrxthat only works with truly regular expressions, not some (useful) abomination like PCRE
23:32pbostromTravisD: just specify a single key
23:33TravisDpbostrom: 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:34dsrxpmonks: _understanding computation_ by tom stuart is a great book if you want to learn more about that kind of thing
23:34pbostromTravisD: yeah, there's no update for some reason
23:35TravisDHm, there's probably a good reason
23:48ambrosebsthis ticket has a patch to support (update-in m [] f) as being equiv to update
23:48ambrosebshttp://dev.clojure.org/jira/browse/CLJ-373
23:51TravisDambrosebs: That seems to be discussing a different issue ,no?
23:51TravisDsome inconsistency in the behaviour of get-in and update-in
23:52TravisDWe'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:53TravisDer, (defn update ...)
23:56charelets talk about cool stuff
23:57ambrosebsTravisD: ah yes
23:58nido`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:59TravisDnido`: I installed cider using packege.el. Worked like a charm!
23:59nido`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:59TravisDnido`: Are you on Mac OS?
23:59nido`I've also been unable to get it to connect to the lein repl