Paste: assoc-join
Author: | ceninan |
Mode: | factor |
Date: | Wed, 23 Jun 2010 21:43:15 |
Plain Text |
:: assoc-join
( ... assoc1 assoc2 quot: ( ... key value1 value2 -- ... newkey newvalue ) -- ... newassoc )
assoc1 quot '[ over assoc2 at _ when* ] assoc-map ; inline
!!!!!!!!!!!!
!!!!!!!!!!!!
H{
{ "x" 7 }
{ "y" 3 }
}
H{
{ "x" 45 }
}
[ + ] assoc-join
=> H{
{ "x" 52 }
{ "y" 3 }
}
!!!!!!!!!!!!!!
H{
{ "foo"
H{
{ "attr1" 70 }
{ "attr2" "aiarht" }
}
}
}
H{
{ "foo"
H{
{ "attr2" "oayrus" }
{ "attr3" "new" }
}
}
}
[ assoc-union ] assoc-join
=> H{
{ "foo"
H{
{ "attr1" 70 }
{ "attr2" "oayrus" }
{ "attr3" "new" }
}
}
}
New Annotation