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 racket/base | |
(require racket/future racket/flonum) | |
(let ((f0 | |
(future | |
(λ () | |
(let ((i 1)) | |
(unless (zero? i) | |
(if (fl< | |
(apply | |
fl- |
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 racket/base | |
(require racket/future racket/flonum) | |
(let ((f0 | |
(future | |
(λ () | |
(let loop ((i 1)) | |
(unless (zero? i) | |
(if (fl< | |
(apply | |
fl- |
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 racket/base | |
;(require racket/promise) | |
(require (for-syntax racket/base) racket/unsafe/undefined racket/unsafe/ops) | |
(define-syntax-rule (delay e) (lambda () e) | |
#; | |
(let ([v unsafe-undefined]) | |
(lambda () (if (eq? v unsafe-undefined) | |
(begin (set! v e) v) | |
v)))) | |
(define-syntax-rule (force e) (e)) |
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 errortrace racket/base | |
(require racket/gui) | |
(define (unpack-submission str) | |
(let* ([base (make-object editor-stream-in-bytes-base% str)] | |
[stream (make-object editor-stream-in% base)] | |
[definitions-text (make-object text%)] | |
[interactions-text (make-object text%)]) | |
(read-editor-version stream base #t) |
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 racket | |
(define (matrix m n) | |
(if (= 1 m) | |
(for/list ((a (in-range 1 (+ n 1)))) | |
(list a)) | |
(let ((downstream (matrix (- m 1) n))) | |
(for*/list ((a (in-range 1 (+ n 1))) | |
(b (in-list downstream))) | |
(cons a b))))) |
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 racket/base | |
(require (for-syntax racket/base)) | |
(module base racket/base | |
(provide f) | |
(define (f x) (sync x))) | |
(module r racket/base | |
(provide f) | |
(dynamic-require 'racket #f) | |
(define (f x) (sync x))) |
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
;; The first three lines of this file were inserted by DrRacket. They record metadata | |
;; about the language level of this file in a form that our tools can easily process. | |
#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname h2111082019-final) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) | |
;; Questions | |
;; Lists | |
;; Space Invaders! | |
(require 2htdp/image) | |
(define background (empty-scene 200 200)) |
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 racket/base | |
(define N 10000000) | |
(unless (fixnum? (* 100 N)) (error 'fail)) | |
(require futures-sort racket/fixnum racket/vector) | |
(define fxv (for/fxvector #:length N | |
([_ (in-range N)]) |
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 racket/base | |
(require racket/future) | |
(define N 100000000) | |
(define v (for/vector #:length N ([i N]) i)) | |
(define (sum-vec v) | |
(for/sum ([i (in-vector v)]) i)) | |
;(time (+ (sum-vec v) (sum-vec v))) | |
(define t1 (current-process-milliseconds)) |
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 scribble/base | |
@title[#:style (list 'hidden 'toc-hidden 'no-toc)]{a} | |
foo | |
foo | |
@include-section["testsect.scrbl"] | |
@section[#:style (list 'hidden 'toc-hidden 'no-toc)]{b} |