Giter VIP home page Giter VIP logo

Comments (3)

VictorTaelin avatar VictorTaelin commented on August 16, 2024 3

(g g) is not a no-no! It is fine and very useful. What is not fine is g g when g is itself a function that has g g. Like, this is okay: (λg(g g) λg g), but this is not okay: (λg(g g) λg(g g)). The Fold function just uses the c argument twice, which is even-more-okay than g g, since c isn't applied itself. So, if we rank terms based on how much they stress HVM's cloning limits, we have:

  1. (λx(x) λx(x)) (completely linear, so ez)

  2. (λx(Pair x x) λx x) (non-linear, but not self-applying... acceptable)

  3. (λx(x x) λx x) (non-linear and self-applying, but nothing else... that hurts, but we're fine)

  4. (λfλx(f (f x)) λfλx(f (f x))) (okay, we're reaching our limits, but no f f so still okay)

  5. (λx(x x) λfλx(f (f x))) (game over, that's too much for us to handle)

On this scale, HVM deals fine with 1-4. Fold is more around 2. And 5 is basically problematic useless stuff. (I challenge anyone to come up with a good example that HVM can't handle, that has any relevant application, or that isn't a contrived way to express a program that just needs to be refactored to not suck.)

from hvm.

VictorTaelin avatar VictorTaelin commented on August 16, 2024 1

It can! For example, this is fine:

let i = λx x
let g = λf (f f)
((g i) (g i))

Here, g is a function that self-applies its argument, and it is used twice. But the clones aren't self-applied. Instead, each clone is applied to λx x, which makes it fine. Since this is too confusing, I've been thinking about some ideas on how to incorporate an "ill clone checker" on HVM, that isn't as restrictive as the old Fm-Core checker.

from hvm.

Heimdell avatar Heimdell commented on August 16, 2024

A-ha, so a function that directly self-apply an argument can't be used twice?

In this case, self-applying stuff like (f f) is a type error in most type systems to begin with.

from hvm.

Related Issues (20)

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.