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
-module(solution). | |
-export([main/0]). | |
%R-Repeat,L-actual List , | |
main() -> | |
[R|L] = read_input([]), | |
foo(R,L). | |
foo(_,[]) -> []; | |
foo(R,[X|Xs]) -> repeat(X,R), foo(R,Xs). |
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
-module(solution). | |
-export([main/0]). | |
%R-Repeat,L-actual List , | |
main() -> | |
[R|L] = read_input([]), | |
foo(R,L,[]). | |
foo(_,[],NL)-> NL; | |
foo(R,[X|Xs],NL)->foo(R,Xs,NL++repeat(X,R)). |
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
-module(solution). | |
-export([start/0]). | |
start() -> | |
{ok,X}=io:fread(">","~d"), | |
io:fwrite("~w~n",[X*2]). | |
Error | |
** exception error: an error occurred when evaluating an arithmetic expression | |
in function solution:start/0 (solution.erl, line 6) |
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
-module(wf_1).%week 1 final | |
-export([bits/1,bitsT/1,bitsST/1]). | |
-author("Erlang"). | |
-version(".1"). | |
bits(0)->0; | |
bits(1)->1; | |
bits(N) -> bits(N div 2)+ (N rem 2). | |
%-----7 |
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
-module(wf_1_peri).%week 1 final | |
-export([perimeter/1,area/1]). | |
-author("Erlang"). | |
-version(".1"). | |
% passing width and height of triangle | |
perimeter({rectangle,W,H}) -> 2*(W+H); | |
% passing Radius of Circle | |
perimeter({circle,R}) -> 2*(math:pi())*R; | |
%passing base,sides length , height |
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
Function generateObject() As RowCell | |
Set rfirst = Selection.Rows.Item(1) ' initialized to first row | |
Dim cell As Variant | |
Dim count As Integer | |
Dim dict As Variant | |
Set dict = CreateObject("Scripting.Dictionary") ': dict.CompareMode = vbTextCompare | |
count = 0 | |
Debug.Print "total Rows in Selection " & Selection.Rows.count | |
Dim tempRowCell As RowCell, theParentRowCell As RowCell |
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
%tail Recursion | |
-module(recursion_1_3_4). | |
-export([sum/1,fib/1,perfect/1,perfect1/1]). | |
% Try 1 | |
% | |
% Sum of numbers | |
% F(0)+F(1)+....F(N-1)+F(N) | |
sum(N) -> sum(N-1,N). |
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
-module(recursion_1_3_1). | |
-export([fib/1,dim/2]). | |
%fibonnaci | |
%0,1,2,3,4,5... | |
%0,1,1,2,3,5,... | |
fib(0)->io:fwrite([0," "]),0; | |
fib(1)->io:fwrite([1," "]),1; | |
fib(N) when N>1->K=fib(N-1)+fib(N-2),io:fwrite([K," "]),K. |
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
46> XOr=fun(true,X)->not(X); | |
(false,X)->X 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
-module(pat_assignment). | |
-export([xOr1/2,xOr2/2,xOr3/2,xOr5/2,maxThree/3,test/0]). | |
xOr1(true,false)->true; | |
xOr1(false,true)->true; | |
xOr1(X,Y)->false. | |
xOr2(true,false)->true; |