Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % hello world program
- -module(helloworld).
- -export([start/0]).
- -import(string,[substr/3]).
- -import(lists,[nth/2]).
- -export([czyJestNaLiscie/2]).
- -import(lists,[member/2]).
- -import(lists,[append/1]).
- -export([wczytajCiagDoListy/1]).
- -import(lists,[reverse/1]).
- -import(lists,[droplast/1]).
- -import(lists,[last/1]).
- -export([odwrocenieDzialania/1]).
- start() ->
- %wczytanie ciągu
- Ciag=wczytajCiagDoListy("a + b * c"),
- %odwrócenie kolejności w ciągu
- OdwroconyCiag=odwrocenieDzialania(Ciag),
- %io:fwrite("~p~n",[OdwroconyCiag]),
- %utworzenie listy operatorów + - * /
- Operatory=["+","-","*","/"],
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- Stos = lists:foldl(fun(El, A) ->
- El1=El,
- V1=czyJestNaLiscie(El,Operatory),
- if
- V1 == true ->
- append([A,[El1]]);
- true ->
- append([A])
- end
- end, [], OdwroconyCiag),
- io:fwrite("Stos ~p~n", [Stos]).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement