question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Execute pipes line by line in fsi

See original GitHub issue

Is your feature request related to a problem? Please describe.

When writing pipelines in fsi, they have to be executed as a single unit:

1   values
2   |> fun1
3   |> fun2

You need to select lines 1 to 3 to execute it, but you cannot execute line 1, then 2, then 3.

Describe the solution you’d like

It would give more flexibility to execute lines one by one. When a line starts with |>, it would interpret it as

it |> fun1

Executing the previous script line by line would be interpreted as:

let it = values
let it = it |> fun1
let it = it |> fun2

Describe alternatives you’ve considered

Continue to select multiple lines, but it’s easy to forget and get an error at execution.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aboniecommented, Dec 7, 2022

Thanks, I think I understand the general idea. I doubt it is worth it though, but perhaps someone will want to take a stab at it.

My main concern is that this behavior would not always be desirable, and hence it will be tricky from UI perspective.

And on the other hand, it is fairly easy to achieve something like this already, by selecting only part of the pipeline expression to send to FSI (and taking advantage of the fact that alt+enter appends to whatever has already been typed in FSI, i.e. you can type it and then select |> fun2 in source and hit alt+enter, which will result in executing it |> fun2).

0reactions
smoothdevelopercommented, Dec 7, 2022

One concern I see with such feature (which could be handy) is that I’d expect it to work for multiline expression that start with the prefix operator, without having to define the selection properly:

a
|> doSomething (fun b -> // evaluating on this line would also need to do the selection till the next pipeline
       ...
    )
|> ...

To nail it perfectly is probably not as simple as it seems, and we end up still needing to rely on user being mindful with how the interpreter is used across several individual evaluations, it won’t change this fact drastically IMO.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bash - Execute a command once per line of piped input?
The accepted answer has the right idea, but the key is to pass xargs the -n1 switch, which means "Use at most 1...
Read more >
ANSYS 2020 Tutorial: 2-Way FSI of a Pipe Bend - YouTube
I will show you how to create the pipe bend geometry using SpaceClaim, ... If you need to make changes and run the...
Read more >
How to use stdin pipe with fsharpi (fsi) and mono
actually i am not compiling fsharp code in order to execute it - the host process runs my own compiler (in fsi) for...
Read more >
Pipe flow FSI using OpenFOAM and CalculiX
Hello, I want to perform 2D FSI simulation with Calculix, I saw the test case of the perpendicular flap where the mesh provided...
Read more >
Working with pipes on the Linux command line
The pipe takes output from one command and uses it as input for another. And, you're not limited to a single piped command—you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found