Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Post Code

Name: Anonymous 2011-03-04 21:33

One recurring complaint is that nobody talks about code on /prog/. So everyone write go and write some code, any code, that does something, anything, and post it. A small explanation wouldn't go amiss either.

Name: Anonymous 2011-03-06 0:18

>>35-36
Terrible!
Please get Emacs, or some Lisp IDE (if you really don't like Emacs). They are able to automatically indent Lisp code. Of course, after having used them for so long, I do know all the indentation rules myself (sometimes I even add rules for my own macros), but I wouldn't indent manually - indentation is there to help you quickly understand what some code is doing, it's quite helpful in lisp as indentation is used to serve as a visual cue as to the purpose/functionality of the code, things which pure syntactic sugar does for you in other languages.

Example proper indentation for your code:

(defun factorial (num)
  (if (> num 1)
      (* num (factorial
              (- num 1)))
      1))
;;; or
(defun factorial (num)
  (if (> num 1)
      (* num (factorial (- num 1)))
      1))


If you MUST know the rules explicitly, here's some hints for CL ( http://www.labri.fr/perso/strandh/Teaching/MTP/Common/Strandh-Tutorial/indentation.html ) and Scheme ( http://mumble.net/~campbell/scheme/style.txt )

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List