Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. % hello world program
  2. -module(helloworld).
  3. -export([start/0]).
  4. -export([odwrocenieDzialania/1]).
  5. -export([wczytajCiagDoListy/1]).
  6. -import(lists,[reverse/1]).
  7.  
  8. start() ->
  9. %wczytanie ciągu
  10. Ciag=wczytajCiagDoListy("a + b"),
  11. %odwrócenie kolejności w ciągu
  12. OdwroconyCiag=odwrocenieDzialania(Ciag),
  13. io:fwrite("~p~n",[OdwroconyCiag]),
  14. %utworzenie listy operatorów + - * /
  15. Operatory=['+','-','*','/']
  16. %pobranie Elementu z listy i sprawdzenie czy jest Operatorem
  17. %Jeśli jest operatorem to dodaj na Stos, jeżeli nie dodaj
  18. %do ciągu wyjściowego
  19.  
  20. .
  21.  
  22. wczytajCiagDoListy(Ciag)->
  23. Lista=string:tokens(Ciag, " "),
  24. Lista.
  25.  
  26. odwrocenieDzialania(L) ->
  27. reverse(L).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement