Skip to content

Instantly share code, notes, and snippets.

@shhyou
Created July 28, 2021 06:42
Show Gist options
  • Save shhyou/4d9c2dd007ec8ae4ed1759fc1041484b to your computer and use it in GitHub Desktop.
Save shhyou/4d9c2dd007ec8ae4ed1759fc1041484b to your computer and use it in GitHub Desktop.
#lang racket/base
(require (for-syntax racket/base)
syntax/parse/define)
(let ()
(define-syntax-parse-rule (define-sum S)
(define (S n)
(if (= n 0) 0 (+ n (S (- n 1))))))
(define-sum sigma)
(sigma 5))
#lang racket/base
(require (for-syntax racket/base)
syntax/parse/define)
(let ()
(define var-in-the-scope "this var is in the scope")
(define-syntax-parse-rule (get-var)
var-in-the-scope)
(get-var))
(let ()
(define-syntax-parse-rule (get-this-too)
also-in-the-scope)
(define also-in-the-scope "this var is also in the scope")
(get-this-too))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment