Maxima abortion's shortcut after a syntax error - maxima

I apologize for this trivial question. Sometimes, after a syntax error, I am unable to return to Maxima's command prompt.
For example, after
2+2;]
how to return to the normal Maxima prompt without closing the terminal?
Ctrl-c does not work. Ctrl-z does not work. Indeed after Ctrl-z then pressing Enter, we return to Maxima prompt, but I am unable to execute commands, even 2+2; does not work.
To be precise, I work under Windows, and use Maxima, command line version.

Related

Getting `spss.Submit` to log commands into the `output` window?

When I execute spss syntax commands from a .sps script, each command is written to the output window before it executes giving me a clear log of exactly how an output was created.
Even if the command is an INSERT command executing a different script - I get a log of the commands from that script.
This is very useful for many reasons:
sanity checking - I can always see exactly what went in to creating a specific output (which filters I used, etc.)
recreation - I (or someone else with this output) can easily re-run the same commands because they're right there.
debugging - if there's an error, I can see which commands caused it
However, when I run commands using spss.Submit inside a python block (in a BEGIN PROGRAM-END PROGRAM block), the actual commands called aren't logged into the output window.
I know I can find a full log in a log file - but that's not helpful.
Is there a way to tell spss to continue to log all the commands in the output window?
You can use set mprint on. before the begin program statement to have the syntax that is run via spss.Submit()show up in the output window. I like simpy putting it on the very top of my syntax file as a "set it and forget it".
For example like so:
set mprint on.
begin program python3.
import spss
vars = list(range(1,11))
for var in vars:
spss.Submit(f'compute v{var} = 0. ')
end program.

"** exception error: undefined function add:addfunc/0 in Erlang "

I'm trying to execute a simple erlang program of adding two numbers.
I'm trying to do this in Eclipse on Ubuntu 10.04 LTS.
When i execute this program, I'm getting the error as shown below:
** exception error: undefined function add:addfunc/0
How do i go about solving this error? Thanks in advance.
This program when executed in the erlang shell is working fine. But when it comes to eclipse it's giving me this error. Not this, any program for that matter is giving me the similar error. Guess I would be missing something about the eclipse configuration.
EDIT:
Anyways, This is the sample add program,
-module(add).
-export([addfunc/0]).
addfunc() ->
5 + 6.
This message tells you that module add doesn't have an exported function addfunc/0.
Ensure the function you want to be called has exactly that name, doesn't expect any
parameters, is
exported, the module is
compiled, the search path includes the compiled beam file and that there is no module clashes using code:clash()
Update
It's not clear how erlide (eclipse erlang plug-in you seem to use) compiles and runs a program. Try to compile source using erlc or inside erl shell. That way you'll have much easier controllable environment and you'll better understand what's going on.
I got exactly the same problem -for a tail recursive fibonacci function- below:
-module(math2).
-export([fibonacci/1]).
fibonacci(0) -> 0;
fibonacci(1) -> 1;
fibonacci(M) -> fibonacci(M-1) + fibonacci(M-2).
In the end, had realized that this is a compile-time exception. Then, have opened a new tab on my shell and tried with erlc, instead of erl.
$ erlc math2.erl
Now I am also able to see math2.beam file created.
Called fibonacci with 10:
4> math2:fibonacci(10).
55
and it worked!
I think you have not compiled the code and you are trying to run the program.
In eclipse, using the "Run" icon, trigger the run; which will get you to the erl shell in the console window.
There you do -
cd("C:\Learning_ERL\src").
And you should see output like-
(Learning-ERL#DALAKSHM-MNFSM)7> cd("C:\Learning_ERL\src").
c:/Learning_ERL/src
ok
Then compile the code -
c(add)
you should see something like this on the erl shell-
(Learning-ERL#DALAKSHM-MNFSM)10> c(add).
{ok,add}
Now you should be seeing a new file called - add.beam in the same directory as that of your erl source file - add.erl
add.beam is a bytecode file
Now you should be able to run the program without any error
How do you try to execute your code?
In your editor, right-click and choose "Run as"->"Erlang application". The VM that is launched will have your project loaded automatically and when editing/saving a file it will get reloaded. When launching, a console appears and you can call your code from there.
If it still doesn't work, what message do you get for m(add).?

interrupting lua interpretation without ctrl -c quitting

I am running code from the book programming in Lua... http://www.lua.org/pil/3.6.html
when I run this code in the terminal interpreter... it continues reading input forever...
list = nil
for line in io.lines() do
list = {next=list, value=line}
end
Ctrl C returns me to the prompt/bash. Is there another command to break? How do I break/return from a chunk of lua code without exiting the interpreter?
By pressing Ctrl-C in a Unix-like system, you are sending your process the signal of SIGINT, which by default will terminate the process.
Your program continues reading from input forever because it's blocking in the call of io.lines(), which keeps reading from standard input. To interrupt it, send your terminal an EOF, this is done by pressing Ctrl-D in a Unix-like system.
On Windows, the key to send EOF is Ctrl-Z.
You can indicate the end of input for stdin by using either Ctrl-Z or Ctrl-D.
CTRL-U deletes all the characters before the cursor position, therefore the whole line. It also works like this in a Linux shell.

How do I Quit IRB from the command line? (Using terminal on mac)

Basically, I'm typing along just fine in terminal, using IRB to run ruby commands:
2.0.0-p0 :014 > bank_account.withdraw(2222)
=> -1222
But sometimes I accidentally miss out a quotation mark.
2.0.0-p0 :020 > BankAccount.create_for("Jim","Johnson)
2.0.0-p0 :021"> bank_account.withdraw(333)
If you look carefully, you'll see that the speech mark I missed out appears next to the line number on the left, next to the patch version.
From here on in, that speech mark appears everytime I run a command! And it stops the commands working:
2.0.0-p0 :021"> BankAccount.create_for("Julian","Hurley")
2.0.0-p0 :022"> BankAccount.create_for("Katt","Smith")
2.0.0-p0 :023"> exec($0)
What I want to know is, how do I get rid of that quotation mark? Or quit IRB from the command line in order to reset it?
If you haven't closed a quote, just put a quote in and hit return.
Exiting from the console can be done by typing exit, though in the circumstance your are would need to hit Control - C
Control - C followed by Control - Z.
I hope it helps!
I was having the same problem. To exit irb within the terminal, type exit.
Use Ctrl-D, it is an end-of-input for irb. If you are in the middle of some command, use Ctrl-C first to terminate the input of this command.
Type quit() and hit Enter to exit ruby.
If you're in the middle of a multi-line block (according to the interpreter), hit Ctrl+C to break out of it.
Then you can do any of the following to quit:
exit (or exit())
quit (or quit())
irb_exit (or irb_exit())
Ctrl+D (sends the EOF character)

Using pfccomp or pint to run Pascal-FC programs

I'm using the Pascal FC implementation for Windows Vista found on http://www-users.cs.york.ac.uk/burns/pf.html
I'm trying to run the dining philophers problem found on the link but I don't get how to make the compiler work.
Screenshot
In the screen shot, the program appears to be waiting for you to enter the name of the file to use for the compiler output. Enter a file name.
Better yet, use the pfc.bat command and let it choose the output names for you. The batch file will also run the program automatically after it has been compiled. At the command prompt, run the command like this:
C:\pascalfc-vista> pfc philchan.pas

Resources