| Paste number 51973: | macro; need help here |
| Pasted by: | hannes |
| 7 months, 2 weeks ago | |
| #dylan | Context in IRC logs | |
| Paste contents: |
| define macro graph { graph ( ?connections:* ) } => { begin let g = make(<graph>); add-edges(g, list(?connections)); g; end } connections: { } => { } { ?snode:name -> ?tnode:name ; ... } => { ?"snode", ?"tnode" , ... } { ?snode:name -> ?tnode:name -> ?unode:name ; ... } => { ?"snode", ?"tnode", ?"tnode", ?"unode", ... } { ?snode:name -> ?tnode:name -> ?unode:name -> ?vnode:name ; ... } => { ?"snode", ?"tnode", ?"tnode", ?"unode", ?"unode", ?"vnode", ... } end; I would like to have only two rules in the connections auxiliary macro |
Annotations for this paste:
| Annotation number 1: | macro usage |
| Pasted by: | hannes |
| 7 months, 2 weeks ago | |
| Context in IRC logs | |
| Paste contents: |
| let new-graph = graph ( foo -> bar -> boo; bluub -> foo ); |
| Annotation number 2: | How about this? |
| Pasted by: | |Agent |
| 7 months, 2 weeks ago | |
| Context in IRC logs | |
| Paste contents: |
| define macro graph { graph ( ?edges:* ) } => { begin let g = make(<graph>); ?edges; add-edges(g, list(?connections)); g; end } edges: { } => { } { ?connections ; ... } => { add-edges(g, list(?connections)) } connections: { ?node:name } => { ?"node" } { ?node:name -> ... } { ?"node", ... } end; |