-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Multiple Argument Functionality to STLC Interface #115
Conversation
1ca7e1f
to
0e383e0
Compare
Adding @rokopt as a new reviewer to receive approval on the new compilation pass. Note that the application interpretation follows from composition-as-substitution definition in the term model. |
e716b3f
to
56d088a
Compare
1fd156d
to
4a10cd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see updated docs on the classes. Since the semantics of lambda and app changed, I wish for the class documentation to be updated to reflect this, and type signatures added to the classes and constructors as well, so I can see them at a glance.
Overall after some docs changes I did manually the pr seems to work, I want the HOF example put into a test as well
src/util/utils.lisp
Outdated
(defun apply-n (times f initial) | ||
(let ((value initial)) | ||
(dotimes (n times value) | ||
(setf value (funcall f value))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably would good to have a doc string with this
(nth i ctx) | ||
(error "Argument exceeds length of context")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah much nicer
@@ -121,10 +121,10 @@ functions taking in context and terms below as well.")) | |||
(if (typep type-of-term 'prod) | |||
(snd ann-term :ttype (mcadr type-of-term)) | |||
(error "type of term not of product type")))) | |||
((lamb tdom term) (let ((ant (ann-term1 (cons tdom ctx) term))) | |||
((lamb tdom term) (let ((ant (ann-term1 (append tdom ctx) term))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes tests to fail, as tdom is still so1 in some situations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the merged commits this is no longer an issue
(ann-left (ann-term1 (cons (mcar type-of-on) ctx) ltm)) | ||
(ann-left (ann-term1 (cons (mcar type-of-on) ctx) ltm)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a needless change that makes formatting worse
src/lambda/trans.lisp
Outdated
fun) | ||
(rec context | ||
term))))) | ||
(comp (rec context fun) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change
(comp (rec context fun) ...)
into
(comp (rec context fun) ...)
The intended semnatics are: [TDOM][generic-function] is a list of types (and | ||
hence a list of [SUBSTOBJ][GEB.SPEC:SUBSTOBJ]) whose iterative product of | ||
components form the domain of the function type. [TERM][generic-function] | ||
is a term (and hence an [STLC][type]) of the codomain of the function type | ||
gotten in the context to whom we append the list of the domains. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these docs need to propagate into the class docs
4a10cd5
to
27315c9
Compare
97cf2dc
to
dc40019
Compare
Adds a utility function applying a given function n-times recursively. Useful for iterative calls of Geb functions.
dc40019
to
89299f8
Compare
Updates lambda term API and documentation for multi-domain function-forming. Additionally, curries the compilation pass. Introduces a new API for function application term allowing for a multi-value function to be applied to several arguments. Fixes tests accordingly.
89299f8
to
6465c06
Compare
Add lambda documentation specifying the indexing of free variables. Adds more documentation for upgraded STLC API and adds typing so that the constructors of STLC do not accept arguments other than the ones intended by the operational semantics. Further adds some examples of some uses of lambda
6465c06
to
9ad208d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me -- thank you!
As a general comment: I suggest we ask the Juvix team how much it'll take for them to adapt to the change to the indexing; if it's at all difficult then we could provide a utility that just syntactically transforms a program written with the old indexing to one written with the new.
This commit adds following functionality:
lamb
now accepts a list of types for itstdom
accessor allowing for functions to be defined in a complex context. The domain of such a lambda term will then be the iterated product.'app' now accepts a list of terms for its
term
accessor allowing for a multi-argument function to be iteratively applied.Change
index
functionality to follow usual convention of reading contexts from left to right.Change the STLC -> GEB compilation to be uncurried solving Uncurry Pipeline Usage #106 and allowing for a neater solution to Geb should expose VampIR error conditions through its STLC API #90