Arc Forumnew | comments | leaders | submitlogin
1 point by adm 5621 days ago | link | parent

those three methods are similar except line processing. Can't we refactor those, where they will call a single method or macro?


3 points by CatDancer 5621 days ago | link

untested, but perhaps something like this?

  (def ffilter1 (file func (o fldsep whitec))
    (ffilter file (fn (line)
                    (func (tokens line fldsep)))))
and similarly define ffilter2 using ffilter as well.

-----

1 point by adm 5621 days ago | link

  (def ffilter1 (file func (o fldsep whitec))
    (ffilter file [tokens _ fldsep]))
this should work? (just curious: since I don't have access to arc right now).

-----

3 points by absz 5621 days ago | link

You want

  (def ffilter1 (file func (o fldsep whitec))
    (ffilter file [func:tokens _ fldsep]))

-----

1 point by adm 5621 days ago | link

oops! I will test with this.

-----