#clojure logs

2016-05-13

00:36unverifiedhello
01:20irctcHi I am very new to clojure. Just started learning it. Can anyone help me with a question?
03:20ilevdWhat is the easiest way to insert file to bytea field in postgresql?
03:26dysfunwhat libraries are you using?
03:31ilevdhoneysql
03:31dysfunoh, that does nothing for you in the way of conversion
03:31dysfuni suspect you'll have to create a PGobject. manually
03:32ilevdMaybe it will appear in mpg?
03:33dysfunhaha, i just filed a ticket for it
03:33ilevd:)
03:34dysfunmy proposal is to map it to ByteBuffer
03:34dysfunbut we'll probably also accept a Reader or a File as input
03:34ilevdCool :)
03:36dysfunif you look at the mpg code to see how we create the PGobject for json, you can probably do something similar for bytea
03:43ilevdHeh, I'm thinking to use something low-level like here https://github.com/krisajenkins/yesql/issues/122
03:46dysfunhttps://github.com/mpg-project/mpg/issues/16 # added a link to that
03:46dysfunany other obscure data types that aren't supported that you have in your database while we're at it? :)
03:48ilevdIt seems that's all :)
03:50dysfunoh good. i'm getting terribly bored of debugging why my jdbc code doesn't work
05:33jonathanjis there something like constantly but instead of giving it a value you give it a function and some args?
05:33dysfunpartial ?
05:34jonathanjpartial isn't quite the same
05:34jonathanjconstantly takes any arguments but disregards them
05:34dysfunwhy can't you use constantly?
05:34jonathanjbecause i don't want to call the function
05:34jonathanjnot right away, anyway
05:35jonathanj(fn [f & args] (fn [& _] (apply f args))) is what i want, i think, but i'm actually looking for a name, not an implementation
05:36dysfuni don't know of anything but i've written similar often
05:45ridcully,(doc repeatedly)
05:45clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
05:49bikeshedr_haha, I created a lazy-seq and forgot to wrap it's relevant content in [], wondering why I always received and emtpy seq
05:49bikeshedr_so easy to miss
05:51bikeshedr_err, I mean I forgot to cons, less easy to miss, obviously I'm confused
05:55jonathanjridcully: ah, the 1-arity version of repeatedly is probably what i want?
05:55jonathanj(repeatedly (partial f a r g s))
05:55jonathanji missed that
09:37bikeshedr_I need a pointer how to approach a problem. I want to build a tree from chess moves (just tell me if that's a stupid idea), and I want to add games to that tree by updating the path taken, say moves are [:e5 :d4] that would be {:e5 {:d4 {} :n 1} :n 1}, increasing :n each time a node was visited. Now update-in easily blows the stack that way for whole games, is there a way to build a map lazily? I've looked at walk, tree-seq, but no luck,
09:37bikeshedr_and I'm not sure if lazy-seq is the right tool
09:39kwladykaDo you know emacs https://github.com/bbatsov/projectile C-c p t (Toggle between an implementation file and its test file.) works? Or only for me it doesn't work?
09:39kwladykain Clojure project
09:47circ-user-0vXzkHi.
09:47circ-user-0vXzkI'm searching for a stepper for clojure
09:48mgaarekwladyka: I believe that relies on a specific naming convention. eg, some.ns should have a corresponding test ns, some.ns-test
09:48kwladykamgaare i am doing this with convenction
09:48kwladykamgaare is it work for you?
09:49mgaarecirc-user-0vXzk: cider's debugger can do stepping - http://cider.readthedocs.io/en/latest/debugging/
09:49mgaarekwladyka: yea
09:50circ-user-0vXzkthnks mgaare!
09:52mgaarekwladyka: it is working for me. I have clojure-mode 20160430.1414, projectile 20160420.1508
09:53mgaarenot sure what other emacs deps would be involved
13:18kwladykacan you share with me your emacs config? Especially part about Clojure?
13:19kwladykado you use clojure-mode-extra-font-locking ?
13:32LewixI need a green light to do a copy paste ? I typed in the wrong channel
14:16edwHey folks, if any of you are also schemers, you may be interested in something I'm working on: https://www.refheap.com/119050
14:18edwIt's a set of Scheme R5RS syntax extensions that push Scheme toward Clojure in terms of concision.
14:18justin_smithawesome
14:20justin_smithedw: how hard would it be to get vector, hash-map, set literals too - or is that already a thing?
14:20amalloywhat about rackjure? that already had some cool stuff
14:20edwjustin_smith: Step one is pushing Scheme as hard as possible toward Clojure without worrying about modifying the reader.
14:22edwamalloy: This is R5RS, so it should work with nearly any Scheme. Each Scheme implementastion is, umm, sufficiently opinionated that an early step of any Scheme-based project is to find the implementation that's working against you least hard.
14:23edwBut I'll check out Rackjure.
14:25edwReading through the Rackjure docs, I realized that I forgot the threading macros. I've written them in Scheme a few times before, they've gotta be around here somewhere.
14:27edwI implemented `for` (as `fir`) fully; the resulting `syntax-case` forms became effectively write-only.
15:15Lewixjustin_smith: is it lazy like the original map https://www.refheap.com/119052
15:15justin_smithLewix: is what lazy?
15:15Lewixjustin_smith: my map
15:15amalloyLewix: why don't you try it on a large sequence and see
15:15justin_smithoh, no, that is not lazy
15:15edw`FYI: I put my Clojurish Scheme stuff in <schemehttps://github.com/edw/skim&gt;.
15:16Lewixjustin_smith: sorry wrong link
15:18sdegutisHello. I'd like this feature please:
15:18sdegutis:chop myapp
15:18Lewix(doc lazy?)
15:18sdegutis(:require [myapp.model.user :chop myapp])
15:18Lewix,(doc lazy?)
15:18Lewix,(apropos lazy?)
15:18clojureboteval service is offline
15:18clojureboteval service is offline
15:19clojureboteval service is offline
15:19justin_smithLewix: there is exactly one lazy type
15:19sdegutisThat would be the same as creating an alias, which uses :as with the fircken thing
15:19sdegutisWhat's a good strong non-sweet alcohol? Scotch?
15:19sdegutisBourbon? Whisky?
15:19sdegutisSo, (:require [myapp.model.user :chop myapp]) would be the same as (;require [myapp.model.user :as model.user])
15:19Lewixjustin_smith: https://www.refheap.com/119053
15:20justin_smithwait, that's not true
15:20sdegutisPlease advice, is this a bad idea?
15:20justin_smithbad
15:20sdegutisWhy
15:20justin_smithLewix: you cannot construct a lazy-seq via recur like that
15:21justin_smithLewix: a lazy function should return a form (usually recursive, never using recur) wrapped in a call to lazy-seq
15:22justin_smithsdegutis: because I want to see the string model.user in your require block in order to know what model.user is, and the :chop obscures it
15:24LewixI see. thanks
15:27sdegutisjustin_smith: well often I find myself trying to type the namespace with my appname not there.
15:27sdegutisLately I've been doing [mywebsite.model.user :as user.model] but then I find myself typeing "model.user/" and waiting for autocompletion menu to pop up.
15:27sdegutisBut it never does, because it's not aliases as model.user, but user.model, which sounded cool at first but feels backwards now.
15:28sdegutisSo as a shortcut I want to just chop off "mywebsite."
15:28sdegutisThat's my feature equest.
15:29sdegutisSo it sounds like Scotch is usually sweeter than Whisky, which is often more oaky.
15:29amalloyclojure should have more feature bequests
15:30sdegutisamalloy: what is bequest tho
15:56ystaelsdegutis: I'm partial to rye, which is more fiery than bourbon-sweet
15:56sdegutisystael: hmm
15:56ystaelI have coworkers who prefer scotch that would be best described not as 'sweet' but as 'diesel exhaust'
15:57dysfunah, caol ila
15:59sdegutisthis website im looking at says "Rye tastes like: A spicy, grainy, hard-edged version of bourbon. Like bourbon's maverick younger brother.
15:59sdegutisand that "Scotch tastes like: Rubber, wood, fire, dirt, and leather -- but in a good way. A great way, actually."
15:59sdegutisystael: would you say so?
15:59justin_smithI keep vodka on my desk at work
15:59dysfunscotch has an enormous range of flavours
15:59ystaelsdegutis: there is very great variation, especially in scotch
15:59sdegutisTIL
16:00ystaelthere is scotch nearly indistinguishable from bourbon, and scotch nearly indistinguishable from a dumpster fire
16:00sdegutisalso: "Tennessee whiskey tastes like: Bourbon, if we're being honest"
16:00dysfunmy first scotch experience was with some godawful stuff called 'high commissioner'
16:00dysfuni thought i didn't like whisky
16:01justin_smithsometimes whisky tastes like somebody put artificially flavored "banana" candy in it
16:01dysfununtil i made a friend who was a scotch fan and learned it didn't all taste like shit
16:01sdegutisim just looking for something very strong and not sweet
16:01sdegutisgood flavor is a bonus
16:01justin_smithsdegutis: vodka!
16:01dysfunjustin_smith: i'm quite fond of angostura 1919 rum in patisserie - it's got loads of banana flavour
16:01sdegutishmm well not disgusting flavor is a requiremnt
16:02dysfungin
16:02justin_smithsdegutis: all vodka has (if done properly) is alcohol and water, the other stuff has been removed
16:02ystaelsdegutis: there is also a wide variety of vile mediciney herbals
16:02ystaelamari, chartreuse, fernet, etc
16:02ystael(i like those quite a bit, actually)
16:02dysfuni'm quite fond of absinthe (but only the good stuff)
16:02dysfunchartreuse i remember drinking at a conference with a mad chartreuse fan
16:03justin_smiththe hipsters here like fernet
16:03dysfun(he brought two bottles to share with strangers)
16:03dysfunvodka is pretty good mixed
16:03ystaelvodka is a good thing to make into fruit infusions
16:03dysfunyou can get totally wrecked on screwdrivers or harvey wallbangers
16:04dysfunand white russians are ace
16:04dysfun...and this is why i don't keep spirits in the flat.
16:04justin_smithdysfun: I'm a barbarian and I drink vodka neat, I consider it a concession that I don't pour it down my throat out of the bottle
16:05dysfunjustin_smith: i remember drinking latvian 'black balsam' neat. god that stuff'll put hairs on your chest
16:05dysfunand for a while i lived near this amazing polish restaurant. i became good friends with the owner and we used to have a lot of flavoured vodka
16:06dysfunalso meat. because what kind of polish restaurant isn't a celebration of meat?
16:07dysfunwhat's the most awful neat spirit you've ever tried?
16:07kwladykacan you share with me your emacs config? Especially part about Clojure?
16:07ystaeldysfun: toss-up, either Maotai (baijiu) or Jeppson's Malört (wormwood bitter)
16:07dysfunnever even heard of those!
16:08ystaelJeppson's Malört is apparently only available in and around Chicago, and tastes like crushed ibuprofen tablets dissolved in nail polish remover
16:09dysfuni nominate ouzo and jenever
16:09ystaelBaijiu, like scotch, comes in a huge variety of tastes, but Maotai is the only one I've tried, and it tastes like stinky tofu (chou doufu) and sweat socks in hexane
16:10dysfunwhere's it from?
16:10ystaelChina
16:10dysfuni've had some bizarre stuff
16:10dysfuni became quite fond of this finnish stuff called tervasnapsi made of pine tar
16:10ystaeli would try that, that sounds like it might be pretty good
16:11dysfunif you're ever in finland, i can recommend it
16:11dysfuni brought some back
16:11dysfunit needs to be almost frozen to be drinkable though :)
16:12dysfunthey do lots of things flavoured with cloudberries too
16:13ystaelsalmiakki koskenkorva is on my "vile drinks from finland" bucket list
16:13dysfunoh, i had some really awful sake once. i used to have a taste for it
16:13dysfunhaha, we called it 'salamari' which means 'tentacle'
16:13dysfunoh god i'm remembering
16:14dysfunthere's also 'fisu', which is the same construction but with fishermans friends
16:14dysfun(instead of the salmiakki)
16:14dysfunmy favourite finnish drink is hartwall lonkero
16:15ystaelis that ... gin and grapefruit soda ... in a _can_?
16:15dysfunyes it is. and it's way more delicious than it sounds
16:16TimMcystael: I just had some chocolate with anise and wormwood.
16:16TimMchttp://endorfinfoods.com/collections/dark-mylk-chocolate-bars/products/absinthe-chocolate-bar
16:16ystaelTimMc: did it taste like sad Christmas?
16:16TimMcNo, it's actually very good. There's just enough wormwood for flavor, it's not bitter.
16:16dysfuntrippy christmas
16:16TimMcnot enough wormwood for that, either :-P
16:17dysfunhaha. you know it was the french wine industry who perpetuated the myth that wormwood was neurotoxic?
16:19TimMchaha
16:23justin_smithdrinking culture is almost as weird as food culture, with blindfolds on people can't even tell the difference between red and white wines
16:23dysfunonly people with no palate at all
16:24dysfuni detest most white wine, but i'm quite fond of red
16:24justin_smithdysfun: this study was on wine experts
16:25dysfunthat's such a ridiculous claim
16:25justin_smithdysfun: it's a documented study, you're welcome to try and falsify it
16:25dysfunlink?
16:26amalloylet's just falsify it by fiat
16:26justin_smithlooking for the real paper, here's a new yorker article http://www.newyorker.com/magazine/2002/08/19/the-red-and-the-white
16:26dysfuni am not at all a wine expert or a wine snob, but smells like bullshit
16:27opqdonutdysfun: but you never drink wine blind do you?
16:27TimMcseems you should be able to taste the redness
16:27TimMcbut I don't drink so... :-)
16:27justin_smithdrinking *until* wine is much more popular
16:27opqdonutseems, yes, that's why the study is so interesting
16:27justin_smithuntil blind, dammit
16:29opqdonutand non-blindness is an essential part of food/drink
16:29dysfunseriously, white wine and red wine are so different in flavour and it's got sod all to do with the colour
16:30opqdonutit's not just the tastes, it's the history, the culture, the discussion
16:30dysfunred wine in rich in tannins, which make the tongue feel funny
16:31TimMcopqdonut: Like how going fishing isn't about hunting aquatic creatures.
16:31opqdonutindeed
17:17sdegutisok im back
17:17sdegutiswhat did i miss?
17:18sdegutisjustin_smith: that sounds really disgusting
20:55sdegutisSo, turns out that Jameson Irish Whisky is pretty good.
20:55sdegutisSmells and tastes nice and creamy without being too sweet.
21:00ridcullythe next best thing for an irish coffee
21:27amalloy,(rand-nth ())
21:27clojurebot#error {\n :cause nil\n :via\n [{:type java.lang.IndexOutOfBoundsException\n :message nil\n :at [clojure.lang.RT nthFrom "RT.java" 885]}]\n :trace\n [[clojure.lang.RT nthFrom "RT.java" 885]\n [clojure.lang.RT nth "RT.java" 854]\n [clojure.core$rand_nth invokeStatic "core.clj" 6952]\n [clojure.core$rand_nth invoke "core.clj" 6945]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandb...
21:27amalloysurprises me given how (first ()) and such things behave
22:02sdegutis,(first ())
22:02clojurebotnil
22:02sdegutis,((juxt first rest next) ())
22:02clojurebot[nil () nil]
22:13sdegutis,(map (juxt first rest next) [() [] #{} {} nil])
22:13clojurebot([nil () nil] [nil () nil] [nil () nil] [nil () nil] [nil () nil])
22:13sdegutis,(mapv (juxt first rest next) [() [] #{} {} nil])
22:13clojurebot[[nil () nil] [nil () nil] [nil () nil] [nil () nil] [nil () nil]]
22:13TEttingernice.
22:14TEttingerconsistency.
22:14sdegutis,(apply = (mapv (juxt first rest next) [() [] #{} {} nil]))
22:14clojurebottrue
22:14sdegutis,(apply = (map (juxt first rest next) [() [] #{} {} nil]))
22:14clojurebottrue
22:15sdegutis,(true? (apply = (map (juxt first rest next) [() [] #{} {} nil])))
22:15clojurebottrue
22:15TEttinger,(mapv #(into % [Double/NaN Double/NaN] [Double/NaN Double/NaN]) [() [] #{} {} nil])
22:15clojurebot#error {\n :cause "Key must be integer"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Key must be integer"\n :at [clojure.lang.APersistentVector invoke "APersistentVector.java" 292]}]\n :trace\n [[clojure.lang.APersistentVector invoke "APersistentVector.java" 292]\n [clojure.core$transduce invokeStatic "core.clj" 6598]\n [clojure.core$into invokeStatic "core.clj" 6614]\n [...
22:16TEttingeraw
22:16TEttinger,(into [] Double/NaN)
22:16clojurebot#error {\n :cause "Don't know how to create ISeq from: java.lang.Double"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Double"\n :at [clojure.lang.RT seqFrom "RT.java" 542]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 542]\n [clojure.lang.RT seq "RT.java" 523]\n [clojure.core$seq__4357 invokeStatic "core.clj" 137]\n [clojur...
22:16sdegutis,(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3))
22:16clojurebot(true true true)
22:16TEttingerhuh
22:16sdegutis,(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3) (apply =))
22:16clojurebottrue
22:16TEttinger,(into [] [Double/NaN])
22:16clojurebot[NaN]
22:16sdegutis,(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3) (every? true?))
22:16clojurebottrue
22:16sdegutisHOW DEEP CAN WE GO
22:17TEttinger,(mapv #(into % [[Double/NaN Double/NaN] [Double/NaN Double/NaN]]) [() [] #{} {} nil])
22:17clojurebot[([NaN NaN] [NaN NaN]) [[NaN NaN] [NaN NaN]] #{[NaN NaN] [NaN NaN]} {NaN NaN, NaN NaN} ([NaN NaN] [NaN NaN])]
22:17TEttinger,(map count (map #(into % [[Double/NaN Double/NaN] [Double/NaN Double/NaN]]) [() [] #{} {} nil]))
22:17clojurebot(2 2 2 2 2)
22:18TEttingerI knew NaN was not equal to itself, I did not know that carried over to vectors containing NaN
22:18TEttinger,(= #{[NaN NaN] [NaN NaN]} #{[NaN NaN] [NaN NaN]})
22:18clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: [NaN NaN]>
22:19TEttinger,(let [weird #(into #{} [[Double/NaN Double/NaN] [Double/NaN Double/NaN]])] (= weird weird))
22:19clojurebottrue
22:19TEttinger,(let [weird #(into #{} [[Double/NaN Double/NaN] [Double/NaN Double/NaN]]) weird2 #(into #{} [[Double/NaN Double/NaN] [Double/NaN Double/NaN]])] (= weird weird2))
22:19clojurebotfalse