Leftmost outermost Reduction (Haskell) -


i got task use leftmost outermost reduction on following expression:

f inc expo 9 (f (*2) expo 3 1) 

inc defined as:

 inc :: int -> int  inc x = x+1 

expo defined as:

expo :: int -> int expo x = expo (x*2) 

and f as:

f :: (int->int) -> (int-> int) -> int -> int -> int f g h b = g(a-b) 

i have absolutely no clue start reduction more functions. read hint redex not contained in other redexes, dont ;(.

i appreciate every tip/help.

the first (leftmost, outermost) reduction for

f inc expo 9 (f (*2) expo 3 1) 

is apply definition of f, once, f g h b = g(a-b) use g inc, a 9 , b (f (*2) expo 3 1), giving

inc(9 - (f (*2) expo 3 1)) 

now we're done question asked. that's leftmost, outermost reduction made. notice didn't need use facts other functions, hint getting at.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -