Comments (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:
-
(λx(x) λx(x))
(completely linear, so ez) -
(λx(Pair x x) λx x)
(non-linear, but not self-applying... acceptable) -
(λx(x x) λx x)
(non-linear and self-applying, but nothing else... that hurts, but we're fine) -
(λfλx(f (f x)) λfλx(f (f x)))
(okay, we're reaching our limits, but nof f
so still okay) -
(λ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.
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.
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)
- Confused by testing infrastructure HOT 2
- Why distinguish FUN and CTR? HOT 2
- How far should `reduce` reduce? HOT 1
- Feedback on reqwest dependency HOT 5
- Rule flattening produces incorrect results on rules with nums
- Useless `let` produced by rule sanitization HOT 2
- Error building with Nix HOT 4
- HVM doesn't use normal order reduction. HOT 3
- [Question] Kubernetes deployment? HOT 5
- Automatic deforestation. HOT 2
- Wrong behaviour of the `str_sugar` function
- Guide is outdated HOT 10
- On the performance of radix sort. HOT 6
- [Regression] Incorrect result on `nqueens` program HOT 5
- Questions about Lambda operator and parallel evaluation. HOT 1
- Performance regression on HVM v1.0 HOT 8
- Crash on thread spawning HOT 3
- Programs with a lot of dups get stuck HOT 5
- Multithreaded sequential programs spend most their active time waiting HOT 4
- Attempting to `cargo install --path .` for the Summation.hvm example from the HVM guide readme fails HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hvm.