Skip to content

Instantly share code, notes, and snippets.

@yao2030
Created November 17, 2012 03:11
Show Gist options
  • Save yao2030/4092947 to your computer and use it in GitHub Desktop.
Save yao2030/4092947 to your computer and use it in GitHub Desktop.
A substring is a subset whose letters come consecutively in the original word.
(define (substrings wd)
(if (empty? wd)
(se "")
(se (sub-helper wd) (substrings (bf wd)))))
(define (sub-helper wd)
(if (= 1 (count wd))
(se wd)
(se wd (sub-helper (bl wd)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment