Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more LISP operators #5

Open
4 tasks
tshemsedinov opened this issue Dec 3, 2024 · 7 comments
Open
4 tasks

Implement more LISP operators #5

tshemsedinov opened this issue Dec 3, 2024 · 7 comments
Assignees
Labels
patterns-24 Patterns 2024

Comments

@tshemsedinov
Copy link
Member

  • Arithmetic Operations
  • Comparison Operations
  • Logical Operations
  • Bitwise Operations
@tshemsedinov tshemsedinov added the patterns-24 Patterns 2024 label Dec 3, 2024
@zpwebbear
Copy link
Contributor

Can I use list of operators and their declaration (incf, decf, logand, etc) from this resource https://www.tutorialspoint.com/lisp/lisp_operators.htm ? Unfortunately I haven't managed to find these operators in the comfortable human readable list from the official common-lisp resources.

And do I need to extend the test/cases.js file or implement new files for each operator? Can I use describe for grouping tests like on the example below:

describe('Arithmetic Operations', () => {
  it('Evaluate subtract operator', () => {
    const program = '(- x y)';
    const context = { x: 5, y: 2 };
    const result = evaluate(program, context);
    const expected = 5 - 2;
    assert.strictEqual(result, expected, 'Subtract operator failed');
  });
  
  //... other arithmetic operators tests
});

@imbroyury
Copy link

@tshemsedinov Should comparison operators support sequences of more than two arguments?

From Common Lisp the Language, 2nd Edition

(= 3 3) is true.		(/= 3 3) is false. 
(= 3 5) is false.		(/= 3 5) is true. 
(= 3 3 3 3) is true.		(/= 3 3 3 3) is false. 
(= 3 3 5 3) is false.		(/= 3 3 5 3) is false. 
(= 3 6 5 2) is false.		(/= 3 6 5 2) is true. 

@zpwebbear
Copy link
Contributor

@imbroyury Great question! I think it's relevant for the arithmetical operators too.

Don't you want to share this issue? I've already started with arithmetic operators and can go logical or bitwise, and you can take comparison and something you want.

And also thanks for the common lisp resource. It's really strange that I missed it.

@zpwebbear
Copy link
Contributor

@tshemsedinov I've created a pull request with an implementation of arithmetic operators. But I'm not experienced in open source and because of it don't know how to attach this PR to this particular issue #11

@imbroyury
Copy link

@zpwebbear happy to implement comparison operators as soon as @tshemsedinov comments on supporting sequences and your commit is merged

@zpwebbear
Copy link
Contributor

@tshemsedinov also to implement Logical Operators we need to implement nil and t symbols. Do we need to do it in the scope of the current issue or we'll make special issue for it?

@zpwebbear
Copy link
Contributor

@tshemsedinov I've added the boolean symbols implementation in the separate PR #12 Could you please take a look?

For some reason I can't assign any reviewer on this PR.

zpwebbear added a commit to zpwebbear/metalisp that referenced this issue Dec 9, 2024
zpwebbear added a commit to zpwebbear/metalisp that referenced this issue Dec 9, 2024
Additionly type field was added to all Expression classes
Refs: metarhia#5
tshemsedinov pushed a commit that referenced this issue Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patterns-24 Patterns 2024
Projects
None yet
Development

No branches or pull requests

3 participants