SyllablesList

From Ial

(Difference between revisions)
(Created page with 'This is the list of all possible 180 syllables for the alphabet: (A I U M N P T K S L) A I U AM AN IM IN UM UN AI AU AIM AIN AUM AUN MA MI MU MAM MAN MIM MIN MUM MUN MAI MAU MA…')
m
 
Line 190: Line 190:
  #|
  #|
  Morpheme list generator in Common Lisp.
  Morpheme list generator in Common Lisp.
-
 
+
  For the Optimal International Auxiliary Language project.
  For the Optimal International Auxiliary Language project.
  See: http://editthis.info/ial
  See: http://editthis.info/ial
-
 
+
  This should work in any Common Lisp implementation
  This should work in any Common Lisp implementation
  (e.g. ECL, CLISP, SBCL, ...)
  (e.g. ECL, CLISP, SBCL, ...)
-
 
+
  Released under the public domain.
  Released under the public domain.
  Author: Antonio Bonifati <http://ninuzzo.github.com/about.html>
  Author: Antonio Bonifati <http://ninuzzo.github.com/about.html>
  |#
  |#
-
 
+
  ;;; Definitions BEGIN:
  ;;; Definitions BEGIN:
  (defconstant +vowels+ '(a i u))
  (defconstant +vowels+ '(a i u))
Line 209: Line 209:
   (append +nasals+ +consonants-before-liquids+ +liquids+))
   (append +nasals+ +consonants-before-liquids+ +liquids+))
  (defconstant +alphabet+ (append +vowels+ +consonants+))
  (defconstant +alphabet+ (append +vowels+ +consonants+))
-
 
+
  (defun diphthongp (letter-list)
  (defun diphthongp (letter-list)
   "Return T (true) if letter-list is a diphthong, NIL (false) otherwise."
   "Return T (true) if letter-list is a diphthong, NIL (false) otherwise."
Line 217: Line 217:
     (and (= (length letter-list) 2) (eq first-letter 'a)
     (and (= (length letter-list) 2) (eq first-letter 'a)
       (or (eq second-letter 'i) (eq second-letter 'u)))))
       (or (eq second-letter 'i) (eq second-letter 'u)))))
-
 
+
  (defun vowel-start-syllables ()
  (defun vowel-start-syllables ()
   "Returns the list of all possible syllables beginning with a vowel."
   "Returns the list of all possible syllables beginning with a vowel."
   (append (vowels) (nasalize (vowels)) (diphthongs) (nasalize (diphthongs))))
   (append (vowels) (nasalize (vowels)) (diphthongs) (nasalize (diphthongs))))
-
 
+
  (defun syllables ()
  (defun syllables ()
   "Returns the list of all possible syllables."
   "Returns the list of all possible syllables."
Line 228: Line 228:
                       +consonants-before-liquids+)))
                       +consonants-before-liquids+)))
  ;;; Definitions END.
  ;;; Definitions END.
-
 
+
-
 
+
  ;;; Utility functions BEGIN:
  ;;; Utility functions BEGIN:
  (defun cross-product (list-1 list-2)
  (defun cross-product (list-1 list-2)
Line 241: Line 241:
               (mapcar #'(lambda (elem-2) (list elem-1 elem-2)) list-2))
               (mapcar #'(lambda (elem-2) (list elem-1 elem-2)) list-2))
           list-1))
           list-1))
-
 
+
  (defun diphthongs ()
  (defun diphthongs ()
   "Return the list of all possible diphthongs."
   "Return the list of all possible diphthongs."
   (remove-if-not #'diphthongp (cross-product +vowels+ +vowels+)))
   (remove-if-not #'diphthongp (cross-product +vowels+ +vowels+)))
-
 
+
  (defun vowels ()
  (defun vowels ()
   "Return the list of all possible vowels."
   "Return the list of all possible vowels."
   (mapcar #'list +vowels+))
   (mapcar #'list +vowels+))
-
 
+
  (defun consonants ()
  (defun consonants ()
   "Return the list of all possible consonants."
   "Return the list of all possible consonants."
   (mapcar #'list +consonants+))
   (mapcar #'list +consonants+))
-
 
+
  (defun nasalize (syllable-list)
  (defun nasalize (syllable-list)
   "Nasalize syllable-list by adding a nasal at the end of each syllable and return the new list."
   "Nasalize syllable-list by adding a nasal at the end of each syllable and return the new list."
   (cross-product syllable-list +nasals+))
   (cross-product syllable-list +nasals+))
-
 
+
  (defun prefix-consonant (syllable-list &optional (consonant-list +consonants+))
  (defun prefix-consonant (syllable-list &optional (consonant-list +consonants+))
   "Prefix syllable-list with consonants from consonant-list and return the new list."
   "Prefix syllable-list with consonants from consonant-list and return the new list."
   (cross-product consonant-list syllable-list))
   (cross-product consonant-list syllable-list))
-
 
+
  (defun flatten (list)
  (defun flatten (list)
   "Return the flattened version of a list."
   "Return the flattened version of a list."
Line 268: Line 268:
           (list list)
           (list list)
           (mapcan #'flatten list))))
           (mapcan #'flatten list))))
-
 
+
  (defun princ-symbol-list (symbol-list)
  (defun princ-symbol-list (symbol-list)
   "Print all the symbols of symbol-list in a row on a fresh line."
   "Print all the symbols of symbol-list in a row on a fresh line."
   (fresh-line)
   (fresh-line)
   (mapc #'(lambda (symbol) (princ symbol)) symbol-list))
   (mapc #'(lambda (symbol) (princ symbol)) symbol-list))
-
 
+
  (defun princ-syllable-list (syllable-list)
  (defun princ-syllable-list (syllable-list)
   "Output syllable-list in a destructured human-readable form."
   "Output syllable-list in a destructured human-readable form."
   (mapc #'princ-symbol-list (mapcar #'flatten (syllables))))
   (mapc #'princ-symbol-list (mapcar #'flatten (syllables))))
  ;;; Utility functions END.
  ;;; Utility functions END.
-
 
+
  ;;; Main program BEGINS:
  ;;; Main program BEGINS:
  (print +alphabet+)
  (print +alphabet+)

Current revision as of 20:49, 19 July 2012

This is the list of all possible 180 syllables for the alphabet:

(A I U M N P T K S L)

A I U AM AN IM IN UM UN AI AU AIM AIN AUM AUN MA MI MU MAM MAN MIM MIN MUM MUN MAI MAU MAIM MAIN MAUM MAUN NA NI NU NAM NAN NIM NIN NUM NUN NAI NAU NAIM NAIN NAUM NAUN PA PI PU PAM PAN PIM PIN PUM PUN PAI PAU PAIM PAIN PAUM PAUN TA TI TU TAM TAN TIM TIN TUM TUN TAI TAU TAIM TAIN TAUM TAUN KA KI KU KAM KAN KIM KIN KUM KUN KAI KAU KAIM KAIN KAUM KAUN SA SI SU SAM SAN SIM SIN SUM SUN SAI SAU SAIM SAIN SAUM SAUN LA LI LU LAM LAN LIM LIN LUM LUN LAI LAU LAIM LAIN LAUM LAUN PLA PLI PLU PLAM PLAN PLIM PLIN PLUM PLUN PLAI PLAU PLAIM PLAIN PLAUM PLAUN TLA TLI TLU TLAM TLAN TLIM TLIN TLUM TLUN TLAI TLAU TLAIM TLAIN TLAUM TLAUN KLA KLI KLU KLAM KLAN KLIM KLIN KLUM KLUN KLAI KLAU KLAIM KLAIN KLAUM KLAUN SLA SLI SLU SLAM SLAN SLIM SLIN SLUM SLUN SLAI SLAU SLAIM SLAIN SLAUM SLAUN

Here is the computer program used to generate it, useful if we make any change to the alphabet.


#!/usr/bin/ecl -shell
#|
Morpheme list generator in Common Lisp.

For the Optimal International Auxiliary Language project.
See: http://editthis.info/ial

This should work in any Common Lisp implementation
(e.g. ECL, CLISP, SBCL, ...)

Released under the public domain.
Author: Antonio Bonifati <http://ninuzzo.github.com/about.html>
|#

;;; Definitions BEGIN:
(defconstant +vowels+ '(a i u))
(defconstant +nasals+ '(m n))
(defconstant +liquids+ '(l))
(defconstant +consonants-before-liquids+ '(p t k s))
(defconstant +consonants+
  (append +nasals+ +consonants-before-liquids+ +liquids+))
(defconstant +alphabet+ (append +vowels+ +consonants+))

(defun diphthongp (letter-list)
  "Return T (true) if letter-list is a diphthong, NIL (false) otherwise."
  ;; Implement here your definition of diphthong.
  (let ((first-letter (first letter-list))
        (second-letter (second letter-list)))
    (and (= (length letter-list) 2) (eq first-letter 'a)
      (or (eq second-letter 'i) (eq second-letter 'u)))))

(defun vowel-start-syllables ()
  "Returns the list of all possible syllables beginning with a vowel."
  (append (vowels) (nasalize (vowels)) (diphthongs) (nasalize (diphthongs))))

(defun syllables ()
  "Returns the list of all possible syllables."
  (append (vowel-start-syllables) (prefix-consonant (vowel-start-syllables))
    (prefix-consonant (prefix-consonant (vowel-start-syllables) '(l))
                      +consonants-before-liquids+)))
;;; Definitions END.


;;; Utility functions BEGIN:
(defun cross-product (list-1 list-2)
  "Couple each element of list-1 to each element of list-2 and return the list of pairs so obtained."
  #|
  Here is another more Common-Lispy implementation using the loop macro:
  (loop for elem-1 in list-1 append
    (loop for elem-2 in list-2 collect (list elem-1 elem-2))))
  |#
  (mapcan #'(lambda (elem-1)
              (mapcar #'(lambda (elem-2) (list elem-1 elem-2)) list-2))
          list-1))

(defun diphthongs ()
  "Return the list of all possible diphthongs."
  (remove-if-not #'diphthongp (cross-product +vowels+ +vowels+)))

(defun vowels ()
  "Return the list of all possible vowels."
  (mapcar #'list +vowels+))

(defun consonants ()
  "Return the list of all possible consonants."
  (mapcar #'list +consonants+))

(defun nasalize (syllable-list)
  "Nasalize syllable-list by adding a nasal at the end of each syllable and return the new list."
  (cross-product syllable-list +nasals+))

(defun prefix-consonant (syllable-list &optional (consonant-list +consonants+))
  "Prefix syllable-list with consonants from consonant-list and return the new list."
  (cross-product consonant-list syllable-list))

(defun flatten (list)
  "Return the flattened version of a list."
  (if list
      (if (atom list)
          (list list)
          (mapcan #'flatten list))))

(defun princ-symbol-list (symbol-list)
  "Print all the symbols of symbol-list in a row on a fresh line."
  (fresh-line)
  (mapc #'(lambda (symbol) (princ symbol)) symbol-list))

(defun princ-syllable-list (syllable-list)
  "Output syllable-list in a destructured human-readable form."
  (mapc #'princ-symbol-list (mapcar #'flatten (syllables))))
;;; Utility functions END.

;;; Main program BEGINS:
(print +alphabet+)
(defparameter syllable-list (syllables))
(print (length syllable-list))
;;; Uncomment to print syllables with internal structure.
;(print syllable-list)
(princ-syllable-list syllable-list)
;; Main program ENDS.
Personal tools