www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - make-array and its prining in CLisp

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
Jul 11 2011