Arc Forumnew | comments | leaders | submitlogin
3 points by rntz 5439 days ago | link | parent

Thirded. I'd very much like to see this get into arc3's final release. This makes iterating over a given table just like iterating over the corresponding association list.

It's a single-line patch:

    diff --git a/arc.arc b/arc.arc
    index a2a6a8d..ac5ea3e 100644
    --- a/arc.arc
    +++ b/arc.arc
    @@ -467,7 +467,7 @@
                      (self (cdr ,g))))
                  ,gseq)
                (isa ,gseq 'table)
    -            (maptable (fn (,g ,var) ,@body)
    +            (maptable (fn ,var ,@body)
                           ,gseq)
                 (for ,g 0 (- (len ,gseq) 1)
                   (let ,var (,gseq ,g) ,@body))))))


1 point by CatDancer 5436 days ago | link

This makes iterating over a given table just like iterating over the corresponding association list

That's a cool point!

If calling a list wasn't already doing a lookup by position, I might like a call on a cons to do an alref so that I could use x!foo to do a lookup by 'foo whether x was a table or an assoc list.

-----

2 points by CatDancer 5439 days ago | link

It's a single-line patch if no other code in Arc/News uses each with tables...

-----