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

Y dis not work?

Name: Anonymous 2012-10-04 11:17

((car '(+ -)) 10 20)

Name: Anonymous 2012-10-04 11:20

+ as in '(+ -) is a quoted symbol, not a function.

Name: Anonymous 2012-10-04 11:49

>>2
How to unquote him, sage?

Name: Anonymous 2012-10-04 11:50

/polecats kebab/

Name: Anonymous 2012-10-04 12:06

>>6-1000
Don't help him!!

Name: Anonymous 2012-10-04 12:08

You use th-- never mind

Name: Anonymous 2012-10-04 13:32

>>1
#;1> ((car `(,+ ,-)) 10 20)
30

Name: Anonymous 2012-10-04 13:48

Name: Anonymous 2012-10-04 14:54

>>7
Propz

Name: Anonymous 2012-10-04 15:03

would ((car (cons + -)) 10 20) work?

Name: Anonymous 2012-10-04 17:01

Also, something interesting to think about when learning about quotes:

> (eqv? (quote +) +)
#f
(eqv? (quote 4) 4)
#t


For which other values does (lambda (x) (eqv? (quote x) x)) hold (and why does it)?

Name: Anonymous 2012-10-04 17:48

>>11
quote + is probably a data or something type, while + is a primitive procedure

Your language likely parses quote content as a data when comparing it. (however, the case could've been that it was actually comparing (quote +) and +, which would return false as they are different procedures/lists, but then it "properly" returns #t on (quote 4) and 4, so this also brings in that your eqv? procedure examines the insides of quote before using it, but the procedures are stored as data while numbers are also stored as data.

My interpreter (Chicken-4.7.0) returns true on eqv? quote 1 and 1, but returns false on quote (+ 0 1) and 1. This implies it does not consider the contents for parsing when comparing, and I guess doesn't even check if it is a procedure at all, as I too tried (eqv? (quote +) +) and it returns false.

Name: Anonymous 2012-10-04 17:51

>>11
Numbers, booleans, characters, and strings are self-quoting.

Name: Anonymous 2012-10-04 18:18

>>11
For which other values does (lambda (x) (eqv? (quote x) x)) hold (and why does it)?
Only for 'x, because you're comparing the argument against the quoted symbol x, dipshit.

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