Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ shravan20
Avatar
bettman-latin
MrJithi
Lahari
2 changes: 2 additions & 0 deletions Languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Hello there!!
- C++
- Dart
- Go
- Haskell
- Java
- Javascript
- Kotlin
Expand All @@ -27,4 +28,5 @@ Hello there!!
- Rust
- Scala
- Scheme
- SML
- Typescript
8 changes: 8 additions & 0 deletions fibonacci_series/Haskell/Haskell_fibonacci.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fibonacci :: Integer -> [Integer]
fibonacci n = map fst $ take (fromIntegral n) $ iterate (\(a, b) -> (b, a + b)) (1, 1)

main = do
putStrLn "Enter the number of Fibonacci terms to be printed"
input <- getLine
let n = read input :: Integer
putStrLn (show (fibonacci n))
27 changes: 27 additions & 0 deletions fibonacci_series/SML/SML_fibonacci.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local
fun fibonacci (i:IntInf.int, j:IntInf.int, n:IntInf.int ) =
let
fun fib (a,b,0) = []
| fib (a,b,count) = a::fib(b,a+b,count-1)
in
fib (i,j,n)
end

fun printList [] = ()
| printList (x::[]) = print (IntInf.toString x ^ "\n")
| printList (x::xs) = (print (IntInf.toString x ^ ", "); printList xs)

fun main () =
let
val _ = print "Enter the number of Fibonacci numbers to be printed: "
val input = TextIO.inputLine TextIO.stdIn
val n = valOf (IntInf.fromString (valOf input))

val result = fibonacci (IntInf.fromInt 1,IntInf.fromInt 1,n)
val _ = printList result
in
()
end
in
val _ = main()
end