In the J language, what is the idiomatic word or phrase to return the value of the item at index n of array x? The documentation for {:: seems concerned with boxed values, mentioning normal arrays as an afterthought.
nth =: {:: NB. This is what I have found, but is there a better word?
2 nth 5 12 73 23 89
73
1 nth 3 3 $ i.9
3 4 5
You are looking for from ( {
). It returns item(s) from an array
2 { 5 12 73 23 89
73
2 4 { 5 12 73 23 89
73 89
2 { i. 4 5
10 11 12 13 14
Some references for from :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.