1

I'm trying to do use the science.plt module in a typed racket program, but I'm having a hard time understanding how to use the require/typed form properly. I've read the docs repeatedly, but I guess I don't quite understand what exactly I'm trying to produce with the form.

In the

[struct name ([f : t] ...)]

form, is the name a name I should expect to find in the module I want to require, or am I making it up for use within my own program?

Probably the most helpful thing for me would be an example or three of require/typed applied to untyped racket modules.

Or if I'm misunderstanding this real deeply and one cannot use untyped modules in a typed program, how should I go about structuring things? I really just need the random number and random distribution functionality from the science.plt module, and don't expect to have any other imports, at this point.

4

1 回答 1

1

您是否查看过 Typed Racket参考页面require/typed?那里有几个例子展示了如何从无类型模块导入。

子句中的name表达式[#:struct name ([f : t] ...) struct-option ...]应该是结构类型的名称。

也就是说,如果您有一个类似 的结构(struct point (x y)name则应该是point

于 2013-02-10T00:31:44.343 回答