ut 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...
I can do it
(define-values (year month day)
(apply values (regexp-split #rx"/" "2012/06/06")))
On 6/11/2012 12:24 PM, 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.
Racket Users list:
htt
(apply (lambda (year month day)
(printf "Year: ~S Month: ~S Day: ~S\n"
year
month
day))
(regexp-split #rx"/" "2012/06/06"))
Neil V.
Racket Users list:
http://lists.racket-lang.org/users
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 ret
You could use match or match-let, e.g.,
(match-let ([(list year month day) (regexp-split #rx"/" "2012/06/06")])
…)
http://docs.racket-lang.org/reference/match.html
On Jun 11, 2012, at 8:24 PM, Jordan Schatz wrote:
>
> Is there a way to unwrap or explode a list? I don't see it in the docs, bu
5 matches
Mail list logo