Last active
August 29, 2015 14:00
-
-
Save kiyoka/11291245 to your computer and use it in GitHub Desktop.
Ruby and Gauche(Scheme)'s equal operators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 2.0.0p353 | |
$ irb | |
irb(main):001:0> a = "abc" | |
=> "abc" | |
irb(main):002:0> b = "abc" | |
=> "abc" | |
irb(main):003:0> a == b | |
=> true | |
irb(main):004:0> a === b | |
=> true | |
irb(main):005:0> a.equal? b | |
=> false | |
irb(main):006:0> a = :abc | |
=> :abc | |
irb(main):007:0> b = :abc | |
=> :abc | |
irb(main):008:0> a == b | |
=> true | |
irb(main):009:0> a === b | |
=> true | |
irb(main):010:0> a.equal? b | |
=> true | |
irb(main):011:0> quit | |
Gauche scheme shell, version 0.9.3.3 | |
$ gosh | |
gosh> (define a "abc") | |
a | |
gosh> (define b "abc") | |
b | |
gosh> (eq? a b) | |
#f | |
gosh> (eqv? a b) | |
#f | |
gosh> (equal? a b) | |
#t | |
gosh> (define a :abc) | |
a | |
gosh> (define b :abc) | |
b | |
gosh> (eq? a b) | |
#t | |
gosh> (eqv? a b) | |
#t | |
gosh> (equal? a b) | |
#t | |
gosh> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment