http://jsoftware.com/help/learning/11.htm
Learning J
        
Chapter 11: Tacit Verbs Concluded


11.5 Parametric Functions

The following example shows the consequences of nouns being evaluated
and verbs not in an expression for a tacit verb.

A curve may be specified by an equation such as, for example:

            y  =  lambda * x * (1 - x)

This equation describes a family of similar parabolic curves, and
different members of the family are picked out by choosing different
values for the number lambda.

A function to correspond to this equation might be written explicitly as verb P:

   P =: 3 : 'lambda * y * (1-y)'

Here lambda is not an argument to function P, but a variable, a
number, which makes a difference to the result. We say that lambda is
a parameter, or that function P is parametric.

x=:0.6  lambda=: 3.0    P x     lambda=: 3.5    P x
0.6     3       0.72    3.5     0.84

Now, can we write a tacit version of P taking lambda as a parameter?

lambda is currently 3.5. If we now generate a tacit form of P

   tP =: 13 : 'lambda * y * (1-y)'
   tP
3.5 * ] * 1 - ]

then we see that lambda is treated as a constant, not a parameter.
This is not what we want.

Further explanation and workarounds follow.

On Sun, July 22, 2012 2:37 pm, Brian Schott wrote:
> Ric,
>
> Thanks for that fact, which I never new.
>
> On Sun, Jul 22, 2012 at 1:48 PM, Ric Sherlock <[email protected]> wrote:
>> When you assign a Tacit verb to a name the value of the nouns in the
>> definition are "compiled" in to the tacit definition. If you use an
>> explicit definition the noun will be reevaluate d each time.
> --
> (B=)

-- 
Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to