Created
April 11, 2011 21:19
-
-
Save amtal/914371 to your computer and use it in GitHub Desktop.
I like helping people
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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