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-29 19:14 ID:vhLurBX2

reference = http://www.cliki.net/CLHS

use emacs & SLIME

Name: Anonymous 2007-07-29 19:15 ID:vhLurBX2

Also, how can i do something similar to Cs ``...''? Something like (defun f (a ...) (rest of code))
read a book about lisp it will cover this

How can i reach a certain member of an array?
reach-member is a bad name, you can use 1- instead of (- x 1), just use elt or nth instead of writing it yourself, its a function not a macro, that only works on lists (like nth) not arrays which elt does work on

Name: Anonymous 2007-07-29 19:27 ID:Heaven

>>2,3
same person

Name: Anonymous 2007-07-29 20:56 ID:Heaven

>>4
memer kid.
Or one of the 30 year old virgins with nothing better to do than search IDs in a bulletin board.

Who CARES if it was the same person?



Name: Anonymous 2007-07-29 21:15 ID:Heaven

>>5
I salute you for your effort. Now STFU.

Name: Anonymous 2007-07-29 21:28 ID:Heaven

>>5
``who CARES if it was the same person?''
``who cares if C is faster than Java?''
``who cares if ++i is faster than i++ in stupid compilers?''
``who cares if xor eax, eax takes less cpu cycles than mov eax, 0?''

YEAH FUCKTARD
WHO CARES?

Name: Anonymous 2007-07-29 22:14 ID:8jaiMKpG

Also, how can i do something similar to Cs ``...''?
Something like
(defun f (a ...) (rest of code))
I think you're looking for
(defun f (a b c &rest l) (code))
which bounds the rest of the arguments to a list.

ex. if you call it (f 1 2 3 4 5 6 7), the bounds will be:

a = 1
b = 2
c = 3
l = (4 5 6 7)

the peter seibel book practical common lisp will tell you all this and more.

Name: Anonymous 2007-07-29 22:17 ID:j9nrsgAB

>>7
I do.

Name: Anonymous 2007-07-30 0:22 ID:Heaven

>>7
1. I don't
2. I do
3. I don't
4. I don't

So, what WAS your point?

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.

Name: Anonymous 2007-07-30 4:51 ID:Heaven

>>11
[/cpde]
Ha ha, your BBCode doesn't compile, noob!

Name: Anonymous 2007-07-30 5:52 ID:Heaven

>>12
Well done, "noob".

Name: Anonymous 2007-07-30 8:17 ID:Heaven

OP here thanks for all the help!

Name: Anonymous 2007-07-31 10:29 ID:Heaven


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