Thanks Marshall,
I like your approach. Made some minor changes to reduce name pollution.
It was my equivalent of your break verb that I was struggling most with.

On Mon, Jun 20, 2011 at 11:11 AM, Marshall Lochbaum
<[email protected]> wrote:
> Here's an updated, shortened version of my code that actually works (I
> should stop editing before I send e-mails). I would still like to see a
> better version of break, although this one at least accomplishes everything
> it needs to.
>
>   setcode=:3 :0 NB. stops setcode alphabet
> 2 6 setcode y
> :
> alphabet=:y, ,":"0 i.10
> stops=: x
> alphkeys=. (a:,,&.>x) ([-.~ [:,,&.>/) i.10
> esckey=: >(alphabet i. '/'){alphkeys
> numkeys=. esckey&,&.> i.10
> keys=: alphkeys,numkeys
>
> encode=: [:; keys{~ alphabet&i.
> break=: </.~ i.@# - _1|. ([: >/\.&.|. e.&stops) + _1|.2*esckey&E.
> decode=: alphabet {~ keys i. break
> i.0 0
> )
>
> I can't bring myself to delete your code as I have barely looked at it and
> the approach may well be better than mine with some work, but I will append
> my code to the section.
>
> Marshall
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Ric Sherlock
> Sent: Saturday, June 18, 2011 11:59 AM
> To: Programming forum
> Subject: [Jprogramming] Straddling Checkerboard encoding
>
> I've made a submission for the Rosetta Code Straddling Checkerboard task but
> judging by some of the other entries I'm pretty sure that it can be
> significantly simplified. Any suggestions?
> http://rosettacode.org/wiki/Straddling_checkerboard
>
> (Please feel free to edit the Rosetta Code solution directly if so
> inclined!)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to