Skip to content

Instantly share code, notes, and snippets.

View j-walk's full-sized avatar

Johnathan j-walk

View GitHub Profile
module Main
(main
) where
import Text.Parsec hiding (State (..))
import Text.Parsec.String
import Control.Monad.State
" Welcome to the wonderful world of my .vimrc
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " Plugin manager
hello
[package]
name = "MandelbrotImage"
version = "0.1.0"
authors = ["Johnathan Walker <jhwalking0@gmail.com>"]
[dependencies]
image = "*"
num = "*"
extern crate image;
extern crate num;
use std::fs::File;
use std::path::Path;
use num::Complex;
// a function which takes a borrowed Complex<f32> and checks if its within
// the bounds of the mandelbrot set
#[inline(three_and_five)]
fn three_and_five() -> usize {
(1..1000).filter(|x| { x % 3 == 0 || x % 5 == 0 }).sum()
}
#[inline(fib)]
fn fib() -> usize {
struct Fib {
curr : usize,
next : usize,
use std::io;
fn main() {
let mut stdin = io::stdin();
let input = &mut String::new();
input.clear();
println!("Specific impulse: ");
stdin.read_line(input).unwrap();
let specific_impulse = input.trim().parse::<i32>().unwrap();
use std::io;
fn main() {
let mut stdin = io::stdin();
let input = &mut String::new();
input.clear();
println!("Specific impulse: ");
stdin.read_line(input).unwrap();
let specific_impulse = input.trim().parse::<i32>().unwrap();
extern crate sdl2;
extern crate noise;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::rect::Rect;
use noise::{NoiseModule, Perlin};
use noise::Seedable;
@j-walk
j-walk / LCReducer.hs
Created September 4, 2018 03:56
Lambda Calculus reducer
data Expr = DeBruijn Int
| App Expr Expr
| Lambda Expr deriving Show
eval :: Expr -> Expr
eval (App (Lambda body) arg) = (arg `captureIn` body) 0
eval (App (App lhs rhs) arg) = eval $ App (eval (App lhs rhs)) arg
eval a = a