On Fri, Nov 25, 2011 at 2:45 PM, Martin Hamant <[email protected]> wrote:
> fold_left() ? What is that ?
> Can I redefine remove_assoc directly in my script ?
My bad, it's list.fold, not fold_left. It's a general way of writing
recursive functions on lists, so we can redefine a (correct)
remove_assoc using it. It is now tested:
# list.remove_assoc = fun(x,l) -> list.fold(fun(l,y)->if fst(y)==x
then l else list.append([y],l) end,[],l) ;;
list.remove_assoc : ('a,[('a*'b)])->[('a*'b)] where 'a is an orderable type =
<fun>
# list.remove_assoc("foo",[("bar",1),("foo",2),("baz",3),("foo",5)]) ;;
- : [(string*int)] = [("baz",3), ("bar",1)]
You should use this workaround for now. In fact, my proposal for the
bug you pointed out would be to remove the builtin remove_assoc and
replace it by this cleaner scripted version.
Cheers,
--
David
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users