Does anyone know of any tricks for making a program that writes programs, similar to the AECROM on the 41's?
Some secret function that converts alpha register to program lines?
As far as I can tell the AECROM edits the ram to make the program. Are there any functions like this?
I could obviously extend FREE42, but I would prefer to share my program with other users!
Any tricks for programs that write programs?
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: Any tricks for programs that write programs?
The short answer is no, there is no trick, programs can't create or modify programs in Free42.
I'd suggest that RPL is the platform of choice if you want to create programs that create programs, but since I'm in the middle of writing some big enhancements anyway... what kind of code were you thinking of writing that would use such a self-programming capability?
I'd suggest that RPL is the platform of choice if you want to create programs that create programs, but since I'm in the middle of writing some big enhancements anyway... what kind of code were you thinking of writing that would use such a self-programming capability?
Re: Any tricks for programs that write programs?
RPL certainly does this, it just feels so messy to me. The object flexibility and more command line style (no hand holding) interpreter make it super interesting for me to play with and study, but hard for me to remember and not screw up for every day use. I'm not afraid I'm going to accidentally save over my program with a single number in FREE42.
I was interested in writing a circuit simulator that produces a "compiled" program instead of relying on a variable and interpreter program every time I run it.
After that I started thinking I could write all kinds of onboard x -> FOCAL "compilers", dsp diagram, algebraic, forth, maybe basic or python?
This is not my use, but one of the crazy things I saw when I was researching whether this was possible was a user asking for a feature like this for use on neural nets. I couldn't completely gather what they were trying to do, but I imagine this would be helpful in the implementation of a genetic algorithm.
Regardless of what ends up in the official FREE42 I'm very grateful that it's open source easily readable c code . I've already done some cosmetic tweaks to my DM42PGM that I'm very satisfied with (restored FREE42 style screen display above XYZTA, and added separators to every 4 digits in hex and binary modes). Even imagining implementing what I'm asking for here would take a long while for me to figure out in 41 MCODE.
I was interested in writing a circuit simulator that produces a "compiled" program instead of relying on a variable and interpreter program every time I run it.
After that I started thinking I could write all kinds of onboard x -> FOCAL "compilers", dsp diagram, algebraic, forth, maybe basic or python?
This is not my use, but one of the crazy things I saw when I was researching whether this was possible was a user asking for a feature like this for use on neural nets. I couldn't completely gather what they were trying to do, but I imagine this would be helpful in the implementation of a genetic algorithm.
Regardless of what ends up in the official FREE42 I'm very grateful that it's open source easily readable c code . I've already done some cosmetic tweaks to my DM42PGM that I'm very satisfied with (restored FREE42 style screen display above XYZTA, and added separators to every 4 digits in hex and binary modes). Even imagining implementing what I'm asking for here would take a long while for me to figure out in 41 MCODE.
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: Any tricks for programs that write programs?
Well, the logic to translate text to programs already exists for program import, so most of the work for adding an "add program line" function has already been done. I'll have to think about the details.
I'm busy with other things at the moment but I'll revisit this topic when I have more time.
I'm busy with other things at the moment but I'll revisit this topic when I have more time.
Re: Any tricks for programs that write programs?
A little off topic but if you manage to write such a program I am interested.
I used this one long time ago before I had a computer with spice but its actually very user unfriendly.
viewtopic.php?f=2&t=2492&p=16133#p16133
A simple program to make a bode plot on the DM42 screen to quickly check for example a filter would be very useful and appreciated.
I used this one long time ago before I had a computer with spice but its actually very user unfriendly.
viewtopic.php?f=2&t=2492&p=16133#p16133
A simple program to make a bode plot on the DM42 screen to quickly check for example a filter would be very useful and appreciated.
HP41C (2x), HP41CV, HP41CX, DM41X β, DM41X, DM42, HP11C, HP48G, HP97
Re: Any tricks for programs that write programs?
Hello Thomas,
if you're going to add more functionality, I vote for the 'RTN+1' instruction, or RTNSKIP or whatnot, shamelessly stolen borrowed from the WP34.
LSTO was already an enormous step in enabling to write routines that mimic built-in ones, and RTN+1 will allow the creation of your own tests.
(advanced error handling is another topic, much more involved, and I'm not sure what is the right way)
Cheers, Werner
if you're going to add more functionality, I vote for the 'RTN+1' instruction, or RTNSKIP or whatnot, shamelessly stolen borrowed from the WP34.
LSTO was already an enormous step in enabling to write routines that mimic built-in ones, and RTN+1 will allow the creation of your own tests.
(advanced error handling is another topic, much more involved, and I'm not sure what is the right way)
Cheers, Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: Any tricks for programs that write programs?
Yep, that's on my list, too. Details still to be determined but the objective is to be able to create functions that behave exactly like built-in unary or binary operators including the ability to throw any error. The error thing takes care of conditionals since those are handled using special error codes (ERR_YES and ERR_NO).
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: Any tricks for programs that write programs?
As far as advanced error handling is concerned, I haven't really thought about it, but I suppose try/catch might be useful. Something like that does already exist but only for catching math errors in functions called by SOLVE.
Re: Any tricks for programs that write programs?
A little donation to https://sourceforge.net/projects/wp34s/ would be appropriate, won't it? (Yes, I know it's open source but one can ask...)
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Re: Any tricks for programs that write programs?
I would donate if I used it, but I don't..
Werner
Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L