blog/assets/js/51624505.16164e69.js

1 line
21 KiB
JavaScript
Raw Permalink Normal View History

"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[4394],{32609:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=t(85893),o=t(11151);const i={title:"Advent of Code '22 in Rust",description:"Preparing for Advent of Code '22.",date:"2022-12-14T21:45",slug:"aoc-2022/intro",authors:"mf",tags:["advent-of-code","advent-of-code-2022","rust"],hide_table_of_contents:!1},a=void 0,s={permalink:"/blog/aoc-2022/intro",editUrl:"https://github.com/mfocko/blog/tree/main/blog/aoc-2022/00-intro.md",source:"@site/blog/aoc-2022/00-intro.md",title:"Advent of Code '22 in Rust",description:"Preparing for Advent of Code '22.",date:"2022-12-14T21:45:00.000Z",formattedDate:"December 14, 2022",tags:[{label:"advent-of-code",permalink:"/blog/tags/advent-of-code"},{label:"advent-of-code-2022",permalink:"/blog/tags/advent-of-code-2022"},{label:"rust",permalink:"/blog/tags/rust"}],readingTime:8.665,hasTruncateMarker:!0,authors:[{name:"Matej Focko",email:"me+blog@mfocko.xyz",title:"a.k.a. @mf",url:"https://gitlab.com/mfocko",imageURL:"https://github.com/mfocko.png",key:"mf"}],frontMatter:{title:"Advent of Code '22 in Rust",description:"Preparing for Advent of Code '22.",date:"2022-12-14T21:45",slug:"aoc-2022/intro",authors:"mf",tags:["advent-of-code","advent-of-code-2022","rust"],hide_table_of_contents:!1},unlisted:!1,prevItem:{title:"1st week of Advent of Code '22 in Rust",permalink:"/blog/aoc-2022/1st-week"}},l={authorsImageUrls:[void 0]},c=[{value:"Choosing a language",id:"choosing-a-language",level:2},{value:"Choosing libraries",id:"choosing-libraries",level:2},{value:"Preparations for Rust",id:"preparations-for-rust",level:2},{value:"Toolkit",id:"toolkit",level:3},{value:"Libraries",id:"libraries",level:3},{value:"My own \u201clibrary\u201d",id:"my-own-library",level:3},{value:"Skeleton",id:"skeleton",level:3}];function d(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",section:"section",strong:"strong",sup:"sup",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["Let's talk about the preparations for this year's ",(0,r.jsx)(n.a,{href:"https://adventofcode.com",children:(0,r.jsx)(n.em,{children:"Advent of Code"})}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"choosing-a-language",children:"Choosing a language"}),"\n",(0,r.jsx)(n.p,{children:"When choosing a language for AoC, you usually want a language that gives you a\nquick feedback which allows you to iterate quickly to the solution of the puzzle.\nOne of the most common choices is Python, many people also use JavaScript or Ruby."}),"\n",(0,r.jsx)(n.p,{children:"Given the competitive nature of the AoC and popularity among competitive programming,\nC++ might be also a very good choice. Only if you are familiar with it, I guess\u2026"}),"\n",(0,r.jsx)(n.p,{children:"If you want a challenge, you might also choose to rotate the languages each day.\nThough I prefer to use only one language."}),"\n",(0,r.jsxs)(n.p,{children:["For this year I have been deciding between ",(0,r.jsx)(n.em,{children:"Rust"}),", ",(0,r.jsx)(n.em,{children:"C++"})," and ",(0,r.jsx)(n.em,{children:"Pascal"})," or ",(0,r.jsx)(n.em,{children:"Ada"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["I have tried Rust last year and have survived with it for 3 days and then gave\nup and switched to ",(0,r.jsx)(n.em,{children:"Kotlin"}),", which was pretty good given it is \u201cJava undercover\u201d.\nI pretty much like the ideas behind Rust, I am not sure about the whole cult and\nimplementation of those ideas though. After some years with C/C++, I would say\nthat Rust feels ",(0,r.jsx)(n.em,{children:"too safe"})," for my taste and tries to \u201c",(0,r.jsx)(n.em,{children:"punish me"}),"\u201d even for the\nmost trivial things."]}),"\n",(0,r.jsxs)(n.p,{children:["C++ is a very robust, but also comes with a wide variety of options providing you\nthe ability to shoot yourself in the leg. I have tried to solve few days of previous\nAdvent of Code events, it was ",(