<./ .+ (min dot plus in APL) can be found in: http://www.jsoftware.com/jwiki/Essays/Transpose
Another interesting inner product is used in leap year calculations: leapyear=: 0 ~:/ . = 4 100 400 |/ ] (,: leapyear) 1800 1900 1996 1997 1998 1999 2000 2001 2002 2003 2004 1800 1900 1996 1997 1998 1999 2000 2001 2002 2003 2004 0 0 1 0 0 0 1 0 0 0 1 ----- Original Message ----- From: Andrew Nikitin <[EMAIL PROTECTED]> Date: Friday, August 15, 2008 11:57 Subject: [Jprogramming] moo (and .) To: [email protected] > I also looked at the moo page on essays. > > While figuring out what the script does, I found myself in a > need of a verb that does the opposite, namely calculates the > number of bulls and cows for a given entry. > This is much easier task and not very interesting in itself, > however, one of the iterations looked like this: > > ans=:+/@:= ([ , -~) [: (>./ . +) =/ > While not very efficient it features an unusual case of ".", > which I thought some of you may find interesting. > > So the score verb woold look like this: > > score=:[: ([ display) ] ; 'bc' #~ 1 2 3 4&ans > and the session > > moo 4$10┌───────┬───┐│1 8 4 3│bcc│└───────┴───┘216 > choices left┌───────┬──┐│3 9 4 8│cc│└───────┴──┘80 choices > left┌───────┬──┐│1 4 8 0│bc│└───────┴──┘16 choices > left┌───────┬───┐│1 5 3 4│bbb│└───────┴───┘3 choices > left┌───────┬────┐│1 2 3 4│bbbb│└───────┴────┘ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
