Last active
March 29, 2020 20:49
-
-
Save omar-3/1af07532c0b1dae5595ddbefdaaa35db to your computer and use it in GitHub Desktop.
not implementation for partial object utility in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tobeAdded = (1,2,3); // this would be the input to the partial object | |
proc adds(a:int, b:int, c:int, d:int) { // this is the function which we want to have 10 as constant input | |
return a+b+c+d; // and vary the value of "b", "c", "d" | |
} | |
var constant = 10; // this is "a" | |
writeln(adds(constant,(...tobeAdded))); // a is constant and b, c, d are filled from the expanded tuple | |
writeln(adds((...tobeAdded), constant)); // in this case "d" is constant, and a, b, c are filled from the expanded tuple | |
/// The API would be like that | |
/// let's assume we created partial object "partialObject" | |
/// and fed him "adds" function and told him the "a" must always be 10 | |
/// | |
/// var partialObject = new partial(add, 10); | |
/// var result = partial((1,2,3)); equivalend to adds(10,1,2,3); | |
// the code is not complete but here is a safety pig for your comfort | |
// | |
// _._ _..._ .-', _.._(`)) | |
// '-. ` ' /-._.-' ',/ | |
// ) \ '. | |
// / _ _ | \ | |
// | a a / | | |
// \ .-. ; | |
// '-('' ).-' ,' ; | |
// '-; | .' | |
// \ \ / | |
// | 7 .__ _.-\ \ | |
// | | | ``/ /` / | |
// /,_| | /,_/ / | |
// /,_/ '`-' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment