DEV Community

Carly Ho 🌈
Carly Ho 🌈

Posted on

#AdventOfCode: What language are you using?

Advent of Code is a December code challenge, with code puzzles running from the first through Christmas, put together by Eric Wastl. I completed it last year, and I know a lot of folks here have done it in the past!

I did Python last year, but I was considering choosing something I'm less familiar with this year (something in the set of Go, Haskell, Rust, Elixir, maybe). As we're coming up on AoC 2018, does anyone else planning to participate have their language picked out for this year?

Top comments (18)

Collapse
 
sublimemarch profile image
Fen Slattery

I did a few challenges last year with Javascript, and made a front end for each to extend the challenge. I think I'll be doing the same thing this year, but actually trying to do the entire month, haha.

Collapse
 
rhymes profile image
rhymes

I didn't know about it!

Do you think it makes sense to use a language you don't know and maybe be "distracted" by syntax and library or to tackle the challenges from a more comfortable starting point? How hard it is?

Thanks for the tip!

Collapse
 
carlymho profile image
Carly Ho 🌈

What I did last year was pick a language I had used before but wanted to brush up on, and that seemed to work out pretty well! I think the folks who make the leaderboard usually use languages they're pretty fluent with, though, so it depends on what your goals are, haha. Some of the days are really hard, as a heads-up—the first couple are usually pretty easy and then it starts to ramp up.

If you try a new or new-ish language, there's also a subreddit for the challenges, and people will post their solutions in the day thread, so if you get stuck you'll almost certainly have a reference for how to solve the puzzle unless you're working in something incredibly obscure—people do it in a lot of languages.

Collapse
 
rhymes profile image
rhymes

What I did last year was pick a language I had used before but wanted to brush up on, and that seemed to work out pretty well!

Good strategy! Not too little, not too much :)

I think the folks who make the leaderboard usually use languages they're pretty fluent with, though, so it depends on what your goals are, haha.

Yeah, I guess so too. Unless they are super fast learners. But it make sense, if you're in it to compete at the highest level, you want to have a head start using something you already know well.

I think I'll follow your strategy. I just have to decide which language :D

If you try a new or new-ish language, there's also a subreddit for the challenges, and people will post their solutions in the day thread, so if you get stuck you'll almost certainly have a reference for how to solve the puzzle unless you're working in something incredibly obscure—people do it in a lot of languages.

Great :) I've registered to the website, I'll probably have to choose a language and then I'll try a few examples from the previous years.

Thank you, Carly

Collapse
 
mattnmoore profile image
Matt Moore

I would love to give it a shot in Elixir since I'm currently trying to learn it. Elm would be cool, too!

Collapse
 
thejessleigh profile image
jess unrein

I tried to do Go last year, got a few days in, and ended up feeling that life was too short 😅

I think Go is too far out of the paradigm of what I do normally to make digging into AoC with it worth it. I might try Ruby since I pick on it so much as "Python but worse formatting and everything is aliased to everything else."

Collapse
 
hoelzro profile image
Rob Hoelz

I did AoC with Racket in 2016, and I did 2017's in Rust (and a few in Idris); I was thinking of maybe doing Clojure this year.

Collapse
 
carlymho profile image
Carly Ho 🌈

How did you find Rust for working on AoC? I imagine the speed probably helps since a lot of the puzzles are kind of optimization problems.

Collapse
 
hoelzro profile image
Rob Hoelz

I enjoyed it - AoC proved to be a pretty good way to get comfortable with Rust! Coding up more complex data structures (like trees and graphs) was a little harder than in, say, C, because you have the borrow checker looking over your shoulder, and you have to do a fair amount of work to convince it you're being safe with those kinds of data structures. What I often ended up doing was create a "node" type that would have a label and a list of labels representing the neighbors/children for that node, and use a label → node hash map to traverse between nodes. Please don't take this as me saying the borrow checker is a downside - it's just my opinion that it makes Rust less suitable for prototyping, but better for writing rock-solid software!

That being said, I would still rate myself as a Rust amateur, so perhaps there are smarter ways to build trees and graphs than I could come up with, or libraries I could leverage for this.

This is all speaking based on the journal notes I took during AoC last year - I didn't mention speed in notes, and I don't remember feeling that Rust's speed gave me a particular advantage over Racket the previous year. That being said, I used what I learned to port some Python code I'd used to parse Wikipedia data dumps into Rust - Rust's speed plus its easy multithreading facilities definitely helped!

Thread Thread
 
deciduously profile image
Ben Lovy

use a label → node hash map to traverse between nodes

Thanks for unsticking me on a graph in Rust, incidentally.

Collapse
 
jlwarg profile image
Jochen Luig

I dabbled with some of the puzzles in previous years in Python and (less so) Guile.
This time I'd like to get my feet wet with Common Lisp. Midnight EST roughly matches the time I usually start the day with my first cup of coffee, so I'll wake up to a new puzzle each day. I'll see how this works out.

Collapse
 
jdsteinhauser profile image
Jason Steinhauser

I'm glad you said something, because I keep forgetting it's a thing until like... mid-December.

That being said, I'll probably give it a go in Elixir since it's been my new language of interest. If I have the time I'll look at doing it in a more comfortable language like F#/ReasonML, or use it as an excuse to refresh my Clojure skills :-)

Collapse
 
chrisboren profile image
Chris Boren

Interesting — I've never heard of it, but I'd be happy to give it a shot. Probably JavaScript for me, maybe Python 3 if I'm feeling adventurous ^_^

Collapse
 
carlymho profile image
Carly Ho 🌈

I really liked doing Python 3! I learned a lot of interesting weird optimization tricks involving xranges and dictionaries. Javascript feels like it'd be its own fun challenge, though.

Collapse
 
bearguy profile image
Stephen Peterkins

Thanks for reminding me about this! I head about this before from a coworker a couple of years ago but didn't think too much of it; this year I'm gonna have a go at it.

I like your strategy of using a language you're less familiar (for me that'll be Go this year). It's a great motivator for applying yourself to a new language without needing to commit yourself to a side project to have it amount to anything.

Collapse
 
deciduously profile image
Ben Lovy

These are a great opportunity to try something funky! I'm torn - I had a blast using ClojureScript last year but these seem like a perfect opportunity to flex some Haskell too.

Por que no los dos?

Collapse
 
kip13 profile image
kip

Exacto, por que no !?

Collapse
 
francisco profile image
Francisco M. Delgado

This is pretty cool, didn't know about it. I'm going to give it a shot. I think I'm going to go with Java. I haven't used it since college and I want to get good at it again.