-*- 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”)
#lang racket/base | |
(require openssl | |
racket/contract) | |
(provide ports->tls-ports/accept | |
ports->tls-ports/connect) | |
(define pem (build-path (collection-path "openssl") "test.pem")) | |
(define server-ctx (ssl-make-server-context 'tls12)) |
#lang racket/base | |
(require racket/format | |
racket/list | |
racket/match | |
racket/trace) | |
(provide (all-defined-out) | |
(all-from-out racket/trace)) |
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 | |
;; The way to catch exceptions is `with-handlers`. | |
;; See http://docs.racket-lang.org/reference/exns.html | |
;; | |
;; You specify the type of exception, and a function to handle it. The | |
;; exception object is passed to the function. | |
;; | |
;; For exmaple, we'll catch the "generic" `exn:fail?` with a function | |
;; that we define in-place using `lambda`: |