Hot answers tagged

8 votes

Thread-safe strtok in C

Since this is not a drop-in replacement of strtok, which iterates token, but only allows a complete tokenization of a string, I'd not expose ...
vnp's user avatar
  • 56.3k
6 votes

Thread-safe strtok in C

Significant semantic differences from strtok() I decided to practice and write a thread-safe version of the same function. Yours is not "a thread-safe ...
John Bollinger's user avatar
6 votes

Thread-safe strtok in C

You don't need the inclusion of stdlib.h in com_github_coderodde_thread_safe_strtok.h. For the definition of ...
Harith's user avatar
  • 4,021
4 votes

Thread-safe strtok in C - version II

Reconsider token_t This is currently a linear linked list of tokens, surprising given the name. A strictly-evaluated linear linked list isn’t an efficient data ...
Davislor's user avatar
  • 6,706
4 votes

Evaluate a prefix expression

Helpful errors You raise a couple of errors like raise ValueError("Invalid expression.") If I were to use your code and it gives me this error, I might ...
Green绿色's user avatar
2 votes

Multithreaded natural language text parser (Rev.3)

To me this looks like a classic map-reduce problem. I would implement a map and reduce functions, of which mapping of chunks looks like Setup thread local datastructures (no thread safety needed, ...
Incomputable's user avatar
  • 9,444
2 votes
Accepted

Evaluating Polish Prefix Notation and Polish Postfix Notation

operator module OPCODES = { "+": lambda lhs, rhs: lhs + rhs, ... The lambdas are nice enough, they get the job done. We could have just mentioned ...
J_H's user avatar
  • 21.9k
2 votes

Evaluating Polish Prefix Notation and Polish Postfix Notation

Testing the first and last tokens is very dubious. It rejects a perfectly valid expression 42, and accepts definitely invalid expressions like ...
vnp's user avatar
  • 56.3k
2 votes

Multithreaded natural language text parser (Rev.2)

About your feedback Taking into account a huge size of data, the slowest thread shouldn’t be much slower that any other as they have almost the same amount of lexems on average; The problem isn't ...
G. Sliepen's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible