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
    
  
  
    
  | function cond(...clauses) { | |
| for (let [test, e] of clauses) { | |
| if (eval(test)) { | |
| return eval(e); | |
| } | |
| } | |
| } | |
| let hi = "test"; | 
  
    
      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/base | |
| (require racket/generator) | |
| (define nat-gen | |
| (generator | |
| () | |
| (let loop ([x 0]) | |
| (yield x) | |
| (loop (add1 x))))) | |
| (define pos-gen | 
  
    
      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/base | |
| (require racket/match | |
| racket/list | |
| racket/sequence | |
| racket/random) | |
| (define (is l) | |
| (define (insert x ys) | |
| (match ys | |
| [(list) (list 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
    
  
  
    
  | const assert = require("assert"); | |
| module.exports = function extend(Extend, Interfaces, method) { | |
| assert(Extend !== undefined); | |
| assert(Extend instanceof Function); | |
| return function (prop) { | |
| // super | |
| const super_ = new Extend(prop); | |
| this.__proto__ = super_; | |
| // interface | 
  
    
      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 | |
| (define (f lst window-size step | |
| #:drop [drop? #t]) | |
| (if (< (length lst) window-size) | |
| (if drop? | |
| '() | |
| (list lst)) | |
| (cons (take lst window-size) | |
| (f (drop lst step) | 
  
    
      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 | |
| (require racket/random) | |
| (define target (stream->list (in-range 1000000 0 -1))) | |
| (define/match (q1 l) | |
| [('()) '()] | |
| [((cons pivot rest)) | |
| (define (less x) (< x pivot)) | |
| (define-values (l b) (partition less rest)) | 
  
    
      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 org.junit.Test | |
| import org.junit.Assert.* | |
| class Test2: | |
| @Test def t1(): Unit = { | |
| val t1 = Fork(1, Node(2), Node(3)) | |
| assertEquals(2, t1.accept(new Depth())) | |
| } | |
| @Test def t2(): Unit = { | 
  
    
      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 | |
| (require syntax/parse/define | |
| (for-syntax syntax/stx)) | |
| (define-for-syntax (subst stx m) | |
| (syntax-parse stx | |
| [(A a ...) | |
| #`(A #,@(stx-map (λ (b) (subst b m)) #'(a ...)))] | |
| [name:id (hash-ref m (syntax->datum #'name) stx)])) | 
  
    
      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 | |
| (require syntax/parse/define | |
| (rename-in racket/base | |
| [define origin-define]) | |
| (for-syntax syntax/transformer | |
| syntax/stx | |
| racket/string | |
| racket/syntax | |
| racket/list | 
  
    
      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 | |
| (require syntax/parse/define | |
| (for-syntax syntax/transformer)) | |
| (define-for-syntax (type-equal? t1 t2) | |
| (equal? (syntax->datum t1) (syntax->datum t2))) | |
| (define-for-syntax (check-type term type) | |
| (unless (type-equal? (typeof term) type) | |
| (raise-syntax-error 'type-mismatch |