#!/usr/bin/picolisp /usr/lib/picolisp/lib.l # commify_series - show proper comma insertion in list output (de Lists ("just one thing") ("Mutt" "Jeff") ("Peter" "Paul" "Mary") ("To our parents" "Mother Theresa" "God") ("pastrami" "ham and cheese" "peanut butter and jelly" "tuna") ("recycle tired, old phrases" "ponder big, happy thoughts") ("recycle tired, old phrases" "ponder big, happy thoughts" "sleep and dream peacefully") ) (de commifySeries (Lst) (ifn (cddr Lst) (glue " and " Lst) (glue (if (find '((S) (sub? "," S)) Lst) "; " ", ") (conc (head -1 Lst) (cons (pack "and " (last Lst))) ) ) ) ) (for L Lists (prinl "The list is: " (commifySeries L) ".") ) (bye)