This file contains hidden or 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 rec split = function | |
| [] -> ([], []) | |
| [a] -> ([a], []) | |
| a::b::cs -> let (M,N) = split cs in (a::M, b::N) | |
let rec merge = function | |
| ([], ys) -> ys | |
| (xs, []) -> xs | |
| (x::xs, y::ys) -> if x < y then x :: merge (xs, y::ys) | |
else y :: merge (x::xs, ys) |
This file contains hidden or 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
type Exp = | |
| Num of int //number of integers | |
| Neg of Exp //negation | |
| Sum of Exp * Exp //sum | |
| Diff of Exp * Exp //difference | |
| Prod of Exp * Exp //product | |
| Quot of Exp * Exp;; //quotient | |
let rec evaluate = function | |
| Num n -> Some n |
This file contains hidden or 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 rec inner xs ys = | |
match xs, ys with | |
| [], [] -> 0 | |
| [], ys -> 0 | |
| xs, [] -> 0 | |
| x::xs, y::ys -> x * y + inner xs ys;; | |
(* | |
The head of the first list (xs) gets multiplied | |
by the head of the second list (ys). | |
We add the next call to this value and recursion |
This file contains hidden or 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 os | |
import sys | |
import binascii | |
from itertools import chain, izip, repeat, islice | |
# this program is compatible with python 2.7.8 | |
# interspace function | |
def intersperse(delimiter, seq): | |
return islice(chain.from_iterable(izip(repeat(delimiter), seq)), 1, None) |
This file contains hidden or 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
// Fill out your copyright notice in the Description page of Project Settings. | |
using System; | |
using System.IO; | |
using UnrealBuildTool; | |
public class codevr : ModuleRules | |
{ | |
public codevr(ReadOnlyTargetRules Target) : base(Target) | |
{ | |
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; |
This file contains hidden or 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
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 14, | |
// font family with optional fallbacks |
This file contains hidden or 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::time::{Instant}; | |
fn permute_eight_bits(ten_bit: u16) -> u8 | |
{ | |
// P8[6 3 7 4 8 5 10 9] | |
// P8[5 2 6 3 7 4 9 8] (-1) | |
let mut permuted_byte = 0b0000_0000_0000_0000; | |
let p_eight: [(u16,u16);8] = [(5, 0b0000_0000_0010_0000), | |
(2, 0b0000_0000_0000_0100), |
This file contains hidden or 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
fn main() { | |
let byte: u8 = 0b1001_0110; | |
let mut high: u8 = 0b0000_0000; | |
let mut low: u8 = 0b0000_0000; | |
/* | |
(1 << 0) -> 0000 0001 | |
(1 << 1) -> 0000 0010 | |
(1 << 2) -> 0000 0100 |
This file contains hidden or 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
fn main() | |
{ | |
//switch boxes | |
let sbox_zero = [[1,0,3,2], | |
[3,2,1,0], | |
[0,2,1,3], | |
[3,1,3,2]]; | |
let sbox_one = [[0,1,2,3], | |
[2,0,1,3], |
This file contains hidden or 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
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced |
NewerOlder