Comments (11)
Note that all the reductions are correct, just not in the form that you expected
from bend.
1: The result is the eta-reduced form of the expected.
2 and 3:
The inner lambdas are combinators, which are converted into lazy references to top-level functions and so didn't get executed.
I understand that for the main function this is generally not what users want. This is being tracked here #424
from bend.
Sometimes eta-reduction isn't done:
Main = λa λb (a ((λc c b))) | Result: λa λb (a b)
and:
Main = λa λb (a b) | Result: λa a
Which one would be the right answer?
from bend.
We eta-reduce the input but not the output. But they're equivalent in effect so both are correct
from bend.
Missing some beta-reduction:
Main = (λa a λa (λb b a)) | Result: λa (λb b a)
and:
Main = λa (λb b a) | Result: λa a
It's not clear why the reduction is missing.
from bend.
2 and 3: The inner lambdas are combinators, which are converted into lazy references to top-level functions and so didn't get executed. I understand that for the main function this is generally not what users want. This is being tracked here #424
from bend.
I have an unexpected result:
Main = λa (λb (λc b b) λb (b (a b))) | Result: λa λb (b (a *))
While I expected something like λa λb (b (a b))
.
Is this the same issue?
from bend.
No, thats a different problem. Your program duplicates a function that duplicates a value, which is currently not valid in Bend.
In some cases this is caught during runtime and the program panics, but we don't know of any way to detect all cases besides type checking.
from bend.
With #548, it should be much rarer to trigger the second and third cases of your original comment
from bend.
Indeed it seems to be gone.
Without duplication:
Main = λa λb (λc b (a λc c)) | Result: ((λa a, *), λb b) | Expected: λa λb b
from bend.
Indeed it seems to be gone.
Without duplication:
Main = λa λb (λc b (a λc c)) | Result: ((λa a, *), λb b) | Expected: λa λb b
Conversion from HVM to Bend can have more than one possible interpretation.
The resulting net, in HVM syntax is (((a a) *) (b b))
((λa a, *), λb b)
is one valid form of the result.
Another equally valid result would be let * = (a λc c); λa λb b
, which is the one you're expecting.
Currently the heuristic for deciding if a node is a lambda or a tuple is very simplistic and will give some unexpected results.
from bend.
Related Issues (20)
- Add progressive typing to Bend HOT 11
- Irrefutable match optimization binding issues
- Don't have the Rust runtime as the default for `bend run` HOT 3
- Add IO for loading and calling dynamically linked libraries
- Enable net size check when running with `run-cu` HOT 5
- Unbound error with correct code
- Convert between Integer and float HOT 4
- FFI for rustlang like a tokio runtime function where i can offload the specific function code to gpu HOT 1
- Monadic operations inside `match` nested inside `with` have unexpected behaviour HOT 2
- "Failed to parse result from HVM" from HVM returning Segmentation Fault when using lage array HOT 2
- Implement lexer and parser using virtual block tokens HOT 2
- Performance degradation on Bitonic Sort output since release HOT 5
- `with` blocks give a false error when the bind function comes from an import HOT 1
- IO/FS/read_line never ends when reading last line with bend run-c HOT 4
- possible to have a bend lang rust + go version or just rust version? HOT 1
- Reading large arrays seems to take forever and if endup, results in Segmentation fault HOT 1
- Improvement in fun syntax
- Main can be unexpectedly lazy when it expands into a function with combinators HOT 1
- References in main aren't expanded when they're inside lists
- Hexadecimal and binary floating-point numbers
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 bend.