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

Improve Lisp #344

Merged
merged 22 commits into from
Jun 6, 2022
Merged

Improve Lisp #344

merged 22 commits into from
Jun 6, 2022

Conversation

vinc
Copy link
Owner

@vinc vinc commented Jun 3, 2022

  • Add println function
  • Add args variable containing the list of arguments the script was called with
  • Add or and and boolean operations
  • Add cat and join string operations
  • Add system command to execute programs

@vinc
Copy link
Owner Author

vinc commented Jun 3, 2022

Boolean operations:

> lisp
MOROS Lisp v0.2.0

> (and true false)
false

> (or true false)
true

@vinc
Copy link
Owner Author

vinc commented Jun 3, 2022

Argument parsing:

> lisp /tmp/lisp/factorial.lsp 20
2432902008176640000

> lisp /tmp/lisp/fibonacci.lsp 20
6765

vinc added 8 commits June 4, 2022 10:51
* Add time command

* Fix merge artefact

* Fix call to realtime
* Replace clock syscalls with device files

* Add missing newline to read

* Update time command
@vinc
Copy link
Owner Author

vinc commented Jun 5, 2022

Before last commit:

> [time lisp /tmp/lisp/factorial.lsp 300
inf
Executed 'lisp /tmp/lisp/factorial.lsp 300' in 0.233964s

After:

> time lisp /tmp/lisp/factorial.lsp 300
inf
Executed 'lisp /tmp/lisp/factorial.lsp 300' in 2.308953s

@vinc
Copy link
Owner Author

vinc commented Jun 5, 2022

> time lisp /tmp/lisp/factorial.lsp 300
inf
Executed 'lisp /tmp/lisp/factorial.lsp 300' in 1.857022s

@vinc
Copy link
Owner Author

vinc commented Jun 5, 2022

> time lisp /tmp/lisp/factorial.lsp 300
inf
Executed 'lisp /tmp/lisp/factorial.lsp 300' in 1.214967s

@vinc
Copy link
Owner Author

vinc commented Jun 5, 2022

> time lisp /tmp/lisp/factorial.lsp 300
inf
Executed 'lisp /tmp/lisp/factorial.lsp 300' in 0.585063s

@vinc
Copy link
Owner Author

vinc commented Jun 6, 2022

Before previous commit:

> time lisp /tmp/lisp/factorial.lsp 1000
inf
Executed 'lisp /tmp/lisp/factorial.lsp 1000' in 12.995001s

After:

> time lisp /tmp/lisp/factorial.lsp 1000
inf
Executed 'lisp /tmp/lisp/factorial.lsp 1000' in 3.843024s

And now are back to the performance we had before we replaced both Env and its reference to its parent env &'a Env with Rc<RefCell<Env>> that will allow us to do TCO by changing the recursive calls to eval with a loop. We couldn't do that before because of the difference in lifetime.

@vinc vinc marked this pull request as ready for review June 6, 2022 13:57
@vinc vinc merged commit b2da751 into trunk Jun 6, 2022
@vinc vinc deleted the feature/lisp branch June 23, 2022 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant