[racket] Turning car/cdr into multi-methods

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Oct 16 21:22:10 EDT 2011

The simplest thing is to just make your own cons, car, and cdr.

If you wanted to have standard racket libraries still work, you could
write specifications for them that look like contracts, but instead of
doing checking, they turn standard racket pairs into your new kind of
pairs (and vice-versa when sending them out to the standard library).

Robby

On Sun, Oct 16, 2011 at 8:15 PM, Patrick Li <patrickli.2001 at gmail.com> wrote:
> Hello everyone,
> I'm implementing a scheme of my own for fun and education, and I'm stuck at
> the following point. I'm wondering whether someone could give me some tips.
> I have the basic forms and functions implemented, and was planning on doing
> everything from there using macros.
> I also now have a multi-method system built up using macros.
> But it's annoying that the basic functions such as car/cdr are still plain
> functions and not multi-methods like everything else. I've tried re-defining
> them at this point, without much luck. Somewhere or other, I fall into an
> infinite recursion.
> Does anyone have some tips for wrapping their heads around recursive things
> like this?
> e.g. writing multi-methods using normal functions, and then somehow turning
> everything into multi-methods?
>    OR writing an object system, where your classes are also objects, etc...
> Thanks!
>   -Patrick
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.