Thanks for your explanation

I tried 

something=:$@:0:` ({.);( $: }.@:])@.<:#@:]

but that gave me a domain error.

It should gather all substrings of length ( left argument) from string in
right argument. Something which can be done very simply with primitive
functions I found out here.

cheers
 
Roelof  
 
Contact information
 
Dr. Roelof K. Brouwer PEng
Professor
Department of Computing Science
School of Advanced Technologies and Mathematics
Thompson Rivers University
900 McGill Road, PO Box 3010
Kamloops, BC, Canada,V2C 5N3
 
skype RoelofBrouwer
telephone numbers
1-250 828 5219 work
1-250-374-5874 home
1-250-377-6133 fax
home page www.tru.ca/advtech/compsci/faculty/rbrouwer
email [EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Mark D. Niemiec
Sent: March 15, 2007 1:15 AM
To: [email protected]
Subject: Re: [Jgeneral] unexpected result

"Roelof K. Brouwer" <[EMAIL PROTECTED]> wrote:

> If I do the following I get a strange result 
>
> a=:$@:0:
>
> b=:({.);( $: }.@:])
>
> c=:<:#@:]
>
> ([EMAIL PROTECTED]) f.
>
>  Of
>
> 
>
> $@:0:`(3 : '{. ; ($: }.@:]) y' :(4 : 'x {. ; ($: }.@:]) y'))@.(<: #@:])
>
> 
>
> Any explanations

According to the dictionary: '$: denotes the longest verb that contains it.'
When a phrase containing $: is embedded into another, the meaning of $:
changes, since it context changes.

To prevent it from doing so, its scope must be localized somehow, via
assignment, or within the context of some primitive like : or ". or 128!:2

Since code within : isn't ambivalent, f. doesn't know whether b is
monadic or dyadic, so it must make both cases explicit separately
although I suppose it COULD have used a sincle three-line definition:
  3 : ('{. ; ($: }.@:]) y';':';'x {. ; ($: }.@:]) y')

In an unrelated issue, I am wondering what you are trying to do with b;
it looks like it will recurse infinitely. Perhaps you really WANTED $:
to include all of ([EMAIL PROTECTED]) ? If so, putting it within b will give you
the wrong result.

-- Mark D. Niemiec <[EMAIL PROTECTED]>

----------------------------------------------------------------------
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