Guest User

Untitled

a guest
Oct 14th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.34 KB | None | 0 0
  1. #lang racket
  2.  
  3. (require rackunit)
  4.  
  5. ;;;Takes transitions in form of '((A B C)...)
  6. ;;;outputs hashtable in form of '((A . B) C)
  7. (define (transitions->hash ts)
  8.   (define (transform t) (cons (cons (first t) (second t)) (third t)))
  9.   (make-hash (map transform ts)))
  10.  
  11. (check-equal? [transitions->hash '((1 2 3))]
  12.               #hash([(1 . 2) . 3]))
Add Comment
Please, Sign In to add comment