Skip to content

Instantly share code, notes, and snippets.

@amtal
Created April 11, 2011 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amtal/914371 to your computer and use it in GitHub Desktop.
Save amtal/914371 to your computer and use it in GitHub Desktop.
I like helping people
(defmodule homework (export letters))
(defun lut (x)
(: lists nth (- x (car '"/"))
'("0"
"1" "abc" "def"
"ghi" "jkl" "mno"
"pqrs" "tuv" "wxyz")))
(defun letters
(('()) '(()))
(((cons n ns)) (lc ((<- chr (lut n))
(<- rest (letters ns)))
(cons chr rest))))
;; Example test (no I/O)
(defun test ()
(let* ((t1 (letters '"123"))
(t2 (letters '"456"))
(t3 (letters '"789"))
(9 (length t1))
(27 (length t2))
(48 (length t3)))
(tuple t1 t2 t3)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment