in reply to Re^4: More functional programming utilities
in thread More functional programming utilities

first, a suggestion - why don't you put around your end result map, so we can easily chain multimaps.

In part because I didn't think of doing that. But now you've made me think about it, I think that I would leave it as it is. Adding it internally would make the user that wants the the list rather than a LoL have to wrap the call in @{ multimap [ ... ] } to get at it.

As is, to get the LoL, you do [ multimap [ ...] ].

In the former I would be creating a list only for the user to discard it. In the latter, he creates it if he needs it. Which I think is a good reason to leave it as is?

'multimap' may not be the best name for that function..

I just went with the OPs name, but I agree that it may not best capture the semantics. I'd favour something shorter. 'map' is well understood in Perl circles so I think that should be in there somewhere.

What is Data::Dumper::SLC?

It's my Just_a_Dumper dumper. No attempt at making the output evallable. No attempt to fold self-referrencial structures (though it does economically detect and flag them). It streams on-the-fly (avoiding accumlating anything in memory) to STDOUT (or an option filehandle) and wraps at 80 or a specifyable limit. It writes as compact a representation as is comensurate with being readable.

When I asked here if anyone knew of such an animal, the basic respose was that nobody except myself ever needed such a thing, so I never got around to documenting or packaging it.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Replies are listed 'Best First'.
Re^6: More functional programming utilities
by kaif (Friar) on Jun 09, 2005 at 03:46 UTC

    'multimap' may not be the best name for that function..

    I just went with the OPs name, but I agree that it may not best capture the semantics. I'd favour something shorter. 'map' is well understood in Perl circles so I think that should be in there somewhere.

    Yeah, I was at a loss as to what to name this thing. In Scheme and other Lisp dialects, it's just called map. I am aware that multimap clashes with part of the C++ STL, but then again, so does map. Maybe mapmulti is a good name.