<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Julia Community 🟣: gfr1337</title>
    <description>The latest articles on Julia Community 🟣 by gfr1337 (@gfr1337).</description>
    <link>https://forem.julialang.org/gfr1337</link>
    <image>
      <url>https://forem.julialang.org/images/CGXy65mglz3TtswzyVsSH930TRBNEw4bibWizUECY-E/rs:fill:90:90/g:sm/mb:500000/ar:1/aHR0cHM6Ly9mb3Jl/bS5qdWxpYWxhbmcu/b3JnL3JlbW90ZWlt/YWdlcy91cGxvYWRz/L3VzZXIvcHJvZmls/ZV9pbWFnZS8xMTc1/L2Y4NmI5YmIwLWZl/ZWUtNDcyMy1hNjVk/LTA2OGMyZTczNGUz/OC5wbmc</url>
      <title>Julia Community 🟣: gfr1337</title>
      <link>https://forem.julialang.org/gfr1337</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.julialang.org/feed/gfr1337"/>
    <language>en</language>
    <item>
      <title>Man/Boy test and why Julia doesn't specialize functional arguments by default.</title>
      <dc:creator>gfr1337</dc:creator>
      <pubDate>Thu, 14 Aug 2025 05:28:35 +0000</pubDate>
      <link>https://forem.julialang.org/gfr1337/manboy-test-and-why-julia-doesnt-specialize-functional-arguments-by-default-13kc</link>
      <guid>https://forem.julialang.org/gfr1337/manboy-test-and-why-julia-doesnt-specialize-functional-arguments-by-default-13kc</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module ManBoy
export man, boy, manboy
export @main

function man(k::Int, f1::Function, f2::Function, f3::Function, f4::Function, f5::Function)::Int
    x = Ref(k)
    b = () -&amp;gt; begin
        x[] -= 1
        man(x[], b, f1, f2, f3, f4)::Int
    end
    if x[] &amp;lt;= 0
        return f4() + f5()
    else
        return b()
    end
end

function boy(k::Int, f1::F1, f2::F2, f3::F3, f4::F4, f5::F5)::Int where {F1 &amp;lt;: Function, F2 &amp;lt;: Function, F3 &amp;lt;: Function, F4 &amp;lt;: Function, F5 &amp;lt;: Function}
    x = Ref(k)
    b = () -&amp;gt; begin
        x[] -= 1
        boy(x[], b, f1, f2, f3, f4)::Int
    end
    if x[] &amp;lt;= 0
        return f4() + f5()
    else
        return b()
    end
end

function manboy(n::Int)
    println("man($n)")
    @time println(man(n, () -&amp;gt; 1, () -&amp;gt; -1, () -&amp;gt; -1, () -&amp;gt; 1, () -&amp;gt; 0))
    println("boy($n)")
    @time println(boy(n, () -&amp;gt; 1, () -&amp;gt; -1, () -&amp;gt; -1, () -&amp;gt; 1, () -&amp;gt; 0))
end

function @main()(args)
    manboy(5)
    manboy(10)
    manboy(15)
end

end # module ManBoy

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;man(5)
0
  0.095508 seconds (58.51 k allocations: 3.080 MiB, 99.78% compilation time)
boy(5)
0
  0.070338 seconds (52.65 k allocations: 2.727 MiB, 99.63% compilation time)
man(10)
-67
  0.116278 seconds (52.27 k allocations: 3.307 MiB, 27.42% gc time, 71.93% compilation time)
boy(10)
-67
  1.764479 seconds (57.47 k allocations: 3.571 MiB, 99.95% compilation time)
man(15)
-3250
  0.438978 seconds (220.55 k allocations: 163.185 MiB, 67.07% gc time, 19.28% compilation time)
boy(15)
-3250
 46.606029 seconds (261.17 k allocations: 167.955 MiB, 0.22% gc time, 99.65% compilation time)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
