← 수업 제작 도구
홈 › Components › Math Response (수식 답변) › 화면 6

화면 6. Math Input.history [source]

원본: Computation Layer 문서(Math Response (수식 답변)) · Try It (원본 화면)

화면 번호6 / 28
문서 항목 설명 (원문)historykey: string Gets the history of a variable that was defined using the "capture" sink.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 6 캡처

화면에 적힌 영어 문구(원문):

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1cubicGraph그래프
# This sink will take all the values captured by the
# history sink we set up in the expression input and store
# them in a number list called "x_history". We use that in the
# calculator to display values along the function.
▷ 이 sink는 수식 답변에 설정한 history로 기록된 모든 값을 가져와 "x_history"라는 숫자배열(numberList)에 저장한다. 계산기에서 이 숫자배열을 써서 함수를 따라 값들을 표시한다.

numberList("x_{history}"): newInspectInputFinal.history("xval")
▶ 그래프의 숫자배열 x_{history}는 수식 답변 newInspectInputFinal이 "xval"이라는 이름으로 기록한 값들의 기록 전체(newInspectInputFinal.history("xval"))로 한다.
numberList("이름")은 그래핑 계산기의 변수를 주어진 숫자배열의 내용으로 정하고, history("이름")은 capture로 정한 변수의 기록 전체를 가져온다.
2레이블 없는 메모메모
# This is a common design pattern in Desmos activiites where
# we'll present the prompt in the content sink and then
# attach a feedback variable which checks for different conditions
# (in this case, whether or not the x-value will result in a y-value
# that's off screen) and displays appropriate feedback.
▷ 이것은 Desmos 활동에서 흔히 쓰는 설계 방식이다. 메모의 content sink에 문제 글을 두고, 여러 조건(여기서는 x 값이 화면 밖의 y 값을 만드는지)을 검사해 알맞은 피드백을 보여 주는 피드백 변수를 붙인다.

feedback =
▶ 변수 feedback은 아래 세 갈래 조건(when 두 개와 otherwise)에 따라 정해지는 값으로 한다.
조건 사이의 # 줄은 주석이다. when은 조건을 차례로 확인해 처음 맞는 값을 쓴다.
when newInspectInputFinal.submitted and (newInspectInputFinal.lastValue("xval") < -9.3 or newInspectInputFinal.lastValue("xval") > 10) "\n\nYour point is off the screen." ▶ 변수 feedback의 첫 번째 조건은 newInspectInputFinal이 제출되었고, 마지막으로 기록된 "xval" 값이 -9.3보다 작거나 10보다 크면 "\n\nYour point is off the screen."(점이 화면 밖에 있다.)로 한다.
글자 안의 \n은 줄바꿈 하나이고 \n\n은 줄바꿈 두 번(빈 줄)이다. \는 바로 뒤 글자의 뜻을 바꾸는 표시이다. submitted는 수식 답변이 제출되었는지를 참 또는 거짓으로 알려 주고, lastValue("이름")은 capture로 정한 변수에 마지막으로 기록된 값을 가져온다. and는 둘 다 참이어야 참이고, or는 둘 중 하나라도 참이면 참이다.
# Here we sink in the last value captured by the capture sink # in the expression input. ▷ 여기서는 수식 답변에서 capture sink로 마지막에 기록된 값을 가져와 넣는다. when newInspectInputFinal.submitted "\n\nYou're currently inspecting: `x=${newInspectInputFinal.lastValue("xval")}`" ▶ 변수 feedback의 두 번째 조건은 제출되었으면 "\n\nYou're currently inspecting: `x=${newInspectInputFinal.lastValue("xval")}`"(지금 살펴보는 값: x=…)로 한다.
백틱(`)으로 감싼 부분은 latex 값이고, 마지막으로 기록된 "xval" 값이 들어간다. ${ }는 글자 안에 변수의 값을 끼워 넣는 표기이고, 그 안의 "xval"은 lastValue(...)에 넘기는 이름이다. 글자 안의 \n\n은 줄바꿈 두 번(빈 줄)이다.
otherwise "" ▶ 변수 feedback은 앞의 두 조건에 모두 해당하지 않으면 빈 글자로 한다. content: "Enter the value for `x` you want to inspect.${feedback}" ▶ 메모의 내용(content)은 "Enter the value for `x` you want to inspect.${feedback}"(살펴보고 싶은 x의 값을 입력하시오.) 뒤에 feedback의 값이 이어지는 글로 한다.
${ }는 글자 안에 변수의 값을 끼워 넣는 표기이다. content는 메모에 직접 적은 글을 덮어쓴다.
3newInspectInputFinal수식 답변
# We're telling the action button to capture the numericValue of this input
# "xval" is a name that capture, lastValue, and history will all share.
▷ 행동 버튼이 이 입력의 numericValue를 기록하도록 한다. "xval"은 capture, lastValue, history가 모두 함께 쓰는 이름이다.
capture("xval"): this.numericValue
▶ "xval"이라는 이름으로 기록할 값(capture)은 이 수식 답변의 계산한 값(this.numericValue)으로 한다.
capture("이름")은 수식 답변을 제출할 때마다 기록해 둘 변수를 정하고, 기록은 나중에 history로 가져온다. numericValue는 입력한 식을 계산한 값을 가져온다. 예를 들어 "2+2"는 숫자 4를 돌려준다. 제출할 때마다 입력한 식을 계산한 값이 "xval"에 기록된다.