Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printf.printf doesn't like to be eta-reduced #3711

Closed
vicuna opened this issue Sep 18, 2002 · 2 comments
Closed

Printf.printf doesn't like to be eta-reduced #3711

vicuna opened this issue Sep 18, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 18, 2002

Original bug ID: 1394
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

I'd expect the expressions

List.iter (Printf.printf "%d %d\n" e) l'

and
List.iter (fun i -> Printf.printf "%d %d\n" e i) l'

to both print e paired with all elements of l', but I get this instead:

     Objective Caml version 3.06

List.iter (Printf.printf "%d %d\n" 1) [2; 3; 4];;

1 2
3
4

  • : unit = ()

List.iter (fun i -> Printf.printf "%d %d\n" 1 i) [2; 3; 4];;

1 2
1 3
1 4

  • : unit = ()

This doesn't feel right.

Yours, Florian Hars.

@vicuna
Copy link
Author

vicuna commented Sep 18, 2002

Comment author: administrator

On Wed, 18 Sep 2002 17:20:36 +0200 (MET DST)
hars@bik-gmbh.de wrote:

I'd expect the expressions

List.iter (Printf.printf "%d %d\n" e) l'
and
List.iter (fun i -> Printf.printf "%d %d\n" e i) l'

to both print e paired with all elements of l', but I get this instead:

     Objective Caml version 3.06

List.iter (Printf.printf "%d %d\n" 1) [2; 3; 4];;

1 2
3
4

  • : unit = ()

List.iter (fun i -> Printf.printf "%d %d\n" 1 i) [2; 3; 4];;

1 2
1 3
1 4

  • : unit = ()

This doesn't feel right.

This question is a classic.
It is exaplained here :
http://caml.inria.fr/ocaml/htmlman/libref/Printf.html

--
Maxence Guesdon

@vicuna
Copy link
Author

vicuna commented Sep 20, 2002

Comment author: administrator

... as documented in the manual for Printf.

@vicuna vicuna closed this as completed Sep 20, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant