|
Re: tarot.el: msg#00009emacs.sources
Joe Corneli writes: > [...] > (defun draw-tarot-card () > (interactive) > (message "%s" (nth (random 78) tarot-deck))) Better to use arrays in such cases: (defvar tarot-deck ["Fool" "Magician" "High Priestess" "Empress" "Emperor" "Hierophant" "Lovers" "Chariot" "Strength" "Hermit" "Wheel of Fortune" "Justice" "Hanged Man" "Death" "Temperance" "Devil" "Tower" "Star" "Moon" "Sun" "Judgement" "World" "Ace of Wands" "2 of Wands" "3 of Wands" "4 of Wands" "5 of Wands" "6 of Wands" "7 of Wands" "8 of Wands" "9 of Wands" "10 of Wands" "Page of Wands" "Knight of Wands" "Queen of Wands" "King of Wands" "Ace of Cups" "2 of Cups" "3 of Cups" "4 of Cups" "5 of Cups" "6 of Cups" "7 of Cups" "8 of Cups" "9 of Cups" "10 of Cups" "Page of Cups" "Knight of Cups" "Queen of Cups" "King of Cups" "Ace of Swords" "2 of Swords" "3 of Swords" "4 of Swords" "5 of Swords" "6 of Swords" "7 of Swords" "8 of Swords" "9 of Swords" "10 of Swords" "Page of Swords" "Knight of Swords" "Queen of Swords" "King of Swords" "Ace of Pentacles" "2 of Pentacles" "3 of Pentacles" "4 of Pentacles" "5 of Pentacles" "6 of Pentacles" "7 of Pentacles" "8 of Pentacles" "9 of Pentacles" "10 of Pentacles" "Page of Pentacles" "Knight of Pentacles" "Queen of Pentacles" "King of Pentacles"]) (defun random-aref (array) (aref array (random (length array)))) (defun draw-tarot-card () (interactive) (message "%s" (random-aref tarot-deck))) -- Emílio C. Lopes Munich, Germany |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | tarot.el: 00009, Joe Corneli |
|---|---|
| Next by Date: | search-prop.el, version 1.1: 00009, Michael Olson |
| Previous by Thread: | tarot.eli: 00009, Joe Corneli |
| Next by Thread: | search-prop.el, version 1.1: 00009, Michael Olson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |