Le 15/06/2011 10:05, David Baelde a écrit :
> Hi Martin,
>
> On Wed, Jun 15, 2011 at 9:57 AM, Martin Hamant<[email protected]> wrote:
>> Do you mean:
>> if stream_format == "mp3" then
>> output = out(%mp3, bla, bla, blu, s)
>> (...)
>> end
> Romain didn't mean that. First, note that with this structure, the
> variable "output" is only defined in the then branch, not anymore
> outside of the if-then-else (if outside is defined after the
> if-then-else, it'd be a previous definition).
>
> However it's perfectly possible to write
> output =
> if stream_format == "mp3" then
> output(%mp3)
> else
> ...
> end
> And do the rest of the application at the end:
> output(source)
>
> Note however that all branches of the if-then-else must have the same
> type, so they must all expect stereo sources for example.
>
>> The cool thing would be able to do partial app like
> Always good to see somebody psyched about partial applications ;) You
> were not a fan of functional programming before, right? It's also good
> than you mention your use of partial application because there might
> be reasons in the future to make it less accessible (for example,
> write f(x,y,...) instead of f(x,y) to explicitly mention that the
> application is partial).
>
> Cheers,
Okay,
I'm a little confused with all of this :) maybe because there is two
vars in my script : "out" and "output".
"out" is the var typed from output.icecast at the beginning. So it is
known along the script.
and "output" is the global var which is added to the dynamic list, it is
initialized at the end and contains the constructed "out" like follow.
In my script, var "out" is defined at start with:
out = output.icecast(
fallible=true,
start=false
)
Then I have to select the format. That's here I have to do something
like (the follow doesn't work):
# for simulation usage
stream_format = "mp3"
if stream_format == "mp3" then
out(%mp3)
end
Then, I need to push partial "out" and all others parameters in a single
var named "output" like this
# The output
output = out(id="#{stream_id}", host="#{stream_host}",
port=int_of_string("#{stream_port}"), password="#{stream_password}",
genre="#{stream_genre}", url="#{stream_url}",
description="#{stream_description}", mount="stream.mp3", protocol="http", s)
# and then to the list of sources
dyn_sources :=
list.append( [(uri,s),(uri,output)],
!dyn_sources )
o0 0o !
------------------------------------------------------------------------------
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