我正在编程吱吱声,需要比较两个代码块,如下所示:(toRunBlock是一个实例变量)
~~~Other code~~~
toRunBlock := [nil].
~~~Other code~~~
Run Code Online (Sandbox Code Playgroud)
但在某些时候,我需要将它与另一个代码块进行比较:
(toRunBlock = [nil]) ifTrue: [
"Run some code if toRunBlock hasn't been overwritten"
].
Run Code Online (Sandbox Code Playgroud)
但是这个检查总是假的,我找不到办法检查它们是否相等.有人可以帮我解决这个问题吗?
我正在Squeak的一个小项目上工作并遇到了一个问题:我无法正确解码WAV文件.
这是我目前用于解码它的两种方法:
convert4bitUnsignedTo16Bit: anArray
"Convert the given array of samples--assumed to be 4-bit unsigned, linear data--into 16-bit signed samples. Return an array containing the resulting samples. I only thinking it is unsigned. I don't really know."
| n samples s |
n _ anArray size.
samples _ SoundBuffer newStereoSampleCount: (n * 2).
1 to: n do: [:i |
s _ anArray at: i.
samples at: (i * 2) put: (self imaDecode: s).
samples at: ((i * 2) - 1) put: …Run Code Online (Sandbox Code Playgroud)