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 planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-from-real-imag x y) | |
| (define (dispatch op) | |
| (cond ((eq? op 'real-part) x) | |
| ((eq? op 'imag-part) y) | |
| ((eq? op 'magnitude) |
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 planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| ;; type-tag, contents, attach-tag | |
| (define (attach-tag tag contents) | |
| (if (number? contents) | |
| contents |
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 planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (put x) x) | |
| (define (get x) x) | |
| (define (square x) (* x x)) | |
| ;; type-tag, contents, attach-tag | |
| (define (attach-tag tag contents) |
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 planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (put x) x) | |
| (define (get x) x) | |
| (define (square x) (* x x)) | |
| ;; type-tag, contents, attach-tag | |
| (define (attach-tag tag contents) |
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 planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (put x) x) | |
| (define (get x) x) | |
| (define (get-coercion x) x) | |
| (define (put-coercion x) x) | |
| (define (square x) (* x 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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (put x) x) | |
| (define (get x) x) | |
| (define (get-coercion x) x) | |
| (define (put-coercion x) x) | |
| (define (square x) (* x 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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (put x) x) | |
| (define (get x) x) | |
| (define (get-coercion x) x) | |
| (define (put-coercion x) x) | |
| (define (square x) (* x 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
| (restart 1) | |
| (load "stream.scm") | |
| (define (stream-map proc . argstreams) | |
| (if (stream-null? (car argstreams)) | |
| the-empty-stream | |
| (let ((s1 (apply proc (map stream-car argstreams)))) | |
| (display s1) | |
| (cons-stream | |
| s1 |
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 main() { | |
| ch := make(chan int, 2) | |
| ch <- 1 | |
| ch <- 2 | |
| fmt.Println(<-ch) | |
| fmt.Println(<- ch) |
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 ( | |
| "flag" | |
| "github.com/alecthomas/template" | |
| "net/http" | |
| "log" | |
| ) | |
| var addr = flag.String("addr", ":1718", "http service addresses") |