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
| let detect1 x = | |
| match x with | |
| | 1 -> printfn "Found a 1!" | |
| | (var1 : int) -> printfn "%d" var1 | |
| let my_list = [0..9] | |
| for i in my_list do detect1 i |
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
| type Money = Money of decimal | |
| let calcTax (Money price) = Money (price * 0.1m) | |
| let p = Money 100m | |
| calcTax p |> printfn "%A" |
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
| type TypeMoney = CaseMoney of decimal | |
| let calcTax (CaseMoney price) = CaseMoney (price * 0.1m) | |
| let p = CaseMoney 100m | |
| calcTax p |> printfn "%A" |
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
| type TypeMoney = CaseMoney of decimal | |
| let calcTax (param_price: TypeMoney) = | |
| //let local_price = match param_price with CaseMoney local_p -> local_p | |
| let local_price = match param_price with CaseMoney (local_p) -> local_p | |
| CaseMoney (local_price * 0.1m) | |
| let p = CaseMoney 100m | |
| calcTax p |> printfn "%A" |
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
| type Money = Money of decimal | |
| let calcTax (price: Money) = | |
| let price = match price with Money p -> p | |
| Money (price * 0.1m) | |
| let p = Money 100m | |
| calcTax p |> printfn "%A" |
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
| import json | |
| import lzma | |
| import nltk | |
| import random | |
| nltk.download('twitter_samples') | |
| my_filters = [ | |
| {"id": lzma.FILTER_LZMA2, "preset": 9 | lzma.PRESET_EXTREME}, | |
| ] |
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
| import lzma | |
| import nltk | |
| import random | |
| nltk.download('reuters') | |
| nltk.download('brown') | |
| nltk.download('gutenberg') | |
| my_filters = [ | |
| {"id": lzma.FILTER_LZMA2, "preset": 9 | lzma.PRESET_EXTREME}, |
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
| $OneNote = New-Object -ComObject OneNote.Application | |
| Add-Type -assembly Microsoft.Office.Interop.OneNote | |
| $target_id = "{A969C2B3-B790-0EDD-2E5A-9D834611888C}{1}{E1950583228671326940781911959017434812881141}" | |
| $publish_path = "G:\work\onenote\export.docx" | |
| $pandoc_path = "p:\myapp\pandoc-3.1.2" | |
| $markdown_path = "G:\work\onenote\export.md" | |
| $OneNote.Publish( |
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
| function makeCSV($hierarchy, $node_depth){ | |
| $data = @() | |
| foreach ($item in $hierarchy.ChildNodes){ | |
| $data += makeCSVitem $node_depth $item | |
| } | |
| return $data | |
| } |
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
| function printAll($hierarchy, $indent_level){ | |
| foreach ($item in $hierarchy.ChildNodes){ | |
| printName $item $indent_level $False | |
| } | |
| } | |
| function printName($items, [int]$indent_level, [bool]$printID){ | |
| $indent = "`t" * $indent_level | |
| foreach($item in $items){ |