PasteRack.org
Paste # 97732
2020-07-16 09:35:57

Fork as a new paste.

Paste viewed 363 times.


Embed:

  1. #lang racket
  2.  
  3. (define name "charlie")
  4. (define feed-command "!feed")
  5. (define apple "apple")
  6.  
  7. (match "apple"
  8.   [(== feed-command) (print "feed and name")]
  9.   [(== name) (print "just name")]
  10.   [(== apple) (print "apple")]
  11.   [x #:when (and (equal? feed-command x) (equal? apple x))
  12.      (print "feed and apple")]
  13.   [_ (print "nope")])

=>

"apple"