9!:48'' queries whether x. is allowed, 9!:49[0 disallows it, and 9!:48[1allows it.
2007/4/8, Tracy Harms <[EMAIL PROTECTED]>:
I've been working on the puzzle from Dr. Dobbs that Randy MacDonald announced here: http://www.jsoftware.com/pipermail/chat/2007-April/000467.html I'm still not ready for full-fledged spoilers, but I am asking for help getting past one particular error condition. The problem is that an index error is reported when I try to load the script, but it seems fine when I run it in the J console. My approach to solving the puzzle is: reportstates same_chars same_tallies 4 comb 50 I've only developed this as deep as verb same_tallies, which is: same_tallies =: ((tally_leftpairs = tally_rightpairs) y.) # y. Here are the component verbs: tally_leftpairs =: 3 : '+/"1 (0 1 {"1 ((i.#y.) { y.)) { tallies' tally_rightpairs =: 3 : '+/"1 (2 3 {"1 ((i.#y.) { y.)) { tallies' Now I'll show testing from a J session, ending with an error on attempt to load the same verb that functioned perfectly when entered in the console: twocomb =: 0 1 11 14 ,: 4 5 6 20 twocomb 0 1 11 14 4 5 6 20 twocomb { states +----------+--------+-----------+-------------+ |Alabama |Alaska |Idaho |Iowa | +----------+--------+-----------+-------------+ |California|Colorado|Connecticut|Massachusetts| +----------+--------+-----------+-------------+ twocomb { tallies 7 6 5 4 10 8 11 13 (0 1 {"1 ((i.#twocomb) { twocomb)) { tallies 7 6 10 8 (2 3 {"1 ((i.#twocomb) { twocomb)) { tallies 5 4 11 13 +/"1 (0 1 {"1 ((i.#twocomb) { twocomb)) { tallies 13 18 +/"1 (2 3 {"1 ((i.#twocomb) { twocomb)) { tallies 9 24 load 'c:\j504\user\miscellany\statespzl2.ijs' |index error: tally_rightpairs | +/"1(2 3 {"1((i.#y.){y.)){tallies No error was signaled for the line before it, which differed only in the values of the pairing noun: tally_leftpairs =: 3 : '+/"1 (0 1 {"1 ((i.#y.) { y.)) { tallies' tally_rightpairs =: 3 : '+/"1 (2 3 {"1 ((i.#y.) { y.)) { tallies' I'm at a loss as to what needs to be fixed, here. -- Tracy B. Harms It is the central thesis of this book that the descriptive and analytic power of an adequate programming language amply repays the considerable effort required for its mastery. Kenneth E. Iverson A Programming Language, 1962 ____________________________________________________________________________________ It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
-- Björn Helgason, Verkfræðingur Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127 801 Grímsnes ,t-póst: [EMAIL PROTECTED] Skype: gosiminn, gsm: +3546985532 Landslags og skrúðgarðagerð, gröfuþjónusta http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) `. )----' (")_(")
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
