As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm sure there must be something like this somewhere but I can't seem to find anything useful on here or Google. I had hoped Boost might have something but alas not.
What I'm after is a lightweight library that can take a string from the user, for example "y=2x+3" and parse it returning an object or function which returns y when given x.
Can anybody recommend something for this? (Worst case I could write one myself but no point reinventing the wheel and all.)
Things which can be assumed if necessary;
Preset variable names
Number of variables fixed
MuParser is all you ever could wish for. You can even define custom operators, store and evaluate the expressions in binary form, etc... Written in C++, bindings for C and C# (and maybe even other languages).
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I was just wondering if there is any free software out there that is able to effectively minimize regular expressions.
You see this question being asked a lot but I haven't seen an effective one anywhere. If you think though the logic required just to simplify something simple like character ranges in a character class - and the fairly low value of doing something like that I think the lack of these begins to make sense.
As another example, how do you remove unneeded groupings when you don't know how they might be used in a replacement string. I would think any simplification that could be achieved would be mostly superficial.
This guy wrote one in Haskell but didn't share: http://community.haskell.org/~ndm/resimplify/
(PS: I sort of lied - there is one effective Regex simplification tool... The mechanical turk that is Stack Overflow :)
I think I found one located here: http://regexvisualizer.apphb.com/?Regex=%28a%2Bb%2Bc%2B%29%2B%7Cabc&NfaSize=300&DfaSize=250#
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I remember reading in Hacker News about a modern C-like language with pretty nifty features, but I can't find it again. The name I can evoke is "C9", but that's not yielding search results.
It was pretty much a superset of C, with multi-pass compilation (and thus, no need for headers and forward declarations) and namespaces, as well as dynamic array syntax and string handling sugar.
I'm about to embark in a low-level project, and this would be a fantastic opportunity to try it out. My C is a bit rusty, I'm afraid, after years of python and coffeescript, so it would surely come in very handy.
Any hope somebody in SO has heard about it, or a similar project?
I think I read the same article. It sounds like C2, including the multi-pass parsing.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
How could I embed or associate an .exe into an ordinary file, like .jpeg or any video etc.
? I want to associate the opening of the ordinary file with the execution of an executable program.
What you're trying to do is intended not to be possible. If and when it does happen, it takes place by exploiting a flaw in the program reading the file. This might take place (this is more common when the program is written in C or C++) by storing out-of-range values in the headers and hoping the program does not validate them before using them as offsets in memory, or (this is more common in higher-level languages) by taking advantage of a logical error in some overgrown feature the format intentionally allows (like embedding javascript).
Beyond this, I think any further answer is off-topic on SO. This is not a site for getting help writing malware.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
As title, I am confused about this. swap should be extremely useful if we are facing an iterative problem. The old vector and the new vector can be swapped by exchanging pointer-to-memory instead of contents. However, this is valid in std::vector but not in std::valarray. I am wondering why. In C++0x it seems the function is added, but why not in C++03?
Because it doesn't.
I doubt there is a much better answer than that. Omissions and mistakes happen (see also std::vector::resize taking its second argument by value, the missing std::copy_if algorithm, and the very long list of closed Standard Library defects).
It's a good thing that the language continues to evolve and that mistakes like this can be rectified in future revisions of the language specification (like C++0x).
Because you didn't suggest it to the language committee.
As soon as you build your time machine, and deliver your request sufficiently far in advance of the standard's publication date for it to be included, C++03 will have it as well.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Does anyone know of a really rock solid C++ library for suffix tries? Other than the one in Mummer?
Ideally, I'd like:
Some concept of concurrency.
Good caching behavior.
Permissive license.
Support for arbitrary alphabets.
Being a bioinformatician, my pick would be SeqAn (check out the sequence index section). It implements a lazy suffix tree and an enhanced suffix array (an equivalent data structure), both of which have good cache behaviour.
Having actually used and then forgotten PATL, I'd like to tuck in a link in an answer.
http://code.google.com/p/patl/
It's got a couple really distinct features, and is generally pleasant reading as well.
Most likely this is a tutorial but IMO worth reading and with source code: http://marknelson.us/1996/08/01/suffix-trees.