GP lisper <spambait@clouddancer.com> wrote:
+---------------
| <pjb@informatimago.com> wrote:
| > C S S <css@swissjabber.ch> writes:
| >> kenny wrote:
| >>> aaa
| >> bbb
| > ccc
|
| dum
| dum
| dum
+---------------
Indeed. This is Lisp, and we shouldn't have to do things thrice
before abstracting a more useful pattern:
> (setf (readtable-case *readtable*) :invert)
:invert
>
> (defun dumdum (lines &key (width 3) (start #\A) (step 1))
(loop repeat lines for c from (char-code start) by step
collect (make-array width :initial-element (code-char c)
:element-type 'base-char)
into strings
finally (return (values-list (mapcar #'intern strings)))))
dumdum
> (dumdum 3)
aaa
bbb
ccc
> (dumdum 5 :width 7)
aaaaaaa
bbbbbbb
ccccccc
ddddddd
eeeeeee
> (dumdum 7 :width 4 :start #\Z :step -3)
zzzz
wwww
tttt
qqqq
nnnn
kkkk
hhhh
>
Now, that's ever so much better! ;-} ;-}
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607