Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created March 15, 2013 20:35
Show Gist options
  • Save dyoo/5172930 to your computer and use it in GitHub Desktop.
Save dyoo/5172930 to your computer and use it in GitHub Desktop.
#lang racket
(define (my-expand-path-with-env a-path-string)
(define (lookup var)
(getenv (substring var 1)))
(regexp-replace* #px"\\$\\w+" a-path-string lookup))
(my-expand-path-with-env "$HOME/foo/bar")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment