Draft
Decrypt me: function parser
Loading description...
Restricted
Puzzles
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
That's not a function, that's an assignment expression where the right hand side happens to be a function.
The kata is clear as mud in what exactly it wants us to do. The specification is severely lacking; limits, if any, are missing; there's a
puzzle
tag that means we might encounter anything, and author's rank estimate is3kyu
. Abandon all hope, ye who enter here. Prepare for Armageddon. But then you only have to jump through a reasonably-sized hoop to solve it.if you see any issues, misunderstandigs or you want to clarify something, please feel free to ask
The description doesn't specify what the limits of the expression are, and there's a
puzzle
tag. So parsing the input is severely discouraged *, because it might turn out to be impossible (we don't know what we're going to encounter ), and it becomes a circumventing the artificial, arbitrary, restrictions kata.If this is to be a parsing kata, specify the expression ( and give me
Function
, because my own personal parser library needs it ). ( It'll also be a duplicate. )If you want to disable
eval
: in JS, you can't; you'll have to create the kata in another language ( e.g. Haskell doesn't haveeval
).* restricting
Function
andRegExp
doesn't help.Yeah, looking at the tests, the whole wrapping input and output in a function is unnecessary. Part of the kata is evaluating the expression, but there's some parsing two types of function syntax and wrapping the return value in a function to contend with, both of which are tasks that have nothing to do with arithmetic expression parsing and add relatively little - except for the fact we don't know it's limited to that, so we had better reinvent
eval
and just let that do the work.