See my RomanNumerals project.
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.Threading | |
open System.Threading.Tasks | |
let semaphoreWaitAsync semaphore cancellationToken = task { | |
printfn "Semaphore wait begin." | |
let ss = (semaphore: SemaphoreSlim) | |
let ct = (cancellationToken : CancellationToken) | |
try | |
do! ss.WaitAsync(ct) // This doesn’t work. OperationCanceledException is not caught. |
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
package shop.examples; | |
import javafx.application.Application; | |
import javafx.beans.Observable; | |
import javafx.scene.Cursor; | |
import javafx.scene.Scene; | |
import javafx.scene.input.KeyEvent; | |
import javafx.scene.input.MouseEvent; | |
import javafx.scene.layout.Pane; | |
import javafx.stage.Stage; |
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
// Consider the heavily-aligned source code as a kind of exploded view to aid understanding. | |
// C# version: https://gist.github.com/daveyostcom/307aedf294042d0aba596cda9cc480ea | |
// Swift version: https://gist.github.com/daveyostcom/21cc630c3431026db73abd7606a59414 | |
// Inspired by https://codeblog.jonskeet.uk/2012/01/30/currying-vs-partial-function-application/ | |
class PartialFunctionApplicationVsCurrying { | |
func main() { |
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
using System; | |
namespace PartialFunctionApplicationVsCurrying { | |
// Consider this heavily-aligned source code as a kind of exploded view to aid understanding. | |
// Func<> documentation https://docs.microsoft.com/en-us/dotnet/api/system.func-4 | |
// C# version: https://gist.github.com/daveyostcom/307aedf294042d0aba596cda9cc480ea | |
// Swift version: https://gist.github.com/daveyostcom/21cc630c3431026db73abd7606a59414 | |
// Inspired by https://codeblog.jonskeet.uk/2012/01/30/currying-vs-partial-function-application/ |
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
#!/usr/bin/swift | |
// swift-4.1-Codable-JSON.swift | |
// | |
// Example code in Swift 4.1 for JSON using the Codable protocol | |
import Foundation | |
let encoder = JSONEncoder() | |
let decoder = JSONDecoder() |