Skip to content

Instantly share code, notes, and snippets.

View iterator.cpp
#include <iostream>
using namespace std;
auto upto(int& beg, int& end) -> decltype(std::function<int()>()) {
return [&]() {
if (beg <= end) {
return beg++;
}
return 0;
@gmichokostas
gmichokostas / stack.go
Last active Aug 15, 2017
LIFO Stack implemented with Go
View stack.go
package stack
import "fmt"
// Stack is a LIFO data structure
type Stack struct {
len int
top *node
}
View guessTheNumber.hs
module GuessTheNumber where
import System.Random
startGame :: IO ()
startGame = do
let tries = 5
num <- randomRIO (0, 9) :: IO Int
makeGuess num tries