Comments (12)
This should get you started:
Comments in code at least intend to point to where this should happen:
https://github.com/lurk-lang/lurk-rs/blob/master/src/eval.rs#L481-L485
https://github.com/lurk-lang/lurk-rs/blob/master/src/eval.rs#L551
And here is how it's done in lang.lisp
:
https://github.com/lurk-lang/lurk/blob/master/impl/lang.lisp#L805-L813
https://github.com/lurk-lang/lurk/blob/master/impl/lang.lisp#L877-L885
Note that Continuation::Tail
is (for now) called CALL3-CONTINUATION
in lang.lisp
.
from lurk-rs.
I can think of at least two ways of doing it:
- have a new kind of call continuation for zero-arg functions
- transform
(lambda () ...)
to(lambda (dummy) ...)
. This seems in the spirit of the auto-currying that is currently done.
Any thoughts?
from lurk-rs.
I think the most economical thing (both conceptually and in terms of computation) is to use Continuation::Tail
. This is exactly a continuation awaiting no more values. That's why it used to be called Call3
: it's what comes after the second value (the argument, first was the function) has been supplied.
Although the context of the code there may have drifted, I think that (just use Tail
) is what this comment is trying to communicate: https://github.com/lurk-lang/lurk-rs/blob/master/src/eval.rs#L763-L765
from lurk-rs.
I am not sure what you have in mind for distinguishing the zero-arg case from the one-arg case when matching on Continuation::Call.
https://github.com/lurk-lang/lurk-rs/blob/master/src/eval.rs#L535
from lurk-rs.
Sounds like we need to change handling of lambda
too:
https://github.com/lurk-lang/lurk-rs/blob/master/src/eval.rs#L307
from lurk-rs.
Ah, I think that if it turns out we can use Continuation::Tail
for the zero-arg case, then we actually won't need to add anything there. In that case, the change will just be to delete the comment, as the implementation will be a no-op.
I think this is where we have parsed the input and know we need to handle a zero-arg function. https://github.com/lurk-lang/lurk-rs/blob/master/src/eval.rs#L473
from lurk-rs.
We still have two steps: we need to evaluate the fun_form
, and then we need to invoke it. It's not just the invocation part.
from lurk-rs.
Right, I agree with that. Am just paging this in. If my previous makes sense as far as it goes, then I think you're on track here.
from lurk-rs.
Yeah, sorry if it would be faster for you to implement than to explain what you had in mind :D
I am not convinced we can do it with one Continuation::Tail because how are we going to get the body
out of the fun_form
?
Thanks.
from lurk-rs.
I think using the one-arg translation of zero-arg functions might be the most economical, since it's just a syntactic change.
from lurk-rs.
I think you might be right. I don't have time to trace this all down right now, and I suspect that if I do I will end up with the same conclusion. So… I think it's probably worthwhile for you to go ahead and implement that way. If a viable competitor emerges, we can look at it, but if you have a line on this, feel free to proceed.
from lurk-rs.
Sounds good, thanks!
from lurk-rs.
Related Issues (20)
- expose minimal bit operations
- move sha256 coprocessor out of lurk crate HOT 1
- Avoid dangling symbols
- Optimize memory usage in `ZDag` functions
- Nightly run failed HOT 1
- chore: some installed deps are not needed
- Nightly run failed
- Migrate to `tonic_rpc`
- `call` and `chain` meta-commands should take one argument
- Coroutine support for `Op::Recv` and `Op::Emit`
- Move `lang` and `prove_from_frames` to the `Prover` trait
- [LUR-37] Supernova benchmarking gap HOT 1
- A better design for Z data
- Expand `chain` and `call` to use generic callables
- Chain server pt2
- chore: rust toolchain needs an upgrade
- Nightly run failed HOT 128
- error: inline assembly requires more registers than available HOT 2
- chore: rust toolchain needs an upgrade
- chore: some installed deps are not needed
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 lurk-rs.