Evaluation example gives different output
Chaz6 opened this issue · 2 comments
Chaz6 commented
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 commented
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 commented
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"
>