Lambdas or something alike...
Posted: 03 Feb 2015 02:41
Hey!
I made something alike lambdas:
I have seen "macro" topics before, but this way is much simpler (and slower ). Can this be useful?
I made something alike lambdas:
Code: Select all
@echo off
set lambda=call:lambda
set func=%lambda%:echo\.\1\_\3
%func% THIS_WIIL_ECHO BUT_THIS_NOT AND_THIS_WILL
exit /B
:lambda:[code] [args]
setlocal
for /f "delims=: tokens=1*" %%a in ("%0") do set "code=%%b"
set "ccode=%code%"
call set "code=%%code:\*=%*%%"
call set "code=%%code:\1=%1%%"
call set "code=%%code:\2=%2%%"
call set "code=%%code:\3=%3%%"
call set "code=%%code:\4=%4%%"
call set "code=%%code:\5=%5%%"
call set "code=%%code:\6=%6%%"
call set "code=%%code:\7=%7%%"
call set "code=%%code:\8=%8%%"
call set "code=%%code:\9=%9%%"
call set "code=%%code:\_= %%"
call set "code=%%code:\:=;%%"
call set "code=%%code:\.=,%%"
call set "code=%%code:\@=&%%"
call set "code=%%code:\/=|%%"
call set "code=%%code:\]=>%%"
call set "code=%%code:\[=<%%"
call set "code=%%code:\0=%ccode%%%"
endlocal && %code%
exit /B
I have seen "macro" topics before, but this way is much simpler (and slower ). Can this be useful?