@@ -967,8 +967,11 @@ string_to_varname(str::AbstractString) = dict_to_varname(JSON.parse(str))
967967
968968Get the innermost layer of an optic. 
969969
970+ For all (normalised) optics, we have that `normalise(_tail(optic) ∘ 
971+ _head(optic) == optic)`. 
972+ 
970973!!! note 
971-     Does not perform optic normalisation. You may wish to call 
974+     Does not perform optic normalisation on the input . You may wish to call 
972975    `normalise(optic)` before using this function if the optic you are passing 
973976    was not obtained from a VarName. 
974977
@@ -999,8 +1002,11 @@ _head(::typeof(identity)) = identity
9991002
10001003Get everything but the innermost layer of an optic. 
10011004
1005+ For all (normalised) optics, we have that `normalise(_tail(optic) ∘ 
1006+ _head(optic) == optic)`. 
1007+ 
10021008!!! note 
1003-     Does not perform optic normalisation. You may wish to call 
1009+     Does not perform optic normalisation on the input . You may wish to call 
10041010    `normalise(optic)` before using this function if the optic you are passing 
10051011    was not obtained from a VarName. 
10061012
@@ -1031,8 +1037,11 @@ _tail(::typeof(identity)) = identity
10311037
10321038Get the outermost layer of an optic. 
10331039
1040+ For all (normalised) optics, we have that `normalise(_last(optic) ∘ 
1041+ _init(optic)) == optic`. 
1042+ 
10341043!!! note 
1035-     Does not perform optic normalisation. You may wish to call 
1044+     Does not perform optic normalisation on the input . You may wish to call 
10361045    `normalise(optic)` before using this function if the optic you are passing 
10371046    was not obtained from a VarName. 
10381047
@@ -1063,8 +1072,11 @@ _last(::typeof(identity)) = identity
10631072
10641073Get everything but the outermost layer of an optic. 
10651074
1075+ For all (normalised) optics, we have that `normalise(_last(optic) ∘ 
1076+ _init(optic)) == optic`. 
1077+ 
10661078!!! note 
1067-     Does not perform optic normalisation. You may wish to call 
1079+     Does not perform optic normalisation on the input . You may wish to call 
10681080    `normalise(optic)` before using this function if the optic you are passing 
10691081    was not obtained from a VarName. 
10701082
@@ -1084,7 +1096,9 @@ identity (generic function with 1 method)
10841096julia> AbstractPPL._init(Accessors.@o _) 
10851097identity (generic function with 1 method) 
10861098""" 
1087- _init (o:: ComposedFunction{Outer,Inner} ) where  {Outer,Inner} =  _init (o. outer) ∘  o. inner
1099+ #  This one needs normalise because it's going 'against' the direction of the
1100+ #  linked list (otherwise you will end up with identities scattered throughout)
1101+ _init (o:: ComposedFunction{Outer,Inner} ) where  {Outer,Inner} =  normalise (_init (o. outer) ∘  o. inner)
10881102_init (:: Accessors.PropertyLens ) =  identity
10891103_init (:: Accessors.IndexLens ) =  identity
10901104_init (:: typeof (identity)) =  identity
0 commit comments