racket

    0热度

    1回答

    对table-panel我偶然发现了instantiate的电话。在阅读Racket的GUI文档之前,我只看到new被用来创建GUI类的对象。 的instantiate从该页面使用方法:documentation其余的new (instantiate button% ((format "~a" j) child) (stretchable-width #t) (

    0热度

    1回答

    我正在使用DrRacket。 这工作: (define foo 1) (set! foo 2) foo ;;returns 2 但在这里我想富返回2: (define foo 1) (define (setmachine variable newvalue) (set! variable newvalue)) (setmachine foo 2) foo ;; return

    2热度

    2回答

    球拍lang中是否提供了将十进制数字转换为具有自定义格式的字符串的函数? 我需要格式化十进制字符串格式化为货币风格? 示例:值100.1应该成为“100,10 CZK"

    1热度

    2回答

    我希望我的函数能够对给定列表中的每个数字进行平方,而且,如果lst中的 元素是列表,则该函数将递归应用于该元素并对元素进行操作该名单也是如此。 这是我的代码: (define (sqr-up-rec-tail lst) (define (helper lst newlist) (if (null? lst) newlist (if (list? (car lst))

    2热度

    1回答

    我在实习面试中被问到做了一个创建函数的R5RS程序,我们假设有两个子集。这个函数必须返回#t,如果列表L包含两个元素总数相等且元素个数相同的子集,否则返回#f。它需要输入列表L(只有正数)和一些参数(我认为有用,没有参数数量的条件),所有参数在开始时都等于0。 我仍然记得的要求如下: - 不要定义其他函数并在“two-subsets”函数中调用它们。 - 它只能使用下面的结构:null ?, co

    2热度

    1回答

    相关的所有值我有一个列表像(列表(列表键值)...),我试图建立一个函数返回与键相关的所有值。 我想我可以使用匹配构造来做到这一点,但没有任何成功。 #lang racket ; should return a list starting with key, otherwise #f (define (match-key lst key) (match lst [(li

    1热度

    1回答

    我有一个使用书目下列涂鸦文件: #lang scribble/base @(require scriblib/autobib) @(define-cite cite citet gen-bib) This is a [email protected][the-citation]. @(define the-citation (make-bib #:title "Hello

    0热度

    2回答

    我目前正试图获得关于函数式编程方面的一般副作用的了解,球拍准确无误。这是我的理解,它涉及到改变某些变量的状态,如全局变量。 下面是我写的一些代码; ; Define a variable with the value of 5 (define x 5) ; Define a function to add 1 to x (define addX (+ 1 x)) ; Test out

    3热度

    1回答

    我尝试执行用DrRacket环境提供的其中一种教学语言(例如Beginning Student)编写的脚本。 我可以通过包装的代码到一个模块中(就像DrRacket一样)实现这一目标: #reader(lib "htdp-beginner-reader.ss" "lang")((modname my_module) (read-case-sensitive #t) (teachpacks()) (

    1热度

    1回答

    新计划和目前正在使用词法分析器。以下是我的代码,我收到错误 map:合同违规 预计:列表? 给出:# 说法位置:第二 其他参数...: # #lang racket (define tokens '((dog noun) (cat noun) (chases verb) (the article))) (define (getToken wo