Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!orion.oac.uci.edu!ucivax!pazzani From: pazzani@ics.uci.edu (Michael Pazzani) Newsgroups: comp.lang.lisp Subject: Re: STRUCTUREP Message-ID: <2713DF17.555@ics.uci.edu> Date: 11 Oct 90 02:55:18 GMT References: <1990Oct10.091722.4495@hellgate.utah.edu> <1990Oct10.165312.29838@hellgate.utah.edu> <758@forsight.Jpl.Nasa.Gov> Reply-To: pazzani@ics.uci.edu (Michael Pazzani) Organization: UC Irvine Department of ICS Lines: 27 In article <758@forsight.Jpl.Nasa.Gov> gat@robotics.Jpl.Nasa.Gov (Erann Gat) writes: >That's actually not a bad solution to the puzzle: > >(defun structurep (thing) > (equal "#S" (subseq (format nil "~S" thing) 0 2))) > >This would work for any structure which did not have a :print-function >defined. (What a horrible hack, though!) > >E. If you get to define the structures (rather than using a large existing program), you could do this in a different way: (defstruct struct) ;; It has no slots, but a struct-p is created now just include struct in every structure you care about, and struct-p will work on them. (defstruct (pig (:include struct)) piglets) (defstruct (goat (:include struct)) kids) etc. (struct-p (make-pig :piglets nil)) Mike