#clojure log - May 13 2016

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:36 unverified: hello

1:20 irctc: Hi I am very new to clojure. Just started learning it. Can anyone help me with a question?

3:20 ilevd: What is the easiest way to insert file to bytea field in postgresql?

3:26 dysfun: what libraries are you using?

3:31 ilevd: honeysql

3:31 dysfun: oh, that does nothing for you in the way of conversion

3:31 i suspect you'll have to create a PGobject. manually

3:32 ilevd: Maybe it will appear in mpg?

3:33 dysfun: haha, i just filed a ticket for it

3:33 ilevd: :)

3:34 dysfun: my proposal is to map it to ByteBuffer

3:34 but we'll probably also accept a Reader or a File as input

3:34 ilevd: Cool :)

3:36 dysfun: if you look at the mpg code to see how we create the PGobject for json, you can probably do something similar for bytea

3:43 ilevd: Heh, I'm thinking to use something low-level like here https://github.com/krisajenkins/yesql/issues/122

3:46 dysfun: https://github.com/mpg-project/mpg/issues/16 # added a link to that

3:46 any other obscure data types that aren't supported that you have in your database while we're at it? :)

3:48 ilevd: It seems that's all :)

3:50 dysfun: oh good. i'm getting terribly bored of debugging why my jdbc code doesn't work

5:33 jonathanj: is there something like constantly but instead of giving it a value you give it a function and some args?

5:33 dysfun: partial ?

5:34 jonathanj: partial isn't quite the same

5:34 constantly takes any arguments but disregards them

5:34 dysfun: why can't you use constantly?

5:34 jonathanj: because i don't want to call the function

5:34 not right away, anyway

5:35 (fn [f & args] (fn [& _] (apply f args))) is what i want, i think, but i'm actually looking for a name, not an implementation

5:36 dysfun: i don't know of anything but i've written similar often

5:45 ridcully: ,(doc repeatedly)

5:45 clojurebot: "([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"

5:49 bikeshedr_: haha, I created a lazy-seq and forgot to wrap it's relevant content in [], wondering why I always received and emtpy seq

5:49 so easy to miss

5:51 err, I mean I forgot to cons, less easy to miss, obviously I'm confused

5:55 jonathanj: ridcully: ah, the 1-arity version of repeatedly is probably what i want?

5:55 (repeatedly (partial f a r g s))

5:55 i missed that

9:37 bikeshedr_: 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,

9:37 and I'm not sure if lazy-seq is the right tool

9:39 kwladyka: Do 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?

9:39 in Clojure project

9:47 circ-user-0vXzk: Hi.

9:47 I'm searching for a stepper for clojure

9:48 mgaare: kwladyka: I believe that relies on a specific naming convention. eg, some.ns should have a corresponding test ns, some.ns-test

9:48 kwladyka: mgaare i am doing this with convenction

9:48 mgaare is it work for you?

9:49 mgaare: circ-user-0vXzk: cider's debugger can do stepping - http://cider.readthedocs.io/en/latest/debugging/

9:49 kwladyka: yea

9:50 circ-user-0vXzk: thnks mgaare!

9:52 mgaare: kwladyka: it is working for me. I have clojure-mode 20160430.1414, projectile 20160420.1508

9:53 not sure what other emacs deps would be involved

13:18 kwladyka: can you share with me your emacs config? Especially part about Clojure?

13:19 do you use clojure-mode-extra-font-locking ?

13:32 Lewix: I need a green light to do a copy paste ? I typed in the wrong channel

13:32 * Lewix smiles

14:16 edw: Hey folks, if any of you are also schemers, you may be interested in something I'm working on: https://www.refheap.com/119050

14:18 It's a set of Scheme R5RS syntax extensions that push Scheme toward Clojure in terms of concision.

14:18 justin_smith: awesome

14:20 edw: how hard would it be to get vector, hash-map, set literals too - or is that already a thing?

14:20 amalloy: what about rackjure? that already had some cool stuff

14:20 edw: justin_smith: Step one is pushing Scheme as hard as possible toward Clojure without worrying about modifying the reader.

14:22 amalloy: 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:23 But I'll check out Rackjure.

14:25 Reading 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:27 I implemented `for` (as `fir`) fully; the resulting `syntax-case` forms became effectively write-only.

15:15 Lewix: justin_smith: is it lazy like the original map https://www.refheap.com/119052

15:15 justin_smith: Lewix: is what lazy?

15:15 Lewix: justin_smith: my map

15:15 amalloy: Lewix: why don't you try it on a large sequence and see

15:15 justin_smith: oh, no, that is not lazy

15:15 edw`: FYI: I put my Clojurish Scheme stuff in <schemehttps://github.com/edw/skim>.

15:16 Lewix: justin_smith: sorry wrong link

15:18 sdegutis: Hello. I'd like this feature please:

15:18 :chop myapp

15:18 Lewix: (doc lazy?)

15:18 sdegutis: (:require [myapp.model.user :chop myapp])

15:18 Lewix: ,(doc lazy?)

15:18 ,(apropos lazy?)

15:18 clojurebot: eval service is offline

15:18 eval service is offline

15:19 eval service is offline

15:19 justin_smith: Lewix: there is exactly one lazy type

15:19 sdegutis: That would be the same as creating an alias, which uses :as with the fircken thing

15:19 What's a good strong non-sweet alcohol? Scotch?

15:19 Bourbon? Whisky?

15:19 So, (:require [myapp.model.user :chop myapp]) would be the same as (;require [myapp.model.user :as model.user])

15:19 Lewix: justin_smith: https://www.refheap.com/119053

15:20 justin_smith: wait, that's not true

15:20 sdegutis: Please advice, is this a bad idea?

15:20 justin_smith: bad

15:20 sdegutis: Why

15:20 justin_smith: Lewix: you cannot construct a lazy-seq via recur like that

15:21 Lewix: a lazy function should return a form (usually recursive, never using recur) wrapped in a call to lazy-seq

15:22 sdegutis: 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:24 Lewix: I see. thanks

15:27 sdegutis: justin_smith: well often I find myself trying to type the namespace with my appname not there.

15:27 Lately 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:27 But it never does, because it's not aliases as model.user, but user.model, which sounded cool at first but feels backwards now.

15:28 So as a shortcut I want to just chop off "mywebsite."

15:28 That's my feature equest.

15:29 So it sounds like Scotch is usually sweeter than Whisky, which is often more oaky.

15:29 amalloy: clojure should have more feature bequests

15:30 sdegutis: amalloy: what is bequest tho

15:56 ystael: sdegutis: I'm partial to rye, which is more fiery than bourbon-sweet

15:56 sdegutis: ystael: hmm

15:56 ystael: I have coworkers who prefer scotch that would be best described not as 'sweet' but as 'diesel exhaust'

15:57 dysfun: ah, caol ila

15:59 sdegutis: this website im looking at says "Rye tastes like: A spicy, grainy, hard-edged version of bourbon. Like bourbon's maverick younger brother.

15:59 and that "Scotch tastes like: Rubber, wood, fire, dirt, and leather -- but in a good way. A great way, actually."

15:59 ystael: would you say so?

15:59 justin_smith: I keep vodka on my desk at work

15:59 dysfun: scotch has an enormous range of flavours

15:59 ystael: sdegutis: there is very great variation, especially in scotch

15:59 * dysfun has been to scotch tastings

15:59 sdegutis: TIL

16:00 ystael: there is scotch nearly indistinguishable from bourbon, and scotch nearly indistinguishable from a dumpster fire

16:00 sdegutis: also: "Tennessee whiskey tastes like: Bourbon, if we're being honest"

16:00 dysfun: my first scotch experience was with some godawful stuff called 'high commissioner'

16:00 i thought i didn't like whisky

16:01 justin_smith: sometimes whisky tastes like somebody put artificially flavored "banana" candy in it

16:01 dysfun: until i made a friend who was a scotch fan and learned it didn't all taste like shit

16:01 sdegutis: im just looking for something very strong and not sweet

16:01 good flavor is a bonus

16:01 justin_smith: sdegutis: vodka!

16:01 dysfun: justin_smith: i'm quite fond of angostura 1919 rum in patisserie - it's got loads of banana flavour

16:01 sdegutis: hmm well not disgusting flavor is a requiremnt

16:02 dysfun: gin

16:02 justin_smith: sdegutis: all vodka has (if done properly) is alcohol and water, the other stuff has been removed

16:02 ystael: sdegutis: there is also a wide variety of vile mediciney herbals

16:02 amari, chartreuse, fernet, etc

16:02 (i like those quite a bit, actually)

16:02 dysfun: i'm quite fond of absinthe (but only the good stuff)

16:02 chartreuse i remember drinking at a conference with a mad chartreuse fan

16:03 justin_smith: the hipsters here like fernet

16:03 dysfun: (he brought two bottles to share with strangers)

16:03 vodka is pretty good mixed

16:03 ystael: vodka is a good thing to make into fruit infusions

16:03 dysfun: you can get totally wrecked on screwdrivers or harvey wallbangers

16:04 and white russians are ace

16:04 ...and this is why i don't keep spirits in the flat.

16:04 justin_smith: dysfun: 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:05 dysfun: justin_smith: i remember drinking latvian 'black balsam' neat. god that stuff'll put hairs on your chest

16:05 and 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:06 also meat. because what kind of polish restaurant isn't a celebration of meat?

16:07 what's the most awful neat spirit you've ever tried?

16:07 kwladyka: can you share with me your emacs config? Especially part about Clojure?

16:07 ystael: dysfun: toss-up, either Maotai (baijiu) or Jeppson's Malört (wormwood bitter)

16:07 dysfun: never even heard of those!

16:08 ystael: Jeppson's Malört is apparently only available in and around Chicago, and tastes like crushed ibuprofen tablets dissolved in nail polish remover

16:09 dysfun: i nominate ouzo and jenever

16:09 ystael: Baijiu, 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:10 dysfun: where's it from?

16:10 ystael: China

16:10 dysfun: i've had some bizarre stuff

16:10 i became quite fond of this finnish stuff called tervasnapsi made of pine tar

16:10 ystael: i would try that, that sounds like it might be pretty good

16:11 dysfun: if you're ever in finland, i can recommend it

16:11 i brought some back

16:11 it needs to be almost frozen to be drinkable though :)

16:12 they do lots of things flavoured with cloudberries too

16:13 ystael: salmiakki koskenkorva is on my "vile drinks from finland" bucket list

16:13 dysfun: oh, i had some really awful sake once. i used to have a taste for it

16:13 haha, we called it 'salamari' which means 'tentacle'

16:13 oh god i'm remembering

16:14 there's also 'fisu', which is the same construction but with fishermans friends

16:14 (instead of the salmiakki)

16:14 my favourite finnish drink is hartwall lonkero

16:15 ystael: is that ... gin and grapefruit soda ... in a _can_?

16:15 dysfun: yes it is. and it's way more delicious than it sounds

16:16 TimMc: ystael: I just had some chocolate with anise and wormwood.

16:16 http://endorfinfoods.com/collections/dark-mylk-chocolate-bars/products/absinthe-chocolate-bar

16:16 ystael: TimMc: did it taste like sad Christmas?

16:16 TimMc: No, it's actually very good. There's just enough wormwood for flavor, it's not bitter.

16:16 dysfun: trippy christmas

16:16 TimMc: not enough wormwood for that, either :-P

16:17 dysfun: haha. you know it was the french wine industry who perpetuated the myth that wormwood was neurotoxic?

16:19 TimMc: haha

16:23 justin_smith: drinking culture is almost as weird as food culture, with blindfolds on people can't even tell the difference between red and white wines

16:23 dysfun: only people with no palate at all

16:24 i detest most white wine, but i'm quite fond of red

16:24 justin_smith: dysfun: this study was on wine experts

16:25 dysfun: that's such a ridiculous claim

16:25 justin_smith: dysfun: it's a documented study, you're welcome to try and falsify it

16:25 dysfun: link?

16:26 amalloy: let's just falsify it by fiat

16:26 justin_smith: looking for the real paper, here's a new yorker article http://www.newyorker.com/magazine/2002/08/19/the-red-and-the-white

16:26 dysfun: i am not at all a wine expert or a wine snob, but smells like bullshit

16:27 opqdonut: dysfun: but you never drink wine blind do you?

16:27 TimMc: seems you should be able to taste the redness

16:27 but I don't drink so... :-)

16:27 justin_smith: drinking *until* wine is much more popular

16:27 opqdonut: seems, yes, that's why the study is so interesting

16:27 justin_smith: until blind, dammit

16:29 opqdonut: and non-blindness is an essential part of food/drink

16:29 dysfun: seriously, white wine and red wine are so different in flavour and it's got sod all to do with the colour

16:30 opqdonut: it's not just the tastes, it's the history, the culture, the discussion

16:30 dysfun: red wine in rich in tannins, which make the tongue feel funny

16:31 TimMc: opqdonut: Like how going fishing isn't about hunting aquatic creatures.

16:31 opqdonut: indeed

17:17 sdegutis: ok im back

17:17 what did i miss?

17:18 justin_smith: that sounds really disgusting

20:55 So, turns out that Jameson Irish Whisky is pretty good.

20:55 Smells and tastes nice and creamy without being too sweet.

21:00 ridcully: the next best thing for an irish coffee

21:27 amalloy: ,(rand-nth ())

21:27 clojurebot: #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:27 amalloy: surprises me given how (first ()) and such things behave

22:02 sdegutis: ,(first ())

22:02 clojurebot: nil

22:02 sdegutis: ,((juxt first rest next) ())

22:02 clojurebot: [nil () nil]

22:13 sdegutis: ,(map (juxt first rest next) [() [] #{} {} nil])

22:13 clojurebot: ([nil () nil] [nil () nil] [nil () nil] [nil () nil] [nil () nil])

22:13 sdegutis: ,(mapv (juxt first rest next) [() [] #{} {} nil])

22:13 clojurebot: [[nil () nil] [nil () nil] [nil () nil] [nil () nil] [nil () nil]]

22:13 TEttinger: nice.

22:14 consistency.

22:14 sdegutis: ,(apply = (mapv (juxt first rest next) [() [] #{} {} nil]))

22:14 clojurebot: true

22:14 sdegutis: ,(apply = (map (juxt first rest next) [() [] #{} {} nil]))

22:14 clojurebot: true

22:15 sdegutis: ,(true? (apply = (map (juxt first rest next) [() [] #{} {} nil])))

22:15 clojurebot: true

22:15 TEttinger: ,(mapv #(into % [Double/NaN Double/NaN] [Double/NaN Double/NaN]) [() [] #{} {} nil])

22:15 clojurebot: #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:16 TEttinger: aw

22:16 ,(into [] Double/NaN)

22:16 clojurebot: #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:16 sdegutis: ,(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3))

22:16 clojurebot: (true true true)

22:16 TEttinger: huh

22:16 sdegutis: ,(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3) (apply =))

22:16 clojurebot: true

22:16 TEttinger: ,(into [] [Double/NaN])

22:16 clojurebot: [NaN]

22:16 sdegutis: ,(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3) (every? true?))

22:16 clojurebot: true

22:16 sdegutis: HOW DEEP CAN WE GO

22:17 TEttinger: ,(mapv #(into % [[Double/NaN Double/NaN] [Double/NaN Double/NaN]]) [() [] #{} {} nil])

22:17 clojurebot: [([NaN NaN] [NaN NaN]) [[NaN NaN] [NaN NaN]] #{[NaN NaN] [NaN NaN]} {NaN NaN, NaN NaN} ([NaN NaN] [NaN NaN])]

22:17 TEttinger: ,(map count (map #(into % [[Double/NaN Double/NaN] [Double/NaN Double/NaN]]) [() [] #{} {} nil]))

22:17 clojurebot: (2 2 2 2 2)

22:18 TEttinger: I knew NaN was not equal to itself, I did not know that carried over to vectors containing NaN

22:18 ,(= #{[NaN NaN] [NaN NaN]} #{[NaN NaN] [NaN NaN]})

22:18 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: [NaN NaN]>

22:19 TEttinger: ,(let [weird #(into #{} [[Double/NaN Double/NaN] [Double/NaN Double/NaN]])] (= weird weird))

22:19 clojurebot: true

22:19 TEttinger: ,(let [weird #(into #{} [[Double/NaN Double/NaN] [Double/NaN Double/NaN]]) weird2 #(into #{} [[Double/NaN Double/NaN] [Double/NaN Double/NaN]])] (= weird weird2))

22:19 clojurebot: false

Logging service provided by n01se.net