Re: Quiz! -Reply

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Tue, 20 Oct 1998, Jay Turley wrote:
>            -- added braces to this line to 'sequencize' the recursed
>            -- sequences
>            -- out = r_reverse(in[i]) & out
>            out = {r_reverse(in[i])} & out
>
>         end if
>     end for
>     return out
> end function
>
> now r_reverse({"hello","world"}) will return
> {"dlrow","olleh"}
> rather than
> {d,l,r,o,w,o,l,l,e,h}

Oops! Caught coding on the fly again! Jay's code is how I intended mine to
be...

Looks like I didn't even pass my own test! :-S :)

Incidentally, it's probably better to use:

    out = prepend(r_reverse(in[i]), out)

rather than

    out = {r_reverse(in[i])} & out

. Semantically equivalent (i.e. they do the same thing), but syntactically
tidier. IMHO.

Feeling very silly,
Carl

/me hits self over head with fish. *Splat*.

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
URL......: http://www.bigfoot.com/~cyrek/
Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu