Last active
February 10, 2022 02:17
-
-
Save malkia/67aab577ab102020dc554ab0d0833a80 to your computer and use it in GitHub Desktop.
cue example of references using integer indexes, then transforming them into bits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"list" | |
) | |
build: { | |
proj1: { | |
deps: [ | |
"proj2", | |
] | |
} | |
proj2: { | |
deps: [ | |
"proj4", | |
"proj3", | |
] | |
} | |
proj3: { | |
deps: [ | |
"proj6", | |
"proj4", | |
] | |
} | |
proj4: { | |
deps: [ | |
"proj7", | |
"proj5" | |
] | |
} | |
proj5: { | |
deps: [ | |
"proj6" | |
] | |
} | |
proj6: { | |
deps: [ | |
"proj7", | |
//"proj3" | |
] | |
} | |
proj7: { | |
deps: [ | |
//"proj1" | |
] | |
} | |
} | |
// Direct dependencies | |
build: [string]: deps: [...string] | |
// Full (transitive) dependencies | |
build: [string]: _#fulldeps: [...string] | |
build: [ID=_]: _#fulldeps: build[ID].deps + list.FlattenN( | |
[for c,d in build[ID].deps { | |
build[d]._#fulldeps | |
}],-1) | |
// "uniq" deps | |
build: [ID=_]: udeps: [for k,_ in {for v in build[ID].deps {"\(v)": null}} {k} ] | |
// full (transitive) "uniq" deps | |
build: [ID=_]: fudeps: [for k,_ in {for v in build[ID]._#fulldeps {"\(v)": null}} {k} ] | |
// import("math/bits") | |
//#build_names: [for k,_ in build{k}] | |
//#build_sids: {for k,v in #build_names{"\(v)":bits.Lsh(1,k)}} | |
//build: [ID=_]: fulldepmask: list.Sum([for c,d in build[ID].fulldeps { | |
// build[d].depmask | |
// }]) + build[ID].depmask | |
//build: [ID=_]: #cycle2: bits.And(#build_sids[ID],build[ID].fulldepmask)!=0 | |
//build: [ID=_]: #cycle2: false | |
//build: [ID=_]: depmask: list.Sum([for k,v in build[ID].deps {#build_sids[v]}]) | |
//build: [ID=_]: #cycle: bits.And(#build_sids[ID],build[ID].depmask)!=0 | |
//build: [ID=_]: #cycle: false | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment