►
From YouTube: 2019-10-11 Go Study Group
Description
Live coding and discussion for Binary Search progression: https://gitlab.com/pokstad1/goprogs/issues/4
A
A
C
A
I'm
sure
that's
gonna
be
a
common
story,
but
we'll
try
to
reduce
the
load
coming
up.
I
think
what
we'll
do
is
we'll
just
have
someone
suggest
a
topic
for
a
problem
and
we
can
just
do
one
single
problem
and
then,
if
that
problem
is
too
hard,
then
we'll
take
a
step
back
and
try
to
figure
out
how
to
build
up
to
it.
So
we'll
try
to
you
have
concurrency
next
so
that
we
can
reduce
the
load
on
people
if
they
want
to.
You
know,
participate
fully,
I
think.
C
A
A
A
Everyone
see
my
screen.
Okay,
give
me
a
thumbs
up
cool,
let's
see
here
so
we're
gonna
I
have
a
solutions,
branch
that
should
have
everything
we
need
make
sure
it's
up
to
date
on
master
first,
okay,
so
just
to
do
a
little
quick
recap
of
where
we
were
last
time.
We
had
the
middle
index
is
the
one
that
we
implemented
as
a
live
coding
exercise.
A
So
what
we're
doing
here
is
we're
just
we
have
a
slice
of
things
and
we
want
to
access
the
middle
element
and
that's
gonna
be
really
important
for
binary
search,
because
what
we're
doing
is
we're
splitting
the
problem
into
smaller
and
smaller
pieces
until
we
get
to
this
base
case,
which
is
that
we
found
the
number
that
we're
looking
for.
So
this
piece
of
the
problem
is
just
helping
us
figure
out
how
to
access
the
middle
element
and
we're
basically
dividing
the
number
of
elements
in
half
and
then
accessing
it
and
seeing
what's
in
there.
A
A
So
there's
a
lot
of
documentation
here
in
very
little
code
and
so
that
that's
that's
kind
of
the
gist
of
it,
but
I'm
also
gonna
pull
up
the
test
code,
so
we
can
see
what
we're
trying
to
do
here.
So
the
mechanics
and
we've
got
split.
What
is
it
split
slice
underscore
test.
So
what
we're
trying
to
do
here
is
that
we
want
these
test
cases
to
pass.
So
these
are
our
test
cases.
A
We
have
a
slice
that
is
an
input,
and
then
we
have
an
index
that
we
want
to
split
the
slice
around,
and
then
we
have
what
we
expect
the
left
side
to
be
and
what
we
expect
the
right
side
to
be
so
we're
gonna
write
the
code
to
do
this,
and
does
anybody
want
to
shout
out?
You
know
how
we're
gonna
do
this.
What
the
go
mechanism
is
that
allows
us
to
to
create
multiple
slices.
A
A
A
A
And
just
to
give
a
further
illustration:
we
don't
want
this
because
we
already
know
that
two
is
not
what
we
want
and
likewise
we
don't
want
to
to
be
included
in
this
list,
because
we
already
know
that
it's
not
the
value
that
we
want
so
yeah.
That's
that's!
Why
we're
doing
it?
There's
other
implementations
that
I've
seen
I
think
some
of
them.
A
So,
let's
see
here,
let's
go
to
the
implementation
code,
so
the
the
thing
that
I'm
looking
for
here
is
that
we
want
to
use
the
slice
indexes
to
be
able
to
specify
you
know
we
want
a
sub
slice
from
here
to
there.
So
the
way
that
we're
going
to
do
this
is
we're
going
to
I'm
going
to
do
a
real
naive
solution,
see
how
that
works.
I'm
going
to
just
go
down
to
the
return
statement
down
here
and
what
I'm
gonna
do
is
just
return
s.
A
A
So
what
we
want
to
do
is
we
want
to
split
this
slice
into
the
beginning
of
it
all
the
way
until
the
halfway
point,
so
I'm
gonna
get
the
length
of
the
slice
and
I'm
gonna
divide
that
by
two
and
then
I'm
going
to
do
the
same
thing
here.
Actually
I'm.
Sorry,
we
we
have
the
middle
index,
provided
so
I'm,
going
to
put
the
middle
index
and
then
I'm
going
to
put
the
other
side
the
right
side
and
I'm
going
to
do
it
on
I
to
the
end
of
the
slice.
A
A
Let's
see
what
happens,
you
get
a
fail
here,
so
splitting
one
two
three
by
index,
one
yielded
left
one
and
right
two,
three
right,
two
three
doesn't
match
desired
three,
so
this
is
the
problem
that
we
were
just
discussing.
Is
that
we
don't
want.
We
want
this
to
be
a
exclusive
of
the
the
middle
index.
We
don't
want
that
part
of
the
the
balance
of
this
array.
So
there's.
A
The
same
test,
I
believe
that's
a
different
test
case,
so
there's
some
edge
case
here,
where
it's
causing
the
whole
thing
to
fail.
Probably,
whenever
I
see
something
like
this,
it's
either
a
nil
pointer
or
it's
out
of
bounds
of
the
the
arrays,
my
guess
so
since
we're
dealing
with
slices.
This
is
probably
an
out
of
balance,
error
and
yeah.
You
can
see
here.
The
panic
gives
a
little
more
information
slice
bounds
out
of
range,
so
we'll
get
to
that
edge
case
in
just
a
second
after
we
fix
it
the
naive
way.
A
So
we
know
that
we
want
to
split
to
the
right
of
the
index
so-
and
this
is
something
that
is
important
to
note-
is
that
in
this
index
notation
that
you're
looking
at
where
we
have
the
number
:
the
end
of
the
slice?
What
go
does
is
that
the
first
index
that
you
provide
so
in
this
case
zero,
is
inclusive
of
that
range.
So
that
means
zero
index
will
be
included
in
this
slice,
but
the
value
that
we
provide
on
the
right
will
not
be
included
in
that
slice.
A
So
I,
let's
say
I
is
three:
it's
not
going
to
go
all
the
way
up.
It's
not
gonna
include
the
third
element
in
the
slice
in
this
sub
slice.
What
it's
gonna
do
is
it's
going
to
include
the
one
before
that,
and
this
is
handy
if
you
want
to
use
the
length
of
a
slice
as
the
last
parameter,
because
you
don't
have
to
worry
about
it
being
out
of
bounds
because
we
use
zero-based
indexing
and
go
so.
We
start
counting
at
zero.
A
So
this
is
handy
for
when
you
want
to
use
the
length
of
the
slice
to
indicate
the
last
element,
you
don't
have
to
worry
about
it
breaking
in
this
slice
notation.
So
that
doesn't
work,
though
for
the
beginning
here.
So
that's
why
we're
not
getting
the
test
results
we
want.
So
what
we're
going
to
do
here
is
we're
going
to
just
add
a
little
little
handy,
plus
one
and
then
we're
gonna
try
again.
A
See
what
happens
so
1
2
3?
We
got
1
&
3,
that's
what
we
wanted,
but
then,
let's
see
here,
1
2,
3,
4,
5
6
by
index
2,
which
is
this
little
guy
right
here.
You'll
do
1
2,
&,
4,
5
6.
That's
also
what
we
want
splitting
one
by
index
0
and
yielded
a
empty
or
empty
slice
and
then
an
empty
slice
which
I
believe
is
also
what
we
want.
A
Okay,
so
splitting
one
by
the
middle
index
gives
us
nothing
and
nothing
which
is
this
test
case
right
here.
So
we
expect
nil
and
nil
or
empty
and
empty
and
here's
another
thing
that
might
be
a
little
confusing.
So
a
slice
can
be
two
different
values.
If
it's
empty,
it
can
be
nil
and
it
can
be
an
initialized
value
that
just
doesn't
contain
any
elements.
So
that's
a
little
confusing
a
lot
of
times.
A
The
idiomatic
thing
to
do
is
just
have
nil,
represent
an
empty
slice,
and
that
way
you
don't
have
to
worry
about
initializing
anything
and
everyone
else
respects
that.
Usually
that's
the
common
pattern
and
the
reason
why
that
works
is
because
things
like
the
length
function,
the
LAN
function.
If
you
run
that
with
a
nil
like
an
uninitialized
slice,
it's
going
to
return
0,
it
won't
panic
and
say:
oh
this
thing
isn't
initialized
I
can't
figure
out
the
length.
It's
actually
able
to
tell
you.
Oh
it's
nil.
That
means
zero
length
slice.
A
A
A
Equals
or
if
the
the
length
of
left
is
equal
to
zero,
then
we're
just
going
to
set
left
to
nil
and
then,
if
the
length
of
right
is
equal
to
zero,
then
we're
going
to
just
set
right
to
zero,
okay
and
I
think
we'll
just
do
a
naked
return,
even
though
this
is
not
usually
advisable.
We're
talking
about
it.
We're
talking
about
that
last
study
session,
but
I'll
do
that,
just
because
it's
a
small
function!
It's
easy!
It's
not
too
hard
to
read
this.
C
You
were
saying
that
uninitialized
slice
will
be
either/or,
it's
Papua,
trios,
nil
or
the
initialized
state.
Why
are
we
not
returning
nil
as
well?
Can
we
return?
Well,
you
I
guess:
if
we
could
return
a
slice,
would
it
make
sense
for
us
to
return
a
a
new
value
instead
of
like
an
uninitialized
or
than
an
initial
I
slice.
A
Try
understand
the
question,
so
the
the
slice
is
a
reference
value,
so
it's
like
a
pointer
right,
so
it
it
can
either
when
it's
first
initialize
it's
going
to
have
a
zero
value
and
actually
let
me
pull
up
the
go
playground.
So
we
can
see
this
in
another
area
here.
So
if
I
have
a
function
or
sorry
if
I
have
a
variable
like
X,
which
is
a
slice
events
and
it's
uninitialized
and
then
I,
just
print
X
I
get
the
empty.
A
This
is
this
is
how
it's
the
string,
the
string
or
function
for
a
slice,
is
just
doing
a
pre
formatting
for
me.
So
it
looks
like
it's
an
initialized
value
right,
because
I
don't
see
nil
here,
but
under
the
covers,
it's
really
a
nil
value.
If
I
try
to
point
if
I
try
to
print
the
pointer
I
believe
it
will
show
us
that
it's
nil,
let's
try
that
yeah!
So
there's
a
zero.
The
zero
address
representing
nil.
So
when
you.
A
A
Get
out
of
the
way
zoom
students
getting
in
my
way,
all
right,
so
in
the
test,
what
we're
doing
is
we're,
checking
that
the
left
and
the
the
right
they
match
the
values
that
we
have
in
the
the
test
cases
here.
So,
for
example,
we
say
I
want
nil
here,
I
want
nil
here,
so
this
equality
test
this
reflects
got
deep,
equal.
It
cares
that
the
slice
is
exactly
nil
and
not
in
onion,
not
an
initialized
value,
that's
empty,
so
this
is
just
the
way
that
this
function
works.
A
If
you
were
to
use
the
length
function,
it
wouldn't
care
if
it's
nil
or
uninitialized.
So
this
is
kind
of
an
example
of
why
we
want
our
test
to
kind
of
reflect,
how
we're
actually
going
to
be
using
the
values
returned,
because
if
we
know
that
most
people
are
not
going
to
care,
if
it's
nil
or
an
empty
slice,
then
our
test
should
really
reflect
that.
So
this
is
kind
of
a
bad
test
is
essentially
the
problem,
so
it
shouldn't
matter
if
we
return
those
two
different
types
of
values.
Does
that
answer
your
question?
Yeah.
A
Yeah
it
would
so
anytime,
you
have
a
slice.
A
slice
can
be
nil,
so
that
what
you're
returning
is
you're
returning,
a
nil
value
of
type
slice,
so
nilz,
the
nil
value,
is
always
typed.
If
that
makes
sense,
so
the
I
think
I
think
it's
always
type
there.
I
was
just
reading
an
article
about
it.
I'll
try
to
dig
that
up.
Let
me
pull
up
a
follow-up
item
article
about
typed
mils,
so
yeah.
It
matches
the
return
value
because
that
nil
value
is
implied
to
be
of
type
slice
and
the.
D
A
D
A
D
A
A
A
Okay,
so
the
we
have
this
edge
case.
That's
failing,
let's
see
here
so
on
the
test
case,
where
we
have
an
empty
slice,
it's
getting
a
slice
bounds
out
of
range,
so
this
is
also
a
good
situation
where
you
want
to
have
a
guard
statement
to
prevent
the
program
from
progressing
if
there's
an
issue,
so
the
guard.
Does
anyone
want
to
chime
in
on
what
that
steamin?
Look
like.
A
A
A
A
If
we,
if
we
choose
an
index
that
is
greater
than
what
is
in
the
slice,
then
we
should
just
return
everything
to
the
left,
and
if
we
choose
an
index
that
is
less
than
the
first
index,
which
is
a
negative
value,
then
it
should
just
return
everything
to
the
right.
That
way,
we
don't
have
to
worry
about
returning
an
error
value.
We
can
just
make
it
work
with
whatever
inputs
come
in.
So
this
is.
This
is
an
example
of
eliminating
the
the
need
for
an
error
value.
A
If
you
can
make
the
logic
of
your
program
work
without
having
to
have
this
like
extra
value.
That
indicates
an
error
case.
Then
that
kind
of
simplifies
things
because
then
you
don't
have
to
do
an
error
check.
So
that's
that's.
What
we're
doing
here
is
we're
just
making
it
extra
safe
and
not
have
to
worry
about
an
error
case,
so
anybody
want
to
take
a
crack
at
this
like
Lucas.
Do
you
want
to
keep
going
with
that.
B
A
A
So
in
this
case
one
two
three
by
splitting
one,
two
three
by
index,
one
yielded
left
empty
and
right
one
two:
three
and
that's
not
what
we
want
because
index
one
is
this
middle
value
right,
so
we
wanted
it
to
be
one
and
three
so
I'm,
looking
at
this
case
right
here,
so
this
new
introduced
logic.
It
works
for
that
weird
case,
but
it
doesn't
work
here.
So
why
is
that
not
working?
A
A
I
is
less
than
sir
okay
yeah,
because
we
don't
actually
care
about
the
links
of
the
all
we
care
about
is
that
is
negative,
because
the
first
index
is
always
going
to
be
zero.
That's
a
constant!
So
we
don't
have
to
actually
check
the
length
of
the
slice
in
this,
and
this
weird
case
that
someone
provides
a
negative
index.
So
let's
go
ahead
and
select
this.
A
A
This
stuff
is
not
easy
by
the
way
cuz
like
you,
don't
have
to
worry
about
slice,
arithmetic
on
a
regular
basis,
usually
you're
not
dealing
with
stuff
like
that,
and
when
you
do
you're
very
careful
and
you
do
very
little
of
it.
All
this
is
is
like
slice
arithmetic,
so
you
have
to
be
really
careful.
You
have
to
have
a
lot
of
test
cases
to
make
sure
that
you
feel
safe,
that
you
did
everything
correctly
and
if
you
want
to
get.
A
If
you
want
to
see
something
that'll
blow
your
mind,
a
little
bit
take
take
a
look
at
slice
tricks
for
go.
This
is
one
of
the
worst
things
about
go,
and
this
is
kind
of
a
problem
with
generics.
If
you
look
through
how
you
do
very
common
basic
container
type
operations
that
like
in
a
language
like
Python
or
Ruby,
would
be
nothing
here
and
go.
A
A
C
Spent
a
question
about
and
what
you
said
before
in
terms
of
avoiding
error
cases
I'm
curious.
If
this
is
like
a
more
of
an
anytime
go
approach
or
if
that
is
more
of
a
general
programming
comment,
because
where
you're
like
avoiding
I
would
expect
to
find
passing.
If
I'm
trying
to
a
slice,
I
passed
a
negative
value
to
slice,
it
would
either
wrap
around
based
on
I,
guess,
just
experience
with
other
languages
or
or
or
just
error
out.
A
So
when
you're
accessing
a
slice
index,
I
believe
that
go
does
not
allow
negative
values,
it
doesn't
want
you
to
do
stuff
like
that
in,
like
inherently
a
part
of
the
language.
If
you
want
that
to
be
a
part
of
your
program,
then
you
have
to
provide
it
like.
We
just
did
where
we
have.
You
know
the
the
explicit
check
for
that
negative
value,
and
we,
you
know,
perform
the
additional
logic
to
either
do
a
wraparound
or
to
do
the
you
know,
select
everything
to
the
right,
so
you
don't
get
that
out
of
the
box.
A
Your
first
question
about
you
know
is
this
something
that
is
in
all
languages
yeah.
It
is
like,
if
you
have
another
language,
where
you
throw
exceptions
I,
do
you
want
to
write
code
where
you
don't
throw
any
exceptions,
and
if
you
do
you
handle
them
as
low
and
close
to
where
the
problem
of
Erised
as
possible?
Right,
you
want
a
hint.
You
want
to
handle
an
exception
as
close
to
where
it
was
thrown,
where
you
have
better
context
of
what
the
problem
is,
so
that
it
doesn't
bubble
up
to
the
the
ultimate
caller
right.
A
So
yeah,
this
is
not
a
go
unique
thing.
What
is
go
unique
is
not
having
the
error
in
the
the
parameter
list,
the
return
values.
So
that's
the
only
real
specific
go
thing
about.
This
is
how
we
actually
annotate
it
to
say.
You
know
this
function
does
not
return
an
error.
You
can
provide
any
input
and
you
should
expect
it
to
return
safely.
A
So,
regarding
the
wraparound
thing,
I'm
pretty
sure
we
can't
do
that.
Go
is
pretty
strict
about
that.
For
a
reason
they
want
you
to.
Anyone,
make
sure
that
you're
doing
things
explicitly
I
think
you
can
find
that
in
the
the
go
spec
like
what
is
a
valid
index
for
the
start
and
ending
you
can
omit
the
ending.
You
can
provide
up
to
the
end
of
a
slice
but
I
think
if
you
go
beyond
it,
it's
gonna
complain
like
we
saw
earlier
any
other
questions.
A
A
I
have
another
program
called
magnet
that
will
do
like
the
windows
type
attaching
to
the
screen
and
splitting
it
in
half
and
stuff,
or
put
it
in
the
corner
and
doing
a
quarter
of
the
screen
automatically.
That's
another
thing:
if
you
don't
want
to
use
this,
because
this
only
does
two
apps
to
the
time.
A
Okay.
So
let's
take
a
look
at
the
other
problem.
I
think
we
still
have
some
time.
Let's
try
to
do
like
maybe
10
or
15
more
minutes,
and
then,
if
anybody
has
any
thing
they
want
to
talk
about,
go
in
general
and
talk
about
the
next
topic.
We
can
do
that,
so
we
did
the
split
slice.
The
next
step
was
the
recursive
split.
So
for
binary
search,
there's
two
ways
you
can
solve
the
problem.
A
You
can
do
an
iterative
approach
where
you
do
everything
in
one
function
or
you
can
do
a
recursive
approach
where
you
continually
call
the
same
function
over
and
over
again
with
a
smaller
problem.
Each
time
until
you
get
to
the
solution,
so
the
by
the
recursive
split
is
just
to
introduce
recursion
and
go
so
that
you
can
get
comfortable
with
it.
In
preparation
for
the
binary
search,
so
what
we've
got
here
for
the
set
up
is
that
we've
got
a
side
being
indicated
using
the
go
equivalent
of
an
enumeration.
A
So
if
you're
not
familiar
with
enumerations,
what
enumeration
is
is
a
bunch
of
it's
basically
a
set
of
constant
values
that
won't
change
throughout
your
program
and
you
can
use
that
to
indicate
like
a
set
of
finite
things.
So
in
this
case
we
have
a
set
of
sides.
So
aside,
really
under
the
covers
is
just
an
integer
and
we
have
constant
values
of
that
type
side
that
are
zero
or
so
actually
sorry.
This
is
one
and
two.
A
So
when
you
see
iota
inside
of
a
block
like
a
constant
block,
what
the
iota
is
saying
is
start
with
zero
and
then
for
every
successive
element
increment
by
one.
So
if
it's
first
zero,
then
that
means,
if
you
add
one
to
it,
it's
gonna
be
one.
This
is
a
little
confusing,
but
it's
kind
of
a
standard
thing
and
go.
If
you
look
at
enemies
and
constants
and
stuff,
they
use
this
all
the
time
throughout
the
standard
library,
so
I
would
just
recommend.
A
Looking
at
other
examples
of
how
people
do
it,
but
essentially
this
is
one-
this
is
value
two,
so
anybody
have
any
questions
about
that.
Okay,
so
then
the
next
thing
we
have
is
we
have
for
each
side.
It's
also
going
to
have
a
string
function.
This
is
just
purely
for
debugging
purposes.
So
if
you
want
to
print
what
side
you're
looking
at
instead
of
it
printing
out
one
or
two,
it's
gonna
print
out
left
or
right.
So
that's
just
handy
if
you
want
to
print
the
problem
out
and
kind
of
understand
where
you're
getting
stuck.
A
It's
always
good
to
have
good
logging
mechanisms
in
your
program
to
figure
out
where
you're
screwing
up
this
right
here
is.
We
have
a
type
called
next
side
and
next
side
is
just
really
an
alias
for
a
function
that
returns
aside.
So
that's
what
this
is
saying.
We
have
a
type
that
is
really
the
same
thing
as
a
function
that
returns
aside.
So
what
we're
gonna
do
is
in
the
the
problem.
A
The
the
code
that
we're
going
to
fill
the
implementation
for
the
test
is
gonna,
provide
to
us
a
function
and
we
don't
know
how
this
function
is
gonna
behave
like
it
could
be
behaving
randomly.
It
could
have
a
script
which
is
actually
what
it's
doing
or
it
could
be.
You
know
receiving
input
over
the
network
or
blah
blah
blah.
It
could
be
anything
all
we
know
is
that
we're
receiving
a
function
and
that
function
is
gonna
tell
us
what
direction
we
need
to
go
in
the
test
in
order
to
succeed
correctly
and
I'll.
A
Show
you
how
that
works,
and
then
here's
the
actual
function
that
we're
gonna
be
working
on
our
split
slice.
I
named
it
are
split
slice
because
the
the
R
is
for
recursive.
So,
and
you
see
that,
are
there
that's
what
it
means
so
we're
gonna
have
a
slice
provided
to
us
of
integers
and
then
we're
gonna
get
a
function
that
we're
gonna
repeatedly
call
to
figure
out
what
direction
we
go
next.
A
So
this
is
to
simulate
design
decision
making
in
an
algorithm.
So
in
the
binary
search
algorithm,
the
decision
making
is
decided
by
you
looking
at
the
element
that
you
inspected
the
middle
element-
and
you
say:
okay
I
either
need
to
go
left
or
go
right,
so
you're
making
the
decision
in
this
test
case
we're
kind
of
eliminating
that
logic,
so
that
we
can
just
focus
on
the
recursive
aspect.
So
this
function
is
going
to
tell
us
what
direction
we
want
to
go
so.
E
E
A
D
A
A
So
the
next
side
is
the
key
to
this.
The
next
side
is
going
to
tell
us.
Oh
actually,
let
me
really
directions
a
little
bit
more,
so
we
know
what
we're
trying
to
do
here.
So
our
split
slice
recursively
splits,
a
slice
in
the
specified
direction
until
there's
only
one
element
remaining,
you
will
determine
the
proper
direction
to
split
the
slice
by
calling
the
provided
function
and
s
so
before
we
can
go
left
or
right.
We
have
to
split
it
right
like
week.
A
A
So
if
we
have
a
two-element
list
and
we
say,
go
left
we're
gonna
get
the
one
value.
So
this
is
a
pretty
simple
case
of
splitting.
So
what
I
mean
by
that
is
that
we
did
a
complicated
case
just
for
fun.
So
we're
gonna
have
a
left
and
a
right
slice
and
the
left
side
is
going
to
be
from
0
to
the
length
of
s
divided
by
2,
and
then
the
the
other
value
is
going
to
be
from
length
of
s
divided
by
2
to
the
end
of
the
slice
like
that.
A
A
A
A
So
the
big
thing
that,
before
I
run
this
test
is
I,
want
to
make
sure
that
this
will
eventually
stop,
because
if
you
have
a
recursive
function
and
you
don't
have
a
way
for
it
to
stop,
it's
just
going
to
keep
recursing
over
and
over
again
infinitely
until
you
run
out
of
stack
space
and
then
it
just
the
whole
program
crashes.
So
what
is
our
base
case?
And
where
can
we
put
that
in
this
function?.
A
A
If
it's
equal
to
one
we're
just
going
to
return
that
value
okay,
so
the
idea
is
that
we're
splitting
splitting
splitting
and
then
eventually
we
have
one
element
and
that's
when
we
return
and
I
don't
think
we
need
to
have
this
case.
That'll
never
run
anything
else.
Look
funny
about
this
function,
I
guess.
A
A
A
D
A
A
A
A
A
And
then
else
we'll
just
have
the
right
and
that
should
simplify
quite
a
bit
there.
We
go
Oh
work
the
first
time.
Well,
the
second
time.
Technically,
oh
no
test
to
run
I
ran
it
written
correctly.
So
there's
a
typo
here.
Okay,
so
it
says
test
recursive
split
in
the
name
right
here
and
the
name
of
the
actual
function
is
tests
are
split
slice.
That's
why
it's
failing
it's
not
running
correctly,
so
as
a
false,
positive.
A
A
I,
don't
feel
like
I
feel,
like
a
child
who
put
me
in
charge:
yeah
I,
I.
Guess
it
just
worked,
we
did
it
cool
I,
don't
think
we're
gonna
have
enough
time
to
do
the
actual
binary
search.
So
I'll
just
save
that
for
next
week,
I
wanted
to
save
a
little
bit
of
time
to
hear
what
like
what
kind
of
concurrency
problems
people
are
interested
in
for
for
a
problem.
I
just
wanted
to
pick
like
maybe
one
problem,
and
then
we
could
try
live
code
in
it.
A
After
we
finish
up
the
the
binary
search,
anybody
have
anything
that
was
on
their
mind
regarding
concurrency
and
by
the
way
I
just
picked
up
this
book.
So
if
anyone
had
any
ideas
from
this
book,
I
just
got
it
yesterday,
so
I
haven't
read
it
yet,
but
if
you
have
any
ideas
from
this
book
or
have
not
purchased
it,
it's
been
recommended
by
a
number
of
people
in
the
company.
So
we
can
definitely
pick
something
from
here
or
pick
a
chapter
and
create
a
problem
around
that
and
we
won't
jump
in
there.
C
Maybe
we
do
something
like
like
paralyzing,
a
some
kind
of
parsing
I,
don't
know.
Sax
parser
would
be
like
way
out
of
way
more
complex
and
we
didn't
want
to
get
into,
but
yeah.
A
Ideally
want
to
reduce
the
amount
of
moving
parts
so
that
the
the
emphasis
is
on
the
actual
concurrency
aspect,
so
that
anyone
who
doesn't
know
anything
about
parsing
or
we
want
it's
a
very
simple
parser
right.
We
want
something
that
anyone
who's
new
to
go
can
pick
up
pretty
easily
within
the
course
of
a
one-hour
study
session.
Right
note.
B
A
Yeah
I
think
that's.
A
good
idea
is
to
just
kind
of
abstract
away
what
actual
work
is
being
done
just
so
that
we're
focused
on
the
coordination
of
that
work,
not
the
actual
work
itself,
because
it
with
concurrency
there's
two
problems
going
on
the
actual
work
being
done
and
how
you
coordinate
that
we
just
want
to
focus
on
one
of
them.
A
Yeah
so
I
think
simulating
the
work
is
the
the
nicest
thing
to
keep
the
the
test
code
and
the
implementation
code
clean.
So
it's
someone
can
look
at
the
full
thing
and
get
a
total
understanding
of
what's
going
on
if
we
have
to
bring
in
a
lot
of
external
libraries
to
do
complex
stuff,
it'll
be
it'll,
be
harder
for
a
someone
new
to
go
to
understand
it.
But
that
being
said,
it
would
also
be
cool
to
do
some
real
world
stuff
like
bring
in
a
web
server.
Do
something
over
the
network.
A
B
Love
to
see
the
difference
between
the
go
routines,
where
you're
waiting
on
specific
work
and
then
creating
like
some
sort
of
report
or
something
or
whether
you're
firing
off
much
go
routine.
So
you
don't
care
about
the
order
you
just
care
about.
You
know
providing
the
results
as
quickly
as
possible,
because
I
think
those
are
two
completely
different
methods
of
opera
down
co-routines.
B
C
A
F
A
Cool
I'll
add
these
discussion
points.
I
have
an
issue
open
for
concurrency
problems,
so
I'll
I'll
write
some
notes
on
there
and
when
I
have
a
free
moment,
just
like
everyone
else,
I
don't
have
very
much
many
free
moments.
I'll
try
to
think
of
what
would
be
a
good
problem
to
involve
these
different
ideas.
A
F
In
the
test
file,
where
you
kind
of
have
like
a
test
matrix
that
you
kind
of
build
up
and
then
run
all
the
other,
is
that
if
one
fails
do
any
of
the
others
run
or
they're
a
better
way
to
kind
of
get
an
idea
of
I,
think
that
makes
it
hard
to
find
out
which
condition
failed.
You
gonna
have
to
like
trace
it
back
to
one
of
the
definitions
or
logging
yeah.
A
So
the
way
this
so
this
specific
test,
the
are
split
slice.
It
will
actually
continue
to
run
if
the
error
was
caused
by
your
functions.
Outputs
and
I'll
explain
that
so
we
what
we're
doing
here
is
we
we
get
the
value
that
the
function
returned.
You
know
whether
that
value
was
1
or
4
3
that
that
value
is
returned
here.
A
Then
we
compare
that
against
what
we
actually
want.
You
know
we
want
3,
we
want
4
in
this
case.
We
want
1
in
this
case
and
then,
if
it
doesn't
match
what
we
do
is
we
call
error,
so
error
will
continue
running
the
test
until
the
test
is
done,
if
I
would
have
put
fatal,
like
you
have
over
here,
that
immediately
stops
the
test.
So
what
we're
gonna
have
if
we
had
a
single
failure,
is
we
would
have
had
this.
A
This
error
message
logged
in
the
test
and
then
it
would
continue
to
the
next
case,
so
that
does
what
you're
talking
about
where
it's
not
going
to
interrupt.
There
are
other
test
cases
so
that
you
can't
inspect
those
and
make
sure
that
you
right
about
some
assumptions
and
wrong
about
the
others,
so
yeah
that
that's
an
important
thing
to
do.
A
The
reason
why
I
use
fatal
here
is
that,
if
this,
if
this
ever
fails
this
next
side,
then
that
means
there's
a
problem
with
the
test
setup
and
not
really
the
implementation
under
test,
and
so
that's
why
I
put
a
fatal
here.
I
wanted
to
make
sure
that
this
wasn't
causing
problems
that
allowed
the
user
to
think
that
the
setup
was
correct,
I
think
that's.
Why
I
put
it
there
and
I?
Don't
really
remember
actually
to
be
honest,
so.
B
Earlier
you
had
a
test
that
failed
and
you
were
tracing
back
to
figure
out
which
test
case
it
was
that
had
failed.
This
was
in
the
prior
example.
Not
the
are
split
case.
How
did
you
determine
which
one
actually
failed,
because
in
my
mind,
I
would
think
like
adding
an
attribute
of
like
a
name
and
then
outputting
that
name
and
that
error
F
would
be
helpful,
but
you
have
not
done
so,
and
I
saw
you
try
to
figure
out
which
test
case
failed
and.
A
Yeah
I
think
that
was
this
test
case
or
something
similar
to
this,
where
we
had
a
panic.
What
I
was
doing
was
I
was
trying
to
look
at
the
the
panic
trace
here,
because
it
gives
you
these
line
numbers
on
where
the
panic
occurred.
So
you
can
see
here,
it's
got,
you
know,
line
27
line
52,
so
I
was
looking
at
the
corresponding
code.
In
that,
let
me
copy
this
really
quick,
so
I
don't
lose
it
and
then
I'll
go
over
here.
So
I
think
okay,
I
gotta
go
to
the
other
one.
A
A
We
wrote
the
error,
so
I
looked
at
that
first
to
see
if
that
provide
a
name
for
any
information,
and
it
didn't
and
then
I
realized
that
the
panic
is
causing
the
test
to
stop
proceeding,
because
we
don't
recover
from
that
panic
that
panic
is
causing
the
whole
thing
to
just
crash.
So
I
just
looked
at
how
many
test
cases
actually
ran
before
the
the
panic
occurred
and
so
I
see
here.
I
have
one
two
three
four
successful
test
cases
and
then
I
have
a
fifth
one.
A
So
there's
a
better
way
to
do
this
in
go.
There
are
sub
tests
that
you
can
do
so.
Each
one
of
these
could
have
been
a
sub
test
and
a
sub
test
gets
its
own
name
and
if
anything
fails
in
it,
it's
not
gonna
cause
the
other
ones
to
crash.
So
if
we
would
have
used
a
sub
test,
it
would
have
only
panicked
that
specific
test
case
and
the
other
ones
would
have
been
able
to
proceed.
So
that's
just
because
these
tests
are
simpler
than
they
should
be.
A
B
C
F
A
A
Ideally
what
you
do
is
you
have
like
one
big
struct,
where
you
have
like
each
each
instance
of
that
struct
is
like
isolated,
so
that
when
you
run
that
test
you're
only
operating
on
that
that
value
but
yeah,
sometimes
you
can't
do
that.
If
you've
got
some
like
helper
function
or
you
want,
you
have
something
expensive
like
I
know
in
the
giddily
codebase,
where
like
creating
repositories
and
you
creating
a
destroy
them
them
a
lot
and
sometimes
they're
created
once
in
one
location
and
then
copied
somewhere
else.
A
You
don't
have
to
clone
it
over
and
over
again
and
there's
some
shared
state
there,
but
we
have
like
helper
scripts
to
help
with
that.
So
there's
a
little
complexity
added
in,
but
yeah
there's,
that's
something
you
should
always
worry
about
is
contaminating
tests
but
yeah.
This
is
what
it
looks
like
you
just
call.
This
little
closure
wrapper
right
here,
so
you
provide
your
your
test
as
a
closure
right
here
and
then
it
runs
it.
So
if
a
panic
occurs
in
here,
it's
only
gonna
cause
this
sub
test
to
fail.
That's
how
that
works.