Thanks for sharing, here are my solutions in Elixir and Racket.

I'm not sure if the Racket code is idiomatic, so, any advice is more than welcome.

Elixir

# https://adventofcode.com/2018/day/1## To run each exercise, you can do the following:## elixir -r exercise.exs -e "IO.inspect(Frequency.first_exercise())"# elixir -r exercise.exs -e "IO.inspect(Frequency.second_exercise())"#defmoduleFrequencydodeffirst_exercise,do:frequency(process_file())defsecond_exercise,do:first_frequency_reached_twice(process_file())@specfrequency([integer])::integerdeffrequency(freq_changes),do:Enum.sum(freq_changes)@specfirst_frequency_reached_twice([integer],{integer,MapSet.t()}|integer)::integerdeffirst_frequency_reached_twice(frequency_changes,acc\\{0,MapSet.new([0])})deffirst_frequency_reached_twice(_,acc)whenis_integer(acc),do:accdeffirst_frequency_reached_twice(frequency_changes,acc)doresult=Enum.reduce_while(frequency_changes,acc,fndigit,{current,past}->next=current+digitifMapSet.member?(past,next)do{:halt,next}else{:cont,{next,MapSet.put(past,next)}}endend)first_frequency_reached_twice(frequency_changes,result)enddefpprocess_filedo"input"|>File.stream!()|>Stream.map(fnx->x|>String.trim()|>String.to_integer()end)|>Enum.to_list()endendExUnit.start()defmoduleFrequencyTestdouseExUnit.CaseimportFrequencytest"should calculate frequency"dotest_cases=[{[1,-2,3,1],3},{[1,1,1],3},{[1,1,-2],0},{[-1,-2,-3],-6}]Enum.each(test_cases,fn{changes,expected}->assertfrequency(changes)==expectedend)endtest"should stop when a frequency is reached twice"dotest_cases=[{[1,-2,3,1,1,-2],2},{[1,-1],0},{[3,3,4,-2,-4],10},{[-6,3,8,5,-6],5},{[7,7,-2,-7,-4],14}]Enum.each(test_cases,fn{changes,expected}->assertfirst_frequency_reached_twice(changes)==expectedend)endend

#langracket/base(requirerackunit"exercise.rkt")(defineexercise-tests(test-suite"Tests for exercise day 1"(test-case"Should calculate frequency"(check-equal?(frequency'(1-231))3)(check-equal?(frequency'(111))3)(check-equal?(frequency'(11-2))0)(check-equal?(frequency'(-1-2-3))-6))(test-case"Should find first frequency reached twice"(check-equal?(first-frequency-reached-twice'(1-1))0)(check-equal?(first-frequency-reached-twice'(1-2311-2))2)(check-equal?(first-frequency-reached-twice'(334-2-4))10)(check-equal?(first-frequency-reached-twice'(-6385-6))5)(check-equal?(first-frequency-reached-twice'(77-2-7-4))14))))(requirerackunit/text-ui)(run-testsexercise-tests)

## re: AoC Day 1: Chronal Calibration VIEW POST

FULL DISCUSSIONThanks for sharing, here are my solutions in Elixir and Racket.

I'm not sure if the Racket code is idiomatic, so, any advice is more than welcome.

## Elixir

## Racket

Unit tests for Racket: