-
Notifications
You must be signed in to change notification settings - Fork 107
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
Educational: built-in map
primitive
#1093
base: main
Are you sure you want to change the base?
Conversation
This leads to simplification in type inference since the construction of a `TabLam` (that was previously the single argument of `Map`) is no longer required there.
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.
Looks good!
TabPi (TabPiType (_:>ixTy) _) <- getType array' | ||
buildTabLam noHint ixTy \i -> do | ||
locals <- tabApp (sink ans) $ Var i | ||
ithArg <- emitAtomToName =<< (tabApp (sink array') $ Var i) |
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.
Instead of emitting to name, you could b @> SubstVal ithArg
below
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.
Thanks.
This is educational work.
DO NOT MERGE.
Implement a built-in
map
primitive for mapping a function over an array.The concrete syntax for the implemented
map
primitive ismap_ <function> over_ <array>
. Example:map_ (\x. 2 * x) over_ [0, 1, 2, 3]
will evaluate to[0, 2, 4, 6]
.