You need 4 : rather than 4 ; in process_prime Henry Rich
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Terrence Brannon > Sent: Tuesday, May 22, 2007 11:34 AM > To: [email protected] > Subject: [Jprogramming] my explicit dyadic verb has some sort > of syntax error > > My dyadic verb process_prime throws a syntax error when I > call it. However, when > I type process_prime and then take the verb definition and > substitute A for x > and 2 for y, it works fine... what is wrong with my calling > of process_prime as > A process_prime 2 > > > multiples =: 4 : 'y * (1 + ( i.(>. x % y)))' NB. max multiples n > make_sieve =: 3 : '0 (0 1) } (y+1) $ 1' > next_prime =: prime_indices pick_prime ] > prime_indices =: I. @ [ NB. return indices in list which equal 1 > pick_prime =: I. { [ NB. dyadic fork to lookup the > drop_le =: 4 : '(x > y) # x' NB. drop elements in > list <= value > > NB. A process_prime 2 - marks all multiples of 2 in A as non-prime > process_prime =: 4 ; '0 (}: }. (((#x)-1) multiples y)) } x' > > A =: make_sieve 27 > A > 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > A process_prime 2 > |syntax error > | A process_prime 2 > process_prime > --T------------------------------------┐ > │4│0 (}: }. (((#x)-1) multiples y)) } x│ > L-+------------------------------------- > 0 (}: }. (((#A)-1) multiples 2)) } A > 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 > > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
