Dan, Sometimes conjunctions are overused!  Viewmat had 5 uses of  @:  
I simplifies the sentence to a simpler version.

Josephus2 =: 4 :'(|x&+)/i.->:y' 
viewmat @: ([ load @:('viewmat'"_)) @: ((Josephus2 % <:@])"0/~) @: >: @:
i.32
viewmat ([[: load 'viewmat'"_)  ((Josephus2 % [:<:])"0/~)  >: i.32

I feel quite confident about removing  @:  carefully.  If you look at the
two images when you run this script they seem to agree.

Now I am trying to fully understand  &  to be sure to use it only when it is
necessary.  So far it is one of my stumbling blocks in Josephus2.

Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Dan Bron
Sent: Friday, May 03, 2013 7:44 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Transcomputational numbers

I wrote:
>  Meaning, given k, what's the largest n I can allow  such that k^n <: 
> 10^93 ? How about k ^. 10^93 ?
>  Or more generally n =: ^.&(10^93) ? 

Linda asked:
Are these the same?
>   ]n =: ^.&(10^93)
>   ]n =: ^.(10^93)

No - one is a verb phrase, and the other is a noun phrase.  As we've
discussed before, simply removing conjunctions from a phrase, without
consideration of (and appropriate substitution for) their purpose just
breaks code.  

It's simply not true that if a phrase contains & (or some other primitive)
and you remove it, the resulting phrase is equivalent or even similar.  If
you remove some primitive, you must compensate for the deletion.

In this case, the original message contains a hint:

>  How about k ^. 10^93 ?  

What that tells you is you need a "k".  What's "k"?  Whatever the user wants
it to be - in other words, the input.  So, to make this a bond-free fork, in
the simplistic style of J you prefer, we can say  ] ^. 10^93"_ or ] ^.
(10^93)"_  or (10^93) ^.~ ] or 1e93 ^.~ ] etc, where ] refers to the input.

Note that the dependency on the user to supply a "k" is what distinguishes
all these formulations from your noun phrase ( ]n =: ^.(10^93) ).  In
particular, all the code above uses the _dyadic_ form of ^.  .  In every
case, we are specifying _two_ arguments: 10^93 (the transcomputational
threshold, the RHA) and k (the LHA, which is the user's choice). 

Whereas, in the sentence ]n =: ^.(10^93), you are using the _monadic_ form
of ^. .  That is, you are only specifying _one_ argument to ^. .  Given that
the monadic definition of ^. relies on the dyadic definition (to wit ^.y is
1x1^.y)  what your second sentence is doing is implicitly fixing the value
of k (at 1x1, the base of the natural logarithm).  

This, then, is (one of) the key differences between your noun phrase and the
original verb phrase.  The concept behind my verb phrase was to let k float,
and determine n from it (which was my understanding of the exercise at the
time).  Fixing k to a specific value (1x1 in your phrase) defeats the
purpose of the exercise.

Hope that helps,

-Dan


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