Collections

All 26 tested collection functions compile and produce correct results, verified with Vector{Int64} and Vector{Float64}.

Supported Functions

FunctionPathNotes
sort, sort!OverlayFull kwarg support (rev=true)
filterOverlayPredicate closures
mapNativeClosures compile correctly
reduce, foldl, foldrNative
sum, prodNative
minimum, maximum, extremaNative
any, allNativePredicate closures
countOverlay
uniqueOverlay
accumulateNative
findmax, findminNative
argmax, argminOverlay
mapreduceNative
foreachOverlayRef mutation pattern
reverse (Vector)Native

Example

using WasmTarget

f_sort(v::Vector{Int64}) = sort(v, rev=true)
f_filter(v::Vector{Int64}) = filter(iseven, v)
f_map(v::Vector{Int64}) = map(x -> x * 2, v)

bytes = compile_multi([
    (f_sort, (Vector{Int64},)),
    (f_filter, (Vector{Int64},)),
    (f_map, (Vector{Int64},)),
])

Compositions

Functions compose correctly across native and overlay paths:

# 8-deep chain — all verified E2E
f(v::Vector{Int64})::Int64 = sum(unique(sort(filter(x -> x > 0, map(abs, accumulate(+, reverse(v)))))))

Array Mutation

All 16 mutation functions work via overlays:

push!, pop!, pushfirst!, popfirst!, insert!, deleteat!, append!, prepend!, splice!, resize!, empty!, fill!, copy, reverse, length, vec