如何使用函数式方法做正则表达式?目前我希望用户输入一个输入,即使他们以大写字母输入它仍然会给出响应吗?我不确定如何实现这一点。
open System
open System.Drawing
open System.Windows.Forms
let (|Hello|Bye|None|) input =
match input with
| "hello" | "hi" | "morning"
-> Hello
| "Goodbye" | "bye" | "go"
-> Bye
| _
-> None
let rand = new Random()
let hello_response () =
let n = rand.Next(10)
match n with
| 0 -> "How do you do."
| 1 -> "Is nice talking to you."
| 2 -> "Tell me something new."
| 3 -> "Nice to meet you."
| …Run Code Online (Sandbox Code Playgroud)