Skip to content

Commit

Permalink
Fix length for BasicSymbolic
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenszhu committed Sep 16, 2024
1 parent 8870978 commit 8d18d9d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ Base.length(l::LL) = length(l.v)-l.i+1
@inline car(l::LL) = l.v[l.i]
@inline cdr(l::LL) = isempty(l) ? empty(l) : LL(l.v, l.i+1)

Base.length(t::BasicSymbolic) = length(arguments(t)) + 1 # PIRACY
function Base.length(t::BasicSymbolic)
@match t.impl begin
Term(_...) => length(arguments(t)) + 1 # PIRACY
_ => 1
end
end
Base.isempty(t::BasicSymbolic) = false
@inline car(t::BasicSymbolic) = operation(t)
@inline cdr(t::BasicSymbolic) = arguments(t)
Expand Down

0 comments on commit 8d18d9d

Please sign in to comment.