On Sunday, 8 November 2015 at 11:47:41 UTC, Rikki Cattermole
wrote:
opApply if you want 0 .. N iterations during for a foreach
statement and having it reset each time.
No, that won't help. I want to be able to iterate over a data set
of infinite size.
Otherwise you want ranges :)
An input
Hello,
I am looking for something like the "Iterator" Interface in Java
or PHP.
Is there something comparable in D that can be used with foreach?
Thanks,
J.Frank
On Sunday, 8 November 2015 at 11:28:05 UTC, Jonathan M Davis
wrote:
On Sunday, November 08, 2015 10:31:11 Panke via
Digitalmars-d-learn wrote:
import std.variant, std.stdio;
---
struct NodeTypeA(T) { T[] children; }
struct NodeTypeB(T) { Tree children; }
struct Leaf(T) { T delegate() dg; }
On Sunday, November 08, 2015 10:31:11 Panke via Digitalmars-d-learn wrote:
> import std.variant, std.stdio;
>
> ---
> struct NodeTypeA(T) { T[] children; }
> struct NodeTypeB(T) { Tree children; }
> struct Leaf(T) { T delegate() dg; }
>
> alias Tree = Algebraic!(Leaf, NodeTypeA!This,
On 09/11/15 12:40 AM, J.Frank wrote:
Hello,
I am looking for something like the "Iterator" Interface in Java or PHP.
Is there something comparable in D that can be used with foreach?
Thanks,
J.Frank
opApply if you want 0 .. N iterations during for a foreach statement and
having it reset
On Sunday, 8 November 2015 at 08:29:30 UTC, BBaz wrote:
On Sunday, 8 November 2015 at 08:21:38 UTC, BBaz wrote:
On Saturday, 7 November 2015 at 13:52:29 UTC, Spacen Jasset
wrote:
[...]
I have a used a template, because I cannot directly use the
InputRange(char) interface as a type, and auto
On Sunday, 8 November 2015 at 14:41:11 UTC, Spacen Jasset wrote:
But it doesn't seem efficient and strays off the conceptual
path. In other words, why chunk things up, join them back, to
get a stream?
`.byChunk` caches and `.joiner` hides this caching mechanism.
Both operations happen under
On 08.11.2015 08:17, Sliya wrote:
I am on Mac OS, but I still don't get it. If the import was not
case-sensitive, I would not have any error since the good file would
have been loaded... Here I have no error saying file not found yet the
file is not loaded. I'd love to know what really happens.
On Sunday, 8 November 2015 at 11:57:16 UTC, J.Frank wrote:
On Sunday, 8 November 2015 at 11:47:41 UTC, Rikki Cattermole
wrote:
opApply if you want 0 .. N iterations during for a foreach
statement and having it reset each time.
No, that won't help. I want to be able to iterate over a data
set
On Sunday, 8 November 2015 at 10:31:13 UTC, Panke wrote:
import std.variant, std.stdio;
---
struct NodeTypeA(T) { T[] children; }
struct NodeTypeB(T) { Tree children; }
struct Leaf(T) { T delegate() dg; }
alias Tree = Algebraic!(Leaf, NodeTypeA!This, NodeTypeB!This);
void main()
{
Tree t;
}
On Saturday, 7 November 2015 at 15:04:41 UTC, maik klein wrote:
template IsSame(T){
template As(alias t){
enum As = is(T : typeof(t));
}
}
void main()
{
int i;
enum b = IsSame!int.As!(i);
}
Err:
Error: template instance As!(i) cannot use local 'i' as
parameter to non-global
import std.variant, std.stdio;
---
struct NodeTypeA(T) { T[] children; }
struct NodeTypeB(T) { Tree children; }
struct Leaf(T) { T delegate() dg; }
alias Tree = Algebraic!(Leaf, NodeTypeA!This, NodeTypeB!This);
void main()
{
Tree t;
}
---
yields
tmp.d(6): Error: functions cannot return
On Sunday, 8 November 2015 at 05:11:50 UTC, suliman wrote:
On Sunday, 8 November 2015 at 04:50:49 UTC, thedeemon wrote:
On Saturday, 7 November 2015 at 10:03:58 UTC, Suliman wrote:
I am using DMD.
-m64 or -m32mscoff ?
Without any keys. I use dub for building
I suspect your issue is
Hello again,
I'm a bit puzzled by the "File" type. Looking at the
implementation, it seems that all I/O functions were stuffed into
a single class^H^H^H^H^Hstruct.
What I expected to find is some kind of "Stream" class (with
read(), write(), eof()), which is extended by a "File" class
(with
On Sunday, 8 November 2015 at 19:57:34 UTC, Freddy wrote:
---
import std.algorithm;
import std.range;
import std.stdio;
void main(){
only(iota(0,4),[1,4,5]).writeln;
}
---
How can I call std.range.only with different range types?
`only` is for creating a range from a list of values.
On Sunday, 8 November 2015 at 21:57:55 UTC, Alex Parrill wrote:
Post what you're trying to do if you want an example.
$ cat test.d
import std.stdio;
//void foo(Stream in_stream, Stream out_stream) // I want
something like this
void foo(File in_stream, File out_stream)
{
---
import std.algorithm;
import std.range;
import std.stdio;
void main(){
only(iota(0,4),[1,4,5]).writeln;
}
---
How can I call std.range.only with different range types?
On Sunday, 8 November 2015 at 20:47:08 UTC, J.Frank wrote:
Hello again,
I'm a bit puzzled by the "File" type. Looking at the
implementation, it seems that all I/O functions were stuffed
into a single class^H^H^H^H^Hstruct.
What I expected to find is some kind of "Stream" class (with
read(),
On Monday, 9 November 2015 at 02:14:58 UTC, Jon D wrote:
Here's an example of the behavior differences below. It uses
refRange, but same behavior occurs if the range is created as a
class rather than a struct.
--Jon
This is an artifact of struct based ranges being value types.
When you use
On Sunday, 8 November 2015 at 20:47:08 UTC, J.Frank wrote:
So, assuming my program reads from stdin and is supposed to
work on a file as well as on a pipe (which is not seekable) -
how can I make the compiler bark when I accidently use
stdin.seek()?
You don't, in general. stdin is sometimes
Just started looking at D, very promising!
One of the first programs I constructed involved infinite
sequences. A design question that showed up is whether to
construct the range as a struct/value, or class/reference. It
appears that structs/values are more the norm, but there are
I have a few questions about the pseudo built in associative
arrays.
1. Is it possible to have the built in associative array use a
custom allocator from std.experimental.allocator to service it's
allocation needs?
2. A while ago I read on the newsgroup a while back that there
was a plan
On Sunday, 8 November 2015 at 23:17:06 UTC, Jakob Ovrum wrote:
The closures for delegates in D1 are never automatically copied
to the heap, while in D2 this is done when it's determined that
the delegate might outlive one of its upvalues.
So, I think it's safe to say we have lexical closures
Hi,
the confusion starts here: http://dlang.org/function.html#closures
End of paragraph bellow the last delegate example:
"This combining of the environment and the function is called a
dynamic closure."
While according to
https://en.wikipedia.org/wiki/Scope_%28computer_science%29
"Lexical
I checked for a flag in this page http://dlang.org/dmd-linux.html
, but couldn't have found any for this purpose.
Is there a way to parse a d source file so it generates a tree in
JSON, XML, or something-that-can-be-processed-easily file format?
---
My real purpose:
I need to generate hash
On 09/11/15 4:57 PM, TheFlyingFiddle wrote:
I have a few questions about the pseudo built in associative arrays.
1. Is it possible to have the built in associative array use a custom
allocator from std.experimental.allocator to service it's allocation needs?
Nope.
2. A while ago I read on
On Monday, 9 November 2015 at 02:44:48 UTC, TheFlyingFiddle wrote:
On Monday, 9 November 2015 at 02:14:58 UTC, Jon D wrote:
Here's an example of the behavior differences below. It uses
refRange, but same behavior occurs if the range is created as
a class rather than a struct.
--Jon
This is
On 09/11/15 6:49 PM, tcak wrote:
I checked for a flag in this page http://dlang.org/dmd-linux.html , but
couldn't have found any for this purpose.
Is there a way to parse a d source file so it generates a tree in JSON,
XML, or something-that-can-be-processed-easily file format?
---
My real
On Monday, 9 November 2015 at 05:49:25 UTC, tcak wrote:
I checked for a flag in this page
http://dlang.org/dmd-linux.html , but couldn't have found any
for this purpose.
Is there a way to parse a d source file so it generates a tree
in JSON, XML, or something-that-can-be-processed-easily
On Monday, 9 November 2015 at 04:29:30 UTC, Rikki Cattermole
wrote:
On 09/11/15 4:57 PM, TheFlyingFiddle wrote:
[...]
Nope.
[...]
As far as I'm aware, you are stuck using e.g. structs to
emulate AA behavior.
I have a VERY basic implementation here:
I've updated my compiler and ran into this regression:
https://issues.dlang.org/show_bug.cgi?id=14981
Code:
---
import std.algorithm, std.container;
void main()
{
static bool compare(P a, P b)
{
return a.curColumn < b.curColumn;
}
Array!P a =
On Saturday, 7 November 2015 at 13:52:29 UTC, Spacen Jasset wrote:
[...]
I have a used a template, because I cannot directly use the
InputRange(char) interface as a type, and auto won't work
either, so is there another parameter type I can use, such that
I can have the concept of an abstract
On Sunday, 8 November 2015 at 08:21:38 UTC, BBaz wrote:
On Saturday, 7 November 2015 at 13:52:29 UTC, Spacen Jasset
wrote:
[...]
I have a used a template, because I cannot directly use the
InputRange(char) interface as a type, and auto won't work
either, so is there another parameter type I
On Sunday, 8 November 2015 at 08:05:41 UTC, Panke wrote:
I've updated my compiler and ran into this regression:
https://issues.dlang.org/show_bug.cgi?id=14981
[...]
reopened.
34 matches
Mail list logo