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

Pages: 1-

symbol? and string?

Name: Anonymous 2012-07-13 17:31

Aside from the issue of uninterned symbols, why are these separate and not the exact same thing?  Alternatively, are these any situations in which you need to differentiate between strings and symbols?

Name: Anonymous 2012-07-13 21:13

In some systems, symbols may not just be glorified interned strings, but carry other information (such as plists, or the top-level binding value).
Also, because symbols are conceptually not strings.

Name: Anonymous 2012-07-13 22:37

>>2
But are there situations in which you do need to differentiate between symbols and strings?

Name: Anonymous 2012-07-13 23:10

>>3
#;1> (define faggot "faggot")
#;2> (string? faggot)
#t
#;3> (symbol? faggot)
#f
#;4> (symbol? 'faggot)
#t

Name: Anonymous 2012-07-13 23:21

>>4
What's your point?  All you did is illustrate that there is a difference between symbols and strings.

Name: Anonymous 2012-07-13 23:57

Boring troll is boring.
(define op "faggot")
(string-append "Op is " op) ; => "Op is op" or "Op is faggot"?

Name: Anonymous 2012-07-14 0:02

>>6
suppose you're in a system where strings don't exist separately and all you have is symbols. then:
(define op 'faggot)
(string-append 'Op\ is\  op) ; => Op is faggot
(string-append 'Op\ is\  'op) ; => Op is op


IHBT.

Name: Anonymous 2012-07-14 0:18

>>7
I will shove cudders down this system creator's throat.
(define faggot #f)
(define op "faggot")
(define (eval-display x) (display (eval x)))
(for-each eval-display (list "Op is " op))
; I expect it to print "Op is faggot"
; But if "faggot" == 'faggot it must print "op is #f"

Name: Anonymous 2012-07-14 0:25

>>8
Argh, you broke it.  At least I get to keep the pieces, right?

Name: Anonymous 2012-07-14 1:37

Lol, you Scheme faggots.

Name: Anonymous 2012-07-14 3:20

>>3


(eq? "hello" "hello")
#f
(eq? 'hello 'hello)
#t

Name: Anonymous 2012-07-14 3:22

>>11
why would any self-respecting implementation not automatically intern strings?

Name: Anonymous 2012-07-14 4:23

>>12


(define a "hello")
#<unspecified>
(define b "hello")
#<unspecified>
a
"hello"
b
"hello"
(string-set! a 4 #\!)
#<unspecified>
a
"hell!"
b
"hello"

Name: Anonymous 2012-07-14 4:43

>>13
R5RS 4.1.2:
*it is an error to alter a constant (i.e. the value of a literal expression) using a mutation procedure like set-car! or string-set!.*

Name: Anonymous 2012-07-14 4:57

>>14


(string-set! "hello" 4 #\!)
#<unspecified>
(set-car! '(what now?) 'huh?)
#<unspecified>

Name: Anonymous 2012-07-14 5:31

>>15
(define shit "Guile")
(display (string-append "Use Scheme interpreter instead of " shit))

Name: Shit thread, ignoring topic 2012-07-14 6:30

>>http://www.arena.net/blog/author/jstumme
watching some obscure anime you’ve (probably) never heard of

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