RosettaCodeData/Task/Closures-Value-capture/Factor/closures-value-capture-1.factor

15 lines
338 B
Factor
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
USING: io kernel locals math prettyprint sequences ;
[let
! Create a sequence of 10 quotations
10 iota [
:> i ! Bind lexical variable i
[ i i * ] ! Push a quotation to calculate i squared
] map :> seq
{ 3 8 } [
dup pprint " squared is " write
seq nth call .
] each
]