Git Product home page Git Product logo

cauliflambda's Introduction

Hi there, I'm Tau. 👋

I'm currently in a very deep rabbit hole trying to bring automatic dark/light detection to terminals and applications running inside terminals.

Some very rough notes can be found in my agenda repository.

cauliflambda's People

Contributors

bash avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cauliflambda's Issues

Show normal form in terms of nominal definitions

If a normal form exists, annotate it with a list of nominal definitions it matches.

E.g. for the following term:

True -> (&t f . t)
False -> (&t f . f)
0 --> (&f x. x)

(False)

The normal form should be shown as:

->> (λ(λ1))
    ^^^^^^^
    Also known as False, 0.

Built-in asserts for testing

This would be helpful for testing that a building block indeed does what it's supposed to.

A special built-in definition should do the trick:

assert (EXPECTED_TERM) (ACTUAL_TERM)

Or a dedicated syntax maybe?

Parse Nominal Definitions

Syntax is very similar to schematic definitions

True -> (λt f.t)
False -> (λt f.f)

Definitions may reference other definitions but they may not be
mutually recursive to prevent infinite loops while expanding definitions.
(You should use a Y-combinator if you need mutual recursion)

Evaluation Take Ⅱ

The reducer using namefree expressions was very easy to implement (and educational ^^). However it comes with a few drawbacks concerning debuggability:

  • (obviously) The names are gone, which makes the expressions unreadable to humans
  • With the current plan for definitions (#1) the expressions would have gotten very large as I planned to implement them in terms of abstractions and applications.

My new goal is to implement a reducer for expressions with names, which means I need to implement ɑ-Conversion after all :/

The reducer should expand definitions lazily i.e. when a definition is on the left side of the outermost application.

Ideally the renaming of the ɑ-Conversion is also done in a separate step for a better user experience.

To do

False positive for warning

warning: unnecessary abstraction
  ┌─ tests/factorial.lc:7:7
  │
5 │   (λ decr
6 │    .
7 │    (λ self . self self)
  │       ^^^^        ^^^^ help: remove the abstraction and this application
8 │    (λ self n . n (λ_ . mult n ((self self) (decr n))) 1)
9 │   )

Embeddable

  • Maximum for automatic church numerals (large numbers can overflow the stack)
  • Maximum steps for beta-reduction
  • Predefined definitions (with a warning if you shadow it)
  • Option to disable syntax sugar such as automatic church numerals, definitions, etc.
  • Spans that point to different files (so that the embedder can surround the user code with an application to pass in data–errors should point to a different "file" in that case)

Reduce to normal form

API shape that I have in mind:

pub fn reduce_to_normal_form(
    expression: Expression<'_>,
    max_reductions: u64,
) -> impl Iterator<Item = DiagnosticsResult<Expression<'_>>>;

I'm not sure what the best return type would be, but I think having the iterator is a good idea
because it allows my UI to display all steps and then an diagnostics message if we do to many reductions.
The diagnostic message should point to the application that was last applied.

Returning a diagnostic depends on #7.

Separate AST from internal representation

The AST should be as close to the entered syntax as possible. This makes warnings / suggestions much more powerful.

Some differences:

  • The parser allows abstractions with more than one variable.
  • The parser allows grouping using parenthesis.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.