Racket - 如何从方案

时间:2016-03-17 08:52:31

标签: list parsing scheme racket

我对MIT Scheme语言有一些疑问。

我使用DrRacket编辑器和球拍语言(#lang racket / gui)

1)如何从文本字段中获取值?

答案:(发送myText-Field get-value)--->好的

2)如何锁定文本字段

3)如何将文本从1)转换为"列表"

for example if user enter : ------------------------
                            | '(a b a b c a d u)   |
                            ------------------------
how to get this value and convert it into a liste to have the following result: '(a b a b c a d u)

4)如何将文本从1)转换为"原子"

for example if user enter : ------------------------
                            | 'a                   |
                            ------------------------
how to get this value and convert it into an "atom" to have the following result: 'a

5)如何将包含我的流程功能(业务层)的DrRacket文件包含到gui(表示层)过程文件中?

1 个答案:

答案 0 :(得分:2)

3)和4)。

> (read (open-input-string "(a b c d e f)"))
'(a b c d e f)
> (read (open-input-string "'(a b c d e f)"))
''(a b c d e f)
> (read (open-input-string "a"))
'a
> (read (open-input-string "'a"))
''a

注意:不要将多个问题放入一个帖子中,而是将它们分开。       这个网站上的问答形式可以更好地处理单个重点问题。

相关问题