Search found 20 matches

by Destruct1
Wed Feb 10, 2010 4:10 am
Forum: Common Lisp
Topic: I dont get Macros
Replies: 31
Views: 17337

Re: I dont get Macros

Lisp Macros have the fullowing use: 1) Basic text Search-and-Replace 2) Building a lexical context 3) SETF Accessor 4) Conditional Evaluation 5) Binding things to the TopLevel While technically every macro is just a search-and-replace texteditor, many example macros are used the same as c-Macros. Th...
by Destruct1
Mon Feb 08, 2010 2:27 am
Forum: Common Lisp
Topic: efficient fixed size vector/matrix represenation+operations
Replies: 8
Views: 6151

Re: efficient fixed size vector/matrix represenation+operations

Btw. this is not intended to be a C++ vs. Lisp topic! Thats not gonna happen. :D Here is the point: You learn Lisp by recreating C programms, caring about C problems, using the C interface and the C libraries While I understand the reason I think it is wrong to learn Lisp by putting it on top of C....
by Destruct1
Sun Feb 07, 2010 6:44 am
Forum: Common Lisp
Topic: call function on all combinations of a list
Replies: 4
Views: 3276

Re: call function on all combinations of a list

I think this easy enough so you dont need an extern library. If you really want to I would search for a math permutation library, because the problem looks like "choose 2 out of x". Anyway here is untested code: (defun is-it-a-collision (argx argy) ;check wheter x and y collide ;put them in a global...
by Destruct1
Fri Feb 05, 2010 1:29 am
Forum: Common Lisp
Topic: "what will happen when i do..."
Replies: 9
Views: 4671

Re: "what will happen when i do..."

Lisp is quite fast, see this article: http://www.norvig.com/python-lisp.html Here is another article: http://ilc2009.scheming.org/node/7 This article basically states that it is hard to compile some of Lisp features. But this is low-level esoteric stuff not something important. So higher-order funct...
by Destruct1
Wed Feb 03, 2010 7:22 am
Forum: Common Lisp
Topic: I dont get Macros
Replies: 31
Views: 17337

Re: I dont get Macros

And here is the code for the hacked python macro: This defines a string template machine: def gaming_action (name, obj1, obj2, place, body): b = "def " + name + " (*input):\n" + " if require (input, obj1 = '" + obj1 + "', obj2 = '" + obj2 +\ "', place = '" + place + "'):\n " + body + "\n\n" return (...
by Destruct1
Wed Feb 03, 2010 6:22 am
Forum: Common Lisp
Topic: I dont get Macros
Replies: 31
Views: 17337

Re: I dont get Macros

Conrad Barski calls macros "SPELS" http://www.lisperati.com/casting.html A more direct link: http://www.lisperati.com/no_macros.html I found it an easy to understand read. I rewrote the Lisp adventure in Python. Although this first solution is not 100% without overhead it is very practical to handl...
by Destruct1
Mon Feb 01, 2010 1:51 pm
Forum: Common Lisp
Topic: I dont get Macros
Replies: 31
Views: 17337

Re: I dont get Macros

Your suggested workaround for aif (using functions) would not be good enough. Why? The Python function takes 3 Parameters and dispatches them. I do the exact same thing: I write a block of code as a definition then use that function in actual practice. Writing a function definition is easier than a...
by Destruct1
Mon Feb 01, 2010 3:23 am
Forum: The Lounge
Topic: LISP for beginners
Replies: 3
Views: 7224

Re: LISP for beginners

"Lisp: A gentle Introduction" is available free online and a good book for beginners.

The other books which are often mentioned are "Ansi common lisp" and "Practical Common Lisp".
I think neither of these are good for a beginner.
by Destruct1
Mon Feb 01, 2010 2:31 am
Forum: Common Lisp
Topic: I dont get Macros
Replies: 31
Views: 17337

Re: I dont get Macros

You know how sometimes you find yourself writing the same pattern of code for the nth time, and think, "man, I should really write a programme that would write this code for me"? That's what they do. The main point is: What is the difference between a function and a macro. What is so special about ...
by Destruct1
Wed Jan 20, 2010 2:22 am
Forum: Common Lisp
Topic: I dont get Macros
Replies: 31
Views: 17337

I dont get Macros

I am new to lisp and I am already glad that I learned the language. When people complain about the syntax and/or lisp in general I think they are are confused by the concepts and not the language itsself. For example I hardly needed a day for recursion, conditionals and the parenthesis structure, bu...