#Combinators

Dyalogdyalog
2024-08-09

In about an hour, Adám from Dyalog is appearing on today's Tacit Talk, a podcast about programming languages, combinators, algorithms, and more. Watch live at 14:00 UTC at youtube.com/watch?v=6LrQithKj8w

Tacit Talk - Dyalog APL with Adám Brudzewsky
2024-06-03

Context free grammars (CFG) are better than parsing expression grammars (PEG), because CFGs represent how we think.

Parser combinators are similar to PEGs, so they are worse than CFGs, too.

So, don't use Rust libraries nom, combine. Use lalrpop.

Don't use Haskell libraries parsec, gigaparsec, attoparsec, megaparsec, trifecta. Use Earley, happy.

See more detailed story in my new article safinaskar.writeas.com/this-is .

The story also includes some cases, where PEG and parser combinators may still be useful. Also, the article gives links to my Haskell parsing libraries.

#haskell #rust #parsing #parse #cfg #peg #combinators #parsercombinators #parsingcombinators #nom #combine #lalrpop #parsec #earley #happy

2024-05-21

Given my difficulties to wrap my head around the Y combinator, I expected it to come with a higher run time penalty. 🙂

#julialang #YCombinator #combinators

Y combinator and it's application to compute the 42nd Fibonacci number, compared with a naive implementation.

Y(f) = (x -> x(x))(y -> f(z -> y(y)(z)))

and

fibg(f) = n -> n < two(n) ? n : f(n - one(n)) + f(n - two(n))

then

Y(fibg)(42)

Using Y it takes 2.6 seconds, naive 1.65 seconds.
2024-02-22

Clojure Blackbird:

(def sum #(reduce + %))

(def • (comp comp comp))

(def aggregate (• sum map))

(aggregate count [[1 2 3] [1 2 3]])

#clojure #combinators

Verity :transHaskell:​:verifiedtransfem:monoidmusician@tech.lgbt
2024-02-03

prettifying my code with combinators tonight :butterfly_ace:​

original:

, Tuple "compileParser" $ const $ Right $ assemble >>> case _ of
Left errs -> pure $ Left $ printErrors errs
Right assembled -> compile assembled <#> case _ of
Left errs -> Left $ intercalate "\n" errs
Right result -> Right result

combinatorified:

, Tuple "compileParser" $ noArgs $
assemble >>> do
failing printErrors |||
compile >== (intercalate "\n" +++ identity)

:butterfly_trans:​

#PureScript #Haskell #combinators

2023-11-02
2023-10-24

I created this cheat sheet about #combinators and their #haskell|-equivalents. Since I didn't find something similiar in my learning process, I thought this could be helpful for others

2023-08-01

Examples of binary choices where both options seem equally good at first, but really aren't:

When writing parsers using #parser #combinators, consuming trailing whitespace is better than consuming leading whitespace. "Design patterns for parser combinators" dl.acm.org/doi/abs/10.1145/347

When writing #E2E #tests, clearing the database before each test is better than clearing it after. "Dangling state is your friend" docs.cypress.io/guides/referen

2023-01-29

#Propositions As #Types • 1
inquiryintoinquiry.com/2013/01

One of my favorite mathematical tricks — it almost seems too tricky to be true — is the #PropositionsAsTypesAnalogy. And I see hints the 2-part analogy can be extended to a 3-part analogy, as follows.

\(\text{proof hint : proof : proposition :: untyped term : typed term : type}\)

See my notes on #PropositionsAsTypes for more.
oeis.org/wiki/Propositions_As_

#Logic #Combinators #ProofTheory #TypeTheory
#CurryHowardIsomorphism #LambdaCalculus

Jons Mostovojsjonn@social.doma.dev
2021-01-09

@tapani the only thing I would have done differently if I was writing it today, I'd use #parser #combinators for github.com/manpages/py-ken/blo, moved program entry point to `main.py` and removed all the dead WIP code like `solver.py`.

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst