Jump to content

Lambda expressions - A really rough sketch.


guinness
 Share

Recommended Posts

If you are coming from the realm of C# 3.0 then lamda expressions should be pretty familiar to you as it's basic syntactic sugar for creating a function with a conditional return.

 

Since functions in AutoIt are first class objects, the following code should make some sense. It passes an array of integers to a function called IsTrueForAll() that checks whether the function object matches the return condition of that function (you passed). So for example a function called IsGreaterThanOrEqualTo10() checks if all values are greater than or equal to 10 (TRUE). Similarly, IsLessThan10() checks if all values are less than 10 (FALSE). This example should be nothing new to those of you who use v3.3.10.0+ and have an understanding of Call().

#include <MsgBoxConstants.au3>

Local $aArray[] = [10, 100, 99, 67]
If IsTrueForAll($aArray, IsGreaterThanOrEqualTo10) Then
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')
EndIf

If IsTrueForAll($aArray, IsLessThan10) Then
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')
EndIf

Func IsTrueForAll($aArray, $hFunc) ; Loop through the array and check the function passed with a single param matches the condition.
    For $i = 0 To UBound($aArray) - 1
        If Not $hFunc($aArray[$i]) Then
            Return False
        EndIf
    Next
    Return True
EndFunc   ;==>IsTrueForAll

Func IsGreaterThanOrEqualTo10($x)
    Return  $x >= 10
EndFunc ;==>IsGreaterThanOrEqualTo10

Func IsLessThan10($x)
    Return  $x < 10
EndFunc ;==>IsLessThan10
But, we could easily just forget about writing the functions (less typing is always nice) and let the compiler or pre-processor do all the work for us. It would simply use the lambda expression and create the function for us with whatever we specified. Like so...

#include <MsgBoxConstants.au3>

Local $aArray[] = [10, 100, 99, 67]
If IsTrueForAll($aArray, $x => $x >= 10) Then ; $x is the parameter, => tells us it's a lambda expression and then the condition we are checking.
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')
EndIf

If IsTrueForAll($aArray, $x => $x < 10) Then ; $x is the parameter, => tells us it's a lambda expression and then the condition we are checking.
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')
EndIf

Func IsTrueForAll($aArray, $hFunc) ; Loop through the array and check the function passed with a single param matches the condition.
    For $i = 0 To UBound($aArray) - 1
        If Not $hFunc($aArray[$i]) Then
            Return False
        EndIf
    Next
    Return True
EndFunc   ;==>IsTrueForAll
...which would create the following code with anonymous functions (they're anonymous as we don't care about them in our main script)...

#include <MsgBoxConstants.au3>

Local $aArray[] = [10, 100, 99, 67]
If IsTrueForAll($aArray, D3F7B1B92177415CA70C7FFC35C2649C) Then
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')
EndIf

If IsTrueForAll($aArray, DA06B548ABF4045AA32F805E6651004) Then
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')
Else
    MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')
EndIf

Func IsTrueForAll($aArray, $hFunc)
    For $i = 0 To UBound($aArray) - 1
        If Not $hFunc($aArray[$i]) Then
            Return False
        EndIf
    Next
    Return True
EndFunc   ;==>IsTrueForAll

Func D3F7B1B92177415CA70C7FFC35C2649C($x)
    Return  $x >= 10
EndFunc ;==>D3F7B1B92177415CA70C7FFC35C2649C

Func DA06B548ABF4045AA32F805E6651004($x)
    Return  $x < 10
EndFunc ;==>DA06B548ABF4045AA32F805E6651004
Example of parsing a lambda expression and replacing in the chosen script:

#include <WinAPICom.au3>

; Script read from a file.
Local $sScript = "#include <MsgBoxConstants.au3>" & @CRLF
$sScript &= "" & @CRLF
$sScript &= "Local $aArray[] = [10, 100, 99, 67]" & @CRLF
$sScript &= "If IsTrueForAll($aArray, $x => $x >= 10) Then" & @CRLF ; Lambda expression.
$sScript &= "   MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')" & @CRLF
$sScript &= "Else" & @CRLF
$sScript &= "   MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')" & @CRLF
$sScript &= "EndIf" & @CRLF
$sScript &= "" & @CRLF
$sScript &= "If IsTrueForAll($aArray, $x => $x < 10) Then" & @CRLF ; Lambda expression.
$sScript &= "   MsgBox($MB_SYSTEMMODAL, '', 'Condition was True.')" & @CRLF
$sScript &= "Else" & @CRLF
$sScript &= "   MsgBox($MB_SYSTEMMODAL, '', 'Condition was False')" & @CRLF
$sScript &= "EndIf" & @CRLF
$sScript &= "" & @CRLF
$sScript &= "Func IsTrueForAll($aArray, $hFunc) ; Loop through the array and check the function passed with a single param matches the condition." & @CRLF
$sScript &= "   For $i = 0 To UBound($aArray) - 1" & @CRLF
$sScript &= "       If Not $hFunc($aArray[$i]) Then" & @CRLF
$sScript &= "           Return False" & @CRLF
$sScript &= "       EndIf" & @CRLF
$sScript &= "   Next" & @CRLF
$sScript &= "   Return True" & @CRLF
$sScript &= "EndFunc   ;==>IsTrueForAll" & @CRLF

ReplaceLambdaInScript($sScript, '$x => $x >= 10') ; Parse the lambda expression and replace it in the above script.
ReplaceLambdaInScript($sScript, '$x => $x < 10') ; Parse the lambda expression and replace it in the above script.

ConsoleWrite($sScript & @CRLF) ; This is the new script with the lamda expression convert to an anonymous method!
ClipPut($sScript)

Func CreateLambdaMethod($sExpression) ; Currently no error checking of whether parameters match.
    Local $bIsReturn = False, _ ; Is the return condition.
            $sFunction = StringRegExpReplace(_WinAPI_CreateGUID(), '[}{-]', ''), $sParam = '', $sReturn = ''
    $sFunction = StringRegExpReplace($sFunction, '^\d+', '') ; Remove digits at the beginning of the function name.
    For $i = 1 To StringLen($sExpression)
        $sChr = StringMid($sExpression, $i, 1)
        If $bIsReturn Then
            $sReturn &= $sChr
        ElseIf $sChr & StringMid($sExpression, $i + 1, 1) == '=>' Then ; Check for =>
            $i += 1
            $bIsReturn = True
        ElseIf Not $bIsReturn Then
            $sParam &= $sChr
        EndIf
    Next
    If Not $bIsReturn Then Return "" ; Something went wrong as the => was not found.

    $sParam = '(' & StringRegExpReplace($sParam, '^\h*|\h*$', '') & ')'
    $sReturn = @TAB & 'Return ' & $sReturn
    Return 'Func ' & $sFunction & $sParam & @CRLF & $sReturn & @CRLF & 'EndFunc ;==>' & $sFunction & @CRLF
EndFunc   ;==>CreateLambdaMethod

Func ReplaceLambdaInScript(ByRef $sScript, $sLambda)
    Local $sFunction = CreateLambdaMethod($sLambda)
    Local $sFunctionName = StringRegExp($sFunction, 'Func (\w*)\(', 3)
    If @error Then Return False
    $sFunctionName = $sFunctionName[0]
    $sScript = StringReplace($sScript, $sLambda, $sFunctionName, 1)
    $sScript &= @CRLF & $sFunction
    Return True
EndFunc   ;==>ReplaceLambdaInScript
It was a simple idea I had this morning whilst having breakfast. Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Just in case...

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

The saying is old code should run new code, therefore we don't need to change the function IsTrueForAll(), just the function we pass which contains the condition we are checking.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Funnily enough I was thinking of mentioning this to you, as you'd already written a preprocessor capable of this.

C# lambdas a quite complex when you get to how they deal with variables used within them. For example look at the following code:

delegate int MulByDelegate(int x);

        static void Main(string[] args)
        {
            MulByDelegate mul1;
            MulByDelegate mul2;

            {
                int mulBy = int.Parse(Console.ReadLine());

                mul1 = (x => x * mulBy);
            }

            {
                int mulBy = int.Parse(Console.ReadLine());

                mul2 = (x => x * mulBy);
            }

            Console.WriteLine("mul1 = {0}", mul1(5));
            Console.WriteLine("mul2 = {0}", mul2(5));
            Console.ReadKey();
        }

This demonstrates that lambdas are first class objects, and are created at runtime. As you'd expect, mul1 does multiplication by the first number you input and mul2 by the second.

Now try this very similar code:

delegate int MulByDelegate(int x);

        static void Main(string[] args)
        {
            MulByDelegate mul1;
            MulByDelegate mul2;

            {
                int mulBy = int.Parse(Console.ReadLine());

                mul1 = (x => x * mulBy);

                mulBy = int.Parse(Console.ReadLine());

                mul2 = (x => x * mulBy);
            }

            Console.WriteLine("mul1 = {0}", mul1(5));
            Console.WriteLine("mul2 = {0}", mul2(5));
            Console.ReadKey();
        }

The only difference is that instead of the mulBy variable going out of scope then being re-declared, it is reused. Now both lambdas should be the same. 

The variable mulBy is captured, rather than just substituted in.

When you disassemble the C# code for the latter, you'll find there is actually a new static class created, called c__DisplayClass2 or something like that, which has mulBy as a member variable. When looking at the byte code of the former you'll see two classes with names like that, both with their own mulBy member.

This page may go some way towards explaining the behaviour and its uses.

Link to comment
Share on other sites

1. I didn't think about using { } as you did. My mind is quite literally blown.

2. Maybe I am not seeing what you're seeing, because I am using ILSpy.

 

1st

private static void Main(string[] args)
{
    int mulBy2 = int.Parse(Console.ReadLine());
    Program.MulByDelegate mul = (int x) => x * mulBy2;
    int mulBy = int.Parse(Console.ReadLine());
    Program.MulByDelegate mul2 = (int x) => x * mulBy;
    Console.WriteLine("mul1 = {0}", mul(5));
    Console.WriteLine("mul2 = {0}", mul2(5));
    Console.ReadKey();
}
2nd

private static void Main(string[] args)
{
    int mulBy = int.Parse(Console.ReadLine());
    Program.MulByDelegate mul = (int x) => x * mulBy;
    mulBy = int.Parse(Console.ReadLine());
    Program.MulByDelegate mul2 = (int x) => x * mulBy;
    Console.WriteLine("mul1 = {0}", mul(5));
    Console.WriteLine("mul2 = {0}", mul2(5));
    Console.ReadKey();
}

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

IlSpy is too clever, you need to look at the actual byte code. Should be a program called Ildasm in the start menu (it's installed with visual studio).

Even then, the first one is actually changed. Notice how there are now two different variables names rather than one being reused! That actually displays the difference very nicely.

Link to comment
Share on other sites

I looked at the IL code as well, but I am way too tired right now. Tomorrow I will look and understand.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...