News for hackers. Stuff that matters.
Re:Advent of Code 2021 by tester34 on Wednesday December 01, 2021 @09:28AM (#29403876)
I wonder how popularity of "exotic" languages increases when AoC's around

F#, Lisp and so on

Re:Advent of Code 2021 by petercooper on Wednesday December 01, 2021 @10:20AM (#29404488)
APL is the language I only ever see around AoC. But it's so impressive too. Like the first part of today's solution is "+/¯1↓x<1⊖x" (stolen from someone on Reddit) and I'm like.. ok, I need to learn this language one day.

(Since their solution is now being discussed, it's from here: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_d...)

Re:Advent of Code 2021 by Jtsummers on Wednesday December 01, 2021 @11:23AM (#29405421)
Interesting solution.

  1⊖x
Rotates the sequence so the first becomes the last.

  x < 1⊖x
Element-wise compare each, resulting in a list of 1s and 0s

  ¯1 ↓ x<1⊖x
Drop the last element because it's actually not part of the solution (thanks to the earlier rotation).

  +/ ¯1↓x<1⊖x
Sum all of them, since it's just 1s and 0s this gives a correct count. Part 2 is solvable (unless I missed something, works on the sample data) by just changing two characters from that solution. Neat.
Re:Advent of Code 2021 by petercooper on Wednesday December 01, 2021 @12:15PM (#29406309)
Thanks for the explanation! I just found someone with a different approach who has similarly broken it down on Twitter: https://twitter.com/janiczek/status/1465969017089363969
Re:Advent of Code 2021 by Jtsummers on Wednesday December 01, 2021 @12:18PM (#29406360)
https://tryapl.org

That's an online APL REPL with all the symbols listed at the top, hover to get a tooltip that tells you both how to type it into the REPL and what its name is. I'd forgotten what rotate was because my APL deep-dive was 2 or 3 years ago now. It's handy for discovering the symbols and breaking down the harder-to-understand one-liners (for novices or those unfamiliar with it).

Re:Advent of Code 2021 by maximus-decimus on Saturday December 04, 2021 @09:18AM (#29440961)
and this is the solution in Q, including paring the file: `(+/) 1_ (>':) "I" $ read0 `:input_1.txt`

I don't think their second solution actually works unless I'm missing something though : +/¯3↓x<3⊖x

This compares every element to the the one 3 positions before it, when the question was to take the sum of each 3 elements and check if it's smaller than the previous sum.

Re:Advent of Code 2021 by ollran on Wednesday December 01, 2021 @11:55AM (#29405959)
APL is quite common in the code golf scene.
Re:Advent of Code 2021 by mcjiggerlog on Wednesday December 01, 2021 @09:55AM (#29404166)
It seems like 80% of people I've heard talking about AoC are planning on doing it in Rust (including me!). It's definitely a great way to get up to speed with a language you're interested in learning.
Re:Advent of Code 2021 by ducharmdev on Wednesday December 01, 2021 @10:29AM (#29404637)
Yup, I'm doing Rust this year as well. I've worked through rustlings a couple times in the past, but haven't had many excuses to use Rust.

I was proud last year when I got to day 18 with Python, but I'm setting the bar much lower this year. I don't have any experience with C/C++ (just C# and a bit of Go), so thinking more carefully about memory mgmt is new to me. But the functional aspects of Rust are pretty exciting.

Re:Advent of Code 2021 by jstx1 on Wednesday December 01, 2021 @09:58AM (#29404199)
In last year's survey Rust was around 10%. It's definitely overrepresented but not quite that much.
Re:Advent of Code 2021 by aunderscored on Wednesday December 01, 2021 @10:11AM (#29404361)
I definitely enjoyed doing rust. I'm planning on doing go, rust, and python. We'll see how well that holds up
Re:Advent of Code 2021 by jstx1 on Wednesday December 01, 2021 @09:56AM (#29404178)
There's definitely a selection effect - the type of person that will spend time on Advent of Code is also likely to be the type of person that learns and uses more exotic languages, or at least languages that aren't used that much commercially.

Some stats to confirm - https://preview.redd.it/jrhlcxrzy0761.png?width=2275&format=... - taken from from last years' unofficial survey - https://www.reddit.com/r/adventofcode/comments/kj53l1/unoffi...

Re:Advent of Code 2021 by asicsp on Wednesday December 01, 2021 @09:55AM (#29404172)
Some create a language just for AoC, for example: https://github.com/healeycodes/adventlang
Re:Advent of Code 2021 by mnw21cam on Wednesday December 01, 2021 @10:39AM (#29404774)
That'd be interesting given that 2019 was already about a created language.
Re:Advent of Code 2021 by riffraff on Wednesday December 01, 2021 @02:11PM (#29407839)
One of the solutions I saw today was in Intcode (the language from 2019), it was pretty incredible.
Re:Advent of Code 2021 by mikewarot on Wednesday December 01, 2021 @10:15AM (#29404416)
I'll balance that out for you, I do my programming in Pascal. I'm going through the old ones as well, hoping to back-fill in answers to all of them.

https://github.com/mikewarot/Advent_of_Code_in_Pascal

Re:Advent of Code 2021 by overkalix on Wednesday December 01, 2021 @09:40AM (#29403994)
Not particularly exotic, but the last two years I pushed myself to do them in elixir (although my solutions become progressively shoddy until I quit, usually around day 10-12). Then I promptly forget everything I've learnt because I can't introduce the language in my work.
Re:Advent of Code 2021 by phillipcarter on Wednesday December 01, 2021 @02:30PM (#29408090)
I'm using it as an opportunity to try out Crystal. I have zero Ruby experience, so it's a fun experience coming in from a "no, actually, none of this is familiar to me" perspective. Nice language.
Re:Advent of Code 2021 by runevault on Wednesday December 01, 2021 @10:48AM (#29404884)
I've been getting back into f# lately and going to use it for AoC to give me real challenges to work on instead of arbitrary ideas, so it is certainly helping one of the mentioned for me.
Re:Advent of Code 2021 by riffraff on Wednesday December 01, 2021 @02:13PM (#29407878)
There's always some cool stuff done with Raku, I'm giving it a chance this year as my "second language", we'll see how it goes.
Re:Advent of Code 2021 by Jenz on Wednesday December 01, 2021 @09:30AM (#29403903)
Lisp is exotic?
Re:Advent of Code 2021 by Scarbutt on Wednesday December 01, 2021 @09:45AM (#29404039)
Esoteric is the word I would use.
Re:Advent of Code 2021 by carnitine on Wednesday December 01, 2021 @10:04AM (#29404278)
Seriously? Lisp of all languages? Also esoteric is already applied to languages like Brainfuck which are designed to be as abstruse as possible.
Re:Advent of Code 2021 by Scarbutt on Wednesday December 01, 2021 @11:02AM (#29405093)
Yes, Lisp and F# are esoteric programming languages in the industry.
Re:Advent of Code 2021 by mrtranscendence on Wednesday December 01, 2021 @11:19AM (#29405366)
I've only seen "esoteric" refer to programming languages that are deliberately constructed to be obscure or unusual, usually in ways that make them unusable in some practical sense. Your Brainfucks or Malbolges, say. I've never heard of anyone applying that term to Lisp or especially F#. They might be unpopular, but they're usable, practical languages with good implementations.
Re:Advent of Code 2021 by ByteJockey on Wednesday December 01, 2021 @12:25PM (#29406459)
A lot of people consider anything not in the tiobe top 10 to be esoteric (especially for the purposes of enterprise work).

Maybe obscure is a better word here?

Re:Advent of Code 2021 by mrtranscendence on Wednesday December 01, 2021 @01:04PM (#29406991)
Obscure is a good choice. I’d probably use niche. Honestly, esoteric could be a good word to describe lisp, except for the fact that it seems to already exist as a term for a category that wouldn’t include lisp.
Re:Advent of Code 2021 by ByteJockey on Wednesday December 01, 2021 @03:40PM (#29408861)
Niche is fair. Basically, I'm trying to describe "not mainstream".
Re:Advent of Code 2021 by bcrosby95 on Wednesday December 01, 2021 @03:49PM (#29408949)
By this metric, Ruby, Swift, Go, Rust, Kotlin, and Typescript are all obscure. Some of these are even more obscure than Lisp.
Re:Advent of Code 2021 by ByteJockey on Thursday December 02, 2021 @08:16AM (#29415687)
Correct. I know plenty of enterprises that do not touch any of those, mostly because of their fear of not being able to find devs familiar with those languages.

As discussed elsewhere, it's possible niche might be a better term to describe what I'm talking about here than obscure.

Re:Advent of Code 2021 by aarchi on Wednesday December 01, 2021 @01:57PM (#29407639)
I'm solving Advent of Code in Whitespace, a quintessential esolang.

https://github.com/andrewarchi/ws-challenges

[dead]
Re:Advent of Code 2021 by speg on Wednesday December 01, 2021 @09:37AM (#29403974)
Advent of Code.
Re:Advent of Code 2021 by BiteCode_dev on Wednesday December 01, 2021 @09:40AM (#29403992)
That sounded like a joke :)
Re:Advent of Code 2021 by gerikson on Wednesday December 01, 2021 @09:44AM (#29404034)
The price of humor on HN is eternal downvotes.
Re:Advent of Code 2021 by Nicksil on Wednesday December 01, 2021 @10:22AM (#29404528)
>The price of humor on HN is eternal downvotes.

Not if its funny.

Re:Advent of Code 2021 by Toutouxc on Wednesday December 01, 2021 @11:46AM (#29405813)
It's important to understand that for every person familiar with the name and the abbreviation there are roughly 22 people who have no idea who she is.