You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
473 B
Racket
18 lines
473 B
Racket
#lang typed/racket/base
|
|
(provide (all-defined-out))
|
|
|
|
;; Typed versions of common library functions, to avoid require/typed
|
|
|
|
(: empty? (Any . -> . Boolean : Null))
|
|
(define (empty? l)
|
|
(null? l))
|
|
|
|
(: empty Null)
|
|
(define empty '())
|
|
|
|
#;(: flatten (Any . -> . (Listof Any)))
|
|
#;(define (flatten orig-sexp)
|
|
(let loop ([sexp orig-sexp] [acc null])
|
|
(cond [(null? sexp) acc]
|
|
[(pair? sexp) (loop (car sexp) (loop (cdr sexp) acc))]
|
|
[else (cons sexp acc)]))) |