Arc Forumnew | comments | leaders | submitlogin
3 points by kinnard 3324 days ago | link | parent

This might not be really helpful because the arc "atom" isn't quite the same as the lisp "atom"[1][2]

arc> (src atom)

(from "arc.arc")

(def atom (x)

  (in type.x 'int 'num 'sym 'char 'string))
==================================================

(define (ar-type x)

  (cond ((ar-tagged? x)     (vector-ref x 1))

        ((pair? x)          'cons)

        ((symbol? x)        'sym)

        ((null? x)          'sym)

        ((procedure? x)     'fn)

        ((char? x)          'char)

        ((string? x)        'string)

        ((exint? x)         'int)

        ((number? x)        'num)     ; unsure about this

        ((vector? x)        'vector)

        ((hash-table? x)    'table)

        ((output-port? x)   'output)

        ((input-port? x)    'input)

        ((tcp-listener? x)  'socket)

        ((exn? x)           'exception)

        ((thread? x)        'thread)

        ((thread-cell? x)   'thread-cell)

        ((keyword? x)       'keyword)

        (#t                 (err "Type: unknown type" x))))
(xdef type ar-type)

[1] https://github.com/arclanguage/anarki/issues/40#issuecomment...

[2] http://arclanguage.org/item?id=19492