equal?
val-a val-bSummary
Test whether two values are equal
Description
Unlike = this is actually comparing the contents of compound data, which can be very slow.
Arguments
val-a
The first argument
val-b
The second argument
Return value
Whether the two arguments are equal?
Examples
(equal? (array/new '(1 2 3) '(4.0 5.0 (tree/new :a 1 :b 2)) '("7" (array/new 8 88) :9)) (array/new '(1 2 3) '(4.0 5.0 (tree/new :a 1 :b 2)) '("7" (array/new 8 88) :9))) #t (equal? '(1 :b "c" (array/new 4.0)) '(1 :b "c" (array/new 4.0))) #t (equal? '(1 :b "c" (array/new 4.0)) '(1 :b "c")) #f (equal? '(1 :b "c") '(1 :b "c")) #t (equal? :a :b) #f (equal? :a :a) #t (equal? 2.0 2.1) #f (equal? 2.0 2.0) #t (equal? 1 1) #t
Bytecode
Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.
( 0 ($get/val 'type-of)) ( 2 ($get/val 'val-a)) ( 4 ($apply 1)) ( 6 ($det/val 'cur-type)) ( 8 ($drop)) ( 9 ($get/val 'not=)) ( 11 ($get/val 'cur-type)) ( 13 ($get/val 'type-of)) ( 15 ($get/val 'val-b)) ( 17 ($apply 1)) ( 19 ($apply 2)) ( 21 ($jf* 7)) ( 24 ($push/false)) ( 25 ($jmp* 72)) ( 28 ($let)) ( 29 ($get/val 'cur-type)) ( 31 ($det/val 'ΓεnΣym-1)) ( 33 ($drop)) ( 34 ($get/val 'ΓεnΣym-1)) ( 36 ($push/val :array)) ( 38 ($=)) ( 39 ($jf* 14)) ( 42 ($get/val 'array/equal?)) ( 44 ($get/val 'val-a)) ( 46 ($get/val 'val-b)) ( 48 ($apply 2)) ( 50 ($jmp* 46)) ( 53 ($get/val 'ΓεnΣym-1)) ( 55 ($push/val :tree)) ( 57 ($=)) ( 58 ($jf* 14)) ( 61 ($get/val 'tree/equal?)) ( 63 ($get/val 'val-a)) ( 65 ($get/val 'val-b)) ( 67 ($apply 2)) ( 69 ($jmp* 27)) ( 72 ($get/val 'ΓεnΣym-1)) ( 74 ($push/val :pair)) ( 76 ($=)) ( 77 ($jf* 14)) ( 80 ($get/val 'list/equal?)) ( 82 ($get/val 'val-a)) ( 84 ($get/val 'val-b)) ( 86 ($apply 2)) ( 88 ($jmp* 8)) ( 91 ($get/val 'val-a)) ( 93 ($get/val 'val-b)) ( 95 ($=)) ( 96 ($closure/pop)) ( 97 ($ret))