早教吧作业答案频道 -->其他-->
Scheme高手请进~两个函数相互定义(define(flat-recurseedlist-proc)(letrec((helper(lambda(ls)(if(null?ls)seed(list-proc(carls)(helper(cdrls)))))))helper))(define(deep-recurseeditem-proclist-proc)(letrec((hlp(lambda(ls)(if
题目详情
Scheme高手请进~两个函数相互定义
(define (flat-recur seed list-proc)
(letrec ((helper (lambda (ls)
(if (null?ls) seed
(list-proc (car ls) (helper (cdr ls)))))))
helper))
(define (deep-recur seed item-proc list-proc)
(letrec ((hlp (lambda (ls)
(if (null?ls) seed
(let ((a (car ls)))
(if (or (pair?a) (null?a))
(list-proc (hlp a) (hlp (cdr ls)))
(item-proc a (hlp (cdr ls)))))))))
hlp))
怎么用deep-recur定义flat-recur,怎么用flat-recur定义deep-recur?
就是在定义deep-recur之后用deep-recur的功能来定义flat-recur,另一个就是反过来啦~
本人为菜鸟,这是一本菜鸟入门书的训练题来着
(define (flat-recur seed list-proc)
(letrec ((helper (lambda (ls)
(if (null?ls) seed
(list-proc (car ls) (helper (cdr ls)))))))
helper))
(define (deep-recur seed item-proc list-proc)
(letrec ((hlp (lambda (ls)
(if (null?ls) seed
(let ((a (car ls)))
(if (or (pair?a) (null?a))
(list-proc (hlp a) (hlp (cdr ls)))
(item-proc a (hlp (cdr ls)))))))))
hlp))
怎么用deep-recur定义flat-recur,怎么用flat-recur定义deep-recur?
就是在定义deep-recur之后用deep-recur的功能来定义flat-recur,另一个就是反过来啦~
本人为菜鸟,这是一本菜鸟入门书的训练题来着
▼优质解答
答案和解析
(define (flat-recur seed list-proc)
(deep-recur seed list-proc list-proc))
用flat-recur来定义deep-recur尚未想到好办法..
(deep-recur seed list-proc list-proc))
用flat-recur来定义deep-recur尚未想到好办法..
看了 Scheme高手请进~两个函...的网友还看了以下:
完形填空Mrs Brown lived alone in a small flat .She wa 2020-05-16 …
Some of us get dipped in flat.求不同的释议求不同的释议Some of 2020-05-16 …
1.Do you know the woman ___ A.in the hat B.wearin 2020-05-16 …
I live in a flat.(加a house改为选择疑问句) _you live in a 2020-05-16 …
Simon is rich enough to buy another flat this yea 2020-05-16 …
This price of this flat is one million dollars(改为 2020-05-16 …
在 Linux 中()命令可将文件以修改时间顺序显示A.ls-aB.ls-bC.ls-cD.ls-d 2020-05-26 …
Scheme高手请进~两个函数相互定义(define(flat-recurseedlist-pro 2020-06-03 …
求EXCELif函数高手(有关超过7个条件的),=IF(A1=1,"A",IF(A1=2,"B", 2020-07-23 …
(这道题叙述可能多些,但意思很简单,望大家驻足赐教)再谢!反应A+3B=2C+2D在三种不同情况下的 2020-12-09 …