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

Reply via email to