1. my class X::NYI { ... }
  2. my role Stringy { }
  3. multi sub infix:<eqv>(Stringy:D \a, Stringy:D \b) {
  4. nqp::p6bool(
  5. nqp::unless(
  6. nqp::eqaddr(a,b),
  7. nqp::eqaddr(a.WHAT,b.WHAT) && nqp::iseq_i(a cmp b,0) # XXX RT #128092
  8. )
  9. )
  10. }
  11. proto sub prefix:<~>($) is pure { * }
  12. multi sub prefix:<~>(\a) { a.Stringy }
  13. multi sub prefix:<~>(int $a) { nqp::p6box_s($a) }
  14. multi sub prefix:<~>(num $a) { nqp::p6box_s($a) }
  15. proto sub infix:<~>(|) is pure { * }
  16. multi sub infix:<~>($x = '') { $x.Stringy }
  17. multi sub infix:<~>(\a, \b) { a.Stringy ~ b.Stringy }
  18. proto sub infix:<x>(Mu $?, Mu $?) is pure { * }
  19. multi sub infix:<x>() { Failure.new("No zero-arg meaning for infix:<x>") }
  20. multi sub infix:<x>($x) { $x.Stringy }
  21. multi sub infix:<x>($s, Num:D $n) {
  22. $n == Inf
  23. ?? Failure.new(X::NYI.new(:feature('Cat object')))
  24. !! $s.Stringy x $n.Int;
  25. }
  26. multi sub infix:<x>($s, Any:D $n) { $s.Stringy x $n.Int }
  27. multi sub infix:<x>($s, Any:U $n) { $s.Stringy x $n.Numeric.Int }
  28. proto sub infix:<leg>(Mu $?, Mu $?) is pure { * }
  29. multi sub infix:<leg>(\a, \b) { a.Stringy cmp b.Stringy }
  30. proto sub infix:<eq>(Mu $?, Mu $?) is pure { * }
  31. multi sub infix:<eq>($x?) { Bool::True }
  32. multi sub infix:<eq>(\a, \b) { a.Stringy eq b.Stringy }
  33. proto sub infix:<ne>(Mu $?, Mu $?) is pure { * }
  34. multi sub infix:<ne>($x?) { Bool::True }
  35. multi sub infix:<ne>(Mu \a, Mu \b) { a !eq b }
  36. multi sub infix:<ne>(Any \a, Any \b) { a.Stringy ne b.Stringy }
  37. proto sub infix:<lt>(Mu $?, Mu $?) is pure { * }
  38. multi sub infix:<lt>($x?) { Bool::True }
  39. multi sub infix:<lt>(\a, \b) { a.Stringy lt b.Stringy }
  40. proto sub infix:<le>(Mu $?, Mu $?) is pure { * }
  41. multi sub infix:<le>($x?) { Bool::True }
  42. multi sub infix:<le>(\a, \b) { a.Stringy le b.Stringy }
  43. proto sub infix:<gt>(Mu $?, Mu $?) is pure { * }
  44. multi sub infix:<gt>($x?) { Bool::True }
  45. multi sub infix:<gt>(\a, \b) { a.Stringy gt b.Stringy }
  46. proto sub infix:<ge>(Mu $?, Mu $?) is pure { * }
  47. multi sub infix:<ge>($x?) { Bool::True }
  48. multi sub infix:<ge>(\a, \b) { a.Stringy ge b.Stringy }
  49. proto sub infix:<~|>(Mu $?, Mu $?) is pure { * }
  50. multi sub infix:<~|>($x = '') { $x.Stringy }
  51. multi sub infix:<~|>(\a, \b) { a.Stringy ~| b.Stringy }
  52. proto sub infix:<~^>(Mu $?, Mu $?) is pure { * }
  53. multi sub infix:<~^>($x = '') { $x.Stringy }
  54. multi sub infix:<~^>(\a, \b) { a.Stringy ~^ b.Stringy }
  55. proto sub infix:<~&>(Mu $?, Mu $?) is pure { * }
  56. multi sub infix:<~&>() { Failure.new("No zero-arg meaning for infix:<~&>") }
  57. multi sub infix:<~&>($x) { $x.Stringy }
  58. multi sub infix:<~&>(\a, \b) { a.Stringy ~& b.Stringy }
  59. proto sub prefix:<~^>(Mu $) is pure { * }
  60. multi sub prefix:<~^>(\a) { ~^ a.Stringy }