Arc Forumnew | comments | leaders | submitlogin
2 points by aw 5213 days ago | link | parent

Using http://awwx.ws/ac,

  (= ac-tnil (ac-scheme tnil))

  (mac ac-predicate (name)
    `(def ,name (x)
       (ac-tnil ((ac-scheme ,(sym (string name "?"))) x))))

  (mac ac-predicates names
    `(do ,@(map (fn (name)
                  `(ac-predicate ,name))
                names)))

  (ac-predicates
   rational complex real integer exact-integer
   exact-nonnegative-integer exact-positive-integer
   inexact-real fixnum? zero? inexact)

  (ac-scheme (xdef numerator numerator))
  (ac-scheme (xdef denominator denominator))
  (ac-scheme (xdef real-part real-part))
  (ac-scheme (xdef imag-part imag-part))


  arc> (inexact-real 4/5)
  nil
  arc> (denominator 3/4)
  4
  arc> (imag-part 3+5i)
  5
See http://docs.plt-scheme.org/reference/numbers.html for documentation.