Giter Site home page Giter Site logo

yolo's People

Contributors

enricosada avatar haf avatar halcwb avatar luiz-monad avatar symphonym avatar toburger avatar varon avatar wallymathieu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yolo's Issues

Possible additions

I'd like to adopt YoLo.fs instead of my own very similar file. I'd like to get a few more things from mine in here, so your thoughts on the following would be appreciated:

module Option = 
    let inline getOrElse d o = 
        match o with
        | Some v -> v
        | None -> d

Top-level functions:

    /// Const function. ignores the second argument
    let ct v = fun _ -> v
    
    /// Const function. Ignores the second and third arguments.
    let ct2 v = fun _ _ -> v
    
    /// Const function. Ignores 3 additional arguments.
    let ct3 v = fun _ _ _ -> v
    
    /// Invokes the provided function.
    let inline invoke f = f()
    
    /// Applies the function to the argument provided
    let inline apply x f = f x
 
    /// Composes two predicates with lazy evaluation
    let inline (>&&>) b1 b2 v = b1 v && b2 v

    /// Composes two predicates with lazy evaluation
    let inline (>||>) b1 b2 v = b1 v || b2 v
    
    /// As for (>>) but for a function f with two arguments.
    let inline (>>+) f g a b = g (f a b)
    
    /// As for (>>) but for a function f with three arguments.
    let inline (>>++) f g a b c = g (f a b c)
    
    /// As for (>>) but for a function f with four arguments.
    let inline (>>+++) f g a b c d = g (f a b c)
    
    /// Clamps a value between a min and a max
    let inline clamp minValue maxValue x = max minValue (min x maxValue)
    
    /// Clamp a value between zero and one
    let inline clamp10 x = clamp LanguagePrimitives.GenericZero LanguagePrimitives.GenericOne x

Dictionary

    module Dictionary = 
        open System.Collections.Generic
        
        let getOpt (dict : Dictionary<_, _>) key = 
            match dict.TryGetValue(key) with
            | (true, value) -> Some(value)
            | (false, _) -> None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.