Arc Forumnew | comments | leaders | submitlogin
2 points by jmatt 6061 days ago | link | parent

(flat (list (list 1 2) (list 3 4))) will do it.

I've used flat before and it's worked well.

reference: http://www.arcfn.com/doc/list.html



1 point by bOR_ 6061 days ago | link

Hmm. Seen flat and tried it. in Arc2 flat works recursively, turning (list (list 1 2) (list (1 2)) into (1 2 1 2), which doesn't produce the desired (2 4) when combined with map +

  (map + (flat (list (list 1 2) (list 1 2))))
  (1 2 1 2)

-----

9 points by almkglor 6061 days ago | link

  (apply map + your-expression)

-----

3 points by bOR_ 6061 days ago | link

  (apply map + (map vals:craa!eltm:car (observecone craa!pos (list 0 359) craa!range)))
  (122 31 0)
Thanks! I'll digest what things you can do with the apply map combination in my sleep, but it seems quite handy.

-----

2 points by absz 6061 days ago | link

The apply function takes a function, any number of arguments, and a list, to wit (apply f x0 x1 x2 ... xN args). This is the same as (f x0 x1 x2 ... xN args.0 args.1 args.2 ... args.M). This allows you to construct argument lists at runtime, which can come in very handy.

-----

2 points by jmatt 6061 days ago | link

almkglor nailed it.

That's elegant and simple.

-----