guile-pstk

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit e8ea3aac2c978ed66d3a673c5e397d028c23695a
parent 570e78da7531dd775252f1cf611888311f699ea7
Author: KikyTokamuro <kiky.tokamuro@yandex.ru>
Date:   Mon,  7 Mar 2022 22:48:37 +0300

Fixed indention in examples

Diffstat:
Mexamples/hello-color.scm | 8++++----
Mexamples/themes.scm | 12++++++------
Mexamples/ttt.scm | 118++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mexamples/weather.scm | 2+-
4 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/examples/hello-color.scm b/examples/hello-color.scm @@ -12,10 +12,10 @@ 'text: "Hello, World!" 'font: "Helvetica 20" 'fg: "#ffff00" 'bg: "#a00000")) (change-color - (lambda () - (let ((c (tk/choose-color))) - (cond ((not (string=? c "")) - (label 'configure 'bg: c)))))) + (lambda () + (let ((c (tk/choose-color))) + (cond ((not (string=? c "")) + (label 'configure 'bg: c)))))) (bt-color (tk 'create-widget 'button 'text: "New Color" 'command: change-color)) diff --git a/examples/themes.scm b/examples/themes.scm @@ -10,12 +10,12 @@ (tk-start) (ttk-map-widgets 'all) (let ((button - (lambda (x) - (let ((b (tk 'create-widget 'button - 'text: (string-append "Select " x " theme") - 'command: (lambda () - (ttk/set-theme x))))) - (tk/pack b 'side: 'top 'fill: 'x))))) + (lambda (x) + (let ((b (tk 'create-widget 'button + 'text: (string-append "Select " x " theme") + 'command: (lambda () + (ttk/set-theme x))))) + (tk/pack b 'side: 'top 'fill: 'x))))) (map button (ttk/available-themes)) (tk/pack (tk 'create-widget 'button 'text: "Exit" 'command: tk-end) diff --git a/examples/ttt.scm b/examples/ttt.scm @@ -20,22 +20,22 @@ (define Moves '(((_ o o) (o o o)) ((o _ o) (o o o)) - ((o o _) (o o o)) - ((_ x x) (o x x)) - ((x _ x) (x o x)) - ((x x _) (x x o)) - ((_ x _) (o x _)) - ((_ _ x) (_ o x)) - ((x _ _) (x o _)) - ((_ x o) (o x o)) - ((_ o x) (o o x)) - ((x _ o) (x o o)) - ((x o _) (x o o)) - ((o _ x) (o o x)) - ((o x _) (o x o)) - ((_ _ o) (o _ o)) - ((o _ _) (o _ o)) - ((_ _ _) (_ o _)))) + ((o o _) (o o o)) + ((_ x x) (o x x)) + ((x _ x) (x o x)) + ((x x _) (x x o)) + ((_ x _) (o x _)) + ((_ _ x) (_ o x)) + ((x _ _) (x o _)) + ((_ x o) (o x o)) + ((_ o x) (o o x)) + ((x _ o) (x o o)) + ((x o _) (x o o)) + ((o _ x) (o o x)) + ((o x _) (o x o)) + ((_ _ o) (o _ o)) + ((o _ _) (o _ o)) + ((_ _ _) (_ o _)))) (define pattern car) (define subst cadr) @@ -44,68 +44,68 @@ (cond ((and (eq? (vector-ref Field f1) (car (pattern rule))) (eq? (vector-ref Field f2) (cadr (pattern rule))) (eq? (vector-ref Field f3) (caddr (pattern rule)))) - (let ((new (subst rule))) - (vector-set! Field f1 (car new)) - (vector-set! Field f2 (cadr new)) - (vector-set! Field f3 (caddr new)) - new)) - (else #f))) + (let ((new (subst rule))) + (vector-set! Field f1 (car new)) + (vector-set! Field f2 (cadr new)) + (vector-set! Field f3 (caddr new)) + new)) + (else #f))) (define (try-moves rules) (cond ((null? rules) '()) - (else (let ((done (or (match-row 0 4 8 (car rules)) - (match-row 2 4 6 (car rules)) - (match-row 0 1 2 (car rules)) - (match-row 3 4 5 (car rules)) - (match-row 6 7 8 (car rules)) - (match-row 0 3 6 (car rules)) - (match-row 1 4 7 (car rules)) - (match-row 2 5 8 (car rules))))) - (cond (done - (cond ((equal? done '(o o o)) - (set! Lost #t) - (Qbutton 'configure 'text: "Oops!" - 'fg: "#ff0000")))) - (else (try-moves (cdr rules)))))))) + (else (let ((done (or (match-row 0 4 8 (car rules)) + (match-row 2 4 6 (car rules)) + (match-row 0 1 2 (car rules)) + (match-row 3 4 5 (car rules)) + (match-row 6 7 8 (car rules)) + (match-row 0 3 6 (car rules)) + (match-row 1 4 7 (car rules)) + (match-row 2 5 8 (car rules))))) + (cond (done + (cond ((equal? done '(o o o)) + (set! Lost #t) + (Qbutton 'configure 'text: "Oops!" + 'fg: "#ff0000")))) + (else (try-moves (cdr rules)))))))) (define (paint-field) (map (lambda (b p) (cond ((eq? p 'o) - (b 'configure 'text: "O" 'fg: 'blue - 'activeforeground: 'blue)) - ((eq? p 'x) - (b 'configure 'text: "X" 'fg: 'red - 'activeforeground: 'red)))) + (b 'configure 'text: "O" 'fg: 'blue + 'activeforeground: 'blue)) + ((eq? p 'x) + (b 'configure 'text: "X" 'fg: 'red + 'activeforeground: 'red)))) Buttons (vector->list Field))) (define (move new) (cond ((and (not Lost) (eq? '_ (vector-ref Field new))) - (vector-set! Field new 'x) - (cond ((eq? '_ (vector-ref Field 4)) - (vector-set! Field 4 'o)) - (else (try-moves Moves))) - (paint-field))) + (vector-set! Field new 'x) + (cond ((eq? '_ (vector-ref Field 4)) + (vector-set! Field 4 'o)) + (else (try-moves Moves))) + (paint-field))) '()) (tk-start) (tk/wm 'title tk "Tic Tac Toe") (let* ((field - (lambda (parent n) - (parent 'create-widget 'button - 'text: n 'font: Font - 'fg: "#a0a0a0" - 'bg: "#e0e0e0" - 'command: (lambda () (move (- n 1)))))) + (lambda (parent n) + (parent 'create-widget 'button + 'text: n 'font: Font + 'fg: "#a0a0a0" + 'bg: "#e0e0e0" + 'command: (lambda () (move (- n 1)))))) (row - (lambda (n) - (let* ((f (tk 'create-widget 'frame)) - (b1 (field f n)) - (b2 (field f (+ 1 n))) - (b3 (field f (+ 2 n)))) - (tk/pack b1 b2 b3 'side: 'left) - (list f b1 b2 b3)))) + (lambda (n) + (let* ((f (tk 'create-widget 'frame)) + (b1 (field f n)) + (b2 (field f (+ 1 n))) + (b3 (field f (+ 2 n)))) + (tk/pack b1 b2 b3 'side: 'left) + (list f b1 b2 b3)))) (r1 (row 1)) (r2 (row 4)) (r3 (row 7))) diff --git a/examples/weather.scm b/examples/weather.scm @@ -48,4 +48,4 @@ (tk/grid result 'columnspan: 3 'row: 2 'sticky: 'we 'padx: 5 'pady: 5) (tk/grid btn-get 'columnspan: 3 'row: 3 'sticky: 'we 'padx: 5 'pady: 5) (tk-event-loop)) - +