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 Free f a = Free (f (Free f a)) | Pure a | |
| deriving Functor | |
| liftF :: Functor f => f a -> Free f a | |
| liftF action = Free (fmap Pure action) | |
| data Ex x = Ex x (Maybe x) | |
| deriving Functor |
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
| ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐ | |
| │~ │! ⌶ │@ ⍫ │# ⍒ │$ ⍋ │% ⌽ │∧ ⍉ │& ⊖ │* ⍟ │( ⍱ │) ⍲ │_ ! │+ ⌹ │Backspace│ | |
| │` ⋄ │1 ¨ │2 ¯ │3 < │4 ≤ │5 = │6 ≥ │7 > │8 ≠ │9 ∨ │0 ∧ │- × │= ÷ │ │ | |
| ├────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬──────┤ | |
| │Tab │Q │W │E ⍷ │R │T ⍨ │Y │U │I ⍸ │O ⍥ │P ⍣ │{ ⍞ │} ⍬ │| ⊣ │ | |
| │ │q ? │w ⍵ │e ∊ │r ⍴ │t ~ │y ↑ │u ↓ │i ⍳ │o ○ │p * │[ ← │] → │\ ⊢ │ | |
| ├───────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴──────┤ | |
| │Caps │A │S │D │F │G │H │J ⍤ │K ⌸ │L ⌷ │: ≡ │" ≢ │Enter │ | |
| │Lock │a ⍺ │s ⌈ │d ⌊ │f _ │g ∇ │h ∆ │j ∘ │k ' │l ⎕ │; ⍎ │' ⍕ │ │ | |
| ├────────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──────────┤ |
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
| -- Naïve indenter | |
| space = repeat ' ' | |
| _indent :: Int -> [Int] -> [Char] -> [Char] | |
| _indent _ _ [] = "" | |
| _indent w k@(t:_) (',':s) = '\n' : take t space ++ ',' : _indent (t+1) k s | |
| _indent w k (c:s) = c : _indent (w+1) (f c) s | |
| where | |
| f v |
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::str::Chars; | |
| use std::io::IoError; | |
| use std::io::fs::File; | |
| use std::iter::Peekable; | |
| use std::error::{FromError, Error}; | |
| struct Settings { | |
| clips : Vec<(String, Path)>, | |
| } |
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
| impl MarketData { | |
| … | |
| pub fn collect( &mut self, data : ( Count, Money, Count ) ) { | |
| let ( assets, price, holders ) = data; | |
| self.day_count += 1; | |
| self.asset_history.push( assets ); | |
| self.price_history.push( price ); | |
| self.holders_history.push( holders ); | |
| } | |
| … |
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
| impl MarketData { | |
| … | |
| pub fn collect( &mut self, market : &mut Market ) { | |
| self.day_count += 1; | |
| self.asset_history.push( market.assets ); | |
| self.price_history.push( market.price ); | |
| self.holders_history.push( market.holders ); | |
| } | |
| … |
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
| #![feature(asm)] | |
| extern crate time; | |
| use std::rand::random; | |
| use std::char::from_u32; | |
| use time::precise_time_ns; | |
| type Chunk = [char, ..5]; |
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
| (ns world.gen) | |
| (defn rrange [mn mx] | |
| (+ (* (rand) | |
| (- mx mn)) | |
| mn)) | |
| (defn printmatrix [matrix] | |
| (print(reduce str(for [x matrix] (str (reduce str(for [y x] (if (= y nil)0 1))) "\n")))) matrix) |
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
| // Actor::update( &mut self, &Vec<Box<Actor>> ) | |
| pub fn update( &mut self ) { | |
| for i in range( 0u, self.actors.len() ) { | |
| let actor = self.actors.get_mut( i ); | |
| actor.update( &self.actors ); | |
| } | |
| } |
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 Data.Bits | |
| import Data.Char | |
| import Data.Word | |
| _intToHex :: Int -> Int -> Bool -> String | |
| -- i: integer, l: length of the number string, s: show sign? | |
| _intToHex i l s = sign ++ body | |
| where | |
| n = if i < 0 | |
| then if s |