I want to use Item Amend (the monadic form of m} )  where the m selects the 
item of y to take the result from. i.e.
   (4 ?...@$ 2)} 'aaaa',:'bbbb'
abba

The same thing can be written as a verb using the gerund form (v1`v2)} y
   nextletter=: >:&.(a.&i.)
   myverb=: ($ ?...@$ 2:)`(] ,: nextletter)}
   myverb 'aaaa'
abba

And setting the probability of getting a 'b' to 0.2
   myverb=: (0.2 > $ ?...@$ 0:)`(] ,: nextletter)}
   myverb 'aaaa'
abaa

However I'm stuck on writing a tacit version of myverb where the probability of 
getting a 'b' is given as the left argument i.e.

   0.2 myverb 'aaaa'

My solution so far is to create an adverb:
   myverb=: 1 : '(m > $ ?...@$ 0:)`(] ,: nextletter)}'
   0.2 myverb 'aaaa'
abaa

Is there a non-adverbial solution?

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

Reply via email to