Based on:
So these two objects will have different shapes:
function ObjA(a, b) {
module Main where | |
import Signal | |
type alias Message = | |
{ operation : String | |
, message : String | |
} |
// npm install benchmark | |
var bench = require('benchmark'); | |
function updateOriginal(oldRecord, updatedFields) | |
{ | |
var newRecord = {}; | |
for (var key in oldRecord) | |
{ | |
newRecord[key] = (key in updatedFields) ? updatedFields[key] : oldRecord[key]; |
;; Ok. Jeg husker ikke Scheme/Racket helt, så jeg tar det i Clojure. | |
;; Jeg satser på at syntaxen er lik nok til at du skjønner poenget. | |
;; Først skal jeg bare forklare et par konsepter som kan være ulikt scheme. | |
;; atom | |
;; Alt i Clojure er i utgangspunktet immutable(ikke-muterbart). | |
;; Funksjoner som set-car! og set-cdr! finnes ikke. | |
;; For å kunne mutere state, kan en pakke inn en verdi i et atom. | |
;; | |
;; (def muterbar (atom '()) <-- definerer en muterbar liste som heter 'muterbar' |
[core] | |
quotepath = false | |
autocrlf = input | |
[user] | |
name = Robin Heggelund Hansen | |
email = [email protected] | |
[credential] | |
helper = osxkeychain | |
[push] | |
default = upstream |
module Main exposing (main) | |
{- | |
So I just went over my projects at work, and my hobby project. | |
This gist is an example of a common way for me, and my colleagues at work, to structure progrograms: | |
src/Main.elm <-- Top-level model-view-update | |
src/VippsModal.elm <-- Popup modal, for paying with a norwegian payment solution, has its own model-view-update | |
src/Data/UserInfo.elm <-- The UserInfo alias, and methods for working on that data | |
src/Backend.elm <-- For communicating with the backend |
/* SETUP */ | |
var Benchmark = require('benchmark'); | |
function _Utils_Tuple2(x,y) { | |
return { | |
$: '#2', | |
a: x, | |
b: y | |
}; |
Based on:
So these two objects will have different shapes:
function ObjA(a, b) {