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

Started with lisp!

Name: Anonymous 2007-07-29 19:11 ID:ya+3Ex+e

You faggots made me start learning lisp..
first of all THANKS a lot. seriously this language excites me more than anything!
btw, im learning CL.

Now what i've figured out about lisp is that f(x y z) is (f x y z) and that it's all expressions and macros.
I got used to progn quickly, and to defun etc

But i don't know the ``standard'' functions/macros/whatever, is there some reference i could use?

Also, how can i do something similar to Cs ``...''?

Something like
(defun f (a ...) (rest of code))

How can i reach a certain member of an array?
I've wrote this macro, but is it a good solution?
(defun reach-member (list nmemb) (if (< nmemb 0) () (if (= nmemb 0) (car list) (reach-member (cdr list) (- nmemb 1)))))

Also, where can i learn how to indent lisp code?
What are the rules?

Name: Anonymous 2007-07-30 0:57 ID:BLvRkzxO

You faggots made me start learning lisp..
Be honest, you just wanted a better language.

first of all THANKS a lot. seriously this language excites me more than anything!
Win.

btw, im learning CL.
You will be disappointed in CL implementations and libraries.

>Now what i've figured out about lisp is that f(x y z) is (f x y z) and that it's all expressions and macros.
Yes, (operator p1 p2 ... pn)[/cpde].

But i don't know the ``standard'' functions/macros/whatever, is there some reference i could use?
Common Lisp HyperSpec. Basically, with the power of Google you can search the spec by searching: [code]clhs <term>
. E.g.:

http://www.google.com/search?hl=en&q=clhs+loop&btnG=Search

Also, how can i do something similar to Cs ``...''?
(defun foo (first-arg &rest rest-of-args) ...)

See here for lots of info about function parameters: http://gigamonkeys.com/book/functions.html

How can i reach a certain member of an array?
(aref array-name 0)
More info: http://www.lisp.org/HyperSpec/Body/acc_aref.html

I've wrote this macro, but is it a good solution?
No, you are confusing arrays with lists.

Also, where can i learn how to indent lisp code?
What are the rules?
The rules are simple. Using Emacs or any decent editor with built-in formatting will do it for you based on your parentheses.

Here is an example video about using SLIME: http://common-lisp.net/movies/slime.mov

(func a b c)
When moving a parameter to a newline, that parameter is aligned with the others. Like so:


(func a
      b c)


or

(func a
      b
      c)

or

(foo a
    (bar a b c)
    (mu a b c))


It's called pretty printing.

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