독도 광고 모금 캠페인


2008/11/04 09:02

Printing formatted texts with loop in Erlang


-module(myf).
-export([myf/1]).
-export([listlen/1]).

myf([]) ->
    ok;
myf(L) ->
    myf_sub(L, 0, listlen(L)).


myf_sub([], C, S) ->
    ok;
myf_sub([H|T], C, S) ->
    io:format("<a href=\"http://bluedawn.janbyul.com/download/_MG_~w.jpg\"><img src=\"http://bluedawn.janbyul.com/download/_MG_~w.jpg\" style=\"width:700px;\" alt=\"Digitech Hotrod\"></a>\"~n", [H, H]), myf_sub(T, C+1, S).


listlen(L) ->
    listlen_sub(L, 0).

listlen_sub([], C) ->
    C;
listlen_sub([H|T], C) ->
    listlen_sub(T, C+1).



<a href=",..,..."><img src="...."></a> 와 같은 식의 형식 문자열을 루프를 통해 출력하는 구문.



Trackback 0 Comment 0