Hi. I’m blanking on something basic and research isn’t helping. When the
blindingly obvious solution is revealed I will blame a combination of sleep
deprivation and senescence.
I’ve got a long list of coordinates ordered by desirability. I want to invoke
f (a custom script) with each coordi
This sounds like a terminated fold.
Something like
https://wiki.jsoftware.com/wiki/Vocabulary/fcap#How_should_I_define_u_and_v.3F
... maybe 0 ]F..(_2 Z: f@[) coords
(That said, you probably want to restructure your description a bit so
that you can get a useful result from all of this work.)
I
}.^:(0 = f@{.)^:_
will return the list with the head being the first f not equal 0.
On Friday, October 21, 2022 at 12:19:41 p.m. EDT, Ed Gottsman
wrote:
Hi. I’m blanking on something basic and research isn’t helping. When the
blindingly obvious solution is revealed I will blame a
Raul,
As usual, instant help: to my nightly prayers I will add the hope that I never
take you for granted.
Fold! Yes. Of course. I’ve read about fold but never tried it…but when I put
in one of the examples I got a nonce error
z =: u F:. v y
not found:
/private/var/mobile/Containers/Dat
if you want the index rather than the coordinate values, then
(1 i.~ f) y
will "short circuit" to the first 1
and
({~ 1 i.~ f)
may be faster to get first coordinates than my original solution, though errors
if there are no items with 1 = f
On Friday, October 21, 2022 at 12:55:41 p.m. EDT
Pascal,
Your original solution is perfect for me—I don’t happen to need the index. And
there may in fact be no items with f = 1.
Very clever: it gets a place of honor in the flashcard deck :-).
Many thanks.
Ed
Sent from my iPad
> On Oct 21, 2022, at 12:46 PM, 'Pascal Jasmin' via Programming
I don't know whether you'r only looking for a tacit function, but this
would also likely work if fold is unavailable for you (untested):
{{ for_val. y do. if. f val do. val_index{y return. end. end.}} coords
Jan-Pieter
On Fri, 21 Oct 2022, 19:51 Ed Gottsman, wrote:
> Pascal,
>
> Your original
Ed,
I am pretty sure that the iPad version of J is version 901
Cheers, bob
> On Oct 21, 2022, at 11:55, Jan-Pieter Jacobs
> wrote:
>
> I don't know whether you'r only looking for a tacit function, but this
> would also likely work if fold is unavailable for you (untested):
>
> {{ for_val. y
Jan-Pieter,
Thank you for the solution. I’m a huge tacit fan (or maybe the word is
“dilettante”) when writing J…less so when reading it a week later :-). In this
particular case the tacit solution wins on elegance and (at least at the
moment) seems perfectly clear.
Thanks again.
Ed
Sent fr
Bob writes
> I am pretty sure that the iPad version of J is version 901
Actually it's the beta-k version of j903.
j901 is the App Store "Product Name" (…poor choice) and is carved in
stone, alas.
Updates have to keep the same name, else it's an entirely new product.
On Fri, 21 Oct 2022 at 19:57,
You could make f throw on success. You'd then simply have f"_1 :: 1, and,
assuming f still returns 0 on failure, the result of the entire expression
would tell you if there was a success, or if all the coordinates failed.
On Fri, 21 Oct 2022, Ed Gottsman wrote:
Hi. I’m blanking on something
Getting off topic, but why don’t the new Fold primitives work in the iPad app,
given it’s J9.03 beta-k?
The info screen links to a NuVoc description. I tried the example starting
with
v=: dyad define
z=. y + 0.01
z [smoutput x ; 'v' ; y ; '-->' ; z
)
…..
Pasting into a new script and ru
I believe the fold implementation requires an addon to be installed.
--
Raul
On Fri, Oct 21, 2022 at 6:49 PM 'Mike Day' via Programming
wrote:
>
> Getting off topic, but why don’t the new Fold primitives work in the iPad
> app, given it’s J9.03 beta-k?
>
> The info screen links to a NuVoc de
Now I've looked back to where this matter was raised, I see it concerns
Fold …
In j901-for-iOS, Fold is implemented in J, but called (as specified) with a
primitive, e.g. (F:.)
Enter:
- F:. + i.6
_1 _3 _6 _10 _15
If that doesn't work, then you're missing the script:
~addons/dev/fold/fold.ijs
I
The error message said that the foldr script is missing, didn't it?
Henry Rich
On Fri, Oct 21, 2022, 6:49 PM 'Mike Day' via Programming <
programm...@jsoftware.com> wrote:
> Getting off topic, but why don’t the new Fold primitives work in the iPad
> app, given it’s J9.03 beta-k?
>
> The info
Yes.
On my machine, having restored the original App Store app, it gives:
not found:
/private/var/mobile/Containers/Data/Application/6AF656DB-BA4F-4FEA-BC8B-81302C6746B2/Documents/j/addons/dev/fold/foldr.ijs
|nonce error
| -F:.+i.6
Sorry, did I write: fold.ijs earlier?
You need foldr.ijs
16 matches
Mail list logo