From 2d1ef94acfda2066f1a586064ecc2712e774b9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Mon, 29 Feb 2016 20:26:38 +0100 Subject: [PATCH] Added pseudocode simple overview of the rich-return graph wrapper macro, as explained on http://stackoverflow.com/q/35652284/324969 . --- graph-lib/graph/graph6-psudocode.rkt.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 graph-lib/graph/graph6-psudocode.rkt.txt diff --git a/graph-lib/graph/graph6-psudocode.rkt.txt b/graph-lib/graph/graph6-psudocode.rkt.txt new file mode 100644 index 00000000..da01bdd3 --- /dev/null +++ b/graph-lib/graph/graph6-psudocode.rkt.txt @@ -0,0 +1,23 @@ +#lang racket + +(require (for-syntax syntax/parse)) + +(define-syntax (define* stx) + ... expand types, uses free-identifier=? ...) + +(define-syntax (define-function-group stx) + (syntax-parse stx + [(_ ((~literal defun) (f-name arg ...) ret-type body) ...) + #`(begin (define-type-expander (return-type-of stx) + (syntax-parse stx + [(_ (~literal f-name)) #'ret-type] ...)) + (define* (f-name arg ...) : ret-type + body) ...)])) + +;; defines a type expander "return-type-of" +(define-function-group + (defun (f1) (Listof String) '("a" "b")) + (defun (f2 [a : (return-type-of f1)] (length '("a" "b"))))) + +;; defines another type expander "return-type-of" +(define-function-group etc.) \ No newline at end of file