diff options
author | Robby Zambito <contact@robbyzambito.me> | 2021-12-31 23:00:37 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2021-12-31 23:00:37 -0500 |
commit | ee970125d23aa61f200449911eca9284e51e53d9 (patch) | |
tree | 6ae579c312c40d96362c0f690353382c4e02452a | |
parent | 08fdac301da812c3eade54faee43fec59b850702 (diff) |
Use named let instead of rec
-rw-r--r-- | game_of_21.scm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/game_of_21.scm b/game_of_21.scm index f4d9e96..69ce762 100644 --- a/game_of_21.scm +++ b/game_of_21.scm @@ -1,5 +1,4 @@ -(use-modules (srfi srfi-1) - (srfi srfi-31)) +(use-modules (srfi srfi-1)) (set! *random-state* (random-state-from-platform)) @@ -151,12 +150,11 @@ (define (both . strategies) (lambda (my-hand opponent-up-card) - ((rec (both strat) - (if (null? strat) - #t - (and ((car strat) my-hand opponent-up-card) - (both (cdr strat))))) - strategies))) + (let loop ((strategies strategies)) + (if (null? strategies) + #t + (and ((car strategies) my-hand opponent-up-card) + (loop (cdr strategies))))))) (display (twenty-one (both hit? (stop-at 21) (stop-at 19)) louis)) |