On Monday, 19 December 2016 at 20:26:26 UTC, Ali Çehreli wrote:
On 12/19/2016 06:09 AM, RazvanN wrote:
> [...]
wrote:
>> [...]
InputRanges.
>> [...]
following
> [...]
char[]
> [...]
function, so
> [...]
http://dlang.org/phobos/std_algorithm_mutation.html#bringToFront
[...]
No need to mention i
; swapping code
>> > [...]
>>
>> Obivously, tmp1 and tmp2 are unusued there. :)
>>
>> > [...]
>> passed.
>> > [...]
>> state
>> > [...]
>> is:
>> > [...]
>> input ranges
>> > [...]
>>
>&
[...]
passed.
> [...]
state
> [...]
is:
> [...]
input ranges
> [...]
Not possible... It's ok to use something similar to the
following template constraint:
void foo(R1, R2)(R1 r1, R2 r2)
if ((hasSwappableElements!R1 && hasSwappableElements!R2) ||
(hasLvalueElements!R1 &&am
On 12/19/2016 02:41 AM, RazvanN wrote:
> Hi,
>
> I have a function which accepts 2 input Ranges
As your comments make it clear below, they cannot be InputRanges.
> and swaps the first
> element in Range1 with the first element in Range2. The swapping code
> looks s
On Monday, 19 December 2016 at 10:41:46 UTC, RazvanN wrote:
Hi,
I have a function which accepts 2 input Ranges and swaps the
first element in Range1 with the first element in Range2. The
swapping code looks something like this :
static if (is(typeof(swap(r1.front, r2.front
Hi,
I have a function which accepts 2 input Ranges and swaps the
first element in Range1 with the first element in Range2. The
swapping code looks something like this :
static if (is(typeof(swap(r1.front, r2.front
{
swap(r1.front, r2.front);
}
else
On Saturday, 28 May 2016 at 20:43:00 UTC, pineapple wrote:
On Saturday, 28 May 2016 at 16:25:02 UTC, Seb wrote:
If you are interested how it works under the hood - it's
pretty simple & elegant:
I checked up on the phobos implementation and found that arrays
are mutated when iterated over as r
On Saturday, 28 May 2016 at 16:25:02 UTC, Seb wrote:
If you are interested how it works under the hood - it's pretty
simple & elegant:
I checked up on the phobos implementation and found that arrays
are mutated when iterated over as ranges, which didn't rest well
with me. Nor did the idea of
On Friday, 27 May 2016 at 14:59:25 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 14:54:30 UTC, pineapple wrote:
I've encountered one remarkable difference: The phobos
function accepts arrays and mine does not.
add `import std.array;` i think to your module and it should
make arrays rang
On Friday, 27 May 2016 at 14:54:30 UTC, pineapple wrote:
I've encountered one remarkable difference: The phobos function
accepts arrays and mine does not.
add `import std.array;` i think to your module and it should make
arrays ranges
I'm writing my own map function modeled after the one in phobos.
(because I feel like it, that's why. good learning experience.)
I've encountered one remarkable difference: The phobos function
accepts arrays and mine does not. I understand why - I'm calling
methods that arrays don't have - but
On Sunday, 19 April 2015 at 23:49:08 UTC, anonymous wrote:
On Sunday, 19 April 2015 at 21:42:23 UTC, Ulrich Küttler wrote:
groupBy is a nice example as it laboriously adds reference
semantics to forward ranges but assumes input ranges to posses
reference semantics by themselves.
All ranges
On Sunday, 19 April 2015 at 21:42:23 UTC, Ulrich Küttler wrote:
groupBy is a nice example as it laboriously adds reference
semantics to forward ranges but assumes input ranges to posses
reference semantics by themselves.
All ranges are input ranges, though. Input ranges are the least
I am convinced most (all?) proper input ranges read
input from an external source. (Reference semantic right there.)
Input ranges are one-pass ranges after all. Therefore, reference
semantics are required in any case (unless the use of the range
is known beforehand.)
groupBy is a nice example
On Saturday, 18 April 2015 at 22:01:56 UTC, Ulrich Küttler wrote:
Input ranges from std.stdio are used for reading files. So
assuming we create a file
auto f = File("test.txt", "w");
f.writeln(iota(5).map!(a => repeat(to!string(a),
4)).joiner.joiner("\n&qu
It seems input ranges without any indirection in memory are not
working well with algorithms. This seems to be understood by the
D community. I did not know. Here is my story on the topic so
far:
Recently, I learned that I did not know input ranges much at all,
totally misjudging
On Wednesday, 25 April 2012 at 21:43:11 UTC, Dmitry Olshansky
wrote:
On 25.04.2012 23:08, H. S. Teoh wrote:
Does std.regex support input ranges to match()? Or do I need
to convert
to string first?
For now, yes you have to convert them. Any random access range
of code units should do the
On 25.04.2012 23:08, H. S. Teoh wrote:
Does std.regex support input ranges to match()? Or do I need to convert
to string first?
For now, yes you have to convert them. Any random access range of code
units should do the trick but stringish template constraints might kill
that.
I plan to
Does std.regex support input ranges to match()? Or do I need to convert
to string first?
Thanks!
T
--
Tell me and I forget. Teach me and I remember. Involve me and I understand. --
Benjamin Franklin
19 matches
Mail list logo