Created
October 5, 2019 14:56
-
-
Save OnurGumus/1645698575202706376c8f1c53cdb7c0 to your computer and use it in GitHub Desktop.
kickstart list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Collections.Generic | |
let csharpList = List<_>(); | |
csharpList.Add(2); | |
printf "%A" <| csharpList.[0] | |
let numbers = [1;2;3] | |
let numbers2 = [4;5;6] | |
let doubleNumbers = numbers |> List.append numbers2 | |
printf "%A" numbers | |
printf "%A" doubleNumbers | |
printf "%A" <| numbers.Item 1 | |
let zeroList = 0 :: numbers | |
printf "%A" zeroList | |
type MyList<'T> = Empty | Cons of ('T * MyList<'T>) | |
let myMList = Cons (2, Empty) | |
let threeFour = Cons(1, myMList) | |
let myTuple= 3,4 | |
let rec printMyListElements list = | |
match list with | |
| Empty -> () | |
| Cons(head , tail) -> | |
printf "%A" head | |
printMyListElements tail | |
printMyListElements threeFour | |
let rec printAllElements list = | |
match list with | |
| [] -> () | |
| head :: tail -> | |
printf "%A" head | |
printAllElements tail | |
printAllElements numbers | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment