Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scheme 如何在每次迭代中保存新文件_Scheme - Fatal编程技术网

Scheme 如何在每次迭代中保存新文件

Scheme 如何在每次迭代中保存新文件,scheme,Scheme,我想在宏代码的每次迭代中创建一个新文件 我试图在文件名中输入一个count变量,但它的解释与变量不同 (define xStart -10 ) (define xFinish 10 ) (define xIncrement 8 ) (define yStart -10 ) (define yFinish 10 ) (define yIncrement 8 ) (define count 0 ) (do ( (xValue xStart (+ xValue xIncrement ) )

我想在宏代码的每次迭代中创建一个新文件

我试图在文件名中输入一个count变量,但它的解释与变量不同

(define xStart -10 )
(define xFinish 10 )
(define xIncrement 8 )

(define yStart -10 )
(define yFinish 10 )
(define yIncrement 8 )
(define count 0 )

(do ( (xValue  xStart  (+ xValue  xIncrement ) ) )
    ( (> xValue  xFinish ) xValue )
  (do ( (yValue  yStart  (+ yValue  yIncrement ) ) )
      ( (> yValue  yFinish ) yValue ) 
    (+ count 1)
    (edit:move (entity:get-by-name "source") xValue yValue -50)
    (raytrace:all-sources)
    (edit:select (cadr (entity:faces (entity:get-by-name "Block 1"))))
    (analysis:irradiance)
    (analysis:irradiance-save "Z:/shadow/maps/.txt")
    (analysis:irradiance-close)
    (display: count)    
    )
  )
该函数将数字转换为字符串。函数会附加字符串

(analysis:irradiance-save (string-append "Z:/shadow/maps/" 
                                         (number->string count) 
                                         ".txt"))
但是
(+count1)
什么也不做。您必须将
count
设置为新值

(set! count (+ count 1))

宏在哪里?宏是代码转换,所以它是抽象语法。如果您希望它处理运行时绑定而不是代码,那么可能应该将其设置为过程。我试试看。