Danil,
The short answer to your question is that a fundamental difference between
tacit and explicit code is that the former can *not* assign variables. That
is more or less the definition of tacit code.
It is not true that this means you cannot see intermediate values. There
are several different ways to produce these; but usually only one is
applicable in a given situation.
For example:
+/ \ i.10
0 1 3 6 10 15 21 28 36 45
+:^:(<4) 1
1 2 4 8
It is also not true that explicit code is neccesarily slower than tacit
code. In fact, certain forms of assignment are supported by special,
optimized code (and, as I said, assignment can only occur in explicit code).
Further, explicit code can embed tacit code, so nothing is lost. However,
explicit verbs should not be used with a small rank.
But your question isn't really about tacit-vs-explicit, it's about
scalar-vs-array:
But the answer to your basic question is:
> Should one really always stretch his brain
> for the pure tacit solutions without use of 'temp variables'?
Yes. Or, rather, no. You're going to have to stop "thinking small". But
this will come naturally, with time and practice, and eventually array (as
opposed to scalar) solutions will no more stretch your brain than "temp
variables" do now. Less, maybe. Certainly they'll stretch your fingers
less.
-Dan
PS: By the way, it is possible to use "temp variables" in tacit code;
they'll just be anonymous. That is, you'll address them by location, not by
name.
See, for example, Arie's message earlier today:
http://www.jsoftware.com/pipermail/programming/2007-November/008726.html
where he stores a temp variable (a loop counter) in his left-hand argument.
He updates it on every iteration. But note that while it's possible to do
this, it's not desirable. In fact, the purpose of Arie's message was to
find a way to remove this artifact.
Compare it to my later versions:
http://www.jsoftware.com/pipermail/programming/2007-November/008738.html
http://www.jsoftware.com/pipermail/programming/2007-November/008742.html
And you'll see the advantage of array thinking.
--
View this message in context:
http://www.nabble.com/updating-of-a-name-from-tacit-expression-tf4779690s24193.html#a13674695
Sent from the J Programming mailing list archive at Nabble.com.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm