This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Prelude hiding (lex) | |
| import Data.Char | |
| import Data.Foldable (sequenceA_) | |
| import Control.Monad.State | |
| data Token = Num Integer | |
| | Op Char deriving (Show, Eq) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function classify(str) | |
| if tonumber(str) == nil then | |
| return str | |
| else | |
| return tonumber(str) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| void get_coins(int a) { | |
| int quarters = a / 25; a %= 25; | |
| int dimes = a / 10; a %= 10; | |
| int nickles = a / 5; a %= 5; | |
| int pennies = a; | |
| printf( " quarters: %d\n dimes: %d\n nickles: %d\n pennies: %d\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "MandelbrotImage" | |
| version = "0.1.0" | |
| authors = ["Johnathan Walker <jhwalking0@gmail.com>"] | |
| [dependencies] | |
| image = "*" | |
| num = "*" |
NewerOlder