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
(load "./p202-generic-alithmetic.scm") | |
(define (attach-tag tag-type contents) | |
(if (eq? tag-type 'scheme-number) | |
contents | |
(cons tag-type contents))) | |
(define (type-tag datum) | |
(cond ((number? datum) 'scheme-number) | |
((pair? datum) (car datum)) | |
(else (error "Bad tagged datum -- TYPE-TAG" datum)))) |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "mechanize" | |
gem "nokogiri" | |
gem "tomlrb" |
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
sealed trait List[+A] | |
case object Nil extends List[Nothing] | |
case class Cons[+A](head:A, tail:List[A]) extends List[A] | |
object List { | |
def foldr[A,B](l: List[A], z: B)(f: (A, B) => B): B = l match { | |
case Nil => z | |
case Cons(h, t) => f(h, foldr(t, z)(f)) | |
} | |
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
class Young | |
MAX = 2 ** 32 - 1 | |
def initialize m, n, arr=[] | |
@bottom = m - 1 | |
@right = n - 1 | |
@tbl = Array.new m | |
m.times {|i| @tbl[i] = Array.new n, MAX } | |
arr.each {|x| insert x } | |
end |
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
module Command | |
C_NONE = 0 | |
C_ARITHMETIC = 1 | |
C_PUSH = 2 | |
C_POP = 3 | |
C_LABEL = 4 | |
C_GOTO = 5 | |
C_IF = 6 | |
C_FUNCTION = 7 | |
C_RETURN = 8 |
NewerOlder