Hi, You might try defining your variables outside of the conditional statements, and then (set! ...) them within the conditionals instead of calling (define-param ...) within conditionals.
Chris On Tue, Apr 17, 2018 at 4:08 AM, leonard Monniello < leonard.monnie...@u-psud.fr> wrote: > Dear kind meepers, > > I used to run a code that was working quite fine, but returns now an > error. > The code part of the code that is not working is in the form: > > *(define-param band? false) * > *(cond ((equal? band? false) (define-param supercell-x 80)) * > * (else (define-param supercell-x 1)) * > > I want to use conditional definitions to be able to control externally the > type of computation I wanna run and also the different parameters, as I > have this kind of line in other places of the script. > > The error returned is: > > *definition in expression context, where definitions are not allowed, in > form (define supercell-x (if (defined? (quote supercell-x)) supercell-x > 80))* > > Though I don't really understand what I'm supposed to do with it. Should I > copy this syntax or try to avoid it ? > > Another example later on in my file, which I use to set the output file > names: > *(cond ((equal? grandguide? true)* > * (define Guide (string-append "W" (number->string (+ 1 (* 2 > decal))) "r" (number->string r))))* > * (else (define Guide ""))* > * )* > > If you have any idea how to rewrite this, it would be very helpful. > > Thank you > > Léonard > > _______________________________________________ > meep-discuss mailing list > meep-discuss@ab-initio.mit.edu > http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss >
_______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss