/tutorial/backtracking/tiny_prolog/prolog_functor.e

http://github.com/tybor/Liberty · Specman e · 20 lines · 19 code · 1 blank · 0 comment · 1 complexity · 8ed3dce97a5aa210998de69244ad4038 MD5 · raw file

  1. expanded class PROLOG_FUNCTOR
  2. inherit
  3. COMPARABLE
  4. HASHABLE
  5. feature
  6. name: PROLOG_ATOM
  7. arity: INTEGER
  8. infix "<"(other: like Current): BOOLEAN is
  9. do
  10. Result := name < other.name
  11. if not result and not other.name < name then
  12. Result := arity < other.arity
  13. end
  14. end
  15. hash_code: INTEGER is
  16. do
  17. Result := (name.hash_code * arity) & 0x7FFFFFFF
  18. end
  19. end