On Sun, Jan 6, 2019 at 4:28 PM George Neuner <gneun...@comcast.net> wrote:

> On Fri, 4 Jan 2019 13:30:43 -0500, David Storrs
> <david.sto...@gmail.com> wrote:
>
> >Racket's OO system has the 'augment' family of functionality that allows
> >you to change how a function works.  I'm wondering if there's a way to do
> >something similar in functional Racket.  For example, when I was working
> in
> >Perl I used to be able to do something like this Racket pseudocode:
> >
> >> (define (greet name)
> >  (println (string-append  "Hi, " name)))
> >
> >> (greet "bob")
> >"Hi, bob!"
> >
> > :
> >
> >> (before greet ~a)  ; argument to greet is now passed to ~a before greet
> >gets it
> >
> > :
> >
> >; or, alternatively, instead of pre, let's do:
> >> (after greet list)
> >
> > :
> >
> >; or, how about full control?
> >> (around greet
> >  (lambda (name)
> >    (displayln "About to enter greet")
> >    (inner (~a name))
> >    (displayln "After greet"))>
>
>
> Not that I can help wrt Racket, but this looks a lot like generic
> functions in Lisp.  Is that what you're trying to achieve?
>

I haven't worked with Racket's generics before, but a quick skim through
the documentation suggests that no, that's not it.  Racket generics appear
to relate to collections and structs, whereas I was looking for something
that operates on arbitrary functions.  Perhaps I've misunderstood something?

Dave

>
>
> George
>
> --
> 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.
>

-- 
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.

Reply via email to