hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

FLisp

Last post 07-02-2007, 14:04 by norberts. 1 replies.
Sort Posts: Previous Next
  •  03-02-2007, 5:20 2102

    FLisp

    Hi!

    I'm working on a Lisp dialect in F# and I have a problem. There is a strange bug. I'm working on a rule processing engine which will be based on the progn command. Rules would be functions created with the fun command.

    If I evaluate the following expressions, one of them has a correct result the othes does not. The evaluation of the progn command is correct if the first argument is not function creation. Also function creation works fine in other places.

    Code for the progn operation:

    let expr_op_progn (expr : Expr list) (ctx : Context) =

    ExprList( List.map (fun l -> eval ctx l |> fst) expr ) ;;

    Exmple:

    let fun_test = prase_expr "( progn ( + 3 1 )

    ( fun () ( + 3 14 ) )

    ( - 3 2) )" ;;

    let fun_test1 = prase_expr "( progn ( fun () ( + 3 14 ) )

    ( - 3 2) )" ;;

    Function creation is the second argument.

    let a,b = eval initial_ctx fun_test ;;

    The result expression is correct:

    ExprList [ExprInt 4; ExprFunction <fun:expr_spec_fun@65>; ExprInt 1]

     

    Function creation is the first argument.

    let d,c = eval initial_ctx fun_test1 ;;

    The result expression is incorrect: ExprInt 17

     

    I would upload or attach the code for the Lisp implementation if someone specifies where...

    Thanks in advance.

     

  •  07-02-2007, 14:04 3309 in reply to 2102

    Re: FLisp

    Hi!

    I've hate to see unanswered posts :) ... so I just want to report that the problem has been solved a couple months ago... It was a nasty bug in the evaluation function.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems