PasteRack.org
Paste # 47835
2019-06-10 18:27:41

Fork as a new paste.

Paste viewed 400 times.


Embed:

  1. #lang racket
  2.  
  3. (define (mountainClimb next total)
  4.     (cond
  5.     [(< total 0) -1]
  6.     [(string=? next "+") (+ total 1)]
  7.     [(string=? next "-") (- total 1)])
  8. )
  9.  
  10. (= 0 (foldr mountainClimb 0 (list "+")))

=>

#f