On Thu, 30 Nov 2006, Luká? Oliva wrote:
ERROR: Wrong type to apply: #<unspecified>

probably on the line:

...
128         (if no-ant? ((save-flux "reflant-flux" reflant)
129                         (save-flux "transcoc-flux" transcoc)))

Your syntax here is incorrect; you have an extra set of parentheses.

Remember, in Scheme, parentheses are not used for operator precedence, like they are in C or other infix languages. Rather, parentheses have a very important meaning: (foo bar) means to *call the function* foo with argument bar. This means that inserting parentheses into your program completely changes its meaning, unlike C where you can insert lots of parentheses with impunity.

Instead of (save-flux "reflant-flux" reflant) ..., you have ((save-flux "reflant-flux" reflant) ...), which means that you are telling Scheme to take the output of the function (save-flux ...) and evaluate the *output* as if it were a function. Since (save-flux ...) does not return a function, this gives an error.

The correction depends on what you want to do. If what you want is (in pseudo-code)

        if no-ant? then
                (save-flux "reflant-flux" reflant)
        else
                (save-flux "transcoc-flux" transcoc)
        endif

then you should do:

        (if no-ant?
                (save-flux "reflant-flux" reflant)
                (save-flux "transcoc-flux" transcoc))

If, instead, what you want is:

        if no-ant? then
                (save-flux "reflant-flux" reflant)
                (save-flux "transcoc-flux" transcoc)
        endif

then what you should do is

        (if no-ant?
             (begin
                (save-flux "reflant-flux" reflant)
                (save-flux "transcoc-flux" transcoc)))

Steven
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to