Introduction I’ve recently started playing Magic the Gathering and have been experimenting with a few decks to try and learn the game better and see which style(s) of decks I like to play. In order to do so I’m playing practice matches against myself. Despite my best efforts, one of the decks I’m very excited about, the Bloomburrow squirrel deck, has lost most of the practice matches I’ve played against myself.
[Read More]
Things I Like About Nim
Method Call Syntax In Nim, a.f(b) is really just syntactic sugar for f(a, b). Note: they look like methods but aren’t attached to the type/object at all. Which function to call will be figured out at compile time, just like normal function calls.
You can use this to implement pseudo extension methods on standard types like strings:
import nim_utils/files, os, strformat proc makeBackup(filename: string) = let backupPath = fmt"{filename}.bak" case filename.
[Read More]
Ocaml Memory Model Notes
Non-Atomic Variables var1: [t1 -> v1; t2 -> v2] where var1 is the name of the variable, tx are timestamps, and vx are the values of the variable at those timestamps.
Note that t(n+1) must be greater than t(n)
Domains Domains are separate spheres of execution. Each thread would have their own Domain, for instance.
Frontier Domains have a frontier, which establishes which variables it can see at which timestamp.
[Read More]
Unification Algorithm Notes
Unification Algorithm type term = | Var of string | Term of string * term list You either have a type variable with a name, or a type constructor with a name and a list of arguments.
Unification takes a list of term pairs which have to be made matching.
Unification returns a list of substitutions, where a substitution is a pair of a string and a term, aka the variable name that should be substituted with the term.
[Read More]
OCaml Effects
I’ve been interested in algebraic effects in programming languages for a while, but they’ve been theoretical-only for a while. That’s soon to change though!
OCaml early on adopted algebraic effects and handlers as a way to implement concurrency, something that had been lacking in the language until now. But changing the langugage’s memory model, runtime, garbage collector, etc. proved to be a long task.
OCaml 5.0 is on the horizon at last and includes an implementation of algebraic effects.
[Read More]
Terminal Setup
A lot of people at work have been asking me how I set up my terminal, so I wrote this up to send to them. Hope you enjoy!
Install ZSH The shell I use is zsh. To install it, follow these instructions
Install oh-my-zsh oh-my-zsh is a plugin/theming library thingie for zsh.
Follow these instructions to install
Make sure to take a look at the plugins and enable any that might be useful for you.
[Read More]
S3 on Flashblade
I currently work for a company called Pure Storage. One of their products is called Flashblade. I couldn’t find any examples on how to use Flashblade’s S3 capabilities programmatically anywhere online, so I’m putting this out to hopefully help people realize they can move their object store into their data center with very little changes to their code.
Code Snippets Most of the work with the libraries I’ve used involves figuring out how to get the client configured properly.
[Read More]
Programming Articles and Talks
Here’s a collection of talks or articles that I really enjoy.
The Error Model Joe Duffy describes the error model in an experimental programming language that he worked on. Starts off by describing different ways that programming languages give programmers to express and deal with errors. He discusses the pros and cons of each strategy, and then goes on to describe how they designed around those problems to create something truly unique.
[Read More]
When to Use Programming Languages
Java Willing to take a small speed decrease in order to have a much better time programming than C/C++ Need to interface with <~Obscure Technology~>. Because Java probably has a library for it Kotlin Want/need to use Java libraries but want to feel modern Groovy I want to write a version of Java that gets rid of everything good about Java while keeping all of the bad C Need the maximum amount of speed possible C++ Need the maximum amount of speed possible while also having the maximum number of language features that don’t fit together Javascript Need to write something quick for the browser Typescript Need to write something large for the browser Python Short scripts, one-offs Want to have a good time programming while not caring about speed or ease of refactoring Go Want the power of concurrency, but don’t want to actually learn concurrency Clojure Want/need to use Java libraries but are a hipster Rich Hickey is my spirit animal Seriously though, Clojure is really good for processing data.
[Read More]