Fork me on GitHub
#clojure-uk
<
2020-09-15
>
dharrigan05:09:44

Good Morning!

jiriknesl05:09:45

Wow, thanks for elaborate explanation!

maleghast10:09:17

Morning All…

dharrigan12:09:57

Saw this on reddit/programming yesterday It feels a lot like the threading macro -> in clojure 🙂

dharrigan12:09:42

/ Complex example
anArray
  |> (a => pickEveryN(a, 2))
  |> (a => a.filter(...))
  |> makeQuery
  |> (a => readDB(a, config))
  |> await
  |> extractRemoteUrl
  |> fetch
  |> await
  |> parse
  |> console.log;

djm12:09:24

Inspired by Elixir, I would guess: https://elixirschool.com/en/lessons/basics/pipe-operator/ (or maybe Elm?)

bronsa12:09:35

ocaml has had |> since 2011

jiriknesl12:09:37

I have seen pipe operator for the first time in OCaml (if we don’t count shell).

djm12:09:20

I did some ocaml at university, but that was before 2011, and I haven't looked at it since

bronsa12:09:33

it's function composition tho, not syntax threading

bronsa12:09:59

haskell has the same but calls it &

jiriknesl12:09:54

Also LiveScript has it, they call it piping (https://livescript.net/#piping) and I remember I was using it ages back.

dharrigan12:09:31

I do believe it is yes, functional composition

dharrigan12:09:38

just feels a bit like the threading macro 🙂

alexlynham13:09:25

i guess it's for langs that always curry cos all functions have only one argument, hence composition, right?

👍 3
alexlynham13:09:00

whereas threading is giving its outputs to the next form, not composing together all the logic/operations and then applying

alexlynham13:09:22

vaguely recall that the thrush combinator is somewhat the inverse of composition

alexlynham13:09:25

lemme google

alexlynham13:09:50

with the caveat that as usual i have very little idea what i'm on about

folcon17:09:13

Am I now in a minority in finding using npm libs from clojurescript still can be fraught wish issues? Just surprised that cljsjs is talking about issuing a draft partial depreciation warning...

dominicm17:09:53

I don't have any problems with them.

dominicm17:09:01

Any bundles are smaller.

folcon17:09:03

Well I'm using figwheel / webpack, and it's still really hit and miss. IE requires work, but then using that doesn't give you any working reflection or any js obj worth looking at...

folcon17:09:36

Is it a case of just work out how to convert all your projects to shadow?

folcon18:09:17

Perhaps this is a minority perspective 😃...

dominicm20:09:07

@folcon I use webpack and Figwheel :).

dominicm20:09:35

I wouldn't advocate for migration to shadow.

dominicm20:09:32

@folcon what problems are you encountering exactly? I'm surprised by your claims.

mccraigmccraig20:09:44

we've had an overall good shadow experience... but we moved off of boot-cljs, rather than figwheel

folcon22:09:44

@dominicm I think I've worked out the problem, at least in this case, blame poor errors perhaps? But webpack 5 doesn't say that they remove the node module polyfills that were bundled in by default...

folcon22:09:18

Unfortunately still took a fair while to debug >_<...