I must admit I don't understand very well what snippet is supposed to do. But, for example, it doesn't work for :sum or :maximum or anything like that.
On Monday, October 26, 2015 at 9:23:35 AM UTC+1, harven wrote: > > > > Le lundi 26 octobre 2015 07:15:56 UTC+1, DNF a écrit : >> >> Hmm. Trying to answer myself: I guess my suggested solution would miss >> functions that don't specify the type, but just rely on the iterable >> behaviour. >> >> > It is easy to get the list of thunks that work on iterables. > > type Iterable x::Float64 end > Base.start(x::Iterable) = 0 > Base.next(x::Iterable) = 0 > Base.done(x::Iterable) = true > show(filter(s -> try > eval(s)(Iterable(0)) ; true > catch > false > end, > names(Base))) > > I am not sure how to provide default arguments for functions of several > variables though. > > Here is the list, excluding macros. > > > :apropos,:broadcast!_function,:broadcast_function,:conj,:ctranspose,:cycle,:deepcopy, > > :display,:done,:dump,:eltype,:enumerate,:esc,:expand,:fetch,:fieldnames,:fill,:finalize, > > :hash,:hcat,:htol,:identity,:info,:isbits,:isgeneric,:isimmutable,:isleaftype,:ltoh,:macroexpand, > > :methods,:names,:next,:object_id,:permutations,:pointer_from_objref,:print,:println,:promote, > > :promote_type,:push!,:redisplay,:repeated,:repr,:rmprocs,:show,:showall,:showcompact, > > :sizeof,:start,:string,:summary,:symbol,:symdiff,:transpose,:typejoin,:vcat,:warn,:xdump,:zip >
