On Tue, Feb 27, 2018 at 11:35 AM, David Storrs <david.sto...@gmail.com> wrote: > Despite using it for a long time, I discovered today that I do not > understand 'curry', at least insofar as it applies to keyword > arguments. > >> (define (baz a b) b) >> (baz 8 9) > 9 > >> (curry baz 8) > #<procedure:curried> > >> ((curry baz 8) 9) > 9 > >> (define (foo a #:bar x) x) >> (foo 8 #:bar 9) > 9 > >> (curry foo #:bar 9) > #<procedure:curried> > > Up to this point I'm fine, but now my understanding derails and all is > confusion. > >> ((curry foo #:bar 9) 8) > #<procedure:curried> > > I expected it to yield 9 as it did in the original direct call. The > curry records the keyword argument and returns a function that takes > one positional argument; when that argument is supplied the original > foo function has all the arguments it needs so it should execute. > > Maybe if I apply the final curried proc as a thunk? > >> (((curry foo #:bar 8) 9)) > #<procedure:curried> > > Nope. > > What am I not understanding?
For the record: I did check the docs <https://docs.racket-lang.org/reference/procedures.html> and this line informed my (incorrect) understanding: "The curry function provides limited support for keyworded functions: only the curry call itself can receive keyworded arguments to be propagated eventually to proc." -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.