Three argument `~^` is not supported

Open
#895 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
backend

Research direction

Start by locating the implementation and tests for the ~^ format directive; the issue provides a Chez Scheme documentation link and a reproducing printf expression. Compare the existing one and two parameter cases with the documented three parameter rule. Done means three parameters are accepted and termination follows the stated comparison, with the existing cases still working.

Written by the indexing model from the issue text.

Description

Per the CSUG,

Chez Scheme's implementation of format supports all of the Common Lisp [30] format directives except for those specific to the Common Lisp pretty printer.

However, the up-and-out/escape upward directive ~^ does not support three arguments:

If a prefix parameter is given, then termination occurs if the parameter is zero. (Hence ~^ is equivalent to ~#^.) If two parameters are given, termination occurs if they are equal. If three parameters are given, termination occurs if the first is less than or equal to the second and the second is less than or equal to the third.

(format "appears~0^ does not appear")
>>> "appears"
(format "appears~1,1^ does not appear")
>>> "appears"
(printf "appears~2,3,4^ does not appear")
>>> Exception in format: too many parameters in ~^ directive "~2,3,4^"
Dominant language
Scheme
Stars
7.4k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
19

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cisco/ChezScheme

All issues in cisco/ChezScheme

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.