Is there a way to get back the logic from a previously applied function?
Does it also make sense, or should fit in any use case?
example:
Is there a way for me to return that 3? (For example, imagine, I am inside a ceremony that has only received 'Lower Doost' 'and now it needs to know the first argument) Introspection / reflection (if possible) to idiocy Scala ) Is preferred for. / P> Conservative scala: No, you can not say you have specifically said The first argument is no longer relevant if the compiler can completely disappear, then it is best that you say that you have a function that depends on an int and string, and you have created it There is no promise about it. If you need actually that value, but you really need to pass 2-logic work, you can do it by hand: Now when you later use the function If you take, you can match the pattern That this function is 2 frame 3 and then read the value: (If it is important for you that it is an integer, then you can remove Reflection: No, you can not (not in general). More clever Textcode (if we wrap your code in def doStuff (lower: int, upper: int, b: string) = for (turn and lower - upper to lower) println (turn Imagine that at one point I know the 'low' logic and I get a function to implement 'doStuff' to do it. >
val lowDoStuff = doStuff (3, _: Int, _: string)
Class Function2From3 [A, B, C, Z] (F: (A, B, C) => Z, Wall _1: A) Expands 2 [B, C, Z] function {FRF applied ( B: B, C: C) = F (_1, B, C)} Val Lower Dotsfu = New Function 2 Afro 3 (DUSTF _, 3)
val f: function 2 [int, string, unit] = lower doustuff f match {case g: function 2 to 3 [_, _, _, _] = & Gt; Println ("I know there is a" + GI + + "!) Case _ = & gt; Println (" All this Greek is for me. ")}
A as a normal parameter and by making an integer by
_1 - and maybe it Call
class FuncApp ):
Public last zero applied (int, java.lang.String); signature: (iLajwa / Lang / string;) V code: 0: Aload_0 1: meets # 18; // field $ exterior: lfncap; 4: iconst_3 5: iLaodi 6: all_2 7: invovalual # 24; // method FuncApp.doStuff: (IILjava / Lang / String;) V10: Return
iconst_3 notice? This is where your 3 went - it disappeared in bytecode no hidden There is no private sector, too The value exists.
Comments
Post a Comment