如何从命令行运行 Pie(来自 The Little Typer)?

问题描述 投票:0回答:1

我读《小打字机》已经有一段时间了,我现在想实际尝试一下 Pie,而不仅仅是阅读它。以下是我尝试在命令行(Mac 上)中启动并运行 Pie REPL 的步骤:

brew install racket
raco pkg install -n pie
racket -l pie -i

最后一行输出:

Welcome to Racket v7.9 [bc].
standard-module-name-resolver: collection not found
  for module path: typed/racket/base
  collection: "typed/racket"
  in collection directories:
   /Users/caspianahlberg/Library/Racket/7.9/collects
   /usr/local/Cellar/minimal-racket/7.9/share/racket/collects
   /usr/local/Cellar/minimal-racket/7.9/share/racket/pkgs/racket-lib
> 

此外,在测试 Pie 表达式时,例如

(cons 'foo 'bar)
,它告诉我:

stdin::1: #%top-interaction: unbound identifier;
 also, no #%app syntax transformer is bound
  at: #%top-interaction
  in: (#%top-interaction cons (quote foo) (quote bar))
  location...:
   stdin::1
  context...:
   /usr/local/Cellar/minimal-racket/7.9/share/racket/collects/racket/repl.rkt:11:26

从命令行运行 Pie 时,似乎有些东西没有正确安装。有遇到过这个问题的人知道如何解决吗

package racket dependent-type typed-racket raco
1个回答
0
投票

如果您使用的是 Mac,则应从 https://download.racket-lang.org/ 安装它,然后启动 DrRacket:它有自己的 IDE。正如您所建议的,通过 cli 调用的球拍似乎是一个非常不同的野兽。

当您启动 DrRacket 时,它不会知道“pie”是什么。您需要转到“文件”->“包管理器”,输入“pie”作为包源,然后单击“更新”按钮。这需要一些时间,但你的盘子里会有馅饼。

当DrRacket运行时,你会在它的窗口中看到两部分:代码部分和执行部分。您可以编写代码,但请确保以#lang pie 开头。您可以通过单击显示古人称为“软盘”的按钮来保存该代码。您可以单击“运行”按钮,您的代码将在执行部分运行。执行部分可以添加一些代码,但不能添加新的定义。定义在代码部分。

© www.soinside.com 2019 - 2024. All rights reserved.