But then this: (map (+ 1 _) (list 1 2 3))
would turn into (lambda (_) (map (+ 1 _) (list 1 2 3)) no? Robby On Tue, May 17, 2011 at 2:22 PM, John Clements <cleme...@brinckerhoff.org> wrote: > > On May 17, 2011, at 12:21 PM, Robby Findler wrote: > >> What is the rule for where the lambda goes? > > Looks to me like it goes at the outside. So the macro plows through the > terms and when it gets to the bottom, it decides either to wrap the whole > thing in a lambda or not. > > John > >> >> Robby >> >> On Tue, May 17, 2011 at 2:14 PM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu> >> wrote: >>> Scala has the nice feature that if you write something like this: >>> lst.map(_ - 1) >>> It automatically rewrites to a function like this: >>> lst.map(x => x - 1) >>> This makes writing some higher-order functions much easier. >>> >>> Of course, it's easy to make this using a macro and `#%app'. You can >>> see the result here: >>> github.com/samth/fancy-app >>> >>> I'm planning to put this in `unstable/app', and if there's interest >>> I'll think about incorporating it into the default `#%app', after some >>> experience with it. >>> >>> Lots of people have written similar things (`cut' in SRFI 26, Jay's >>> `super-cut', etc), but I'd like to move towards using it implicitly. >>> -- >>> sam th >>> sa...@ccs.neu.edu >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://lists.racket-lang.org/listinfo/dev >>> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://lists.racket-lang.org/listinfo/dev > > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev