Mastodon (Wikipedie) - sociální síť, která není na prodej - byl vydán ve verzi 4.5. Přehled novinek s náhledy v oznámení na blogu.
Německo zvažuje, že zaplatí místním telekomunikačním operátorům včetně Deutsche Telekom, aby nahradili zařízení od čínské firmy Huawei. Náklady na výměnu by mohly přesáhnout dvě miliardy eur (bezmála 49 miliard Kč). Jeden scénář počítá s tím, že vláda na tento záměr použije prostředky určené na obranu či infrastrukturu.
Po dvaceti letech skončil leader japonské SUMO (SUpport.MOzilla.org) komunity Marsf. Důvodem bylo nasazení sumobota, který nedodržuje nastavené postupy a hrubě zasahuje do překladů i archivů. Marsf zároveň zakázal použití svých příspěvků a dat k učení sumobota a AI a požádal o vyřazení svých dat ze všech učebních dat.
Úřad pro ochranu hospodářské soutěže zahajuje sektorové šetření v oblasti mobilních telekomunikačních služeb poskytovaných domácnostem v České republice. Z poznatků získaných na základě prvotní analýzy provedené ve spolupráci s Českým telekomunikačním úřadem (ČTÚ) ÚOHS zjistil, že vzájemné vztahy mezi operátory je zapotřebí detailněji prověřit kvůli možné nefunkčnosti některých aspektů konkurence na trzích, na nichž roste tržní podíl klíčových hráčů a naopak klesá význam nezávislých virtuálních operátorů.
Různé audity bezpečnostních systémů pařížského muzea Louvre odhalily závažné problémy v oblasti kybernetické bezpečnosti a tyto problémy přetrvávaly déle než deset let. Jeden z těchto auditů, který v roce 2014 provedla francouzská národní agentura pro kybernetickou bezpečnost, například ukázal, že heslo do kamerového systému muzea bylo „Louvre“. 😀
Z upstreamu GNOME Mutter byl zcela odstraněn backend X11. GNOME 50 tedy poběží už pouze nad Waylandem. Aplikace pro X11 budou využívat XWayland.
Byl publikován plán na odstranění XSLT z webových prohlížečů Chrome a Chromium. S odstraněním XSLT souhlasí také vývojáři Firefoxu a WebKit. Důvodem jsou bezpečnostní rizika a klesající využití v moderním webovém vývoji.
Desktopové prostředí LXQt (Lightweight Qt Desktop Environment, Wikipedie) vzniklé sloučením projektů Razor-qt a LXDE bylo vydáno ve verzi 2.3.0. Přehled novinek v poznámkách k vydání.
Organizace Open Container Initiative (OCI) (Wikipedie), projekt nadace Linux Foundation, vydala Runtime Specification 1.3 (pdf), tj. novou verzi specifikace kontejnerového běhového prostředí. Hlavní novinkou je podpora FreeBSD.
Nový open source router Turris Omnia NG je v prodeji. Aktuálně na Allegro, Alternetivo, Discomp, i4wifi a WiFiShop.
Když zdrojový kód zkrátíte a zároveň vám vzroste rychlost exekuce, tak si můžete být skoro jistí, že už do toho pomalu pronikáte. Prohlížel jsem si takhle nějaký kód v erlangu a viděl jsem tam takovou hezkou vychytávku (stejná myšlenka je použita níže ve funkci mapper/2 a collector/2), kdy dotyčný procházel pomocí lists:foldl list a zároveň z něho vytvářel slovník (dict). No a pak mě napadlo jestli bych taky nemohl přepsat stavový algoritmus z mého prvního erlangového modulu na rekurzivní, ale se schopností foldl/foldr funkce a pak ostatní funkce jako map a perms přepsat se stejným trikem. Zároveň mi vrtalo hlavou jestli se to náhodou nezrychlí a byl jsem dost překvený, nárust výkonu byl více než dvojnásobný a kódu dost podstatně ubylo (dostal jsem se na 1,1 us což je ani ne 2x víc než v C napsaný Alghoritm-Permute pro perl!).
Pak jsem udělal ještě drobnou úpravu (viz ugly), která je z funkčního hlediska zbytečná, ale rychlost to ještě trošku zvedlo. Taky jsem udělal generátor, aby se dalo použít podobně jako původní kód, ale tam tam rychlost poklesla, ale je jen o něco pomalejší než původní. Z toho je pěkně vidět, že to zaslání několika miliónů zpráv tam a zpátky umí erlang udělat opravdu rychle.
Copyright © 2007 Hynek Vychodil
Version: 0.0.2
Authors: Hynek Vychodil (pichi@nekde.top) [web site: http://www.abclinuxu.cz/blog/Pichi].
perms - Permutation generator
This module provides "simply" permutation generator with state support.
> perms:perms([a,b,c]).
[[a,b,c],[a,c,b],[b,a,c],[b,c,a],[c,a,b],[c,b,a]]
> perms:foreach(fun(P)->io:format("~p~n",[P]) end, [a,b,c]).
[a,b,c]
[a,c,b]
[b,a,c]
[b,c,a]
[c,a,b]
[c,b,a]
ok
> perms:foldl(fun perms:inc/2, 0, lists:seq(1,10)).
3628800
> perms:map(fun(P)->io:format("~p~n",[P]), P end, [a,b,c]).
[c,b,a]
[b,c,a]
[c,a,b]
[a,c,b]
[b,a,c]
[a,b,c]
[[a,b,c],[b,a,c],[a,c,b],[c,a,b],[b,c,a],[c,b,a]]
% see map/2 why called in reverse order
> F = perms:new([a,b,c]).
<0.199.0>
> perms:next(F).
[a,b,c]
> perms:next(F).
[a,c,b]
> perms:free(F).
free
> perms:next(F).
'$end_of_table'
foldFun() = (P::list(), AccIn) -> AccOut
| first/1 | (Deprecated.) Makes first permutation (same as original L) and Generator. |
| foldl/3 | Folds permutations of L. |
| foldr/3 | Same as foldl/3 but in reverse order. |
| foreach/2 | Call F for each permutation P of L. |
| free/1 | Terminate Generator before all permutation passed (free memory). |
| generatorTest/1 | Test generator for benchmarking purposes. |
| inc/2 | Counter. |
| map/2 | Makes Result list() of Res results from calling F on each permutations P of L. |
| mapr/2 | Makes reversed Result list() of Res results from calling F on each permutations P of L
but F is called in right order of permutations e.g. |
| new/1 | Make new permutation generator. |
| next/1 | Makes next permutation P from Generator. |
| perms/1 | Returns list() containing all L's permutations. |
first(L::list()) -> {L::list(), Generator::pid()}
This function is deprecated: Use S=new(L), next(S) instead.
Makes first permutation (same as original L) and Generator.
See also: next/1.
foldl(F::foldFun(), Acc0, L::list()) -> Acc
Folds permutations of L. Calls F on each permutation of L. Acc0 is passed as AccIn to firts F call
and each AccOut is passed to next F call.
Last F call result is returned as Acc.
foldr(F, Acc0, L::list()) -> Acc
Same as foldl/3 but in reverse order.
foreach(F, L::list()) -> ok
Call F for each permutation P of L.
free(Generator::pid()) -> free
Terminate Generator before all permutation passed (free memory).
generatorTest(L::list()) -> ok
Test generator for benchmarking purposes.
Generator use is about four times slower than perms/1,
foreach/2, map/2 and foldl/3 but consumed less memory except foreach/2 and foldl/3.
inc(Ignored::any(), CIn::number()) -> COut::number
Counter. Returns second argument increased by one. Can be used as foldFun() mainly for testing purposes.
map(F, L::list()) -> Result::list()
Makes Result list() of Res results from calling F on each permutations P of L.
Warning: For implementation reasons F is called on permutations in reverese order.
If order is important use lists:reverse(mapr(F, L)) instead
See also: mapr/2.
mapr(F, L::list()) -> Result::list()
Makes reversed Result list() of Res results from calling F on each permutations P of L
but F is called in right order of permutations e.g. original L as the first, two last elements swaped as the second, etc.
See also: map/2.
new(L::list()) -> Generator::pid()
Make new permutation generator.
next(Generator::pid()) -> P::list()
Makes next permutation P from Generator.
perms(L::list()) -> Permutations::list()
Returns list() containing all L's permutations.
%% @copyright 2007 Hynek Vychodil
%% @author Hynek Vychodil <pichi@nekde.top>
%% [http://www.abclinuxu.cz/blog/Pichi]
%% @version 0.0.2
%% @end
%% =====================================================================
%% @doc perms - Permutation generator
%%
%% This module provides "simply" permutation generator with state support.
%%
%% == Usage ==
%%```
%%> perms:perms([a,b,c]).
%%[[a,b,c],[a,c,b],[b,a,c],[b,c,a],[c,a,b],[c,b,a]]
%%> perms:foreach(fun(P)->io:format("~p~n",[P]) end, [a,b,c]).
%%[a,b,c]
%%[a,c,b]
%%[b,a,c]
%%[b,c,a]
%%[c,a,b]
%%[c,b,a]
%%ok
%%> perms:foldl(fun perms:inc/2, 0, lists:seq(1,10)).
%%3628800
%%> perms:map(fun(P)->io:format("~p~n",[P]), P end, [a,b,c]).
%%[c,b,a]
%%[b,c,a]
%%[c,a,b]
%%[a,c,b]
%%[b,a,c]
%%[a,b,c]
%%[[a,b,c],[b,a,c],[a,c,b],[c,a,b],[b,c,a],[c,b,a]]
%% % see map/2 why called in reverse order
%%> F = perms:new([a,b,c]).
%%<0.199.0>
%%> perms:next(F).
%%[a,b,c]
%%> perms:next(F).
%%[a,c,b]
%%> perms:free(F).
%%free
%%> perms:next(F).
%%'$end_of_table'
%%'''
-module(perms).
-export([perms/1, foreach/2, map/2, mapr/2, foldl/3, foldr/3]).
-export([first/1, next/1, new/1, free/1, inc/2, generatorTest/1]).
-version("0.0.2").
-import(lists, [reverse/1, reverse/2]).
%% @spec (list()) -> Permutations::list()
%% @doc Returns {@type list()} containing all `L''s permutations.
perms(L) -> foldr(fun collector/2, [], L).
collector(P, L) -> [P|L].
%% @spec (F, list()) -> ok
%% F = (P::list()) -> any()
%% @doc Call `F' for each permutation `P' of `L'.
foreach(F,L) -> foldl(fun do/2, F, L), ok.
do(P, F) -> F(P), F.
%% @spec (F, list()) -> Result::list()
%% F = (P::list()) -> Res
%% Result = [Res]
%% @doc Makes `Result' {@type list()} of `Res' results from calling `F' on each permutations `P' of `L'.
%% Warning: For implementation reasons `F' is called on permutations in reverese order.
%% If order is important use `lists:reverse(mapr(F, L))' instead
%% @see mapr/2
map(F, L) -> element(2, foldr(fun mapper/2, {F, []}, L)).
mapper(P, {F, L}) -> {F, [F(P)|L]}.
%% @spec (F, list()) -> Result::list()
%% F = (P::list()) -> Res
%% Result = [Res]
%% @doc Makes reversed `Result' {@type list()} of `Res' results from calling `F' on each permutations `P' of `L'
%% but `F' is called in right order of permutations e.g. original `L' as the first, two last elements swaped as the second, etc.
%% @see map/2
mapr(F, L) -> element(2, foldl(fun mapper/2, {F, []}, L)).
%% @spec (F::foldFun(), Acc0, list()) -> Acc
%% @type foldFun() = (P::list(), AccIn) -> AccOut
%% @doc Folds permutations of `L'. Calls `F' on each permutation of `L'. `Acc0' is passed as `AccIn' to firts `F' call
%% and each `AccOut' is passed to next `F' call.
%% Last `F' call result is returned as `Acc'.
foldl(F, Acc0, L) -> foldr(F, Acc0, reverse(L)).
%% @spec (F, Acc0, list()) -> Acc
%% F = (P::list(), AccIn) -> AccOut
%% @doc Same as {@link foldl/3} but in reverse order.
foldr(F, Acc0, L) -> foldr(F, _AccIn = Acc0, L, _PermTail=[]).
foldr(F, AccIn, [], Perm) -> F(Perm, AccIn);
foldr(F, AccIn, L, PermTail) -> foldr(F, AccIn, _ToDo=L, _Done=[], PermTail).
foldr(_F, AccIn, [] = _ToDo, _Done, _PermTail) -> AccIn;
foldr(F, AccIn, [H] = _ToDo, [] = _Done, PermTail) -> F([H|PermTail], AccIn); % ugly but minor speed up (~10%)
foldr(F, AccIn, [H|T] = _ToDo, Done, PermTail) ->
foldr(F,
_NewAcc = foldr(F, AccIn, reverse(Done, T), [H|PermTail]),
T, [H|Done], PermTail).
%% @spec (Ignored::any(), CIn::number()) -> COut::number
%% @doc Counter. Returns second argument increased by one. Can be used as {@type foldFun()} mainly for testing purposes.
inc(_,A) -> A+1.
%% @spec (list())->Generator::pid()
%% @doc Make new permutation generator.
new(L) -> spawn(fun() -> foreach(fun receiver/1, L) end).
%% @spec (list()) -> {L::list(), Generator::pid()}
%% @doc Makes first permutation (same as original `L') and `Generator'.
%% @deprecated Use `S=new(L), next(S)' instead.
%% @see next/1
first(L) -> S=new(L), {next(S), S}.
%% @spec (Generator::pid()) -> P::list()
%% @doc Makes next permutation `P' from `Generator'.
next(S) ->
case process_info(S, status) of
undefined -> '$end_of_table';
_ ->
S ! self(),
receive
{S, P} -> P
end
end.
%% @spec (Generator::pid()) -> free
%% @doc Terminate `Generator' before all permutation passed (free memory).
free(S) -> S ! free.
receiver(P) ->
receive
free -> exit(normal);
PID when is_pid(PID) ->
PID ! {self(), P}
end.
%% @spec (list()) -> ok
%% @doc Test generator for benchmarking purposes.
%% Generator use is about four times slower than {@link perms/1},
%% {@link foreach/2}, {@link map/2} and {@link foldl/3} but consumed less memory except {@link foreach/2} and {@link foldl/3}.
generatorTest(L) -> generatorTest(new(L), next).
generatorTest(_, '$end_of_table') -> ok;
generatorTest(S, _) -> generatorTest(S, next(S)).
Tiskni
Sdílej:
Pokud vim, tak Haskell na rozdil od Scheme nema side efecty, takze by to teoreticky melo byt jednodussi.
Glasgow Parallel Haskell
Glasgow Distributed Haskell
Jako lakadlo na Haskell bych doporucil defmacro.org.
Jinak Erlang je proste jednou prumyslove overena vec a ve spojeni s OTP asi tezko porazitelna. Haskell je vsak podobne jake Scheme urcen primarne pro vyuku nebo alespon na zacatku to tak bylo, proto je jejich syntaxe lepe citelna.
Takto se to jevi mne pri pohledu z vrtulniku.
). Haskel má v tomhle směru celkem hezky našlápnuto, ale já na něj nemám teď moc čas, bohužel. Kdyby byl už dnes na úrovni erlnagu, tak si na něj ten čas aspoň zkusím udělat, protože má mnohem lepší optimalizace a kompilátor.