@cdunn2001 I'm not sure why you think it doesn't work. I typed up your example
and the following works (I'm using Nim 0.18.1):
type GraphConcept* = concept g
type NodeType = type(g.node())
type Node* = object
n*: int
type Graph* = object
nodes*: seq[Node]
proc node*(g: Graph): Node =
Node()
proc shortest_path*(g: GraphConcept): seq[g.NodeType] =
g.nodes
let nodes = @[Node(n:1), Node(n: 2)]
let g = Graph(nodes: nodes)
echo shortest_path(g)
Run
- Concepts boia01
- Re: Concepts cdunn2001
- Re: Concepts cdunn2001
- Re: Concepts boia01
- Re: Concepts boia01
