Dear all,
I am learning J and stumbled on something today:
I loaded a .csv and obtained a boxed table, that I assigned to the name
'data'.
The first row of 'data' looks like that:
│N°IPP│Nom du paramètre│Valeur│Valeur Unit│Heure│
Then I defined two functions, that do work as expected:
NB. Column index of data y by name x
colIdxByName =: 4 : 'I. (0 { y) = <x'
NB. Select a column in data y by index x
colByIdx =: 4 : '}.x{|:y'
But if I try:
colByName =: 4 : 0
idx =. x colIdxByName y
res =. idx colByIdx y
)
'Valeur' colByName data NB. nothing happens...
idx =: 'Valeur' colIdxByName data
idx colByIdx data NB. this doesn't work
2 colByIdx data NB. but this does...
How can I elegantly compose colIdxByName and colByIdx ?
Cheers,
Raoul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm