-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record Updates Allow Arbitrary Expressions, Update Pollen Tests (#141)
Co-authored-by: Susan Garry <[email protected]> Co-authored-by: Susan Garry <[email protected]> Co-authored-by: anshumanmohan <[email protected]> Co-authored-by: Adrian Sampson <[email protected]>
- Loading branch information
1 parent
6fc0854
commit 4825794
Showing
12 changed files
with
830 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def degree() { | ||
// Output is a (Segment, int) set. | ||
parset out_degs[(Segment*int)]; | ||
|
||
for segment in in_g.segments { | ||
emit (segment, segment.edges.size()) to out_degs; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
def flip() { | ||
graph out_g; | ||
|
||
for path in paths { | ||
flip_path(path); | ||
} | ||
} | ||
|
||
def flip_path(path: Path) { | ||
parset out_steps[Step, out_g]; | ||
max_step_idx = path.length() - 1; | ||
if is_rev(path) { | ||
for step in path.steps { | ||
emit | ||
{ step with handle: | ||
{ step.handle with | ||
orientation: !step.handle.orientation | ||
}, | ||
idx: max_step_idx - step.idx | ||
} to out_steps; | ||
} | ||
} | ||
} | ||
|
||
def is_rev(path: Path) { | ||
fw = 0; | ||
bw = 0; | ||
for step in path.steps { | ||
sh = step.handle; | ||
len = sh.segment.length(); | ||
if sh.orientation { | ||
fw = fw + len; | ||
} | ||
else { | ||
bw = bw + len; | ||
} | ||
} | ||
return bw > fw; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def overlap() { | ||
// Output is a (Path, Path) set. | ||
parset out_overlaps[(Path*Path)]; | ||
|
||
for path in paths { | ||
for step in path.steps { | ||
for s in step.handle.segment.steps { | ||
if s.path != path { | ||
emit (path, s.path) to out_overlaps; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
Prog { | ||
imports: [], | ||
func_defs: [ | ||
FuncDef { | ||
name: Id( | ||
"degree", | ||
), | ||
args: [], | ||
ret_typ: None, | ||
stmts: [ | ||
ParsetDecl { | ||
id: Id( | ||
"out_degs", | ||
), | ||
typ: Tuple( | ||
Node, | ||
Int, | ||
), | ||
graph_id: None, | ||
}, | ||
For { | ||
id: Id( | ||
"segment", | ||
), | ||
iterator: FieldAccess { | ||
object: Var( | ||
Id( | ||
"in_g", | ||
), | ||
), | ||
field: Var( | ||
Id( | ||
"segments", | ||
), | ||
), | ||
}, | ||
body: Block { | ||
stmts: [ | ||
EmitTo { | ||
expr: Tuple { | ||
lhs: Var( | ||
Id( | ||
"segment", | ||
), | ||
), | ||
rhs: MethodCall { | ||
object: FieldAccess { | ||
object: Var( | ||
Id( | ||
"segment", | ||
), | ||
), | ||
field: Var( | ||
Id( | ||
"edges", | ||
), | ||
), | ||
}, | ||
method: Id( | ||
"size", | ||
), | ||
args: [], | ||
}, | ||
}, | ||
set_id: Id( | ||
"out_degs", | ||
), | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
ret: None, | ||
}, | ||
], | ||
} |
Oops, something went wrong.