Snippets tagged operators

  • Perl Style "Regex Matches?" operator

    Perl Style "Regex Matches?" operator

    49 people like this

    Posted: 6 years ago by fholm

  • Type-inference friendly division and multiplication

    F# necessarily forces you to explicitly cast between int and float for operations such as division. This is necessary because implicit conversion would make type inference much harder. However having to cast all the time in your code can be a pain. These operators reduce the overhead to one or at most two characters of code.

    2 people like this

    Posted: 4 years ago by Kit Eason

  • Unmanaged memory search

    Useful for pinvoke stuff where your native API requires that you have a unmanaged buffer containing the data you want to work on. Edit: Changed native calls, removed Marshal.Copy (there is a async corner case but I won't delve into it here) and replaced with pinning.

    4 people like this

    Posted: 4 years ago by David Klein

  • APL mode for F#

    Inspired by @theburningmonk, this snippet defines a couple of extensions and operators that can be used to make F# as short and as obscure as APL. Complete with a 19 character solution of the Euler problem #1!

    5 people like this

    Posted: 2 years ago by Tomas Petricek