Skip to content

Instantly share code, notes, and snippets.

use itertools::Itertools;
use std::convert::From;
use std::fs::File;
use std::io::{self, BufRead};
use std::ops::BitAnd;
fn main() {
let backpacks = get_data("./input");
println!("Part1: {}", part1(&backpacks));
println!("Part2: {}", part2(&backpacks));
@corpsmoderne
corpsmoderne / mandel.ex
Created October 20, 2021 15:43
Mandelbrot in Elixir
defmodule Mandel do
defp mandel(x0, y0, zoom, iter_max) do
loop = fn
(_, _, _, ^iter_max) -> 0
(self, x, y, iter) ->
x_x = x * x |> div(zoom)
y_y = y * y |> div(zoom)
if x_x + y_y > 4 * zoom do
iter