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,
-- 
David

------------------------------------------------------------------------------
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

Reply via email to