Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 std.stdio, std.typetuple, std.traits; | |
template maxexp(T, uint base, T acc = T.max, uint i = 0) | |
if (isIntegral!T && base > 1) | |
{ | |
static if (acc == 0) | |
{ | |
enum maxexp = i - 1; | |
} | |
else |
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 <unistd.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
long ntimes = 0; | |
char data[] = {'0', '1'}; | |
// llamadas de sistemas utilizadas: | |
// write, pthread_create, pthread_join, pthread_exit, exit |
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
data State = Q1 | Q2 deriving Show | |
data Sigma = Zer | One | Cee | Nan deriving Show | |
data Gamma = R | B | G deriving Show | |
delta _ _ [] = error "Finished!" | |
delta Q1 Zer (R:p) = (Q1, B:R:p) | |
delta Q1 Zer (B:p) = (Q1, B:B:p) | |
delta Q1 Zer (G:p) = (Q1, B:G:p) |
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 TypeFamilies #-} | |
import Control.Monad (mzero) | |
class Pushdown m where | |
data State m :: * | |
data Sigma m :: * | |
data Gamma m :: * | |
startState :: State m |
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
# iterable class | |
class naturals(object): | |
def __init__(self, top): | |
assert top >= 1, 'top >= 1' | |
self._cur = 1 | |
self._top = top | |
def __iter__(self): |
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
# hello. | |
def myrange(a, b): | |
r = [] | |
while a < b: | |
r.append(a) | |
a += 1 | |
return r | |
for x in myrange(0, 10): |
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 Program() = | |
let main argv = | |
printfn "%A" argv |
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
// lambda syntax; construction & call | |
int x = 0; | |
int y = 10; | |
[x, &y] (int z) { return x + (++y) + (++z); } (5); | |
// desugared | |
struct __lambda1 { | |
int x; | |
int &y; | |
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
from PIL import Image | |
from urllib.request import urlopen | |
from urllib.parse import quote_plus | |
import json | |
import io | |
import re | |
from random import choice | |
def first(xs): | |
for x in xs: |
OlderNewer