Library and site D examples
Tejas
notrealemail at gmail.com
Sun Jan 29 03:49:04 UTC 2023
On Sunday, 29 January 2023 at 00:03:31 UTC, Karmello wrote:
> should automatically include most of the standard library so
> one doesn't have to constantly import them just to do basic
> playing around with the examples.
>
>
> For example, I modified an example
>
> import std.array : assocArray;
> import std.range : enumerate;
> import std.conv, std.algorithm, std.math;
>
> auto aa = iota(1,20).map!(i => round(log(i))).take(10).array;
> writeln(to!string(aa));
>
>
> and had to import the 3rd line. This gets pretty annoying when
> playing around with the examples. The most common libs should
> automatically be imported and may be dependent on the
> library(e.g, if its std.traits maybe import std.meta and others
> related).
>
You can just `import std;` if you want to play around and don't
care much about the first compilation time. The following code
also works:
```d
import std;
void main(){
auto aa = iota(1,20).map!(i => round(log(i))).take(10).array;
writeln(to!string(aa));
}
```
More information about the Digitalmars-d
mailing list