This file contains hidden or 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
(use-modules (srfi srfi-1) (ice-9 textual-ports) (ice-9 peg) | |
(ice-9 pretty-print) (srfi srfi-26) (ice-9 receive)) | |
(define-peg-string-patterns | |
"entry <-- number COLON (SPACE number)+ NL | |
number <-- [0-9]+ | |
COLON < ':' | |
SPACE < ' ' | |
NL < '\n' |
This file contains hidden or 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
(use-modules (srfi srfi-1) (ice-9 textual-ports) (ice-9 peg) | |
(ice-9 pretty-print) (srfi srfi-26) (ice-9 receive)) | |
(define-peg-string-patterns | |
"entry <-- number COLON (SPACE number)+ NL | |
number <-- [0-9]+ | |
COLON < ':' | |
SPACE < ' ' | |
NL < '\n' |
This file contains hidden or 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
(use-modules (srfi srfi-1) (ice-9 textual-ports) (ice-9 peg) | |
(ice-9 pretty-print) (srfi srfi-26) (ice-9 receive)) | |
(define-peg-string-patterns | |
"order <-- number PIPE number NL | |
update <-- (number COMMA?)* NL | |
number <-- [0-9]+ | |
PIPE < '|' | |
COMMA < ',' |
This file contains hidden or 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
(use-modules (srfi srfi-1) (srfi srfi-26) | |
(ice-9 pretty-print) (ice-9 textual-ports)) | |
(define (%read-input) | |
(let ([line (get-line (current-input-port))]) | |
(if (eof-object? line) | |
'() | |
(cons (string->list line) (%read-input))))) |
This file contains hidden or 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
(use-modules (srfi srfi-1) (ice-9 textual-ports) (ice-9 peg) | |
(ice-9 match) (ice-9 pretty-print) (srfi srfi-26)) | |
(define-peg-string-patterns | |
"insn <- (mul / dont / do) | |
mul <-- MUL number COMMA number RPAREN | |
dont <-- 'don' ['] 't()' | |
do <-- 'do()' | |
number <-- [0-9]+ | |
junk < (!insn .)* |
This file contains hidden or 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
(use-modules (ice-9 textual-ports) (srfi srfi-1) (srfi srfi-26) | |
(ice-9 format) (ice-9 match) (ice-9 pretty-print) | |
(srfi srfi-8) (ice-9 arrays)) | |
(define (%map-input-char c) | |
(match c | |
[#\. 0] | |
[#\O 1] | |
[#\# -1])) |
This file contains hidden or 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
(use-modules (srfi srfi-1) (ice-9 textual-ports) | |
(ice-9 format) (srfi srfi-26) (ice-9 match) | |
(srfi srfi-43)) | |
(define (read-input) | |
(string-split (get-line (current-input-port)) #\,)) | |
(define (hash str) | |
(string-fold | |
(λ (chr prev) |
This file contains hidden or 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
(use-modules (ice-9 textual-ports) (srfi srfi-1) (srfi srfi-26) (ice-9 match) | |
(ice-9 format) (ice-9 pretty-print) (srfi srfi-8)) | |
(define (read-lines) | |
(let ([line (get-line (current-input-port))]) | |
(if (eof-object? line) | |
'() | |
(cons line (read-lines))))) | |
(define (%read-input lines) |
This file contains hidden or 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
(use-modules (ice-9 textual-ports) (srfi srfi-1) (srfi srfi-26) | |
(ice-9 format) (ice-9 match) (ice-9 pretty-print)) | |
(define (%read-input) | |
(let ([line (get-line (current-input-port))]) | |
(if (eof-object? line) | |
'() | |
(cons (list->vector (string->list line)) | |
(%read-input))))) |
This file contains hidden or 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
(use-modules (ice-9 textual-ports) (srfi srfi-1) (srfi srfi-26) (ice-9 match) | |
(ice-9 format) (ice-9 pretty-print) (srfi srfi-8)) | |
(define (read-input) | |
(let ([line (get-line (current-input-port))]) | |
(if (eof-object? line) | |
'() | |
(cons (string->list line) | |
(read-input))))) |