Interactive Development F #

Based on the background of Matlab and R, where the development process is very interactive (select, run selection, correct, select, run selection, fix, etc.), I am trying to understand how F # handles this style of development, which seems very important in scientific applications. Here are a few things that immediately come to mind for someone new to F #:

  • Selecting multiple rows gives different results than one row at a time.

    let add x y = x + y
    add 4.1 2.3
    

    Selecting both rows yields float -> float -> float, while selecting the first row yields int -> int -> int. More generally, Matlab / R users are used to print the results after each statement, rather than at the end.

  • Shadow copying can become burdensome.

    let file = open2GBfile('file.txt')
    process file
    

    If you run it interactively over and over, a 2GB file is copied with a tap and you will quickly run out of memory. Creating a mutable file does not seem like a suitable solution, since the final launch of the program will never change it.

Given these problems, is it not possible for a system based to fsi.exesupport Matlab / R-style interactive development?

[Edit: I guess that 2. For objects marked for deletion as soon as they are shaded?]

+3
source share
2 answers

, F # Matlab/R, F # . , , . , " ", , , , .

# 1, , , , , inline " " .

# 2 , open process, , . , open :

  • , //etc,
  • FileStream, process, .
  • ,
  • ,
  • gazillion .

, . Matlab R, , F #, . , .

+4

# 1

FSI ;; :

> 1 + 2;;
val it : int = 3

F # -Codefile , , , .

# 2:

, -, : file , / , ( let ).

+1

Source: https://habr.com/ru/post/1721631/


All Articles