2 Star 4 Fork 1

xiaochi / jsp

 / 详情

如下汉诺塔程序不能顺利执行

待办的
创建于  
2021-09-03 19:35
(let ()
  (define Substance
	'((1 2 3 4 5 6 7 8)
	  ()
	  ()))

  (define move
	(lambda (from to)
	  (set! Substance
	   (let ((x (car (from Substance))))
		 (cond ((and (eq? from car) (eq? to cadr))
				`(,(cdr (from Substance)) ,(cons x (to Substance)) ,(caddr Substance)))
			   ((and (eq? from car) (eq? to caddr))
				`(,(cdr (from Substance)) ,(cadr Substance) ,(cons x (to Substance))))

			   ((and (eq? from cadr) (eq? to car))
				`(,(cons x (to Substance)) ,(cdr (from Substance)) ,(caddr Substance)))
			   ((and (eq? from cadr) (eq? to caddr))
				`(,(car Substance) ,(cdr (from Substance)) ,(cons x (to Substance))))

			   ((and (eq? from caddr) (eq? to car))
				`(,(cons x (to Substance)) ,(cadr Substance) ,(cdr (from Substance))))
			   ((and (eq? from caddr) (eq? to cadr))
				`(,(car Substance) ,(cons x (to Substance)) ,(cdr (from Substance)))))))
	  (display Substance)
	  (newline)))

  (define (H n start temp end)
	(if (= n 1)
		(move  start end)
		(begin (H (- n 1) start end temp)
			   (H 1 start temp end)
			   (H (- n 1) temp start end))))

  (H (length (car Substance))  car cadr caddr))

评论 (2)

zhangshenhua 创建了任务
zhangshenhua 关联仓库设置为xiaochi/jsp
展开全部操作日志

这里使用了宏。。。jsp还不支持宏……

那太遗憾了

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
1
https://gitee.com/picasso250/jsp.git
git@gitee.com:picasso250/jsp.git
picasso250
jsp
jsp

搜索帮助

14c37bed 8189591 565d56ea 8189591