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
Eugene needs your help |
We can't make this file beautiful and searchable because it's too large.
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
title,cast,director,overview |
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
#lang typed/racket | |
(require typed/rackunit) | |
(define-type ExprC (U Real Symbol String LamC AppC IfC SetC)) | |
(struct LamC ([params : (Listof Symbol)] [body : ExprC]) #:transparent) | |
(struct AppC ([fun : ExprC] [args : (Listof ExprC)]) #:transparent) | |
(struct IfC ([test : ExprC] [thn : ExprC] [els : ExprC]) #:transparent) | |
(struct SetC ([var : Symbol] [newval : ExprC]) #:transparent) | |
(define-type Value (U Real Boolean String CloV PrimV ArrayV)) |
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
// A* pseudocode from the wikipedia article | |
function A*(start, goal) | |
// The set of nodes already evaluated | |
closedSet := {} | |
// The set of currently discovered nodes that are not evaluated yet. | |
// Initially, only the start node is known. | |
openSet := {start} | |
// For each node, which node it can most efficiently be reached from. |
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
PID COMM STATE | |
1 systemd INT | |
2 kthreadd INT | |
3 rcu_gp OTHER | |
4 rcu_par_gp OTHER | |
5 kworker/0:0 OTHER | |
6 kworker/0:0H OTHER | |
7 kworker/u4:0 OTHER | |
8 mm_percpu_wq OTHER | |
9 ksoftirqd/0 INT |
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
;; Test parse | |
(check-equal? (parse 10) (vc 10)) | |
(check-equal? (parse -10) (vc -10)) | |
(check-equal? (parse '{+ 10 5}) (appC (idC '+) (list (valueC (realV 10)) (valueC (realV 5))))) | |
(check-equal? (parse '{+ 10 {+ 2 3}}) (appC (idC '+) (list (valueC (realV 10)) (appC (idC '+) | |
(list (valueC (realV 2)) | |
(valueC (realV 3))))))) | |
(check-equal? (parse '{* 10 5}) (appC (idC '*) (list (valueC (realV 10)) (valueC (realV 5))))) | |
(check-equal? (parse '{* 10 {+ 2 3}}) (appC (idC '*) (list (valueC (realV 10)) (appC (idC '+) | |
(list (valueC (realV 2)) |
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
;; Turn an s-expression in to an AST using the ExpressionC elements defined above. | |
(define (parse [expression : Sexp]) : ExprC | |
(match expression | |
[(? real? value) (numC (realV value))] | |
[(list 'ifleq0 condition if-block else-block) | |
(ifleq0C (parse condition) (parse if-block) (parse else-block))] | |
[(? symbol? value) (idC value)] | |
[(list 'fn (list (? symbol? arguments) ...) body) (lambdaC (cast arguments (Listof Symbol)) (parse body))] | |
[(list 'let (? list? arguments) ... 'in (? list? body)) | |
(appC (lambdaC (get-let-arg-symbols (cast arguments (Listof Sexp))) (parse body)) |
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 unittest | |
import filecmp | |
from concordance import * | |
class TestList(unittest.TestCase): | |
def test_01(self): | |
conc = Concordance() | |
conc.load_stop_table("stop_words.txt") | |
conc.load_concordance_table("file1.txt") |
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 unittest | |
from hash_quad import * | |
class TestList(unittest.TestCase): | |
def test_01a(self): | |
ht = HashTable(7) | |
self.assertEqual(ht.get_table_size(), 7) | |
def test_01b(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
import unittest | |
import random | |
from heap import * | |
class TestHeap(unittest.TestCase): | |
def test_01_enqueue(self): | |
"""Test simple enqueue operations and build heap""" | |
test_heap = MaxHeap(7) | |
test_heap.build_heap([2, 9, 7, 6, 5, 8]) | |
insert = test_heap.enqueue(10) |
NewerOlder