This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
forked from Chia-Network/clvm_tools_rs
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from Chia-Network/20221217-assign
20221217 assign
- Loading branch information
Showing
19 changed files
with
1,589 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
( | ||
(defun last_inner ((next . remainder)) | ||
(if remainder | ||
(last_inner remainder) | ||
next | ||
) | ||
) | ||
|
||
(defmacro last ARGS | ||
(defun snoc (L agg) | ||
(if L | ||
(if (r L) | ||
(snoc (r L) (c (f L) agg)) | ||
(c (f L) agg) | ||
) | ||
(c () ()) | ||
) | ||
) | ||
|
||
(defun prefix (L P) | ||
(if L | ||
(c (f L) (prefix (r L) P)) | ||
P | ||
) | ||
) | ||
|
||
(if ARGS | ||
(if (r ARGS) | ||
(assign | ||
(final . rest) (snoc ARGS ()) | ||
reversed (prefix rest (list final)) | ||
(qq (last_inner (unquote (c list reversed)))) | ||
) | ||
(qq (last_inner (unquote (f ARGS)))) | ||
) | ||
(x "Last takes at least one argument") | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(mod () | ||
(include *standard-cl-21*) | ||
(include last.clinc) | ||
|
||
(last 99 100 101) | ||
) |
Oops, something went wrong.