2
declare
fun {Beta E}
    case E
    of lambda(X [Y Z]) andthen {IsAtom Y}  then Z
    else nil 
     end
    end

{Browse {Beta lambda(y [y a])   }}

I'm trying to make a beta reducer for lambda calculus but I don't know how to append arguments for Oz which I just started using.

What I want to do is: IsAtom Y and if(X==Y) then Z

I've tried "and, &&, &, andthen" but nothing really works. Oz documentation is just giving me headaches.

Shaunak
  • 17,377
  • 5
  • 53
  • 84
user1869558
  • 697
  • 3
  • 11
  • 21

2 Answers2

1

In Oz, And is a function not an operator. So to do an and operation you would do something like

{And true false}

Will yield false

Here is a good reference manual.

Shaunak
  • 17,377
  • 5
  • 53
  • 84
1

Remember 'then' is a separator in statement syntax, 'andthen' and 'orelse' are boolean (short circuit) operators

CASESTATEMENT:

case VALUE of PATTERN then STATEMENT

IFSTATEMENT:

if BOOLEXP then STATEMENT

BOOLEXP: BOOLEXP andthen BOOLEXP orelse BOOLEXP

larsr
  • 5,447
  • 19
  • 38