mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-19 09:41:02 +02:00
Fixed pair() and pair_wrap()
This commit is contained in:
@@ -353,7 +353,7 @@ function subindex(v, idx) = [
|
||||
// Example:
|
||||
// l = ["A","B","C",D"];
|
||||
// echo([for (p=pair(l)) str(p.y,p.x)]); // Outputs: ["BA", "CB", "DC"]
|
||||
function pair(v) = [for (i=[0:len(v)-1]) [v[i],v[i%len(v)]]];
|
||||
function pair(v) = [for (i=[0:len(v)-2]) [v[i],v[i+1]]];
|
||||
|
||||
|
||||
// Function: pair_wrap()
|
||||
@@ -364,7 +364,7 @@ function pair(v) = [for (i=[0:len(v)-1]) [v[i],v[i%len(v)]]];
|
||||
// Example:
|
||||
// l = ["A","B","C",D"];
|
||||
// echo([for (p=pair_wrap(l)) str(p.y,p.x)]); // Outputs: ["BA", "CB", "DC", "AD"]
|
||||
function pair_wrap(v) = [for (i=[0:len(v)-1]) [v[i],v[i%len(v)]]];
|
||||
function pair_wrap(v) = [for (i=[0:len(v)-1]) [v[i],v[(i+1)%len(v)]]];
|
||||
|
||||
|
||||
// Function: zip()
|
||||
|
Reference in New Issue
Block a user