luogu-dev / cyaron

CYaRon: Yet Another Random Olympic-iNformatics test data generator
GNU Lesser General Public License v3.0
1.35k stars 168 forks source link

Make sure formula in Sequence is callable #52

Closed william-song-shy closed 5 years ago

william-song-shy commented 5 years ago

函数规格

def (x) # 返回第x个

@lin714093880

william-song-shy commented 5 years ago

其实就是把lambda变成def

william-song-shy commented 5 years ago

这样支持成块的函数(可能没啥用)

moesoha commented 5 years ago

It's a breaking change. You'd better not to do so.

william-song-shy commented 5 years ago

这是一个突破性的变化。你最好不要这样做。

why?

william-song-shy commented 5 years ago

我删了空行

moesoha commented 5 years ago

@william-song-shy Here is still a review left. PTAL.

william-song-shy commented 5 years ago

您能说中文吗?

moesoha commented 5 years ago

我在第 24 行的改动上还有一个 review。你这个改动打破了现有的 API 行为。

william-song-shy commented 5 years ago

所以呢?

william-song-shy commented 5 years ago

好的,我改成这样可以吧。 @moesoha

moesoha commented 5 years ago

@william-song-shy 为什么要放弃第二个参数

william-song-shy commented 5 years ago

看下新的吧(保持了lambda+第二个参数,对于使用def的只有一个参数)

laosb commented 5 years ago

@william-song-shy 对于 lamda 保留参数也不影响的话,就不要做这个不必要的判断。

william-song-shy commented 5 years ago

大佬觉得该怎样? @laosb

moesoha commented 5 years ago

这里返回函数是用于像斐波那契这种递归定义的数列,所以返回的是 __get_one。就算是想传 def 定义的函数也是需要用的啊

william-song-shy commented 5 years ago

我的想法

def f (x)
     return f(x-1)+f(x-2)
moesoha commented 5 years ago

__get_one 有针对重复计算进行处理

william-song-shy commented 5 years ago

就当我只加了一句异常和一个工具

moesoha commented 5 years ago

@william-song-shy 判断lambda基本不需要,以及你把缩进都改了,还有code style也不一致

moesoha commented 5 years ago

@william-song-shy 算了我来改吧