Why do you have the asterisks (`*`) in your macro definition?
I'm pretty sure the "OnePump.λ$λno" interpolation isn't going to work. I
don't think you can't interpolate into a symbol like that. You may have to
try renaming those variables more generically, or do some manual symbol
construction; i.e. symbol("OnePump.λ" * string($λno))
On Mon, Jul 7, 2014 at 11:05 AM, Andrei Berceanu <[email protected]>
wrote:
> Jacob, tnx for the quick reply and sorry about the redundant for loop.
> This is how I decided to do it:
>
> macro scatter(axno, reim, λno, col)
> :(*axes[$axno][:scatter](sbox.kx, $reim([OnePump.λ$λno(0., momx, np)
> for momx in sbox.kx]), s=15, alpha=0.2, color=$col) )*
> end
>
> fig, axes = plt.subplots(2,1, figsize=(8,6))
> @scatter(1, real, 1, "orange")
> @scatter(1, real, 2, "blue")
> @scatter(2, imag, 1, "orange")
> @scatter(2, imag, 2, "blue")
>
> but i get `missing separator in tuple` when I define the macro. Any clues
> why that might be?
>
>
> On Monday, July 7, 2014 3:40:58 PM UTC+2, Jacob Quinn wrote:
>
>> I'm not sure I quite understand your example (your `i` variable is never
>> used?), but macros just take zero or more expression/symbol arguments and
>> return expressions, so you could easily do.
>>
>> macro orangeaxes()
>> :(*axes[1][:scatter](kx, real([OnePump.λ1(0., momx, np) for momx in
>> kx]), s=15, alpha=0.4, color="orange") )*
>> end
>> macro axes()
>> :(*axes[1][:scatter](kx, real([OnePump.λ2(0., momx, np) for momx in
>> kx]), s=15, alpha=0.2) )*
>> end
>> for i = 1:2
>> @orangeaxes
>> @axes
>> @orangeaxes
>> @axes
>> end
>>
>> Note the use of the `quote....end` shorthand `:(...)` in the macro
>> definitions so that an expression is returned.
>>
>> -Jacob
>>
>>
>> On Mon, Jul 7, 2014 at 6:04 AM, Andrei Berceanu <[email protected]>
>> wrote:
>>
>>> axes[1][:scatter](kx, real([OnePump.λ1(0., momx, np) for momx in kx]),
>>> s=15, alpha=0.4, color="orange")
>>
>>
>>
>>