This file contains 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
# coding: utf-8 | |
require 'rspec' # 2.14.1 | |
# NOTE: "include?" and "included_modules" are for modules only. | |
CLASS_METHODS = %i( | |
!= | |
< | |
<= | |
<=> |
This file contains 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
{-# LANGUAGE ForeignFunctionInterface #-} | |
module Main (main) where | |
import Foreign.C.Types (CDouble (..)) | |
foreign import ccall safe "math.h sin" c_sin :: CDouble -> CDouble | |
foreign import ccall safe "public.h square" c_square :: CDouble -> CDouble | |
foreign import ccall safe "private.h half" c_half :: CDouble -> CDouble |
This file contains 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
// http://taylor.fausak.me/2014/04/28/cloning-2048-in-haskell/ | |
import func Cocoa.rand | |
/* | |
Utilities | |
*/ | |
// TODO: Can this be generalized to allow anything addable? | |
func combine(array: Int[]) -> Int[] { |
This file contains 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.List (group) | |
import Data.Maybe (isJust) | |
import Data.Monoid ((<>)) | |
empty :: Int -> [Maybe Int] | |
empty = flip replicate Nothing | |
shift :: [Maybe Int] -> [Maybe Int] | |
shift v = take n (v' <> empty n) | |
where |
I hereby claim:
- I am tfausak on github.
- I am taylorfausak (https://keybase.io/taylorfausak) on keybase.
- I have a public key whose fingerprint is 1074 397C 56E3 4F1B FBDA 9D31 9C45 BE88 5CC1 680A
To claim this, I am signing this object:
https://github.com/tfausak/exercism-solutions/blob/master/haskell/binary/Binary.hs
module Binary
( toDecimal
) where
This file contains 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
class Run | |
attr_reader :state | |
attr_reader :exception | |
attr_reader :time | |
def initialize(state, exception = nil, time = nil) | |
@state = state | |
@exception = exception | |
@time = time.nil? ? Time.now : time | |
end |
This file contains 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
-- Purely Functional Data Structures | |
-- Exercise 5.1 | |
module Main | |
( Deque (Deque) | |
, empty | |
, isEmpty | |
, cons | |
, head | |
, tail |
This file contains 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
# coding: utf-8 | |
require 'stringio' | |
module Erudite | |
class Outcome | |
attr_reader :result | |
attr_reader :output | |
def initialize(result, output) |
OlderNewer