PasteRack.org
Paste # 32723
2017-08-10 11:49:36

Fork as a new paste.

Paste viewed 14 times.


Embed:

  1. #lang typed/racket
  2.  
  3. (: SLOT_LOOKUP (Immutable-HashTable Symbol Symbol))
  4. (define SLOT_LOOKUP
  5.   (let ([slots '(Head Chest Legs LShoulder RShoulder LHand RHand Feet Shirt Pants Skirt Ring1 Ring2 Amulet Belt Weapon Shield Ammo)])
  6.     (make-immutable-hash
  7.      (cast (map
  8.       (λ (s i)
  9.         (cons s (string->symbol (number->string (cast i Number)))))
  10.       slots
  11.       (range 18)) (Listof (Pairof Symbol Symbol))))))
  12. SLOT_LOOKUP

=>

eval:2:0: Type Checker: parse error in type;

 type name `Immutable-HashTable' is unbound

  in: Symbol

- : (HashTable Symbol Symbol)

'#hash((LHand . |5|)

       (LShoulder . |3|)

       (Feet . |7|)

       (Ring1 . |11|)

       (RHand . |6|)

       (Pants . |9|)

       (Shield . |16|)

       (Shirt . |8|)

       (Ammo . |17|)

       (Weapon . |15|)

       (Skirt . |10|)

       (Ring2 . |12|)

       (Belt . |14|)

       (Head . |0|)

       (Legs . |2|)

       (RShoulder . |4|)

       (Amulet . |13|)

       (Chest . |1|))