4주차 Discussion #6
chloe-codes1
started this conversation in
General
Replies: 4 comments
-
function make_segment(p1, p2) {
return pair(p1, p2);
}
function start_segment(segment) {
return head(segment);
}
function end_segment(segment) {
return tail(segment);
}
function make_point(x, y) {
return pair(x, y);
}
function x_point(point) {
return head(point);
}
function y_point() {
return tail(point);
}
function midpoint_segment(p1, p2) {
return make_point(
x_point(start_segment(p1)) + x_point(end_segment(p2)) / 2,
y_point(start_segment(p1)) + y_point(end_segment(p2)) / 2
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
// 2.2
// 2.2-1
function make_segment(startPoint, endPoint) {
return pair(startPoint, endPoint);
}
function start_segment(segment) {
return head(segment);
}
function end_segment(segment) {
return tail(segment);
}
// 2.2-2
function make_point(x, y) {
return pair(x, y);
}
function x_point(point) {
return head(point);
}
function y_point(point) {
return tail(point);
}
// 2.2-3
function midpoint_segment(segment) {
return make_point(
(x_point(start_segment(segment)) + x_point(end_segment(segment))) / 2,
(y_point(start_segment(segment)) + y_point(end_segment(segment))) / 2
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
2.03
function makeRectangle(height, width) {
return {
height,
width,
};
}
function getPerimeter(rect) {
return 2 * (rect.width + rect.height);
}
function getArea(rect) {
return rect.width * rect.height;
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
📢 책을 읽으면서 궁금한 점들을 자유롭게 적고 대답해주세요
4주차 진행 방식
복습: 2.1 문제 풀어오기 - 1 ~ 8, 10, 12 (10문제)진도: 2.2까지 읽어오고 정리 & 의견 나누기미래 정하기: 2.2 에서 풀 문제 정하기Beta Was this translation helpful? Give feedback.
All reactions