-*- mode:org ; mode:visual-line -*-
Hack && Tell 6 Boston
Specifically a “step debugger”?
A program that runs your program, letting you
- Pause execution (“break”) at steps of its evaluation (“breakpoints”)
| Say that /tmp/ex.rkt is | |
| #lang racket | |
| (define x 42) | |
| x | |
| Now: | |
| $ racket | |
| Welcome to Racket v6.10. |
| #lang racket/base | |
| (require racket/match) | |
| (define (combining xs pred?) | |
| (let loop ([xs xs]) | |
| (match xs | |
| [(list* (? pred? this) (? pred? next) more) | |
| (loop (cons (string-append this next) more))] | |
| [(cons this more) |
| (url | |
| "http" | |
| #f | |
| "bttracker.debian.org" | |
| 6969 | |
| #t | |
| (list (path/param "announce" '())) | |
| '((info_hash . ";\u001D��x\u000E���S���zc�R�1�") | |
| (peer_id . "-TR4940-i750j7wqz8tu") | |
| (uploaded . "0") |
| #lang racket/base | |
| (define (expensive-or-complicated v) | |
| v) ;not really, but for example | |
| (for*/list ([x (in-list '(1 2 3 4))] | |
| [y (in-value (expensive-or-complicated x))] | |
| #:unless (odd? y)) | |
| y) | |
| ;; '(2 4) |
| #lang racket/base | |
| (module m racket/base | |
| (provide (struct-out exn:fail) | |
| (rename-out [exn-message exn:fail-message] | |
| [exn-continuation-marks exn:fail-continuation-marks]))) | |
| (require 'm) | |
| (define e (exn:fail "foo" (current-continuation-marks))) |
| #lang racket/base | |
| (require racket/match | |
| net/dns) | |
| (provide validate-address) | |
| (define (validate-address s) | |
| (match s | |
| [(regexp "^([^@]+)@(.+)$" (list _ user domain)) |
| #lang racket/base | |
| (require racket/format | |
| racket/list | |
| racket/match | |
| racket/trace) | |
| (provide (all-defined-out) | |
| (all-from-out racket/trace)) |
| modified index.rkt | |
| @@ -12,12 +12,14 @@ | |
| (for-label racket/syntax)) | |
| @(define evaluator | |
| (parameterize ([sandbox-output 'string] | |
| - [sandbox-error-output 'string]) | |
| + [sandbox-error-output 'string] | |
| + [sandbox-memory-limit 100]) | |
| (make-evaluator 'racket))) | |
| ;; A fairly simple Racket program like this: | |
| (module m racket/base | |
| (define (f xs) | |
| (for/list ([x (in-list xs)]) | |
| (add1 x))) | |
| (f '(1 2 3 4))) | |
| ;; Fully expanded with: | |
| ;; | |
| ;; (println (syntax->datum (expand (with-input-from-file "foo.rkt" read-syntax)))) |