osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOOP with fixed final index value


Op 2017-09-27, Robert L. schreef <No_spamming at noWhere_7073.org>:
>> > (defun myloop (initial final increment)
>> >   (loop for i = initial then (+ i increment)
>> >         while (< i final)
>> >         do (print i)
>> >         finally (let ((i final)) (print i))))
>> >

> In Python?

myloop = lambda *args: print("{}{}".format("".join(map("{}\n".format,
  range(*args))), args[1]))

Of course.