Is logical subsetting of an array possible ?

Sahil via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 14 03:43:12 PDT 2016


This is with reference to documentation about use of array in D 
(https://dlang.org/spec/arrays.html#array-setting).

In languages tailor-made for data mining, like R, a subset of an 
array (not necessarily contiguous values) can be extracted as 
shown below:

vec //a vector or array in R
c(1:length(vec))[vec > 3] //extract a new array having values of 
vec that are greater than 3.

I have read about slicing, but it can only subset contiguous 
values. Correct me if I am wrong here.

How can the above functionality be achieved in D ?
(I am totally new to D)


More information about the Digitalmars-d-learn mailing list