diff --git a/collects/unstable/list.rkt b/collects/unstable/list.rkt index a7440692f9..206a8c58bf 100644 --- a/collects/unstable/list.rkt +++ b/collects/unstable/list.rkt @@ -33,7 +33,7 @@ prefix)) (define (drop-common-prefix as bs #:same? [same? equal?]) - (let-values ([(atail btail) (internal-split-common-prefix as bs same? #f)]) + (let-values ([(prefix atail btail) (internal-split-common-prefix as bs same? #f)]) (values atail btail))) (provide/contract diff --git a/collects/unstable/scribblings/class-iop.scrbl b/collects/unstable/scribblings/class-iop.scrbl index 2af6c20d4f..372d7888aa 100644 --- a/collects/unstable/scribblings/class-iop.scrbl +++ b/collects/unstable/scribblings/class-iop.scrbl @@ -9,7 +9,7 @@ @title[#:tag "class-iop"]{Interface-Oriented Programming for Classes} @(define the-eval (make-base-eval)) -@(the-eval '(require racket/class unstable/class-iop)) +@(the-eval '(require racket/class unstable/class-iop (for-syntax racket/base))) @defmodule[unstable/class-iop] @@ -127,4 +127,18 @@ should be fixed. } +@defform[(define-interface-expander id transformer-expr)]{ + +Defines @racket[id] as a macro that can be used within +@racket[define-interface] forms. + +@examples[#:eval the-eval +(define-interface-expander stack-methods + (lambda (stx) #'[empty? push pop])) +(define-interface stack<%> () + ((stack-methods))) +(interface->method-names stack<%>) +] +} + @close-eval[the-eval] diff --git a/collects/unstable/scribblings/list.scrbl b/collects/unstable/scribblings/list.scrbl index ac8a423c40..c7378148b2 100644 --- a/collects/unstable/scribblings/list.scrbl +++ b/collects/unstable/scribblings/list.scrbl @@ -27,6 +27,41 @@ ] } +@defproc[(take-common-prefix [l list?] [r list?] + [#:same? same? equal?]) + list?]{ + + Returns the longest common prefix of @racket[l] and @racket[r]. + +@examples[#:eval the-eval +(take-common-prefix '(a b c d) '(a b x y z)) +] +} + +@defproc[(drop-common-prefix [l list?] [r list?] + [#:same same? equal?]) + (values list? list?)]{ + + Returns the tails of @racket[l] and @racket[r] with the common + prefix removed. + +@examples[#:eval the-eval +(drop-common-prefix '(a b c d) '(a b x y z)) +] +} + +@defproc[(split-common-prefix [l list?] [r list?] + [#:same? same? equal?]) + (values list? list? list?)]{ + + Returns the longest common prefix together with the tails of + @racket[l] and @racket[r] with the common prefix removed. + +@examples[#:eval the-eval +(split-common-prefix '(a b c d) '(a b x y z)) +] +} + @addition{Sam Tobin-Hochstadt} @defproc[(filter-multiple [l list?] [f procedure?] ...) (values list? ...)]{