Not at all, I think.  The rule is:

In-place assignment is used only for sentences that are converted to words when an explicit definition is created.

In your examples, the sentences in the body of the definition would qualify (but they don't use an inplaceable form). The sentence executed by ". would not.

Similarly for mapped files: anything in an explicit definition (except ". lines) is inplaceable. Only lines from the keyboard, or lines in a script that are not parts of explicit definitions, would be affected.

Henry Rich

On 8/31/2016 7:14 AM, 'Pascal Jasmin' via Programming wrote:
You use the terms script and explicit I assume meaning just one of them 
(explicit is what you meant?)

how would it impact these functions?

assign =: 4 : '(x) =: y'
assignwith =: 1 : ('(y) =: u ". y';':';'(y) =: x u ". y')
assignwithC =: 2 : ('(y) =: u (y~ [ ]) :: (n"_) 1';':';'(y) =: x u (y~ [ ]) :: 
(n"_) 1 ')

    3 + assignwithC 0 'abc'
3
    3 + assignwith 'abc'
6
   abc
6




________________________________
From: Henry Rich <[email protected]>
To: Programming forum <[email protected]>
Sent: Wednesday, August 31, 2016 5:23 AM
Subject: [Jprogramming] Heads up: Assignment-in-place to be only from script


I am working on emancipating the in-place operations so that they can be
performed inside sentences, not just in the special forms.  Thus, in

a =. ({."1 b) , c

the , would be performed in-place.  In-place operations will be
recognized whenever the arguments are results (rather than names or
constants).  As another example, something like

a =. b + , >: c

will perform the , in place.

In-place operations will also be recognized when one argument is being
reassigned:

a =: a , blah   NB. This has always been handled in place

a =. b =: b , blah   NB. This would not have been in place


Here's the catch: in-place assignments will be recognized ONLY FOR LINES
EXECUTED IN EXPLICIT DEFINITIONS.  If you type those in from the
keyboard, you will get new blocks allocated.

This makes the implementation easier, and I reasoned that lines from the
console are not performance-critical anyway.

But now I'm thinking I should ask, in case this would cause trouble for
people with applications like mapped files.  If you really need
append-in-place from the console you will have to use something like

apip =. 4 : '3 : (x , ''=:'' , x , '', y'') y'

and type

'name' apip value

Anybody got a problem with that?

Henry Rich
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to