From fc18b9c8b78fdf7f83e70982fe99a4c1c0208d90 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Mon, 30 Sep 2019 19:58:26 -0700 Subject: [PATCH 1/3] :pencil: --- src/contents/15.jp.tsx | 55 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/src/contents/15.jp.tsx b/src/contents/15.jp.tsx index 148583704..b0848e47a 100644 --- a/src/contents/15.jp.tsx +++ b/src/contents/15.jp.tsx @@ -928,7 +928,7 @@ export default () => ( /> 掛け算を計算できる弁当箱を… - 省略表記してみる + 以下のように省略表記してみる ( <> {' '} ✖️{' '} - {' '} - を掛け算してくれる +
+ 掛け算ができる弁当箱の省略表記 } /> @@ -965,7 +965,30 @@ export default () => ( children: ( <>

- そうだ。試しに、こちらを + そうだ。 + + 次に紹介する弁当箱は複雑なので、先ほどの掛け算ができる弁当箱をそのまま表示するとスペースが足りなくなる。だから、 + のアイコンで省略することにした + + というわけだ。 +

+ + ) + }, + { + type: 'thinking', + children: ( + <> +

そうか、了解!

+ + ) + }, + { + type: 'devil', + children: ( + <> +

+ この省略表記がちゃんと機能するかどうか試すために、こちらを してみるといい:

@@ -1511,6 +1534,30 @@ export default () => ( } /> + +

+ まさに、「 + 魔法のYコンビネータ + 」だな! +

+ + ) + } + ]} + /> + + 魔法のYコンビネータ + + } + /> ) }, From 952c4a80de7ba361b148ebbaed9a8a777155461d Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Mon, 30 Sep 2019 20:16:58 -0700 Subject: [PATCH 2/3] Improve 15 --- scripts/lib/initialExpressionContainers.ts | 14 ++ scripts/lib/runnerConfigs.ts | 6 + src/components/Runners/Ochk.tsx | 12 ++ src/components/Runners/index.ts | 1 + src/contents/15.jp.tsx | 37 +++- src/lib/runners/ochk.json | 230 +++++++++++++++++++++ 6 files changed, 294 insertions(+), 6 deletions(-) create mode 100644 src/components/Runners/Ochk.tsx create mode 100644 src/lib/runners/ochk.json diff --git a/scripts/lib/initialExpressionContainers.ts b/scripts/lib/initialExpressionContainers.ts index bd964f4c2..d8a4f9da5 100644 --- a/scripts/lib/initialExpressionContainers.ts +++ b/scripts/lib/initialExpressionContainers.ts @@ -2099,6 +2099,20 @@ export const ibfr = initializeExpressionContainer([ } ]) +export const crxl = initializeExpressionContainer([ + [ + addParams('a', 'b', 'c', 'd'), + { + shorthandNumberAfterConvert: 'number', + shorthandNumber: 3 + } + ], + { + shorthandNumberAfterConvert: 'number', + shorthandNumber: 2 + } +]) + export const bgiy = initializeExpressionContainer({ shorthandNumberAfterConvert: 'number', shorthandNumber: 5 diff --git a/scripts/lib/runnerConfigs.ts b/scripts/lib/runnerConfigs.ts index c1c3da29b..7ab85c13a 100644 --- a/scripts/lib/runnerConfigs.ts +++ b/scripts/lib/runnerConfigs.ts @@ -2514,6 +2514,12 @@ export const mlnt: ExpressionRunnerShorthandConfig = { showPriorities: true } +export const ochk: ExpressionRunnerShorthandConfig = { + runner: 'simple', + initialExpressionContainer: initialExpressionContainers.crxl, + showPriorities: true +} + export const ryqp: ExpressionRunnerShorthandConfig = { runner: 'simple', initialExpressionContainer: initialExpressionContainers.bgiy diff --git a/src/components/Runners/Ochk.tsx b/src/components/Runners/Ochk.tsx new file mode 100644 index 000000000..0799bb617 --- /dev/null +++ b/src/components/Runners/Ochk.tsx @@ -0,0 +1,12 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/ochk.json' + +const Ochk = ({ children }: { children?: React.ReactNode }) => ( + // @ts-ignore + + {children} + +) + +export default Ochk diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index f7cf2c8f3..851c06bd0 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -356,6 +356,7 @@ export { default as Ugvz } from 'src/components/Runners/Ugvz' export { default as Xkcm } from 'src/components/Runners/Xkcm' export { default as Edzu } from 'src/components/Runners/Edzu' export { default as Mlnt } from 'src/components/Runners/Mlnt' +export { default as Ochk } from 'src/components/Runners/Ochk' export { default as Ryqp } from 'src/components/Runners/Ryqp' export { default as Vqyl } from 'src/components/Runners/Vqyl' export { default as Wzqv } from 'src/components/Runners/Wzqv' diff --git a/src/contents/15.jp.tsx b/src/contents/15.jp.tsx index b0848e47a..bfcca6e01 100644 --- a/src/contents/15.jp.tsx +++ b/src/contents/15.jp.tsx @@ -987,16 +987,43 @@ export default () => ( type: 'devil', children: ( <> +

ここで具体例を見てみよう。

- この省略表記がちゃんと機能するかどうか試すために、こちらを - してみるといい: + たとえば、こちらの {' '} + ✖️ {' '} + を計算できる弁当箱は… +

+ + ) + } + ]} + /> + + ✖️{' '} + を計算できる弁当箱 + + +

+ 以下のように を使って省略表記できる。 +

+

+ を押してみると、ちゃんと{' '} + ✖️{' '} + が計算できるぞ。

) } ]} /> - + + 上の弁当箱を で省略表記してみた + ( children: ( <>

- なるほど、これで {' '} - ✖️ {' '} - を計算できるんだな。 + なるほど。で、この省略表記をどう使って階乗を計算するんだい?

) diff --git a/src/lib/runners/ochk.json b/src/lib/runners/ochk.json new file mode 100644 index 000000000..09f746571 --- /dev/null +++ b/src/lib/runners/ochk.json @@ -0,0 +1,230 @@ +{ + "expressionContainers": [ + { + "expression": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2, + "shorthandNumberAfterConvert": "number", + "maxNestedFunctionDepth": 0 + }, + "func": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 3, + "shorthandNumberAfterConvert": "number", + "maxNestedFunctionDepth": 0 + }, + "func": { + "arg": { + "name": "a", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1, + 2 + ], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "name": "b", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "name": "c", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "name": "d", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "arg": { + "name": "d", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 2, + 4 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "func": { + "arg": { + "name": "c", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 3 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "func": { + "name": "b", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 3, + 4 + ], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "state": "default", + "type": "call", + "priority": 3, + "maxNestedFunctionDepth": 0 + }, + "state": "default", + "type": "call", + "priority": 4, + "maxNestedFunctionDepth": 0 + }, + "func": { + "arg": { + "name": "c", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "func": { + "name": "a", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1, + 2 + ], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "state": "default", + "type": "call", + "priority": 1, + "maxNestedFunctionDepth": 0 + }, + "state": "default", + "type": "call", + "priority": 2, + "maxNestedFunctionDepth": 0 + }, + "type": "function", + "maxNestedFunctionDepth": 1 + }, + "type": "function", + "maxNestedFunctionDepth": 2 + }, + "type": "function", + "maxNestedFunctionDepth": 3 + }, + "type": "function", + "maxNestedFunctionDepth": 4 + }, + "state": "default", + "type": "call", + "priority": 1, + "maxNestedFunctionDepth": 4 + }, + "state": "default", + "type": "call", + "priority": 2, + "maxNestedFunctionDepth": 4 + }, + "numLeafNodes": 9, + "containerState": "ready", + "previouslyChangedExpressionState": "default" + } + ], + "speed": 1, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": false, + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "highlightFunctions": false +} From f4a32e17863e3c0a55e501d5b5a6842590689e48 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Mon, 30 Sep 2019 20:35:59 -0700 Subject: [PATCH 3/3] Clarify 15 --- src/contents/15.jp.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/contents/15.jp.tsx b/src/contents/15.jp.tsx index bfcca6e01..9813fa8cd 100644 --- a/src/contents/15.jp.tsx +++ b/src/contents/15.jp.tsx @@ -914,6 +914,11 @@ export default () => ( type: 'devil', children: ( <> +

+ 階乗を計算するためには、先ほど紹介した + 掛け算を計算できる弁当箱 + を使う必要があるわけだが… +

まず、 @@ -950,10 +955,7 @@ export default () => ( ]} description={ <> - {' '} - ✖️{' '} -
- 掛け算ができる弁当箱の省略表記 + のアイコンが掛け算を示す } /> @@ -967,10 +969,12 @@ export default () => (

そうだ。 - 次に紹介する弁当箱は複雑なので、先ほどの掛け算ができる弁当箱をそのまま表示するとスペースが足りなくなる。だから、 - のアイコンで省略することにした + 次に紹介する、階乗を計算できる弁当箱は複雑なので、こういった省略表記を使わないとスペースが足りなくなる。 - というわけだ。 +

+

+ だから、 掛け算を {' '} + のアイコンで省略表記することにしたというわけだ。

)