[racket] An easy route to define-datatype in BSL?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Nov 5 08:22:04 EST 2012

BSL uses special syntax information (installed by beginner:define) to only
allow applications on first-order functions. For example,

(define (f a)
 (a 1))

is an error in BSL. The way this is detected is that every top-level define
(like for 'f') has a special notation on it that says "I'm a function".
Since 'a' doesn't have this, then the macro for app in BSL can throw an
error.

The main thing that this macro does is give that information to the
identifiers, but you need to redefine them, which causes the need for the
variant mapping since type-case is looking for the original variant names.

Jay



On Mon, Nov 5, 2012 at 6:13 AM, Prabhakar Ragde <plragde at uwaterloo.ca>wrote:

> On 2012-11-05 6:43 AM, Matthew Flatt wrote:
>
>  Here's a first cut at a module that you can import into BSL programs.
>>
>> The least obvious part is defining a new `define-type' and `type-case'
>> that invents hidden names for the variants and them maps between them
>> while expanding to the original forms.
>>
>
> Wow, thanks. I will study the code and do my best to understand it, and
> test it for deployment next fall. I can already see the outline of how your
> code achieves what you describe, but could you please say a few words about
> why that's necessary, to improve my understanding of BSL? Thanks again. --PR
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/**users <http://lists.racket-lang.org/users>
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121105/70384f13/attachment.html>

Posted on the users mailing list.