Skip to content

Commit

Permalink
Fix op
Browse files Browse the repository at this point in the history
  • Loading branch information
kzfm committed Nov 23, 2012
1 parent 833b82b commit 1c8de55
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions sources/stackCalc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ haskellでは破壊的な操作ができないので、スタックから要素
let
(i1, stack1) = pop stack
(i2, stack2) = pop stack1
(_, stack3) = push (i1+i2) stack2
in
((i1+i2), stack3)
push (i1+i2) stack2

これはうまく動きます

Expand All @@ -179,9 +178,8 @@ haskellでは破壊的な操作ができないので、スタックから要素
let
(i1, stack1) = pop stack
(i2, stack2) = pop stack1
(_, stack3) = push (op i1 i2) stack2
in
((op i1 i2), stack3)
push (op i1 i2) stack2

add = calc (+)
sub = calc (-)
Expand Down
6 changes: 2 additions & 4 deletions stackCalc.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ <h2>加算を実装してみる<a class="headerlink" href="#id3" title="Permalin
<span class="kr">let</span>
<span class="p">(</span><span class="n">i1</span><span class="p">,</span> <span class="n">stack1</span><span class="p">)</span> <span class="ow">=</span> <span class="n">pop</span> <span class="n">stack</span>
<span class="p">(</span><span class="n">i2</span><span class="p">,</span> <span class="n">stack2</span><span class="p">)</span> <span class="ow">=</span> <span class="n">pop</span> <span class="n">stack1</span>
<span class="p">(</span><span class="kr">_</span><span class="p">,</span> <span class="n">stack3</span><span class="p">)</span> <span class="ow">=</span> <span class="n">push</span> <span class="p">(</span><span class="n">i1</span><span class="o">+</span><span class="n">i2</span><span class="p">)</span> <span class="n">stack2</span>
<span class="kr">in</span>
<span class="p">((</span><span class="n">i1</span><span class="o">+</span><span class="n">i2</span><span class="p">),</span> <span class="n">stack3</span><span class="p">)</span>
<span class="n">push</span> <span class="p">(</span><span class="n">i1</span><span class="o">+</span><span class="n">i2</span><span class="p">)</span> <span class="n">stack2</span>
</pre></div>
</div>
<p>これはうまく動きます</p>
Expand All @@ -198,9 +197,8 @@ <h2>加算を実装してみる<a class="headerlink" href="#id3" title="Permalin
<span class="kr">let</span>
<span class="p">(</span><span class="n">i1</span><span class="p">,</span> <span class="n">stack1</span><span class="p">)</span> <span class="ow">=</span> <span class="n">pop</span> <span class="n">stack</span>
<span class="p">(</span><span class="n">i2</span><span class="p">,</span> <span class="n">stack2</span><span class="p">)</span> <span class="ow">=</span> <span class="n">pop</span> <span class="n">stack1</span>
<span class="p">(</span><span class="kr">_</span><span class="p">,</span> <span class="n">stack3</span><span class="p">)</span> <span class="ow">=</span> <span class="n">push</span> <span class="p">(</span><span class="n">op</span> <span class="n">i1</span> <span class="n">i2</span><span class="p">)</span> <span class="n">stack2</span>
<span class="kr">in</span>
<span class="p">((</span><span class="n">op</span> <span class="n">i1</span> <span class="n">i2</span><span class="p">),</span> <span class="n">stack3</span><span class="p">)</span>
<span class="n">push</span> <span class="p">(</span><span class="n">op</span> <span class="n">i1</span> <span class="n">i2</span><span class="p">)</span> <span class="n">stack2</span>

<span class="nf">add</span> <span class="ow">=</span> <span class="n">calc</span> <span class="p">(</span><span class="o">+</span><span class="p">)</span>
<span class="nf">sub</span> <span class="ow">=</span> <span class="n">calc</span> <span class="p">(</span><span class="o">-</span><span class="p">)</span>
Expand Down
6 changes: 2 additions & 4 deletions stackCalc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ haskellでは破壊的な操作ができないので、スタックから要素
let
(i1, stack1) = pop stack
(i2, stack2) = pop stack1
(_, stack3) = push (i1+i2) stack2
in
((i1+i2), stack3)
push (i1+i2) stack2
これはうまく動きます

Expand All @@ -179,9 +178,8 @@ haskellでは破壊的な操作ができないので、スタックから要素
let
(i1, stack1) = pop stack
(i2, stack2) = pop stack1
(_, stack3) = push (op i1 i2) stack2
in
((op i1 i2), stack3)
push (op i1 i2) stack2
add = calc (+)
sub = calc (-)
Expand Down

0 comments on commit 1c8de55

Please sign in to comment.