Paste: Execute a predicate atmost n times

Author: nomennescio
Mode: factor
Date: Sat, 30 Jul 2022 10:59:01
Plain Text |
! Copyright 2022 nomennescio

:: atmost ( n! quot: ( ... -- ... ? ) -- ) quot [ n 1 - dup n! 0 > and ] compose loop ; inline

Annotation: variant for 0 times

Author: nomennescio
Mode: factor
Date: Sat, 30 Jul 2022 11:15:39
Plain Text |
:: atmost ( n! quot: ( ... -- ... ? ) -- ... )


: atmost* ( n quot: ( ... -- ... ? ) -- ... )
  over 0 > [ atmost ] [ 2drop ] if ; inline

New Annotation

Summary:
Author:
Mode:
Body: