Fix opposite_eq method.

Simplify method in Simplify trait.

Fix distributive law.

Response for the simplify endpoint.

HTTP client.

camelCase and SCREAMING_SNAKE_CASE for struct and enum
This commit is contained in:
Martin Berg Alstad
2024-06-06 23:53:30 +02:00
parent c4393e94bf
commit 9cb0fa0a59
7 changed files with 114 additions and 21 deletions

8
http/common.js Normal file
View File

@ -0,0 +1,8 @@
/**
* Encode the given string as a URI component, and set the request variable "expression" to the result.
* @param {string} expression
* @returns {void}
*/
export function expression(expression) {
request.variables.set("expression", encodeURIComponent(expression))
}

10
http/http-client.env.json Normal file
View File

@ -0,0 +1,10 @@
{
"dev": {
"expression": "",
"url": "http://localhost:8000"
},
"prod": {
"expression": "",
"url": "https://api.martials.no/simplify-truths"
}
}

29
http/simplify.http Normal file
View File

@ -0,0 +1,29 @@
### GET Atomic Expression
GET {{url}}/simplify/A
### GET And Expression
< {%
import {expression} from './common.js';
expression("A & B")
%}
GET {{url}}/simplify/{{expression}}
### GET Or Expression
< {%
import {expression} from "./common";
expression("A | B")
%}
GET {{url}}/simplify/{{expression}}
### GET Not Expression
GET {{url}}/simplify/!A
### GET Implication Expression
< {%
import {expression} from "./common";
expression("A => B")
%}
GET {{url}}/simplify/{{expression}}