我正在尝试编写一个谓词来根据公共索引在列表中添加元素。我到目前为止所做的当然不值得展示...... =(
预期的行为将类似于:
List = [ ]
add_to_list( List, Index1, Param1, Value1 )
List = [
[ Index1, [ Param1, Value1 ] ]
]
add_to_list( List, Index1, Param2, Value2 )
List = [
[ Index1, [ Param1, Value1 ], [ Param2, Value2 ] ]
]
add_to_list( List, Index2, Param3, Value3 )
List = [
[ Index1, [ Param1, Value1 ], [ Param2, Value2 ] ],
[ Index2, [ Param3, Value3 ] ]
]