小编Kei*_*awa的帖子

如何在Lisp中随机播放列表?

这是一个非常简单的程序,它只将输入作为列表改组返回。我用python编写了这个程序。现在,我想将此程序转换为Lisp代码。但我做不到 如何用Lisp写下该程序?

def my_shuffle(a, b, c, d):
    return [b, c, d, a]
Run Code Online (Sandbox Code Playgroud)

我尝试了以下代码,但发生错误。

(defun my_shuffle (a b c d) (list b c d a))
Run Code Online (Sandbox Code Playgroud)

elisp common-lisp

4
推荐指数
2
解决办法
818
查看次数

为什么C++的创建者决定使用构造函数初始化列表来初始化基类?

为什么C++的创建者决定使用构造函数初始化列表来初始化基类?为什么他没有选择使用类似下面代码中的第二个注释行的语法?

class A{
public:
  A() { }
};

class B : A{
public:
  B() : A() { }   // Why decide to use this one, using constructor initializer, to initialize base class?
  B() { A(); }    // Why not choose this one? It's easy for me to understand if it was possible.
};

int main(int argc, char *argv[]){
  /* do nothing */
}
Run Code Online (Sandbox Code Playgroud)

c++

3
推荐指数
1
解决办法
130
查看次数

标签 统计

c++ ×1

common-lisp ×1

elisp ×1