Memoize

BasicWerk   EC Support   Technique   Facebook  

20141226090111_Common_Lisp_defstruct_stone_roses

Common_Lisp_defstruct_stone_roses

 

 

sample_hash_ref.lisp
 
(defstruct mem name age part)
(defparameter members
 (list
  (make-mem :name 'john	:age 34 :part 'guitar)
  (make-mem :name 'ian	:age 35 :part 'vocal)
  (make-mem :name 'mani	:age 35 :part 'bass)
  (make-mem :name 'reni	:age 33 :part 'drums)))
 
(format T "Members~%")
 
(mapc
 (lambda (ms)
  (format T "~C~A~%" #\tab (mem-name ms))
  (format T "~C~C~A~C~A~%" #\tab #\tab 'age  #\tab (mem-age ms))
  (format T "~C~C~A~C~A~%" #\tab #\tab 'part #\tab (mem-part ms)))
 members)
 
 
;; output
Members
    JOHN
        AGE	34
        PART	GUITAR
    IAN
        AGE	35
        PART	VOCAL
    MANI
        AGE	35
        PART	BASS
    RENI
        AGE	33
        PART	DRUMS
 

 

20141226012754_Perl_hash_reference

 


© Shin Nakamura/BasicWerk 2008 - 2015