Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do you have a public repo of your Advent code? I started out trying to use Zig but couldn’t find documentation on how to complete even basic tasks (like passing a filename as a command line arg, then opening and reading a file line by line), so I gave up. Maybe seeing a repo of good Zig code accomplishing these tasks would get me going.


Check out the Zig standard library and the tests for examples on doing some basic stuff with the language. Tests are generally at the end of files, you can search for "test".

0.5.0 Documentation https://ziglang.org/documentation/0.5.0/#Introduction

root std library https://github.com/ziglang/zig/tree/master/lib/std

examples of writing and reading to a file https://github.com/ziglang/zig/blob/master/lib/std/event/fs....

There are also a ton of projects that the creator has done with Zig, you can check those out for more examples as well.

https://github.com/andrewrk?utf8=%E2%9C%93&tab=repositories&...

Looks like he has an advent of code repo too.


My solutions are here: https://github.com/lukechampine/advent

Documentation for Zig isn't great, but it's become much easier now that the standard library is searchable: https://ziglang.org/documentation/master/std


Here[1] is a playlist of the creator of Zig coding in Zig. He also has some solutions for Advent of Code.

1. https://www.youtube.com/watch?v=hBCsWEQ_asM&list=PLviMr_WImM...


> He also has some solutions for Advent of Code.

I had looked at his 2018 Advent repo and was disappointed to find that he simply pasted his input directly into the code, whereas I like to compile generic binaries that can read inputs from the command line. However, it looks like his 2019 solutions for days 1 and 2 at least do read input from a file, so this year looks like it'll be a better starting point.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: