我在写申请书
juggling pattern animator
)在PLT方案中,接受方案表达式作为某些字段的值。我正试图写一个小的文本编辑器
让我将表达式“分解”为仍然可以进行eval'd但以文本形式包含数据的表达式
手动调整。
例如,
(4hss->sexp "747")
是生成合法模式的函数调用。如果我把它打印出来,它就会变成
(((7 3) - - -) (- - (4 2) -) (- (7 2) - -) (- - - (7 1)) ((4 0) - - -) (- - (7 0) -) (- (7 2) - -) (- - - (4 3)) ((7 3) - - -) (- - (7 0) -) (- (4 1) - -) (- - - (7 1)))
它可以作为字符串“读取”,但不会与函数“eval”相同。当然,对于这个声明,我需要的是
(quote (((7 3...
但其他的例子也不平凡。例如,这一个包含作为向量打印的结构:
pair-of-jugglers
; -->
(#(struct:hand #(struct:position -0.35 2.0 1.0) #(struct:position -0.6 2.05 1.1) 1.832595714594046) #(struct:hand #(struct:position 0.35 2.0 1.0) #(struct:position 0.6 2.0500000000000003 1.1) 1.308996938995747) #(struct:hand #(struct:position 0.35 -2.0 1.0) #(struct:position 0.6 -2.05 1.1) -1.3089969389957472) #(struct:hand #(struct:position -0.35 -2.0 1.0) #(struct:position -0.6 -2.05 1.1) -1.8325957145940461))
我已经想到了至少三种可能的解决方案,没有一种我非常喜欢。
在我再次开始做糟糕的递归梦之前帮助我。