make-array and its prining in CLisp
bearophile
bearophileHUGS at lycos.com
Mon Jul 11 07:04:36 PDT 2011
I find some of the Common Lisp built-ins handy, like:
http://ideone.com/Q7qvP
This program:
(print (make-array '(10 10) :element-type 'bit :initial-element 1))
Shows:
#2A(#*1111111111
#*1111111111
#*1111111111
#*1111111111
#*1111111111
#*1111111111
#*1111111111
#*1111111111
#*1111111111
#*1111111111)
It's a nD matrix of bits, and you are allowed to give an optional initial element value. make-array is a generic function that works with any type of element. The print shows a nicely formatted array of bits.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list