「48時間でSchemeを書こう/練習問題の解答」の版間の差分

削除された内容 追加された内容
M編集の要約なし
297 行
parseVector = do arrayValues <- sepBy parseExpr spaces
return $ Vector (listArray (0,(length arrayValues - 1)) arrayValues)
</syntaxhighlight>
In order to use this, import ''Data.Array'' and add the following to the LispVal type:
In order to use this,
<syntaxhighlight lang="haskell">
import ''Data.Array''
</syntaxhighlight>
In order to use this, import ''Data.Array'' and add the following to the LispVal type:
<syntaxhighlight lang="haskell">
| Vector (Array Int LispVal)
</syntaxhighlight>
Add the following lines to parseExpr; ''before'' the parser for Lists and DottedLists.
<syntaxhighlight lang="haskell">
<|> try (do string "#("
x <- parseVector
305 ⟶ 313行目:
return x)
</syntaxhighlight>
 
===Exercise 3===