I always prefer being explicit about what you are doing, rather than using partial
. For example, I would have written:
(filter #(my-filt x %) y)
or sometimes the full function specification:
(fn [z] (my-filt x z))
So it is clear we are calling my-filt
with a fixed parameter x
. The fn
syntax also gives you the option to provide a descriptive name for each argument, which is often quite helpful documentation for the reader.
Of course, partial
cannot be used if you have any free arg preceeding a fixed arg.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…