Hi!
But now another problem:
> a =: ;: 'he ha ho he hi he'
> b =: ~. a
c =: 1 4; 2 ; 3; 5
> d =: c { each <b i. a
> +---+-+-+-+
> |1 3|2|0|0|
> +---+-+-+-+
>
Now I have the following matrix:
m =: ((#b), #b) $ 0
and I have to fill it based on the information in d. Each cell of d
corresponds to each row of m. Indexes in cells show which positions in that
row in m should be incremented by one.
After this procedure using example data above the m should look the
following:
m
0 1 0 1
0 0 1 0
1 0 0 0
1 0 0 0
I studied the vocabulary and the following verbs seem to be useful for this
task:
Dyad {:: for selecting items from d, but I understand that it cannot be used
for selecting several items (for example i.3 {:: d).
m} for amending the matrix elements, but how to use it for replacing the
cell value with the current cell value + 1?
Any other suggestions, which verbs to use and how to combine them to get the
task done?
Kairit
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm