ssadler / hawk

Awk for Hoodlums
BSD 3-Clause "New" or "Revised" License
35 stars 2 forks source link

auto-lambda #29

Open gelisam opened 11 years ago

gelisam commented 11 years ago

Swap can be written as:

> printf "1\t2" | hsl swap

or equivalently

> printf "1\t2" | hsl '\(x,y) -> (y,x)'

With implicit arguments, we should be allowed to write it as:

> printf "1\t2" | hsl '(_2, _1)'

I think it would also be useful to support _0 for the entire argument, for those cases where pointfree style is inconvenient:

> seq 10 | hsl 'take 2 _0 ++ drop (length _0 - 2) _0'
1
2
9
10