This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List splitAt = method(n, [self[0...n], self[n..-1]]) | |
PhoneNumbers = Origin mimic do( | |
words = FileSystem readFully("/usr/share/dict/words") split("\n") | |
mnemonics = { | |
2 => "ABC", | |
3 => "DEF", | |
4 => "GHI", | |
5 => "JKL", | |
6 => "MNO", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GameOfLife = Origin mimic do( | |
initialize = method(rows:, columns:, | |
@grid = Grid withDimensions(rows, columns)) | |
evolve = method( | |
nextGrid = grid blankGrid | |
grid filter(numLiveNeighbours in?(2..3)) each(cellInfo, nextGrid spawnCell(cellInfo coords first, cellInfo coords second)) | |
@grid = nextGrid | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
counts = method( | |
files_to_read = FileSystem["**"] reject(name, FileSystem directory?(name)) | |
combined_text = files_to_read map(filename, FileSystem readFully(filename)) join("") | |
filtered_words = #/\w+/ allMatches(combined_text) map(lower) | |
filtered_words inject({} withDefault(0), counts, word, counts[word]++. counts) | |
) | |
spit = method(outfile, enumerable, | |
FileSystem withOpenFile(outfile, fn(file, enumerable each(x, file println(x))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Position = Origin mimic do( | |
at = method(x, y, with(x: x, y: y)) | |
origin = at(0, 0) | |
+ = method(position, at(x + position x, y + position y)) | |
asText = method("(#{x},#{y})") | |
) | |
at = method(x, y, Position at(x,y)) | |
; This is pretty funny, right? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFO] [jar:jar] | |
[WARNING] JAR will be empty - no content was marked for inclusion! | |
[INFO] Building jar: /Users/olabini/workspace/cuke4duke/examples/java/target/cuke4duke-java-example-0.1.6.jar | |
[INFO] [cuke4duke:cucumber {execution: run-features}] | |
[INFO] Code: | |
[INFO] | |
[INFO] Features: | |
[INFO] * features/call_step.feature | |
[INFO] * features/demo.feature | |
[INFO] * features/hooks.feature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then = Origin mimic | |
Then allThens = [] | |
Then match = method(inputText, | |
allThens each(th, | |
if(th pattern =~ inputText, | |
th code call(*(it names map(nm, it[nm])))))) | |
then = dmacro( | |
[>pattern, code] | |
messages = pattern names map(nm, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import(:javax:swing, :JFrame, :JButton) | |
import java:awt:GridLayout | |
button = JButton new("Press me!") do( | |
addActionListener(fn(e, button text = "Hello from Ioke"))) | |
JFrame new("My Frame") do( | |
layout = GridLayout new(2, 2, 3, 3) | |
add(button) | |
setSize(300, 80) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SimpleInterface { | |
public String doSomething(); | |
}// SimpleInterface |
NewerOlder