Le 21/06/2011 09:46, David Baelde a écrit : > Good morning Martin, Hi !!!
> On Mon, Jun 20, 2011 at 4:50 PM, Martin Hamant<[email protected]> wrote: >> btw, I don't want to "change" out, I want to "update" it. This is my >> understanding of how partial out() works and maybe this is what I don't >> understand. > I'll try to clarify this bit. Thanks. > Let's say out has type (format,source)->source. The variable out > denotes a function object which expects two arguments. When I write > out(%mp3) I have an expression of type (source)->source, which > evaluates to a new, different function object expecting only one > argument. Nothing has changed for the initial function object, and not > even for the variable out -- this is maybe what isn't clear to you. > # For the sake of the example let me define a dummy out. > out = fun (f,s) -> s > out(%mp3,blank()) > # At this point out still denotes the initial function. > # Indeed, we can re-use it. > out(%wav,sine()) > In your example you're redefining out, which gives a different > impression. Leaving the if-then-else aside for now, you have something > like that: > > out = fun (f,s) -> s > out = out(%mp3) > out = out(blank()) > > But in this code you're only changing the local definition of the > variable out, not changing the object it denotes. You're only stacking > up new definitions of out, each new definition being bound to a value > built from the value of the previous binding. Can we say that: each time, the new out contains a new updated object definition. The goal is to get a complete 'fun' object (ie: out should defines the final working function type) ? > This will probably be > clearer For now, I have to be honest, no :) I need simple words for simple needs :D I know, "simple" word is transient and relative, but still; I talk for me :D > if I perform the following change which is always valid with > definitions (valid in the sense that it is rigorously equivalent after > parsing): if you have an expression of the form (x = v ; e) where e is > the scope of the definition of x, and y doesn't occur in e, you can > change it to (y = v ; e[y/x]), where e[y/x] is e where y replaces x. > Concretely, the above example becomes, after two applications of this > renaming operation: > > out = fun (f,s) -> s > out' = out(%mp3) > out'' = out'(blank()) If am I right, this is what I describe in my words above ? I think that I understand the general concept. Immutable variables - partial def etc. The KEY THING for me was to understand that a conditional can build a definition. but at first I was: hey ! how I tell that the definition starts and end ? Seems it's implicit with (if then else end) statement. in the code: super = if something then (...) end nothing explicitly shows that the if statement is somehow linked to "super" !!! that "super=" starts something that the next "end" will finish. for the common reader like me, this are two independent things at first. > This is rigorously the same as before except that we now have distinct > names for the distinct definitions. Finally, to insist on the fact > that we didn't change the objects, note that we can add a fourth line > in that example, containing for example out(%wav,sine()), ie. use the > first function object, which is still the same as on the 1st > definition. > > Don't hesitate to keep digging into those issues, I really enjoy that > kind of discussion. Thanks. It is unusual concepts for the end user !! I think it should be easy for the one who has worked a lot of time with it. I am sure they are reasons for this choice, but I can say, this is really not for the end user. With pros and cons it implies :D ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
