<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic defining function scope changes how result is returned in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/defining-function-scope-changes-how-result-is-returned/m-p/943082#M109546</link>
    <description>&lt;P&gt;Why don't all three of these return their unevaluated argument like the first one does? Is there a way to make the last two work like the first? Inside the function, e is still unevaluated, this seems to happen when the result is returned.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
ns = New Namespace("n");

   foo = function({e}, Name Expr(e) );
ns:bar = function({e}, Name Expr(e) );

show(      foo( expr( notavar     ) ) ); // expected    returns notavar, unevalauted
show( here:foo( expr( notavarhere ) ) ); // unexpected  tries to evaluate notavarhere
show(   ns:bar( expr( notavarns   ) ) ); // unexpected  tries to evaluate notavarns&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Inside the function e is unevaluated, as expected:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ns:bart = function( {e}, Show( Name Expr(e) ) );
ns:bart( expr( notavar ) );              // expected, unevaluated&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is an uninspiring workaround by copying the function to the current default namespace, although it doesn't solve nested function calls.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;localbar = name expr( ns:bar );
show( localbar( expr( notavar ) ) );     // expected, unevaluated&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2026 01:11:18 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2026-04-21T01:11:18Z</dc:date>
    <item>
      <title>defining function scope changes how result is returned</title>
      <link>https://community.jmp.com/t5/Discussions/defining-function-scope-changes-how-result-is-returned/m-p/943082#M109546</link>
      <description>&lt;P&gt;Why don't all three of these return their unevaluated argument like the first one does? Is there a way to make the last two work like the first? Inside the function, e is still unevaluated, this seems to happen when the result is returned.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
ns = New Namespace("n");

   foo = function({e}, Name Expr(e) );
ns:bar = function({e}, Name Expr(e) );

show(      foo( expr( notavar     ) ) ); // expected    returns notavar, unevalauted
show( here:foo( expr( notavarhere ) ) ); // unexpected  tries to evaluate notavarhere
show(   ns:bar( expr( notavarns   ) ) ); // unexpected  tries to evaluate notavarns&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Inside the function e is unevaluated, as expected:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ns:bart = function( {e}, Show( Name Expr(e) ) );
ns:bart( expr( notavar ) );              // expected, unevaluated&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is an uninspiring workaround by copying the function to the current default namespace, although it doesn't solve nested function calls.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;localbar = name expr( ns:bar );
show( localbar( expr( notavar ) ) );     // expected, unevaluated&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2026 01:11:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/defining-function-scope-changes-how-result-is-returned/m-p/943082#M109546</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2026-04-21T01:11:18Z</dc:date>
    </item>
  </channel>
</rss>

