> On Jan 17, 2019, at 2:39 PM, David Storrs <david.sto...@gmail.com> wrote:
> 
> it would be nice to be able to do some slicing and dicing in the
> parsing pattern as opposed to doing it manually afterwards.  Is there
> a way to do it?




#lang racket
(struct spec (type mode) #:transparent) ; cf 'cipher-spec' in crypto module
(define s (spec "aes" "cbc"))

(define-values (type mode cipher-descriptor)
  (match s
    [(struct* spec ([type (app string->symbol type)]
                    [mode (app  string->symbol mode)]))
     (values type mode (list type mode))]))

type ; 'aes
mode ; 'cbc
cipher-descriptor ; '(aes cbc)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to