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
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| func a ()[]int { | |
| var arr [16]int | |
| for i := range arr { | |
| arr[i] = i |
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 atype = {a : int} | |
| type btype = {a : int; b : int} | |
| let accept {a = x} = x | |
| (* | |
| ---> val accept : btype -> int = <fun> | |
| select the last record type which contains the fields | |
| *) |
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
| ;; A Scheme-to-C compiler. | |
| ;; Author: Matthew Might | |
| ;; Site: http://matt.might.net/ | |
| ;; http://www.ucombinator.org/ | |
| ;; The purpose of this compiler is to demonstrate | |
| ;; the most direct possible mapping of Scheme into C. | |
| ;; Toward that end, the compiler uses only two | |
| ;; intermediate transformations: mutable-variable |
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
| #lang racket | |
| ; a simple example to deduce Y-combinator for factorial function | |
| ; author: Wei Chen([email protected]) | |
| ; 1. | |
| ; we can use lambda extraction to get reference to self | |
| (define f1 | |
| (lambda (fac) | |
| (lambda (x) |
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
| (* Parse a subset of regular expression, using recursive descent *) | |
| (* modified from https://code.google.com/p/sharable-stuff/ *) | |
| type regexp = | |
| | Empty_String | |
| | Char of char | |
| | Union of regexp * regexp | |
| | Concat of regexp * regexp | |
| | Star of regexp |
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
| #lang scheme | |
| ;; notes about Y combinator and related. | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; function never stop | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (define eternity | |
| (lambda (x) | |
| (eternity x))) |
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
| #include <vector> | |
| #include <list> | |
| #include <map> | |
| #include <set> | |
| #include <deque> | |
| #include <queue> | |
| #include <stack> | |
| #include <bitset> | |
| #include <algorithm> | |
| #include <functional> |
NewerOlder