Chicken Scheme 4.8.0.5
Greetings all,
Assuming I have a text file containing a top-level definition
topLevelDef.txt
(define techDisplays '(
( AG1 fillerIgnore AG1_fillerIgnore t t nil t nil )
( AG2 drawing AG2_drawing t t nil t t )
)
)
and I bring it in as an include
trythis.scm
(use extras format posix posix-extras regex regex-literals utils srfi-13)
(include "./mytech/mytech.tf.techDisplays") ; works when hard-coded
;include inn-file) ; want to pass it in as an arg
(define write-out-techDisplays
(lambda()
(for-each
(lambda(rule-as-list-of-symbols)
(begin
(set! rule-as-list-of-strings ( map symbol->string rule-as-list-of-symbols))
(print (string-join rule-as-list-of-strings ))
)
)
techDisplays
)
)
)
(define (main args)
(set! inn-file ( car args))
(set! out-file (cadr args))
(with-output-to-file out-file write-out-techDisplays)
0
)
So how can I achieve this? Either by delaying evaluation of the include somehow? Or reading in the contents of inn-file and evaluating the string somehow? Or something else?
TIA,
Still-learning Steve
just pass the list you want as an argument to your outer lambda. your formatting is misleading, you could try to pretty print your code.
finally, you could redesign your code to work without sideffects (those set!s). that for-each could be a map.