2525from .dynassign import dyn , make_dynvar
2626from .regutil import register_decorator
2727
28- # we use @mark_lazy (and handle possible lazy args) to support unpythonic.syntax.lazify.
29- from .lazyutil import mark_lazy , islazy , force , force1 , maybe_force_args
28+ # we use @passthrough_lazy_args (and handle possible lazy args) to support unpythonic.syntax.lazify.
29+ from .lazyutil import passthrough_lazy_args , islazy , force , force1 , maybe_force_args
3030
3131@register_decorator (priority = 10 )
3232def memoize (f ):
@@ -57,7 +57,7 @@ def memoized(*args, **kwargs):
5757 raise value
5858 return value
5959 if islazy (f ):
60- memoized = mark_lazy (memoized )
60+ memoized = passthrough_lazy_args (memoized )
6161 return memoized
6262
6363#def memoize_simple(f): # essential idea, without exception handling
@@ -71,7 +71,7 @@ def memoized(*args, **kwargs):
7171# return memoized
7272
7373make_dynvar (curry_context = [])
74- @mark_lazy
74+ @passthrough_lazy_args
7575def _currycall (f , * args , ** kwargs ):
7676 """Co-operate with unpythonic.syntax.curry.
7777
@@ -86,7 +86,7 @@ def _currycall(f, *args, **kwargs):
8686 return curry (f , * args , _curry_force_call = True , _curry_allow_uninspectable = True , ** kwargs )
8787
8888@register_decorator (priority = 90 )
89- @mark_lazy
89+ @passthrough_lazy_args
9090def curry (f , * args , _curry_force_call = False , _curry_allow_uninspectable = False , ** kwargs ):
9191 """Decorator: curry the function f.
9292
@@ -200,7 +200,7 @@ def curried(*args, **kwargs):
200200 if len (args ) < min_arity :
201201 p = partial (f , * args , ** kwargs )
202202 if islazy (f ):
203- p = mark_lazy (p )
203+ p = passthrough_lazy_args (p )
204204 return curry (p )
205205 # passthrough on right, like https://github.com/Technologicat/spicy
206206 if len (args ) > max_arity :
@@ -223,7 +223,7 @@ def curried(*args, **kwargs):
223223 return (now_result ,) + later_args
224224 return maybe_force_args (f , * args , ** kwargs )
225225 if islazy (f ):
226- curried = mark_lazy (curried )
226+ curried = passthrough_lazy_args (curried )
227227 curried ._is_curried_function = True # stash for detection
228228 # curry itself is curried: if we get args, they're the first step
229229 if args or kwargs or _curry_force_call :
@@ -249,7 +249,7 @@ def flip(f):
249249 def flipped (* args , ** kwargs ):
250250 return maybe_force_args (f , * reversed (args ), ** kwargs )
251251 if islazy (f ):
252- flipped = mark_lazy (flipped )
252+ flipped = passthrough_lazy_args (flipped )
253253 return flipped
254254
255255def rotate (k ):
@@ -279,11 +279,11 @@ def rotated(*args, **kwargs):
279279 rargs = args [- j :] + args [:- j ]
280280 return maybe_force_args (f , * rargs , ** kwargs )
281281 if islazy (f ):
282- rotated = mark_lazy (rotated )
282+ rotated = passthrough_lazy_args (rotated )
283283 return rotated
284284 return rotate_k
285285
286- @mark_lazy
286+ @passthrough_lazy_args
287287def apply (f , arg0 , * more , ** kwargs ):
288288 """Scheme/Racket-like apply.
289289
@@ -366,7 +366,7 @@ def notf(f): # Racket: negate
366366 def negated (* args , ** kwargs ):
367367 return not maybe_force_args (f , * args , ** kwargs )
368368 if islazy (f ):
369- negated = mark_lazy (negated )
369+ negated = passthrough_lazy_args (negated )
370370 return negated
371371
372372def andf (* fs ): # Racket: conjoin
@@ -392,7 +392,7 @@ def conjoined(*args, **kwargs):
392392 return False
393393 return b
394394 if all (islazy (f ) for f in fs ):
395- conjoined = mark_lazy (conjoined )
395+ conjoined = passthrough_lazy_args (conjoined )
396396 return conjoined
397397
398398def orf (* fs ): # Racket: disjoin
@@ -420,7 +420,7 @@ def disjoined(*args, **kwargs):
420420 return b
421421 return False
422422 if all (islazy (f ) for f in fs ):
423- disjoined = mark_lazy (disjoined )
423+ disjoined = passthrough_lazy_args (disjoined )
424424 return disjoined
425425
426426def _make_compose1 (direction ): # "left", "right"
@@ -443,7 +443,7 @@ def compose1(fs):
443443 # - if fs contains only one item, we output it as-is
444444 composed = reducel (compose1_two , fs ) # op(elt, acc)
445445 if all (islazy (f ) for f in fs ):
446- composed = mark_lazy (composed )
446+ composed = passthrough_lazy_args (composed )
447447 return composed
448448 return compose1
449449
@@ -505,7 +505,7 @@ def composed(*args):
505505 def compose (fs ):
506506 composed = reducel (compose_two , fs ) # op(elt, acc)
507507 if all (islazy (f ) for f in fs ):
508- composed = mark_lazy (composed )
508+ composed = passthrough_lazy_args (composed )
509509 return composed
510510 return compose
511511
@@ -591,7 +591,7 @@ def apply_f_to_kth_arg(*args):
591591 out .extend (args [m :])
592592 return tuple (out )
593593 if islazy (f ):
594- apply_f_to_kth_arg = mark_lazy (apply_f_to_kth_arg )
594+ apply_f_to_kth_arg = passthrough_lazy_args (apply_f_to_kth_arg )
595595 return apply_f_to_kth_arg
596596
597597def to1st (f ):
@@ -663,5 +663,5 @@ def fwithself(*args, **kwargs):
663663 #return f(fwithself, *args, **kwargs)
664664 return maybe_force_args (f , fwithself , * args , ** kwargs ) # support unpythonic.syntax.lazify
665665 if islazy (f ):
666- fwithself = mark_lazy (fwithself )
666+ fwithself = passthrough_lazy_args (fwithself )
667667 return fwithself
0 commit comments