4 ms·
You're still in the pedagogy sandbox; every real Lisp worth using has structures and objects: (defstruct person name age occupation) => PERSON (make-
by mahmud 16y ago
You're still in the pedagogy sandbox; every real Lisp worth using has structures and objects:
(defstruct person
name age occupation) => PERSON
(make-person :name "Kris Kringle"
:age 71
:occupation "Santa") => #S(PERSON-1)
(person-name *) ==> "Kris Kringle"
- jacquesm 16y ago> You're still in the pedagogy sandbox; Don't worry, I realize that :) > very real Lisp worth using has structures and objects: That's a tricky and somewhat circular definition. If it is worth using it is probably real and vv, but most lisp tutorials that teach 'pure' lisp do not have structures and / or objects, they rely on lists alone as their major data structure. That also defines all lisps that do not have these items as somehow not real and there seem to be a lot of lisp people that somehow consider this 'impure'. Or is my reading material that dated ?
- jules 16y agoIf your reading material Lisp doesn't have some form of defstruct then it certainly is dated, or they are avoiding it on purpose. Every non-toy Lisp has it.
- jacquesm 16y agoOk, thanks. That helps. I started 'from the ground up', I figured that the best way to study a language is by looking at the way it was in the beginning since that's the most pure form of it. If 'lists' are as great as they are said to be you'd expect that things like structs and classes are optimizations, not essentials.
- mahmud 16y agoRestricting yourself to Pure Lisp is like insisting on only dating virgins.
- jules 16y agoYeah, you can view it as an optimization: you can build defstruct & co on top of lists with macros. However, using ca(d)*r by hand is not advisable in any case... Usually it goes the other way around: you implement lists on top of defstruct.
- eru 16y agoDon't do that for Lisp. You will be stuck with the dynamic scoping that Lisp used to be plagued with in the beginning. Go far a modern Lisp like Scheme. (You can ignore the syntax you don't want to deal with, yet.)