[erlang-questions] If you are homesick for object.selector

Ulf Wiger ulf@REDACTED
Thu Jan 24 21:24:20 CET 2013


On 24 Jan 2013, at 10:12, Olav Frengstad wrote:

> {Get,Set} = compose([#char.cur_weapon, #weapon.ability, #ability.points_req]),
> Character2 = S(123, Character),
> 123 = G(Character2).
> 
> Jesper Louis Andersen wrote a simple Erlang implementation which can
> be found here: https://github.com/jlouis/erl-lenses

I noticed this was posted on the list quite a while ago, but I missed it then.

I have added lens support in exprecs, with reference in the docs to 
Jesper's erl-lenses project:

Eshell V5.9.2  (abort with ^G)
1> test_exprecs:'#lens-'(a,r).
{#Fun<test_exprecs.6.45636860>,
 #Fun<test_exprecs.7.45636860>}

2> {G,S} = v(1).
{#Fun<test_exprecs.6.45636860>,
 #Fun<test_exprecs.7.45636860>}

3> R = test_exprecs:'#new-r'().  
{r,0,0,0}

4> G(S(17,R)).
17

5> S(17,R).
{r,17,0,0}

Pushed to http://github.com:uwiger/parse_trans.git

BR,
Ulf W

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-questions mailing list