Search found 226 matches

by edgar-rft
Fri Aug 21, 2015 11:21 am
Forum: Common Lisp
Topic: Overriding describe
Replies: 4
Views: 11842

Re: Overriding describe

Sonya Keene worked with an early version of CLOS, that had been slightly modified in the final ANSI version, but 99.99999% of the book still works today. In ANSI Common Lisp DESCRIBE is a normal function like the functions defined by DEFUN , that can have no methods. That's why you get an error when...
by edgar-rft
Mon Aug 17, 2015 6:50 pm
Forum: Common Lisp
Topic: Variable reference in structures
Replies: 18
Views: 45779

Re: Variable reference in structures

I only wanted to say: The Keene book explains CLOS *much* better than I can do it here in the limited space of a Lisp-forum text box. I have a copy of that book, too. So if there still are questions...
by edgar-rft
Sun Aug 16, 2015 2:34 pm
Forum: Common Lisp
Topic: To merge new symbols in macros
Replies: 6
Views: 14812

Re: To merge new symbols in macros

If you want to make it look really scary you could add some FORMAT science: (defun symbol-from-items (&rest items) (intern (format nil "~:@(~a~{-~a~}~)" (first items) (rest items)))) (symbol-from-items 1 2 3 'hello "kitty") => 1-2-3-HELLO-KITTY See ~:@( ~) , ~{ ~} , and ~a if...
by edgar-rft
Sun Aug 16, 2015 12:30 pm
Forum: Common Lisp
Topic: To merge new symbols in macros
Replies: 6
Views: 14812

Re: To merge new symbols in macros

...a compound word merged from the union of a variable with some other custom defined content... What is a "word"? A symbol, a string, (or maybe a 16-bit integer)? What data type do you need as result? The easiest way to combine all sort of stuff into a string is using ( FORMAT nil ...) l...
by edgar-rft
Sun Aug 16, 2015 9:31 am
Forum: Common Lisp
Topic: Variable reference in structures
Replies: 18
Views: 45779

Re: Variable reference in structures

Because it's raining all day long and because I'm obviously bored to death, here is one of the most ridiculous programs I ever wrote. It's a four-slots mini spreadsheet that is displayed in the REPL's return value. It uses CLOS and :AFTER methods to update the result whenever one of the input slots ...
by edgar-rft
Sun Aug 16, 2015 5:03 am
Forum: Common Lisp
Topic: Variable reference in structures
Replies: 18
Views: 45779

Re: Variable reference in structures

Here you have something to play with until your book arrives: I wasn't thinking to do that at instatiation time, but inside the structure, at definition time, something like: (defstruct my-class (attr1 0) (attr2 (+ attr1 1))) Common Lisp classes are stupid data containers like structures, the behavi...
by edgar-rft
Sun Aug 16, 2015 4:27 am
Forum: Common Lisp
Topic: Variable reference in structures
Replies: 18
Views: 45779

Re: Variable reference in structures

My thinking was: if I can use slots for both attributes and methods, since I can store functions as data, I won't be so far from the point. That's in principle correct, Paul Graham shows in the last chapter of ANSI Common Lisp how to build an C++-like object system with inheritance out of simple Co...
by edgar-rft
Sat Aug 15, 2015 6:11 am
Forum: Common Lisp
Topic: Variable reference in structures
Replies: 18
Views: 45779

Re: Variable reference in structures

Common Lisp is much older than nearly all other programming languages (only Assembly and Fortran are older) and therefore often has "weird" names for nearly everything. The structure "fields" for example in Common Lisp are called "slots", and I think that is what you me...
by edgar-rft
Mon Aug 10, 2015 1:27 pm
Forum: Other Tools
Topic: A very hard start (How to compile and execute CCL)
Replies: 6
Views: 32163

Re: A very hard start (How to compile and execute CCL)

It's nearly impossible to write a Common Lisp program without using CLOS but most people don't know it. For example, the different number types (integer, float, etc.) are system classes and nearly all math functions are generic functions that specialize their arguments on the number classes and then...
by edgar-rft
Fri Aug 07, 2015 8:06 am
Forum: Common Lisp
Topic: what is a special form?
Replies: 6
Views: 16827

Re: what is a special form?

Here is what I've found so far: Section 11.1.2.1 The COMMON-LISP Package Section 11.1.2.1.1 Constraints on the COMMON-LISP Package for Conforming Implementations Section 11.1.2.1.2 Constraints on the COMMON-LISP Package for Conforming Programs Section 11.1.2.1.2.1 Some Exceptions to Constraints on t...