如何加载外部F#脚本文件并在F#交互式中使用它? [英] How to load external F# script file and use it in F# interactive?

查看:82
本文介绍了如何加载外部F#脚本文件并在F#交互式中使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个或多个.fsx文件加载到F#交互式程序中,并在范围内具有.fsx文件中定义的所有功能,以便我可以直接在控制台中使用这些功能.

I would like to load one or more .fsx files into the F# interactive and have all the functions defined in the .fsx files in scope so that I can directly use the functions in the console.

#load指令执行指定的.fsx文件,但随后我不再能够在.fsx文件中使用这些功能.任何解决方法?谢谢.

The #load directive executes the .fsx file specified, but then I am no longer able to use those functions in the .fsx file. Any workaround for this? Thanks.

推荐答案

我怀疑您正在加载的脚本不在某个模块中,这可能会导致您的问题.只需添加

I suspect that the script you are loading is not in a module which may be causing your problem. Just add

module Script1

在第一个脚本中,然后您就可以

in the first script and then you can do

#load "Script1.fsx"
open Script1

您的功能将可用

这篇关于如何加载外部F#脚本文件并在F#交互式中使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆