![]() |
ocaml pattern matching
Kind of confused for some reason... give the following...
:
type expr = Plus of expr * expr (* means a + b *)the matching in to_string is where I'm getting confused a tad So given this : Times (Value "n", Plus (Value "x", Value "y")) Okay while looking it at I think I figured it out... When that goes through the matching I was getting confused on why it called to_string again with each parameter after it found a match but I guess it does it because the parameter can be folded such as the Plus and needs to be recycled to the function. Right? |
| All times are GMT -5. The time now is 12:54 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC