Choral

1 program Added 2026-02-23T17:24:21Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled Evidence Report issue View issues
Aliases: —
Provenance: commit cf9c35398b · authored 2026-02-23T18:24:51+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

Coral (0.50)Charcoal (0.29)CORAL 68 (0.29)CAMAL (0.25)CHILL (0.25)

LLM-contributed programs

Mergesort

Provenance: commit cf9c35398b · authored 2026-02-23T18:24:51+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
code.choral · added: 2026-02-23T17:24:21Z
public class Mergesort@( A, B, C ){

  SymChannel@( A, B )< Object > ch_AB;
  SymChannel@( B, C )< Object > ch_BC;
  SymChannel@( C, A )< Object > ch_CA;

  public Mergesort(
    SymChannel@( A, B )< Object > ch_AB,
    SymChannel@( B, C )< Object > ch_BC,
    SymChannel@( C, A )< Object > ch_CA
  ) {
    this.ch_AB = ch_AB;
    this.ch_BC = ch_BC;
    this.ch_CA = ch_CA;
  }

  public List@A< Integer > sort( List@A< Integer > a ){
    if ( a.size()> 1@A ) {
      ch_AB.< Choice >select( Choice@A.L );
      ch_CA.< Choice >select( Choice@A.L );
      Mergesort@( B, C, A ) mb = new Mergesort@( B, C, A )( ch_BC, ch_CA, ch_AB );
      Mergesort@( C, A, B ) mc = new Mergesort@( C, A, B )( ch_CA, ch_AB, ch_BC );
      Double@A pivot = a.size() / 2@A
        >> Math@A::floor
        >> Double@A::valueOf;
      List@B<Integer> lhs = a.subList( 0@A, pivot.intValue() )
        >> ch_AB::< List< Integer > >com
        >> mb::sort;
      List@C< Integer > rhs = a.subList( pivot.intValue(), a.size() )
        >> ch_CA::< List< Integer > >com
        >> mc::sort;
      return merge( lhs, rhs );
    } else {
      ch_AB.< Choice >select( Choice@A.R );
      ch_CA.< Choice >select( Choice@A.R );
      return a;
    }
  }

  private List@A< Integer > merge ( List@B< Integer> lhs, List@C< Integer> rhs ) {
    if( lhs.size() > 0@B ) {
      select( MChoice@B.L, ch_AB ); select( MChoice@B.L, ch_BC );
      if( rhs.size() > 0@C ){
        select( MChoice@C.L, ch_CA ); select( MChoice@C.L, ch_BC );
        ArrayList@A< Integer > result = new ArrayList@A< Integer >();
        if( lhs.get( 0@B ) <= ch_BC.< Integer >com( rhs.get( 0@C ) ) ){
          select( MChoice@B.L, ch_AB ); select( MChoice@B.L, ch_BC );
          lhs.get( 0@B ) >> ch_AB::< Integer >com >> result::add;
          merge( lhs.subList( 1@B, lhs.size() ), rhs ) >> result::addAll;
          return result;
        } else {
          select( MChoice@B.R, ch_AB ); select( MChoice@B.R, ch_BC );
          rhs.get( 0@C ) >> ch_CA::< Integer >com >> result::add;
          merge( lhs, rhs.subList( 1@C, rhs.size() ) ) >> result::addAll;
          return result;
        }
      } else {
        select( MChoice@C.R, ch_CA ); select( MChoice@C.R, ch_BC );
        return lhs >> ch_AB::< List< Integer > >com;
      }
    } else {
      select( MChoice@B.R, ch_AB ); select( MChoice@B.R, ch_BC );
      return rhs >> ch_CA::< List< Integer > >com;
    }
  }
}

Contribute — propose a file extension

Tell us where to find evidence about Choral (mapped to pl/choral). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Choral/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Chops Chordfuck →