运行方案从命令行 [英] Running Scheme from the command line

查看:141
本文介绍了运行方案从命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在linux(ubuntu)中从终端运行Scheme程序?还有如何从Scheme程序中的命令行接受参数?

How do you run Scheme programs from the terminal in linux(ubuntu)? Also how to accept arguments from the command-line in a Scheme program?

编辑:Im使用DrScheme实现。

Im using the DrScheme implementation.

推荐答案

DrScheme方案实现和用于从命令行执行它的名称是 mzscheme 。启动命令行脚本的文档位于此处: Unix脚本(PLT Scheme文档)。此处说明命令行参数的使用:命令行解析(PLT Scheme Documentation) )

The DrScheme scheme implementation, and the name you use to execute it from the command line, is mzscheme. The documentation for starting a command line script is found here: Unix Scripts (PLT Scheme documentation). Use of the command line args is explained here: Command-line Parsing (PLT Scheme Documentation).

结果是你可以使用这样的shebang脚本:

The upshot is that you can use shebang scripts like this:

#! /usr/bin/env mzscheme
#lang scheme/base
(...scheme s-exps...)

或者如果你想更多地控制 mzscheme 的命令行标志,你需要启动这样的脚本:

or if you want more control over the command line flags for mzscheme, you need to start the script like this:

#! /bin/sh
#|
exec mzscheme -cu "$0" ${1+"$@"}
|#
#lang scheme/base
(...scheme s-exps...)

用来处理命令行参数的函数是 / code>。您可以在第二个链接链接到的文章中找到如何使用它的示例。

The function you use to process command line args is command-line. You will find examples of how to use it in the article linked to by the second link.

这篇关于运行方案从命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆