[racket] unwrapping a list
A few minutes ago, Jordan Schatz wrote:
>
> Is there a way to unwrap or explode a list? I don't see it in the
> docs, but it seems like it would be a common thing.
>
> This is what I want to do:
>
> (define-values (year month day)
> (regexp-split #rx"/" "2012/06/06"))
>
> But regexp-split returns a list, not values, so I'd like to "unwrap"
> the list and just have the values...
(match-define (list year month day)
(regexp-split #rx"/" "2012/06/06"))
> (let ([year month day (regexp-split #rx"/" "2012/06/06")])
> )
> Would be handy too...
(match-let ([(list year month date)
(regexp-split #rx"/" "2012/06/06")])
year)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!