I must really disagree.  I don't believe that it is necessary for the purveyors 
of this or any language to set up checks for every mathematical anomaly.  It's 
simple enough to check for a zero in your argument, and if there is one, simply 
to return zero before using the */ function.  You'd be surprised how well any 
language can work if the author just uses a little extra thought when writing 
some code.  

Years ago I did some development work using a C interpreter (not a compiler) on 
my old Apple IIe.  Should have been really slow - well it ran quite fast - 
remarkable for an interpreter on an old 8 bit machine.  J, like its APL 
predecessor, can do alot for you, but really, just a wee bit of extra code can 
go a long way.

Bob in Boynton Beach, FL

[EMAIL PROTECTED] wrote: Send General mailing list submissions to
 [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
 http://www.jsoftware.com/cgi-bin/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
 [EMAIL PROTECTED]

You can reach the person managing the list at
 [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of General digest..."


Today's Topics:

   1. RE: re[Jgeneral] duce/fold in J as an adverb or conjuction
      (Henry Rich)
   2. Request for change (Richard Donovan)
   3. implement wd'timer' as ibeam (bill lam)
   4. Re: implement wd'timer' as ibeam (Oleg Kobchenko)
   5. Re: Request for change (Oleg Kobchenko)
   6. Re: Request for change (Ralph G Selfridge)
   7. J for C - generic dyad application versus verb specific
      (metaperl.j)
   8. RE: J for C - generic dyad application versus verb specific
      (Henry Rich)


----------------------------------------------------------------------

Message: 1
Date: Sun, 25 Nov 2007 01:07:46 -0500
From: "Henry Rich" 
Subject: RE: re[Jgeneral] duce/fold in J as an adverb or conjuction
To: "'General forum'" 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"

If you want to create a verb that produces (x u v y) if
dyadic or (u v y) if monadic, you can use

[EMAIL PROTECTED] : (u v)

but this has a problem: the values of u and v are repeated.
If you have several conjunctions in this form, passing verb
results down the line, the resulting final verb can be
enormous.  (This actually happened to me in an application).

Another way to achieve the same result is the trick

u^:(1:`(]v))

which you can understand by looking at the fine print of ^: .
This version does not repeat u and v and so grows only linearly
as the verbs get complicated.

This idea can be used in the current problem:

R4 =: 1 : 'u~/@|.@(u^:(1:`(]{.))  [`0:`]}  ])'

I haven't tested this but it looks right.

Henry Rich


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Raul Miller
> Sent: Saturday, November 24, 2007 7:46 AM
> To: General forum
> Subject: Re: re[Jgeneral] duce/fold in J as an adverb or conjuction
> 
> Dan Bron's posts have triggered my sluggish thinking into realizing
> how to make a tacit instance of R:
> 
> R3=:1 :0
>   u~/@|.@([EMAIL PROTECTED]@]`0:`]}~) :( u~/@|.@((u {.)`0:`]}))
> )
> 
> Or, if you prefer
> 
> R4=:1 :(0 :0-.LF)
>   u~/@|.@([EMAIL PROTECTED]@]`0:`]}~)
>  :
>   (u~/@|.@((u {.)`0:`]}))
> )
> 
> If you type that in manually, note that the : in R4 should
> be indented.
> 
> -- 
> Raul
> ----------------------------------------------------------------------
> For information about J forums see 
> http://www.jsoftware.com/forums.htm



------------------------------

Message: 2
Date: Sun, 25 Nov 2007 12:59:02 +0000
From: Richard Donovan 
Subject: [Jgeneral] Request for change
To: General forum 
Message-ID: 
Content-Type: text/plain; charset="Windows-1252"


It would save me a lot of time if   */ y   (product) could be made to return 
zero result as
soon as it encounters a 0 in y .

   y=.0,1e7#7

   ts '*/y'                 NB. nearly six seconds to calc on a mid-range 
pentium 
5.85124 1088

could in fact return zero "instantaneously". Oviously this is the "best/worst 
case scenario" to make
my point but it seems that  */  continues the multiplication even after it 
"knows" that the result
will be zero. I have records containing many thousands of fields, any of which 
could be zero, and
it would save an immense amount of time if  */  could be amended. 

This seems like it may be an easy and worthwhile change.

Similarly...

   x=.0

   ts 'y-x'                   NB. Lots of time and space to do nothing!
0.149041 6.71095e7

   ts 'y+x'
0.157018 6.71095e7

   ts 'y'
1.00571e_5 384
_________________________________________________________________
100’s of Music vouchers to be won with MSN Music
https://www.musicmashup.co.uk

------------------------------

Message: 3
Date: Sun, 25 Nov 2007 23:56:54 +0800
From: bill lam 
Subject: [Jgeneral] implement wd'timer' as ibeam
To: General forum 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=UTF-8; format=flowed

current wd'timer' depends on wd which only available in c++ or java frontend 
therefore timer function can not used in jconsole. Would it be possible to 
implement timer as a new foreign (ibeam) function?

-- 
regards,
bill


------------------------------

Message: 4
Date: Sun, 25 Nov 2007 08:39:37 -0800 (PST)
From: Oleg Kobchenko 
Subject: Re: [Jgeneral] implement wd'timer' as ibeam
To: General forum 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

Timer is based on message loop, which there is none in console.

The read/eval/print loop has blocking read. So perhaps you need read with 
timeout?


Oleg


On Nov 25, 2007, at 10:56, bill lam  wrote:

current wd'timer' depends on wd which only available in c++ or java frontend 
therefore timer function can not used in jconsole. Would it be possible to 
implement timer as a new foreign (ibeam) function?

-- 
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm



      
____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 


------------------------------

Message: 5
Date: Sun, 25 Nov 2007 08:42:52 -0800 (PST)
From: Oleg Kobchenko 
Subject: Re: [Jgeneral] Request for change
To: General forum 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=utf-8

But */ does NOT know. Such knowledge would cost time.
So it will worsen any such loop.

Perhaps you could do 0&e. or so?


Oleg


On Nov 25, 2007, at 7:59, Richard Donovan  wrote:


It would save me a lot of time if   */ y   (product) could be made to return 
zero result as
soon as it encounters a 0 in y .

  y=.0,1e7#7

  ts '*/y'                 NB. nearly six seconds to calc on a mid-range 
pentium 
5.85124 1088

could in fact return zero "instantaneously". Oviously this is the "best/worst 
case scenario" to make
my point but it seems that  */  continues the multiplication even after it 
"knows" that the result
will be zero. I have records containing many thousands of fields, any of which 
could be zero, and
it would save an immense amount of time if  */  could be amended. 

This seems like it may be an easy and worthwhile change.

Similarly...

  x=.0

  ts 'y-x'                   NB. Lots of time and space to do nothing!
0.149041 6.71095e7

  ts 'y+x'
0.157018 6.71095e7

  ts 'y'
1.00571e_5 384
_________________________________________________________________
100’s of Music vouchers to be won with MSN Music
https://www.musicmashup.co.uk----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm



      
____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 


------------------------------

Message: 6
Date: Sun, 25 Nov 2007 16:45:34 -0500 (EST)
From: Ralph G Selfridge 
Subject: Re: [Jgeneral] Request for change
To: General forum 
Message-ID: 

Content-Type: text/plain; charset="windows-1252"

Not really, because the same could be asked for and/ wih a zero somewhere. 
But more important is the question of what zero really is.fuzz comes so 
easily and very small times large is/is-not important.


Ralph Selfridge


On Sun, 25 Nov 2007, Richard Donovan wrote:

>
> It would save me a lot of time if   */ y   (product) could be made to return 
> zero result as
> soon as it encounters a 0 in y .
>
>   y=.0,1e7#7
>
>   ts '*/y'                 NB. nearly six seconds to calc on a mid-range 
> pentium
> 5.85124 1088
>
> could in fact return zero "instantaneously". Oviously this is the "best/worst 
> case scenario" to make
> my point but it seems that  */  continues the multiplication even after it 
> "knows" that the result
> will be zero. I have records containing many thousands of fields, any of 
> which could be zero, and
> it would save an immense amount of time if  */  could be amended.
>
> This seems like it may be an easy and worthwhile change.
>
> Similarly...
>
>   x=.0
>
>   ts 'y-x'                   NB. Lots of time and space to do nothing!
> 0.149041 6.71095e7
>
>   ts 'y+x'
> 0.157018 6.71095e7
>
>   ts 'y'
> 1.00571e_5 384
> _________________________________________________________________
> 100’s of Music vouchers to be won with MSN Music
> https://www.musicmashup.co.uk----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>

------------------------------

Message: 7
Date: Sun, 25 Nov 2007 13:55:16 -0800 (PST)
From: "metaperl.j" 
Subject: [Jgeneral] J for C - generic dyad application versus verb
 specific
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii


At:
http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have_r.htm#_Toc141157992

We see Henry discuss how dyadic + works. One key requirement for dyadic + in
all cases is that there must be a common frame. Hence, the following is an
error:

  ( i. 2 2 ) + (i. 3 3 )
|length error

However, in:
http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have_r.htm#_Toc141157993

Henry demonstrates:

   ( i. 2 2 ) , (i. 3 3 )
0 1 0
2 3 0
0 1 2
3 4 5
6 7 8

and obviously the requirement for common prefix is not met.

So the question becomes: what is the general algorithm for dyadic verb
application? Which verb, "+" or "," is closer to the general algorithm? How
and where are "hooks" inserted into this algorithm so that the algorithm can
be "jettisoned" in favor of behavior peculiar to a particular verb?

Just FYI, the algorithm for dyadic "+" (which I thought was the general
dyadic application algorithm) is coded starting on line 112 here -
http://hg.metaperl.com/redick?f=8d2f0d91211b;file=scheme/dyads/dyad-apply.scm;style=gitweb

... it works for all examples in J for C. But obviously it blows up when
dyadic "," is passed to it. So the goal is to make changes to get both
working and a generic dyadic application algorithm with proper callouts to
respect certain verb peculiarities.

-- 
View this message in context: 
http://www.nabble.com/J-for-C---generic-dyad-application-versus-verb-specific-tf4871837s24193.html#a13940484
Sent from the J General mailing list archive at Nabble.com.



------------------------------

Message: 8
Date: Sun, 25 Nov 2007 17:06:30 -0500
From: "Henry Rich" 
Subject: RE: [Jgeneral] J for C - generic dyad application versus verb
 specific
To: "'General forum'" 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"

The key is the rank of the verb.  That is given in the Dictionary.

x + y fails, and x , y works, in the cases you give, because
+ has rank 0 while , has rank _ .

The verb itself is applied to operand cells, which are the highest-rank
pieces the interpreter can find whose rank does not exceed the verb rank.

What the verb does on those cells is completely up to the verb and
you can't model it generally.

What can be modeled generally is what happens when the operands
have rank higher than the rank of the verb.  In that case, the
operands are broken into cells, the verb is applied on each cell,
and the results are padded with framing fills to produce an array.

In your example, the verb dyad , has infinite rank so nothing general
can be said.  You have to follow the description of the verb which,
as you noted, has its quirks.

Dyad {. is a similar example.  What it does for overtake has to
be modeled as the idiosyncratic behavior of that verb.

So, the 'hooks' you refer to appear when the verb is applied to its
cells.  The rank of the cells is specified by the rank of the verb.

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of metaperl.j
> Sent: Sunday, November 25, 2007 4:55 PM
> To: [email protected]
> Subject: [Jgeneral] J for C - generic dyad application versus 
> verb specific
> 
> 
> At:
> http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have
> _r.htm#_Toc141157992
> 
> We see Henry discuss how dyadic + works. One key requirement 
> for dyadic + in
> all cases is that there must be a common frame. Hence, the 
> following is an
> error:
> 
>   ( i. 2 2 ) + (i. 3 3 )
> |length error
> 
> However, in:
> http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have
> _r.htm#_Toc141157993
> 
> Henry demonstrates:
> 
>    ( i. 2 2 ) , (i. 3 3 )
> 0 1 0
> 2 3 0
> 0 1 2
> 3 4 5
> 6 7 8
> 
> and obviously the requirement for common prefix is not met.
> 
> So the question becomes: what is the general algorithm for dyadic verb
> application? Which verb, "+" or "," is closer to the general 
> algorithm? How
> and where are "hooks" inserted into this algorithm so that 
> the algorithm can
> be "jettisoned" in favor of behavior peculiar to a particular verb?
> 
> Just FYI, the algorithm for dyadic "+" (which I thought was 
> the general
> dyadic application algorithm) is coded starting on line 112 here -
> http://hg.metaperl.com/redick?f=8d2f0d91211b;file=scheme/dyads
> /dyad-apply.scm;style=gitweb
> 
> ... it works for all examples in J for C. But obviously it 
> blows up when
> dyadic "," is passed to it. So the goal is to make changes to get both
> working and a generic dyadic application algorithm with 
> proper callouts to
> respect certain verb peculiarities.
> 
> -- 
> View this message in context: 
> http://www.nabble.com/J-for-C---generic-dyad-application-versu
> s-verb-specific-tf4871837s24193.html#a13940484
> Sent from the J General mailing list archive at Nabble.com.
> 
> ----------------------------------------------------------------------
> For information about J forums see 
> http://www.jsoftware.com/forums.htm



------------------------------

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

End of General Digest, Vol 26, Issue 20
***************************************





       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to