Advertisement
Guest User

Untitled

a guest
Nov 6th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.32 KB | None | 0 0
  1. (define (helper l current count)
  2.   (cond
  3.     [(and (null? l) (= count 0)) '()]
  4.     [(and (null? l) (not (= count 0))) (list count current)]
  5.     [(= (car l) current) (helper (cdr l) current (+ 1 count))]
  6.     [else (append (list count current) (helper l (car l) 0))]))
  7.  
  8. (define (next-look-and-say l)
  9.   (helper l (car l) 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement