<p dir="auto">On <code class="notranslate">0.7.0</code></p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using SparseArrays
m, n = 2, 2
A    = ones(m, n)
B    = ones(Int8, m, n)
C    = sparse(1:min(m, n), 1:min(m, n), ones(Int8, min(m, n)), m, n);"><pre class="notranslate"><span class="pl-k">using</span> SparseArrays
m, n <span class="pl-k">=</span> <span class="pl-c1">2</span>, <span class="pl-c1">2</span>
A    <span class="pl-k">=</span> <span class="pl-c1">ones</span>(m, n)
B    <span class="pl-k">=</span> <span class="pl-c1">ones</span>(Int8, m, n)
C    <span class="pl-k">=</span> <span class="pl-c1">sparse</span>(<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">min</span>(m, n), <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">min</span>(m, n), <span class="pl-c1">ones</span>(Int8, <span class="pl-c1">min</span>(m, n)), m, n);</pre></div>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; A
2×2 Array{Float64,2}:
 1.0  1.0
 1.0  1.0"><pre class="notranslate">julia<span class="pl-k">&gt;</span> A
<span class="pl-c1">2</span><span class="pl-k">×</span><span class="pl-c1">2</span> Array{Float64,<span class="pl-c1">2</span>}<span class="pl-k">:</span>
 <span class="pl-c1">1.0</span>  <span class="pl-c1">1.0</span>
 <span class="pl-c1">1.0</span>  <span class="pl-c1">1.0</span></pre></div>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; B
2×2 Array{Int8,2}:
 1  1
 1  1"><pre class="notranslate">julia<span class="pl-k">&gt;</span> B
<span class="pl-c1">2</span><span class="pl-k">×</span><span class="pl-c1">2</span> Array{Int8,<span class="pl-c1">2</span>}<span class="pl-k">:</span>
 <span class="pl-c1">1</span>  <span class="pl-c1">1</span>
 <span class="pl-c1">1</span>  <span class="pl-c1">1</span></pre></div>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; C
2×2 SparseMatrixCSC{Int8,Int64} with 2 stored entries:
  [1, 1]  =  1
  [2, 2]  =  1"><pre class="notranslate">julia<span class="pl-k">&gt;</span> C
<span class="pl-c1">2</span><span class="pl-k">×</span><span class="pl-c1">2</span> SparseMatrixCSC{Int8,Int64} with <span class="pl-c1">2</span> stored entries<span class="pl-k">:</span>
  [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>]  <span class="pl-k">=</span>  <span class="pl-c1">1</span>
  [<span class="pl-c1">2</span>, <span class="pl-c1">2</span>]  <span class="pl-k">=</span>  <span class="pl-c1">1</span></pre></div>
<p dir="auto">I would expect <code class="notranslate">(A .&gt;= 0) .&amp; (B .&amp; 1 .== 1) .&amp; (C .&amp; 1 .== 1)</code> to return either a <code class="notranslate">BitArray</code> or a <code class="notranslate">SparseMatrixCSC</code> of <code class="notranslate">Bool</code>-type (but not <code class="notranslate">Any</code>) entries. However,</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; (A .&gt;= 0) .&amp; (B .&amp; 1 .== 1) .&amp; (C .&amp; 1 .== 1)
2×2 SparseMatrixCSC{Any,Int64} with 2 stored entries:
  [1, 1]  =  true
  [2, 2]  =  true"><pre class="notranslate">julia<span class="pl-k">&gt;</span> (A <span class="pl-k">.&gt;=</span> <span class="pl-c1">0</span>) <span class="pl-k">.&amp;</span> (B <span class="pl-k">.&amp;</span> <span class="pl-c1">1</span> <span class="pl-k">.==</span> <span class="pl-c1">1</span>) <span class="pl-k">.&amp;</span> (C <span class="pl-k">.&amp;</span> <span class="pl-c1">1</span> <span class="pl-k">.==</span> <span class="pl-c1">1</span>)
<span class="pl-c1">2</span><span class="pl-k">×</span><span class="pl-c1">2</span> SparseMatrixCSC{Any,Int64} with <span class="pl-c1">2</span> stored entries<span class="pl-k">:</span>
  [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>]  <span class="pl-k">=</span>  <span class="pl-c1">true</span>
  [<span class="pl-c1">2</span>, <span class="pl-c1">2</span>]  <span class="pl-k">=</span>  <span class="pl-c1">true</span></pre></div>
<p dir="auto">Caching each term within parentheses first</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="I_A  = A .&gt;= 0
I_B  = B .&amp; 1 .== 1
I_C  = C .&amp; 1 .== 1
I_BC = (B .&amp; 1 .== 1) .&amp; (C .&amp; 1 .== 1);"><pre class="notranslate">I_A  <span class="pl-k">=</span> A <span class="pl-k">.&gt;=</span> <span class="pl-c1">0</span>
I_B  <span class="pl-k">=</span> B <span class="pl-k">.&amp;</span> <span class="pl-c1">1</span> <span class="pl-k">.==</span> <span class="pl-c1">1</span>
I_C  <span class="pl-k">=</span> C <span class="pl-k">.&amp;</span> <span class="pl-c1">1</span> <span class="pl-k">.==</span> <span class="pl-c1">1</span>
I_BC <span class="pl-k">=</span> (B <span class="pl-k">.&amp;</span> <span class="pl-c1">1</span> <span class="pl-k">.==</span> <span class="pl-c1">1</span>) <span class="pl-k">.&amp;</span> (C <span class="pl-k">.&amp;</span> <span class="pl-c1">1</span> <span class="pl-k">.==</span> <span class="pl-c1">1</span>);</pre></div>
<p dir="auto">would produce</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; I_A .&amp; I_B .&amp; I_C
2×2 BitArray{2}:
  true  false
 false   true"><pre class="notranslate">julia<span class="pl-k">&gt;</span> I_A <span class="pl-k">.&amp;</span> I_B <span class="pl-k">.&amp;</span> I_C
<span class="pl-c1">2</span><span class="pl-k">×</span><span class="pl-c1">2</span> BitArray{<span class="pl-c1">2</span>}<span class="pl-k">:</span>
  <span class="pl-c1">true</span>  <span class="pl-c1">false</span>
 <span class="pl-c1">false</span>   <span class="pl-c1">true</span></pre></div>
<p dir="auto">that is somehow inconsistent with</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; (A .&gt;= 0) .&amp; I_BC
2×2 SparseMatrixCSC{Bool,Int64} with 2 stored entries:
  [1, 1]  =  true
  [2, 2]  =  true"><pre class="notranslate">julia<span class="pl-k">&gt;</span> (A <span class="pl-k">.&gt;=</span> <span class="pl-c1">0</span>) <span class="pl-k">.&amp;</span> I_BC
<span class="pl-c1">2</span><span class="pl-k">×</span><span class="pl-c1">2</span> SparseMatrixCSC{Bool,Int64} with <span class="pl-c1">2</span> stored entries<span class="pl-k">:</span>
  [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>]  <span class="pl-k">=</span>  <span class="pl-c1">true</span>
  [<span class="pl-c1">2</span>, <span class="pl-c1">2</span>]  <span class="pl-k">=</span>  <span class="pl-c1">true</span></pre></div>
<p dir="auto">First of all, I'm no Julia expert, so please forgive me if this is user error.</p>
<p dir="auto">Under the following circumstances, i am unable to use pmap to call an anon function within an anon function.</p>
<p dir="auto">The following error is displayed:</p>
<ul dir="auto">
<li><code class="notranslate">UndefVarError: 27#54 not defined</code></li>
<li><code class="notranslate">in #26 at [file.jl:pmap line of code]</code></li>
</ul>
<p dir="auto">When running the following code:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pmap(arg -&gt; method1(() -&gt; method2(arg)), input_args_array, err_stop=true)

@everywhere function method1(sub_func)
    sub_func()
end`

@everywhere function method2(arg)
    println(arg)
end"><pre class="notranslate"><span class="pl-c1">pmap</span>(arg <span class="pl-k">-&gt;</span> <span class="pl-c1">method1</span>(() <span class="pl-k">-&gt;</span> <span class="pl-c1">method2</span>(arg)), input_args_array, err_stop<span class="pl-k">=</span><span class="pl-c1">true</span>)

<span class="pl-c1">@everywhere</span> <span class="pl-k">function</span> <span class="pl-en">method1</span>(sub_func)
    <span class="pl-c1">sub_func</span>()
<span class="pl-s"><span class="pl-pds"><span class="pl-c1">end</span>`</span></span>
<span class="pl-s"></span>
<span class="pl-s">@everywhere function method2(arg)</span>
<span class="pl-s">    println(arg)</span>
<span class="pl-s">end</span></pre></div>
<p dir="auto">Note this only occurs if I run up julia with <code class="notranslate">-p 1</code>. If i don't include <code class="notranslate">-p 1</code> everything works fine.</p>
<p dir="auto">This also only occurs with -p 1 if i use 2x anon funcs. If i do the following it works fine:<br>
<code class="notranslate">arg -&gt; method1()</code><br>
<code class="notranslate">arg -&gt; method1(method2)</code></p>
<p dir="auto">Thanks,<br>
Jon</p>