Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Programs-as-procedures #149

Open
s5bug opened this issue Feb 11, 2020 · 2 comments
Open

Programs-as-procedures #149

s5bug opened this issue Feb 11, 2020 · 2 comments

Comments

@s5bug
Copy link

s5bug commented Feb 11, 2020

I want to make a library for BigInts/BigRationals/BigDecimals, and I need to perform certain mathematical operations with them. I was thinking that a way to implement "subroutines" would be to allow programs themselves to accept arguments and then be able to call those programs from ICE, for example:
SNBICMP:

[i]INBICMP(BIGINTA,BIGINTB)

[i] some code here
SOMEMATH+SOMEOTHERMATH->RESULT
[i] some code here

RESULT

SNBIADD:

[i]INBIADD(BIGINTA,BIGINTB)

[i] some code here
prgmSNBICMP(MYBIGINTA,MYBIGINTB)->CMPRESULT
If CMPRESULT=-1
    SOMEMATH+SOMEOTHERMATH->RESULT
Else
    SOMEFOO+SOMEOTHERFOO->RESULT
End
[i] some code here

RESULT

I have another idea on how to handle parameters that I'll post in a separate issue.

@AlvajoyAsante
Copy link

I strongly agree with this!! But it needs to be approached in a new way.

Instead of having a separate program that allows you to run new command. it should be in source code of the program like in C.

This makes it much more easier and less space consuming. not only will this help, this will put an end to people asking for new commands in ICE. 😄 "Just A step closer to ICE 3.0!"

@s5bug
Copy link
Author

s5bug commented Mar 29, 2020

I agree that that's also a good idea, but (with my very limited knowledge of how ICE works) it seems like it would be harder to implement.

I think if it does end up being handled that way, having imports would be a great idea. I'd be able to fit a math library into a single program that others can just import.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants