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
type 'a tree = Empty | Node of 'a * 'a tree * 'a tree | |
module type SUM = sig | |
val sum : int tree -> int | |
end | |
(* | |
1. Normal Recursive tree sum. | |
*) | |
module Recursive : SUM = struct |
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
Inductive regex : Set := | |
| Zero : regex | |
| Eps : regex | |
| Nat : nat -> regex | |
| Cat : regex -> regex -> regex | |
| Or : regex -> regex -> regex. | |
Fixpoint nullableT (r : regex) : Type := | |
match r with |
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
interface Group a where | |
(<*>) : a -> a -> a | |
inv : a -> a | |
e : a | |
lAssoc : (x <*> y) <*> z = x <*> (y <*> z) | |
rAssoc : x <*> (y <*> z) = (x <*> y) <*> z | |
lId : e <*> x = x | |
rId : x <*> e = x | |
lInv : inv x <*> x = e | |
rInv : x <*> inv x = e |
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
using System; | |
using System.Linq; | |
namespace Learn | |
{ | |
public class Sorter | |
{ | |
public void PrintArray(int[] arr){ | |
Console.WriteLine(string.Join(",",arr)); | |
} |
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
char *a = "Hello, "; | |
int a_len = strlen(a); | |
//This? | |
char *b = calloc(a_len,1); | |
strncpy(b,a); | |
strncat(b,"World!",6); | |
//Or this? | |
char *b = calloc(a_len + 6,1); |