(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
import functools, itertools, operator | |
import json | |
class attrdict(dict): | |
def __getattr__(self, key): return self.get(key) | |
def __setattr__(self, key, value): self[key] = value | |
def rankedresult(rank, result): | |
return attrdict(rank = rank, result = result) |
data Cofree f a = a :< (f (Cofree f a)) | |
-- Fix point | |
newtype Mu f = Mu { unMu :: f (Mu f) } | |
extract :: Cofree f a -> a | |
extract (a :< _) = a | |
-- catamorphism | |
cata :: Functor f => (f b -> b) -> Mu f -> b |
F = fun(F, Fd) -> receive stop -> io:format(Fd, "stop~n", []), file:close(Fd), ok; Msg -> io:format(Fd, "~p~n", [Msg]), F(F, Fd) end end. | |
{ok, Fd} = file:open("/tmp/trace.out", [write]), Tracer = proc_lib:spawn(fun() -> F(F, Fd) end). | |
%% trace everything | |
erlang:trace(Pid, true, [all, {tracer, Tracer}]). | |
%% stop tracing | |
erlang:trace(Pid, false, [all, {tracer, Tracer}]). | |
Tracer ! stop. | |
%% match pattern |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/node --harmony | |
const data = { | |
username: '12X34567', | |
password: 'abcde12345' | |
}; | |
const address = [ | |
'https://', | |
'\x77\x6C\x61\x6E\x61\x75\x74\x68\x2E\x6E\x6F\x63\x2E\x74\x69\x74\x65\x63\x68\x2E\x61\x63\x2E\x6A\x70\x2F\x6C\x6F\x67\x69\x6E', | |
'.html' |
{ | |
"title": "AquaSKK", | |
"rules": [ | |
{ | |
"description": "Ctrl-J to Kana on Apple Terminal/iTerm2", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "j", |
この記事はDMMグループ'20卒内定者アドベントカレンダー15日目の記事です.
現在修士2年,プログラミング言語の研究室に所属していて関数リアクティブプログラミング (Functional Reactive Programming, FRP) というプログラミングパラダイムの研究をしています.修論も佳境!終わらない実装!ということで自己紹介がてらFRPの簡単な紹介でも書こうかなと思います.
関数リアクティブプログラミング(FRP)はリアクティブなソフトウェアの記述をサポートするプログラミングパラダイムです.
アプリケーションのUIや制御システムなど,外部からの入力に応答するようなソフトウェアの場合にはキー入力やセンサーの値などの非同期的な入力を処理する必要があります.非同期的な入力に対する処理はポーリング・コールバック関数・マルチスレッディングなどで実装されるわけですが,これらが組み合わさってくると実行の流れが把握しづらくなり,プログラムが複雑になってしまいます.
Requirements: Terraform, GCP credentials with permission to create a project Tested with: Terraform v0.12.23, google cloud provider v3.26
You can use an environment variable to set which service account key to use during provisioning export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key
The service account you use must belong to a GCP project that has the necessary APIs enabled (such as billing and resource manager)--if it does not, you may have to enable these APIs manually along the way in those projects
In this directory, run terraform init
then terraform apply
-- you will need to provide a billing_id and organization_id for your GCP project
Once successful, be sure to add the following to your ~/.prefect/config.toml
John Belmonte, 2022-Sep
I've started writing a toy structured concurrency implementation for the Lua programming language. Some motivations:
So what is structured concurrency? For now, I'll just say that it's a programming paradigm that makes managing concurrency (arguably the hardest problem of computer science) an order of magnitude easier in many contexts. It achieves this in ways that seem subtle to us—clearly so, since its utility didn't reach critical mass until around 2018[^sc_birth] (just as control structures like functions, if
, and while
weren't introduced to languages until long after the first compu