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

(second), (third), etc. in common lisp

Name: shitting lollybox 2012-10-15 5:45

so if I want to express the third element of some list I can write
(third '(a b c))
This works all the way up to (tenth).

WTF? Why would they include built in functions like this? Seems insane coming from C and Java

Name: Anonymous 2012-10-15 5:47

It's academic quality.

Name: Anonymous 2012-10-15 5:48

Newlisp:
('(a b c) 2)

Name: Anonymous 2012-10-15 5:54

>>1
So that retards who can't write reader macros to handle list[index] (such as yourself) can use them.

Name: Anonymous 2012-10-15 5:56

>>3
Hey, that's actually pretty smart.  Are there any obvious flaws I'm not seeing?

Name: Anonymous 2012-10-15 5:56

>>4
It would be more appropriate to use a vector for that, captain kike.

Name: Anonymous 2012-10-15 6:00

>>6
Eat shit and die, captain illogic.

Name: Anonymous 2012-10-15 6:03

>>7
u first XP

Name: Anonymous 2012-10-15 6:06

>>6
Different untyped containers called list and vectorThat was dumb goy quality!

Name: Anonymous 2012-10-15 6:11

>>9
I didn't invent lisp, Shekelberg.

Name: Anonymous 2012-10-15 6:17

Name: Anonymous 2012-10-15 12:46

car
cadr
caddr
cadddr...

Name: Anonymous 2012-10-15 15:50

>>5
quoted lists are not functions?

Name: Anonymous 2012-10-15 15:51

>>13
they are in newlisp?

Name: Anonymous 2012-10-15 15:52

Lists are shit and cache-unfriendly.

Name: Anonymous 2012-10-15 17:31

>>15
Not necessarily.

Name: Anonymous 2012-10-15 17:35

>>13,14
It's newlisp's extension of lisp semantics. Quoted lists are quoted lists so it doesn't break anything AFAIK. Newlisp also evaluates the functor first, just like scheme.

Name: Anonymous 2012-10-15 17:57

>>17
Newlisp also evaluates the functor first, just like scheme.
Doesn't it make more sense to evaluate the arguments first, and then the functor?  Think about it, if it's implemented as a stack machine, evaluating (+ (+ (+ 1 2) 3) 4) requires a stack depth of 5, as opposed to 3 if you evaluate the functor last.

Name: Anonymous 2012-10-15 19:19

>>18
(+ 1 2 3 4) genius.

Name: Anonymous 2012-10-15 22:41

>>18
this is why order of evaluation of function arguments is better left undefined. The optimal implementation varies depending on the target machine.

Name: Anonymous 2012-10-15 22:44

>>1

You think that's bad? Just look at this!

http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node244.html

Name: Anonymous 2012-10-15 23:00

>>18
I was talking about:

((if foo + -) 42 13)
Will either be 55 or 29 depending on the value of foo. As for the order of evaluation, I'm pretty sure functors first then arguments.

Name: Anonymous 2012-10-15 23:04

>>22

ey was just saying that it would be more convenient to evaluate the functor last if the target is a stack machine.


42 13 foo {+} {-} ifelse exec

Name: Anonymous 2012-10-15 23:46

>>18,23
If the target is any modern machine, the best way to do it is obviously to evaluate them both at the same time.
Especially for stack machines, where crazy shit like 144-core CPUs1 is common.

[sub]________
1. http://www.greenarraychips.com/home/documents/greg/PB001-100503-GA144-1-10.pdf

Name: SARCASM 2012-10-15 23:54

>>24
the best way to do it is obviously to evaluate them both at the same time.
Obviously.

Name: Anonymous 2012-10-16 0:56

>>24
did they sort out the static electricity sensitivity issue?

Name: Anonymous 2012-10-16 1:10

>>24
GA144, bridging the gap between FPGA and CPU?

Name: Anonymous 2012-10-16 1:27

>>26
Fuck if I know, I can't even afford a Raspberry Pi.

Name: Anonymous 2012-10-16 1:41

>>28
I wouldn't want one considering the questionable humongous binary blob that has to run on the GPU prior to boot-up.

Name: Anonymous 2012-10-16 1:42

hah, poor!
but same

Name: Anonymous 2012-10-16 6:48

>>29
I wouldn't be using the GPU anyway.

Name: Anonymous 2012-10-16 9:04

>>31
But what if the blob actually contains spyware?

Name: Anonymous 2012-10-16 12:41

>>32
If it doesn't run, it doesn't matter what it contains.

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