hjertnes.blog

Pure functions

21.08.2018 10:00

One terms you will hear over and over and over when you start getting into functional programming is the term pure functions.

But they can be a little bit difficult to understand, or difficult to find a clear description.

A pure function is a function that returns a result based on it’s inputs and the inputs alone. The result should be deterministic. This have some consequences for how most programmers write their code. Because a pure function never change anything outside itself.

This mean that it does not use variables that are not defined inside it or are parameters, and it does not change anything outside itself.

If it prints: not pure. If it writes to a file: not pure. If it alters global state: not pure.

I think that using pure functions as much as possible is a good idea, because pure functions are often less buggy and easier to maintain. And it forces you to limit unpure functions to a minimum and really thinking before you deal with unpurity.

Personally I prefer languages like Clojure that are built with this in mind.

#

21.08.2018 09:31

Liked: The Weird, Complicated, Sexist History of Pockets

#

21.08.2018 09:30

Liked: The Politics of Pockets - Racked

#

21.08.2018 09:30

Liked: The Gender Politics of Pockets - The Atlantic

#

21.08.2018 09:29

Liked: How small women’s pockets are, visualized | The Outline

#

21.08.2018 09:29

Liked: unmaintainable-code/README.md at master ยท Droogans/unmaintainable-code

#

21.08.2018 09:27

I’m really loving Splatoon 2 this far!

Ink Review: Pilot Iroshizuku Murasaki Shikibu

20.08.2018 10:00

I got myself a new ink back in July, because I was running out of inks. This is another Iroshizuku ink, because I have kind of decided to mostly use them exclusively going forward. I’m not saying all other inks are bad. But my experience is that I enjoy using them much more than almost all other inks I have used. They dry fast and I never have any flow problems.

It has a great purple colour. Like with all Iroshizuku inks I have used, it is not too dark or too light. There are not much at all to note about the ink. If you like inks from Pilot Iroshizuku and want a purple one I’d give it a shot.

My writing workflow

20.08.2018 10:00

The way I write is that it starts with some idea. I usually write it down either in Drafts or in a Field Notes, that eventually finds its way into Omni Focus. Then I write a draft in a lined Leuchtturm1917 notebook. Usually either with a pencil or a fountain pen.

The next step is that I go through all the stuff I have written there every 25 pages or so. I transcribe the stuff I am happy with on my AlphaSmart Neo or re-add the idea to Omni Focus if I want to try it again.

Then I start BBEdit, open my Drafts.txt document and send the text from my AlphaSmart when I’m done.

The next step is that I once a week schedule posts for this site and The Ink Smudge. I pick the stuff I like from the Drafts document and I also try to delete stuff that I know I’m never going to publish.

#

17.08.2018 10:06

Liked: Stevey’s Blog Rants: Execution in the Kingdom of Nouns