Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread Jose Mario Quintana
erb( and so usable in tacit expressions): > > itmemamend =: 4 : 'x}y' > > there are also enhancement as to rank that can replace the simpler case > above: > > itemamend2 =: (([: ;/(,.i.@#))@:[ { ])"1 _ > itemamend =: 4 : '((2}.$y) $"1 0 x)} y' > > &

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread Marshall Lochbaum
But the code you gave doesn't perform an in-place amend with J's current implementation. Compare: a=.?~1e7 6!:2 'a =. 2 (9}) a' 1.6e_5 6!:2 '?~1e7' 2.71278 6!:2 '2&(9})^:100 ?~1e7' 10.6457 Of course it's possible for J to do an in-place amend in this situation, as J's arrays a

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread Danyel Lawson
I think you can use a gerund for more dynamic amend source subset and replacement parts like with the power verb or insert. I am looking for an opportunity to refactor or factor in gerund usage to everything I write as gerunds are obviously the proper way to write in j after you get your head aroun

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread Raul Miller
Actually, there's no problem with doing an in-place amend in tacit code. For example: 2 (9}) ?~1e7 If something goes wrong, you have trashed the right argument being passed in to the tacit amend, but it wasn't stored anywhere else so it would have been lost anyways. The problem occurs wh

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread 'Pascal Jasmin' via Programming
e simpler case above: itemamend2 =: (([: ;/(,.i.@#))@:[ { ])"1 _ itemamend =: 4 : '((2}.$y) $"1 0 x)} y' - Original Message - From: Jose Mario Quintana To: Programming forum Cc: Sent: Tuesday, July 22, 2014 12:39:33 PM Subject: Re: [Jprogramming] Tacit J and indexed repl

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread Jose Mario Quintana
Don wrote: "I think it would be impossible to do an amendment in place in tacit code" It is not possible to amend in place tacitly in the official version of J. However, tacit versions of amend, and append, in-place have been implemented in an special version of J. These are definitively not for

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-22 Thread Jose Mario Quintana
Erling wrote: "I can't follow and it seems I might be misinterpreted." No worries, all I was (am) saying, or trying to say, was that I am not done yet discussing the topics raised in this thread; often I disengage from the forums for extended periods for one reason or another, and last time was fo

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-21 Thread Erling Hellenäs
I can't follow and it seems I might be misinterpreted. /Erling On 2014-07-20 23:04, Jose Mario Quintana wrote: I was on vacation eating and drinking at street side stands in Mexico City and sun bathing on the Mayan Riviera. I am sorry. Nah, I am not. On Sun, Jul 20, 2014 at 3:59 PM, Erling H

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-20 Thread Jose Mario Quintana
I was on vacation eating and drinking at street side stands in Mexico City and sun bathing on the Mayan Riviera. I am sorry. Nah, I am not. On Sun, Jul 20, 2014 at 3:59 PM, Erling Hellenäs wrote: > Didn't we finish this thread? How about a new thread, possibly with > summaries from earlier di

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-20 Thread Erling Hellenäs
Didn't we finish this thread? How about a new thread, possibly with summaries from earlier discussions? This thread was only about indexed replacement and Amend? /Erling On 2014-07-20 21:17, Jose Mario Quintana wrote: "It's déjà vu all over again." :) ( http://www.jsoftware.com/pipermail/pr

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-20 Thread Jose Mario Quintana
"It's déjà vu all over again." :) ( http://www.jsoftware.com/pipermail/programming/2009-December/017478.html http://www.jsoftware.com/pipermail/programming/2009-December/017480.html http://www.jsoftware.com/pipermail/programming/2009-December/017482.html ) On Tue, Jul 8, 2014 at 7:05 PM, Erling

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-11 Thread Ian Clark
> > > the very definition and purpose of Amend. > > > > > > > > > > > > > > In general, using Amend to construct an array for the first > time > > > > seems > > > > > > fine > > > > > > > to me.

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-11 Thread bill lam
t; > seems > > > > > fine > > > > > > to me. What I'd be more wary of is if you notice yourself using > > for > > > > > > intermediate transformations - particularly if the changes (the > > uses > > > of > > &g

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-11 Thread Ian Clark
u notice yourself using > for > > > > > intermediate transformations - particularly if the changes (the > uses > > of > > > > }) > > > > > are both frequent and small, because that's indicative of the > "scalar > > > > >

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-11 Thread Ric Sherlock
gt; > I'd further say that if you're confident in your use of J and > > > > array-oriented programming, there's no particular reason to *avoid* > > > amend. > > > > I think you'll just naturally find yourself using it less. But in > the > > > > c

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Ian Clark
nd. > > > I think you'll just naturally find yourself using it less. But in the > > > cases where it's the right tool for the job - well, then, it's the > right > > > tool for the job. I'd use it with no more compunction than I'd have > > about &

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Ric Sherlock
s the right tool for the job - well, then, it's the right > > tool for the job. I'd use it with no more compunction than I'd have > about > > # or /. or + or whatever. (But that's because I'm an egomaniac, and I'm > > pretty

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Ian Clark
bout > # or /. or + or whatever. (But that's because I'm an egomaniac, and I'm > pretty sure of my ability to discriminate the situations } is the right > tool for the job, and when I'm using it as a crutch.) > > -Dan > > - Original Message

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Dan Bron
tions } is the right tool for the job, and when I'm using it as a crutch.) -Dan - Original Message --- Subject: Re: [Jprogramming] Tacit J and indexed replacement From: Ben Gorte - CITG Date: Thu, 10 Jul 2014 14:43:01 + To: "programm...@jsoftware.com&q

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Raul Miller
gt;>N =: v (;/i) } 1000 1000$0 >> >> And of course: >>N -: M >> 1 >> >> Is there a better way to do this? >> >> Ben >> ___ >> From: programming-boun...@forums.jsoftware.com >> [programming-boun...@forums.jso

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Ben Gorte - CITG
> [programming-boun...@forums.jsoftware.com] on behalf of Dan Bron > [j...@bron.us] > Sent: Tuesday, July 08, 2014 02:23 > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Tacit J and indexed replacement > > Do you have examples, in practice, where you've wanted

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Raul Miller
> > Ben > ___ > From: programming-boun...@forums.jsoftware.com > [programming-boun...@forums.jsoftware.com] on behalf of Dan Bron > [j...@bron.us] > Sent: Tuesday, July 08, 2014 02:23 > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Taci

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-10 Thread Ben Gorte - CITG
[programming-boun...@forums.jsoftware.com] on behalf of Dan Bron [j...@bron.us] Sent: Tuesday, July 08, 2014 02:23 To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement Do you have examples, in practice, where you've wanted to modify one item (or a sublist) f

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-09 Thread Ian Clark
Dan wrote: >My contention (and I think Ian and Henry's, though I don't want to put >words in their mouths) is that J encourages holistic (i.e. all-at-once) >thinking, which makes the use of } much rarer in J than one would expect >coming from other languages. Yes, I'd go along with that. Splitting

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Linda Alvord
: [Jprogramming] Tacit J and indexed replacement @Linda - the "domain error" is because you've defined h as: h=: 3 :'0 x } y' That should have been h=: 4 :'0 x } y' if you're going to call h dyadically. But I sympathize. Exactly this error catches me out all too ofte

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Dan Bron
al Message --- Subject: Re: [Jprogramming] Tacit J and indexed replacement From: Jose Mario Quintana Date: Tue, 8 Jul 2014 18:10:27 -0400 To: Programming forum Dan, ultimately, I find difficult to agree, or disagree, with the statement: " x m} y is used in J much less than

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Erling Hellenäs
One thing I find fascinating with J is that it forces you to put the operations in logical order. At least that's how I feel. If I have three pieces of information to do something with I think a little more, do something with two pieces, then use the result to include another piece. When I firs

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Dan Bron
Dan wrote: > I rarely find a call for } . I'm wondering if you've > [Pepe] have invented or discovered generally beneficial > uses of } unrelated to performance. Pascal responded: > I think } (dyadic amend) is pretty essential. > The obvious use is amending one (or sublist) item >

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Don Guinn
J avoids a pitfall in scalar language amend by replacement. It verifies that the replacement won't crash half-way through leaving the data corrupted. It is transparent to the program whether the amend amends in place or not, other than performance. And sometimes amend makes more sense than other wa

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Erling Hellenäs
In most languages indexed replacement is indexed replacement? In J and in most functional languages it is not? You get a brand new variable? So, why give the user the flawed impression he can still do indexed replacement and do amendments to variables/nouns? And at the same time in tacit code w

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Don Guinn
I think it would be impossible to do an amendment in place in tacit code, but amendment should still work in a tacit expression, just not in place. But if the result were assigned back to the original variable what will happen? Would the tacit expression prevent it from recognizing the operation as

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Jose Mario Quintana
Erling wrote: "It's obviously not possible to do any amendments in tacit code?" Adding after wards: "A principle of functional programming is you never modify a variable?" From my perspective those (rhetorical?) questions are separate. Regarding the first question, consider the verb (v) that p

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Jose Mario Quintana
certainly (especially in my "professional J-ing" days) > see the benefit of } for performance. But I'm wondering if you've > invented or discovered generally beneficial uses of } unrelated to > performance. I'd be very interested in that, if so ('cause the only on

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Ian Clark
end. On Tue, Jul 8, 2014 at 1:22 PM, Linda Alvord wrote: > I'm comparing it to the post below it that says it is a verb. It struck > me as a peculiar inconsistency.'' > > Linda > > -Original Message- > From: programming-boun...@forums.jsoftware.com [mailto: &

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Linda Alvord
: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement I think we have covered these issues with you before. Do you remember why you should get that error? Thanks, -- Raul On 7/8/14, Linda Alvord wrote: > And then! > > h=: 3 :'0 x } y' >

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Linda Alvord
July 08, 2014 5:52 AM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement I think we have covered these issues with you before. Do you remember why you should get that error? Thanks, -- Raul On 7/8/14, Linda Alvord wrote: > And then! > > h=: 3 :&

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Erling Hellenäs
om: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On BehalSSf Of Linda Alvord Sent: Tuesday, July 08, 2014 5:14 AM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement Ian's post was very early in this threa

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Raul Miller
; > -Original Message- > From: programming-boun...@forums.jsoftware.com > [mailto:programming-boun...@forums.jsoftware.com] On BehalSSf Of Linda > Alvord > Sent: Tuesday, July 08, 2014 5:14 AM > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Tacit J and indexed rep

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Linda Alvord
: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement Ian's post was very early in this thread, but something has puzzled me for a while as I tried to write a tacit version: f=: 13 :'0 x } y' 4 5 f i.11 0 1 2 3 0 0 6 7 8 9 10 g=: 4 :'0 x

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-08 Thread Linda Alvord
g 4 : '0 x } y' 4!:0 <'f' 3 4!:0 <'g' 3 Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Ian Clark Sent: Sunday, July 06, 2014 3:54 AM To: pr

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Linda Alvord
ramming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Marshall Lochbaum Sent: Monday, July 07, 2014 11:07 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement Dan didn't really give you the whole story (well, I

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Marshall Lochbaum
Dan didn't really give you the whole story (well, I won't either, I suppose), so I'll discuss this a bit more. An array in J (which refers to a multidimensional array, rather than just a list) consists of a shape given by $ and a ravel given by , . The entire ravel is stored contiguously in memory

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Raul Miller
hough it can generally be achieved with a gerund version of }) > that provides verb based amend. > > amend_z_ =: 2 : 0 > s=. v"_ y > (u (s{y)) (s}) y > : > s=. v"_ y > (x u (s{y)) (s}) y > ) > > > - Original Message - > From: Dan Bron > To: &

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread 'Pascal Jasmin' via Programming
23:54 PM Subject: Re: [Jprogramming] Tacit J and indexed replacement Do you have examples, in practice, where you've wanted to modify one item (or a sublist) from a data structure? Would you say those circumstances are the exception or the rule? (I'm asking because it's definitely the excep

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
> From: Dan Bron > To: programm...@jsoftware.com > Cc: > Sent: Monday, July 7, 2014 7:42:35 PM > Subject: Re: [Jprogramming] Tacit J and indexed replacement > > Pepe, I'm with Ian and Henry on this one: questions of efficiency aside, I > rarely find a call for } . The only

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread 'Pascal Jasmin' via Programming
lementing the example in this thread. - Original Message - From: Dan Bron To: programm...@jsoftware.com Cc: Sent: Monday, July 7, 2014 7:42:35 PM Subject: Re: [Jprogramming] Tacit J and indexed replacement Pepe, I'm with Ian and Henry on this one: questions of efficiency aside,

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
The answer to all three of your questions, in the current implementation of J, is "yes" (where a "generalized array" corresponds to J's "boxed array"). But bear in mind that J is an abstract language, a notation independent of any implementation, and so future implementations may make choices w

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
A generalized array is only an array of links to arrays? When you allocate a new generalized array, the arrays it links to can remain? When you assign a new array in a cell of your generalized array, all you have to do is set a link to the array assigned to the cell? /Erling On 2014-07-08 01:1

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
d, scalar substitution). -Dan - Original Message --- Subject: Re: [Jprogramming] Tacit J and indexed replacement From: Jose Mario Quintana Date: Mon, 7 Jul 2014 19:12:55 -0400 To: Programming forum Ian wrote: " And the reason for that has less to do with finding it

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread David Lambert
6 17 8 >Date: Mon, 07 Jul 2014 20:46:32 +0200 >From: Erling Hellen?s >To: programm...@jsoftware.com >Subject: Re: [Jprogramming] Tacit J and indexed replacement >Message-ID: <53baeb08.3070...@erlinghellenas.se> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Jose Mario Quintana
Ian wrote: " And the reason for that has less to do with finding it "hard to get my head round Amend" than the fact that "in-place array modification" is a technique that goes hand-in-hand with a scalar approach to problem-solving, which is not what J is designed to do well. " How come? In the fo

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
J is not a pure functional language. But tacit J is a (n almost) purely functional subset of J (exceptions include things like ? and s:, but much more importantly !:). In particular, tacit J /has no variables/. You can't, in any way, modify a previous result, because you have no way to refer to

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
Yes, what I said is it seems like a misnomer. Functional J has variables, but they are handled by the interpreter? Still they are never changed? This could create a performance problem if you do a lot of small changes to big data structures? It is essential to handle this efficiently? Still J d

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Jose Mario Quintana
What variable? Tacit programming does not refer to any arguments explicitly; or, are you saying that “amend” is a misnomer (if so, that is not my domain)? On Mon, Jul 7, 2014 at 6:07 PM, Erling Hellenäs wrote: > A principle of functional programming is you never modify a variable? What > Amend

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
A principle of functional programming is you never modify a variable? What Amend does is create a new variable from other existing variables? Nothing is amended? /Erling On 2014-07-07 23:50, Jose Mario Quintana wrote: Erling wrote: " It's obviously not possible to do any amendments in tacit co

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
R.E. wrote: > 2 2 3 Linda wrote: > 123 123 2 3 >2 2 2 R.E. Boss' original example: http://jsoftware.com/help/dictionary/d530v.htm [2] In f} y , f addresses the indices of the _ravel_ of y, even though the Vocabulary doesn't say that: http://www.jsoftware.com/pipe

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Jose Mario Quintana
Erling wrote: " It's obviously not possible to do any amendments in tacit code? It is also less elegant to pass these three parameters in the two arguments in tacit code? " Well, Raul and I showed general verbs to perform amendments tacitly. Once I was as puzzled as you are (were?) but I found en

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
Erling Hellenäs wrote: > q([ } ])x,:y This doesn't do what you expect because } isn't what you think it is. Unlike (for example) { which is a verb, } is an adverb: a completely different kind of animal, with completely different rules. That's why you're having trouble using it tacitly. Using

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
Hi all ! Just to clarify one thing: q } x,:y 0 11 2 13 4 15 6 17 8 q([ } ])x,:y 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 17 18 q ([ {"0 1 ] ) x,"0 y 0 11 2 13 4 15 6 17 8 Why is Amend so much faster then From? It seems to do the same thing? /Erling On 2014-07-07 22:19, Dan Bron

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Linda Alvord
Odd: 1 mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Erling Hellenäs Sent: Monday, July 07, 2014 2:47 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement An example: x=:3 3 $i.9 y=:x+10 q=:2|x x 0 1 2 3 4 5 6 7 8 y 10 11 12 13

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
I wrote: > If you want to be able to calculate q on-the-fly, using tacit code, > here's a little helper utility: > ... > It works on the same principles as x q} y , using gerund} to permit > the calculation of q from x and/or y at runtime. It's a bit convoluted > because the definition

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
I wrote: > mergeMask =: (&>) / (`>) } (@:,) (&<) In retrospect, given that x and y will by definition agree in type and shape, we can skip the boxing and simplify mergeMask: mergeMask =: / (`]) } (@:,:) x (2|[) mergeMask y 0 11 2 13 4 15

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
ger said: "The pattern is that the monadic case of gerund op uses the monadic meaning of op while the dyadic case uses the dyadic meaning. In the case of gerund} , the dyadic case IS allowed, but it is invoked via x gerund}y ." http://www.jsoftware.

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
An example: x=:3 3 $i.9 y=:x+10 q=:2|x x 0 1 2 3 4 5 6 7 8 y 10 11 12 13 14 15 16 17 18 q 0 1 0 1 0 1 0 1 0 q {"0 1 x,"0 y 0 11 2 13 4 15 6 17 8 /Erling On 2014-07-07 19:53, Erling Hellenäs wrote: It's obviously not possible to do any amendments in tacit code? It is also le

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Marshall Lochbaum
> > > > > >R.E. Boss > > > >(Add your info to http://www.jsoftware.com/jwiki/Community/Demographics ) > > > > > > > >>-Original Message- > >>From: programming-boun...@forums.jsoftware.com [mailto:programming- > >>boun...@forums

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread 'Pascal Jasmin' via Programming
its equivalent to 1 2 3 < 2 2 2 1 2 3,:2 2 2 creates 2 items (each item a list) - Original Message - From: Erling Hellenäs To: programm...@jsoftware.com Cc: Sent: Monday, July 7, 2014 2:05:03 PM Subject: Re: [Jprogramming] Tacit J and indexed replacement This one beats me. look

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread 'Pascal Jasmin' via Programming
14 1:53:52 PM Subject: Re: [Jprogramming] Tacit J and indexed replacement It's obviously not possible to do any amendments in tacit code? It is also less elegant to pass these three parameters in the two arguments in tacit code? Any opinions about the use of From to do the same thing?

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
4 12:33 To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit J and indexed replacement Another approach for this is: (x*-.q)+y*q Sadly, that only works when x and y are numeric. Boxes and literals do not have zero and 1 values (hypothetically "fill" could be zero, but "1&

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
It's obviously not possible to do any amendments in tacit code? It is also less elegant to pass these three parameters in the two arguments in tacit code? Any opinions about the use of From to do the same thing? NB. x and y are arrays of the same rank NB. q is a boolean, also of this rank NB. T

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Dan Bron
REB wrote: > 2 2 3 Wow. That's going right into PrimitivePrimitives! max =. .) (100 100 ?@$ 0) 1 -Dan -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread R.E. Boss
4 12:33 > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Tacit J and indexed replacement > > Another approach for this is: >(x*-.q)+y*q > > Sadly, that only works when x and y are numeric. Boxes and literals do > not have zero and 1 values (hypothetically "fill

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Raul Miller
Another approach for this is: (x*-.q)+y*q Sadly, that only works when x and y are numeric. Boxes and literals do not have zero and 1 values (hypothetically "fill" could be zero, but "1" is harder to rationalize.) A variant which uses amend might be: (q#y) (I.q)} x This only works when x an

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Erling Hellenäs
Hi all ! About the problem I want to solve. Generally you compare some arrays and you want to replace part of one of them with info from the other or from some other array of the same dimensions? I found a solution not using Amend: NB. x and y are arrays of the same rank NB. q is a boolean

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Linda Alvord
Subject: Re: [Jprogramming] Tacit J and indexed replacement Thanks, guys, keep the ideas coming. There's enough been said in this thread to enable me to substantially improve the NuVoc presentation of Amend in http://www.jsoftware.com/jwiki/Vocabulary/curlyrt#dyadic - which I think most would

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-07 Thread Ian Clark
Thanks, guys, keep the ideas coming. There's enough been said in this thread to enable me to substantially improve the NuVoc presentation of Amend in http://www.jsoftware.com/jwiki/Vocabulary/curlyrt#dyadic - which I think most would agree doesn't present Amend in the most appealing light. Perhaps

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Raul Miller
Since it'w nagging at me (and this is still unteted code :/), here's what I currently think i should have said: amend=: (0:{::])`(1:{::])`(2:{::])}~ The trailing ~ because I need the dyad from the resulting verb, and the trailing ] on each because those verbs need to ignore one of the resulting

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Raul Miller
Since it'w nagging at me (and this is still unteted code :/), here's what I currently think i should have said: amend=: (0:{::])`(1:{::])`(2:{::])}~ The trailing ~ because I need the dyad from the resulting verb, and the trailing ] on each because those verbs need to ignore one of the resulting

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Raul Miller
Meh, no, that won't work. Stick with Jose's version. (I also don't have the feature enabled which lets me cancel sending an email after "sending" it.) I'll just go do some "practical" work now... Sorry for the noise. -- Raul On 7/6/14, Raul Miller wrote: > Oops, yes. Sorry about that. > > I

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Raul Miller
Oops, yes. Sorry about that. I should have said: amend=: (0:{::)`(1:{::)`(2:{::)}~ (I'm working right now from a machine where J doesn't run, and I forget details when I don't test my code.) Thanks, -- Raul On 7/6/14, Jose Mario Quintana wrote: > Raul wrote: > " > For example: > amen

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Jose Mario Quintana
Raul wrote: " For example: amend=: 0&{::`(1&{::)`(2&{::)} amend 0;2 3 5;7#9 9 9 0 0 9 0 9 " Actually, JVERSION Installer: j602a_win.exe Engine: j701/2011-01-10/11:25 Library: 6.02.023 amend=: 0&{::`(1&{::)`(2&{::)} amend 0;2 3 5;7#9 |rank error: amend | amend 0;2 3 5;7#9

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Dan Bron
=: 1 : ' a: 1 : m' > advswap =: 2 : (':';'u x v eval y') > > 1 2 3 ([ 13 advswap '}' ]) i.10 > 0 13 13 13 4 5 6 7 8 9 > > does constant replacement instead of constant index > > > - Original Message - > From: Erl

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread J. Patrick Harrington
Interesting - I'd never used "_ in that way. Works for any type: e.g., am=: 13 : 'x 13.3j_5"_`[`]}y' I really should get out more, vocabulary-wise. Patrick On Sun, 6 Jul 2014, Marc Simpson wrote: (& Raul) Try 13"_ (see http://www.jsoftware.com/jwiki/V

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Marc Simpson
Try 13"_ (see http://www.jsoftware.com/jwiki/Vocabulary/quotem) On Sun, Jul 6, 2014 at 3:51 PM, J. Patrick Harrington wrote: > > Too bad that only works for the few constant functions: >_9: _8: ... 0: 1: ... 9: > > so am=: 13 : 'x 8:`[`]}y' >3 am i. 11 > 0 1 2 8 4 5 6 7 8 9 10 > > b

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Raul Miller
x 13"_`[`]} y Thanks, -- Raul On Jul 6, 2014 10:51 AM, "J. Patrick Harrington" wrote: > > Too bad that only works for the few constant functions: >_9: _8: ... 0: 1: ... 9: > > so am=: 13 : 'x 8:`[`]}y' >3 am i. 11 > 0 1 2 8 4 5 6 7 8 9 10 > > but you can't use a general value: > >

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread J. Patrick Harrington
Too bad that only works for the few constant functions: _9: _8: ... 0: 1: ... 9: so am=: 13 : 'x 8:`[`]}y' 3 am i. 11 0 1 2 8 4 5 6 7 8 9 10 but you can't use a general value: am=: 13 : 'x 13`[`]}y' 3 am i. 11 |domain error: am | x 13`[`]}y On Sun, 6 Jul 2014, Aai wrote:

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Raul Miller
I would agree that amend is seldom useful in much the same way that computers are seldom useful. That is: it depends on what you mean by "seldom" (and, for that matter, "useful"). Generally speaking, } is one of the less common characters that I use when I write in J, but I do use it. Also, in ad

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Ric Sherlock
I don't agree that Amend is seldom useful. I do agree that it isn't the easiest thing to get your head around (perhaps why you have found other ways to getting stuff done). Aai has shown how to tacitly use Amend so it seems that 13 : is not smart enough to give you a tacit equivalent. I suspect th

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Aai
But "13 :" refuses to give me an equivalent tacit verb ... 13 : '0 x}y' 4 : '0 x}y' Is this just a shortcoming of "13 :" ? Does anyone know a "nice" tacit equivalent? I don't. But you can use this: 13 : 'x 0:`[`]}y' -- Met vriendelijke groet, @@i = Arie Groeneveld --

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-06 Thread Ian Clark
I think Erling is quite right, if you take what he says literally: "Amend is seldom useful for indexed replacement when you write tacit J". I'd go further and say "Amend is seldom useful." Period. I write a lot of J code and I hardly ever use it. To someone coming from C (say), this cries out for

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-05 Thread Raul Miller
#x27; > advswap =: 2 : (':';'u x v eval y') > >1 2 3 ([ 13 advswap '}' ]) i.10 > 0 13 13 13 4 5 6 7 8 9 > > does constant replacement instead of constant index > > > - Original Message - > From: Erling Hellenäs > To: program

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-05 Thread 'Pascal Jasmin' via Programming
;}' ]) i.10 0 13 13 13 4 5 6 7 8 9 does constant replacement instead of constant index - Original Message - From: Erling Hellenäs To: programm...@jsoftware.com Cc: Sent: Saturday, July 5, 2014 3:59:22 PM Subject: [Jprogramming] Tacit J and indexed replacement Hi all ! When you wri

Re: [Jprogramming] Tacit J and indexed replacement

2014-07-05 Thread Raul Miller
There are several alternatives you have not yet noticed. But, what problem are you trying to solve? Thanks, -- Raul On Jul 5, 2014 3:59 PM, "Erling Hellenäs" wrote: > Hi all ! > > When you write tacit code, the index m used by Amend, syntax description > x m} y, is a constant? > Normally you

[Jprogramming] Tacit J and indexed replacement

2014-07-05 Thread Erling Hellenäs
Hi all ! When you write tacit code, the index m used by Amend, syntax description x m} y, is a constant? Normally you have a variable you want to use for indexing? This means Amend is seldom useful for indexed replacement when you write tacit J? Are there any descriptions of nice ways to do in