PasteRack.org
Paste # 38359
2022-11-18 06:37:32

Fork as a new paste.

Paste viewed 1353 times.


Embed:

Estables

  1. #lang racket
  2.  
  3. (define (estables list value fM fm)
  4.   (define (helper xs countM countm)
  5.     (cond
  6.       [(empty? xs) (cons countM (cons countm empty))]
  7.       [(> (fM (car xs)) value) (helper (cdr xs) (+ countM 1) countm)]
  8.       [(< (fm (car xs)) value) (helper (cdr xs) countM (+ countm 1))]
  9.       [else (helper (cdr xs) countM countm)]))
  10.   (helper list 0 0))
  11.  

=>