On Thu, Jan 5, 2012 at 9:47 AM, Linda Alvord <lindaalv...@verizon.net> wrote:
> I'm not sure this if this challenge was too hard or too
> easy. Since no one responded, ...

Personally, I find the embargo requirement daunting.  I also had some
trouble with the way you had phrased the task -- I sent an email about
some of those issues, and received no response.

That said, with a concrete example of what you are looking for, I can
provide workalikes and comments.

   packla=: |.|:,/'SHDC',"0/'AKQJT98765432'
   packlardm=: >,{'AKQJT98765432';'SHDC'

(I like the rdm version better but you might not accept it.)

   mixlardm=: {~ [:?~#
   mixla=:    {~"1 [:?~_1{$

   mixla packla
559Q46388T79J6QTAAJ4KTAK2T42Q645776598KA3Q9J2J3287K3
CSHHCHDHSHDCDCDDCHHHHCDSSSSCSDDDSCSHDCDSHCSCHSSDDHCC
   |:mixlardm packlardm
J3K9QAT3722KJ4A85849K926Q35TJ86A35T768QT7J675Q294K4A
HSSCDHSDDCDDDDSHSCCDHSSSHCCDCSCCHHHHHDCCCSDSDSHHHCSD

Note that your original instructions were unclear about the role of
the left argument for mixla.  It's clear now that you do not use the
left argument.  That said, neither of my above definitions will ignore
the left argument.  For that, use:

   mixlardm=: ]{~ [:?~ [:# ]
   mixla=:    ]{~"1 [:?~ _1{ [:$ ]

However, in my opinion, this kind of a "you must handle a left
argument by ignoring it" thing smells bad.  It complicates that code
and thus makes future revisions more difficult and makes understanding
the code harder.

   dolela=: _13 ]\ mixla
   dolelardm=: _13 |:\ mixlardm

   dolela packla
...
   dolelardm packlardm
...

Or, if you want extra shuffles (though it's not clear if they do
anything meaningful):

   dolelardm mixlardm^:2 packlardm

(results omitted here for brevity).

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to