s=: 'Hello Jello'
Given a string like the above, I need to tabulate the number of occurrences of
every letter for every prefix of length >=k. I also need to know the length of
the prefix. So:
As an example, prefix length=3, prefix=ell, letter=o, count=2
In my real use case k may be quite
Just in case it matters, are you regarding Hello & Jello as distinct
words here, or is
space just another character?
If they're separate, then we need only examine (;: s) or (cut s),
brackets only to delimit
the J idioms.
Thanks,
Mike
On 09/04/2021 14:48, Emir U wrote:
s=: 'Hello Jello'
Hey Mike, many thanks for looking, its all just one string. There are no
implicit delimiters in the string itself. Emir
> Just in case it matters, are you regarding Hello & Jello as distinct words
> here, or is space just another character?
> If they're separate, then we need only examine (;:
/. gives you letter-tabulations and \ gets you prefixes:
s=: 'Hello Jello'
Given a string like the above, I need to tabulate the number of
occurrences of every letter for every prefix of length >=k. I also
need to know the length of the prefix. So:
As an example, prefix length=3, prefi
Thanks - so in this slightly longer, repetitive string:
<<
s,' ',s
Hello Jello Hello Jello
>>
'llo Jell' would be a prefix (among several others!) with a count of two?
(I see Julian has posted something which is probably useful...)
Cheers,
Mike
On 09/04/2021 15:12, Emir U wrote:
Hey Mi
Hey Mike, no prefixes don't have counts, letters with prefixes have counts.
Your example: Hello Jello Hello Jello
prefix length=8, prefix=llo Jell, letter=o, count=2
That's true for 'o' because 'o' follows both occurrences.
Some more examples using your string.
prefix length=1, prefix=l, lett
You can get every substring in a list with ; <@<\\. s
If k is quite large, your approach with every k : #) <@<\ ]
tab=: (<:@# ; }: ; {:)&>
count=: ~. ,. <@#/.~
f=: count@:tab@:subs
4 f s
--
For information about J
I sent this message from an account which I think is unknown to the j
forum. Hope it doesn't appear twice.
Forwarded Message
Subject:Fwd: read failure on Mac j903 beta-h
Date: Fri, 9 Apr 2021 14:14:33 -0400
From: JAMES PATRICK HARRINGTON
To: [email protected]
'ello' (<@[ +/@:= #@[ <\ ])'Hello Jello'
will return the count of matches.
On Friday, April 9, 2021, 09:48:11 a.m. EDT, Emir U wrote:
s=: 'Hello Jello'
Given a string like the above, I need to tabulate the number of occurrences of
every letter for every prefix of length >=k. I also
About the histogram verb in stats/base
NB. The result is a list of counts of the number of data points in each
interval.
Intervals are specified by the left argument. histogram uses dyadic I.
The I. primitive defines (1+#x) intervals. See its clear definition
in Nuvoc. In short, it
I have noticed some oddities here too but mostly have ignored them and
adjusted my plots to compensate. I mostly use my own variant
"plotHistoMulti" - here:
https://code.jsoftware.com/wiki/User:Devon_McCormick/myStats - but have not
yet nailed down exactly what is off with the underlying.
On Sat,
Hello J,
"The Edges of Our Universe" is a nice and very accesible paper by Toby Ord that
discusses different natural "edges" to the universe that arise in General
Relativity (and in particular the ΛCDM model) and some futurist implications.
https://arxiv.org/abs/2104.01191
Anyway, the tail end o
12 matches
Mail list logo