Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Xiao-Yong Jin
> On Apr 5, 2017, at 5:54 PM, Jose Mario Quintana > wrote: > > So, that is what I was missing. It seems that one can literally fix the Cannot fix explicit definition with global names. Try f=:3 :'square y' -- For informa

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Jose Mario Quintana
So, that is what I was missing. It seems that one can literally fix the problem of passing named verbs (at least it works for simple examples); make the wrapper, qromb=. 1 : 0 NB. Base wrapper qromb_nr_ (u f.`'') ; y ) square=. *: square qromb 1 2 2. square=. 3 : ' *: y'

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Xiao-Yong Jin
> On Apr 5, 2017, at 4:33 PM, Jose Mario Quintana > wrote: > > *: qromb 1 2 > 2.3 > > ((*: qromb 1 2) * *:) qromb 1 2 > 5.4 > > coname'' > ┌┐ > │base│ > └┘ > > > I must have missed something. > Try pass in a named verb. And when I said calling qromb inside of qromb,

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Jose Mario Quintana
I must be the least qualified member of the forum to comment on this because I write tacitly and I fix everything (no names, no name conflicts). Yet, I occasionally use external explicit verbs which might include explicit adverbs or conjunctions. Apologies in advance if I am misunderstanding the

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Raul Miller
How about: qualify name in the calling locale? In other words, if calling locale is FOO abc becomes abc_FOO_ abc_xyz_ remains abc_xyz_ abc__Y with Y_FOO_ being X becomes abc_X_ This covers most of the important issues I can think of... The remaining issue (getting the calling locale an identif

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Xiao-Yong Jin
> On Apr 5, 2017, at 2:49 PM, 'Pascal Jasmin' via Programming > wrote: > > myadv_far_ =: locs (1 : 'u~ y') NB. cannot include locs (relevant/relative > to caller) as part of localized definition. > > >'a' myadv_far_ > 'a_far_' (1 : 'u~ y') First I would not want to pass in a string. I

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread 'Pascal Jasmin' via Programming
well, 18!:51 proposal, Returns name of the caller's locale (the locale that execution will return to after execution of the current function). But, using it would be awkward compared to passing qualified names to begin with. This can already be done generically with: loc =: (,&'_'@[ ,&'_'@,

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Henry Rich
Oooh, let's talk about this. What would you like to see? I have long wanted to be able to evaluate a name in the context of the caller of an adv/conj, so that I can pass a private name into a conjunction and have it evaluated there. If we can come up with a sound proposal, it can be implemen

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Raul Miller
The inability of determining the locale of the calling context (to qualify non-locative names with it) has bothered me for some time (many years). However, I did not have a convincing use case where it was significant (I was trying to work with trace, and that apparently was not important enough t

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Xiao-Yong Jin
> On Apr 5, 2017, at 3:32 AM, Raul Miller wrote: > > I get: > (-~&(^&3%3:)/ -: *:qromb_nr_) 1 2 > |domain error > | PolyInterpY=:PolyInterpY(j-1)}~u trapzdNext ab > That was because your code has some issues. You can see what's going on by checking the output of *trapzdNext_nr_ I did s

[Jprogramming] Google Codejam 2017

2017-04-05 Thread Thomas McGuire
Google codejam qualifying round starts this Friday April 7, 2017. The number of J programmers participating has been dwindling. I figured I would post a reminder and a link: https://code.google.com/codejam/ I learn a lot by seeing other people’s J code after t

Re: [Jprogramming] (- ~:) documented somewhere..?

2017-04-05 Thread Martin Kreuzer
For the record (and later reference) ... Euler's product formula for the totient of a number n with k *distinct* prime factors p_i reads phi(n) = n * (1 - 1/p_1) * (1 - 1/p_2) * ... * (1 - 1/p_k) Rewriting this by replacing n with the product of prime factors one gains Product (i=1 to k) ove

Re: [Jprogramming] locales with adverbs and conjunctions?

2017-04-05 Thread Raul Miller
I get: (-~&(^&3%3:)/ -: *:qromb_nr_) 1 2 |domain error | PolyInterpY=:PolyInterpY(j-1)}~u trapzdNext ab But the locale is right, which is all I was concerned with. That said, there's another issue - we are working with an anonymous verb, so we must manually set the locale back to what it