2008/6/18 Raul Miller <[EMAIL PROTECTED]>:
> On 6/17/08, June Kim <[EMAIL PROTECTED]> wrote:
>> Is there a generic and natural way of turning vectorized default
>> output to numbers in J?
>
> If you want serialization, I would probably use 3!:1
> (and 3!:2 to deserialize).
>
> However, if you know that your character vector
> properly represents a non-singuler and non-empty
> numeric array, you might use something like this:
>
> lines=: <@".;._2
> shap=: [:|. [:*/\^:_1 [:+/\@(+ [EMAIL PROTECTED]) [:#/.~ [:>./\ [:#;.1 a:&~:
> unvec=:  >@(shap $ -.&a:)@lines
>
>   unvec v
> ...
>

Thank you but it doens't work as I expected:

   s2=: 0 : 0
1 2 3
4 5 6
7 8 9
)

   s3=: 0 : 0
1 2 3
4 5 6
7 8 9

9 8 7
6 5 4
3 2 1
)

   unvec s2  NB. the shape is wrong here
1 2 3
4 5 6
7 8 9
1 2 3
   unvec s3
|domain error: unvec
|       unvec s3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to