On Sunday, January 10, 2016 at 4:44:57 PM UTC-5, David K. Storrs wrote:
> I feel like I'm starting to be somewhat functional with Racket, but I'd like 
> to get more idiomatic.  I'd appreciate it if people would critique the 
> following code:
> 
> 
> (define (data/fetch s key-list)
>   (if (or (empty? s)
>           (nor (list? s)
>                (hash? s)))

I'm not the one to answer about what is idiomatic Racket, but I'd probably be 
using (cond).

  (cond
    [(hash? s)..]
    [(pair? s)...]
    [ else ...])

Also, you probably want a 4th parameter to hash-ref for failed lookup.

More than anything, thanks for using (nor).  I did not know of it beforehand.

JG




-- 
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