Skip to content

Commit

Permalink
Removed another duplicated method
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRT committed Jan 10, 2024
1 parent aa75616 commit b0bbe32
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/dangerous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function listReverseInPlace(inList::List{T})::List{T} where {T}
MetaModelica.listReverse(inList)
end


function listReverseInPlace2(inList::Nil)
return inList#MetaModelica.listReverse(inList)
end
Expand Down Expand Up @@ -76,15 +75,15 @@ function listReverseInPlace2(lst::Cons{T}) where {T}
end


"""
O(1). A destructive operation changing the \"first\" part of a cons-cell.
TODO: Not implemented
"""
function listSetFirst(inConsCell::Cons{A}, inNewContent::A) where {A} #= A non-empty list =#
firstPtr::Ptr{A} = unsafe_getListAsPtr(inConsCell)
#local newHead = Cons{T}(inNewContent, inConsCell.tail)
# unsafe_store!(firstPtr, inNewContent)
end
# """
# O(1). A destructive operation changing the \"first\" part of a cons-cell.
# TODO: Not implemented
# """
# function listSetFirst(inConsCell::Cons{A}, inNewContent::A) where {A} #= A non-empty list =#
# firstPtr::Ptr{A} = unsafe_getListAsPtr(inConsCell)
# #local newHead = Cons{T}(inNewContent, inConsCell.tail)
# # unsafe_store!(firstPtr, inNewContent)
# end

""" O(1). A destructive operation changing the rest part of a cons-cell """
#= NOTE: Make sure you do NOT create cycles as infinite lists are not handled well in the compiler. =#
Expand All @@ -105,15 +104,15 @@ function listSetRest(inConsCell::Cons{A}, inNewRest::Nil) where {A} #= A non-emp
GC.@preserve unsafe_store!(lstPtr, Cons{A}(inConsCell.head, inNewRest))
return inConsCell
end

""" O(1). A destructive operation changing the \"first\" part of a cons-cell. """
function listSetFirst(inConsCell::Cons{A}, inNewContent::A) where {A} #= A non-empty list =#
@assign inConsCell.head = inNewConent
end

"""
O(1). A destructive operation changing the rest part of a cons-cell
NOTE: Make sure you do NOT create cycles as infinite lists are not handled well in the compiler.
"""
O(1). A destructive operation changing the rest part of a cons-cell
NOTE: Make sure you do NOT create cycles as infinite lists are not handled well in the compiler.
"""
function listSetRest(inConsCell::Cons{T}, inNewRest::List{T}) where {T} #= A non-empty list =#
@assign inConsCell.tail = inNewRest
Expand Down

0 comments on commit b0bbe32

Please sign in to comment.