RE: Defining long constants - do-able but not exactly elegant
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 13, 2002
- 453 views
What's wrong with : constant testset= -- "idfursf ujbdoc ujy negnxdnown idfu fun cxjkgdoc " & -- "joy rggxnkkdbn ajo in wjoorf jggxnwdjfn fun " -- "b hcn fba ioa caxw pbxlsbw ramc mpj scchk " & -- "blmji mpbm pj rk ioaaran com cl mpj scchk" -- "zaxabaprsanl cdrlt znlzdlsersanl nq zbntd " & -- "fsabaprsanl nq skd brlu twedru nq habu baqd rhrv" "ktj uz wjiwnlufza rnujw fv nyywzqfbnujcp zaj iztwug " & "kjjyjw ugna fu nyyjnwv uz mj rgja czzdfah fauz fu" -------- Derek -----Original Message----- From: petelomax at blueyonder.co.uk [mailto:petelomax at blueyonder.co.uk] Sent: Thursday, 14 March 2002 9:38 To: EUforum Subject: Defining long constants - do-able but not exactly elegant After a few test runs with my fledgling cipher program, my source contains something like this: --constant ts1="idfursf ujbdoc ujy negnxdnown idfu fun cxjkgdoc ", -- ts2="joy rggxnkkdbn ajo in wjoorf jggxnwdjfn fun ", -- ts3="jzzjhdmdfl rz fun uronkf joy cnonxrsk ", -- testset=ts1&ts2&ts3 --constant ts1="b hcn fba ioa caxw pbxlsbw ramc mpj scchk ", -- ts2="blmji mpbm pj rk ioaaran com cl mpj scchk", -- testset=ts1&ts2 --constant ts1="zaxabaprsanl cdrlt znlzdlsersanl nq zbntd ", -- ts2="fsabaprsanl nq skd brlu twedru nq habu baqd rhrv", -- testset=ts1&ts2 constant ts1="ktj uz wjiwnlufza rnujw fv nyywzqfbnujcp zaj iztwug ", ts2="kjjyjw ugna fu nyyjnwv uz mj rgja czzdfah fauz fu", testset=ts1&ts2 Obviously, I coded it that way because of line length problems, then just carried on. I'd rather have one big constant & a loop. Unfortunately Euphoria doesn't support \<eol> I have a work-round (below), but before you read it, ask yourself how you would do it, elegantly. A gut of mine tells me that is not the best way to do it. It's not very readable, really, & easy to make small slips, especially when the set gets fairly large. By the time you read this, I'll have coded: testset={ t11&t12&t13, t21&t22, t31&t32, t41&t42} but I don't like all those extra names cluttering up my code. Was there a t33, or not, t84? etc Pete PS I chopped a few of those ciphers to tidy up the post a bit. Don't use em, if you want the originals I'll mail them direct.