Skip to content

Commit

Permalink
Meetup 15 notes and upcoming meetup
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasJayanth committed Aug 18, 2024
1 parent d0bbfd7 commit 7f1ac49
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 16 deletions.
25 changes: 25 additions & 0 deletions blog/2024-08-04-monopoly-in-ocaml-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
slug: monopoly-in-ocaml-3
title: "Meetup 14: Monopoly in OCaml continued - part 3"
authors: [prometheansacrifice]
---

[@theteachr](https://github.com/theteachr) showed us the minimal TUI he wrote for the game and explained the game loop.

**Highlights**

1. We discussed how game loop had to be kept a pure function of game state and player moves
2. Possible improvements with a `Seq` modules



## Next Meetup

Checkout [Upcoming Meetups](/upcoming-meetups)

## Stay in touch with us


Twitter: https://x.com/ReasonBangalore

Discord: https://discord.com/invite/Ytr36fRC4C

43 changes: 43 additions & 0 deletions blog/2024-08-11-monopoly-in-ocaml-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
slug: monopoly-in-ocaml-4
title: "Meetup 15: Monopoly in OCaml continued - part 4"
authors: [prometheansacrifice]
---

[@theteachr](https://github.com/theteachr) showed us the new game loop using `Seq.of_dispenser` making the game loop look like this.


```ocaml
let () =
let game =
[ "ocaml"; "reason"; "melange"; "dune" ]
|> List.map Player.make
|> Game.start
in
read_command
|> Seq.of_dispenser
|> Seq.filter_map Command.parse
|> Seq.scan Command.exec game
|> Seq.take_while Game.is_not_over
|> Seq.iter Tui.draw
```

**Highlights**

We discussed,
1. Possible use of GADTs for handling propert card transformations. You can find the git branch [here](https://github.com/theteachr/fortune/tree/gadt-property)
2. use of `Seq.unfold`. [Code](https://github.com/theteachr/fortune/tree/unfold)
3. Modular card transformations. [Code](https://github.com/theteachr/fortune/tree/property-modules)



## Next Meetup

Checkout [Upcoming Meetups](/upcoming-meetups)

## Stay in touch with us


Twitter: https://x.com/ReasonBangalore

Discord: https://discord.com/invite/Ytr36fRC4C

57 changes: 57 additions & 0 deletions blog/2024-08-18-treesitter-for-ocaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
slug: tree-sitter-for-ocaml
title: "Meetup 16: Tree sitter for Reason and OCaml"
authors: [prometheansacrifice]
---

[@theteachr](https://github.com/KaranAhlawat) led the session explaining Tree sitter, how to write a grammar, debug tree-sitter-ocaml issies on helix. We even explored extending the Reason tree sitter grammar with a class definition. Here's the WIP snippet.


```diff
diff --git a/grammar.js b/grammar.js
index 9f587a4..7bc6748 100644
--- a/grammar.js
+++ b/grammar.js
@@ -56,6 +56,7 @@ module.exports = grammar(require("./embedded/ocaml"), {
$.expression_statement,
$.open_statement,
$.module_definition,
+ $.class_definition,
$.mutable_record_update,
),

@@ -71,6 +72,22 @@ module.exports = grammar(require("./embedded/ocaml"), {
$._semicolon,
),

+ class_definition: ($) =>
+ seq(
+ "class",
+ // TODO optional($._attribute),
+ $.class_binding,
+ $._semicolon,
+ ),
+
+ class_binding: ($) =>
+ seq(
+ field("name", choice($._class_name, alias("_", $.class_name))),
+ // optional($._module_typed),
+ seq("=", field("body", $._module_expression)),
+ // repeat($.item_attribute),
+ ),
+
module_binding: ($) =>
seq(
field("name", choice($._module_name, alias("_", $.module_name))),
```

## Next Meetup

Checkout [Upcoming Meetups](/upcoming-meetups)

## Stay in touch with us


Twitter: https://x.com/ReasonBangalore

Discord: https://discord.com/invite/Ytr36fRC4C

18 changes: 2 additions & 16 deletions src/pages/upcoming-meetups.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@ title: Upcoming Meetups

# Upcoming Meetups

## Continuted - Joining Nikhil as he writes a card game in OCaml

We'll be continuing Nikhil Bijapur's Monopoly Deal, a card game. We plan to live-code this game was built with Nikhil and learn along the way.

### When?
Date: August, 4th, 2024.
2:00 PM to 4:00 PM IST

### Where?
Online. Join us Discord to get the link.

### Speaker: A. C. Sreedhar Reddy


## Continued: HTML Canvas Game tutorial, but with Reason and OCaml

We continue where we left off last weekend - ie follow the HTML Canvas Game tutorial from MDN. You can find the [code repository on Github org](https://github.com/ReasonOCamlIndia/melange-mdn-canvas-game-tutorial-live-coded).


### When?
Date: August, 11th, 2024. (tentative)
Date: August, 25th, 2024. (tentative)
2:00 PM to 4:00 PM IST

### Where?
Expand All @@ -39,7 +25,7 @@ We will look at how to setup CI for apps written in native Reason and OCaml so t
You can reach out me on X [@ManasJayanth](https://x.com/ManasJayanth) if you have any trouble.

### When?
Sunday, August 18, 2024
Sunday, September 1st, 2024
2:00 PM to 4:00 PM IST

### Where?
Expand Down

0 comments on commit 7f1ac49

Please sign in to comment.