From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id B7E577FCEF for ; Thu, 2 Apr 2015 14:19:31 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anthony.tavener@gmail.com) identity=pra; client-ip=74.125.82.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of anthony.tavener@gmail.com designates 74.125.82.52 as permitted sender) identity=mailfrom; client-ip=74.125.82.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f52.google.com) identity=helo; client-ip=74.125.82.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="postmaster@mail-wg0-f52.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DRAQBrMh1VmzRSfUobATcJg1pcBYJKRrIyjhiCA4VzAoFBB0wBAQEBAQESAQEBAQEGCwsJFC6EHgEBAQMBDAYRHQEbEgsBAwELBgMCCw0NHQICIgERAQUBChIGExIQh3gBAwkIDZdPSJBXPjGLNoFrgneNNAoZJwMKVIRwAQEBAQEFAQEBAQEBARUBBQ6LG4QdWAQHgmiBRQWFEAqJQYFshBiECoIBgR0RKY8pgX4SI4EMCYF9ghU8MYJDAQEB X-IPAS-Result: A0DRAQBrMh1VmzRSfUobATcJg1pcBYJKRrIyjhiCA4VzAoFBB0wBAQEBAQESAQEBAQEGCwsJFC6EHgEBAQMBDAYRHQEbEgsBAwELBgMCCw0NHQICIgERAQUBChIGExIQh3gBAwkIDZdPSJBXPjGLNoFrgneNNAoZJwMKVIRwAQEBAQEFAQEBAQEBARUBBQ6LG4QdWAQHgmiBRQWFEAqJQYFshBiECoIBgR0RKY8pgX4SI4EMCYF9ghU8MYJDAQEB X-IronPort-AV: E=Sophos;i="5.11,510,1422918000"; d="scan'208";a="108054592" Received: from mail-wg0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Apr 2015 14:19:30 +0200 Received: by wgbdm7 with SMTP id dm7so83561937wgb.1 for ; Thu, 02 Apr 2015 05:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7mBS909CAx8Tc4AxuvHhyaJex8G4FR4WBf0/mHIEwkU=; b=TvPH73GhlqSOBMB1sYm1aSIPqgAKIdcEBn58AuBMDSmMd9NcRS415xnIi/pTtgSbHb gdUcMarSN7cuNJt5kEzEAZAoFhhB00VSfjGGA4iyozFBHUWrMLZXRg3aNnDErmXNcWdl Rd9oc7+7reY/KUtQEyGbzAURmGahNbkLZ9se1SL1uZ6qF0yI8sRMLSjybOtzQWpRDug6 4xfdTzIZrXk3MuZyKlLL8elLm8HEUvEKEnRvJC2sKp5YhTDIsmd7An9wVVmftX+oxyyc HptOx7mEtoBTscygB8I08C9024DC4fwpzLcw5u/E6VCoFvsJ4DAYhaG3Swd9zPq8lI4D pkeg== MIME-Version: 1.0 X-Received: by 10.180.19.65 with SMTP id c1mr23452428wie.49.1427977170210; Thu, 02 Apr 2015 05:19:30 -0700 (PDT) Received: by 10.28.87.65 with HTTP; Thu, 2 Apr 2015 05:19:30 -0700 (PDT) In-Reply-To: <551D1C29.5010808@lakaban.net> References: <551C55F4.5080703@lakaban.net> <551D1C29.5010808@lakaban.net> Date: Thu, 2 Apr 2015 14:19:30 +0200 Message-ID: From: Anthony Tavener To: =?UTF-8?B?RnLDqWTDqXJpYyBCb3Vy?= Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=bcaec53d592ffa55320512bcd761 Subject: Re: [Caml-list] [ANN] OCamp - Reactive programming in the shell --bcaec53d592ffa55320512bcd761 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hah! You were serious? I thought with commands like hipp and stir, and your legal review notice at the end, that this was an April Fool's joke. :) On Thu, Apr 2, 2015 at 12:38 PM, Fr=C3=A9d=C3=A9ric Bour wrote: > Code is finally available at: > https://github.com/def-lkb/ocamp > > Sorry for the little delay! > > > On 01/04/2015 22:32, Fr=C3=A9d=C3=A9ric Bour wrote: > >> OCamp extends unix shells with constructions to express memoization, >> sharing of computations and reactive programming. >> >> # Subcommands >> >> ## fire >> >> Just wrap a unix command with "ocamp fire" to enable the extension: >> $ ocamp fire bash >> >> This will spawn a new bash session where the following subcommands are >> enabled. >> >> ## hipp >> >> $ ocamp hipp >> >> Will memoize the output and exit status of . >> Later calls to the same won't lead to actual execution, but >> just to a duplication of its previous output. >> Concurrent calls to will just share the same process, the >> beginning of the output being replayed to later callers. >> >> The identity of a command is defined by its arguments and working >> directory. >> >> ## stir >> >> $ ocamp stir >> >> Indicate potential changes in the output if was rerun. >> Later calls to `hipp` will recompute as if it was not yet >> memoized. >> >> ## (un)follow >> >> $ ocamp follow >> >> First, is memoized if it was not the case yet. >> Then changes to dependencies of will trigger a reevaluation. >> Use `stir` to notify a change. >> >> (to follow is an hipp/stir reactivity). >> >> ## pull >> >> $ ocamp pull >> >> Closely related to `hipp`, but instead of marking dependency on the >> output of , the dependency applies to the "effects" of . >> >> Thus, if `stir` is used: >> - all pullers will be reevaluated. >> - hippers will be reevaluated only if the output is different. >> >> ## Summary >> >> $ ocamp fire - setup a new session alive until exi= ts >> pull - mark dependency on effects of >> hipp - mark dependency on output of >> stir - notify that might have been updated >> follow - eval , and reactively recompute it >> whenever one of its dependencies change. >> unfollow - stop recomputing when >> dependencies >> change >> >> hipp and pull provide memoization. >> stir and follow bring a flavor of reactive programming. >> >> # Examples >> >> ## Fibonacci >> >> $ cat fib.sh >> #!/bin/sh >> ARG=3D"$1" >> if [ "$ARG" -le 1 ]; then >> echo "$ARG" >> else >> A=3D`ocamp hipp ./fib.sh $((ARG-1))` >> B=3D`ocamp hipp ./fib.sh $((ARG-2))` >> echo $((A+B)) >> fi >> >> $ time ocamp fire ./fib.sh 50 >> 12586269025 >> real 0m0.391s >> user 0m0.153s >> sys 0m0.060s >> >> ## Build-system >> >> `ocamp` provides simple primitives to construct and manage a dependency >> graph. >> >> This might be a saner foundation to base a build-system on than make(1): >> - the command focus on one specific problem >> - no dsl is involved; rules can be plain unix commands, including a >> shell, rather than a make-flavored simulation of shell >> - nothing is provided for resolving goals; indeed this is better left to >> tools specifically built for goal-search. >> >> A quick'n'dirty script building ocamp itself is provided as an example. >> >> # Future >> >> The current release is a proof-of-concept and should be considered alpha >> quality. >> The two features planned next are a way to make the graph persistent (all >> data is kept in memory atm) and an interface to debug and/or observe gra= ph >> construction. >> >> Note: code is undergoing legal review and should be available soon \o/ >> >> > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --bcaec53d592ffa55320512bcd761 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hah! You were serious? I thought with commands like hipp a= nd stir, and your legal review notice at the end, that this was an April Fo= ol's joke. :)

On Thu, Apr 2, 2015 at 12:38 PM, Fr=C3=A9d=C3=A9ric Bour <frederic.bour@lakaban.net> wrote:
Code is finally available at:
=C2=A0 =C2=A0 https://github.com/def-lkb/ocamp

Sorry for the little delay!


On 01/04/2015 22:32, Fr=C3=A9d=C3=A9ric Bour wrote:
OCamp extends unix shells with constructions to express memoization, sharin= g of computations and reactive programming.

# Subcommands

## fire

Just wrap a unix command with "ocamp fire" to enable the extensio= n:
=C2=A0 $ ocamp fire bash

This will spawn a new bash session where the following subcommands are enab= led.

## hipp

=C2=A0 $ ocamp hipp <command>

Will memoize the output and exit status of <command>.
Later calls to the same <command> won't lead to actual execution,= but just to a duplication of its previous output.
Concurrent calls to <command> will just share the same process, the b= eginning of the output being replayed to later callers.

The identity of a command is defined by its arguments and working directory= .

## stir

=C2=A0 $ ocamp stir <command>

Indicate potential changes in the output if <command> was rerun.
Later calls to `hipp` will recompute <command> as if it was not yet m= emoized.

## (un)follow

=C2=A0 $ ocamp follow <command>

First, <command> is memoized if it was not the case yet.
Then changes to dependencies of <command> will trigger a reevaluation= .
Use `stir` to notify a change.

(to follow is an hipp/stir reactivity).

## pull

=C2=A0 $ ocamp pull <command>

Closely related to `hipp`, but instead of marking dependency on the output = of <command>, the dependency applies to the "effects" of &l= t;command>.

Thus, if `stir` is used:
- all pullers will be reevaluated.
- hippers will be reevaluated only if the output is different.

## Summary

=C2=A0 $ ocamp fire <command> - setup a new session alive until <c= ommand> exits
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pull <command> - mark dependency o= n effects of <command>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hipp <command> - mark dependency o= n output of <command>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stir <command> - notify that <c= ommand> might have been updated
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 follow <command> - eval <comman= d>, and reactively recompute it
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whenever one of its dependencies change.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 unfollow <command> - stop recomput= ing <command> when dependencies
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0change

hipp and pull provide memoization.
stir and follow bring a flavor of reactive programming.

# Examples

## Fibonacci

=C2=A0 $ cat fib.sh
=C2=A0 #!/bin/sh
=C2=A0 ARG=3D"$1"
=C2=A0 if [ "$ARG" -le 1 ]; then
=C2=A0 =C2=A0 echo "$ARG"
=C2=A0 else
=C2=A0 =C2=A0 A=3D`ocamp hipp ./fib.sh $((ARG-1))`
=C2=A0 =C2=A0 B=3D`ocamp hipp ./fib.sh $((ARG-2))`
=C2=A0 =C2=A0 echo $((A+B))
=C2=A0 fi

=C2=A0 $ time ocamp fire ./fib.sh 50
=C2=A0 12586269025
=C2=A0 =C2=A0 real=C2=A0 =C2=A0 0m0.391s
=C2=A0 user=C2=A0 =C2=A0 0m0.153s
=C2=A0 sys=C2=A0 =C2=A0 =C2=A00m0.060s

## Build-system

`ocamp` provides simple primitives to construct and manage a dependency gra= ph.

This might be a saner foundation to base a build-system on than make(1):
- the command focus on one specific problem
- no dsl is involved; rules can be plain unix commands, including a shell, = rather than a make-flavored simulation of shell
- nothing is provided for resolving goals; indeed this is better left to to= ols specifically built for goal-search.

A quick'n'dirty script building ocamp itself is provided as an exam= ple.

# Future

The current release is a proof-of-concept and should be considered alpha qu= ality.
The two features planned next are a way to make the graph persistent (all d= ata is kept in memory atm) and an interface to debug and/or observe graph c= onstruction.

Note: code is undergoing legal review and should be available soon \o/



--
Caml-list mailing list.=C2=A0 Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners<= /a>
Bug reports:
http://caml.inria.fr/bin/caml-bugs

--bcaec53d592ffa55320512bcd761--