Efficient Boolean Formula Evaluation Functions for Simplified SML Programming"

  • Thread starter Thread starter Monsu
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
The discussion revolves around a programming challenge involving the creation of a cascading evaluation function for boolean expressions. The task requires defining two functions: `eval`, which takes an integer-to-boolean mapping and a boolean expression, returning a custom boolean type (`mybool`), and `evalbib`, which simplifies this by returning a standard boolean type without using "if" constructs. The user expresses confusion and seeks clarification on how to approach the problem, emphasizing their novice status in programming. The response suggests reviewing provided educational materials, indicating that foundational knowledge may be necessary to tackle the problem effectively.
Monsu
Messages
38
Reaction score
1
hi, pleaaaaaaaaaase! i need help urgently! I am completely stuck! I have no idea what to do on this question, it reads thus:





Given the following datatypes for boolean formulae and the truth values

datatype boolexp = bez | beo (*0 and 1*)
| bep of boolexp * boolexp (*plus*)
| bet of boolexp * boolexp (*times*)
| bec of boolexp (*complement*)
| bev of int (*variables*)
datatype mybool = mytrue | myfalse

write a cascading evaluation function eval : (int -> mybool) -> boolexp -> mybool
that takes an assignment $ and a boolean formula & and returns I$(&) as a value .
write a simplified version of the function evalbib : (int -> bool) -> boolexp -> bool. (without using "if" constructs)




I'm clueless as to how to begin this, and I am a novice in all languages, any acclaration and explanations will be highly appreciated, thanks in advance!


:rolleyes: :rolleyes: :rolleyes:
 
Computer science news on Phys.org
read the slides


philipp
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Back
Top