Skip to content

Commit 9ad865c

Browse files
committed
README: tweaks
1 parent 4466644 commit 9ad865c

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ An important design goal is that a somewhat experienced developer -- especially
2525
In the following code snippet, you'll might recognize familiar mechanisms like function calls and pattern recognition. There's also some standard FP idioms like partial application and composition (and a monad!). You might also spot a fun trick (operators-as-functions)!
2626

2727
```java
28+
defn arithmetic(op) ^(
29+
?(op){
30+
["add"]: (+);
31+
["subtract"]: (-);
32+
["multiply"]: (*);
33+
["divide"]: (/);
34+
: Left@ "Invalid"
35+
}
36+
);
2837
def adder: arithmetic("add");
2938
def subtractor: arithmetic("subtract");
3039
def tripler: (*)|3|;
@@ -40,19 +49,7 @@ sub5(12); // 7
4049
3 #> tripler #> adder(3, #) #> sub5; // 7
4150

4251
compute(3); // 7
43-
(<+)(sub5, add3, tripler)(3); // 7
44-
45-
// ***********************
46-
47-
defn arithmetic(op) ^(
48-
?(op){
49-
["add"]: (+);
50-
["subtract"]: (-);
51-
["multiply"]: (*);
52-
["divide"]: (/);
53-
: Left@ "Invalid"
54-
}
55-
)
52+
(<+)(sub5, add3, tripler)(3) // 7
5653
```
5754

5855
----
@@ -196,7 +193,7 @@ To prepare for exploration of **Foi**, here are some aspects of the design philo
196193

197194
The `&` capability also allows selective picking/linking, like `< &two.3 >` `< &one.something >`.
198195

199-
Computed property names in JS again overload the `[ .. ]` syntax, like `{ [someProp]: 42 }`. But in **Foi**, we simplify this with a single `%` symbol: `< %someProp: 42 >`. This is also how Records act as Maps (non-primitive keys): `< %otherObj: .. >`.
196+
Computed property names in JS again overload the `[ .. ]` syntax, like `{ [someProp]: 42 }`. But in **Foi**, we simplify this with a single `%` symbol: `< %someProp: 42 >`. This is also how Records act as Maps (non-primitive keys): `< %otherObjAsKey: .. >`.
200197

201198
**Foi** treats a "Set" as just a filtered construction (removing duplicates) of a Tuple.
202199

0 commit comments

Comments
 (0)