Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sharing problem when --enable-self-tail used #341

@samdphillips

Description

@samdphillips

This program does not print the same output when --enable-self-tail is used.

#lang racket/base 

(define xs
  (list (list 1 2 3 4 5)
        (list 5 4 3 2 1)))

(let loop ([xs xs]
           [f void])
  (cond
    [(null? xs) (f)]
    [else
     (define x (car xs))
     (loop (cdr xs)
           (λ ()
             (displayln x)
             (f)))]))

When the flag is not used (or when running the code in Racket) the output is:

(5 4 3 2 1)
(1 2 3 4 5)

When the flag is used the output is:

(5 4 3 2 1)
(5 4 3 2 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions