Question

Is there any way of persisting my F# session or serializing it into a file? i.e. so I can hand it to a friend and say "run this" and they will be at the same place I was? I know forth had this ability but I can't find any way of doing this.

An alternative would be a log file or something of similar ilk, but ideally it would strip the output and just give me the code I wrote.

On the topic of user questions, is there a config file for F# so I can add some "always includes" or alter the defaults?

Was it helpful?

Solution

There is no way to serialize the F# Interactive session or create some log of commands automatically.

The typical user interaction is that you write all your code in F# Script File (.fsx extension) and evaluate code by selecting lines and sending them to F# Interactive using Alt+Enter. If you work like this, then the F# Script File is a bit like log of your work - and you can easily send it to other people.

The good thing about this approach is that you can edit the file - if you write something wrong, you can correct it and the wrong version will not appear in the log. The bad thing is that you need some additional effort to keep the source file correct.

Regarding automatic inclusions - you can specify options for fsi.exe in Visual Studio Options (F# Tools). The --load command line parameter can be used to load some F# source at startup.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top