Denis Shelomovskij:
D already have undocumented[1] front tuple expansion in
foreach over range:
---
import std.algorithm;
import std.stdio;
void main() {
enum s = "this is an example for huffman encoding"d;
foreach (c, n; s.dup.sort().release().group())
writefln("'%s' %s", c, n);
22-Mar-2013 17:41, renoX пишет:
The fact that you sort of can't easily index tuple of 3 ints as a
fixed array of 3 ints is a clear indication of a tendency that I find
disturbing.
But there is a reason for this: tuple/structs can contain heterogeneous
type whereas array contains only homogeneou
On Friday, 22 March 2013 at 14:23:53 UTC, Tobias Pankrath wrote:
But there is a reason for this: tuple/structs can contain
heterogeneous type whereas array contains only homogeneous
type..
So if you want to index a tuple/struct of say {int,int[128]}
you have to build an array of pointers to t
On Friday, 22 March 2013 at 13:41:31 UTC, renoX wrote:
The fact that you sort of can't easily index tuple of 3 ints
as a fixed array of 3 ints is a clear indication of a tendency
that I find disturbing.
But there is a reason for this: tuple/structs can contain
heterogeneous type whereas array
The fact that you sort of can't easily index tuple of 3 ints as
a fixed array of 3 ints is a clear indication of a tendency
that I find disturbing.
But there is a reason for this: tuple/structs can contain
heterogeneous type whereas array contains only homogeneous type..
So if you want to inde
22-Mar-2013 16:44, renoX пишет:
On Friday, 22 March 2013 at 11:14:47 UTC, Dmitry Olshansky wrote:
I'd hate any solution that distances ordinary structs, library tuples
and fixed-sized arrays.
Are struct/tuples similar to fixed-sized array?
I thought that both are different because you can sele
On Friday, 22 March 2013 at 11:14:47 UTC, Dmitry Olshansky wrote:
I'd hate any solution that distances ordinary structs, library
tuples and fixed-sized arrays.
Are struct/tuples similar to fixed-sized array?
I thought that both are different because you can select which
element you access at r
22-Mar-2013 15:25, bearophile пишет:
Dmitry Olshansky:
auto (lof, loa) = ...;
In Haskell, Scala, Python, F#, etc, the semantics and syntax are
similar.
I'd hate any solution that distances ordinary structs, library tuples
and fixed-sized arrays. If anything these should be trivially
substit
foreach ((c, ref e); loa)
I think parens become rather confusing, what about something like:
foreach (|c, ref e|; loa)
Dmitry Olshansky:
auto (lof, loa) = ...;
In Haskell, Scala, Python, F#, etc, the semantics and syntax
are similar.
I'd hate any solution that distances ordinary structs, library
tuples and fixed-sized arrays. If anything these should be
trivially substitutable where makes sense.
In Bug
On Friday, 22 March 2013 at 07:05:03 UTC, Denis Shelomovskij
wrote:
22.03.2013 1:13, bearophile пишет:
And in foreach:
foreach ((c, ref e); loa)
D already have undocumented[1] front tuple expansion in foreach
over range:
---
import std.algorithm;
import std.stdio;
void main() {
enum s
22-Mar-2013 14:58, bearophile пишет:
Jacob Carlborg:
auto (lof, loa) = heap.front;
How is front suddenly returning two elements?
It is not returning two elements. In D you can't return two elements. It
is returning a 2-Tuple. You see the 2-tuples are built by the map() and
then used to cr
Denis Shelomovskij:
D already have undocumented[1] front tuple expansion in foreach
over range:
---
import std.algorithm;
import std.stdio;
void main() {
enum s = "this is an example for huffman encoding"d;
foreach (c, n; s.dup.sort().release().group())
writefln("'%s' %s", c,
On 2013-03-21 22:13, bearophile wrote:
auto (lof, loa) = heap.front;
How is front suddenly returning two elements?
--
/Jacob Carlborg
22-Mar-2013 11:05, Denis Shelomovskij пишет:
22.03.2013 1:13, bearophile пишет:
And in foreach:
foreach ((c, ref e); loa)
D already have undocumented[1] front tuple expansion in foreach over range:
---
import std.algorithm;
import std.stdio;
void main() {
enum s = "this is an example f
22.03.2013 1:13, bearophile пишет:
And in foreach:
foreach ((c, ref e); loa)
D already have undocumented[1] front tuple expansion in foreach over range:
---
import std.algorithm;
import std.stdio;
void main() {
enum s = "this is an example for huffman encoding"d;
foreach (c, n; s.dup
I would like to see tuple syntax and abilities improved. It's
been a while since I last tried to use them so I'm not prepared
to explain in detail what I'd like to see for improvements,
however I can say that when I did try to use them I remember they
were much more unwieldy to use and more lim
UFCS, plus some tweaks to the standard library like this one
(http://d.puremagic.com/issues/show_bug.cgi?id=8755 ) help write
D code in a more functional (flow programming, Walter calls it
component programming) style.
So tuples become more and more useful, and the lack of a syntax
to unpack
18 matches
Mail list logo