Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am rjwebb on github.
  • I am rjwebb (https://keybase.io/rjwebb) on keybase.
  • I have a public key ASCv0-ae5IB77dqQ1VbY6tdmVD-Ow0Mb2SFWcKn9ZPPbggo

To claim this, I am signing this object:

@rjwebb
rjwebb / gradient_descent.hs
Last active December 18, 2018 23:08
Gradient descent implementation in Haskell
import Control.Monad (liftM)
import Data.List (find)
-- Given a list it returns the consecutive pairs of items in the list
pairs :: [a] -> [(a, a)]
pairs values = zip values (tail values)
-- Given a list, this function returns the first item whose difference
-- between it and the previous item is less than `threshold`
@rjwebb
rjwebb / brainfuck.py
Last active February 26, 2019 08:12
A toy Brainfuck implementation in Python
"""
A toy Brainfuck implementation in Python.
In this implementation, the length of tape is infinite in both directions (I used two stacks for the left and right
sides of the tape) and the values on the tape are 0 <= x < 256.
"""
def jump_to_closing_bracket(start_i, program):
"""