PasteRack.org
Paste # 75313
2018-06-14 15:01:40

Fork as a new paste.

Paste viewed 112 times.


Embed:

  1. #lang racket
  2.  
  3. (for/list ([i '("foo" "bar" "spam" eggs)]
  4.            #:when (string? i))
  5.   (match i
  6.     [(? string? s) (string-upcase s)]))
  7.  
  8. (for*/list ([i '("foo" "bar" "spam" eggs)]
  9.             [v (in-value (match i
  10.                            [(? string? s) (string-upcase s)]
  11.                            [_ #f]))]
  12.             #:when v)
  13.   v)

=>

'("FOO" "BAR" "SPAM")

'("FOO" "BAR" "SPAM")