|
|
Hunger 2 (Programming) by Dovina
;LISP
(defun hunger ;This time do it, and forget
;your silly âsyntax errorâ
;and âbad data type.â
(while hungry
(if food ;if itâs offered
(smell)
(taste)
(eat)
);end if food
);end while hungry ;eventually you will get full
(search-desires)
(fulfill-desires)
(hunger) ;Now go back
;to the start
;and donât complain.
;Keep looping.
;Itâs all you get.
);end defun hunger
Votes: (green: user, blue: anonymous)
| Graph | Votes |
10 |
|
2 | 1 |
9 |
|
0 | 0 |
8 |
|
1 | 0 |
7 |
|
0 | 0 |
6 |
|
0 | 0 |
5 |
|
0 | 0 |
4 |
|
0 | 0 |
3 |
|
1 | 0 |
2 |
|
1 | 0 |
1 |
|
1 | 0 |
0 |
|
1 | 0 |
|
Arithmetic Mean: 5.5
Weighted score: 5.134471
Overall Rank: 5537
Posted: February 27, 2005 6:18 AM PST; Last modified: February 27, 2005 6:18 AM PST
View voting details
Comments:
350 view(s)
|
Hey mofo, what about the poem?
Furthermore, "hunger" is a terrible name for a function. Hunger is a thing. You can't "do" hunger. And Christ alone knows what 'fulfill-desires' does. Whatever it is, it evidently doesn't involve satisfying hunger, as that's taken care of in "hunger". And you don't use any function parameters, or declare any local variables. All your variables are global. They fail. You fail.
Aside from its bulbous demerits as a program, it's an utter swellington as a poeme. And that ain't good. -10-
Also, it is very common for a programmer to comment on a close paren, especially if several lines separate it from its open paren. As you may not know, every open paren in LISP must be followed eventually by a close paren which completes the command. Placing the close paren on a new line with a comment telling which open paren it closes is therefore good practice and makes the code easier to maintain.
I tried to keep the program simple, avoiding parameter passing and uncommon commands that manage linked lists, coordinate searches and the like, but I see it is not simple enough.
Of course nobody can dispute your expertise in swellington poemes and your ability to determine failure in all things poetic and LISP.
1. 'food' is either a global variable or an error. Stop disputing it, and stop randomly discharging Lisp syntax.
2. I'm well aware how expressions are formed. I am commenting on your formatting. Your formatting is unconventional and unhelpful. It may be considered "good practice" to put closing brackets on a separate line in the ladies' world of AUTOCAD. It is not considered good practice anywhere else. Lisp is not C.
Go read some actual, non-AUTOCAD Lisp. You will see how it is done in the real world of enormous beards.
3. I don't fathom how you think it "makes the code easier to maintain". However, what doesn't make the code easier to maintain is your cutesy comments. They make it harder, because if you change the name of the function or variable, you have to go update the comment. It also insults the reader, clutters up the page, and makes you look like the only code you've ever seen was from an AUTOCAD tutorial, which is most likely the case.
4. It is "Lisp". Do not discharge what it stands for.
5. That you think "linked list" and "coordinate searches" are sophisticated, confusing computer phrases is both quaint and crushingly dim.
The code is easier to maintain because itâs easier to follow. Itâs easy to change a variable name and all of the comments that address it using a simple text search and replace.
Thatâs how itâs done in the real world of nil beards.
2. Anyone operating on a cognitive level above that of a pea is perfectly capable of matching up opening and closing parentheses without the aid of indentation. And since it's against convention, which makes it uncomfortable and annoying to read for people accustomed to convention, it's equivalent to wearing a bin on one's head and charging head-first into the sea.
3. I can't expect anyone without a billowing, rockmage-like beard to understand how comments actually tend to make code harder to read. Naive, comforting faith in comments is endemic to the ladies' world of AUTOCAD, and I doubt I will convince you otherwise, so I shan't bother.
www.lisp.org/table/style.htm
Where are your mysterious ideas of "good practice" coming from?