Skip to content

Instantly share code, notes, and snippets.

View harrysarson's full-sized avatar

Harry Sarson harrysarson

View GitHub Profile
@harrysarson
harrysarson / lexer-parser.md
Created June 30, 2021 20:05
Lexer/parser thoughts

Lexer/parser thoughts

I like lexer/parser approach because there seem to be two hard parts to going from text to an AST:

  1. Dealing with text
  2. Working out the (possibly recursive structure of the text)

Elm is a really nice language in that you can separate the two hard parts cleanly when writing a parser for it:

@harrysarson
harrysarson / effect-managers.md
Last active March 3, 2020 09:23
Effect managers in elm

The best guide on event managers in elm

Not because this guide is any good, but because it is the only one. This is (to the best of my knowledge) correct as of version 19.0 of the elm compiler and version 1.0.2 of elm/core.

Types of event managed things in elm

  1. Cmds
  2. Port Cmds (I believe these to be fundamentally different from normal Cmds).
  3. Subs.
folkertdev [Yesterday at 9:53 PM]
you mean something custom?
10 replies
ilias [17 hours ago]
The builtin one is a todo :sweat_smile:
@harrysarson
harrysarson / elm-inline-tests.md
Last active June 5, 2019 15:01
[RFC] Elm Inline Tests

An idea: elm inline tests

Everybody's second favourite programming language to be developed in the last decade has the following to say about unit tests:

The purpose of unit tests is to test each unit of code in isolation from the rest of the code to quickly pinpoint where code is and isn’t working as expected. You’ll put unit tests in the src directory in each file with the code that they’re testing.

To allow elm developers to put their unit tests in the same file as the source code, this document proposes a special type of comment with the syntax {-test- ... -} in elm source files. These comments are test blocks, wrapping code that should only be run when testing. The elm compiler ignores code in test blocks (as it ignores everything in comments) but an elm test runner could extract tests and supporting code from such test blocks and run them.

@harrysarson
harrysarson / rv.m
Created October 16, 2017 13:34
3F3 Lab
% Plot normal distribution:
figure(1)
x=randn(1000,1);
subplot(211),
hist(x,20)
subplot(212),
ksdensity(x,’width’,0.1)
% Plot uniform distribution:
figure(2)
x=rand(1000,1);
@harrysarson
harrysarson / README.md
Last active July 8, 2017 17:20
Placeholder branch used for forked repositories.

Repository Name

This repository is used to hold any branches of Repository Name I am developing on or have submitted pull requests for.

It seemed unnessessy to maintain an up to date master branch so I have replaced it with this placeholder.

Basic Usage