Efficient Boolean Formula Evaluation Functions for Simplified SML Programming"

  • Thread starter Thread starter Monsu
  • Start date Start date
  • Tags Tags
    Programming
Click For Summary
SUMMARY

The discussion focuses on creating efficient Boolean formula evaluation functions in Standard ML (SML). Participants are tasked with implementing two functions: `eval`, which evaluates a Boolean expression based on an integer assignment, and `evalbib`, a simplified version that avoids "if" constructs. The provided datatype definitions for Boolean expressions (`boolexp`) and Boolean values (`mybool`) are crucial for constructing these functions. The urgency expressed by the original poster highlights the need for clear guidance on functional programming concepts in SML.

PREREQUISITES
  • Understanding of Standard ML (SML) syntax and semantics
  • Familiarity with functional programming concepts, particularly recursion
  • Knowledge of Boolean algebra and expressions
  • Experience with datatype definitions in SML
NEXT STEPS
  • Study the implementation of recursive functions in Standard ML
  • Learn about datatype definitions and pattern matching in SML
  • Research Boolean algebra and its application in programming
  • Explore functional programming techniques that avoid imperative constructs
USEFUL FOR

This discussion is beneficial for novice programmers, particularly those learning Standard ML, as well as educators and students focused on functional programming and Boolean logic evaluation.

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
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K