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

Evaluation example gives different output #391

Open
Chaz6 opened this issue Jan 27, 2021 · 2 comments
Open

Evaluation example gives different output #391

Chaz6 opened this issue Jan 27, 2021 · 2 comments
Labels

Comments

@Chaz6
Copy link

Chaz6 commented Jan 27, 2021

When I run one of the evaluation examples, the output shown is different to that of the example.

The example is thus:-

> roll(|1=("chicken", roll(|1=("hot dog", roll(|1=("pizza", roll(|0=()|))|))|))|) :: ^x.(()+([char]*x))
"chicken":"hot dog":"pizza":[]
> cons("chicken", cons("hot dog", cons("pizza", nil())))
"chicken":"hot dog":"pizza":[]

The actual output is :-

> roll(|1=("chicken", roll(|1=("hot dog", roll(|1=("pizza", roll(|0=()|))|))|))|) :: ^x.(()+([char]*x))
"nekcihcgod tohazzip"
> cons("chicken", cons("hot dog", cons("pizza", nil())))
"nekcihcgod tohazzip"
@smunix smunix added the bug label Jan 27, 2021
@smunix
Copy link
Contributor

smunix commented Jan 27, 2021

I'm able to reproduce this on Nix too:

~ ∫ nix shell nixpkgs#hobbes -c hi -s -x -e 'roll(|1=("chicken", roll(|1=("hot dog", roll(|1=("pizza", roll(|0=()|))|))|))|) :: ^x.(()+([char]*x))'
"nekcihcgod tohazzip"

@smunix
Copy link
Contributor

smunix commented Jan 27, 2021

Thank you for reporting this, it looks like we have an issue printing the output, it's reversed. I'll fix it. The following works:

~ ∫ nix shell nixpkgs#hobbes -c hi                                                                                                                                                                                            [14:01:37] 
hi : an interactive shell for hobbes
      type ':h' for help on commands

> fix=\xs.reverse(slice(xs,0,size(xs)))
> fix(roll(|1=("chicken", roll(|1=("hot dog", roll(|1=("pizza", roll(|0=()|))|))|))|) :: ^x.(()+([char]*x)))
"pizzahot dogchicken"
>

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

2 participants