如何阅读 elixir 中的规范
How to Read specification in elixir
这是什么意思或如何think/implement?
• @spec add(heap(), integer()) :: heap()
实现函数add/2,将整数添加到堆中。
函数 add
有两个参数,第一个是 heap
,第二个是 integer
。
它是 return 一个新的 heap
,它将成为添加整数的初始堆。
所有这些括号只是 elixir 语法的一部分。
这是什么意思或如何think/implement?
• @spec add(heap(), integer()) :: heap()
实现函数add/2,将整数添加到堆中。
函数 add
有两个参数,第一个是 heap
,第二个是 integer
。
它是 return 一个新的 heap
,它将成为添加整数的初始堆。
所有这些括号只是 elixir 语法的一部分。