Skip to content

Commit eb87b7c

Browse files
committed
finis coronat opus
1 parent 46c2a2f commit eb87b7c

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ set (SRC_CORE
2727
src/parser.c
2828
src/pict.c
2929
src/primproc.c
30+
src/register.c
3031
src/storage.c
3132
src/strbldr.c
3233
)

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
# sicp-scheme
2-
Perhaps, eventually, a SICP Scheme interpreter.
1+
# SICP Exercise 5.51
2+
3+
A solution for [SICP Exercise 5.51][ex5.51] - an interpreter that
4+
supports the scheme syntax and code from the [book][book].
5+
6+
[ex5.51]: https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-35.html#%_thm_5.51
7+
[book]: https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html

src/eceval.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ static obj parallel_execute(obj procs, obj env)
518518
return parallel_eval(actions, env);
519519
}
520520

521-
static int rand_clicks(int n)
521+
static int rndslices(int n)
522522
{
523523
Integer r = plat_rand();
524524
return ((r % 16) > 11) ? (r % n) + 1 : 0;
@@ -548,23 +548,20 @@ static obj parallel_eval(obj actions, obj env)
548548
}
549549

550550
runcount = free;
551-
552551
while (runcount) {
553552
for (i = 1; i <= free; i++) {
554553
if (!running[i]) {
555554
continue;
556555
}
557-
int clicks = rand_clicks(2);
558-
for (j = 0; j < clicks; j++) {
559-
obj r = ecevalgoto(getcore(i), true);
560-
if (!is_yielded(r)) {
556+
int nslices = rndslices(2);
557+
for (j = 0; j < nslices; j++) {
558+
if (!is_yielded(ecevalgoto(getcore(i), true))) {
561559
running[i] = false;
562560
runcount--;
563561
break;
564562
}
565563
}
566564
}
567565
}
568-
569566
return finished;
570567
}

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define SICP_VERSION "5.5.7.0"
1+
#define SICP_VERSION "5.5.7.1"

www/build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
../sicp-scheme/src/pict.c \
2222
../sicp-scheme/src/primproc.c \
2323
../sicp-scheme/src/sicp.c \
24+
../sicp-scheme/src/register.c \
2425
../sicp-scheme/src/storage.c \
2526
../sicp-scheme/src/strbldr.c \
2627
\

0 commit comments

Comments
 (0)