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 <cstdio> | |
void swap(int & a, int & b) | |
{ | |
a = a ^ b; | |
b = a ^ b; | |
a = a ^ b; | |
} | |
int main() |
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 itertools | |
# tstime(https://bitbucket.org/gsauthof/tstime) is used to measure the performance. | |
# OS: Archlinux 3.6.10-1 | |
# Python Version: 2.7.3 | |
# PyPy Version: 2.0.0-beta1 | |
c = 0 | |
for (i, j) in itertools.product(range(10000), repeat=2): | |
c += i * j |
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
I, the contributor, agree to licence my contributions to the Scala-Forklift project under the terms of the Apache 2.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
{-# LANGUAGE GADTs, DataKinds, KindSignatures, TypeFamilies #-} | |
module Vector where | |
data Nat = Z | S Nat | |
data Vec :: * -> Nat -> * where | |
Nil :: Vec a Z | |
Cons :: a -> Vec a n -> Vec a (S n) |
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
package dependent | |
import scala.language.implicitConversions | |
import shapeless._, shapeless.nat._ | |
object Vector { | |
trait Vec[+A, N <: Nat] | |
case object Nil extends Vec[Nothing, _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 <stdio.h> | |
#include <string.h> | |
#define MAX_SQUARE 57521883 | |
#define C1 4617 | |
#define C2 73 | |
#define C3 36936 | |
#define C4 262657 | |
#define C5 2134536 | |
#define C6 16810048 |