This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updating a single variable in-place: closures get the new value because they fetch it from the lexical scope | |
$ cat closures.pl | |
my @closures; | |
for (my $i = 0; $i < 3; $i++) { | |
push @closures, sub { print "$i\n"; }; | |
} | |
for my $fn (@closures) { | |
$fn->(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Results of solving a "grid of arithmetic operations" problem in MiniZinc, | |
# using Gecode 6.3.0 at -O5. | |
# Program listing at https://mathstodon.xyz/@pozorvlak/114148447412533853 | |
v = | |
[| 2, 34, 4, 9, 30, 15 | |
| 35, 11, 31, 6, 21, 28 | |
| 5, 14, 10, 1, 16, 18 | |
| 13, 20, 29, 23, 19, 7 | |
| 33, 27, 8, 26, 3, 24 |
OlderNewer