This question already has answers here:
Go back to last state
(2 answers)
Closed 8 years ago.
I would like to save the state of a Lisp compiler so that I need not load my file in several minutes, but instead I would load that image in seconds.
Which Common Lisp compiler would do this favor for me?
I came to this idea as Standard ML of New Jersey does this: Exporting Heaps.
I could not find similar in the sbcl manual or the
ecl manual.
With SBCL, use save-lisp-and-die. To restart the image, use the --core arguments.
Read carefully the caveats in the documentation.
With CLISP, use EXT:SAVEINITMEM
Related
This question already has answers here:
Common Lisp equivalent to C enums
(3 answers)
Closed 2 years ago.
I've been learning Common Lisp this week, toying a bit with it. As an exercise, I would like to translate some Haskell code I had written to simulate balanced ternary. The core of it is the type:
Data Trit = Pos | Neutr | Neg
How do I declare a type of that kind in Lisp? The idea is that this type should only have three possible values.
In Common Lisp programs, you will simply use symbols 'Pos, 'Neutr and 'Neg.
If you really need a specific type, you could refer to:
Common Lisp equivalent to C enums but I would suggest to keep it simple and stay with 'Pos, 'Neutr and 'Neg.
This question already has answers here:
How do I count the characters, words, and lines in a file, using Perl?
(10 answers)
Closed 4 years ago.
How do I find out linecount in perl similar to what wc -l gives me. A method preferably that doesn't require reading the whole file.
This question is way too broad and un-specific. But as it is based on an often seen misconception I'd like to comment on that.
A file is a sequence of bytes with no notion of "lines." The lines that we see when a file is displayed are determined by a particular character (or a short sequence of characters) in the file, denoting a "linebreak" to be used by software that views or edits the file. They are not a property of a file that one can just look up as metadata.
So you have to read the whole file in order to determine how many "lines" it has.
This can be done using native tools in a language or by running an external utility which does this, like wc. I'd recommended to do it using Perl in a Perl program, since the job fits squarely within Perl's most common uses. Then there are a number of ways to do this but we'd need to see your code in order to offer a specific recommendation.
This question already has an answer here:
Emacs cc-mode indentation problem with C++0x enum class
(1 answer)
Closed 4 years ago.
I found a problem with the emacs cc-mode. Unfortunately, whenever I am trying to initialize an object with an initializer list that spans multiple lines, I receive the following indentation style:
S<int> s = {
1,
2,
3
}
I would prefer to have all elements to be indented with the equivalent spacing on every line. Does anyone know how this can be achieved?
The problem was that up until recently C++11 List initialisation hadn't been implemented, so CC Mode was struggling. It now has been implemented.
There are three strategies for getting the new code, in order of increasing rapidity and increasing work:
1/- Wait for the code to be released in Emacs, probably in version 25.2. (several months', to over a year's wait).
2/- Wait for the code to be released in CC Mode in release 5.33.1. (Several week's wait). This will then be downloadable from http://cc-mode.sourceforge.net/release.php.
3/- Download the up to date source code repository version from CC Mode. (Instantaneous). Instructions can be found on http://cc-mode.sourceforge.net/hgaccess.php.
This question already has answers here:
How to execute multiple statements in a MATLAB anonymous function?
(5 answers)
Closed 7 years ago.
Is it possible to create multiline anonymous function in Matlab?
There are no appropriate examples in documentation, but also no direct denials. In web discussions I found some derisions of askers as if it silly wish. Nowadays, when most languages introducing lambda expressions with multiline capability this looks strange.
No, unfortunately this is not possible.
This question already has answers here:
How can I generate a list of function dependencies in MATLAB?
(2 answers)
Closed 8 years ago.
Assume I have written two MATLAB functions foo.m and bar.m
I want to know if foo.m calls bar.m
I tried using depfun and listing dependencies and checking if bar is a member. It didn't work.
It seems depfun only returns builtin functions.
Is there a way around this when bar.m is not a built in function?
There are various techniques listed in the documentation to identify file dependencies, one of them should do the trick.
Note: the techniques listed in the documentation page I mentioned are for the latest release R2014b, they may not all be available in earlier releases.