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
/* compile with: | |
on linux: gcc -g stack_traces.c | |
on OS X: gcc -g -fno-pie stack_traces.c | |
on windows: gcc -g stack_traces.c -limagehlp | |
*/ | |
#include <signal.h> | |
#include <stdio.h> | |
#include <assert.h> |
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 HasStmt a where | |
class HasDef a where | |
class HasExpr a where | |
data Module = Module [ParsedDef] | |
data ParsedDef = ParsedDef (Definition ParsedStmt) SourcePos | |
data ParsedStmt = ParsedStmt (Statement ParsedDef ParsedStmt ParsedExpr) SourcePos | |
data ParsedExpr = ParsedExpr (Expr ParsedExpr) SourcePos |
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 DeriveFunctor | |
, DeriveFoldable | |
, DeriveTraversable #-} | |
import Control.Applicative | |
import Data.Foldable | |
import Data.Traversable | |
import Prelude hiding (sum) |
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
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
/* | |
This is our integer linked list type (Null is an empty list) | |
(it is immutable, note the consts) | |
*/ | |
typedef struct IntList_s const * const IntList; |
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
source "http://rubygems.org" | |
gem "my_awesome_lib", :path => "../my_awesome_lib" | |
# or to use directly from a git repository: | |
# gem "my_awesome_lib", :git => "git://path/to/git/repo/my_awesome_lib.git", :branch => "1.0" | |
# or just use as a gem (perhaps from your very own gem source): | |
# gem "my_awesome_lib", ">= 1.0.0" |
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
#include "DetectDanger.h" | |
bool Detect_Ship_In_Danger(bool * const in_danger, | |
Position2D const detector1_pos, | |
Direction2D const detector1_ship_direction_time1, | |
Direction2D const detector1_ship_direction_time2, | |
Position2D const detector2_pos, | |
Direction2D const detector2_ship_direction_time1, | |
Direction2D const detector2_ship_direction_time2, | |
Position2D const hazard_pos, |
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 Rank2Types | |
, RebindableSyntax | |
, ImplicitParams | |
, NoMonomorphismRestriction #-} | |
import Data.Maybe | |
import Data.Function | |
import Data.String | |
import Prelude (undefined, error, String, (++)) |
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
def arctan(n, x): | |
if x > 1.0: | |
return math.pi/2.0 - my_preferred_arctan_implementation(n, 1/x) | |
else: | |
return my_preferred_arctan_implementation(n, x) |
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
let result = do | |
account <- getAccount person | |
lastTransaction <- getLastTransaction account | |
getAmount lastTransaction | |
case result of | |
Nothing -> putStrLn "Oh noes!" | |
Just a -> putStrLn ("The amount was: " ++ show a) | |
-- Or really, I'd actually do this: |
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 GeneralizedNewtypeDeriving #-} | |
module Language.TheExperiment.AST where | |
import Text.Parsec.Pos | |
import Language.TheExperiment.Type | |
data Literal = StringLiteral String | |
| CharLiteral Char | |
| IntegerLiteral Integer |