> (eq? 1 1)
#t
> (eq? 1.1 1.1)
#f
> (= 1.1 1.1)
#t
This is the interaction window in DrScheme. Could somebody please explain the difference between = and eq? in Scheme?
eq? is pointer comparison. It returns #t iff its arguments literally refer to the same objects in memory. Symbols are unique ('fred always evaluates to the same object). Two symbols that look the same are eq. Two variables that refer to the same object are eq.
Boolean operations: and, or, not Since Scheme doesn't have a numeric "not equals" operator (like the != operator in C/Java/Python), we have to combine not and = in order to evaluate "not equals".
Scheme Operator means each person within an Outlet authorized by the Agent to operate SCHEME Services using the Equipment.
Equality predicates tell whether one value is "the same as" another. There are actually several important senses of "the same as," so Scheme provides four equality predicates. Sometimes you want to know whether two data structures are structurally the same, with the same values in the same places.
= compares numbers. eq? tests if the parameters represent the same data object in memory. eqv? should work in the second case as it tests same as eq? but tests primitives specially. More on equlivence predicates in scheme here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With