Skip to content

Controversial seq! macro usage examples #301

Closed
@videobitva

Description

@videobitva

Hello!

The seq! macro usage example, which could be found here, is pretty much controversial and made me frustrating for several hours while trying to figure out what is wrong with me and my coding skills.

Take a look at this section:

let b = constant(1.0 as f32, dim4!(3, 3));
let seqs = [seq!(1:3:1), seq!()];
assign_seq(&mut a, &seqs, &b);

Here we can clearly see the way to use this macro:

seq!(start:stop:step);

However, this does not work, because the way it supposed is to be (according to reality and this doc page) is to be like this:

seq!(start,stop,step);

As this issue name has controversial in it, time to take a look at this bit of docs:

let seqs = &[Seq::new(1u32, 3, 1), Seq::default()];
let _sub = index(&a, seqs);
//af_print!("a(seq(1,3,1), span)", sub);
// [3 5 1 1]
//     0.6720     0.3932     0.0621     0.9159     0.8434
//     0.5339     0.2706     0.7089     0.0231     0.1328
//     0.1386     0.9455     0.9434     0.2330     0.2657

Here the correct way of code usage was given, but the problem is that it was commented out, thus while looking through you can easily miss it. If we continue reading, we can easily see (as we already discovered it), that every single example of the correct way of usage of this macro was commented out, while the wrong way was kept.

Of course, all of this would not be a problem if I firstly looked through the docs here, but, the thing is, in the first section it clearly states that you should use the tutorials, which have misleading info in it. Please correct the tutorial so there will be less people in pain.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions