Compiler fails sometimes when parameter deconstruction not used
@prozacchiwawa is already working on this.
Since Aug 18, 2022.
Assessment
This issue has not been assessed yet.
Description
I believe that I maybe found a bug in the compiler.
Steps to reproduce:
cat > puzzle.cl <<EOF
(mod params
(defun ident (arg)
(f (list arg))
)
(ident (ident params))
)
EOF
run puzzle.cl
Expected result:
I expect a CLVM puzzle to be written to stdout, which would output its solution when passed to brun (i.e. "identity puzzle").
Actual results:
The run command fails with the following message:
FAIL: first of non-cons 1
Some more insight:
When I modify the puzzle in either one of the following ways, then it translates and the resulting CLVM behaves as expected:
(f (list arg))->(f arg)(f (list arg))->(list arg)(f (list arg))->(f (f arg))(f (list arg))->(list (list arg))(f (list arg))->(list (f arg))(ident (ident params))->(ident params)(mod params ...)->(mod (params) ...)
Please note that the documentation admits any of the following possibilities:
(mod params ...)(mod (param_one param_two) ...)(mod ((param)) ...)
Quoting https://chialisp.com/docs/high_level_lang#squaring-a-list:
You can name each parameter in a list or you can name the list itself. This works at any place where you name parameters, and allows you to handle lists where you aren't sure of the size.
- Dominant language
- Python
- Stars
- 51
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Chia-Network/clvm_tools
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
Chia-Network/clvm_tools#74 ·
-
Chia-Network/clvm_tools#71 · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 20/100
Chia-Network/clvm_tools#66 · 5 comments · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Chia-Network/clvm_tools#64 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Chia-Network/clvm_tools#61 · 2 comments ·
All issues in Chia-Network/clvm_tools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100