Fork me on GitHub
#clojure-uk
<
2017-05-12
>
dominicm08:05:21

Any experience with PlantUML here? I'm using it a lot right now, quite enjoying it.

korny08:05:29

yeah, used it a fair bit. Also nice for embedding diagrams in asciidoc - there’s a plugin for asciidoctor that will do inline diagrams via plantuml and a bunch of other similar tools.

dominicm08:05:35

Yeah, we're using that.

dominicm08:05:38

Big on Adoc here.

dominicm08:05:26

adoc is the file extension.

Rachel Westmacott08:05:39

rcfotd:

-------------------------
clojure.core/find-keyword
([name] [ns name])
  Returns a Keyword with the given namespace and name if one already
  exists.  This function will not intern a new keyword. If the keyword
  has not already been interned, it will return nil.  Do not use :
  in the keyword strings, it will be added automatically.

korny08:05:17

I’ve been moving my github pages to asciidoc - thought you don’t get plantuml there 🙂 but it’s nice for tables and things that markdown just can’t handle.

glenjamin08:05:12

There’s a plantuml-type thing that runs in the browser: https://knsv.github.io/mermaid/

malcolmsparks08:05:44

The main thing I like about adoc is that you convert it to DocBook - http://tdg.docbook.org/tdg/5.2/ -which means you can treat a document as a strongly-typed data-structure - so you can do things like extract index terms, count notes, process hyperlinks, fix things, insert boilerplate

malcolmsparks08:05:31

The DocBook-to-PDF toolchain is mature and works great, the DocBook-to-HTML is mature and looks like the web 15 years ago 😞 But it's remarkably easy to process a valid DocBook structure with Clojure and transform it to the HTML of your choice...

glenjamin09:05:07

javascript instead of java 🙂

glenjamin09:05:17

which is only really relevant if you want to run it in the browser

korny10:05:02

Trying to refactor some es6 to be more immutable. I’m trying to work out, which is better - to use raw es6, which means ugly strange things like Object.assign({}, thing, { newKey: newVal });

korny10:05:01

or to use immutable.js which is great and clojure-y, but also requires the audience to accept using an extra library

korny10:05:43

(I’m trying to encourage good FP practices in JavaScript, and attempting to avoid mutating objects.)

glenjamin10:05:07

if you can get buy-in for immutable, it’s much better

glenjamin10:05:14

you get proper value equality

glenjamin10:05:21

and structural sharing

glenjamin10:05:51

if you are sticking with plain js, I hear rambda is good, but i’d at least wrap up patterns like that in well-named helper functions

korny10:05:21

yeah - but it means instead of saying “You’re doing JavaScript badly, the language now has all these great FP things”, I have to say “the language has all these great FP things, but you need a 3rd party library as well” 🙂

glenjamin10:05:27

ES6 doesn’t really improve the story for FP datastructures imo

korny10:05:23

well, at least you get a better Map, though as I was ranting yesterday the keys are still handled badly.

glenjamin10:05:52

i wasn’t really crying out for a new mutable map based on object identity 😞

korny10:05:48

I think for my simple example I’m going to stick with pure es6, and add a comment that immutable.js and others would be much better for a real project.

korny10:05:55

Most of my code didn’t mutate things anyway, but I did have to do a couple of “take a big data structure and add extra bits to it” operations, which makes it very tempting to just iterate and mutate 🙂

glenjamin10:05:28

yeah, i often do function update(obj, extra) { return Object.assign({}, obj, extra); }

mccraigmccraig10:05:16

(heap usage dropping to 60MB after a GC 😄 )

maleghast10:05:54

Wow... Is that post-agent?

mccraigmccraig10:05:23

it's after i fixed a thread-leak in java-nats... prior to that every user connection was leaking one or more threads and a single vm would be using 10GB of RAM in a few hours

korny10:05:48

@glenjamin that’s pretty well verbatim what I use. If I were using babel I could say {...obj, newKey: newVal} but that hasn’t made it into browsers yet.

glenjamin10:05:08

i’d still prefer a named function to that

glenjamin10:05:25

you see some really weird inline syntax tricks to do immutable updates in redux code in the wild

glenjamin10:05:44

I’d pick function names which carry intent over that every time

korny10:05:06

yeah, good point, though syntax tricks can become idioms if you see them enough.

korny10:05:28

like, say, some clojure destructuring tricks 🙂

korny10:05:23

I’ve given up when it comes to reduce - reduce with immutable results and without decent data structures is just horrible. 😞

glenjamin10:05:51

i find in JS that a closure over a mutable var + .forEach is usually more readable than a reduce

korny11:05:18

depends a bit on the reduce, and willingness to mutate the memo rather than returning a new value each time. A cheat’s reduce, really.

korny11:05:36

uniqueReleases = data.reduce((memo, task) => memo.add(task.release), new Set());

glenjamin11:05:11

yeah, i often end up doing it with plain objects, so the mutate doesn’t return the new value

dominicm13:05:24

ah, slight drawback to mermaid vs plantuml: Limited shape support. There's an open issue for it. But no activity for a while.

glenjamin13:05:16

ah, i hadn’t run into that

dominicm13:05:07

https://github.com/knsv/mermaid/issues/274 if it had this, it would replace plantuml for me I think. I'll probably use it for ideas though.

Rachel Westmacott15:05:58

to each their own…