This file contains hidden or 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
module Main where | |
import Prelude | |
import Data.Maybe | |
import Control.Monad.Eff | |
import Data.Maybe.Unsafe | |
import Data.Nullable (toMaybe) | |
import qualified Thermite as T |
This file contains hidden or 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
def common_root(xs, root), do: common_root(xs, root, String.length(root)) | |
def common_root([h | _] = xs, root \\ "", length \\ 0) do | |
newroot = elem(String.split_at(h, length + 1), 0) | |
if Enum.all?(xs, &String.starts_with?(&1, newroot)) do | |
common_root(xs, newroot, length + 1) | |
else | |
root | |
end | |
end |
This file contains hidden or 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 Queue do | |
@moduledoc ~S""" | |
Elixir wrapper around Erlang's 'queue' module, following the convention of pipe operator | |
This module implements (double ended) FIFO queues in an efficient manner. | |
All functions fail with reason badarg if arguments are of wrong type, for example queue arguments are not queues, indexes are not integers, list arguments are not lists. Improper lists cause internal crashes. An index out of range for a queue also causes a failure with reason badarg. | |
Some functions, where noted, fail with reason empty for an empty queue. |
This file contains hidden or 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 Queue do | |
@moduledoc """ | |
Elixir wrapper around Erlang's 'queue' module, following the convention of pipe operator | |
""" | |
@functions :queue.module_info(:exports) | |
Enum.map @functions, fn | |
{:module_info, _} -> 0 | |
{name, 0} -> def unquote(name)(), do: apply(:queue, unquote(name), []) |
This file contains hidden or 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 Queue do | |
@functions :queue.module_info(:exports) | |
Enum.map @functions, fn | |
{:module_info, _} -> 0 | |
{name, 0} -> def unquote(name)(), do: apply(:queue, unquote(name), []) | |
{name, 1} -> def unquote(name)(x), do: apply(:queue, unquote(name), [x]) | |
{name, 2} -> def unquote(name)(x,y), do: apply(:queue, unquote(name), [y, x]) | |
end | |
end |
This file contains hidden or 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 Queue do | |
@functions :queue.module_info(:exports) | |
Enum.map @functions, fn | |
{:module_info, _} -> 0 | |
{name, 0} -> def unquote(name)(), do: apply(:queue, unquote(name), []) | |
{name, 1} -> def unquote(name)(x), do: apply(:queue, unquote(name), [x]) | |
{name, 2} -> def unquote(name)(x,y), do: apply(:queue, unquote(name), [y, x]) | |
end | |
end |
This file contains hidden or 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 Queue do | |
@functions :queue.module_info(:exports) | |
Enum.map @functions, fn | |
{:module_info, _} -> 0 | |
{name, 0} -> def unquote(name)(), do: apply(:queue, unquote(name), []) | |
{name, 1} -> def unquote(name)(x), do: apply(:queue, unquote(name), [x]) | |
{name, 2} -> def unquote(name)(x,y), do: apply(:queue, unquote(name), [y, x]) | |
end | |
end |
This file contains hidden or 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 Queue do | |
@functions :queue.module_info(:exports) | |
Enum.map @functions, fn | |
{:module_info, _} -> 0 | |
{name, 0} -> def unquote(:"#{name}")(), do: apply(:queue, unquote(name), []) | |
{name, 1} -> def unquote(:"#{name}")(x), do: apply(:queue, unquote(name), [x]) | |
{name, 2} -> def unquote(:"#{name}")(x,y), do: apply(:queue, unquote(name), [y, x]) | |
end | |
end |
This file contains hidden or 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 static void main(String[] args) | |
{ | |
PunktMaterialny pkt = new PunktMaterialny(); //klasa z konstruktorem domyślnym | |
pkt.setMasa(5); | |
pkt.mombez(); | |
pkt.opis(); | |
PunktMaterialny pkt2 = new PunktMaterialny(8); //klasa z konstruktorem z parametrem | |
pkt2.opis(); | |
pkt.setMasa(3); //zmiana masy w pierwszym obiekcie |
This file contains hidden or 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
run: web/static/* | |
for f in web/static/*.html; do cp -f "$$f" "web/templates/page/$$(basename $$f).eex"; done | |
mix phoenix.server | |
config: | |
for f in web/static/*.html; do cp -f "$$f" "web/templates/page/$$(basename $$f).eex"; done | |
debug: web/static/* | |
for f in web/static/*.html; do ln -sf "../../../$$f" "web/templates/page/$$(basename $$f).eex"; done | |
iex -S mix phoenix.server | |