On Tuesday, 10 November 2015 at 04:34:22 UTC, Cauterite wrote:
Here's the output I get (DMD v2.068.2):
[1, 3, 10, 12, 21, 30, 100, 102, 111, 120, 201, 210]
core.exception.AssertError@std\range\package.d(4603): Assertion
failure
iota.front() is complaining the range is empty from this line.
Here's the output I get (DMD v2.068.2):
[1, 3, 10, 12, 21, 30, 100, 102, 111, 120, 201, 210]
core.exception.AssertError@std\range\package.d(4603): Assertion
failure
void main() {
import std.stdio, std.algorithm, std.range, std.conv;
enum digSum = (int n) => n.text.map!(d => d - '0').sum;
//enum harshads = iota(1, int.max).filter!(n => n % digSum(n)
== 0);
enum harshads = iota(1, 256).filter!(n => n % digSum(n) == 0);
harshads.take(20).w
On Tuesday, 10 November 2015 at 01:29:11 UTC, Brian Schott wrote:
Yes. It's a hack that gives you a modulus without having to do
a modulus. It only works on powers of two.
http://graphics.stanford.edu/~seander/bithacks.html#ModulusDivisionEasy
On Monday, 9 November 2015 at 21:33:09 UTC, TheFlyingFiddle wrote:
On Monday, 9 November 2015 at 04:52:37 UTC, rsw0x wrote:
On Monday, 9 November 2015 at 04:29:30 UTC, Rikki Cattermole
wrote:
Fwiw, EMSI provides high quality containers backed by
std.experimental.allocator.
https://github.com/e
On Monday, 9 November 2015 at 21:33:09 UTC, TheFlyingFiddle wrote:
On Monday, 9 November 2015 at 04:52:37 UTC, rsw0x wrote:
On Monday, 9 November 2015 at 04:29:30 UTC, Rikki Cattermole
wrote:
Fwiw, EMSI provides high quality containers backed by
std.experimental.allocator.
https://github.com/e
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 file
On Monday, 9 November 2015 at 18:07:39 UTC, ref2401 wrote:
On Monday, 9 November 2015 at 14:42:01 UTC, ref2401 wrote:
Hello
I wrote a small hello world app and imported the
`std.experimental.allocator` module.
I'm getting the following optlink error:
--
Given the following code:
```
import std.meta;
static assert(is(char : dchar));
static assert(is(AliasSeq!(int, char) : AliasSeq!(int, char)));
static assert(is(AliasSeq!(int, char) : AliasSeq!(int, dchar)));
```
The third static assert fails. Should it, given that the first
and second pass?
On Monday, 9 November 2015 at 22:06:22 UTC, Alex Parrill wrote:
Check out the following code:
struct Test {
int foo() {
return 2;
}
int bar() @property {
return 2;
}
}
On Monday, 9 November 2015 at 21:56:22 UTC, Fyodor Ustinov wrote:
Hi!
Why do need "@proprety" if everything works without it?
WBR,
Fyodor.
Check out the following code:
struct Test {
int foo() {
return 2;
}
On Monday, 9 November 2015 at 19:42:53 UTC, J.Frank wrote:
On Monday, 9 November 2015 at 18:44:00 UTC, Alex Parrill wrote:
Ranges are streams. file.byLine(Copy) and byChunk are
effectively streams that are ranges.
I might be wrong, but from what I read so far I don't think
that "ranges are st
Hi!
Why do need "@proprety" if everything works without it?
WBR,
Fyodor.
On Monday, 9 November 2015 at 18:04:23 UTC, Alex Parrill wrote:
On Monday, 9 November 2015 at 17:56:14 UTC, Alex Parrill wrote:
On Monday, 9 November 2015 at 15:23:21 UTC, Spacen Jasset
wrote:
On Monday, 9 November 2015 at 14:58:19 UTC, Adam D. Ruppe
wrote:
File has a .byLine and .byLineCopy me
On Monday, 9 November 2015 at 04:52:37 UTC, rsw0x wrote:
On Monday, 9 November 2015 at 04:29:30 UTC, Rikki Cattermole
wrote:
Fwiw, EMSI provides high quality containers backed by
std.experimental.allocator.
https://github.com/economicmodeling/containers
I have a question regarding the impleme
On Monday, 9 November 2015 at 04:52:37 UTC, rsw0x wrote:
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 imp
On Monday, 9 November 2015 at 08:49:08 UTC, J.Frank wrote:
Hm. "Maybe the stream is seekable, maybe it is not" is not
really an option for a language that is supposed to be type
safe.
It just isn't known at compile time. Files, especially on Unix,
are interchangeable at compile time but offer
On Monday, 9 November 2015 at 19:42:53 UTC, J.Frank wrote:
(BTW. Where do I find select()/poll() in phobos?)
They are in `core.sys.posix.sys.select`
In general, OS headers for Posix in C like "sys/select.h" can be
gotten by "import core.sys.posix.sys.select;" is in
"core.sys.posix.unistd"
On Monday, 9 November 2015 at 19:49:15 UTC, J.Frank wrote:
I'm looking for a replacement for the deprecated inferfaces
InputStream and OutputStream.
Just keep using them. The deprecated note isn't really
important... they will still be in Phobos for another year and
you can copy the file out
On Monday, 9 November 2015 at 19:38:06 UTC, Ali Çehreli wrote:
As far as I understand, the issue is to prevent the seek() call
at compile time, right? If so, the range types that byLine()
and byLineCopy() return does not have such a member function.
I think the code achieves that goal because
On Monday, 9 November 2015 at 18:44:00 UTC, Alex Parrill wrote:
Ranges are streams. file.byLine(Copy) and byChunk are
effectively streams that are ranges.
I might be wrong, but from what I read so far I don't think that
"ranges are streams":
- Can you read an arbitrary length of bytes from a
On 11/09/2015 10:18 AM, J.Frank wrote:
On Monday, 9 November 2015 at 14:48:35 UTC, Ali Çehreli wrote:
import std.stdio;
import std.range;
void foo(I, O)(I in_stream, O out_stream)
if (isInputRange!I &&
isOutputRange!(O, ElementType!I)) {
// in_stream.seek(3); // compile
On Monday, 9 November 2015 at 18:18:19 UTC, J.Frank wrote:
On Monday, 9 November 2015 at 14:48:35 UTC, Ali Çehreli wrote:
import std.stdio;
import std.range;
void foo(I, O)(I in_stream, O out_stream)
if (isInputRange!I &&
isOutputRange!(O, ElementType!I)) {
// in_stream
[code]
private static import std.digest.md;
public enum HashValue = std.digest.digest.digest!(
std.digest.md.MD5)( "" );
void main(){}
[/code]
[output]
dmd main.d
/usr/include/dmd/phobos/std/digest/md.d(202): Error:
reinterpreting cast from uint[16] to ubyte* is not supported in
CTFE
/usr/i
On Monday, 9 November 2015 at 14:48:35 UTC, Ali Çehreli wrote:
import std.stdio;
import std.range;
void foo(I, O)(I in_stream, O out_stream)
if (isInputRange!I &&
isOutputRange!(O, ElementType!I)) {
// in_stream.seek(3); // compile error - good :)
foreach (element;
On Monday, 9 November 2015 at 14:42:01 UTC, ref2401 wrote:
Hello
I wrote a small hello world app and imported the
`std.experimental.allocator` module.
I'm getting the following optlink error:
---
OPTLINK (R) for Win32 Release 8.00.17
Copyright (
On Monday, 9 November 2015 at 17:56:14 UTC, Alex Parrill wrote:
On Monday, 9 November 2015 at 15:23:21 UTC, Spacen Jasset wrote:
On Monday, 9 November 2015 at 14:58:19 UTC, Adam D. Ruppe
wrote:
File has a .byLine and .byLineCopy method you could use to
just get lines from it.
Ah yes. but unfo
On Monday, 9 November 2015 at 15:23:21 UTC, Spacen Jasset wrote:
On Monday, 9 November 2015 at 14:58:19 UTC, Adam D. Ruppe wrote:
File has a .byLine and .byLineCopy method you could use to
just get lines from it.
Ah yes. but unfortunately I don't want to do that. I want to
pass a range into m
On Monday, 9 November 2015 at 15:09:28 UTC, rumbu wrote:
The problem is that just importing FormatSpec will create
exactly 88 phobos dependencies.
I would pull request that to move it into its own independent
module and then make std.format import that. I know that's not an
immediate solution
On Monday, 9 November 2015 at 16:11:23 UTC, H. S. Teoh wrote:
On Mon, Nov 09, 2015 at 03:09:26PM +, rumbu via
Digitalmars-d-learn wrote:
[...]
Do you need *custom* format specifiers? If all you need is to
be able to write: format("%s", myData), then the only thing you
need to do is to im
On Mon, Nov 09, 2015 at 03:09:26PM +, rumbu via Digitalmars-d-learn wrote:
> Let's say that I'm a library provider and I intend to offer a
> completely new data type suitable for printing with format() or
> writef().
>
> According to this tutorial
> (http://wiki.dlang.org/Defining_custom_print
On Monday, 9 November 2015 at 14:58:19 UTC, Adam D. Ruppe wrote:
File has a .byLine and .byLineCopy method you could use to just
get lines from it.
Ah yes. but unfortunately I don't want to do that. I want to pass
a range into my print function. i.e. Sometimes it may not be a
File, it might b
Let's say that I'm a library provider and I intend to offer a
completely new data type suitable for printing with format() or
writef().
According to this tutorial
(http://wiki.dlang.org/Defining_custom_print_format_specifiers),
to achieve this, one must import at least std.format : FormatSpec
File has a .byLine and .byLineCopy method you could use to just
get lines from it.
On 11/09/2015 01:48 AM, J.Frank wrote:
My question is now:
How can I make this work without using deprecated stuff?
import std.cstream;
void foo(InputStream in_stream, OutputStream out_stream)
{
//in_stream.seek(3); // compile error - good :)
char[] line;
while ((line = in_strea
I can't seem to find a way of splitting a range of characters
into lines unless the range has a length or can be sliced? This
presumably is because i is a range of chunks, which cannot have a
length or a slice. I do not see how to get anything else from the
File object at the moment.
import s
Hello
I wrote a small hello world app and imported the
`std.experimental.allocator` module.
I'm getting the following optlink error:
---
OPTLINK (R) for Win32 Release 8.00.17
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.d
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 file
My question is now:
How can I make this work without using deprecated stuff?
import std.cstream;
void foo(InputStream in_stream, OutputStream out_stream)
{
// in_stream.seek(3); // compile error - good :)
char[] line;
while ((line = in_stream.readLine()) !is null)
On Sunday, 8 November 2015 at 23:50:58 UTC, Adam D. Ruppe wrote:
You don't, in general. stdin is sometimes seekable and the
compiler doesn't know if it is or not until you try at runtime.
Hm. "Maybe the stream is seekable, maybe it is not" is not really
an option for a language that is suppose
40 matches
Mail list logo