-
Notifications
You must be signed in to change notification settings - Fork 25
Snippets
Alex Harsányi edited this page Feb 1, 2021
·
2 revisions
#lang racket
(require "al-interactive.rkt")
(define (walked-distance df)
(and (df-contains? df "dst" "grade")
(df-fold
df
'("dst" "grade")
0
(lambda (a p n)
(if (and p n)
(match-let ([(list pd pg) p]
[(list nd ng) n])
(if (and pd pg nd ng)
(+ a (* (- nd pd) (+ 1 (/ (abs ng) 100.0))))
a))
a)))))