intersection. Intersecting hashes
^hash_a.intersection[hash_b]
The method intersects two hashes. It results in a hash containing keys that belong to both
$hash_a
and
$hash_b
. The result has to be assigned to a new hash.
Example
Code…
$man[
$.name[
Jack
]
$.age[
22
]
$.sex[
m
]
]
$woman[
$.name[
Mary
]
$.age[
20
]
$.weight[
50
]
]
$int_hash[^man.intersection[$woman]]
…will return hash
$int_hash
:
$int_hash[
$.name[Jack]
$.age[22]
]
Copyright © 19972025 Art. Lebedev Studio |
http://www.artlebedev.com
Last updated: 30.03.2004