Can I #load other code files in my tryfsharp.org script?

Answered Can I #load other code files in my tryfsharp.org script?

  • Sunday, January 27, 2013 7:07 PM
     
     
    Can I use #load or something similar to load other tryfsharp.org hosted fsx files into my current script?  Or does all the code have to be in the one script?

All Replies

  • Monday, January 28, 2013 1:24 AM
     
     Answered

    You can use #load to load scripts saved on the server at tryfsharp.org by using:

        #load "<nickname>/<filepath>"

    where <filepath> is the complete name of the file from a user with the given <nickname>.

    For example, take the following file http://www.tryfsharp.org/create/cpoulain/msdn/load1.fsx which defines a simple module:

        namespace foo

        module bar =
            let f x y = x + y

    Then from another script, you could do:

        #load "cpoulain/msdn/load1.fsx"
        open foo
        bar.f 1 2

    (as shown here http://www.tryfsharp.org/create/cpoulain/msdn/load2.fsx ).

     



    • Edited by cpoulain Monday, January 28, 2013 1:25 AM
    • Edited by cpoulain Monday, January 28, 2013 1:25 AM
    • Marked As Answer by jbuedel Monday, January 28, 2013 3:03 PM
    •