Arc Forumnew | comments | leaders | submitlogin
4 points by skenney26 5755 days ago | link | parent

  (def rec (f base xs)
    ((rfn r (xs)
       (if (atom xs)
           (base xs)
           (f (map r xs))))
     xs))

  arc> (= test (list 1 2 3 (list 3 4 5) (list 3 4 (list 1 2 3))))
  (1 2 3 (3 4 5) (3 4 (1 2 3)))
  arc> (rec avg idfn test)
  13/5

  arc> (rec avg [* _ 2] test)
  26/5
  arc> (rec [apply + _] [* _ 3] test)
  93