You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a lab session where the students need to enter some data. Before, we were using "read_int()" for that, but in ocaml_top it seems to hang, waiting for the input.
Is there a way to give some input to a program? Maybe by opening a dialog box?
The text was updated successfully, but these errors were encountered:
It would be problematic to allow one to send the input directly to the stdin of ocaml (which is where read_int() reads from), because this is the same channel that is used to send it the source code, and there is no easy way to delimit different kinds of input (ie ocaml-top has no way to know that it's your script reading an int and not the ocaml toplevel). Using different inputs, or a socket, could help, but we want ocaml-top to remain compatible with any external top-level.
So re-defining read_* functions to trigger a different means of input sounds like the way to go ; we already redefine output functions anyway (so that your program's output and ocaml's can be recognized).
I'll see what can be done; opening a dialog box would be nice but requires a GUI lib to be available from the toplevel so that will be difficult to keep portable.
Hello, basically, in your console, if you type let x = read_int();; , you will be prompted for input. If you enter an integer, then, the value of x will become the value you entered.
I have a lab session where the students need to enter some data. Before, we were using "read_int()" for that, but in ocaml_top it seems to hang, waiting for the input.
Is there a way to give some input to a program? Maybe by opening a dialog box?
The text was updated successfully, but these errors were encountered: