How to remove element from an SList?

2012-03-27 Thread Chris Pons
Right now i'm struggling with trying to understand how to remove an element from a n SList. I only want to remove one element, not a range of elements. I also don't want to use an Array because I will have to reshuffle elements to take care of the empty spot when I remove it. The only thing

Re: How to remove element from an SList?

2012-03-27 Thread James Miller
On 28 March 2012 13:02, Chris Pons cmp...@gmail.com wrote: Right now i'm struggling with trying to understand how to remove an element from a n SList. I only want to remove one element, not a range of elements. I also don't want to use an Array because I will have to reshuffle elements to take

Re: How to remove element from an SList?

2012-03-27 Thread Ali Çehreli
On 03/27/2012 05:02 PM, Chris Pons wrote: Right now i'm struggling with trying to understand how to remove an element from a n SList. I only want to remove one element, not a range of elements. I don't have experience with std.container but I think you need to call take(a, 1). The only

Re: How to remove element from an SList?

2012-03-27 Thread bearophile
Ali Çehreli: The following worked for me. Note treating the SList as a range by []: import std.container; import std.stdio; import std.algorithm; import std.range; void main() { auto l = SList!int(1, 2, 3, 4, 5, 6, 7); auto a = find(l[], 2); // Search for 2 ...