Skip to content

Commit

Permalink
Julia for 2b
Browse files Browse the repository at this point in the history
  • Loading branch information
tjpalmer committed Dec 8, 2018
1 parent 54681c7 commit bf9d981
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions 2018/02/julia/compare.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
module Compare

function main()
count2 = 0
count3 = 0
ids = []
open("../input/input.txt") do file
for line in eachline(file)
id = reshape(map(x -> x[1], split(line, "")), (1, :))
# for other in ids
# end
if length(ids) > 5
println(size(id))
ids_all = vcat(ids...)
println(size(ids_all))
println(ids_all)
println(ids_all .== id)
println(sum(ids_all .== id, dims=2))
break
id = map(x -> x[1], split(line, ""))
match_count = length(id) - 1
for other in ids
common = other .== id
if sum(common) == match_count
# Print what's in common.
println(join(id[common]))
# No labeled break in Julia yet.
# See also: https://github.com/JuliaLang/julia/issues/5334
@goto done
end
end
push!(ids, id)
end
@label done
end
end

Expand Down

0 comments on commit bf9d981

Please sign in to comment.