Search found 106 matches

by Paul
Sun Jan 20, 2013 2:41 pm
Forum: Homework
Topic: SBCL defconstant workaround
Replies: 4
Views: 18581

Re: SBCL defconstant workaround

hayden wrote:You aren't Paul Graham, are you?
No
by Paul
Sat Jan 19, 2013 6:59 pm
Forum: Homework
Topic: SBCL defconstant workaround
Replies: 4
Views: 18581

Re: SBCL defconstant workaround

Anyways, in ANSI Common Lisp, Graham, Paul writes some functions that can be used to parse dates, but if you're using SBCL, you end up finding out that some weird bug involving defconstant gives some errors. It's not a bug (in SBCL). The value in a DEFCONSTANT form is restricted to being something ...
by Paul
Thu Nov 29, 2012 3:26 pm
Forum: Common Lisp
Topic: macro expansion within macro
Replies: 5
Views: 14817

Re: macro expansion within macro

Why do you (think you) want the inner macro to be expanded? It'll be expanded anyway when the processor (compiler, interpreter) gets to it; is it really necessary to have the expansion appear in your macro-expansion? Possibly you're just asking for a "macroexpand-all" function (in which ca...
by Paul
Mon Nov 19, 2012 5:45 pm
Forum: Common Lisp
Topic: on &rest and keyword args...
Replies: 11
Views: 23989

Re: on &rest and keyword args...

Ah, this must be a recent Python innovation. I haven't really used Python since 1.5 (but the version I have installed is 2.5.1). I get >>> def foo(b, x=1, y=2, *vargs, k=4, j=5, **kargs): pass File "<stdin>", line 1 def foo(b, x=1, y=2, *vargs, k=4, j=5, **kargs): pass ^ SyntaxError: inval...
by Paul
Sun Nov 18, 2012 4:44 pm
Forum: Common Lisp
Topic: on &rest and keyword args...
Replies: 11
Views: 23989

Re: on &rest and keyword args...

Well, summaries I would just like to know whether it is possible achieve a flexible behavior like in this trivial example of func (written in Python) that can accepts arbitrarily positional variables args(&rest) with keyargs, or only positional variables args, or only keyargs… Only if you wri...
by Paul
Sat Nov 17, 2012 6:08 pm
Forum: Common Lisp
Topic: on &rest and keyword args...
Replies: 11
Views: 23989

Re: on &rest and keyword args...

You can always use just &rest, and then parse it yourself for keyword args. It's not entirely trivial...what do you want it to do? Pick off the keyword args and then put everything else in rest? Or let you have non-keyword args first, then the keyword args? Or let you intermix them? How do you t...
by Paul
Fri Nov 16, 2012 3:06 pm
Forum: Common Lisp
Topic: Behaviour of EVAL inside LET
Replies: 14
Views: 24246

Re: Behaviour of EVAL inside LET

The discussion in this topic is aimed at better understanding how the principle "there is no difference between code and data in LISP" works in practice. My intention was to "execute" comand-variables containing LISP code as their values (like variable "command") so th...
by Paul
Tue Nov 13, 2012 7:31 am
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 37263

Re: Replacing a function in an expression

I'm quite sure you are wrong here, the special operators are the true primitives, they don't have anytthing below them. What the standard is talking about here is that the implementation needs to have an macro expander for the special operators which understands which parts of the code being compil...
by Paul
Tue Nov 13, 2012 2:24 am
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 37263

Re: Replacing a function in an expression

Of course they can. But implementation-specific special forms must have macro-expansions...so if you fully-macroexpand, there can't be any implementation-specific special forms remaining -- just functions and standard special forms. The ANSI spec says that ... An implementation is free to implement...
by Paul
Mon Nov 12, 2012 2:53 pm
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 37263

Re: Replacing a function in an expression

Unfortunately there is no implementation independent way to do this since every implementations has it's own special forms. But usually the number of special forms is small wich makes it feasible to write different versions for different implementations. No. The special forms/operators are defined ...