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
#!/bin/bash | |
usage() { | |
1>&2 cat <<EOS | |
Usage: ${0} --work-dir SVN_WORK_DIR --repo SVN_REPOS_URL --user SVN_USER:SVN_PASSWORD | |
EOS | |
} | |
log() { |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <limits.h> | |
unsigned short calc(unsigned short u) | |
{ | |
return u ^ (u >> 1); | |
} | |
void print_bits(unsigned short u, unsigned short v) |
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
-module(concurrent1). | |
-export([pong/0, ping/1, start/1]). | |
pong() -> | |
receive | |
{From, Msg} -> | |
io:format("Pong received ~w~n", [Msg]), | |
From ! {self(), Msg}, | |
pong(); | |
term -> |
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
namespace Monad | |
{ | |
interface IEither<out E, V> {} | |
public class Either<E, V> : IEither<E, V> | |
{ | |
public readonly E Error; | |
public V Value { get; private set; } | |
public bool HasError { get; private set; } | |
public Either(E error) | |
{ |
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
namespace Example | |
module Main = begin | |
open Monad.Maybe; | |
let maybeString (s:string) = | |
if s = null || s.Length = 0 then Nothing | |
else Just s; | |
let a2A (s: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
namespace System.Monad | |
{ | |
public class Error | |
{ | |
private Error() { } | |
public sealed class ErrorM<A> : Error, IMonad<A, Error> | |
{ | |
public IMonad<B, Error> Return<B>(B val) | |
{ | |
return new ErrorM<B> { Value = val, Exc = default(Exception), HasError = false }; |
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
namespace System.Monad | |
{ | |
// Monad m => m A | |
// e.g. Maybe Int when m = Maybe and A = Int | |
public interface IMonad<A, M> | |
{ | |
// Monad m => b -> m b | |
IMonad<B, M> Return<B>(B val); | |
// Monad m => m a -> (a -> m b) -> m b | |
IMonad<B, M> Bind<B>(Func<A, IMonad<B, M>> f); |
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
public class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string str = "Hello work!"; | |
Test(str, | |
error => | |
{ | |
Console.WriteLine(error.Message); | |
Console.ReadLine(); |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
int main(void) | |
{ | |
int i; | |
std::vector<int> v; | |
while (std::cin >> 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
use std::io::Timer; | |
use std::io::timer; | |
use std::time::duration::Duration; | |
fn main() { | |
let (sc1, rc1) = channel(); | |
let (sc2, rc2) = channel(); | |
let mut timer = Timer::new().unwrap(); | |
let timeout1 = timer.oneshot(Duration::milliseconds(1000)); |