Javascript to Elm

19: More than Just Functions

Informações:

Sinopsis

  Functions A function takes inputs and ALWAYS returns output I have definitely NOT always done this. Many cases where I’ve initWithId or initWithArray, that all return void. Ewwww Part of this, is the idea that in order to help retrain my thinking. I need to do more functional thinking in my daily javascript * + (void)initialize { if(self == [WhateverClass class]) { ...perform initialization... } } Procedural/Imperative programming simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program’s execution, including by other procedures or itself. declarative code communicates more effectively than imperative code. Don’t at me. //imperative function meow(props) { var x = props[0], y = props[1], arr = props.slice(2); //... } //declarative function soup([x, y, ...args] = []) { //.. that's it?? } meow([2, 4, 6]); //i guess I can figure out which is which soup([1, 3, 5])