VBScript で関数型プログラミング

Eval マンセー
もっと汎用的な方法、堅牢な方法があったら教えてください。


Functional.vbs

Function FMap(Collec, Func)
    Result= Array()
    For Each e In Collec
        ReDim Preserve Result(UBound(Result) + 1)
        Result(UBound(Result)) = Eval(Func & "(e)") 
    Next
    FMap = Result
End Function

Function Plus1(x)
    Plus1 = x + 1
End Function

Sub FMap_Test()
    a = Array(1,5,6)

    hoge = FMap(a, "Plus1")

    For Each e In hoge
        MsgBox e
    Next 
End Sub

Call FMap_Test()

Function FFilter(Collec, Func)
    Result = Array()
    For Each e In Collec
        If Eval(Func & "(e)") Then
            ReDim Preserve Result(UBound(Result) + 1)
            Result(UBound(Result)) = e
        End If
    Next
    FFilter = Result
End Function

Sub FFilter_Test()
    a = Array(1,5,6)
    hoge = FFilter(a, "3 <")
    For Each e In hoge
        MsgBox e
    Next 
End Sub

Call FFilter_Test()