question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

implement `mod` resource (% operator)

See original GitHub issue

If we have division and multiplication operators, we should also have a modulo operator. However, currently it does not exist.

🦄 40/6
float ask(call(get('/'),40,6))
6.666666666666667
🦄 40*6
int ask(call(get('*'),40,6))
240
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
40%6

Uncaught Error: Unknown identifier '%'!
    at Object.<anonymous> (/Users/milimetr/Desktop/x/askql/dist/askvm/lib/run.js:70:15)
    at Generator.next (<anonymous>)
    at /Users/milimetr/Desktop/x/askql/dist/askvm/lib/run.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/milimetr/Desktop/x/askql/dist/askvm/lib/run.js:4:12)
    at Object.run (/Users/milimetr/Desktop/x/askql/dist/askvm/lib/run.js:29:12)
🦄

This task is to create a mod resource and a % operator linked to this resource.

Dear new contributor,

If you have any questions on how to start, please write a comment with a tag: @czerwinskilukasz1 or @mhagmajer, or join our Discord Community and let us know there. We will be very happy to help you start! 😃 Hint for starters: As a starting point, take a look at src/askvm/resources/math/index.ts file, where a * operator and times resource are already linked or a couple of other ones and use them as an example.

Cheers, Łukasz (@czerwinskilukasz1) AskQL Core Developer

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mhagmajercommented, Jun 27, 2020

@czerwinskilukasz1 let’s do it in parser only for operators, div and mod and carry the discussion about unary % on a separate issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mod Operator - Visual Basic - Microsoft Learn
The Mod operator in Visual Basic, the .NET Framework op_Modulus operator, and the underlying rem IL instruction all perform a remainder ...
Read more >
Python Modulo in Practice: How to Use the % Operator
One of these operators is the modulo operator ( % ), which returns the remainder of dividing two numbers. In this tutorial, you'll...
Read more >
Modulo operator (practice) | Cryptography - Khan Academy
Learn for free about math, art, computer programming, economics, physics, chemistry, biology, medicine, finance, history, and more. Khan Academy is a ...
Read more >
Efficient C Tip #13 – use the modulus (%) operator with caution
This is the thirteenth in a series of tips on writing efficient C for embedded systems. As the title suggests, if you are...
Read more >
The Modulo operator Unplugged
The Modulo operator Unplugged · Printables · Classroom resources · Programming challenges · Table of contents · Key questions · Lesson starter ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found