This definition of substring also conflicts with either the python
implementation or the python documentation (the referenced activestate
page is, after all, a "python recipe"):

from http://docs.python.org/release/2.7.3/library/string.html --

string.count(s, sub[, start[, end]])ΒΆ
Return the number of (non-overlapping) occurrences of substring sub in
string s[start:end].

And, trying an example in python:

$ python
>>> 'follow'.count('foo')
0

And it also conflicts with the results from the 'substring' operation
in various languages which include a definition for one (basic,
javascript, perl, ...)

-- 
Raul

On Thu, Jan 10, 2013 at 2:10 PM, Roger Hui <rogerhui.can...@gmail.com> wrote:
> If substring is a contiguous non-empty sequence of characters in the
> original, then a string of length 9 can have only 45 substrings.  The defn
> that is apparently used in this puzzle would say that "foo" is a substring
> of "follow".  That is a new one for me.
>
>
>
> On Thu, Jan 10, 2013 at 11:05 AM, David Ward Lambert <b49p23t...@stny.rr.com
>> wrote:
>
>>    NB. The palindromes needn't be unique
>>    # (#~(-:|.)&>) 'abccdadba'<@:#"1~ }. #: i.2^9
>> 50
>>
>>
>>    NB. I think the number of substrings is this:
>>
>>    1 2 3 4 5 6 7 8 9 mp 9 8 7 6 5 4 3 2 1
>> 165
>>
>>    (mp |.)@:>:i.9
>> 165
>>
>> >Date: Thu, 10 Jan 2013 10:39:39 -0800
>> >From: Roger Hui <rogerhui.can...@gmail.com>
>> >To: Programming forum <programm...@jsoftware.com>
>> >Subject: Re: [Jprogramming] Contests & Hackatons
>> >Message-ID:
>> ><camz_i_a_by01mnogsnbdffqgze+2hmcxtxlctz5q3wg3hhr...@mail.gmail.com>
>> >Content-Type: text/plain; charset=UTF-8
>> >
>> > $ ~. (#~(-:|.)&>) 'abccdadba'<@:#"1~ }. #: i.2^9
>> >29
>> >
>> >The description says there are 50 palindromes in the example so
>> something
>> >isn't right.
>> >
>> >
>> >
>> >On Thu, Jan 10, 2013 at 10:17 AM, Aai <agroeneveld...@gmail.com> wrote:
>> >
>> > Here's a BF solution
>> >
>> > ~. (#~(-:|.)&>) 'abccdadba'<@:#"1~ }. #: i.2^9
>> >
>> >
>> > On 10-01-13 18:53, Roger Hui wrote:
>> >
>> >
>> http://code.activestate.com/**recipes/577010-palindrome-**count/<
>> http://code.activestate.com/recipes/577010-palindrome-count/>says:
>> >
>> > 'abccdadba' contains 50 palindromes, not all unique. Examples are: 'a'
>> at
>> > positions 0,-4, and -1. 'aa' at (0,4),(5,-1), and (5,-1) The longest
>> is
>> > 'abdadba' This code counts the palindromes in the data variable.
>> >
>> > Since the string has 9 the number of substrings is only 45 (+/\1+i.9).
>> > Therefore, I don't understand what the description means by
>> "palindrome"
>> > or "in the data variable".
>> >
>> > On Thu, Jan 10, 2013 at 9:38 AM, David Ward Lambert
>> > <b49p23t...@stny.rr.com>wrote:
>> >
>> > The Kurukshetra contest is fun and soon. The university sponsors
>> > several contests, this one fits me best.
>> >
>> >
>> http://kurukshetra.org.in/#!/**events/athena<
>> http://kurukshetra.org.in/#!/events/athena>
>> >
>> > Of course the winners finish just about all the problems before I even
>> > start, but they did ask me to publish one of my solutions. It's in
>> > python, my j skills were insufficient then:
>> >
>> >
>> http://code.activestate.com/**recipes/577010-palindrome-**count/<
>> http://code.activestate.com/recipes/577010-palindrome-count/>
>> >
>> > Athena!
>> >
>> >
>> > We are back again with Athena ? the ultimate math-coding contest of
>> > Kurukshetra'13 which tests your prowess at solving mathematical
>> problems
>> > using your coding skills. Are you a programmer who is fine with math
>> > conceptually, but just don't like doing calculations by hand? But are
>> > you skilled to tell a computer what the math problem is and make it do
>> > the calculations for you? The event will be a spectacle with amateurs
>> > locking horns with geniuses and getting all those guns blazing to make
>> > one final stand against a looming cloud of impossibility! Gear up for
>> > this ultimate battle of your computational and programming skills.
>> >
>> > Event Starts on 26th January 2013.
>>
>> > Date: Wed, 9 Jan 2013 13:22:50 +0000
>> > From: Y-01 <darling.ki...@gmail.com>
>> > Message-ID:
>> > <CADHLgnnw2bMB5dQTQunPz2mA7v-**wV5uuVdRtb
>> >
>> > +oauy=s8hz...@mail.gmail.com>
>> >
>> > Who knows another sites where you can learn J in practice of solving
>> > problems? Mb serious problems, mb parts of work in J. Anything but in
>> >
>> > J.
>>
>> > Met vriendelijke groet,
>> > @@i = Arie Groeneveld
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> 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