Skip to content

Instantly share code, notes, and snippets.

Avatar

Greg Hendershott greghendershott

View GitHub Profile
View provide.rkt
;; provide.rkt
#lang racket/base
(module outer racket/base
(module inner racket/base
(define (foo x) x)
(define (bar x) x)
(provide foo bar))
View module-binding.rkt
#lang racket/base
(require racket/match
racket/path
racket/pretty
syntax/modread)
(define (expanded-module+symbol->identifier path-str exp-mod-stx sym)
;; (-> path-string? syntax? symbol? identifier?)
;;
View check-syntax-problem.org

I am seeing a problem where drracket/check-syntax show-content returns bad pathnames in syncheck:add-jump-to-definition items. It seems to happen only requires of relative path names.

Given a.rkt and b.rkt in the same dir:

#lang racket/base
(require "b.rkt")
provided-by-b
View framing.rkt
#lang racket/base
(require racket/require
(multi-in racket (contract function)))
(define executor (make-will-executor))
(void (thread (λ () (let loop () (will-execute executor) (loop)))))
(define frame? any/c)
View config.rkt
;; <base-name> is used both (1) to define a parameter named
;; current-<base-name> and (2) to get an environment variable named
;; "WEB_<BASE_NAME>" (note conversion of kebab-case to SNAKE_CASE).
(define-syntax-parser dp
[(_ base-name:id
default:expr
contract:expr
(~optional (~seq #:coerce coerce:expr) #:defaults ([coerce #'values]))
(~optional (~seq #:secret? secret?:boolean) #:defaults ([secret? #'#f])))
(with-syntax ([id-name (format-id #'base-name
View tls.rkt
#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))
View wsl.md

Let's say you want to run Emacs for Linux under Windows Subsystem for Linux. The following is what I have been trying, for about 48 hours as I write this. So, take this with a grain of salt. It is not meant to be a polished or comprehensive tutorial.

Do a vanilla WSL install

  • Install Windows Subsystem for Linux itself.

  • Install a distro from the Microsoft store, e.g. Ubuntu.

View hack-and-tell-6-boston.org

-*- mode:org ; mode:visual-line -*-

Hack && Tell 6 Boston

What is a “debugger”?

Specifically a “step debugger”?

A program that runs your program, letting you

  • Pause execution (“break”) at steps of its evaluation (“breakpoints”)
View gist:20b0011372d95813130da2dc6c507f53
Say that /tmp/ex.rkt is
#lang racket
(define x 42)
x
Now:
$ racket
Welcome to Racket v6.10.
View combining.rkt
#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)
You can’t perform that action at this time.