13
you are viewing a single comment's thread
view the rest of the comments
[-] Andy@programming.dev 5 points 2 years ago* (last edited 2 years ago)

I would have liked to see a nice clear example at the top to help me decide if I really want to read about the language.


EDIT: First sample:

day := 1;
import "advent-prelude.noul";

puzzle_input := advent_input();

submit! 1, puzzle_input split "\n\n" map ints map sum then max;
submit! 2, puzzle_input split "\n\n" map ints map sum then sort then (_[-3:]) then sum;

Looks not too different from what you might do in Factor:

: totals ( -- seq )
  puzzle-input "\n\n" split-subseq [ split-lines [ string>number ] map-sum ] map
;

: part1 ( -- ) totals supremum . ;

: part2 ( -- ) totals sort 3 tail* sum . ;
this post was submitted on 14 Nov 2023
13 points (100.0% liked)

Advent Of Code

1243 readers
1 users here now

An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Everybody Codes is another collection of programming puzzles with seasonal events.

EC 2025

AoC 2025

Solution Threads

M T W T F S S
1 2 3 4 5 6 7
8 9 10 11 12

Visualisations Megathread

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 3 years ago
MODERATORS