egison 2.4.6 → 2.4.7
raw patch · 2 files changed
+1/−20 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- egison.cabal +1/−1
- hs-src/Language/Egison/Numerical.hs +0/−19
egison.cabal view
@@ -1,5 +1,5 @@ Name: egison-Version: 2.4.6+Version: 2.4.7 Synopsis: An Interpreter and Compiler for the Programming Language Egison Description: An interpreter and compiler for the programming language Egison. A feature of Egison is the strong pattern match facility.
hs-src/Language/Egison/Numerical.hs view
@@ -18,29 +18,10 @@ binaryOp _ singleVal@[_] = throwError $ NumArgs 2 singleVal binaryOp op [a, b] = toEgisonVal <$> liftM2 op (fromEgisonVal a) (fromEgisonVal b) --- |Convert a number to a string; radix is optional, defaults to base 10---numToString :: [EgisonVal] -> IOThrowsError EgisonVal---numToString [(Number n), (Number radix)] = do--- case radix of--- 2 -> do -- Nice tip from StackOverflow question #1959715--- liftIO $ stringToCharCollection $ showIntAtBase 2 intToDigit n ""--- 8 -> liftIO $ stringToCharCollection $ printf "%o" n--- 10 -> liftIO $ stringToCharCollection $ printf "%d" n--- 16 -> liftIO $ stringToCharCollection $ printf "%x" n--- _ -> throwError $ BadSpecialForm "Invalid radix value" $ Number radix---- |Convert a float to a string; radix is optional, defaults to base 10---floatToString :: [EgisonVal] -> IOThrowsError EgisonVal---floatToString [(Float n)] = liftIO $ stringToCharCollection $ show n---floatToString [x] = throwError $ TypeMismatch "number" x---floatToString badArgList = throwError $ NumArgs 1 badArgList- isEgisonEOF :: [EgisonVal] -> ThrowsError EgisonVal isEgisonEOF [EOF] = return $ Bool True isEgisonEOF [_] = return $ Bool False isEgisonEOF badArgList = throwError $ NumArgs 1 badArgList---- - end Numeric operations section stringToChars :: [EgisonVal] -> ThrowsError EgisonVal stringToChars [(String str)] = return $ Collection $ map Char str