Fork me on GitHub
#off-topic
<
2018-05-15
>
dpsutton05:05:59

so i was playing around with the let-if macro that would only branch if the bindings succeeded. the strategy is to check the keys of &env before the binding and then after the binding and remove the ones from before the binding . then its a simple (every? some? bindings) and the macro is done. is there any obvious problem with this?

dpsutton05:05:54

(let-if [{:a/keys [a b]} {:a/a 1 :a/b 2}]
  (+ a b))
3
clojure.tools.analyzer.jvm> 
(let-if [{:a/keys [a not-found]} {:a/a 1 :a/b 2}]
  (+ a not-found))
nil

phronmophobic06:05:03

i’m still learning stuff about macros. how do you get access to &env before and after the bindings?

val_waeselynck06:05:33

Have the wrapping macro emit an inner macro ?

dpsutton11:05:38

Exactly

👍 4
phronmophobic06:05:39

also, that assumes that your let statement is introducing a new binding when that’s not necessarily the case. for example

(let [not-found "haha"]
  (let-if [{:a/keys [a not-found]} {:a/a 1 :a/b 2}]
    (+ a not-found)))

👍 4
arrdem06:05:27

I’m sure Alex will say this is a bad idea, but I’d probably have chosen to use spec to parse the bindings vector and tried to extract the expected locals that way, but that &env approach sounds plausible. difference of closures is the emitted let.

Alex Miller (Clojure team)12:05:19

Sounds like a great idea

xtreak2910:05:18

Are books like code complete and clean code useful for functional programming? Are they agnostic of paradigms? They seem to use OO examples though some stuff are common like meaningful variable names.

Philip Hale21:05:43

I still find a lot to learn from Code Complete, much of what it talks about is independent of any one paradigm or separate from the technicalities of programming languages. There's crossover to good practice in Clojure as well, e.g. the section on table-driven methods to avoid sprawling logic (which the book explains is not solved by OO.)

borkdude14:05:52

@xtreak29 For Clojure you might want to read Elements of Clojure maybe?

borkdude14:05:27

Also Clojure Applied might suit your needs.

borkdude14:05:27

But I do think the books you mentioned add value regardless of language, although things like “the chain rule”, “train wreck”, etc. do apply more to typed/OO langs.

martinklepsch14:05:47

I’m struggling to set up nginx/letsencrypt on fedora for a clojure server. Any chance someone can help? Happy to pay in beer and/or money

borkdude14:05:35

I’ve done it on a VPS where I run clojure with java -jar uberjar.jar. I basically followed a bunch of instructions I found online

borkdude14:05:59

Let’s see if I can find those links

borkdude14:05:44

and in nginx I use a reverse proxy to the clojure server, so I didn’t have to change anything there

martinklepsch14:05:04

yeah, I followed these to a degree and have certificates (that part worked) but now I can’t get nginx to serve my thing. Let me gist my config

martinklepsch14:05:19

the error I’m getting is 502 Bad Gateway

jgh15:05:23

ah damn i missed out on the beer and/or money 😉

😂 4
martinklepsch15:05:30

next time 😄

benzap17:05:53

Been doing some research on GraalVM, and I was wondering if they mentioned which architectures support the native-image features

benzap17:05:53

"Effectively, it's converting bytecode that runs on the JVM (on any platform) to native code for a specific OS/platform"

benzap17:05:00

Unfortunately, I can't seem to find any information on what OS/platform's are supported with this feature. I'm particularly interested in compiling on raspberrypi/arm. It would be interesting to see if more clojure development could veer in that direction, since the memory footprints would be significantly less

hmaurer17:05:00

@benzap ask on their Gitter; I got a quick reply the other day

benzap17:05:13

ah, good idea

hmaurer17:05:30

for native-images I asked a different question, but part of their answer was that the compilation target is the platform you are compiling on

hmaurer17:05:41

but they are working on passing arbitrary compilation targets

hmaurer17:05:42

apparently

hmaurer17:05:46

that’s all I know

benzap17:05:53

Oh, that's great to hear

benzap17:05:00

i'll try and see if I can get more info

borkdude17:05:35

@benzap you might want to drop a message in #graalvm

👍 4
benzap17:05:23

From the gitter, it seems like support is only on Linux+MacOS on Arm64, with support for other platforms in the future

hmaurer18:05:15

thanks for the info 🙂

jjmojojjmojo17:05:24

If anyone’s interested in a unique approach to doing code reviews, my wife Stacy just did a talk at PyCon about it (it’s totally language-neutral): https://youtu.be/lpWvYxEW09k

👍 4