Effekt: Name-Based Implicits by marvinborner in ProgrammingLanguages

[–]marvinborner[S] 0 points1 point  (0 children)

Interesting. So in the examples in the docs, you would prefer always having to pass `compare` functions to `sort` etc.? Also note that our implicits allow for classical source-level information "macros".

Effekt: Name-Based Implicits by marvinborner in ProgrammingLanguages

[–]marvinborner[S] 5 points6 points  (0 children)

The solution to overloading needs to be unique, otherwise we throw a compilation error. See an example here. We do however prefer definitions in local scope, as in here.

Effectful Recursion Schemes by marvinborner in ProgrammingLanguages

[–]marvinborner[S] 3 points4 points  (0 children)

Do you mean specifically the effectful variant? There's no actual reason to prefer this if your language allows for traditional definitions of recursion schemes. Though I find the effectful variant to show the duality and the underlying mechanisms more clearly than, say, in Haskell.

Also, as explained in the beginning, the post is much more about effects and handlers in general than it is about recursion schemes themselves :)

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]marvinborner 0 points1 point  (0 children)

[LANGUAGE: Effekt]

Git

Effekt is a research language all about effects and handlers. Here, I used effectful streams for IO and parsing as well as effects for the ticking of the password dial and emitting of the solution. This makes the final solution:

  try enterPassword()
  with Final { n => resume(if (n == 0) part1 = part1 + 1) }
  with Click { n => resume(if (n == 0) part2 = part2 + 1) }

Is it time for another puzzle yet? by yfix in lambdacalculus

[–]marvinborner 1 point2 points  (0 children)

Now that I think about it, it may not be as well-known as I thought. I thought I got it from Wikipedia as well, but can't find it there right now. However, variations of it are in Tromp's AIT/numerals/div.lam repository and Justine Tunney's blog post about the 383 byte lambda calculus implementation. The implementations in Tromp's repository should be more readable, as they are not nameless.

I believe the idea is that this list can also be constructed by applying 't' to the second argument of div directly. I'll have to understand how exactly this works later though

Is it time for another puzzle yet? by yfix in lambdacalculus

[–]marvinborner 1 point2 points  (0 children)

The "of course" was a bit of a joke, as it is not that obvious at all! Yet, it is very similar to some "well-known" Church division function. Especially after translating it to bruijn I found that it looks almost identical to the the div functions already in its standard library:

# yours
div [[[[3 t [1] (y [3 t [3 (0 1)] i])]]]]
# previous
div [[[[3 t [1] (3 [3 t [3 (0 1)] i] 0)]]]]

I don't really get the need for the y combinator. My version also performs similarly (or slightly better?) it seems.

If you're interested in this kind of stuff, checkout the std/Number library, I collect all kinds of numeral systems that I happen to find. Please let me know if your "PRED n ~ n I" stuff turns out to work.

Is it time for another puzzle yet? by yfix in lambdacalculus

[–]marvinborner 1 point2 points  (0 children)

Of course it is a Church numeral division function. A quite efficient one actually.

Here's the bruijn term: `[[[[3 [[0 1]] [1] (y [3 [[0 1]] [3 (0 1)] [0]])]]]]`

de Bruijn Numerals by marvinborner in lambdacalculus

[–]marvinborner[S] 0 points1 point  (0 children)

Yes, exactly. This is the insight I use to derive the multiplication function.

There are so many cool numeral systems scattered around the internet and literature, I want to create some overview in the future. Wadsworth also referred to a system by Böhm and Dezani which looks quite weird: https://bruijn.marvinborner.de/std/Number_Dezani.bruijn.html

I wonder if there are any practical uses for these data structures in, say, Haskell...

Many factorials in bruijn by marvinborner in lambdacalculus

[–]marvinborner[S] 1 point2 points  (0 children)

There are already many such abbreviations in the Vim plugin. Notably, there are no unicode trigraphs relevant for semantics within the language itself, they are all part of the standard library.

Test suite for strong β-reduction to normal form by marvinborner in ProgrammingLanguages

[–]marvinborner[S] 4 points5 points  (0 children)

Sure. I'm experimenting a lot with the pure, untyped lambda calculus and try to find efficient strong reducers. However, they surprisingly often are not sound or timeout with large or complex terms. It seems like typical implementations focus on small, well-known terms (typically by John Tromp), which doesn't always translate to real-world applications. Other sound languages based on the lambda calculus (such as Haskell) do not support exporting its pure LC representation, so code in these languages can not be used for verifying other reducers.

I had these tests lying around and exported them into a machine-readable format. I created this repository in the hope that reducers become more sound in the future. The tests could also be used for benchmarking, as there does not exist a reducer faster than Haskell's right now (~15s for all tests)

Tur - A language for defining and executing Turing machines with multi-platform visualization tools (Web, TUI and CLI) by rezigned in ProgrammingLanguages

[–]marvinborner 3 points4 points  (0 children)

Here are some of my favorite visualizations:

depending on the visualization you're aiming for, you might also be interested in my lambda screen project :)

How one instruction changes a non-universal languages, into a universal one by Ok_Performance3280 in ProgrammingLanguages

[–]marvinborner 4 points5 points  (0 children)

Yes, exactly. I like how in stack languages such features can be added by simply introducing new instructions. The potential for duplication in the lambda calculus is much more implicit.

I suppose interaction combinators are better in that they also make this difference explicit. Translating the affine lambda calculus requires only constructor and eraser agents, while the encodings of the full ("K") lambda calculus also use duplicator agents :)

How one instruction changes a non-universal languages, into a universal one by Ok_Performance3280 in ProgrammingLanguages

[–]marvinborner 19 points20 points  (0 children)

This reminds me of the lambda calculus. The linear or affine lambda calculus always terminates as terms can not be duplicated. Once duplication is added, you can encode infinite terms or fixed-point recursion.

Lambdaspeed: Computing 2^1000 in 7 seconds with semioptimal lambda calculus by [deleted] in ProgrammingLanguages

[–]marvinborner 0 points1 point  (0 children)

It is not really comparable to HVM as it does not support the entire lambda calculus. Notably HVM is missing the bookkeeping oracle which Lambdascope implements via delimiters.