|
From: Reuben T. <rr...@sc...> - 2004-02-02 10:29:52
|
> Naming: yeah, dunno. Arity: I decided it made sense only for commutative
> operators to be variadic.
Whereas in e.g. APL they all are, and you get alternating differences with
-. I'm not sure what's worse: providing variadic / (what is that for?) or
not providing it (why doesn't my code work suddenly when I replace + with
/?).
> > The following I plain don't understand:
> >
> > function std.getter(name) -- what's this for?
> > function std.method(name, ...) -- what's this for?
> > function std.bind_method(t, m) -- what's this for?
>
> Say I have a list of objects and I want to get a list of those which have
> attribute foo = true:
>
> footrue = std.filter(std.getter("foo"), objects)
Seems a bit contrived. If you wanted those that had attribute foo < 4,
you'd still need to make a function.
> Say I want to call method swizzle(5) on each of a list of (maybe polymorphic)
> objects:
>
> results = std.map(std.method("swizzle", 5), objects)
And again, that only works with constant values. If you wanted to call
swizzle(self.foo+self.bar), again, you'd need a function.
> > I'm dubious about the following:
> >
> > function std.map_tbl(f, t) -- it is really wise to map over a table?
> > function std.filter_tbl(f, t) -- these should only be used on
> > lists/arrays IMO
>
> Why not? Changing the keys is maybe not such a great idea, but there doesn't
> seem to be any reason not to map/filter over the values. Obviously the order
> is undefined, but that's just expected from any operation on tables. I don't
> really see why one shouldn't map (most likely injections) over sets either.
> Fair enough. I just didn't think of that; I've never come across reverseMap
> before. I don't see it in your library though.
No, I haven't needed it yet!
--
http://www.mupsych.org/~rrt/ | Academics age by degrees
|