I need to create a subfunction that will return to me all the adjacent nodes that I need for this question in the Scheme. I am new to the circuit, I don’t know how I can combine two conditions into one test case?
Basically, my algorithm should check if the node is on the edge or not. In this case, I use a 5x5 grid.
If both nodes are on the corner, then both are either 1 or 5, which will have only 2 neighboring nodes. If only one of the nodes hit the edge, I will have a 3 node return value. If there is no edge around the node, I will have 4 node return.
My problem is how can I put 2 test cases in one point?
(define (neighbors l w)
(if (= 1 l) and (= 1 w)
(display l w))) --at top left corner
Here I want to evaluate whether l and w are equal to 1. Now this does not work, because I can not use "and" or "such keywords in the syntax, and I can not use and / or combine them. Any ideas? Or should i do something else?
source
share