Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

We have seen the light at the end of the tunnel, and it's out.


interests / soc.culture.china / More philosophy about one of the most important disadvantage of functional programming..

SubjectAuthor
o More philosophy about one of the most important disadvantage ofWorld90

1
More philosophy about one of the most important disadvantage of functional programming..

<s90pjh$rut$1@dont-email.me>

  copy mid

https://novabbs.com/interests/article-flat.php?id=2352&group=soc.culture.china#2352

  copy link   Newsgroups: soc.culture.china
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m...@m.com (World90)
Newsgroups: soc.culture.china
Subject: More philosophy about one of the most important disadvantage of
functional programming..
Date: Sun, 30 May 2021 15:38:24 -0400
Organization: A noiseless patient Spider
Lines: 104
Message-ID: <s90pjh$rut$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 30 May 2021 19:38:25 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="54fd4c2ee7fca3e9d5d503c82444a97b";
logging-data="28637"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nCBPPEm9yH/7p+oziRKuI5PRzyTVfTgA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.10.2
Cancel-Lock: sha1:pTClgPQFL6dgs6veiPwYJTwWXEY=
Content-Language: en-US
X-Mozilla-News-Host: news://news.eternal-september.org:119
 by: World90 - Sun, 30 May 2021 19:38 UTC

Hello,

More philosophy about one of the most important disadvantage of
functional programming..

I am a white arab and i think i am smart since i have also invented many
scalable algorithms and algorithms..

I have just posted previously my thoughts about continuation—passing
style (CPS) and Monads, here they are:

https://groups.google.com/g/alt.comp.lang.borland-delphi/c/kdP6YSTcjj4

I think i am smart and i have just "quickly" noticed that when you are
using patterns of functional programming such as Map and Monads ,
it will come with a very important disadvantage, and it is that you will
move much more the data from a memory region to another memory region,
so it is not efficient, since it is really slower, and i think that
it is the one of the most important disadvantage of functional
programming, since functional programming abstracts more, but it is
really slower, so i have just given you previously an example of a
"Maybe" Monad in Delphi, and here is an example of the "List" Monad in
Delphi and notice how it is is really slower by moving the data to the
the returned result of the "Bind" function of the Monad as TmList object:

program List_monad;

{$APPTYPE CONSOLE}

uses
System.SysUtils;

type
TmList = record
Value: TArray<Integer>;
function ToString: string;
function Bind(f: TFunc<TArray<Integer>, TmList>): TmList;
end;

function Create(aValue: TArray<Integer>): TmList;
begin
Result.Value := copy(aValue, 0, length(aValue));
end;

{ TmList }

function TmList.Bind(f: TFunc<TArray<Integer>, TmList>): TmList;
begin
Result := f(self.Value);
end;

function TmList.ToString: string;
var
i: Integer;
begin
Result := '[ ';
for i := 0 to length(value) - 1 do
begin
if i > 0 then
Result := Result + ', ';
Result := Result + value[i].toString;
end;
Result := Result + ']';
end;

function Increment(aValue: TArray<Integer>): TmList;
var
i: integer;
begin
SetLength(Result.Value, length(aValue));
for i := 0 to High(aValue) do
Result.Value[i] := aValue[i] + 1;
end;

function Double(aValue: TArray<Integer>): TmList;
var
i: integer;
begin
SetLength(Result.Value, length(aValue));
for i := 0 to High(aValue) do
Result.Value[i] := aValue[i] * 2;
end;

var
ml1, ml2: TmList;

begin
ml1 := Create([3, 4, 5]);
ml2 := ml1.Bind(Increment).Bind(double);
Writeln(ml1.ToString, ' -> ', ml2.ToString);
readln;
end.

Output:
[ 3, 4, 5] -> [ 8, 10, 12]

Thank you,
Amine Moulay Ramdane.


interests / soc.culture.china / More philosophy about one of the most important disadvantage of functional programming..

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor