Fork me on GitHub
#clojure-europe
<
2021-06-28
>
pez06:06:17

Good morning everybody!

jasonbell06:06:25

s/Moring/Morning/g;

dharrigan06:06:43

Good Morning Everyone! 😄

hkjels08:06:20

God morgen

reefersleep09:06:01

Good morning 😊

thomas10:06:16

morning, slowly recovering from a really bad cold.

raymcdermott11:06:45

@jasonbell some regex pro tips: ... s/r/rn/ would do it ... no need for the /g ... yes I know, I'm the worst.

reefersleep21:06:43

I must admit that I thought the same! Though I pretty much always put /g by default, because I usually need it

reefersleep21:06:30

(I didn’t think about the r/rn bit)

pez11:06:01

I took it as the regexp was installed from now on.

pez11:06:12

If I have a function taking arguments [x y], how can I transform it to a function taking [y x]? Same function body, I just want to call it with x and y reversed.

djm11:06:03

s/(?<=r)/n/ no need to replace the r with another r 😁

😝 3
reefersleep21:06:29

Negative and positive lookahead and lookbehind are awesome things

borkdude11:06:38

@pez This would only work for a 2 arg function but is more performant than when you would do it for n args using var-args and apply

(defn flip [f] (fn [x y] (f y x)) 

❤️ 6
borkdude11:06:41

This would the the n-args version:

(defn reverse-args [f] (fn [& args] (apply f (reverse args))))

borkdude11:06:42

I think this function is called flip in Haskell (so I edited the 2 args version with that name now)

pez11:06:46

flip, TIL

jasonbell12:06:11

@raymcdermott I’m fully aware but I do appreciate the reminder, I was covering past mistooks 😉

😂 3
raymcdermott12:06:40

@jasonbell yeah I figured but thought a little regex frivolity might lighten Monday

❤️ 6
RAMart12:06:19

Next :clojureD 2021 talk by @mkvlr now online: https://www.youtube.com/watch?v=Gnrh7XOt_84

🔥 18
reefersleep21:06:43

I must admit that I thought the same! Though I pretty much always put /g by default, because I usually need it

reefersleep21:06:29

Negative and positive lookahead and lookbehind are awesome things