Common names lisp and random names app


I needed some names for a different game example so I made these lists. These are names from historical NZ data.


1. Source

1.1. Repo

git clone git@codeberg.org:tfw/common-names.git
ln -s common-names -t ~/common-lisp/

1.2. Lisp

(require :common-names)

2. Names

2.1. Girls

(print common-names/names:*girls*)
("Sophie" "Olivia" "Ella" "Isabella" "Charlotte" "Lily" "Emma" "Emily"
 "Jessica" "Grace" "Hannah" "Chloe" "Ruby" "Lucy" "Ava" "Amelia" "Madison"
 "Maia" "Mia" "Holly" "Sophia" "Zoe" "Paige" "Georgia" "Kate" "Brooke"
 "Maddison" "Samantha" "Sienna" "Isla" "Jade" "Sarah" "Katie" "Stella" "Eva"
 "Caitlin" "Hayley" "Jasmine" "Elizabeth" "Tayla" "Anna" "Summer" "Bella" "Amy"
 "Isabelle" "Mikayla" "Molly" "Keira" "Kayla" "Abigail" "Amber" "Zara" "Alexis"
 "Millie" "Alyssa" "Aaliyah" "Eden" "Nevaeh" "Gemma" "Rebecca" "Phoebe"
 "Danielle" "Mya" "Aria" "Leah" "Ashley" "Poppy" "Harmony" "Laura" "Manaia"
 "Scarlett" "Angel" "Abby" "Maya" "Rose" "Lilly" "Victoria" "Jorja" "Hazel"
 "Savannah" "Tessa" "Alexandra" "Natalie" "Peyton" "Sofia" "Maria" "Lauren"
 "Alice" "Lucia" "Anika" "Caitlyn" "Gabrielle" "Mackenzie" "Ayla" "Chelsea"
 "Gabriella" "Madeleine" "Nicole" "Trinity" "Madeline" "Faith" "Skye" "Brianna"
 "Anahera" "Isabel" "Kaitlyn" "Nikita" "Ashlee" "MacKenzie" "Libby" "Aimee"
 "Jessie" "Courtney" "Rachel" "Paris" "Ashleigh" "Natasha" "Jemma" "Megan"
 "Stephanie" "Imogen" "Lydia" "Claudia" "Jenna" "Tiana" "Erin" "Ariana"
 "Angelina") 

2.2. Boys

(print common-names/names:*boys*)
("Taylor" "Brooklyn" "Riley" "Jack" "James" "William" "Samuel" "Joshua" "Liam"
 "Oliver" "Benjamin" "Daniel" "Thomas" "Jacob" "Ethan" "Jayden" "Noah" "Ryan"
 "Lucas" "Luke" "Max" "Hunter" "Matthew" "Lachlan" "Alexander" "Dylan" "Connor"
 "Blake" "Tyler" "Caleb" "Charlie" "George" "Joseph" "Cooper" "Nathan" "Logan"
 "Alex" "Cameron" "Michael" "Harrison" "Isaac" "Jackson" "Toby" "Jordan"
 "Xavier" "Levi" "Harry" "Jake" "Ashton" "Finn" "Jesse" "Oscar" "Elijah" "Leo"
 "Cody" "John" "Luca" "Mason" "Aidan" "Charles" "Flynn" "Henry" "Kingston"
 "Jamie" "Adam" "David" "Joel" "Reuben" "Aaron" "Bailey" "Lincoln" "Nicholas"
 "Sam" "Christian" "Seth" "Andrew" "Carter" "Sebastian" "Angus" "Ben" "Troy"
 "Zachary" "Edward" "Robert" "Hamish" "Dominic" "Isaiah" "Phoenix" "Archie"
 "Callum" "Kyle" "Luka" "Hayden" "Christopher" "Felix" "Quinn" "Cole" "Aiden"
 "Gabriel" "Leon" "Marcus" "Nathaniel" "Patrick" "Sean" "Jason" "Louis"
 "Mitchell" "Lukas" "Jonathan" "Peter" "Austin" "Vincent" "Kaleb" "Carlos"
 "Brayden" "Anthony" "Bradley" "Timothy" "Regan" "Justin") 

3. Well, let's add a mcclim app for randomly choosing names

3.1. Require mcclim

(require :mcclim)

I also move to (in-package :clim-user) in my repl.

3.2. Random names app

(define-application-frame name-frame
    ()
  ((girls :initform common-names/names:*girls*)
   (boys :initform common-names/names:*boys*))
  (:pane :interactor))

3.3. Commands

3.3.1. boys

(define-name-frame-command (com-boys :menu t :name t)
    ((no '(integer 1 100) :default '1))
  (with-slots (boys) *application-frame*
    (loop
      :repeat no
      :for r := (random (length boys))
      :for name := (nth r boys) :do
    (princ name) (princ " "))))


3.3.2. girls

(define-name-frame-command (com-girls :menu t :name t)
    ((no '(integer 1 100) :default '1))
  (with-slots (girls) *application-frame*
    (loop
      :repeat no
      :for r := (random (length girls))
      :for name := (nth r girls) :do
    (princ name) (princ " "))))

3.3.3. people

(define-name-frame-command (com-people :menu t :name t)
      ((no '(integer 1 100) :default '1))
    (with-slots (girls boys) *application-frame*
      (loop
    :with people := (append girls boys)
    :repeat no
    :for r := (random (length people))
    :for name := (nth r people) :do
      (princ name) (princ " "))))

3.4. find app (at any time)

(find-application-frame 'name-frame)

4. Hope it helps you!

We can chatter here or on the mastodon.

By the way, come hang out at the weekly live shows on Wed 0UTC anonradio.net. Tuesday night in the Americas.

Same as every week: https://mastodon.sdf.org/@screwtape/114185828795141960

Author: screwlisp

Created: 2025-03-21 Fri 17:58

Validate

Get lispmoo2

Leave a comment

Log in with itch.io to leave a comment.