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 Data.List | |
import Data.Maybe | |
digits = ['0'.. '9'] ++ ['A'.. 'Z'] ++ ['a'.. 'z'] | |
fromBase10 :: Int -> Int -> String | |
fromBase10 0 _ = "" | |
fromBase10 number base | |
| base > 0 = fromBase10 (number `div` base) base ++ [digits !! (number `mod` base)] | |
| otherwise = error "Invalid base" |
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
defmodule BouncingCounter do | |
def even(max, main_pid) do | |
receive do | |
{:inc, odd_pid, n} when n <= max -> | |
IO.puts("EVEN: Count currently at #{n}") | |
send(odd_pid, {:inc, self(), n + 1}) | |
even(max, main_pid) | |
{:inc, even_pid, n} when n > max -> |
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
defmodule MultipleReceive do | |
def myProc do | |
IO.puts "Func starting: " | |
receive do | |
:first -> IO.puts "Received first message!" | |
end | |
receive do | |
:second -> IO.puts "Received second message!" | |
end |
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
package main | |
import ( | |
"fmt" | |
"strings" | |
"sync" | |
) | |
func main() { |
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
pragma solidity ^0.5.4; | |
contract MailApplication { | |
struct Mail { | |
string message; | |
address sender; | |
} | |
Mail[] private allMail; |