|
PPdos
高级用户
   
积分 783
发帖 268
注册 2006-12-26
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
Originally posted by qzwqzw at 2008-6-25 02:09 PM:
大家说了半天
都没觉得是在围着一个很不典型的例子在讨论问题吗?
难道没人知道set /a是缺省具有延迟效果的吗?
楼主的那个例子完全用不着变 ...
如果缩成一行写呢?
Originally posted by qzwqzw at 2008-6-25 02:09 PM:
Everyone has been talking for a long time
Don't you all feel that we are discussing the problem around a very non-typical example?
Does no one know that set /a has the default delay effect?
The example of the landlord is completely unnecessary to change...
What if it is written in one line?
|

菩提本无树,明镜亦非台,本来无一物,何处惹尘埃. |
|
2008-6-25 21:15 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
很无味的想法
代码追求简洁明快
而非简短古怪
Very tasteless idea. The code pursues simplicity and clarity rather than being short and strange.
|
|
2008-6-25 21:20 |
|
|
metoo
初级用户
 
积分 195
发帖 93
注册 2006-10-28
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
Originally posted by qzwqzw at 2008-6-25 09:09 PM:
大家说了半天
都没觉得是在围着一个很不典型的例子在讨论问题吗?
难道没人知道set /a是缺省具有延迟效果的吗?
楼主的那个例子完全用不着变 ...
兄貌似对什么叫延迟变量了解不够透彻,同样是for循环结束后变量自然是生效的
应用上面的一个例子不用set/a
@echo off
for /f %%a in ('dir/b') do (
set ww=%%a
)
echo %ww%
pause
可以看到最后变量%ww%是会被赋予最后的值的
Originally posted by qzwqzw at 2008-6-25 09:09 PM:
You've been talking for a long time,
Don't you all think you're discussing the problem around a very non-typical example?
Does no one know that set /a has the default delay effect?
The example of the building owner is completely unnecessary to change...
Brother seems to have insufficient understanding of what delay variables are. Similarly, the variable will naturally take effect after the for loop ends.
Apply an example above without set/a
@echo off
for /f %%a in ('dir/b') do (
set ww=%%a
)
echo %ww%
pause
It can be seen that the final variable %ww% will be assigned the last value
|
|
2008-6-25 21:20 |
|
|
PPdos
高级用户
   
积分 783
发帖 268
注册 2006-12-26
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
很无味的想法
代码追求简洁明快
而非简短古怪
那无奈何老大的签名岂不是让你说的一文不值拉。。。。
Last edited by PPdos on 2008-6-25 at 02:32 PM ]
Bland idea
Code pursues simplicity and clarity
Not short and strange
Then, isn't Lao Da's signature made worthless by what you said...
Last edited by PPdos on 2008-6-25 at 02:32 PM ]
|

菩提本无树,明镜亦非台,本来无一物,何处惹尘埃. |
|
2008-6-25 21:30 |
|
|
metoo
初级用户
 
积分 195
发帖 93
注册 2006-10-28
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
Originally posted by qzwqzw at 2008-6-25 09:15 PM:
metoo老兄9楼的言论有欠思量啊
在没有变量延迟的dos时代
也是可以“连续赋值/中间环节直接获取”的
这只需要对被call的:num_add一节做些小小的改 ...
确实。。是可以用这个格式。。
某些代码我也欠考虑了,很高兴这论坛能有这样的气氛^ ^
Originally posted by qzwqzw at 2008-6-25 09:15 PM:
Brother metoo, the remarks in post 9 are a bit thoughtless.
In the DOS era without variable delay,
it is also possible to "assign continuously / directly obtain intermediate links"
This only requires making some small changes to the :num_add section that is called...
Indeed. This format can be used..
Some of my code was also under-considered. I'm glad this forum can have such an atmosphere^ ^
|
|
2008-6-25 21:30 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
metoo老兄可能是引用错了吧
我是在15楼反驳你的言论的
13楼的说法我是在证明楼主代码的多余
貌似没有什么问题
首先变量延迟我是了解的
“延迟变量”倒是第一次看见
兄在18楼的例子想说明什么问题?
任何变量在被“连续赋值”后自然都应该是最后的生效啊?
这没有什么值得讨论的啊
Last edited by qzwqzw on 2008-6-25 at 11:11 PM ]
Brother metoo may have misquoted. I was refuting your remarks on the 15th floor.
My statement on the 13th floor was to prove that the code of the thread starter is redundant. It seems there is no problem.
First, I am familiar with variable delay. The "delayed variable" is the first time I've seen it.
What problem are you trying to illustrate with the example on the 18th floor?
Any variable should naturally take effect as the last one after being "continuously assigned"? There's nothing to discuss about this.
Last edited by qzwqzw on 2008-6-25 at 11:11 PM ]
|
|
2008-6-25 21:31 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
无奈何的签名其里重于其表
其中透出的无奈与豁达
我是很欣赏的
如果没有点睛的那几句释名辞
我只会视作过眼云烟
可很多人都被那古怪的结构
和willsort的一篇释义帖
搞得在技术的迷宫里迷失了方向
反而失去了最应该值得珍视的内在
不要觉得在讨论技术的地方
就应该钻技术的牛角尖
毕竟技术的讨论和发展是不断推陈出新的
而心灵的感觉和人生的体验却往往是弥足珍贵的
The weight of the content of the signature is greater than its appearance. The helplessness and openness revealed in it are what I very much appreciate. If there were no those finishing-off explanatory words, I would only regard it as something passing by. But many people are confused in the technical maze by that strange structure and a post of explanation by willsort, and instead lose the most precious inner part. Don't think that in the place where technology is discussed, one should get stuck in the technical details. After all, the discussion and development of technology are constantly bringing forth new things, while the feeling of the heart and the experience of life are often extremely precious.
|
|
2008-6-25 21:45 |
|
|
metoo
初级用户
 
积分 195
发帖 93
注册 2006-10-28
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
其实楼主的言论是对的- -!
然后ppdos兄的简化其实是错误的,并不能代替延迟变量,而是简单的连续赋值后的最后产物,然后我就他那个作了些解释 - -!
其实
变量延迟/延迟变量 不管叫啥吧(当然99%是我叫错了。。死鸭子也得嘴硬一下)
他存在的目的就是得到for循环内的set获得的变量变化的各个步骤然后加以处理,
当在for 应用中使用set的话是必须 变量延迟/延迟变量 的 而用call是将set至于循环命令的外圈执行,是一个不断调用子过程来达到类似 变量延迟/延迟变量 的效果
还有 无奈何的 那个签名并不是 连续赋值 注意 set/p 这个参数是个交互命令,这个地方可能是这个签名最精髓的地方
Last edited by metoo on 2008-6-25 at 09:56 PM ]
Actually, the original poster's statement is correct - -!
Then brother ppdos's simplification is actually wrong. It cannot replace the delayed variable, but is just the final product after simple consecutive assignments, and then I explained his that - -!
Actually
Whether it's called variable delay/delayed variable or whatever (of course 99% is that I called it wrong. Even a stubborn person has to be stubborn)
The purpose of its existence is to get each step of the variable changes obtained by set in the for loop and then process them.
When using set in for application, delayed variable is necessary. And using call is to put set in the outer circle of the loop command, which is a process of continuously calling sub - processes to achieve an effect similar to delayed variable.
Also, the signature of "Helpless" is not consecutive assignment. Note that the set/p parameter is an interactive command. This place may be the most essential part of this signature.
Last edited by metoo on 2008-6-25 at 09:56 PM ]
|
|
2008-6-25 21:54 |
|
|
PPdos
高级用户
   
积分 783
发帖 268
注册 2006-12-26
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
大家都没说楼主说的错啊~~?
我只是觉得楼主 写的长了点给简化一下
是否错误 那还是仁者见仁
Everyone didn't say the building owner was wrong~~?
I just think the building owner wrote it a bit long and simplified it a bit
Whether it's wrong or not is still a matter of personal opinion
|

菩提本无树,明镜亦非台,本来无一物,何处惹尘埃. |
|
2008-6-25 21:58 |
|
|
wxcute
中级用户
  
积分 458
发帖 211
注册 2006-7-26
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
没想到这么多人讨论。
就像第1页15楼qzwqzw说的,改成这样就能显示中间的了。
还有metoo也挺搞笑“嘴硬的死鸭子”
@echo off
for /f %%a in ('dir/b') do call :num_add file_num
echo 目录下有%file_num%个文件(夹)。
pause
goto :eof
:num_add
set/a %1+=1
::加了下一行
echo %file_num%
goto :eof
Last edited by wxcute on 2008-6-25 at 10:25 PM ]
I didn't expect so many people to discuss.
Just like what qzwqzw on floor 15 of page 1 said, changing it like this can display the middle one.
Also, "metoo" is quite funny, "stubborn dead duck"
@echo off
for /f %%a in ('dir/b') do call :num_add file_num
echo There are %file_num% files (folders) in the directory.
pause
goto :eof
:num_add
set/a %1+=1
:: Added the next line
echo %file_num%
goto :eof
Last edited by wxcute on 2008-6-25 at 10:25 PM ]
|

┌───────┐
├→学习→实践→┤
└───────┘ |
|
2008-6-25 22:16 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
首先,楼主的言论肯定是对的
计算当然可以不用变量延迟(即使是在for中计算)
当然,这里的“计算”说得很模糊
导致各人有各人的理解
楼主这里的潜台词是可以用call来代替延迟
因为他的代码中出现了call
其次,楼主的代码也是没有问题的
语法正确无误且能达到想要的效果
我想表明的是
楼主的代码证明不了楼主观点中的潜台词
因为我用非call且非延迟的方式也能实现同样的目的
那就无法结实call可以代替延迟的意义
--------------------------------------------------------
从ppdos的第一回帖来看
是了解我在14楼提到的set /a的缺省延迟效果的
只不过没把它当成一个问题与楼主的言论联系起来而已
简化本身没有问题
我也只是认为缩成一行代码略显多余
也能从中找到证明call能代替延迟的观点的佐证
(for /f %i in ('dir /b') do set /a n+=1 >nul)&call echo 目录下有%n%个文件(夹)
可以代替
(for /f %i in ('dir /b') do set /a n+=1 >nul)&echo 目录下有!n!个文件(夹)
这说明连接语句中遇到变量延迟问题可以用call替换
而metoo却往for里面去看
当然是看不到什么有价值的东西的
--------------------------------------------------------
至于无奈何的签名
那真是又扯远了
我现在只记得那几句词
代码早忘得个干净
也不耐再去翻腾出来
且管它是不是连续赋值
Last edited by qzwqzw on 2008-6-25 at 10:28 PM ]
First of all, the LZ's statement is definitely correct. Calculations can certainly be done without variable delays (even in a for loop). Of course, the "calculation" here is very vague, leading to everyone having their own understanding. The implied meaning here by the LZ is that call can be used instead of delay because call appears in his code. Secondly, the LZ's code is also correct, with correct syntax and achieving the desired effect. What I want to show is that the LZ's code cannot prove the implied meaning in his view because I can achieve the same purpose in a non-call and non-delay way, so there is no way to explain the significance of call replacing delay. -------------------------------------------------------- From the first reply of ppdos, it is known that he understands the default delay effect of set /a I mentioned in building 14, but just didn't connect it with the LZ's statement as a problem. Simplification itself is not a problem, and I just think that condensing into one line of code is a bit redundant. One can also find evidence to prove the view that call can replace delay. (for /f %i in ('dir /b') do set /a n+=1 >nul)&call echo There are %n% files(folders) under the directory can be replaced by (for /f %i in ('dir /b') do set /a n+=1 >nul)&echo There are!n! files(folders) under the directory. This shows that when encountering variable delay problems in the connected statements, call can be used to replace, while metoo looks into the for, of course, not seeing anything valuable. -------------------------------------------------------- As for the signature of Wunaaihe, that's really off-topic. I only remember those few lines of words now, and the code has long been forgotten completely, and I don't bother to dig it out again, and just let it be whether it's continuous assignment or not. Last edited by qzwqzw on 2008-6-25 at 10:28 PM ]
|
|
2008-6-25 22:21 |
|
|
metoo
初级用户
 
积分 195
发帖 93
注册 2006-10-28
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
作者的方法是对的。。但是那个简化版的是作不到代替延迟变量的。。这点错误我已经意识到了。。话说无奈何斑竹那个是特殊情况,不是连续赋予值。。用的set/p的交互方式。。。那个call也不是这种用法。。仿冒他的签名写了个p版的
@echo off
set tt=一二三四五,上山打老虎,老虎不在家,回家吃番薯。 ——metoo冒牌版
for /l %%i in (0,1,36)do (
call call set/p= %%%%tt:~%%i,1%%%%<nul&ping/n 1 127.1>nul
)
按照楼上说法那我这个call call 是何种解释呢?
Last edited by metoo on 2008-6-25 at 10:40 PM ]
The author's method is correct.. But that simplified version can't replace the delay variable.. I have realized this mistake.. Say, the moderator's case is a special situation, not continuously assigning values.. Using the interactive way of set/p.. That call is not used in this way.. I imitated his signature to write a p version
@echo off
set tt=One, two, three, four, five, go up the mountain to fight tigers, the tiger is not at home, go home to eat sweet potatoes. ——metoo counterfeit version
for /l %%i in (0,1,36)do (
call call set/p= %%%%tt:~%%i,1%%%%<nul&ping/n 1 127.1>nul
)
According to the above statement, then what kind of explanation is my call call?
Last edited by metoo on 2008-6-25 at 10:40 PM ]
|
|
2008-6-25 22:27 |
|
|
wxcute
中级用户
  
积分 458
发帖 211
注册 2006-7-26
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
其实我也菜鸟一个,没想得那么深。
只是习惯了用%,要用!代替%有点不适应,还有就是写“setlocal enableDelayedExpansion”挺费事的。我记性不好,记了有段时间才记住。
Actually, I'm also just a newbie, and I didn't think that deeply.
I'm just used to using %, and it's a bit uncomfortable to replace % with!, and also writing "setlocal enableDelayedExpansion" is quite tedious. I have a bad memory, and it took me some time to remember it.
|

┌───────┐
├→学习→实践→┤
└───────┘ |
|
2008-6-25 22:30 |
|
|
metoo
初级用户
 
积分 195
发帖 93
注册 2006-10-28
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
Originally posted by wxcute at 2008-6-25 10:30 PM:
其实我也菜鸟一个,没想得那么深。
只是习惯了用%,要用!代替%有点不适应,还有就是写“setlocal enableDelayedExpansion”挺费事的。我记性不好,记了有段时间才记住。
<img src="images/smilies/face-raspberry.png" align="absmiddle" border="0">鄙人也是菜鸟一个,话说其实这东西我现在都记不住。。我在editplus里设置了一个快捷输入!
Originally posted by wxcute at 2008-6-25 10:30 PM:
Actually, I'm also a newbie, not thinking that deeply.
Just used to using %, it's a bit uncomfortable to use! instead of %, and also writing "setlocal enableDelayedExpansion" is quite tedious. I have a bad memory, it took me some time to remember.
:P I'm also a newbie, to be honest, I can't remember this stuff now. I set up a shortcut input! in editplus!
|
|
2008-6-25 22:33 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
人一多就显得有些乱了
再加上有几位喜欢编辑帖子的
看着看着就觉得思路连不上了
现在理顺一下
ppdos开始只是想简化楼主的代码
后来提出无奈何签名是反驳我“简短古怪不可取”的言论
metoo是想说明变量延迟的“连续赋值”意义并以此证明其不可替代
后来提到无奈何的签名没有用变量延迟是因为没有用“连续赋值”
我刚开始只是想说楼主的代码证明不了楼主的观点
现在我想延伸楼主的观点——
for+call可以替代for+延迟,无论何种情况下
欢迎大家举出例子反驳我的观点
顺便也是对自己编程思想和代码技巧的一次整理
It gets a bit chaotic when there are too many people.
Plus there are a few who like to edit posts.
After looking at it for a while, I just can't follow the train of thought.
Now let's sort it out.
ppdos initially just wanted to simplify the LZ's code.
Then it was proposed that Wunaaihe's signature was a refutation of my statement "short and weird is not可取".
metoo wanted to explain the meaning of "continuous assignment" of variable delay and use that to prove its irreplaceable nature.
Later it was mentioned that Wunaaihe's signature didn't use variable delay because it didn't use "continuous assignment".
I initially just wanted to say that the LZ's code couldn't prove the LZ's viewpoint.
Now I want to extend the LZ's viewpoint —
for+call can replace for+delay, in any case.
Everyone is welcome to come up with examples to refute my viewpoint.
By the way, it's also a sort-out of my own programming ideas and code skills.
|
|
2008-6-25 22:38 |
|