Thank you for intersting
for example
afd 1 1 1 NB. correct
M
dfa ,'M'
1 1 1
pack3 1 1 1 NB. unfortunatelly not correct
ZM
unpack3 'ZM'
1 1 1
István
2007/12/1, Raul Miller <[EMAIL PROTECTED]>:
>
> Hmm... when I try running this as a script, I get a domain error
> which I can not
> reproduce interactively. (Note that I have changed i to I to attempt
> to isolate this
> problem -- it did not help.)
>
> dfa_2=:[:|:3 3 3&#: NB. conversion to ternary
> ]t=:dfa_2 I
> |domain error: scriptd
> | ]t =:dfa_2 I
> |[-43] C:\Documents and Settings\User\j602-user\temp\6.ijs
> I
> 9 17 9 20 14 25 8 1 11 14 8 21 16 17 5 18 6 5 16 14 8 11 26 17 21 17 9
> 2 20 13 8 22
> dfa_2 I
> 1 1 1 2 1 2 0 0 1 1 0 2 1 1 0 2 0 0 1 1 0 1 2 1 2 1 1 0 2 1 0 2
> 0 2 0 0 1 2 2 0 0 1 2 1 2 2 1 0 2 1 2 1 2 0 2 2 1 2 0 0 0 1 2 1
> 0 2 0 2 2 1 2 1 2 2 2 0 1 2 2 0 0 2 1 2 2 2 2 2 0 2 0 2 2 1 2 1
>
> I suppose I should try upgrading from b-beta to one of the c-betas...
>
> Anyways, I do not fully understand what you are doing here. For
> example, I do not understand why you say (3#.3|3+*) instead of
> (3#.>:). I mean, sure, these give different answers, but my point
> is that I do not understand your point (and I do not know where to
> find a copy of this ibm research journal to help me out).
>
> I also wonder if you should be using
> (,0#~0=$)&(}.~0={.)^:_ instead of just (,0#~0=$)&(}.~0={.)
> If this is really what you want, I would instead prefer
> #~1:_1}[:+./\0~:]
>
> Also, for very long tacit verbs, I prefer to break out meaningful
> chunks of code and give them names, so I can better understand
> what's going on. In other words, something like this:
>
> sTrinary=: * * [: (((1 |. ]) + [ - 3 * ]) 2&=)^:_"1 0: ,. 3 #.inv |
> trimZero=: #~1:_1}[:+./\0~:]
> afd=:vabc{~ trimZero@(3#.3|3&+)@|:@|[EMAIL PROTECTED]
>
> (Except, of course, that my trimzero might be wrong for
> whatever it is you are trying to do.)
>
> (Also, you can always use f. if you want to remove intermediate
> names from your tacit definition.)
>
> As I understand it, you are packing a fixed-width vector (length
> three) into an encoded base 27 representation with afd and
> then reversing this process with dfa. However, I do not
> understand why you picked this encoding over something
> simpler to implement, like
> pack3=: vabc {~ 3 #. >:@* ,&|: 3#.inv |
> unpack3=: [: (<:@{. * 3x #. |:@}.) 3 3 3 #: vabc i. ]
>
> In other words, I do not truly understand the point of this
> exercise.
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm