Move chomp
function into its own util file
This commit is contained in:
parent
f0ebfee9ac
commit
4d448785cd
|
@ -0,0 +1,11 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide chomp)
|
||||
|
||||
;; removes newline (if any) at end of string
|
||||
(define (chomp str)
|
||||
(define len (string-length str))
|
||||
(if (eq? #\newline (string-ref str (sub1 len)))
|
||||
(substring str 0 (sub1 len))
|
||||
str))
|
||||
|
|
@ -6,6 +6,7 @@ don't depend on any other portion of the system
|
|||
|#
|
||||
|
||||
(require syntax/source-syntax "disappeared-use.rkt"
|
||||
"string.rkt"
|
||||
racket/list racket/match racket/promise racket/string
|
||||
syntax/parse (for-syntax racket/base syntax/parse)
|
||||
(only-in unstable/sequence in-slice))
|
||||
|
@ -163,13 +164,6 @@ don't depend on any other portion of the system
|
|||
(apply tc-error/delayed #:stx stx final-msg (reverse vals))
|
||||
(apply tc-error/stx stx final-msg (reverse vals))))
|
||||
|
||||
;; helper for above, remove \n at end if any
|
||||
(define (chomp str)
|
||||
(define len (string-length str))
|
||||
(if (eq? #\newline (string-ref str (sub1 len)))
|
||||
(substring str 0 (sub1 len))
|
||||
str))
|
||||
|
||||
;; produce a type error, using the current syntax
|
||||
(define (tc-error msg . rest)
|
||||
(let* ([ostx (current-orig-stx)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user