Code:
t =: i: 10 j. 1000
y=:(%2) * (^-|t% (%2)) * sin(( (|t)* (%:2) % 2 )+ (pi%4))
plot t;y
This is the Mathematica version:
Here I'll post things related to my research that don't fit in 140 characters (twitter.com/nes1983), as well as programming-related things that I do and come across.
show repeat 20;'point (n =: n+1) fd 1 rt 15'[n=: _2
to 'goreturn a b';'goto b goto a'
to 'goreturnall a'; 'goreturn for a,.i.20'
show goreturnall for i.20
The color window can be moved away from text that it may obscure by clicking on the top bar, holding the button down, and dragging it to a new position before releasing the mouse button –– Chapter 2, lesson 2 in the J tutorial.
Stack new isEmpty should not be true.
true should not be true
.thisContext
, though there are some performance issues with it.stack should not be isEmpty
.assertEquals(expected(true), actual(stack.isEmpty());
stack isEmpty should be true
.
EGExample subclass: #ForExampleStack
…
shouldBeEmpty
"Create the empty stack"
| stack |
stack := Stack new.
stack should be isEmpty.
stack size should = 0.
^ stack
shouldPushElement
"Push one element"
| stack |
stack := self given: #shouldBeEmpty.
stack push: 42.
stack should not be isEmpty.
stack size should = 1.
stack top should = 42.
^ stack
shouldPopElement
"And pop it again"
| stack |
stack := self given: #shouldPushElement.
stack pop should = 42.
stack should be isEmpty.
stack size should = 0.
Gofer new
squeaksource: 'phexample';
addPackage: 'Phexample';
load