Arc Forumnew | comments | leaders | submitlogin
2 points by zck 3938 days ago | link | parent

If nothing else, you can use 'listtab to convert an association list (http://arclanguage.github.io/ref/assoc.html) to a table:

    arc> (= al '((k1 v1) (k2 v2)))
    ((k1 v1) (k2 v2))
    arc> (alref al 'k2)
    v2
    arc> (listtab al)
    #hash((k1 . v1) (k2 . v2))
And it is more readable for long argument lists:

    arc> (obj 1 2 3 4 5 6 7 8 9 0 a 2 b 3 r 4) ;; Is 0 a key or a value?
    #hash((r . 4) (1 . 2) (b . 3) (3 . 4) (a . 2) (5 . 6) (7 . 8) (9 . 0))
    arc> (listtab '((1 2) (3 4) (5 6) (7 8) (9 0) (a 2) (b 3) (r 4))) ;; a val.
    #hash((r . 4) (1 . 2) (b . 3) (3 . 4) (a . 2) (5 . 6) (7 . 8) (9 . 0))