I know that "@ it is seen as comment in userRPL until end of line or the next @" but I did not try around the "@@" , is it 'just' persistent (that is, it can be seen on the calculator even after saving the program) or does it also expand on the next line until a closing "@@" is written? (that is, a multiline comment)

(bonus question: I do not remember seeing @@ in the official documentation for the 50g, is it another of my mistakes? )

I think you are now falling to two similar, but not identical language trap! That thread is pure newRPL discussion. NewRPL allows persistent comments with that format, while userRPL do not.

UserRPL is memory optimised in that regard, it cuts the comments out to preserve precious 128kB 2kB of memory(..or what the size were back in the first models using RPL).

but there are programs shared in the past with "@@" comments before newRPL was a thing.

And I learned the hard way that if I write:
@ this is a comment containing an @ in the middle

I get 'in' 'the' 'middle' on the stack.

So either a string of consecutive "@" is stripped, or "@@" for me would mean "start a comment and stop it immediately".

---
---

Aside from that, I am stuck in a relatively simple, although non standard, probabilistic problem because, well, I am still not good enough. Maybe someone here has an idea.

So I know (or I think I know) the formula to compute the expected value given a probability density (discrete or not).
I wanted to extend it to a new "dice".

The new dice is given by the following procedure:
I roll a dice 5 times in a row and I count the number of double ones that appears. That is , if I get the series 51161 I count 1, because there are only two ones appearing one after another.
If I get 51116 , I count 2 double ones. 5[11]16 and 51[11]6.
Of course something like 41356 has 0 double ones.

So given a dice that returns those "results", I started to make a list of useful combinations:
- 1 is were I expect a one
- x is where I expect 2 to 6
- y is where I expect 1 to 6 , it is an isolated one.

- only one double: 11xxy, 11xyx, x11xy, yx11x, yxx11, xyx11
probability for each series is 5*5*6/6^5 = 5^2/6^4
- two doubles: 111xy x111x yx111
probability 5*6/6^5 for the ones with y and 5^2/6^5 for the one with only x
- two doubles: 11x11
prob 5/6^5
- three doubles: 1111x x1111
prob 5/6^5
- four doubles: 11111
prob: 1/6^5

Now, since I'm not sure, I also did a program to count for me (see below) but I got:
10 "rolls of this dice" produce an average of 0.1
100 produces 0.11
1000 produces 0.108
10000 produces 0.1092

So it does seem that either my code or my formula above is wrong and I would say my formula is wrong. Any ideas?

edit: I ended up counting overlapping solutions. This guy helped, so my formula above is wrong when I count 11xxy and 11xyx (I count in one place 2-6 and then 1-6, therefore counting overlapping sequences)

My code is right though. Power of computer science for the ones that performs poorly with math.

Code:

avgDoubleOnes
@ the program seems to work and the idea of the "expected values of ones"
@ it seems reasonably working.
\<<
0 "sumDoubleOnes" DROP
-1 "lastRandom" DROP
-1 "newRandom" DROP

So since some weeks I have two hp 50g. The second is assigned to newRPL (as soon as I get grip with it through the desktop version). I decided today to make use of the second (I see possible double usage with standard rom, so I may get a third 50g just to be sure) so I have two 50g connected via usb to a win XP system.

The conn4x anyway, fails to detect the one that has the Xserver running. Is that normal?

I mean one 50g is visualizing the stack, the other the Xmodem Server , but conn4x just goes in loop (not always).

I would like to share a simple program for backup up a directory from home to the SD card.

The examples that I found on this site (search string site:hpmuseum.org sd backup) use heavily the stack - while I like named variables, especially for things that do not have to be fast - and do not use the sdlib included with the sdfiler.

Since I would have liked to see an example with a different layout and I did not find it, I share mine to raise the chances that a reader, for example me in the future, can have another idea.

The program is far from being general, it is just an example how a backup program can be done.

@Now we need to "roll" the data instead of 15062017 we want
@20170615 further we need to know that we dates with trailing
@zeroes the tailing zero is lost
IF
dateStr SIZE 8 \=/
THEN
'dateStr' 0 STO+
END

@'fileStr' dateStr STO+
@we cannot make this now, it cannot be done by the RPL filer

{HOME LIFEG} RCL
@put the object in memory
@(problem, when the memory does not have enough space to duplicate an object on the stack)

fileStr
3 \->TAG
STO @stores it on the sd

@rename the file on the SD using the library
fileStr
'fileStr' dateStr STO+
'fileStr' timeStr STO+
@longfilename with all those info
fileStr
SDMOVE

@now moving it in the right directory on the sd
"LIFEGDATABACKUP/B" dateStr + 'sdDirStr' STO
@sdDirStr SDMKDIR
@I need to handle the message, luckly the sdlib has also commands that
@are less strict
sdDirStr XMKDIR DROP
@creates the folder, if already existing, it does not fail.
@this is valid for multiple backups in a day

New little problem. I could not translate it in a list problem or a string processing problem therefore I post it in this thread that is more of a "catch all!" of my posts.

So there is a park with paths that can be seen as two squares, one in another. The internal square is constructed linking the middle points of the sides of the bigger square.

Alan and Bob start running in the same point (one middle point of the bigger square), only Alan keeps running on the bigger square and Bob on the internal one. Both have the same pace.

Question:

(a) assuming that they have unlimited capacity and they keep running forever, would they meet again in a place while running?

(b) (the question that I wanted to convert in list/string processing . Inspired by the recent posts of Gerald H about sequences) .
Assuming that the bigger square has vertex A, B, C, D and middle points E, F, G, H. IAlan and Bob start Both in the point E.

(09-09-2017 09:21 PM)pier4r Wrote: (a) assuming that they have unlimited capacity and they keep running forever, would they meet again in a place while running?

If Alan and Bob are mathematical points with no extension, then NO. Let's assume that the outer perimeter is 4. At all 4 midpoints, the distance covered by the outer runner will always be a rational number, and the distance covered by the inner runner will always be an irrational number, and hence never equal. The same logic applies regardless of the actual measurements.

If Alan and Bob are actual physical beings, then YES. If they never speed up, slow down, or veer off course, then bumping into each other is inevitable.

EDIT: The first paragraph is only true in an abstract, non-physical reality. In THIS universe, where everything seems to be made up of discrete quanta, I suppose even infinitely small points would eventually meet as they hop-scotch in contiguous, minuscule jumps (quantum leaps?), rather than moving smoothly and continuously, along their respective paths.

Sometimes this problems happens to me but finally I decode it. (I asked this already but I was not sure)

in userRPL if I write a comment like this:
@@test
in the program on the calculator 'test' is left .

Does that mean that@this is a comment until the end of the line
while@this is a comment until the next at@ while this are program statements
is until the second '@' ?

Does anyone know the proper behavior of how '@' is interpreted in all cases?

edit: I wonder when I will learn all the useful things on the 50g.
If you have the clock on the screen on the 50g, and the 50g is buy in a long computation, the clock won't be updated, giving you an idea for how long the system has been under load.

(09-24-2017 08:17 PM)pier4r Wrote: in userRPL if I write a comment like this:
@@test
in the program on the calculator 'test' is left .

Does that mean that@this is a comment until the end of the line
while@this is a comment until the next at@ while this are program statements
is until the second '@' ?

Does anyone know the proper behavior of how '@' is interpreted in all cases?

I only know that it starts ignoring at the first @, and stops ignoring after the next @, hence one reason why it's difficult to embed email addresses in a comment. This doesn't hold true for @ inside " or ' though, otherwise we'd be in all sorts of bother.

Others will be able to perhaps quote chapter/verse of applicable manuals.

(09-24-2017 08:17 PM)pier4r Wrote: Sometimes this problems happens to me but finally I decode it. (I asked this already but I was not sure)

in userRPL if I write a comment like this:
@@test
in the program on the calculator 'test' is left .

Does that mean that@this is a comment until the end of the line
while@this is a comment until the next at@ while this are program statements
is until the second '@' ?

Does anyone know the proper behavior of how '@' is interpreted in all cases?

From the AUR, p. 1-7:

Creating Programs on a Computer

It is convenient to create programs and other objects on a computer and then load them into the calculator.

If you are creating programs on a computer, you can include “comments” in the computer version of the program.

To include a comment in a program:

 Enclose the comment text between two @ characters. or
 Enclose the comment text between one @ character and the end of the line.

Whenever the calculator processes text entered in the command line — either from keyboard entry or transferred from a computer — it strips away the @ characters and the text they surround. However, @ characters are not affected if they’re inside a string.

As I (maybe) wrote I am using one of my 50g for a long term project named "life gamification". It is nothing else that collecting data from my point of view to evaluate how I perceived my days. I hope to write a little summary about it but the idea is more or less similar to the one mentioned in the following article: https://hackernoon.com/how-data-forced-m...df76064903

So far I collected 132 days of data, mostly in a directory made out of lists of reals (the total size of the directory is 11 KB on the calculator).

What I do after every collected day is a backup, with a rough script that sometimes requires two executions (see below) and is likely not safe after hundreds of executions due to name conflicts.

After several backups done with the method mentioned above, I browse the SD with the SD filer and I rename the backups done, plus I move them in a precise subfolder on the SD card.

I tried a soft reset (on + F3) but nothing. I may have to reinstall the library, I am not sure, but I was not expecting it.

Another bit: already some weeks ago, browsing with the SDfiler the content of the SD, I noticed that sometimes the SD filer was unable to report all the files in a folder 50+ of them (in particular the 'final' folder where I save the backups). Of , say 60 files, only 40 or 50 were listed.

Code:

bckSafe
@input: a string (with a date)
\<<
@11:18 10.08.2017
@safe backup as long as the backup using the SDLIB is not foolproof
@in input one puts a string with the time like "201708201116"
@then the STO command is going to save the LIFEG directory
@ (one executes the program within the directory)
@with the name LGB201708201116
@but while STO puts the entire name, only the first 8(?) letters
@are important for it. So often there is a conflict with
@existing files
@and we need a workaround.

I realized (maybe a little too late) that syntax highlighting helps even with concise languages, especially if I am used to use notepad++ .

Has anyone done a user defined language for userRPL for notepad++? I tried to search it via google but with no useful results.

Of course I decided to do my version since it is not difficult to do (I will include it in the next hp calc torrent ) but if someone has already an advanced work, it would be worth it, I think. Otherwise I will include keywords as soon as I encounter them, so not very quickly.

Some news about the userRPL user defined language for notepad++ (once again, if someone has a more complete version, please let me know).

It helps quite a bit

note the variables, have to be called lvname to be highlighted.

I hope to adjust it later for newRPL as well, since the newRPL desktop version can import text files. (I will include it also in the next torrent release, then you can give me feedback if you want)

I used it to test a solution to a micro problem that was since long time in my todo list.

One has processes that print on the console and locks. One should define the different processes in a way that they coordinate to print the wanted pattern even if the execution is randomly picking between the two processes.

So the basic is to have the process A and the process B (or 1 and 2) and to print 1,2,1,2,1,2 etc..

This gets more complicated if the pattern to produce is more complicated and there are more processes involved. For the moment, though, I am happy that I was able to find a way to test it on the hp 50g. Below the first working solution.

Of course, from real problem solving - especially if one is not that good like me - new questions arise so I am going to ask the following:

To "pack" a command to be executed I discovered the following method:
"statements" OBJ\->

instead of the more verbose
\<< statements \>>
(note that with a text expander like fastKeys on windows - aText on mac - one could produce \<< \>> quite quickly with shortcuts)

Do you know any other way?

In particular could be possible to pack and entire program in a string or block of some type and then execute it in "pieces" in a proper way?

Code:

lockSyncPatterns
\<<
@2017-10-17 working.

@ During my university time there was a course, about software engineering
@ (programming with agents) that exposed me to a couple of little problems
@ to solve mostly with locks or synch mechanisms related to Petri networks.
@ This exposure lasted maybe for a couple of hours but it was interesting.
@ For years I had this in the back of my mind but I never played with them
@ until I started to collect little problems to challenge my colleagues
@ in my current company (that has some hundreds of colleagues so it is worth
@ to try). In reality those little challenegs push me also to find little
@ problems and solve them.

@ In short those problems can be defined in this way.
@ One has a certain number of workers that print to the console their name.
@ Like the worker A print A, the worker B prints B and so on.
@ Then one has a certain type of locks and define a run rutine (in a while true)
@ and wants to achieve a certain pattern.

@ Now the problem can have way more difficult variants but the variant choose here is:
@ there is a default setup before the execution.
@ the code of workers is defined (note that it is easier if every worker has a different code)
@ then the workers are executed statement by statement in a random order
@ simulating context switch (that the 50g does not have)
@ the pattern nevertheless has to be achieved.

@I'd like to create a little engine that takes different workers,
@ "exploded" in single commands (would be great if I am able to write entire
@ programs in one block and then pick the single operations) that then gets
@evaluated

@note: from a string well defined, OBJ\-> executes the contents
@ and I wonder how many useful commands I still don't know that could help in this case.
@ the 50g library is amazing sometimes.

gpTestAddDOLIST
\<<
@as usual, the more on does, the more one may notice.
@damn me that I forget this or I don't appreciate it.

@So playing around on the 50g (first and foremost one needs to
@check part of the commands for an algorithm manually)
@I observed that ADD is not that fast. Surely
@multiplying a list by a scalar is quick, but adding two lists
@ (admittedly of 1000 elements) was not that quick.
@ So I wonder if Add is faster than DOlist or not.
@first list
100 RAND * IP 1000 NDUPN \->LIST
@second list
100 RAND * IP 1000 NDUPN \->LIST