[Omake] adding a python-like "dict.get"

Aleksey Nogin nogin at metaprl.org
Fri Feb 23 12:43:32 PST 2007


On 23.02.2007 02:26, Erick Tryzelaar wrote:

> Also, things would be a little simpler if we could do this:
> 
>   obj-get(o, v, x) =
>      return
>         try
>            value $(obj-find $o, $v)
>         default
>            value $x

Note that "return" is a control operation that only differs from "value" 
in cases where something follows it.

Simple

obj-get(o, v, x) =
    try
       value $(obj-find $o, $v)
    default
       value $x

works the same.

Aleksey


More information about the Omake mailing list