Skip to content

Commit ab0c011

Browse files
bcbeckmanTiagoCavalcante
bcbeckman
authored andcommitted
Issue #96: missing file
1 parent 6235dcc commit ab0c011

File tree

1 file changed

+46
-0
lines changed
  • examples/symbolic_logic/gries_schneider

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
(* ****************************************************************************
2+
3+
by Brian Beckman. License the same as for mathics.
4+
5+
Oct 2020
6+
7+
These examples are adapted from Gries & Schnedier, "A Logical Approach
8+
to Discrete Math." The bibtex entry for this book follows:
9+
10+
@Book{gries1993a,
11+
author = {Gries, David},
12+
title = {A Logical Approach to Discrete Math},
13+
publisher = {Springer New York},
14+
year = {1993},
15+
address = {New York, NY},
16+
isbn = {978-1-4757-3837-7}}
17+
18+
*************************************************************************** *)
19+
20+
(* ***************************************************************************
21+
22+
This file contains tooling so we can write 'expected' and 'actual' in our
23+
examples. You don't need to understand how this works. You just need to know
24+
how to use it, and you'll see how in the examples in GS1.m, GS2.m, GS3.m.
25+
26+
*************************************************************************** *)
27+
28+
ClearAll[expect, totalRight, totalWrong, totalTests];
29+
SetAttributes[ expect, HoldAllComplete ];
30+
totalRight = totalWrong = totalTests = 0;
31+
expect[expected_, actual_] := (* <~~~ Here's the API *)
32+
Module[{evalActualOnce = actual,
33+
evalExpectedOnce = expected},
34+
totalTests += 1;
35+
Print[ {"Test[" <> ToString[totalTests] <> "]:=\n",
36+
HoldForm[actual],
37+
"\nexpected", HoldForm[expected],
38+
"\neval'd expected", evalExpectedOnce,
39+
"\neval'd actual ", evalActualOnce,
40+
"\nright?", evalExpectedOnce === evalActualOnce} ];
41+
Print[ "" ]; (* newline *)
42+
If[ evalExpectedOnce === evalActualOnce,
43+
totalRight += 1,
44+
totalWrong += 1 ];
45+
{"total right", totalRight, "total wrong", totalWrong}
46+
];

0 commit comments

Comments
 (0)