SMAWK algorithm in Racket