>    (<:@[ , *) ^: (> 1:)/ ^:_ ] 4 1
> 24

Hey, wait a minute. Where did the "1" go? As in

>    (<:@{. , */) ^: (1: < {.) ^:_ ] 4 1
> 1 24

That puzzled me for a minute. The dyadicised version
has the convenience of stripping the aux argument!

After the while-condition is not satisfied, it's
already in the dyadiic part, so only its y. is returned.


--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:

> It's really very simple.
> I posted comments in the Mathschallenge forum.
> 
> Probably the most difficult part is the tail-recursive while loop:
> 
>   do_verb ^: while_cond ^:_ initial_arg
> 
>    (<:@{. , */) ^: (1: < {.) ^:_ ] 4 1
> 1 24
>    !4
> 24
> 
> with 2-item argument list it can be dyadicised
> 
>    (<:@[ , *) ^: (> 1:)/ ^:_ ] 4 1
> 24
> 
> 
> 
> --- Richard Donovan <[EMAIL PROTECTED]> wrote:
> 
> > http://www.mathschallenge.net/index.php?section=project&ref=problems&id=112
> > 
> > Would anyone who solved this problem care to look at my solution
> > (in the forum entry) and tell me of ways to speed it up!
> > 
> > I looked at Oleg's solution but it is far too expert for my level!
> > 
> > I am sure my version could be quickened up as other solvers have
> > mentioned shortcuts but I can't see anything obvious.
> > 
> > 
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to