--- Joey K Tuttle <[EMAIL PROTECTED]> wrote:

> At 08:14  -0700 2007/09/14, Ed Keith wrote:
> >I'm coming to J from a C++ background. While much of J
> >requires a new mind set, I think I am getting most of
> >it, but I'm just not getting tacit programming. I
> >cannot figure out anything that is not trivial.
> >
> >For example I recently wrote the following verb:
> >
> >base =: dyad : '((<. 1 + y ^. x) # y) #: x'
> >
> >It takes a number and a base and and produces an array
> >of digits to represent the number in the base.
> >
> >How would this be written tacitly? I'm not so much
> >interested in how to write this verb, but how to think
> >through the creation of a tacit verb.
> >
> >Any assistance is appreciated,
> >
> 
> One way (but without thinking...) -
> 
>     13 : '((<. 1 + y ^. x) # y) #: x'
> [ #:~ ] #~ [: <. 1 + ^.~

Check out the hand-coded variant in previous post,
which turns out to be amazingly the same.
>    base=: [ #:~ ] #~ [: <. 1 + ^.~

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

> This is an interesting question: how would

>    4 #. 3 2 1   NB. test case
> 57
> 
>    57 (^.~) 4   NB. incremental
> 2.91645
>    57 (1 + ^.~) 4
> 3.91645
>    57 ([: <. 1 + ^.~) 4
> 3
>    57 (] #~ [: <. 1 + ^.~) 4
> 4 4 4
>    57 ([ #:~ ] #~ [: <. 1 + ^.~) 4
> 3 2 1
> 
>                 NB. new name   
>    base=: [ #:~ ] #~ [: <. 1 + ^.~
>    57 base 4
> 3 2 1



       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to