sorawee
2019-12-2 11:13:45

@sorawee has joined the channel


sorawee
2019-12-2 11:16:28

I didn’t search on part 2. Just use Rosette to do that for me :joy:


wwall
2019-12-2 12:15:00

@wwall has joined the channel


samdphillips
2019-12-2 16:11:28

for* was sufficient


ruyvalle
2019-12-2 16:13:06

@ruyvalle has joined the channel


ruyvalle
2019-12-2 16:39:06

Here’s my day 1 solution. Feedback would be much appreciated :slightly_smiling_face: (define input-port (open-input-file (expand-user-path "~/Downloads/AOCDay1In.txt"))) (define (calc-required-fuel mass) (- (quotient mass 3) 2)) (for/sum ([str (in-lines input-port)]) (define num (string->number str)) (calc-required-fuel num))


ruyvalle
2019-12-2 17:31:19

My solution to day 1 parts 1 and 2 (define input-path (expand-user-path "~/Downloads/AOCDay1In.txt")) (define (calc-required-fuel mass) (- (quotient mass 3) 2)) (define (calc-required-fuel-rec mass) (define (iter total mass) (define required-fuel (calc-required-fuel mass)) (if (<= required-fuel 0) total (iter (+ total required-fuel) required-fuel))) (iter 0 mass)) (define (solve-day1-part calc-func) (with-input-from-file input-path (thunk (for/sum ([str (in-lines)]) (define num (string->number str)) (calc-func num))))) (define (solve-day1-part1) (solve-day1-part calc-required-fuel)) (define (solve-day1-part2) (solve-day1-part calc-required-fuel-rec))


popa.bogdanp
2019-12-2 19:06:04

@popa.bogdanp has joined the channel


pocmatos
2019-12-2 19:52:14

Bonus points for using Rosette - I guess! :)


sorawee
2019-12-2 19:52:47

It’s actually a pretty bad reason to use Rosette


sorawee
2019-12-2 19:53:24

In particular, if the program counter becomes a symbolic value, it will get stuck in an infinite loop and need symbolic reflection to counter that. And at that point I might as well just solve it with the “regular” method.


sorawee
2019-12-2 19:54:21

Luckily, input that I got didn’t cause pc to become symbolic, so ….


philip.mcgrath
2019-12-2 20:51:52

@philip.mcgrath has joined the channel


d_run
2019-12-3 00:30:22

@d_run has joined the channel


racket132
2019-12-3 01:29:44

@racket132 has joined the channel


samdphillips
2019-12-3 06:12:04

My part two solution is horrid


samdphillips
2019-12-3 06:12:29

well I used a mutable hashtable so maybe not that bad


sorawee
2019-12-3 07:04:12

Mutable hash too :slightly_smiling_face:


bas
2019-12-3 07:09:30

@bas has joined the channel