9주차 Discussion #12
chloe-codes1
started this conversation in
General
Replies: 4 comments
-
3.12["b", null]
["b", ["c", ["d", null]]] |
Beta Was this translation helpful? Give feedback.
0 replies
-
3.21function print_queue(queue) {
display(front_ptr(queue));
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
3.24function assoc(key, records, same_key) {
return is_null(records)
? undefined
: same_key(key, head(head(records)))
? head(records)
: assoc(key, tail(records));
}
function make_table(same_key) {
const local_table = list("*table*");
function lookup(key_1, key_2) {
const subtable = assoc(key_1, tail(local_table), same_key);
if (is_undefined(subtable)) {
return undefined;
} else {
const record = assoc(key_2, tail(subtable));
return is_undefined(record) ? undefined : tail(record);
}
}
function insert(key_1, key_2, value) {
const subtable = assoc(key_1, tail(local_table));
if (is_undefined(subtable)) {
set_tail(
local_table,
pair(list(key_1, pair(key_2, value)), tail(local_table)),
);
} else {
const record = assoc(key_2, tail(subtable), same_key);
if (is_undefined(record)) {
set_tail(subtable, pair(pair(key_2, value), tail(subtable)));
} else {
set_tail(record, value);
}
}
}
function dispatch(m) {
return m === "lookup"
? lookup
: m === "insert"
? insert
: error(m, "unknown operation -- table");
}
return dispatch;
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
3.28function or_gate(a1, a2, output) {
function or_action_function() {
const new_value = logical_or(get_signal(a1), getA_signal(a2));
after_delay(or_gate_delay, () => set_signal(output, new_value));
}
add_action(a1, or_action_function);
add_action(a2, or_action_function);
return "ok";
} |
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
-
📢 책을 읽으면서 궁금한 점들을 자유롭게 적고 대답해 주세요
9주차 진행 방식
진도
: 3.3 ~ 3.4.1 읽어오고 정리 & 의견 나누기문제 풀이
: 3.12, 3.21, 3.24, 3.28, 3.38 문제 풀고, Github 에 올리기 (총 5문제)Beta Was this translation helpful? Give feedback.
All reactions