Skip to content

Instantly share code, notes, and snippets.

@jackfirth
Last active December 15, 2020 04:53
Show Gist options
  • Save jackfirth/c4d66bd7378aa3ef4e9576eda0c094a9 to your computer and use it in GitHub Desktop.
Save jackfirth/c4d66bd7378aa3ef4e9576eda0c094a9 to your computer and use it in GitHub Desktop.
The worst racket string program
#lang racket/base
(require racket/unsafe/ops)
(define s1 (string-append))
(define s2 (string-append))
(immutable? s1) ; false
(immutable? s2) ; false
(eq? s1 s2) ; true (!!!)
(unsafe-string->immutable-string! s1) ; changes s1 to immutable and returns s1
(immutable? s1) ; true
(immutable? s2) ; true (!!!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment