Re: List of Dynamic Arrays

2021-06-17 Thread Justin Choi via Digitalmars-d-learn

On Thursday, 17 June 2021 at 15:58:40 UTC, Adam D Ruppe wrote:

On Thursday, 17 June 2021 at 15:57:46 UTC, Justin Choi wrote:

I want to write something like `DList!int[]()`


DList!(int[])() ?


Thanks I've mentally slapped myself a hundred times for this 
mistake :D


List of Dynamic Arrays

2021-06-17 Thread Justin Choi via Digitalmars-d-learn
If I wanted to create a DList (or any similar data structure) of 
multiple integers, how would I accomplish this?


I want to write something like `DList!int[]()` but the best I can 
do for now is a format such as `DList!(Tuple(int, int))()` which 
confines me to a fixed number of integers.


Unpacking Slices

2021-06-14 Thread Justin Choi via Digitalmars-d-learn
Is there any shortcut for unpacking slices like I'd want to do in 
a scenario like this?

`info = readln.strip.split;`
`string a = info[0], b = info[1], c = info[2];`


Predicates Within Strings

2021-06-14 Thread Justin Choi via Digitalmars-d-learn
Could somebody explain or point me to documentation that helps to 
explain the usage of strings in predicates?
My main question is how D infers the omitted variable 
specifications given otherwise - for example:

`filter!(a => a < 3)(arr);`
and
`filter!"a < 3"(arr);`
produce the same result.


Inclusion of Parenthesis on Certain Functions

2021-06-13 Thread Justin Choi via Digitalmars-d-learn
I'm currently learning D right now, and I was wondering why 
certain functions like std.stdio.readln can work both with and 
without parenthesis for the function call. I've tried looking 
through the documentation but can't find an explanation for why 
you can use it without parenthesis.