remove scheme ambitions

This commit is contained in:
David 2023-12-03 06:34:49 -05:00
parent d83b8aacec
commit 2cf787a203
5 changed files with 54 additions and 30 deletions

50
03/main.go Normal file
View File

@ -0,0 +1,50 @@
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"time"
)
func mustAtoi(line string) int {
i, _ := strconv.Atoi(line)
return i
}
func main() {
start := time.Now()
partOne()
duration := time.Since(start)
partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
}
func makeScanner(test bool) *bufio.Scanner {
var f *os.File
if test {
f, _ = os.Open("inputs/testinput")
} else {
f, _ = os.Open("inputs/input")
}
reader := bufio.NewReader(f)
return bufio.NewScanner(reader)
}
func partOne() {
scanner := makeScanner(false)
for scanner.Scan() {
// line := scanner.Text()
}
}
func partTwo() {
scanner := makeScanner(false)
for scanner.Scan() {
// line := scanner.Text()
}
}

View File

@ -1,20 +0,0 @@
(import
(chicken io)
(chicken format)
)
(define print-line
(lambda (line)
(printf "~A~%" line)))
(call-with-input-file "inputs/input"
(lambda (port)
(map
print-line
(read-lines port))))
(call-with-input-file "inputs/input"
(lambda (port)
(map
print-line
(read-lines port))))

3
new.sh
View File

@ -14,8 +14,5 @@ if [ "${1}" != "" ]; then
if [ ! -f "${padded}/main.go" ]; then if [ ! -f "${padded}/main.go" ]; then
cp -n main.go.tmpl ${padded}/main.go cp -n main.go.tmpl ${padded}/main.go
fi fi
# if [ ! -f "${padded}/main.scm" ]; then
# cp -n main.scm.tmpl ${padded}/main.scm
# fi
echo "https://adventofcode.com/${__year}/day/${1}" echo "https://adventofcode.com/${__year}/day/${1}"
fi fi

View File

@ -1,5 +1,7 @@
# AOC 2023 # AOC 2023
In Chicken Scheme? Perhaps. Go as a fallback. ~~In Chicken Scheme? Perhaps.~~Like I actually have time to learn Scheme's idioms with a six-month-old in the house.
Go as a fallback.
<https://adventofcode.com/2023/> <https://adventofcode.com/2023/>

7
run.sh
View File

@ -3,11 +3,6 @@
if [ "${1}" != "" ]; then if [ "${1}" != "" ]; then
padded=$(printf "%02g" ${1}) padded=$(printf "%02g" ${1})
cd ${padded} cd ${padded}
if [ "${2}" == "go" ]; then go run main.go
go run main.go
fi
if [ "${2}" == "csi" ]; then
csi -s main.scm
fi
cd - > /dev/null cd - > /dev/null
fi fi