Skip to Content.
Sympa Menu

patterns-discussion - RE: [patterns-discussion] Homoiconicity Pattern Language?

patterns-discussion AT lists.cs.illinois.edu

Subject: General talk about software patterns

List archive

RE: [patterns-discussion] Homoiconicity Pattern Language?


Chronological Thread 
  • From: "Mike Beedle" <beedlem AT e-architects.com>
  • To: "'Pascal Costanza'" <costanza AT web.de>, "'Patterns-Discussion'" <patterns-discussion AT cs.uiuc.edu>
  • Cc:
  • Subject: RE: [patterns-discussion] Homoiconicity Pattern Language?
  • Date: Sun, 15 Aug 2004 23:28:38 -0500
  • Importance: Normal
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>




Pascal Costanza writes:
> Hm, at the moment I am skeptical that this term can turn out
> useful. As far as I understand the term at the moment, not only
> Lisp is homoiconic, but also assembly language (or better: machine
> language) would be. In machine language, both data and programs
> are just (sequences of) machine words.

Pascal:

I think the rule of thumb is that programs need to be indistinguishable
from data, and that this "data" could be modified and then executed.
So to qualify, machine language would have to have the equivalent of
"eval" in Lisp... and create dynamically code segments. (I believe
Tom Ray, the acclaimed artificial life researcher, has done some
of that with assembler.)

For example:

(format t "~%~%HomoIconicity")
(setf L nil)
(setf L '(defclass lagrangian()
((store :initform nil
:initarg :start-expression
:accessor store)))) ;; a program that is
data
(print L)
(eval L)
(setf c2 (make-instance 'lagrangian ))
(print c2)
(print (car (cdr L)))
;; (print (car (cdr (cdr L))))
;; (print (car (cdr (cdr (cdr L)))))
(setf (car (cdr L)) 'hamiltonian) ;; modified data = the
program
(print (car (cdr L)))
(eval L)
(setf c2 (make-instance 'lagrangian ))
(print c2)

This will produce:

HomoIconicity
(DEFCLASS LAGRANGIAN NIL ((STORE :INITFORM NIL :INITARG
:START-EXPRESSION :ACCESSOR STORE)))
#<LAGRANGIAN @ #x22447492>
LAGRANGIAN
NIL
((STORE :INITFORM NIL :INITARG :START-EXPRESSION :ACCESSOR STORE))
HAMILTONIAN
(DEFCLASS HAMILTONIAN NIL ((STORE :INITFORM NIL :INITARG
:START-EXPRESSION :ACCESSOR STORE)))
#<HAMILTONIAN @ #x22448272>
CL-USER>

and shows how one can modify some data in Lisp -- a program, and then
re-evaluate it.

This is the very quality that enables:

genetic algorithms
true mobile agents
most of the artificial life research
dynamic-rule systems
true behavior-learning and behavior-exploring systems
spontaneous model creation
true interactive programming systems (ala Kay)
etc.

Imo, it is a somewhat special quality. But yes, it depends
on what you want to do and what you consider "cool".

Pascal Costanza writes:
> The reason why I am skeptical is this: There are lots of
> terms floating around in computer science that seem to want to
> indicate a certain quality that we should want as programmers.
> Like typed, strongly typed, dynamically typed, compiled,
> object-oriented, class-based, functional, higher order,
> platform-independent, garbage collected, well-founded, minimal,
> standardized, and so on, and so on.

Not everyone likes the same properties homoiconicity would
be fairly high up in the list of priorities for some of us.

Pascal Costanza writes:
> It's pretty common that people with different personal preferences
> can come together and produce something valuable for other people,
> not only for oneself - like in a band or an orchestra, for example.
> Why should that be different in our profession?)

I agree with this, you just have to make the choice of either
playing the violin (the equivalent of a very expressive
language like Lisp), or a drum (like... Basic?).

Pascal Costanza writes:
> The only thing I can really tell for sure is that Common Lisp is the
> best language out there. ;)

Here, I strongly agree :-)

Pascal Costanza writes:
> "Sadly, society and parents insidiously put out messages from
> childhood on that others know what's best. Many people are deeply
> conditioned to expect and hope some outside agency, power or person
> will solve their problems. Letting go of expectations or even
> wanting this is difficult, partially because what one is left with
> is oneself and all of one's limitations."
> Joel Kramer, Diana Alstad, The Guru Papers - Masks of Authoritarian
> Power
>
> That book tells you quite a few things about programming languages.
>
> Pascal

Great quote ... Definitely something to think about.

I have a 4 and a 6 year old .... :-)

- Mike

"One can even conjecture that Lisp owes its survival
specifically to the fact that its programs are lists,
which everyone, including me, has regarded as a disadvantage."

- John McCarthy, "Early History of Lisp"

This tells you how John McCarthy really understands Lisp ;-)






Archive powered by MHonArc 2.6.16.

Top of Page