Discussion
Loading...

#Tag

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 days ago

I like consistent colors in my terminal and I like #OCaml, so I threw together a quick Nord color scheme for utop:

https://git.sr.ht/~citizen428/nord-utop

The following example code in a utop session show in the Nord colorscheme.

# let rec sum = function
| [] -> 0
| hd :: tl -> hd + sum tl;;
val sum : int list -> int = <fun>
# #show sum;;
val sum : int list -> int
# "Hello, " ^ "OCaml " ^ "World!";;
- : string = "Hello, OCaml World!"
# 1/0;;
Exception: Division_by_zero.
# 1 + "string";;
Error: This constant has type string but an expression was expected of type int
The following example code in a utop session show in the Nord colorscheme. # let rec sum = function | [] -> 0 | hd :: tl -> hd + sum tl;; val sum : int list -> int = <fun> # #show sum;; val sum : int list -> int # "Hello, " ^ "OCaml " ^ "World!";; - : string = "Hello, OCaml World!" # 1/0;; Exception: Division_by_zero. # 1 + "string";; Error: This constant has type string but an expression was expected of type int
The following example code in a utop session show in the Nord colorscheme. # let rec sum = function | [] -> 0 | hd :: tl -> hd + sum tl;; val sum : int list -> int = <fun> # #show sum;; val sum : int list -> int # "Hello, " ^ "OCaml " ^ "World!";; - : string = "Hello, OCaml World!" # 1/0;; Exception: Division_by_zero. # 1 + "string";; Error: This constant has type string but an expression was expected of type int
  • Copy link
  • Flag this post
  • Block
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 weeks ago

I have now also resurrected the other old #ocaml article and converted the code examples from #reasonml:

https://citizen428.net/blog/ocaml-module-functors/

Note that this was originally written for an audience of mostly OO programmers, not FP aficionados, so it may occasionally be a bit loose with terminology.

Module Functors in OCaml - citizen428.net

Note: A version of this article was originally written for Human Readable magazine in March 2020. That site no longer exists, so I decided to republish it on this blog. In the process I also converted the example code from ReasonML to OCaml syntax and updated the text to reflect those changes. Since functional programming’s move into the mainstream, many developers have embraced concepts like higher-order functions. OCaml take this a step further and extends the concept to the module level. This article explores module functors, a powerful feature that offers a functional approach to code sharing, dependency injection, and more.
  • Copy link
  • Flag this post
  • Block
jbz
@jbz@indieweb.social  ·  activity timestamp 2 weeks ago

🐫 OCaml Platform Roadmap · OCaml Documentation

https://ocaml.org/tools/platform-roadmap

#ocaml #programming #functionalprogramming

OCaml

OCaml Platform Roadmap · OCaml Documentation

The 2024-2026 roadmap for the OCaml Platform.
  • Copy link
  • Flag this post
  • Block
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 weeks ago

I have another #ocaml article that is no longer available online since the magazine it was written for has shut down. However, it uses #reasonml syntax. Does anyone still use that, or should I convert the examples to OCaml and update the text?

  • Copy link
  • Flag this post
  • Block
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 weeks ago

A couple of years ago I wrote an article about #ocaml extension points/PPX for a magazine that no longer exists. It's been offline for a while now and is unlikely to ever come back, so I decided to republish it on my blog:

https://citizen428.net/blog/introduction-ocaml-extension-points/

Introduction Ocaml Extension Points - citizen428.net

Note: This article was originally written for Human Readable magazine. That site no longer exists, so I decided to republish it on this blog. Metaprogramming is a technique in which programs modify themselves at compile or run time. This can be achieved in various ways, for example through reflection (C#, Java, Ruby, Smalltalk), templates (C++, D, Template Haskell), or macros (Lisp, Elixir). The OCaml language offers a distinct approach to compile-time code generation in the form of extension points and AST rewriters, which we’ll explore in this article.
  • Copy link
  • Flag this post
  • Block
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 weeks ago

Operator Lookup

https://www.craigfe.io/operator-lookup/

Very useful #ocaml tool.

Operator Lookup

An operator lookup utility for OCaml.
  • Copy link
  • Flag this post
  • Block
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 weeks ago

Every couple of years I seem to briefly develop a crush on #ocaml. Now seems to be such a time again, triggered by the 5.4 release announcements. This post is very informative if you're not (too) familiar with the language.

https://xvw.lol/en/articles/why-ocaml.html

  • Copy link
  • Flag this post
  • Block
Stefano Marinelli boosted
Juno
@jutty@mastodon.bsd.cafe  ·  activity timestamp last month

The OCaml implementation of iganaq was finished in May, but I only got to finish writing about it today:

https://tori.jutty.dev/updates/iganaq-ocaml/

iganaq is my experimental subset of tori (https://tori.jutty.dev) for evaluating candidate programming languages for its future versions.

#OCaml #ProgrammingLanguages #programming #OperatingSystems

  • Copy link
  • Flag this post
  • Block
Juno
@jutty@mastodon.bsd.cafe  ·  activity timestamp last month

The OCaml implementation of iganaq was finished in May, but I only got to finish writing about it today:

https://tori.jutty.dev/updates/iganaq-ocaml/

iganaq is my experimental subset of tori (https://tori.jutty.dev) for evaluating candidate programming languages for its future versions.

#OCaml #ProgrammingLanguages #programming #OperatingSystems

  • Copy link
  • Flag this post
  • Block
Bozhidar Batsov (a.k.a. Bug)
@bbatsov@hachyderm.io  ·  activity timestamp 2 months ago

When I saw #Python code like:

processed = map(normalize, map(clean, filter(is_valid, items)))

I immediately realized why Pythonistas believe that list comprehensions read better. I'm really surprised they didn't add some form of pipeline chaining to make such transformations more natural.

Not a big deal, but after so much #Ruby, #Clojure and #OCaml my mind really struggles to parse such code.

  • Copy link
  • Flag this post
  • Block
d@nny disc@ mc² boosted
Hannes
@hannes@social.coop  ·  activity timestamp 2 months ago

I know we're late to the party, but finally https://ocaml.org/security is alive #OCaml #security -- so please share your exploits now 😊 or at least know a way to report the segmentation faults you encounter ;)

  • Copy link
  • Flag this post
  • Block
Hannes
@hannes@social.coop  ·  activity timestamp 2 months ago

I know we're late to the party, but finally https://ocaml.org/security is alive #OCaml #security -- so please share your exploits now 😊 or at least know a way to report the segmentation faults you encounter ;)

  • Copy link
  • Flag this post
  • Block
Xavier Van de Woestyne
@xvw@merveilles.town  ·  activity timestamp 3 months ago

Here is a rather lengthy write-up (in English) explaining why I chose #OCaml as my main programming language for my personal and professional projects!

https://xvw.lol/en/articles/why-ocaml.html

I hope you find this interesting, and I welcome any feedback!

  • Copy link
  • Flag this post
  • Block
jbz
@jbz@indieweb.social  ·  activity timestamp 4 months ago

🐫 Writing a Game Boy Emulator in OCaml • linoscope

「 For the past few months, I have been working on a project called CAMLBOY, a Game Boy emulator written in OCaml that runs in the browser. You can try it out on the following demo page: https://linoscope.github.io/CAMLBOY 」

https://linoscope.github.io/writing-a-game-boy-emulator-in-ocaml/

#ocaml #gameboy #emulation #retrogaming

  • Copy link
  • Flag this post
  • Block
Juno
@jutty@mastodon.bsd.cafe  ·  activity timestamp 7 months ago

tori will be rewritten in another programming language. But which one? The contenders are OCaml, Haskell and Rust and the decision will be made by implementing a simplistic subset of its functionality in an experimental project called iganaq.

For more details, the reasons behind the rewrite and the candidate languages, see the announcement here:

https://tori.jutty.dev/updates/iganaq

Or go straight to the code, where the OCaml implementation is almost done already:

https://brew.bsd.cafe/tori/iganaq

#programming#OCaml#Haskell#Rust

  • Copy link
  • Flag this post
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.3.21 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login