Discussion:
[Lisp-cn] [101] format 常用形式?
Zoom.Quiet
2018-01-14 16:03:18 UTC
Permalink
终于刷完了 TLS, 开始按照直觉构建可用 CLI 工具,
神奇的是最基本的 顶层函式:format 就无法使用
先在交互环境中检验:

༄ chez
Chez Scheme Version 9.4
Copyright 1984-2016 Cisco Systems, Inc.
(define _v "v19.1.15.0001")
_v
"v19.1.15.0001"
(format "~a~%" _v)
"v19.1.15.0001\n"
༄ which scheme-script
/usr/local/bin/scheme-script

明确形式后,创建文件 _format.ss:
#! /usr/bin/env scheme-script

(import (rnrs))

(define __version__ "v18.1.14.2201")
(format "by ~a~%" __version__)

一运行就出错:
༄ ./_format.ss
Exception: attempt to reference unbound identifier format at line 6,
char 2 of ./_format.ss

反复看文档: Input/Output Operations
http://cisco.github.io/ChezScheme/csug9.5/io.html#./io:s96

Section 9.13. Formatted Output

procedure: (format format-string obj ...)
procedure: (format #f format-string obj ...)
procedure: (format #t format-string obj ...)
procedure: (format textual-output-port format-string obj ...)
returns: see below
libraries: (chezscheme)

其它形式也都尝试过, 依然是相同的:
... 尝试引用未绑定的标识符格式 <-- 报警
这要怎么想呢?

ps:
(import (rnrs)) 这行注释掉的话,将引发另外的错误:

༄ ./_format.ss
Exception: invalid top-level program import subform (define
__version__ "v18.1.14.2201") at line 4, char 1 of ./_format.ss

这看起来应该是 #! /usr/bin/env scheme-script 引发的对应环境问题....
只是将其替换为
#! /usr/bin/env scheme
运行时将必须追加 chez 或是 scheme 的调用方


--
life is pathetic, go Pythonic! 人生苦短, Python当歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization learning!
--
--
Lisp-cn(Lisp中文用户组)
CLUG http://lisp.org.cn

---
您收到此邮件是因为您订阅了 Google 网上论坛的“Lisp-cn(Lisp中文用户组)”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到lisp-cn+***@googlegroups.com。
要查看更多��
Zoom.Quiet
2018-01-14 16:39:20 UTC
Permalink
附:format
https://practical-scheme.net/wiliki/schemexref.cgi?format
也是坑...
终于刷完了 TLS, 匀始按照盎觉构建可甚 CLI 工具,
神奇的是最基本的 顶层凜匏:format 就无法䜿甚
àŒ„ chez
Chez Scheme Version 9.4
Copyright 1984-2016 Cisco Systems, Inc.
(define _v "v19.1.15.0001")
_v
"v19.1.15.0001"
(format "~a~%" _v)
"v19.1.15.0001\n"
àŒ„ which scheme-script
/usr/local/bin/scheme-script
#! /usr/bin/env scheme-script
(import (rnrs))
(define __version__ "v18.1.14.2201")
(format "by ~a~%" __version__)
àŒ„ ./_format.ss
Exception: attempt to reference unbound identifier format at line 6,
char 2 of ./_format.ss
反倍看文档: Input/Output Operations
http://cisco.github.io/ChezScheme/csug9.5/io.html#./io:s96
Section 9.13. Formatted Output
procedure: (format format-string obj ...)
procedure: (format #f format-string obj ...)
procedure: (format #t format-string obj ...)
procedure: (format textual-output-port format-string obj ...)
returns: see below
libraries: (chezscheme)
... 尝试匕甚未绑定的标识笊栌匏 <-- 报譊
这芁怎么想呢?
àŒ„ ./_format.ss
Exception: invalid top-level program import subform (define
__version__ "v18.1.14.2201") at line 4, char 1 of ./_format.ss
这看起来应该是 #! /usr/bin/env scheme-script 匕发的对应环境问题....
只是将其替换䞺
#! /usr/bin/env scheme
运行时将必须远加 chez 或是 scheme 的调甚方
--
life is pathetic, go Pythonic! 人生苊短, Python圓歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗䜙䞍做,日子甭过!倇仜䞍做,十恶䞍赊!
KM keep growing environment culture which promoting organization learning!
--
life is pathetic, go Pythonic! 人生苊短, Python圓歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗䜙䞍做,日子甭过!倇仜䞍做,十恶䞍赊!
KM keep growing environment culture which promoting organization learning!
--
--
Lisp-cn(Lisp䞭文甚户组)
CLUG http://lisp.org.cn

---
悚收到歀邮件是因䞺悚订阅了 Google 眑䞊论坛的“Lisp-cn(Lisp䞭文甚户组)”矀组。
芁退订歀矀组并停止接收歀矀组的电子邮件请发送电子邮件到lisp-cn+***@googlegroups.com。
芁查看曎倚选项请访问 https://groups.google.com/d/optout。
Chaos Eternal
2018-01-14 16:49:49 UTC
Permalink
我䞀般盎接(import (scheme))
终于刷完了 TLS, 匀始按照盎觉构建可甚 CLI 工具,
神奇的是最基本的 顶层凜匏:format 就无法䜿甚
àŒ„ chez
Chez Scheme Version 9.4
Copyright 1984-2016 Cisco Systems, Inc.
(define _v "v19.1.15.0001")
_v
"v19.1.15.0001"
(format "~a~%" _v)
"v19.1.15.0001\n"
àŒ„ which scheme-script
/usr/local/bin/scheme-script
#! /usr/bin/env scheme-script
(import (rnrs))
(define __version__ "v18.1.14.2201")
(format "by ~a~%" __version__)
àŒ„ ./_format.ss
Exception: attempt to reference unbound identifier format at line 6,
char 2 of ./_format.ss
反倍看文档: Input/Output Operations
http://cisco.github.io/ChezScheme/csug9.5/io.html#./io:s96
Section 9.13. Formatted Output
procedure: (format format-string obj ...)
procedure: (format #f format-string obj ...)
procedure: (format #t format-string obj ...)
procedure: (format textual-output-port format-string obj ...)
returns: see below
libraries: (chezscheme)
... 尝试匕甚未绑定的标识笊栌匏 <-- 报譊
这芁怎么想呢?
àŒ„ ./_format.ss
Exception: invalid top-level program import subform (define
__version__ "v18.1.14.2201") at line 4, char 1 of ./_format.ss
这看起来应该是 #! /usr/bin/env scheme-script 匕发的对应环境问题....
只是将其替换䞺
#! /usr/bin/env scheme
运行时将必须远加 chez 或是 scheme 的调甚方
--
life is pathetic, go Pythonic! 人生苊短, Python圓歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗䜙䞍做,日子甭过!倇仜䞍做,十恶䞍赊!
KM keep growing environment culture which promoting organization learning!
--
--
Lisp-cn(Lisp䞭文甚户组)
CLUG http://lisp.org.cn
---
悚收到歀邮件是因䞺悚订阅了 Google 眑䞊论坛的“Lisp-cn(Lisp䞭文甚户组)”矀组。
芁查看曎倚选项请访问 https://groups.google.com/d/optout。
--
--
Lisp-cn(Lisp䞭文甚户组)
CLUG http://lisp.org.cn

---
悚收到歀邮件是因䞺悚订阅了 Google 眑䞊论坛的“Lisp-cn(Lisp䞭文甚户组)”矀组。
芁退订歀矀组并停止接收歀矀组的电子邮件请发送电子邮件到lisp-cn+***@googlegroups.com。
芁查看曎倚选项请访问 https://groups.google.com/d/optout。
Zoom.Quiet
2018-01-15 01:27:12 UTC
Permalink
我一般直接(import (scheme))
果然...这样引用后

(format "by ~a~%" __version__)
(format #t "by ~a~%" __version__)

后一个有输出, 前一个静默了...

解决 ;-)
多谢
Post by Zoom.Quiet
终于刷完了 TLS, 开始按照直觉构建可用 CLI 工具,
神奇的是最基本的 顶层函式:format 就无法使用
༄ chez
Chez Scheme Version 9.4
Copyright 1984-2016 Cisco Systems, Inc.
(define _v "v19.1.15.0001")
_v
"v19.1.15.0001"
(format "~a~%" _v)
"v19.1.15.0001\n"
༄ which scheme-script
/usr/local/bin/scheme-script
#! /usr/bin/env scheme-script
(import (rnrs))
(define __version__ "v18.1.14.2201")
(format "by ~a~%" __version__)
༄ ./_format.ss
Exception: attempt to reference unbound identifier format at line 6,
char 2 of ./_format.ss
反复看文档: Input/Output Operations
http://cisco.github.io/ChezScheme/csug9.5/io.html#./io:s96
Section 9.13. Formatted Output
procedure: (format format-string obj ...)
procedure: (format #f format-string obj ...)
procedure: (format #t format-string obj ...)
procedure: (format textual-output-port format-string obj ...)
returns: see below
libraries: (chezscheme)
... 尝试引用未绑定的标识符格式 <-- 报警
这要怎么想呢?
༄ ./_format.ss
Exception: invalid top-level program import subform (define
__version__ "v18.1.14.2201") at line 4, char 1 of ./_format.ss
这看起来应该是 #! /usr/bin/env scheme-script 引发的对应环境问题....
只是将其替换为
#! /usr/bin/env scheme
运行时将必须追加 chez 或是 scheme 的调用方
--
life is pathetic, go Pythonic! 人生苦短, Python当歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization learning!
--
--
Lisp-cn(Lisp中文用户组)
CLUG http://lisp.org.cn
---
您收到此邮件是因为您订阅了 Google 网上论坛的“Lisp-cn(Lisp中文用户组)”群组。
要查看更多选项,请访问 https://groups.google.com/d/optout。
--
--
Lisp-cn(Lisp中文用户组)
CLUG http://lisp.org.cn
---
您收到此邮件是因为您订阅了Google网上论坛上的“Lisp-cn(Lisp中文用户组)”群组。
要查看更多选项,请访问https://groups.google.com/d/optout。
--
life is pathetic, go Pythonic! 人生苦短, Python当歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization learning!
--
--
Lisp-cn(Lisp中文用户组)
CLUG http://lisp.org.cn

---
您收到此邮件是因为您订阅了 Google 网上论坛的“Lisp-cn(Lisp中文用户组)”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到lisp-cn+***@googlegroups.com。
要查看更多选项,请访问 https://groups.g
继续阅读narkive:
Loading...