Skip to content

Instantly share code, notes, and snippets.

View bjartwolf's full-sized avatar

Bjørn Einar Bjartnes bjartwolf

View GitHub Profile
@swlaschin
swlaschin / booklist.md
Last active July 23, 2024 10:37
Some recommended books for improving as a software developer

Some recommended books for improving as a software developer

Most software books are too language specific and go out of date too quickly. What I find has stayed with me are books about bigger concepts, such as systems thinking and complexity, and also so-called "soft skills" such as management and psychology.

User experience

These are all really about developing empathy for other people :)

  • "The Design of Everyday Things" by Donald Norman
module Person =
open System
type PersonState = private { id: Guid; name: string; age: int}
let createPerson id name age = {id = id; name = name; age = age}
let changeName name personState = {personState with name = name}
let changeAge age personState =
// some crazy business rule involving age
{personState with age = age}
module SomeOtherModule =
// Implemented Jimmy Bogard's https://github.com/jbogard/presentations/tree/master/WickedDomainModels/After in F#
namespace FSharp.Wicked
open System
module Types =
type Id = Id of Guid
type Entity<'T> = Id * 'T
let createEntity state = Guid.NewGuid(), state
@einarwh
einarwh / numbss.fs
Created May 16, 2015 14:07
1-9 to 100 directly
let solve lim total =
let rec gen (n::t) s =
let m = (n % 10) % lim
if m = 0 then
if n = lim then [(List.head (List.rev (n::t)), s)] else []
else
match t with
| [] ->
gen ((m+1)::n::t) (string n) @
gen ((10 * n + m + 1)::t) s
let calcExpr n =
let rec innerCalcExpr n current last=
if current>last then "" else [|""; "+"; "-"|].[n%3] + string current + innerCalcExpr (n/3) (current+1) last
"1" + innerCalcExpr n 2 9
let rec sum = function
|(op::h::t) -> (int (op+h)) + sum t
| _ -> 0
let eval text = sum ("+" :: (System.Text.RegularExpressions.Regex.Split(text,@"(\+)|(-)") |> List.ofArray))
@einarwh
einarwh / numbs.fs
Last active August 29, 2015 14:21
1-9 to 100 with FParsec
open FParsec
let rec permute xs = seq {
match xs with
| [] -> yield ""
| [x] -> yield string x
| h::t ->
let s = string h
for foo in permute t do
yield s + foo