Search found 78 matches

by David Mullen
Fri Nov 06, 2015 1:43 pm
Forum: Homework
Topic: encoding and decoding randomly
Replies: 3
Views: 11755

Re: encoding and decoding randomly

How do they define "the" right encoding? Seems like there could be (at least for some messages) more than one potential encoding.
by David Mullen
Tue Nov 03, 2015 8:22 pm
Forum: The Lounge
Topic: How many LISP books until...
Replies: 5
Views: 14177

Re: How many LISP books until...

I doubt anyone would get that far just by reading books. Learning a programming language is one thing, but to 'get' Common Lisp is to internalize the thinking that drove the evolution of the language in the first place. You do that by writing code, while familiarizing yourself with the standard and ...
by David Mullen
Sun Oct 25, 2015 1:12 pm
Forum: Common Lisp
Topic: With-open-file macro problem
Replies: 6
Views: 15870

Re: With-open-file macro problem

What happens when you want to perform output to a file that already exists is controlled by the :if-exists option. The possibilities—per the standard—run from :new-version (for versioning file systems, e.g. Files-11 ) to :rename-and-delete and :append and then some. Problem is, the standard is l...
by David Mullen
Sat Oct 24, 2015 8:12 pm
Forum: Common Lisp
Topic: With-open-file macro problem
Replies: 6
Views: 15870

Re: With-open-file macro problem

If I type what you've posted then I get an error: ? (defvar glob nil) GLOB ? (defun get-data() (with-open-file (stream "deseases.dat" ) (setf (glob (read stream))))) > Error: Odd number of args to SETF : ((GLOB (READ STREAM))). > While executing: (:INTERNAL CCL::NX1-COMPILE-LAMBDA), in pro...
by David Mullen
Sat Oct 24, 2015 2:13 pm
Forum: Common Lisp
Topic: With-open-file macro problem
Replies: 6
Views: 15870

Re: With-open-file macro problem

What's the error message?
by David Mullen
Thu Oct 08, 2015 2:18 pm
Forum: Homework
Topic: unbound variable
Replies: 1
Views: 7109

Re: unbound variable

Don't use funcall to call the function directly. And on the remove-duplicates line in the powerset function, the reference to LST shouldn't be in parentheses by itself.
by David Mullen
Tue Sep 08, 2015 10:10 am
Forum: Common Lisp
Topic: Trying to rewrite an ugly macro
Replies: 10
Views: 25879

Re: Trying to rewrite an ugly macro

Forgive my ignorance, but why is a symbol macro necessary in the first place? Isn't it unnecessarily polluting the namespace? What's so great about a symbol macro? I didn't feel like using a dynamic variable if I didn't need one. Needless to say, a dynamic variable would also add to the namespace, ...
by David Mullen
Fri Sep 04, 2015 5:49 pm
Forum: Common Lisp
Topic: Trying to rewrite an ugly macro
Replies: 10
Views: 25879

Re: Trying to rewrite an ugly macro

Sod Almighty wrote:In which case, my question would be "why not just use a normal let binding instead?"
Well, I guess I had gensyms on the brain, is why. You're right, of course, a normal let binding will also shadow a symbol macro.
by David Mullen
Fri Sep 04, 2015 12:34 pm
Forum: Common Lisp
Topic: Trying to rewrite an ugly macro
Replies: 10
Views: 25879

Re: Trying to rewrite an ugly macro

Does symbol-macrolet declare a dynamic binding for the ,body call, that shadows the original macro? No, the shadowing is lexical. Why not just use a normal dynamic variable, or a parameter? I don't use dynamic variables if I don't need dynamic extent. In this case lexical scoping appeared sufficien...
by David Mullen
Wed Sep 02, 2015 3:44 pm
Forum: Common Lisp
Topic: Trying to rewrite an ugly macro
Replies: 10
Views: 25879

Re: Trying to rewrite an ugly macro

I write macros in a piecemeal way, separating out parts of the functionality into smaller macros that build on each other, and I like to be able to test each piece separately with MACROEXPAND-1 so I know what I'm getting in the final expansion. This is what keeps me sane, and that's reason enough to...