update sugar/list with values->list

pull/2/head
Matthew Butterick 11 years ago
parent 3d3a227ff7
commit 5c1a4dc5fe

@ -69,4 +69,10 @@
(define-syntax (when/splice stx)
(syntax-case stx ()
[(_ test body)
#'(if test (list body) '())]))
#'(if test (list body) '())]))
(provide values->list)
(define-syntax (values->list stx)
(syntax-case stx ()
[(_ values-expr) #'(call-with-values (λ () values-expr) list)]))

@ -9,8 +9,7 @@
"list.rkt"
"misc.rkt"
"string.rkt"
"len.rkt"
"values.rkt")
"len.rkt")
(provide
(all-from-out
@ -22,5 +21,4 @@
"list.rkt"
"misc.rkt"
"string.rkt"
"len.rkt"
"values.rkt"))
"len.rkt"))

@ -3,7 +3,7 @@
@(require scribble/eval (for-label racket sugar))
@(define my-eval (make-base-eval))
@(my-eval `(require sugar))
@(my-eval `(require sugar racket/list))
@title{List}
@defmodule[sugar/list]
@ -82,3 +82,11 @@ A special version of @racket[when] that you can use inside @racket[quasiquote] t
`(,@(when/splice (even? 2) "hooray"))
`(,@(when/splice (even? 3) "hooray"))
]
@defform[(values->list values)]
Convert @racket[_values] to a simple list.
@examples[#:eval my-eval
(split-at '(a b c d e f) 3)
(values->list (split-at '(a b c d e f) 3))
]

@ -1,13 +0,0 @@
#lang racket/base
(require (for-syntax racket/base))
(provide (all-defined-out))
(define-syntax (values->list stx)
(syntax-case stx ()
[(_ values-expr) #'(call-with-values (λ () values-expr) list)]))
(define-syntax (apply-values stx)
(syntax-case stx ()
[(_ proc values) #'(apply proc (values->list values))]))
Loading…
Cancel
Save