In [52]:
using GeometryTypes
mutable struct Node
id::Int64
parentID::Int64
state::Point{2, Float64}
cost::Float64
Node(id::Int64, state::Point{2, Float64}) = new(id, -9999999, state, -9999999) #todo do this with outer constructors?
Node(id::Int64, parentID::Int64, state::Point{2, Float64}) = new(id, parentID, state, -9999999)
Node(id::Int64, parentID::Int64, state::Point{2, Float64}, cost::Float64) = new()
end
In [3]:
struct LSD
pounds::Int
shillings::Int
pence::Int
function LSD(a, b, c)
if a < 0 || b < 0
error("no negative numbers")
end
if c > 12 || b > 20
error("too many pence or shillings")
end
new(a, b, c)
end
end
In [55]:
Node(1, 3, Point(2.,3.), 34.)
Out[55]:
In [102]:
x = [1 3 4 2 10]
findfirst(x) do y
z = y+2
z > 3
end
findfirst(y -> y>2, x)
Out[102]:
In [97]:
a = Point(2,3)
b= Point(3,4)
c= Point(5,10)
alist = [a b c]
foo =3
findfirst(alist) do pt
a = pt[1]
a == foo
end