Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MiniChallange: eliminate same TYPE in a list

17 views
Skip to first unread message

Veli-Pekka Nousiainen

unread,
Nov 30, 2004, 10:02:45 AM11/30/04
to
A minichallange for those who have *never before* taken part!
Write the SHORTEST routine that eliminates the same TYPE of element
2: list
1: element of which type is desired to be eliminated
RELEMTYPE
1: list
Note:
Recall 'RELMTYPE' program contenst to stack and do BYTES
to get the bytes of the program itself + checksum

Restrictions:
1) It must work correctly on an empty list too
2) The remaining elements have to be in their original order
3) No downloaded external libraries
4) UserRPL only, no SYSEVAL, LIBEVAL, FLASHEVAL
5) Be honest: don't ask for help from anyone!

Categories:
A) 48-series: 48S, 48SX, 48G, 48G+, 48GX
B) 49-series: 48gII, 49G, 49g+
C) 49-series using also manually attachable "secret" libraries
Contestants are urged to dig information using internet.

The challange ends at 12.12.2004 midnight greenw. time
(regardless of D.MY/M.DY setting)

James M. Prange is invited to be the Great Judge!
:-D
[VPN]


Lee

unread,
Nov 30, 2004, 11:38:06 AM11/30/04
to
Here's mine 164.5 bytes
\<< 0. \-> a b c
\<< a OBJ\-> DUP 'c' STO { } 'a' STO
WHILE 0. \=/
REPEAT DUP TYPE b SAME { DROP }
\<< 1. \->LIST a + 'a' STO
\>> IFTE 'c' DECR
END a
\>>
\>>
RDElm

"Veli-Pekka Nousiainen" <DROP...@THIS.welho.com> wrote in message
news:coi21a$ugm$1...@nyytiset.pp.htv.fi...

KJ

unread,
Nov 30, 2004, 10:45:31 PM11/30/04
to
Try this...

Checksum: # BDABh
Bytes: 120

%%HP: T(3)A(D)F(.);
\<< { } \-> a b
\<< OBJ\->
IF DUP 0 ==
THEN DROP
ELSE 1 SWAP
START DUP
TYPE a
IF ==
THEN DROP
ELSE 1
\->LIST 'b' STO+
END
NEXT
END b
\>>
\>>

Kevin J

remove_the_...@charZterZ.net


"Veli-Pekka Nousiainen" <DROP...@THIS.welho.com> wrote in message
news:coi21a$ugm$1...@nyytiset.pp.htv.fi...

James M. Prange

unread,
Dec 1, 2004, 3:52:24 AM12/1/04
to
Veli-Pekka Nousiainen wrote:
> A minichallange for those who have *never before* taken part!
> Write the SHORTEST routine that eliminates the same TYPE of element

"SHORTEST" meaning the smallest size (in bytes) returned by the
BYTES command on the program itself; not the size when you run
BYTES on the program's quoted name. Execution time doesn't matter
in this particular minichallenge.

> 2: list
> 1: element of which type is desired to be eliminated

Meaning that the level 1 argument should be a "real number"
representing the type to be eliminated, such as 0 for reals
numbers, 1 for complex numbers, 2 for characters strings, and so
on, not an example of the type to be eliminated. Right,
Veli-Pekka?

Argument checking isn't required. In other words, it doesn't
matter what the program does for arguments other than the above.

> RELEMTYPE
> 1: list
> Note:
> Recall 'RELMTYPE' program contenst to stack and do BYTES
> to get the bytes of the program itself + checksum

Please post the checksum and which model you used too, as an aid
to verifying that the program was downloaded or entered correctly.

To make it easier to read and download the program, I recommend
that you upload it to your PC using a Kermit ASCII transfer with
translation mode 3 (Xlat: ->255 in an input form), or use a Conn4x
"text" transfer with all translations enabled. For the 49 series,
have the calculator in exact mode while uploading. Copy and paste
the contents (including the transfer header) of the file to your
post. Of course, you can type in the program instead; if I don't
get the same checksum and size, then I'll ask for clarification.

For the 49 series, please be particularly careful of the
difference between real numbers (type 0) and exact integers (type
28); if you intend a real number, then include a decimal point.

> Restrictions:
> 1) It must work correctly on an empty list too

That is, if the level 2 argument is an empty list, then it must
return an empty list without causing an error.

> 2) The remaining elements have to be in their original order
> 3) No downloaded external libraries
> 4) UserRPL only, no SYSEVAL, LIBEVAL, FLASHEVAL
> 5) Be honest: don't ask for help from anyone!

But I'd encourage everyone to make use of whatever other resources
they can find, for example, the Google archive of this newsgroup.

6) Anything besides the arguments that was on the stack should
still be there when the program ends. For example, clearing the
stack is not acceptable, unless the program also restores it.
Similarly, it shouldn't KILL any suspended programs, or purge
or change any pre-existing variables.

7) Must not be mode or flag dependent. For example, it should work
in both exact and approximate modes, and with or without last
arguments saves (flag -55) enabled. It may change a flag while
running, but if it does, then it must restore the original
state.

> Categories:
> A) 48-series: 48S, 48SX, 48G, 48G+, 48GX

Considering the changes to list processing, let's split that into
two categories; one for the 48S and 48SX, and another for the 48G,
48GX, and 48G+.

> B) 49-series: 48gII, 49G, 49g+

I don't have a 48gII, but I expect that if it works on one of
these, then it ought to work on all of them. If it turns out
otherwise, let's just say that it must work on at least one of
them.

> C) 49-series using also manually attachable "secret" libraries
> Contestants are urged to dig information using internet.

Of course, it could happen that one entry wins in more than one
category.

> The challange ends at 12.12.2004 midnight greenw. time
> (regardless of D.MY/M.DY setting)

"Midnight" meaning when 2004-12-12 ends, in Universal Coordinated
Time. I'll go by the date and time in the post's
"NNTP-Posting-Date:" header; usually (but not necessarily) this is
within a few seconds after you send the post. If the date isn't
2004-12-12 or earlier after converting to UTC, then it's too late.

In case of a tie, whoever posts first wins.

Entries or questions should be in replies to this thread. Of
course, if you come up with something smaller, then feel free to
post another entry.

Let's try to keep this an enjoyable learning exercise. Give it
your best shot. I'd encourage you to post your smallest program
before the deadline, even if someone else has already posted a
smaller one; it could turn out that there's a flaw in an
apparently better entry. It's interesting to see how many
different ways to get the same result are possible.

In case of a dispute, the judge's final decision is final. But if
you notice a flaw that the judge hasn't noticed, point it out. The
judge reserves his right to change his decision.

Prize: Fame (at least in this thread).

> James M. Prange is invited to be the Great Judge!

Accepted. Thank you!

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 4:01:30 AM12/1/04
to
Lee wrote:
> Here's mine 164.5 bytes

Checksum on 48 series: # FC51h
Checksum on 49 series: # 87E5h

> \<< 0. \-> a b c
> \<< a OBJ\-> DUP 'c' STO { } 'a' STO
> WHILE 0. \=/
> REPEAT DUP TYPE b SAME { DROP }
> \<< 1. \->LIST a + 'a' STO
> \>> IFTE 'c' DECR
> END a
> \>>
> \>>

There are certainly some interesting techniques in there. I
haven't analysed how it works, but it does seem to work on the
48SX, 48GX, and 49g+.

Note that on the 49 series, the level 1 argument has to be a real
number; an exact integer won't work. I hadn't expected that to
come up, but it's okay.

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 4:06:26 AM12/1/04
to
KJ wrote:

> Try this...
>
> Checksum: # BDABh

On the 48 series, that is.

On the 49 series, the checksum is # 7F72h.


> Bytes: 120
>
> %%HP: T(3)A(D)F(.);
> \<< { } \-> a b
> \<< OBJ\->
> IF DUP 0 ==
> THEN DROP
> ELSE 1 SWAP
> START DUP
> TYPE a
> IF ==
> THEN DROP
> ELSE 1
> \->LIST 'b' STO+
> END
> NEXT
> END b
> \>>
> \>>

We have a new leading entry. It works on 48SX, 48GX, and 49g+.

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 4:16:30 AM12/1/04
to
I wrote:

> KJ wrote:
>
>
>>Try this...
>>
>>Checksum: # BDABh
>
>
> On the 48 series, that is.
>
> On the 49 series, the checksum is # 7F72h.

Oops! Since this was from a 48 series, I should consider the
numbers to be reals instead of exact integers, which makes the 49
series checksum # 12E8h. This doesn't change the size.

Endless

unread,
Dec 1, 2004, 6:27:05 AM12/1/04
to
Here's mine, 111 bytes, crc #35ACh on my hp48gx, I think it should work on
any hp48/49

\<< \-> T L
\<< {}
IF L SIZE DUP
THEN 1 SWAP
FOR I L I GET DUP TYPE T ==
::DROP
::+
IFTE
NEXT
ELSE DROP
END
\>>
\>>


"Veli-Pekka Nousiainen" <DROP...@THIS.welho.com> wrote in message
news:coi21a$ugm$1...@nyytiset.pp.htv.fi...

Endless

unread,
Dec 1, 2004, 6:53:18 AM12/1/04
to
Note, I realized I mixed the order in which args are given, so it takes
2: type
1: list

To make it take
2: list
1: type

You just need to replace \-> T L with \-> L T, size stays the same, crc
becomes #9347h on the hp48

"Endless" <news...@daydreamnation.org> wrote in message
news:41adaa87$0$30405$636a...@news.free.fr...

James M. Prange

unread,
Dec 1, 2004, 7:20:46 AM12/1/04
to
Endless wrote:
> Here's mine, 111 bytes, crc #35ACh on my hp48gx, I think it should work on
> any hp48/49
>
> \<< \-> T L
> \<< {}
> IF L SIZE DUP
> THEN 1 SWAP
> FOR I L I GET DUP TYPE T ==
> ::DROP
> ::+
> IFTE
> NEXT
> ELSE DROP
> END
> \>>
> \>>

Sorry, as posted, this doesn't quite work as required. Review what
the arguments are supposed to be. It should be a trivial fix.

> "Veli-Pekka Nousiainen" <DROP...@THIS.welho.com> wrote in message
> news:coi21a$ugm$1...@nyytiset.pp.htv.fi...
>
>>A minichallange for those who have *never before* taken part!
>>Write the SHORTEST routine that eliminates the same TYPE of element
>> 2: list
>> 1: element of which type is desired to be eliminated
>> RELEMTYPE
>> 1: list

<snip>

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 7:40:26 AM12/1/04
to
Endless wrote:
> Note, I realized I mixed the order in which args are given, so it takes
> 2: type
> 1: list
>
> To make it take
> 2: list
> 1: type
>
> You just need to replace \-> T L with \-> L T, size stays the same, crc
> becomes #9347h on the hp48

Exactly! So it becomes:


%%HP: T(3)A(D)F(.);
@ 48 series checksum: # 9347h
@ 49 series checksum: # A1E1h
@ Size: 111.
\<< \-> L T


\<< {}
IF L SIZE DUP
THEN 1 SWAP
FOR I L I GET DUP TYPE T ==
::DROP
::+
IFTE
NEXT
ELSE DROP
END
\>>
\>>


It works on the 48S, 48G, and 49 series.

--
Regards,
James

Khanh-Dang

unread,
Dec 1, 2004, 9:36:11 AM12/1/04
to
Veli-Pekka Nousiainen a écrit :

> Write the SHORTEST routine that eliminates the same TYPE of element
> 2: list
> 1: element of which type is desired to be eliminated
> RELEMTYPE
> 1: list

Here is my routine. It may work on hp48 and hp49. On my hp49g, BYTES
gives #4064h and 98.5 bytes :

'RELMTYPE' :
\<<
OVER SIZE

{
OVER HEAD

OVER TYPE OVER TYPE ==
SWAP 1. \->LIST 1. \->LIST
{ {} }
IFTE

ROT TAIL
ROT
RELMTYPE
+
}

:: DROP

IFTE
\>>

You may have noticed it is a recursive program, so that in order to
work, it has to be stored in the variable 'RELMTYPE'. Of course, the
program can be 7 bytes shorter if you call it 'R', or any other 1-char
name. So, in reality my program is 91.5 bytes-long.

Veli-Pekka Nousiainen

unread,
Dec 1, 2004, 11:32:40 AM12/1/04
to
"James M. Prange" <jmpr...@i-is.com> wrote in message
news:lDfrd.5837$qk....@fe39.usenetserver.com...

> Veli-Pekka Nousiainen wrote:
>> A minichallange for those who have *never before* taken part!
>> Write the SHORTEST routine that eliminates the same TYPE of element
>
> "SHORTEST" meaning the smallest size (in bytes) returned by the
> BYTES command on the program itself; not the size when you run
> BYTES on the program's quoted name. Execution time doesn't matter
> in this particular minichallenge.
>
>> 2: list
>> 1: element of which type is desired to be eliminated
>
> Meaning that the level 1 argument should be a "real number"
> representing the type to be eliminated, such as 0 for reals
> numbers, 1 for complex numbers, 2 for characters strings, and so
> on, not an example of the type to be eliminated. Right,
> Veli-Pekka?

Well actually I though that this could be an of object
instead of a type number, but since you are the
Great Judge
now, it's your call, 007
(one TYPE command [more/less] doesn't change the logic)
X


>> Categories:
>> A) 48-series: 48S, 48SX, 48G, 48G+, 48GX
>
> Considering the changes to list processing, let's split that into
> two categories; one for the 48S and 48SX, and another for the 48G,
> 48GX, and 48G+.

You are the Great Judge, James

> In case of a tie, whoever posts first wins.

You are the Great Judge, Monsieur Prange

> Let's try to keep this an enjoyable learning exercise. Give it
> your best shot. I'd encourage you to post your smallest program
> before the deadline, even if someone else has already posted a
> smaller one; it could turn out that there's a flaw in an
> apparently better entry. It's interesting to see how many
> different ways to get the same result are possible.

A *very* good point!!!

> In case of a dispute, the judge's final decision is final. But if
> you notice a flaw that the judge hasn't noticed, point it out. The
> judge reserves his right to change his decision.
>
> Prize: Fame (at least in this thread).
>
>> James M. Prange is invited to be the Great Judge!
>
> Accepted. Thank you!

You're welcome!
{ V P N }
6.
RELEMTYPE
{ }
6.
RELEMTYPE
{ }


Veli-Pekka Nousiainen

unread,
Dec 1, 2004, 11:37:16 AM12/1/04
to
"Khanh-Dang" <k...@fr.invalid> wrote in message
news:41add6db$0$30421$8fcf...@news.wanadoo.fr...
Ahhh!
I was waiting for this one.
The name is deliberately long in my original MiniChallange
to not to give this solution too much advantage
BUT
James is the Great Judge
and he may deside in this matter whatever he will.
[VPN]


Endless

unread,
Dec 1, 2004, 12:44:27 PM12/1/04
to
I came up with a much better method by going back to my orginal idea
(dosubs).
Down to 88.5 bytes, crc #D571h on the hp48.

\<<
\-> T
\<<
T 0 NOVAL IFTE SWAP + 1
\<<
DUP TYPE T == ::DROP IFT
\>>
DOSUBS TAIL
\>>
\>>


Lee

unread,
Dec 1, 2004, 1:05:49 PM12/1/04
to
Congrats.. Looks like it works well

"Endless" <news...@daydreamnation.org> wrote in message
news:41ae02f9$0$30476$636a...@news.free.fr...

James M. Prange

unread,
Dec 1, 2004, 1:10:11 PM12/1/04
to
Khanh-Dang wrote:
> Veli-Pekka Nousiainen a écrit :
>
>> Write the SHORTEST routine that eliminates the same TYPE of element
>> 2: list
>> 1: element of which type is desired to be eliminated
>> RELEMTYPE
>> 1: list
>
>
> Here is my routine. It may work on hp48 and hp49. On my hp49g, BYTES
> gives #4064h and 98.5 bytes :

Or # CADBh on a 48GX. It works on the 49 and 48G series, but
because of the HEAD and TAIL commands, not on the 48S series.

> 'RELMTYPE' :
> \<<
> OVER SIZE
>
> {
> OVER HEAD
>
> OVER TYPE OVER TYPE ==
> SWAP 1. \->LIST 1. \->LIST
> { {} }
> IFTE
>
> ROT TAIL
> ROT
> RELMTYPE
> +
> }
>
> :: DROP
>
> IFTE
> \>>
>
> You may have noticed it is a recursive program, so that in order to
> work, it has to be stored in the variable 'RELMTYPE'. Of course, the
> program can be 7 bytes shorter if you call it 'R', or any other 1-char
> name. So, in reality my program is 91.5 bytes-long.

I have to admit that a recursive program didn't occur to me, or
that the HEAD or TAIL commands would be used, for that matter.
It's very interesting.

Sorry, my decision is that the name must match the name in the
announcement. But I might be persuaded to change my mind based on
comments from others. Are there any trial lawyers out there who
care to argue the case one way or the other? Of course, arguments
from those who aren't eligible for this minichallenge will carry a
lot more weight; I think I know which way other participants would
argue.

Actually, my initial reaction was that the name should be
'RELEMTYPE', but I see that Veli-Pekka also used 'RELMTYPE' in the
announcement, so I'll allow at least that much.

--
Regards,
James

Endless

unread,
Dec 1, 2004, 1:12:31 PM12/1/04
to
And even shorter: 85.5 bytes, #8FB3h:

\<<
\-> T
\<<
T 0 TRUE IFTE SWAP + 1

Khanh-Dang

unread,
Dec 1, 2004, 2:21:22 PM12/1/04
to
James M. Prange a écrit :

> I have to admit that a recursive program didn't occur to me, or
> that the HEAD or TAIL commands would be used, for that matter.
> It's very interesting.

In fact, it is usual to program this way if you write a Caml
(http://caml.inria.fr/) program.

Using recursive programming with list a the normal way to program with
Caml. In fact, if you want to traverse the list, you /have to/ make a
recursive program, because you can only access the head of a list.
For example, the following Caml routine take a list of integers and add
1 to each of these integer. It is equivalent to the UserRPL program << 1
ADD >>.

let rec my_function list = match list with
| [] -> []
| head::tail -> (head + 1) :: my_function tail
;;

In fact, the program can be written shorter, but I write it this way in
order to let everybody easily understand it. Notice that "[" and "]" are
caml-list delimiters.

Lee

unread,
Dec 1, 2004, 2:26:55 PM12/1/04
to
\<< \-> t
\<< 1.
\<< DUP TYPE t == :: DROP IFT
\>> DOLIST
\>>
\>>
Same style 63 bytes #F1Eh

"Endless" <news...@daydreamnation.org> wrote in message
news:41ae098c$0$30427$636a...@news.free.fr...

James M. Prange

unread,
Dec 1, 2004, 2:32:21 PM12/1/04
to
Veli-Pekka Nousiainen wrote:
> "James M. Prange" <jmpr...@i-is.com> wrote in message
> news:lDfrd.5837$qk....@fe39.usenetserver.com...
>
>>Veli-Pekka Nousiainen wrote:
>>
>>>A minichallange for those who have *never before* taken part!
>>>Write the SHORTEST routine that eliminates the same TYPE of element
>>
>>"SHORTEST" meaning the smallest size (in bytes) returned by the
>>BYTES command on the program itself; not the size when you run
>>BYTES on the program's quoted name. Execution time doesn't matter
>>in this particular minichallenge.
>>
>>
>>> 2: list
>>> 1: element of which type is desired to be eliminated
>>
>>Meaning that the level 1 argument should be a "real number"
>>representing the type to be eliminated, such as 0 for reals
>>numbers, 1 for complex numbers, 2 for characters strings, and so
>>on, not an example of the type to be eliminated. Right,
>>Veli-Pekka?
>
>
> Well actually I though that this could be an of object
> instead of a type number, but since you are the
> Great Judge
> now, it's your call, 007
> (one TYPE command [more/less] doesn't change the logic

Okay, I'll allow the level 1 argument to be an example of the type
to be eliminated. For example, 0. for real numbers, (0.,0.) for
complex numbers, "A" for character strings, 0 for exact integers
on the 49 series, and so on. But the submission should state that
it's intended for the level 1 argument to be an example of the
type instead of a type number; don't make me guess about it.

Does anyone argue for making this a separate set of categories?

>>>Categories:
>>>A) 48-series: 48S, 48SX, 48G, 48G+, 48GX
>>
>>Considering the changes to list processing, let's split that into
>>two categories; one for the 48S and 48SX, and another for the 48G,
>>48GX, and 48G+.
>
>
> You are the Great Judge, James

Separate categories for the 48S series and 48G series. We've
already had one submission that works on the 48G but not the 48S.
I expect that there are at least a few 48S series still in use. So
far, I haven't noticed anything that I could accomplish on the
48GX that I couldn't also accomplish on the 48SX, although it may
well take more steps on the 48SX.

>>In case of a tie, whoever posts first wins.
>
>
> You are the Great Judge, Monsieur Prange

Hey, I thought that "Prange" was German, not French. On the other
hand, my niece's family tree shows a lot more French ancestors
than German ancestors, because they've been here a lot longer; so
long that a lot of the branches have grafted to each other. Maybe
it should be called a "network" instead of a "tree"? I guess they
were making sure that the best genes stayed in the family.

Anyway, I figure that the "first posted wins in case of a tie"
policy discourages participants from holding back until the last
minute, hoping to benefit from others' ideas while keeping their
own secret. The only reasonable alternative that occurs to me
would be for the submissions to be only size and checksum until
after the deadline, in which case not many ideas would be shared.

>>Let's try to keep this an enjoyable learning exercise. Give it
>>your best shot. I'd encourage you to post your smallest program
>>before the deadline, even if someone else has already posted a
>>smaller one; it could turn out that there's a flaw in an
>>apparently better entry. It's interesting to see how many
>>different ways to get the same result are possible.
>
>
> A *very* good point!!!

I'll add that it can be interesting how many things can go wrong
with what you'd thought was a logically flawless program.

>>In case of a dispute, the judge's final decision is final. But if
>>you notice a flaw that the judge hasn't noticed, point it out. The
>>judge reserves his right to change his decision.
>>
>>Prize: Fame (at least in this thread).
>>
>>

>>>James EM. Prange is invited to be the Great Judge!


>>
>>Accepted. Thank you!
>
>
> You're welcome!

Hmm, I had a hunch that this might involve some difficult
decisions.

--
Regards,
James

Lee

unread,
Dec 1, 2004, 2:33:22 PM12/1/04
to
Hold on this won"t handle empty lists properly. My mistake, I should test
more and post less.
"Lee" <RD...@PACBELL.NET> wrote in message
news:3Word.37081$6q2....@newssvr14.news.prodigy.com...

Endless

unread,
Dec 1, 2004, 2:56:36 PM12/1/04
to
It also doesn't return an empty list if all the elemnts got deleted. I know,
that was the first program I came up with. In my 85.5 bytes entry, the first
line is here only to ensure that dosubs operates on a non empty list and
returns a non empty list (that tails will make empty if it is supposed to
be).


"Lee" <RD...@PACBELL.NET> wrote in message

news:60prd.37086$6q2....@newssvr14.news.prodigy.com...

Lee

unread,
Dec 1, 2004, 3:01:46 PM12/1/04
to
Yep I noticed that after i posted. I could go smaller but it would be in
sysrpl
I conceede smallest to you Endless. (for now ;-) )
RDElm

"Endless" <news...@daydreamnation.org> wrote in message
news:41ae21f3$0$30403$636a...@news.free.fr...

Endless

unread,
Dec 1, 2004, 3:14:52 PM12/1/04
to
If the 48s has SUB working like I think it does, replace TAIL with:
DUP SIZE 2 SWAP SUB. I have no idea what the size and crc on the 48s become,
as I don't own one to test.

"Endless" <news...@daydreamnation.org> wrote in message
news:41ae098c$0$30427$636a...@news.free.fr...

Werner

unread,
Dec 1, 2004, 3:51:19 PM12/1/04
to
Khanh-Dang <k...@fr.invalid> wrote in message news:<41add6db$0$30421$8fcf...@news.wanadoo.fr>...
>
> Here is my routine. It may work on hp48 and hp49. On my hp49g, BYTES
> gives #4064h and 98.5 bytes :
>
> 'RELMTYPE' :
> (snip)

> You may have noticed it is a recursive program, so that in order to
> work, it has to be stored in the variable 'RELMTYPE'. Of course, the
> program can be 7 bytes shorter if you call it 'R', or any other 1-char
> name. So, in reality my program is 91.5 bytes-long.

BYTES does not include the program name.
Too bad I can't compete!

Werner

James M. Prange

unread,
Dec 1, 2004, 4:09:19 PM12/1/04
to
Endless wrote:
> I came up with a much better method by going back to my orginal idea
> (dosubs).
> Down to 88.5 bytes, crc #D571h on the hp48.

On the 48G series, that is. It doesn't work on the 48S because of
the TAIL command.

On the 49 series, the checksum is # 8EE2h, and the size is 85.5.

>
> \<<
> \-> T
> \<<
> T 0 NOVAL IFTE SWAP + 1
> \<<
> DUP TYPE T == ::DROP IFT
> \>>
> DOSUBS TAIL
> \>>
> \>>

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 4:47:05 PM12/1/04
to
Endless wrote:
> And even shorter: 85.5 bytes, #8FB3h:

On my 48GX, I come up with 90.5 bytes, # 860Dh.
On my 49G, I come up with 90.5 bytes, # 71CFh.

Note that TRUE compiles to a global name on my calculators, at
least in UserRPL. Maybe it's an external library command on your
calculator? Or is TRUE a typo?

Even so, it does work on the 48G and 49 series, but not on the 48S
because of the DOSUBS and TAIL commands.

> \<<
> \-> T
> \<<
> T 0 TRUE IFTE SWAP + 1
> \<<
> DUP TYPE T == ::DROP IFT
> \>>
> DOSUBS TAIL
> \>>
> \>>

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 5:01:10 PM12/1/04
to

True, but the point is that this is a recursive program with its
own name included in the body of the program, so the size of its
name does make a difference.

> Too bad I can't compete!

I know what you mean. But any time I enter a mini-challenge, I
figure that it's a safe bet that you're going to come up with
something better. I think that the idea is to give those new to
mini-challenges a chance, without discouraging right away with
techniques that would never have occurred to them at first.
They're doing a lot better than I expected.

--
Regards,
James

Endless

unread,
Dec 1, 2004, 5:14:19 PM12/1/04
to
Now that you mention it, I didn't think that TRUE and FALSE worked on my
48gx only because I'm using MK and are not built-in.
In that case, try this:

%%HP: T(3)A(D)F(.);
\<< \-> T
\<< T 0 <1d> IFTE SWAP + 1


\<< DUP TYPE T == ::DROP IFT
\>> DOSUBS TAIL
\>>
\>>

I posted a TAIL replacement for the 48s in this thread, but I can't test to
see if it works.


"James M. Prange" <jmpr...@i-is.com> wrote in message

news:EZqrd.266$nU....@fe61.usenetserver.com...

Veli-Pekka Nousiainen

unread,
Dec 1, 2004, 5:24:09 PM12/1/04
to
"Endless" <news...@daydreamnation.org> wrote in message
news:41ae423c$0$30431$636a...@news.free.fr...

> Now that you mention it, I didn't think that TRUE and FALSE worked on my
> 48gx only because I'm using MK and are not built-in.
> In that case, try this:
>
> %%HP: T(3)A(D)F(.);
> \<< \-> T
> \<< T 0 <1d> IFTE SWAP + 1
> \<< DUP TYPE T == ::DROP IFT
> \>> DOSUBS TAIL
> \>>
> \>>
Advice (based on "<1d>") :
You might consider removing all external libraries for the moment
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 1, 2004, 5:31:05 PM12/1/04
to
"James M. Prange" <jmpr...@i-is.com> wrote in message
news:k%ord.5872$qk....@fe39.usenetserver.com...
X

>> Well actually I though that this could be an of object
>> instead of a type number, but since you are the
>> Great Judge
>> now, it's your call, 007
>> (one TYPE command [more/less] doesn't change the logic
>
> Okay, I'll allow the level 1 argument to be an example of the type
> to be eliminated. For example, 0. for real numbers, (0.,0.) for
> complex numbers, "A" for character strings, 0 for exact integers
> on the 49 series, and so on. But the submission should state that
> it's intended for the level 1 argument to be an example of the
> type instead of a type number; don't make me guess about it.
>
> Does anyone argue for making this a separate set of categories?

I do: it should be either type number or object itself
I vote for type number since everyone is using it already
I just answered for your question
and suggested that a single command TYPE
does not change the logic: I object dividing the categories.
BUT
James = Great Judge

X


> Separate categories for the 48S series and 48G series.

sounds good

> Anyway, I figure that the "first posted wins in case of a tie"
> policy discourages participants from holding back until the last
> minute, hoping to benefit from others' ideas while keeping their

Absolutely. You're much better judge than I would be
I never though of this onr to occur :-D

> own secret. The only reasonable alternative that occurs to me
> would be for the submissions to be only size and checksum until
> after the deadline, in which case not many ideas would be shared.

People have already posted whole programs
AND have withdrawn casese where {} is not handled OK

>>>Let's try to keep this an enjoyable learning exercise. Give it
>>>your best shot. I'd encourage you to post your smallest program
>>>before the deadline, even if someone else has already posted a
>>>smaller one; it could turn out that there's a flaw in an
>>>apparently better entry. It's interesting to see how many
>>>different ways to get the same result are possible.
>>
>> A *very* good point!!!
>
> I'll add that it can be interesting how many things can go wrong
> with what you'd thought was a logically flawless program.

X
I'm just a fan of recursion
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 1, 2004, 6:02:18 PM12/1/04
to
"Veli-Pekka Nousiainen" <DROP...@THIS.welho.com> wrote in message
news:colgkv$ak9$1...@nyytiset.pp.htv.fi...

> "James M. Prange" <jmpr...@i-is.com> wrote in message
> news:k%ord.5872$qk....@fe39.usenetserver.com...
> X
>>> Well actually I though that this could be an of object
>>> instead of a type number, but since you are the
>>> Great Judge
>>> now, it's your call, 007
>>> (one TYPE command [more/less] doesn't change the logic
>>
>> Okay, I'll allow the level 1 argument to be an example of the type
>> to be eliminated. For example, 0. for real numbers, (0.,0.) for
>> complex numbers, "A" for character strings, 0 for exact integers
>> on the 49 series, and so on. But the submission should state that
>> it's intended for the level 1 argument to be an example of the
>> type instead of a type number; don't make me guess about it.
>>
>> Does anyone argue for making this a separate set of categories?
>
> I do: it should be either type number or object itself
> I vote for type number since everyone is using it already
> I just answered for your question
> and suggested that a single command TYPE
> does not change the logic: I object dividing the categories.
> BUT
> James = Great Judge
X
Actually I should withdraw my suggestion
to stick into type number input,
since I just noticed that my original program (first try)
used the element property to make it very short
Darn!
Well, I'm not participating anyway
)-:
[VPN]


James M. Prange

unread,
Dec 1, 2004, 7:07:16 PM12/1/04
to
Endless wrote:
> Now that you mention it, I didn't think that TRUE and FALSE worked on my
> 48gx only because I'm using MK and are not built-in.
> In that case, try this:
>
> %%HP: T(3)A(D)F(.);
> \<< \-> T
> \<< T 0 <1d> IFTE SWAP + 1
> \<< DUP TYPE T == ::DROP IFT
> \>> DOSUBS TAIL
> \>>
> \>>

No, <1d> causes an "Invalid Syntax" error. But don't give up; I can think of
lots of things that would accomplish the same purpose.

> I posted a TAIL replacement for the 48s in this thread, but I can't test to
> see if it works.

DUP SIZE 2 SWAP SUB

It works, returning an empty list for a 1-element or empty list, taking 12.5
bytes. TAIL takes 5.5 bytes.

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 7:47:05 PM12/1/04
to

Okay, but I guess that you don't use many 1-character names, except
locally.

I'm well aware of recursive programming, but I rarely use it,
accomplishing what I need with other methods. I don't have
anything particular against it. I just wish that I'd thought of
it, and especially of its effect on program size, before someone
actually used it in this mini-challenge.

As for HEAD and TAIL, those are still "new" commands to me; I
can't use them on my 48SX. They are indeed useful, but typically
they wouldn't be the first method that occurs to me.

With these calculators, there are usually several different ways
to accomplish any particular task. Which is best? Well, it depends
on your priorities. Smallest size, shortest execution time, least
memory use at runtime, not slowing garbage collection to a crawl,
and ease and speed of development and modification are all
reasonable goals, but often conflict, and typically it will be a
compromise.

Wolfgang is an exception; for him, shaving off a nibble seems to
be cause for celebration (as it is in this mini-challenge).

I suppose that execution speed would be a high priority for many
assembly languge programmers.

But note that in the ROM code, smallest size or more likely
fastest development seems to have had the higher priority. Often
it seems that the idea was to reuse code known to work correctly,
even if it was far from optimal (the "if it ain't broke, don't
'fix' it" philosophy, which isn't such a bad policy).

In the little project that I've been working on (occasionally),
there's a (rather large) speed critical section, but for the rest
of it, trying to keep the size down to something reasonable has a
higher priority.

Playing around at home, I can be fussy about size and speed and
"optimise" a program, but at work, other than returning the
correct results, development time has the highest priorty. If it
works, then it's good enough, even if I already see ways to make
it faster or smaller. Usually, for an ad hoc program, optimising
for speed would take more time than I could hope to regain in
reduced execution time, and the program will probably be purged
soon anyway, so size isn't an issue either.

--
Regards,
James

James M. Prange

unread,
Dec 1, 2004, 8:15:11 PM12/1/04
to
I wrote:
> Endless wrote:

<snip>

>>I posted a TAIL replacement for the 48s in this thread, but I can't test to
>>see if it works.
>
>
> DUP SIZE 2 SWAP SUB
>
> It works, returning an empty list for a 1-element or empty list, taking 12.5
> bytes. TAIL takes 5.5 bytes.

Ah, now I see (I think). Sorry, sometimes I'm a bit slow on the
uptake. You want me to substitute the above sequence into your
best program using TAIL to make a submission for the 48S, right?
The trouble with that is that the 48S doesn't have a built-in
DOSUBS command either.

The enhanced list processing, including the ADD, DOLIST, DOSUBS,
ENDSUB, HEAD, \GSLIST, \PILIST, \GDLIST, NSUB, REVLIST, SEQ, SORT,
STREAM, and TAIL commands, is new with the 48G series.

--
Regards,
James

Endless

unread,
Dec 2, 2004, 1:11:12 AM12/2/04
to
Ah, ok. Then no entry from me for the 48s for now.


"James M. Prange" <jmpr...@i-is.com> wrote in message

news:S0urd.5907$qk....@fe39.usenetserver.com...

werner.h...@gmail.com

unread,
Dec 2, 2004, 1:31:00 AM12/2/04
to

Endless wrote:
> Now that you mention it, I didn't think that TRUE and FALSE worked on
my
> 48gx only because I'm using MK and are not built-in.
> In that case, try this:
>
> %%HP: T(3)A(D)F(.);
> \<< \-> T
> \<< T 0 <1d> IFTE SWAP + 1
> \<< DUP TYPE T == ::DROP IFT
> \>> DOSUBS TAIL
> \>>
> \>>
>
> I posted a TAIL replacement for the 48s in this thread, but I can't
test to
> see if it works.
>

You are getting close..
I have essentially the same routine, but it is only 77.5 bytes.

Werner

Endless

unread,
Dec 2, 2004, 1:43:45 AM12/2/04
to
The purpose is to gain 3 bytes on the 48g, since it seems NOVAL takes only
2.5 bytes on the 49 series, as opposed to 5.5 bytes on the 48g.

I tried replacing <1d> with PI (the symbol), and it seems to work.


"James M. Prange" <jmpr...@i-is.com> wrote in message

news:31trd.273$nU....@fe61.usenetserver.com...

Fabian

unread,
Dec 2, 2004, 3:51:40 AM12/2/04
to
I don't want to post my solution. I was thinking along the same line as
Endless. I just couldn't come up with a good object to put at the
beginning of the list -- for me NOVAL is excellent!!!

Why do I prefer the DOSUBS solution to the ones which use a loop (or a
recursion)? Just try your programs on the following problem:

2: { { 1 } 2 'a' }
1: 0
REMELTYPE

should return
1: { { 1 } 'a' }

Fabian

P.S. Observe what + does if you want to append an element to a list which
is a list itself.

On Tue, 30 Nov 2004, Veli-Pekka Nousiainen wrote:

> A minichallange for those who have *never before* taken part!
> Write the SHORTEST routine that eliminates the same TYPE of element

> 2: list
> 1: element of which type is desired to be eliminated

> RELEMTYPE
> 1: list
> Note:
> Recall 'RELMTYPE' program contenst to stack and do BYTES
> to get the bytes of the program itself + checksum
>
> Restrictions:
> 1) It must work correctly on an empty list too
> 2) The remaining elements have to be in their original order
> 3) No downloaded external libraries
> 4) UserRPL only, no SYSEVAL, LIBEVAL, FLASHEVAL
> 5) Be honest: don't ask for help from anyone!


>
> Categories:
> A) 48-series: 48S, 48SX, 48G, 48G+, 48GX

> B) 49-series: 48gII, 49G, 49g+
> C) 49-series using also manually attachable "secret" libraries
> Contestants are urged to dig information using internet.
>
> The challange ends at 12.12.2004 midnight greenw. time
> (regardless of D.MY/M.DY setting)
>
> James M. Prange is invited to be the Great Judge!
> :-D
> [VPN]
>
>
>
------------ And now a word from our sponsor ------------------
Want to have instant messaging, and chat rooms, and discussion
groups for your local users or business, you need dbabble!
-- See http://netwinsite.com/sponsor/sponsor_dbabble.htm ----

Veli-Pekka Nousiainen

unread,
Dec 2, 2004, 4:39:15 AM12/2/04
to
"James M. Prange" <jmpr...@i-is.com> wrote in message
news:hOnrd.5866$qk....@fe39.usenetserver.com...
> Khanh-Dang wrote:
X

>> 'RELMTYPE' :
>> \<<
>> OVER SIZE
>>
>> {
>> OVER HEAD
>>
>> OVER TYPE OVER TYPE ==
>> SWAP 1. \->LIST 1. \->LIST
>> { {} }
>> IFTE
>>
>> ROT TAIL
>> ROT
>> RELMTYPE
>> +
>> }
>>
>> :: DROP
>>
>> IFTE
>> \>>
>>
>> You may have noticed it is a recursive program, so that in order to
>> work, it has to be stored in the variable 'RELMTYPE'. Of course, the
>> program can be 7 bytes shorter if you call it 'R', or any other 1-char
>> name. So, in reality my program is 91.5 bytes-long.
X
When I use recursion (and speed and/or size is not optimized)
I tend to use a local name for the subprogram that is recursive
this way I know that I can always change the Global name
if I need/want to (Except in my TEST subdirectories).

Using your program (and making it longer) as an example
'RELMTYPE' :
\<< -> l t \<< l t @ check for two arguments
\<< @ put the subrogram on the stack


OVER SIZE
{
OVER HEAD
OVER TYPE OVER TYPE ==
SWAP 1. \->LIST 1. \->LIST
{ {} }
IFTE
ROT TAIL
ROT

t EVAL @ RELMTYPE replaced by local name
+
}
:: DROP
IFTE
\>> -> t \<< t EVAL @ re-using the variable name
\>> \>> \>>
NO BYTES:
this is *not* an entry (boy, it's long), I'm not qualified
One may learn something new here
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 2, 2004, 5:30:43 AM12/2/04
to
"Endless" <news...@daydreamnation.org> wrote in message
news:41aeb9a0$0$19372$636a...@news.free.fr...

> The purpose is to gain 3 bytes on the 48g, since it seems NOVAL takes only
> 2.5 bytes on the 49 series, as opposed to 5.5 bytes on the 48g.
>
> I tried replacing <1d> with PI (the symbol), and it seems to work.
X
what is your flag -2 is Constant -> num
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 2, 2004, 5:28:45 AM12/2/04
to
"James M. Prange" <jmpr...@i-is.com> wrote in message
news:31trd.273$nU....@fe61.usenetserver.com...
X

> DUP SIZE 2 SWAP SUB
>
> It works, returning an empty list for a 1-element or empty list, taking
> 12.5
> bytes. TAIL takes 5.5 bytes.
X
2 OVER SIZE SUB
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 2, 2004, 5:29:26 AM12/2/04
to
"James M. Prange" <jmpr...@i-is.com> wrote in message
news:S0urd.5907$qk....@fe39.usenetserver.com...

> The enhanced list processing, including the ADD, DOLIST, DOSUBS,
> ENDSUB, HEAD, \GSLIST, \PILIST, \GDLIST, NSUB, REVLIST, SEQ, SORT,
> STREAM, and TAIL commands, is new with the 48G series.
X
Just to remaind you all: NOVAL, too
[VPN]


Fabian

unread,
Dec 2, 2004, 5:48:30 AM12/2/04
to
I decided to post my solution. It is not specially short:

\<<
SWAP OVER


0 NOVAL IFTE
SWAP +

DUP 1 ::TYPE DOSUBS
ROT - NOT
2
\<< ::DROP IFT \>>
DOLIST
TAIL
\>>

HP48GX: 89 bytes, checksum: # E1FFh

Lee

unread,
Dec 2, 2004, 11:16:54 AM12/2/04
to
I have to agree. Since I'm supposed to actually be working and the fact that
normally if I need a program to do a given task its (the programming) not a
priority, I'll tend to minimize programming time. My first submission only
took about 3 minutes to come up with. After about another 5 minutes I
nibbled it down to 121 bytes. And there it would stay, unless I needed a
speed increase. Then i would write it in sysrpl. So enough typing for me.
My second submission 121 bytes # D1AFh on a 49G+
\<< 0. \-> b c
\<< OBJ\-> DUP 'c' STO { } SWAP
WHILE 0. \=/
REPEAT SWAP DUP TYPE b SAME :: DROP { 1. \->LIST SWAP + } IFTE 'c' DECR
END
\>>
\>>


Endless

unread,
Dec 2, 2004, 7:56:16 AM12/2/04
to

<werner.h...@gmail.com> wrote in message
news:1101969060.1...@z14g2000cwz.googlegroups.com...

>
>
> You are getting close..
> I have essentially the same routine, but it is only 77.5 bytes.
>

I'm really curious to see that since I have to make sure that:
- the list for dosubs is not empty
- it returns a list, even empty
- it doesn't modify the rest of the stack

I thought about always adding 0 (for example) then catching the error TAIL
would throw, but that works only if the 3rd object in the stack cannot be
TAILed. Catching the dosubs error on an empty input list doesn't help with
the case where dosubs returns nothing.

> Werner
>


Endless

unread,
Dec 2, 2004, 7:39:54 AM12/2/04
to
There we go, I solved my saving 3 bytes problem, which was to generate a non
real (/integer on the 48g) in 2.5 bytes. On the 49, NOVAL was good enough,
but wasted 3 bytes on the 48g. I tried using boolean flags, but as JMP
noticed, it was specific of my calc, then system ints, but you can't enter
them easily, then PI, but it was dependant of the system flag. Then just a
minute ago, I thought about TICKS which returns a #num.

crc 96B7h on the 48gx, 85.5 bytes. Should work on the 49, if not, use NOVAL
instead of TICKS.

\<<
\-> T
\<<
T 0 TICKS IFTE SWAP + 1

Veli-Pekka Nousiainen

unread,
Dec 2, 2004, 8:16:00 AM12/2/04
to
"Endless" <news...@daydreamnation.org> wrote in message
news:41af0d17$0$22451$626a...@news.free.fr...

> There we go, I solved my saving 3 bytes problem, which was to generate a
> non
> real (/integer on the 48g) in 2.5 bytes. On the 49, NOVAL was good enough,
> but wasted 3 bytes on the 48g. I tried using boolean flags, but as JMP
> noticed, it was specific of my calc, then system ints, but you can't enter
> them easily, then PI, but it was dependant of the system flag. Then just a
> minute ago, I thought about TICKS which returns a #num.
>
> crc 96B7h on the 48gx, 85.5 bytes. Should work on the 49, if not, use
> NOVAL
> instead of TICKS.

TICKS is ok, what other solutions you _can_ find?
[VPN]

Khanh-Dang

unread,
Dec 2, 2004, 7:07:53 AM12/2/04
to
Fabian a écrit :

> 2: { { 1 } 2 'a' }
> 1: 0
> REMELTYPE
>
> should return
> 1: { { 1 } 'a' }
>

I am such an idiot : the recursive program I gave in a thread above
should be called KEPPELTYPE (I've misread the rules :-)

Here is the corrected version of my program (same lenght, as \=/ is 2.5
bytes, as well as ==)

Note that my version expect an object from level 1, and not a real
giving the type you want to remove.

\<<
OVER SIZE

{
OVER HEAD

OVER TYPE OVER TYPE \=/


SWAP 1. \->LIST 1. \->LIST
{ {} }
IFTE

ROT TAIL
ROT
RELMTYPE
+
}

:: DROP

IFTE
\>>


>

> P.S. Observe what + does if you want to append an element to a list which
> is a list itself.

You are right, and that's why I have to add a 1. \->LIST in my program,
wasting 5 bytes :)

It's also a shame in this particular case that << {} EVAL >> is
equivalent to a DROP. Indeed, the command IFTE always EVALs one of the
two first objects. This is the reason why I have to put { {} } instead
of {}, wasting another 5 bytes !

James M. Prange

unread,
Dec 2, 2004, 11:45:37 PM12/2/04
to
reth wrote:
> "James M. Prange" <jmpr...@i-is.com> wrote in message
> news:dYNrd.5996$qk....@fe39.usenetserver.com...

>
>>Endless wrote:
>>
>>>There we go, I solved my saving 3 bytes problem, which was to generate a
>
> non
>
>>>real (/integer on the 48g) in 2.5 bytes. On the 49, NOVAL was good
>
> enough,
>
>>>but wasted 3 bytes on the 48g. I tried using boolean flags, but as JMP
>>>noticed, it was specific of my calc, then system ints, but you can't
>
> enter
>
>>>them easily, then PI, but it was dependant of the system flag. Then just
>
> a
>
>>>minute ago, I thought about TICKS which returns a #num.
>>
>>TICKS does work, although it seems rather a kludge, but "elegance"
>>isn't a requirement.

>>
>>
>>>crc 96B7h on the 48gx, 85.5 bytes. Should work on the 49, if not, use
>
> NOVAL
>
>>>instead of TICKS.
>>
>>It works on the 49g+ as it is. BYTES returns # BC8Fh, 85.5. For
>>anyone trying to compile the program on a 49 series, note that the
>>0 and 1 in the program are real numbers, not exact integers,
>>because the source code was written for the 48G series
>>
>>Of course it doesn't work on the 48S/SX.
>>
>>
>>>\<<
>>> \-> T
>
>
> *** here T is the element, not the type ***

>
>
>>> \<<
>>> T 0 TICKS IFTE SWAP + 1
>>> \<<
>>> DUP TYPE T == ::DROP IFT
>>> \>>
>>> DOSUBS TAIL
>>> \>>
>>>\>>
>>
>>--
>>Regards,
>>James
>>
>
>
> so I can't see it working at all

???

I'm not sure what you're saying. The level 1 argument should be a
real number for the type of element to be eliminated. Optionally,
an alternative style can use an example of the type of element to
be eliminated, but that should be noted in the entry.

Note that for this mini-challenge, what the program does for
arguments other than a list in level 2 and a real (or example of a
type) in level 1 doesn't matter. In particular, it doesn't matter
what it does for a type 28 exact integer in level 1, except when
it's the style that's supposed to take an example of the type
there. To be sure, it's nice if it also works correctly with an
exact integer instead of a real in level 1, and gracefully errors
out with other wrong arguments, but those aren't requirements.

Any program that takes a type number could very easily be modified
to take a type example instead, just by inserting a TYPE command
at the very beginning of the program. Of course, that adds 2.5
bytes to the program size. If someone can manage it without adding
an extra 2.5 bytes, I'd like to see how.

It sure looks to me as if this entry ought to work, and trying it
out, I haven't noticed any cases where it doesn't. I'm not going
to publish an analysis of how it works; other participants can
figure it out for themselves, if they care to.

Since this was written for a 48 series, on the 49 series I compile
it in approximate mode. It would fail if the 0 in the program were
a type 28 exact integer instead of a type 0 real number.

If anyone has a problem getting one of these programs to work,
first check the results from the BYTES command to make sure that
it's compiled as intended. I encourage all entrants to include the
results from the BYTES command (on the program itself on level 1,
not the quoted program name) and which model that was from to help
verify that I (and anyone else who wants to try the program) can
verify that it's compiled as intended. If it works on more than
one series of calcultors, I'll publish the other checksum, and at
least where it's diifferent, the other size.

On a 49 series, if the program was written for a 49 series, then
use exact mode to compile it, but if it was written for a 48
series, then use approximate mode to compile it. Compiling reals
to zints or vice versa would probably be the most frequent error,
but certainly typos could occur if you type it in.

So far, all of the entries have been using Kermit translation mode
3, and I appreciate that, although I've had to insert the transfer
headers myself. I've been using "%%HP: T(3)A(D)F(.);" for the
header. If someone uses anything other than translation mode 3 and
"." for the fraction mark, I'll try to adjust for that, but I may
have to ask for clarification if it doesn't compile as expected on
my calculators.

If you're the first to notice that an entry doesn't work
correctly, tell us what circumstances it fails in; for example,
flag settings or particular arguments.

--
Regards,
James

James M. Prange

unread,
Dec 2, 2004, 6:55:33 PM12/2/04
to
Endless wrote:
> There we go, I solved my saving 3 bytes problem, which was to generate a non
> real (/integer on the 48g) in 2.5 bytes. On the 49, NOVAL was good enough,
> but wasted 3 bytes on the 48g. I tried using boolean flags, but as JMP
> noticed, it was specific of my calc, then system ints, but you can't enter
> them easily, then PI, but it was dependant of the system flag. Then just a
> minute ago, I thought about TICKS which returns a #num.

TICKS does work, although it seems rather a kludge, but "elegance"
isn't a requirement.

> crc 96B7h on the 48gx, 85.5 bytes. Should work on the 49, if not, use NOVAL
> instead of TICKS.

It works on the 49g+ as it is. BYTES returns # BC8Fh, 85.5. For


anyone trying to compile the program on a 49 series, note that the
0 and 1 in the program are real numbers, not exact integers,

because the source code was written for the 48G series.

Of course it doesn't work on the 48S/SX.

> \<<


> \-> T
> \<<
> T 0 TICKS IFTE SWAP + 1
> \<<
> DUP TYPE T == ::DROP IFT
> \>>
> DOSUBS TAIL
> \>>
> \>>

--
Regards,
James

Werner

unread,
Dec 3, 2004, 5:46:05 AM12/3/04
to
"Endless" <news...@daydreamnation.org> wrote in message news:<41b01164$0$1798$626a...@news.free.fr>...
> I guess that's the 77.5 bytes Werner was talking about (if you remove the
> TYPE command at the beginning).
> I didn't think using a temp var would use more space than dup, and really
> didn't think about DROPN. Well done.
>

That is it, indeed. Even if I use SAME instead of == and DOLIST instead of DOSUBS.

Werner

Endless

unread,
Dec 3, 2004, 2:10:17 AM12/3/04
to
I guess that's the 77.5 bytes Werner was talking about (if you remove the
TYPE command at the beginning).
I didn't think using a temp var would use more space than dup, and really
didn't think about DROPN. Well done.

"reth" <re...@nospam.com.at> wrote in message
news:41b0036a$1...@dnews.tpgi.com.au...
> Based on Endless' ;) - hp48g
>
> << TYPE DUP -> T


> << 0 TICKS IFTE SWAP + 1
> <<

> DUP TYPE T == DROPN
> >>
> DOSUBS TAIL
> >>
> >>
>
>


Veli-Pekka Nousiainen

unread,
Dec 3, 2004, 2:25:43 AM12/3/04
to
"reth" <re...@nospam.com.at> wrote in message
news:41af...@dnews.tpgi.com.au...
X

> Quoting VPN:
>
> "A minichallange for those who have *never before* taken part!
> Write the SHORTEST routine that eliminates the same TYPE of element
> 2: list
> 1: element of which type is desired to be eliminated
> RELEMTYPE
> 1: list
> "
> If I read properly the above in level 1 we should have the element itself
> and not what's left after TYPE command performed on it. I can see the
> point
> of that, used as a subroutine it should take any argument
X
That was my original intention
X
> I don't really get it if a program not working on the 48S counts for the
> 48
> category and VPN is kindly prompted to clarify that.
X
If you follow the thread back
you will notice that James M. Prange is the Great Judge
So now there are separate 48S/48G categories

Great Judge is kindly prompted to TakeOver
of these questions, too...
I only answered, giving my opinions, because I was addressed.
[VPN]


reth

unread,
Dec 3, 2004, 12:23:31 AM12/3/04
to

"James M. Prange" <jmpr...@i-is.com> wrote in message
news:acSrd.6039$qk....@fe39.usenetserver.com...

> >>>\<<
> >>> \-> T
> >
> >
> > *** here T is the element, not the type ***
> >
> >
> >>> \<<
> >>> T 0 TICKS IFTE SWAP + 1
> >>> \<<
> >>> DUP TYPE T == ::DROP IFT
> >>> \>>
> >>> DOSUBS TAIL
> >>> \>>
> >>>\>>
> >>

>


> I'm not sure what you're saying. The level 1 argument should be a

> real number for the type of element to be eliminated.> Regards,
> James
>

Quoting VPN:

"A minichallange for those who have *never before* taken part!
Write the SHORTEST routine that eliminates the same TYPE of element
2: list
1: element of which type is desired to be eliminated
RELEMTYPE
1: list
"
If I read properly the above in level 1 we should have the element itself
and not what's left after TYPE command performed on it. I can see the point
of that, used as a subroutine it should take any argument

What I'm saying for the above program is that it does not work on my HP48GX
if in level 1 of the stack there is anything but a real number.

***

I don't really get it if a program not working on the 48S counts for the 48
category and VPN is kindly prompted to clarify that.

here is my 106 byte version (48 series)

<< TYPE -> L T
<< { }
IFERR 1 L SIZE
FOR I L I GET DUP TYPE T ==
:: DROP
:: +
IFTE
NEXT
THEN DROP2
END
>>
>>

Regards,
Reth


reth

unread,
Dec 2, 2004, 9:45:32 PM12/2/04
to

"James M. Prange" <jmpr...@i-is.com> wrote in message
news:dYNrd.5996$qk....@fe39.usenetserver.com...

> Endless wrote:
> > There we go, I solved my saving 3 bytes problem, which was to generate a
non
> > real (/integer on the 48g) in 2.5 bytes. On the 49, NOVAL was good
enough,
> > but wasted 3 bytes on the 48g. I tried using boolean flags, but as JMP
> > noticed, it was specific of my calc, then system ints, but you can't
enter
> > them easily, then PI, but it was dependant of the system flag. Then just
a
> > minute ago, I thought about TICKS which returns a #num.
>
> TICKS does work, although it seems rather a kludge, but "elegance"
> isn't a requirement.
>
> > crc 96B7h on the 48gx, 85.5 bytes. Should work on the 49, if not, use
NOVAL
> > instead of TICKS.
>
> It works on the 49g+ as it is. BYTES returns # BC8Fh, 85.5. For
> anyone trying to compile the program on a 49 series, note that the
> 0 and 1 in the program are real numbers, not exact integers,
> because the source code was written for the 48G series
>
> Of course it doesn't work on the 48S/SX.
>
> > \<<
> > \-> T

*** here T is the element, not the type ***

> > \<<


> > T 0 TICKS IFTE SWAP + 1
> > \<<
> > DUP TYPE T == ::DROP IFT
> > \>>
> > DOSUBS TAIL
> > \>>
> > \>>
>
> --
> Regards,
> James
>

so I can't see it working at all

Regards


reth

unread,
Dec 3, 2004, 5:14:09 AM12/3/04
to

"James M. Prange" <jmpr...@i-is.com> wrote in message
news:3NVrd.3321$nU....@fe61.usenetserver.com...

> Sorry, if the list contain any "sublist" as an element, then
> that's always eliminated, so this doesn't work as required.
>
> For example:
>
> 2: { 1 "1" { 1 } }
> 1: 0
> RELEMTYPE
>
> returns:
>
> 1: { "1" }
>
> instead of:
>
> 1: { "1" { 1 } }
>
> Don't feel too bad; my program had the same flaw.
>
> --
> Regards,
> James
>
Sorry, James, you're right, what about:

%%HP: T(3)A(D)F(.);
\<< TYPE \-> L T


\<< { }
IFERR 1 L SIZE
FOR I L I GET

IF DUP TYPE
T ==
THEN DROP
ELSE
IF DUP
TYPE 5 ==
THEN 1
\->LIST
END +
END
NEXT
THEN DROP2
END
\>>
\>>

You're doing a great job, exactly what I like! My girlfriend recons it's all
bullshit, "how do you find this interesting..." :) Well I do

Best regards
Reth


James M. Prange

unread,
Dec 3, 2004, 3:49:45 AM12/3/04
to
reth wrote:
> "James M. Prange" <jmpr...@i-is.com> wrote in message
> news:acSrd.6039$qk....@fe39.usenetserver.com...
>
>
>>>>>\<<
>>>>> \-> T
>>>
>>>
>>>*** here T is the element, not the type ***
>>>
>>>
>>>
>>>>> \<<
>>>>> T 0 TICKS IFTE SWAP + 1
>>>>> \<<
>>>>> DUP TYPE T == ::DROP IFT
>>>>> \>>
>>>>> DOSUBS TAIL
>>>>> \>>
>>>>>\>>
>>>>
>
>>I'm not sure what you're saying. The level 1 argument should be a
>>real number for the type of element to be eliminated.> Regards,
>>James
>>
>
>
> Quoting VPN:
>
> "A minichallange for those who have *never before* taken part!
> Write the SHORTEST routine that eliminates the same TYPE of element
> 2: list
> 1: element of which type is desired to be eliminated
> RELEMTYPE
> 1: list
> "
> If I read properly the above in level 1 we should have the element itself
> and not what's left after TYPE command performed on it. I can see the point
> of that, used as a subroutine it should take any argument

Well, yes, it could be used that way, but then I'd have to have an
object of the type to be eliminated on the stack. Offhand, I'd
guess that I'd know which type I wanted to eliminate, and simply
supply the type as a real number on the stack. Either way has its
advantages.

> What I'm saying for the above program is that it does not work on my HP48GX
> if in level 1 of the stack there is anything but a real number.

I'm sorry for the misunderstanding.

Quoting myself, from when I accepted the "Great Judgeship":

>> 2: list
>> 1: element of which type is desired to be eliminated
>

> Meaning that the level 1 argument should be a "real number"
> representing the type to be eliminated, such as 0 for reals
> numbers, 1 for complex numbers, 2 for characters strings, and so
> on, not an example of the type to be eliminated. Right,
> Veli-Pekka?

I simply didn't quite understand Veli-Pekka's wording, using
"element" instead of "object", and in "clarifying" the rules, I
apparently ended up changing them from what he intended. I later
added in the option of using an object as an example of the type
to be eliminated instead of a real number.

As noted elsewhere, I expect that programs that use an object as
an example of the type to be eliminated will simply be 2.5 bytes
larger than programs that use a real number representing the
object type. But who knows? Maybe someone will surprise me.

> ***
>
> I don't really get it if a program not working on the 48S counts for the 48
> category and VPN is kindly prompted to clarify that.

That's easy. I split the 48 series category into two separate
categories; one for the 48SX and 48S, and another for the 48GX,
48G, and 48G+. As we've seen, there are very significant
differences in how these handle lists, and it's quite possible
that a program written for the 48G series won't work in the 48S
series. Requiring all 48 series entries to also work on the 48S
series would seem rather a burden to those (perhaps the majority
of 48 series users) who've never used a 48S series. On the other
hand, I expect that enough 48S series are still in use that they
should be included, and the users may not be familiar with how
lists are treated on the 48G series. Anyway, I thought it best to
have the two separate categories for the 48 series. There's also a
category for the 49G, 49g+, and 49gII. Currently, it looks to me
as if the differences between the 48S series and the 48G series
will turn out to be more important than the differences between
the 48 series and the 49 series, so I'm glad I did it that way.

In cases where an entry works in more than one category, I'm
treating it as an entry into all of the categories that it
actually works correctly in.

> here is my 106 byte version (48 series)
>
> << TYPE -> L T
> << { }
> IFERR 1 L SIZE
> FOR I L I GET DUP TYPE T ==
> :: DROP
> :: +
> IFTE
> NEXT
> THEN DROP2
> END
> >>

Which I think has the dubious distinction of being the first entry
to give me a "Syntax Error" even after I'd inserted the transfer
header. I took the liberty of modifying the source code as
follows:


%%HP: T(3)A(D)F(.);
@ 48S Checksum: # AC9Eh
@ 48S Size: 106
@ 48G Checksum: # AC9Eh
@ 48G Size: 106
@ 49 Checksum: # 3221h
@ 49 Size: 106.
\<< TYPE \-> L T
\<< { }
IFERR 1. L SIZE


FOR I L I GET
DUP TYPE T == :: DROP
:: + IFTE
NEXT
THEN DROP2
END

\>>
\>>

reth

unread,
Dec 3, 2004, 1:10:44 AM12/3/04
to
Based on Endless' ;) - hp48g

<< TYPE DUP -> T


<< 0 TICKS IFTE SWAP + 1
<<

DUP TYPE T == DROPN
>>
DOSUBS TAIL
>>
>>


Werner

unread,
Dec 3, 2004, 4:17:48 AM12/3/04
to
"Endless" <news...@daydreamnation.org> wrote in message news:<41af10ee$0$22457$626a...@news.free.fr>...

The logic of your program is the same as mine: add a sentinel up front
that will
always make it into the result list, and take its TAIL.
The devil is in the details..
For instance: a local variable reference is 4.5 bytes, and one of the
differences between your version and mine is that I avoid one, and
have a DUP (2.5 bytes) instead: 2 bytes less. Look carefully...
Another difference (that does not .. make a difference):
You have found TICKS as a 2.5 byte 'constant', congrats! I use C$ 0,
which will show up as a 2.5 byte empty string - but if you enter it as
"", it is 5 bytes. C$ <length> <chars> is used to enter strings that
contain the string delimiters themselves, and works on all 48/49
machines afaik.
There's only one other difference between your version and mine..

I can't post mine - I'm not allowed to compete!
Werner

James M. Prange

unread,
Dec 2, 2004, 8:57:45 PM12/2/04
to
Khanh-Dang wrote:
> Fabian a écrit :
>
>> 2: { { 1 } 2 'a' }
>> 1: 0
>> REMELTYPE
>>
>> should return
>> 1: { { 1 } 'a' }
>>
>
> I am such an idiot : the recursive program I gave in a thread above
> should be called KEPPELTYPE (I've misread the rules :-)

KEPPELTYPE?

> Here is the corrected version of my program (same lenght, as \=/ is 2.5
> bytes, as well as ==)

48S Checksum: N/A
48S Size: N/A
48G Checksum: # 7ABEh
48G Size: 98.5
49 Checksum: # EF2h
49 Size: 98.5

A reminder to anyone trying to run this program, it must be stored
with the name 'RELMTYPE' because it's recursive.

> Note that my version expect an object from level 1, and not a real
> giving the type you want to remove.

The first of this sort to be posted. I didn't really expect anyone
to do that, but it does work, and an example of the type to be
removed instead of the type number may be easier for some.


>
> \<<
> OVER SIZE
>
> {
> OVER HEAD
>
> OVER TYPE OVER TYPE \=/
> SWAP 1. \->LIST 1. \->LIST
> { {} }
> IFTE
>
> ROT TAIL
> ROT
> RELMTYPE
> +
> }
>
> :: DROP
>
> IFTE
> \>>

<snip>

--
Regards,
James

James M. Prange

unread,
Dec 2, 2004, 7:36:51 PM12/2/04
to
Lee wrote:
> I have to agree. Since I'm supposed to actually be working and the fact that
> normally if I need a program to do a given task its (the programming) not a
> priority, I'll tend to minimize programming time. My first submission only
> took about 3 minutes to come up with. After about another 5 minutes I
> nibbled it down to 121 bytes. And there it would stay, unless I needed a
> speed increase. Then i would write it in sysrpl. So enough typing for me.
> My second submission 121 bytes # D1AFh on a 49G+

It also works on the 48S and 48G series, 121 bytes # 628h.

> \<< 0. \-> b c
> \<< OBJ\-> DUP 'c' STO { } SWAP
> WHILE 0. \=/
> REPEAT SWAP DUP TYPE b SAME :: DROP { 1. \->LIST SWAP + } IFTE 'c' DECR
> END
> \>>
> \>>

--
Regards,
James

Veli-Pekka Nousiainen

unread,
Dec 3, 2004, 6:15:36 AM12/3/04
to
"Werner" <werner.h...@gmail.com> wrote in message
news:e4f1e026.04120...@posting.google.com...
X

> For instance: a local variable reference is 4.5 bytes, and one of the
> differences between your version and mine is that I avoid one, and
> have a DUP (2.5 bytes) instead: 2 bytes less. Look carefully...
> Another difference (that does not .. make a difference):
> You have found TICKS as a 2.5 byte 'constant', congrats! I use C$ 0,
> which will show up as a 2.5 byte empty string - but if you enter it as
> "", it is 5 bytes. C$ <length> <chars> is used to enter strings that
> contain the string delimiters themselves, and works on all 48/49
> machines afaik.
> There's only one other difference between your version and mine..
>
> I can't post mine - I'm not allowed to compete!

You can post to me, Werner
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 3, 2004, 2:55:43 AM12/3/04
to
"Endless" <news...@daydreamnation.org> wrote in message
news:41b01164$0$1798$626a...@news.free.fr...
This "Endless" minichallange looks like it's going to end soon...
(-;
I would still like to see more entries.
Maybe someone can make it faster?
Veli-Pekka
PS: This MiniChallange reveales also the "features" of the
DOSUBS
which is a command that differs from other commands.
I don't know the decisions behind it.
This has been discussed before in this news group,
but I still hate the behaviour )-:<
:-(
[VPN]


James M. Prange

unread,
Dec 3, 2004, 4:33:26 AM12/3/04
to

Modified for downloading to any of these calculators:

%%HP: T(3)A(D)F(.);
@ 48S Checksum: N/A
@ 48S Size: N/A
@ 48G Checksum: # 593Fh
@ 48G Size: 80
@ 49 Checksum: # 990Dh
@ 49 Size: 80.
\<< TYPE DUP \-> T
\<< 0. TICKS IFTE
SWAP + 1.
\<< DUP TYPE T ==
DROPN
\>> DOSUBS TAIL
\>>
\>>

Note that the level 1 argument for this program is an object
that's an example of the type to be eliminated, instead of the
real number for the type.

--
Regards,
James

James M. Prange

unread,
Dec 2, 2004, 8:08:27 PM12/2/04
to
Fabian wrote:
> I decided to post my solution. It is not specially short:
>
> \<<
> SWAP OVER
> 0 NOVAL IFTE
> SWAP +
> DUP 1 ::TYPE DOSUBS
> ROT - NOT
> 2
> \<< ::DROP IFT \>>
> DOLIST
> TAIL
> \>>
>
> HP48GX: 89 bytes, checksum: # E1FFh

Or on a 49 series, 86 bytes, checksum: # 2679h. Again note that
the numbers in the program are reals, not exact integers.

Of course, it doesn't work on the 48S/SX.

<snip>

--
Regards,
James

reth

unread,
Dec 3, 2004, 8:22:01 AM12/3/04
to

"James M. Prange" <jmpr...@i-is.com> wrote in message
news:7vZrd.102$AI...@fe39.usenetserver.com...
> Yes, it works, at least as far as I've noticed. But notice what
> happened to the size.
>
> @ 48S Checksum: # 152Bh
> @ 48S Size: 139
> @ 48G Checksum: # 152Bh
> @ 48G Size: 139
> @ 49 Checksum: # 8EF1h
> @ 49 Size: 139.
>
> This program takes an object as an example of the type to be
> eliminated.

>
> > You're doing a great job, exactly what I like!
>
> Thank you!

>
> > My girlfriend recons it's all
> > bullshit, "how do you find this interesting..."
>
> Some people just don't get it, do they? Usually, but not always,
> females; at least it seems that way to me. But I expect that your
> girlfriend can think of something that you'd find more
> interesting, at least for a while.
>
> > :) Well I do
>
> Same here, and no doubt everyone who reads this newsgroup
> regularly.
>
> --
> Regards,
> James
>
Whatever you do whatever (prog for HPcalc) you write there will be better
solution, that's what makes it the greatest calculator. Practically I don't
use it for work (except for + - etc) it's all onboard these days (surveying
instruments). But it's fun all over. Not to mention the memories. Strange, I
find computers boring despite of all their power. And the opposite for this
little gadget :)
Cheers


Fabian

unread,
Dec 3, 2004, 10:05:41 AM12/3/04
to
On Sat, 4 Dec 2004, reth wrote:

> really?
> try :
> { 1 "1" { 1 } }
> DUP
> <THE ABOVE PROGRAM>
> :)
>

You are right. One cannot eliminate lists from a list. Furthermore (and
this even more serious), it does not work on a empty list properly.

It seems that I didn't enough testing.
Fabian

Fabian

unread,
Dec 3, 2004, 8:28:35 AM12/3/04
to
Note:
This new program takes an example of an object of the type you want to
delete as an input!!! (as originally postet by VPN)

Input:


2: list
1: element of which type is desired to be eliminated

Program:
\<<
DUP TYPE SWAP ROT


+ DUP
1 ::TYPE
DOSUBS
ROT - NOT

2 \<< DROPN \>>
DOLIST
\>>
HP48GX: 69.5 bytes, checksum: # 3D35h

Veli-Pekka Nousiainen

unread,
Dec 3, 2004, 9:47:38 AM12/3/04
to
"reth" <re...@nospam.com.at> wrote in message
news:41b0...@dnews.tpgi.com.au...
X

> really?
> try :
> { 1 "1" { 1 } }
> DUP
> <THE ABOVE PROGRAM>
> :)
>
> otherwise very elegant and original solution
X
Well It's not exactly what I had
but close enough
Naturally I have not tested entries I read here
(I let James to worry about them)
just my own
we will see late what Werner has in his sleeves
[VPN]


Veli-Pekka Nousiainen

unread,
Dec 3, 2004, 9:03:48 AM12/3/04
to
"Fabian" <NOSPAM_...@yahoo.de> wrote in message
news:Pine.LNX.4.58L.0...@ptah.ethz.ch...

> Note:
> This new program takes an example of an object of the type you want to
> delete as an input!!! (as originally postet by VPN)
>
> Input:
> 2: list
> 1: element of which type is desired to be eliminated
>
> Program:
> \<<
> DUP TYPE SWAP ROT
> + DUP
> 1 ::TYPE
> DOSUBS
> ROT - NOT
> 2 \<< DROPN \>>
> DOLIST
> \>>
> HP48GX: 69.5 bytes, checksum: # 3D35h
X
This is what I originally wanted to see...
:-D
[VPN]


James M. Prange

unread,
Dec 3, 2004, 8:03:39 AM12/3/04
to

Yes, it works, at least as far as I've noticed. But notice what
happened to the size.

@ 48S Checksum: # 152Bh
@ 48S Size: 139
@ 48G Checksum: # 152Bh
@ 48G Size: 139
@ 49 Checksum: # 8EF1h
@ 49 Size: 139.

This program takes an object as an example of the type to be
eliminated.

> You're doing a great job, exactly what I like!

Thank you!

> My girlfriend recons it's all
> bullshit, "how do you find this interesting..."

Some people just don't get it, do they? Usually, but not always,

reth

unread,
Dec 3, 2004, 9:39:49 AM12/3/04
to

"Veli-Pekka Nousiainen" <DROP...@THIS.welho.com> wrote in message
news:coprlq$ot4$1...@nyytiset.pp.htv.fi...
really?
try :
{ 1 "1" { 1 } }
DUP
<THE ABOVE PROGRAM>
:)

otherwise very elegant and original solution

cheers
reth


James M. Prange

unread,
Dec 3, 2004, 3:27:15 PM12/3/04
to
Endless wrote:
> I guess that's the 77.5 bytes Werner was talking about (if you remove the
> TYPE command at the beginning).
> I didn't think using a temp var would use more space than dup,

Indeed it does, and I expect that in most cases, it's slower than
keeping everything that you still need right on the stack. But
local variables often make program development easier, and in some
cases, I haven't found a way to avoid using them to accomplish
what I want.

Actually, I was rather surprised that so many entries were using
local variables. I've sometimes been sorely tempted to give hints,
but that may well give some participants more help than others, so
I've been trying to avoid it. A judge is supposed to be impartial,
right?

> and really
> didn't think about DROPN. Well done.

I've noticed that participants seem to be borrowing ideas from
each other, which is fine with me. That way, you make faster
progress toward the best possible program, and we're learning new
things. I'm glad that nobody seems to be expressing hard feelings
when an idea is borrowed from him.

> "reth" <re...@nospam.com.at> wrote in message
> news:41b0036a$1...@dnews.tpgi.com.au...
>
>>Based on Endless' ;) - hp48g
>>
>><< TYPE DUP -> T
>> << 0 TICKS IFTE SWAP + 1
>> <<
>> DUP TYPE T == DROPN
>> >>
>> DOSUBS TAIL
>> >>

--
Regards,
James

reth

unread,
Dec 3, 2004, 8:10:27 PM12/3/04
to

"James M. Prange" <jmpr...@i-is.com> wrote in message
news:2%3sd.8$yY...@fe39.usenetserver.com...

I certainly take no credit - it's all Endless' idea and the DROPN trick I
learnt from Werner!

Cheers
Reth


Tony Hutchins

unread,
Dec 4, 2004, 6:15:49 PM12/4/04
to
-=[ Sun, 5.12.04 12:02 p.m. +1300 (NZDT) ]=-

Hi James M. Prange ! <jmpr...@i-is.com>

1 day 02h35m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :

> Actually, I was rather surprised that so many entries were
> using local variables.

Hint taken :-)
I had to have a go at this, having never been involved in an
official challenge where size matters. Here is a 100 byter for
my old HP48SX. CRC #3137h.

%%HP: T(3)A(R)F(.);
\<< \-> T
\<< OBJ\-> { } SWAP
IF DUP
THEN 1 SWAP
START SWAP T OVER TYPE SAME :: DROP { 1 \->LIST SWAP + } IFTE
NEXT
ELSE DROP
END
\>>
\>>

It turns out to be merely a variant of Lee's program.
Disqualification happily accepted for any reason :-)

--
Tony Hutchins
New Zealand

Tony Hutchins

unread,
Dec 4, 2004, 6:48:27 PM12/4/04
to
-=[ Sun, 5.12.04 12:40 p.m. +1300 (NZDT) ]=-

25m ago, on Sun, 5.12.04 at 12:15 p.m. +1300 (NZDT), I wrote
in message ID <1080379...@news.individual.net> :



> > Actually, I was rather surprised that so many entries were
> > using local variables.
>
> Hint taken :-)

Oops I forgot to say I tried it on the 48SX without local
variables and got the BYTES down to 103.5 - but using just one
local variable made stack manipulation much easier and the
BYTES reduced to 100, and the size of the source text file
reduced even more :-)

Tony Hutchins

unread,
Dec 4, 2004, 7:49:29 PM12/4/04
to
-=[ Sun, 5.12.04 1:34 p.m. +1300 (NZDT) ]=-

01h18m ago, on Sun, 5.12.04 at 12:15 p.m. +1300 (NZDT), I wrote
in message ID <1080379...@news.individual.net> :
[...]


> It turns out to be merely a variant of Lee's program.
> Disqualification happily accepted for any reason :-)

Actually, and I'm really plagiarizing now<G>, using Lee's
WHILE... REPEAT instead of my START.. shaves off another 5
bytes. This 48S version is 95 bytes.

%%HP: T(3)A(R)F(.);
\<< \-> T
\<< OBJ\-> { } SWAP

WHILE DUP
REPEAT 1 - ROT T OVER TYPE SAME
:: DROP { 1 \->LIST ROT + SWAP } IFTE
END DROP
\>>
\>>

James M. Prange

unread,
Dec 4, 2004, 9:16:13 PM12/4/04
to
I wrote:

On second thought, notice what happens if you have flag -55 set
(No last args), and you try eliminating elements from an empty
list. So this one doesn't qualify after all.

My apologies for not noticing sooner. I had such cases
specifically in mind when I wrote the rules, and was thinking that
I'd have to watch for IFERR structures as a "red flag", but this
one slipped by for a while.

Someone mentioned IFERR, and I thought, "I hope he doesn't try
going there!"

Big hint to all: If you use an IFERR structure, you may well have
to add code, either to save the flag state, force flag -55, and
restore it, or else to detect the flag -55 state and act
appropriately for it.

Of course, such techniques aren't prohibited, and if you can get
the program smaller using an IFERR structure and still meet the
requirements, then so be it. Personally, I don't think I'd start
down that path when the goal is the smallest size and I can avoid
doing things differently depending on the flag states.

--
Regards,
James

James M. Prange

unread,
Dec 4, 2004, 9:39:13 PM12/4/04
to
I wrote:
> Veli-Pekka Nousiainen wrote:

<snip>

>>The challange ends at 12.12.2004 midnight greenw. time
>>(regardless of D.MY/M.DY setting)
>
>
> "Midnight" meaning when 2004-12-12 ends, in Universal Coordinated
> Time. I'll go by the date and time in the post's
> "NNTP-Posting-Date:" header; usually (but not necessarily) this is
> within a few seconds after you send the post. If the date isn't
> 2004-12-12 or earlier after converting to UTC, then it's too late.
>
> In case of a tie, whoever posts first wins.

But I was surprised to find that some posts don't have an
"NNTP-Posting-Date:" header. Oh well, it probably won't be an
issue, but there are other headers that have the date and time. I
specifically don't want to use the "Date:" header, because with
most newsreaders, I can change that simply by changing the date or
time on my PC. Not that anyone on this newsgroup would cheat, but
just trying to make sure.

<snip>

--
Regards,
James

Virgil

unread,
Dec 5, 2004, 2:45:14 AM12/5/04
to
Has anyone bettered 77.5 bytes for the 49+?

Checksum # 37D4h or # 14295d

If given an empty or a list all of which are to be eliminated it
correctly returns an empty, and has passed all the other tests I can
think of right now.

Tony Hutchins

unread,
Dec 5, 2004, 3:16:14 AM12/5/04
to
-=[ Sun, 5.12.04 8:51 p.m. +1300 (NZDT) ]=-

Hi James M. Prange ! <jmpr...@i-is.com>

1 day 11h24m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :

[...]


> I'm glad that nobody seems to be expressing hard feelings
> when an idea is borrowed from him.
>
> > "reth" <re...@nospam.com.at> wrote in message
> > news:41b0036a$1...@dnews.tpgi.com.au...
> >
> >>Based on Endless' ;) - hp48g
> >>
> >><< TYPE DUP -> T
> >> << 0 TICKS IFTE SWAP + 1
> >> <<
> >> DUP TYPE T == DROPN
> >> >>
> >> DOSUBS TAIL
> >> >>

Following Endless and Reth I had to try transposing this 80
byter to no local variable usage. This appears to be
equivalent, but 73 bytes, for the 49g+:

\<< TYPE SWAP 1
\<< DUP TYPE PICK3 == DROPN \>>
DOLIST
DUP IF TYPE 5 \=/ THEN {} END
NIP
\>>

For the 48G it would be 78 bytes (using 3 PICK and SWAP DROP
instead of PICK3 and NIP).

Strange how {} doesn't register in IFT.
<< 1. {} IFT >> EVAL just wipes itself out, but
<< IF 1. THEN {} END>> EVAL leaves {} on level 1.

--
Tony Hutchins
New Zealand

#232 Nothing in the world can take the place of
persistence. Calvin Coolidge

James M. Prange

unread,
Dec 5, 2004, 3:54:06 AM12/5/04
to
Tony Hutchins wrote:

> -=[ Sun, 5.12.04 12:02 p.m. +1300 (NZDT) ]=-
>
> Hi James M. Prange ! <jmpr...@i-is.com>
>
> 1 day 02h35m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
> in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :
>
>
>>Actually, I was rather surprised that so many entries were
>>using local variables.
>
>
> Hint taken :-)
> I had to have a go at this, having never been involved in an
> official challenge where size matters.

But you have entered a mini-challenge before right? Based on that
I'm disqualifying you. Sorry, it was a tough decision to make.

But I will check your programs.

--
Regards,
James

Tony Hutchins

unread,
Dec 5, 2004, 4:21:00 AM12/5/04
to
-=[ Sun, 5.12.04 9:40 p.m. +1300 (NZDT) ]=-

Hi Virgil ! <ITSnetNOTcom#vir...@COMCAST.com>

54m ago, on Sun, 5.12.04 at 00:45 a.m. -0700, you wrote
in message ID <ITSnetNOTcom#virgil-099439....@comcast.dca.giganews.com> :

> Has anyone bettered 77.5 bytes for the 49+?

Without the initial TYPE this is 70.5 bytes

\<< TYPE SWAP 1
\<< DUP TYPE PICK3 == DROPN \>>
DOLIST
DUP IF TYPE 5 \=/ THEN {} END
NIP
\>>

Without the initial TYPE one must also allow the input (which
then remains unchanged & needs to be NIPped at the end ) to be
an integer (eg 8) or a real (eg 8.) so I test against 5
(string) at the end.

I also wrote:

> Strange how {} doesn't register in IFT.
> << 1. {} IFT >> EVAL just wipes itself out, but
> << IF 1. THEN {} END>> EVAL leaves {} on level 1.

Ahha I see the IFT needs {{}}, so loses the byte advantage in
this case.

I'm sure the above can be shrunk. Let's target 50 bytes :-)

Following Endless & Reth and Werner more closely, this is down
to 66 bytes without the initial TYPE:

\<< TYPE DUP 0 TICKS IFTE ROT + 1


\<< DUP TYPE PICK3 == DROPN \>>

DOSUBS TAIL NIP
\>>

16 bytes to go :-)

*If* DOLIST/DOSUBS did the expected and actually produced an
explicit *something* for the null result - a {} would be quite
nice for example<G>, then we would hit 50.5 or 48 bytes
without the initial TYPE - i.e.
<< TYPE SWAP 1 << DUP TYPE PICK3 == DROPN >> DOLIST NIP >>
If we leave off the final NIP this does work without run-time
error but we need to carefully interpret the output<G> - so 50
is a tantalising target.

James M. Prange

unread,
Dec 5, 2004, 4:34:42 AM12/5/04
to
Tony Hutchins wrote:
> -=[ Sun, 5.12.04 12:02 p.m. +1300 (NZDT) ]=-
>
> Hi James M. Prange ! <jmpr...@i-is.com>
>
> 1 day 02h35m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
> in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :
>
>
>>Actually, I was rather surprised that so many entries were
>>using local variables.
>
>
> Hint taken :-)
> I had to have a go at this, having never been involved in an
> official challenge where size matters. Here is a 100 byter for
> my old HP48SX. CRC #3137h.

@ 48S Checksum: # 3137h
@ 48S Size: 100
@ 48G Checksum: # 3137h
@ 48G Size: 100
@ 49 Checksum: # B316h
@ 49 Size: 100.

Note: Download to 49 series in approximate mode.

It works in all categories, but as noted elsewhere, I disqualified
Tony.

> %%HP: T(3)A(R)F(.);
> \<< \-> T
> \<< OBJ\-> { } SWAP
> IF DUP
> THEN 1 SWAP
> START SWAP T OVER TYPE SAME :: DROP { 1 \->LIST SWAP + } IFTE
> NEXT
> ELSE DROP
> END
> \>>
> \>>
>
> It turns out to be merely a variant of Lee's program.
> Disqualification happily accepted for any reason :-)

--
Regards,
James

Tony Hutchins

unread,
Dec 5, 2004, 4:42:04 AM12/5/04
to
-=[ Sun, 5.12.04 10:32 p.m. +1300 (NZDT) ]=-

Hi James

38m ago, on Sun, 5.12.04 at 03:54 a.m. -0500, you wrote
in message ID <s1Asd.191$jb3...@fe61.usenetserver.com> :
[...]


> > I had to have a go at this, having never been involved in an
> > official challenge where size matters.
>
> But you have entered a mini-challenge before right? Based on
> that I'm disqualifying you. Sorry, it was a tough decision
> to make.

Fair enough. Sorry to put you on the spot!

Cheers,
Tony

James M. Prange

unread,
Dec 5, 2004, 4:48:37 AM12/5/04
to
Virgil wrote:
> Has anyone bettered 77.5 bytes for the 49+?

Well, read the thread.

I think I'll end up making a table to see which programs were
which size in each category.

> Checksum # 37D4h or # 14295d
>
> If given an empty or a list all of which are to be eliminated it
> correctly returns an empty, and has passed all the other tests I can
> think of right now.

Before you post an entry, have you ever entered a mini-challenge
before?

--
Regards,
James

James M. Prange

unread,
Dec 5, 2004, 6:43:39 AM12/5/04
to
Tony Hutchins wrote:
> -=[ Sun, 5.12.04 1:34 p.m. +1300 (NZDT) ]=-
>
> 01h18m ago, on Sun, 5.12.04 at 12:15 p.m. +1300 (NZDT), I wrote
> in message ID <1080379...@news.individual.net> :
> [...]
>
>>It turns out to be merely a variant of Lee's program.
>>Disqualification happily accepted for any reason :-)
>
>
> Actually, and I'm really plagiarizing now<G>, using Lee's
> WHILE... REPEAT instead of my START.. shaves off another 5
> bytes. This 48S version is 95 bytes.

@ 48S Checksum: # 7B9h
@ 48S Size: 95
@ 48G Checksum: # 7B9h
@ 48G Size: 95
@ 49 Checksum: # 6D37h
@ 49 Size: 95.

Download to 49 series in approximate mode.

Works in all categories, but as noted before, I disqualified Tony.

> %%HP: T(3)A(R)F(.);
> \<< \-> T
> \<< OBJ\-> { } SWAP
> WHILE DUP
> REPEAT 1 - ROT T OVER TYPE SAME
> :: DROP { 1 \->LIST ROT + SWAP } IFTE
> END DROP
> \>>
> \>>

--
Regards,
James

Endless

unread,
Dec 5, 2004, 7:45:49 AM12/5/04
to

"Tony Hutchins" <jus...@csi.com> wrote in message
news:1146490...@news.individual.net...

> -=[ Sun, 5.12.04 9:40 p.m. +1300 (NZDT) ]=-
>
> Hi Virgil ! <ITSnetNOTcom#vir...@COMCAST.com>
>
> 54m ago, on Sun, 5.12.04 at 00:45 a.m. -0700, you wrote
> in message ID
<ITSnetNOTcom#virgil-099439....@comcast.dca.giganews.com> :
>
> > Has anyone bettered 77.5 bytes for the 49+?
>
> Without the initial TYPE this is 70.5 bytes
>
> \<< TYPE SWAP 1
> \<< DUP TYPE PICK3 == DROPN \>>
> DOLIST
> DUP IF TYPE 5 \=/ THEN {} END
> NIP
> \>>

Try {{1} 2 3. "4"}
0 (or 0.)
Nothing happens.

In fact, as soon as te list contains mixed types, it just stops working.

> Without the initial TYPE one must also allow the input (which
> then remains unchanged & needs to be NIPped at the end ) to be
> an integer (eg 8) or a real (eg 8.) so I test against 5
> (string) at the end.
>
> I also wrote:
>
> > Strange how {} doesn't register in IFT.
> > << 1. {} IFT >> EVAL just wipes itself out, but
> > << IF 1. THEN {} END>> EVAL leaves {} on level 1.
>
> Ahha I see the IFT needs {{}}, so loses the byte advantage in
> this case.
>
> I'm sure the above can be shrunk. Let's target 50 bytes :-)
>
> Following Endless & Reth and Werner more closely, this is down
> to 66 bytes without the initial TYPE:
>
> \<< TYPE DUP 0 TICKS IFTE ROT + 1
> \<< DUP TYPE PICK3 == DROPN \>>
> DOSUBS TAIL NIP
> \>>
>

Try
{ 1 2 3 }
0

I get a TAIL error

Or even
{ 1. 2. 3.}
0

-> returns { 2. 3. }

And last, { 1. 2. 3. }
0.
Returns the original list.

Endless

unread,
Dec 5, 2004, 8:02:19 AM12/5/04
to

"Tony Hutchins" <jus...@csi.com> wrote in message
news:1139414...@news.individual.net...

> -=[ Sun, 5.12.04 8:51 p.m. +1300 (NZDT) ]=-
>
> Hi James M. Prange ! <jmpr...@i-is.com>
>
> 1 day 11h24m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
> in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :
>
> [...]
> > I'm glad that nobody seems to be expressing hard feelings
> > when an idea is borrowed from him.
> >
> > > "reth" <re...@nospam.com.at> wrote in message
> > > news:41b0036a$1...@dnews.tpgi.com.au...
> > >
> > >>Based on Endless' ;) - hp48g
> > >>
> > >><< TYPE DUP -> T
> > >> << 0 TICKS IFTE SWAP + 1
> > >> <<
> > >> DUP TYPE T == DROPN
> > >> >>
> > >> DOSUBS TAIL
> > >> >>
>
> Following Endless and Reth I had to try transposing this 80
> byter to no local variable usage. This appears to be
> equivalent, but 73 bytes, for the 49g+:
>
> \<< TYPE SWAP 1
> \<< DUP TYPE PICK3 == DROPN \>>
> DOLIST
> DUP IF TYPE 5 \=/ THEN {} END
> NIP
> \>>
>

I commented on that above in the thread (in short, it doesn't work)

> For the 48G it would be 78 bytes (using 3 PICK and SWAP DROP
> instead of PICK3 and NIP).
>

And I just tested it on the 48gx:
{1 2 "3"}
#2

Returns { 1 2 }

And I just figured what is wrong with your program, I think.

At one point we have
10 (result of TYPE on #2)
{1 2 "3"}
1
<<DUP TYPE 3 PICK == DROPN >>

Then DOLIST arrives and it breaks it into

10
1
the little code is run: DUP
10
1
1

TYPE
10
1
0

PICK3
10
1
0
10

==
10
1
0

DROPN
10
1

Then... the next element is pushed on the stack
10
1
2

Same thing, we end up with:
10
1
2

Then "3" is pushed
10
1
2
"3"

Then
DUP
TYPE
10
1
2
"3"
2

PICK3
10
1
2
"3"
2
2

== DROPN
10
1
2

We finished the dolist, the internal counter is at two, it becomes
10
{1 2}

then we clean, and finish with
{1 2}

James M. Prange

unread,
Dec 5, 2004, 9:10:29 AM12/5/04
to
Tony Hutchins wrote:
> -=[ Sun, 5.12.04 8:51 p.m. +1300 (NZDT) ]=-
>
> Hi James M. Prange ! <jmpr...@i-is.com>
>
> 1 day 11h24m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
> in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :
>
> [...]
>
>>I'm glad that nobody seems to be expressing hard feelings
>>when an idea is borrowed from him.
>>
>>
>>>"reth" <re...@nospam.com.at> wrote in message
>>>news:41b0036a$1...@dnews.tpgi.com.au...
>>>
>>>
>>>>Based on Endless' ;) - hp48g
>>>>
>>>><< TYPE DUP -> T
>>>> << 0 TICKS IFTE SWAP + 1
>>>> <<
>>>> DUP TYPE T == DROPN
>>>> >>
>>>> DOSUBS TAIL
>>>> >>
>
>
> Following Endless and Reth I had to try transposing this 80
> byter to no local variable usage. This appears to be
> equivalent, but 73 bytes, for the 49g+:

@ 48S Checksum: N/A
@ 48S Size: N/A
@ 48G Checksum: N/A
@ 48G Size: N/A
@ 49 Checksum: # 2E97h
@ 49 Size: 73.

Download to 49 series in exact mode.

Apparently, this is intended to take an example of a type in
level 1.

What's really interesting about this one is that it looks like it
has to error out with an empty list, and indeed it does on my 49G
with ROM revision 1.19-6, failing with "DOLIST Error: Invalid
Dimension". But it *seemed* to work on my 49g+ (ROM revision
1.23). How could that be?

As far as I've investigated, DOLIST fails with an empty list in
the 48G and 49G, but with the 49g+, it returns what *looks* like
an empty list. But actually, the list isn't really empty; SIZE on
it returns 1, but SIZE on a really empty list returns 0, and the
results from the BYTES command is different too. Looking at it
with flag -85 set (SysRPL stk disp), the list contains PTR 05607,
which is the pointer to an empty secondary, which of course isn't
displayed with flag -85 clear (Normal stk disp).

Is this supposed to be a feature? To me it seems to be a bug; if I
ask the calculator to do something unreasonable, then I expect it
to error out, not return a phony result that isn't what it looks
like. Is there a flag that controls this behaviour?

A more immediate concern for me is whether this phony
empty-looking list should be an acceptable result for this
mini-challenge. Comments, anyone?

Of course, I've already disqualified Tony.

> \<< TYPE SWAP 1
> \<< DUP TYPE PICK3 == DROPN \>>
> DOLIST
> DUP IF TYPE 5 \=/ THEN {} END
> NIP
> \>>
>
> For the 48G it would be 78 bytes (using 3 PICK and SWAP DROP
> instead of PICK3 and NIP).

But of course it wouldn't work on a 48G.

> Strange how {} doesn't register in IFT.
> << 1. {} IFT >> EVAL just wipes itself out, but
> << IF 1. THEN {} END>> EVAL leaves {} on level 1.

--
Regards,
James

James M. Prange

unread,
Dec 5, 2004, 10:45:07 AM12/5/04
to
Tony Hutchins wrote:
> -=[ Sun, 5.12.04 9:40 p.m. +1300 (NZDT) ]=-
>
> Hi Virgil ! <ITSnetNOTcom#vir...@COMCAST.com>
>
> 54m ago, on Sun, 5.12.04 at 00:45 a.m. -0700, you wrote
> in message ID <ITSnetNOTcom#virgil-099439....@comcast.dca.giganews.com> :
>
>
>>Has anyone bettered 77.5 bytes for the 49+?
>
>
> Without the initial TYPE this is 70.5 bytes

@ 48S Checksum: N/A


@ 48S Size: N/A
@ 48G Checksum: N/A
@ 48G Size: N/A

@ 49 Checksum: 2E97h
@ 49 Size: 73.

> \<< TYPE SWAP 1


> \<< DUP TYPE PICK3 == DROPN \>>
> DOLIST
> DUP IF TYPE 5 \=/ THEN {} END
> NIP
> \>>

With an empty list, this fails on a 49G. On a 49g+, it returns an
empty-looking list with PTR 05607 as an element.

> Without the initial TYPE one must also allow the input (which
> then remains unchanged & needs to be NIPped at the end ) to be
> an integer (eg 8) or a real (eg 8.) so I test against 5
> (string) at the end.
>
> I also wrote:
>
>
>>Strange how {} doesn't register in IFT.
>><< 1. {} IFT >> EVAL just wipes itself out, but
>><< IF 1. THEN {} END>> EVAL leaves {} on level 1.
>
>
> Ahha I see the IFT needs {{}}, so loses the byte advantage in
> this case.
>
> I'm sure the above can be shrunk. Let's target 50 bytes :-)
>
> Following Endless & Reth and Werner more closely, this is down
> to 66 bytes without the initial TYPE:

@ 48S Checksum: N/A


@ 48S Size: N/A
@ 48G Checksum: N/A
@ 48G Size: N/A

@ 49 Checksum: # F3F8h
@ 49 Size: 68.5

Download in exact mode.

> \<< TYPE DUP 0 TICKS IFTE ROT + 1
> \<< DUP TYPE PICK3 == DROPN \>>
> DOSUBS TAIL NIP
> \>>

Fails pretty badly on both the 49G and 49g+

> 16 bytes to go :-)
>
> *If* DOLIST/DOSUBS did the expected and actually produced an
> explicit *something* for the null result - a {} would be quite
> nice for example<G>, then we would hit 50.5 or 48 bytes
> without the initial TYPE - i.e.

> << TYPE SWAP 1 << DUP TYPE PICK3 == DROPN >> DOLIST NIP >>

Or:

%%HP: T(3)A(R)F(.);


@ 48S Checksum: N/A
@ 48S Size: N/A
@ 48G Checksum: N/A
@ 48G Size: N/A

@ 49 Checksum: EC22h
@ 49 Size: 50.5
@ Download in exact mode.
\<< TYPE SWAP 1


\<< DUP TYPE PICK3 ==
DROPN
\>> DOLIST NIP

\>>

With a 1- or 2-elemnt list, fails on the 49G. With a 1-element
list, fails on the 49g+. With an empty list, returns a list with
the element PTR 05607 on the 49g+.

> If we leave off the final NIP this does work without run-time
> error but we need to carefully interpret the output<G> - so 50
> is a tantalising target.

--
Regards,
James

James M. Prange

unread,
Dec 5, 2004, 12:30:20 PM12/5/04
to
I wrote:
> Veli-Pekka Nousiainen wrote:
>
>>A minichallange for those who have *never before* taken part!

In any mini-challenge, whether it involved size or not.

>>Write the SHORTEST routine that eliminates the same TYPE of element
>
>
> "SHORTEST" meaning the smallest size (in bytes) returned by the
> BYTES command on the program itself; not the size when you run
> BYTES on the program's quoted name. Execution time doesn't matter
> in this particular minichallenge.


>
>
>> 2: list
>> 1: element of which type is desired to be eliminated
>
>

> Meaning that the level 1 argument should be a "real number"
> representing the type to be eliminated, such as 0 for reals
> numbers, 1 for complex numbers, 2 for characters strings, and so
> on, not an example of the type to be eliminated. Right,
> Veli-Pekka?

As an alternative, programs which take an object as an example of
the type to be eliminated are also acceptable, but if you do this,
please note it in the entry.

> Argument checking isn't required. In other words, it doesn't
> matter what the program does for arguments other than the above.
>
>
>> RELEMTYPE
>> 1: list
>> Note:
>>Recall 'RELMTYPE' program contenst to stack and do BYTES
>> to get the bytes of the program itself + checksum

It must work correctly when stored in a global variable with
either the name 'RELEMTYPE' or 'RELMTYPE'

> Please post the checksum and which model you used too, as an aid
> to verifying that the program was downloaded or entered correctly.

If I can tell which series (48 or 49) it was written for, an entry
written for the 48 series will be compiled in approximate mode on
the 49 series, and an entry written for the 49 series will be
compiled in exact mode on the 49 series.

Note that exact integers from the 49 series will always be
compiled as real numbers in the 48 series.

> To make it easier to read and download the program, I recommend
> that you upload it to your PC using a Kermit ASCII transfer with
> translation mode 3 (Xlat: ->255 in an input form), or use a Conn4x
> "text" transfer with all translations enabled. For the 49 series,
> have the calculator in exact mode while uploading. Copy and paste
> the contents (including the transfer header) of the file to your
> post. Of course, you can type in the program instead; if I don't
> get the same checksum and size, then I'll ask for clarification.
>
> For the 49 series, please be particularly careful of the
> difference between real numbers (type 0) and exact integers (type
> 28); if you intend a real number, then include a decimal point.
>
>
>>Restrictions:
>>1) It must work correctly on an empty list too
>
>
> That is, if the level 2 argument is an empty list, then it must
> return an empty list without causing an error.

To clarify, looking like an empty list isn't enough; it must
actually be empty. If SIZE on it returns something other than 0,
then it isn't empty. My reasoning is that it's very basic to RPN
(including RPL) calculators that the result(s) returned by an
operation be suitable for the argument(s) in a subsequent
operation. If the list looks empty but actually contains a element
that isn't displayed, then it certainly isn't suitable.

>>2) The remaining elements have to be in their original order
>>3) No downloaded external libraries
>>4) UserRPL only, no SYSEVAL, LIBEVAL, FLASHEVAL
>>5) Be honest: don't ask for help from anyone!
>
>
> But I'd encourage everyone to make use of whatever other resources
> they can find, for example, the Google archive of this newsgroup.
>
> 6) Anything besides the arguments that was on the stack should
> still be there when the program ends. For example, clearing the
> stack is not acceptable, unless the program also restores it.
> Similarly, it shouldn't KILL any suspended programs, or purge
> or change any pre-existing variables.
>
> 7) Must not be mode or flag dependent. For example, it should work
> in both exact and approximate modes, and with or without last
> arguments saves (flag -55) enabled. It may change a flag while
> running, but if it does, then it must restore the original
> state.
>
>
>>Categories:
>>A) 48-series: 48S, 48SX, 48G, 48G+, 48GX
>
>
> Considering the changes to list processing, let's split that into
> two categories; one for the 48S and 48SX, and another for the 48G,
> 48GX, and 48G+.
>
>
>>B) 49-series: 48gII, 49G, 49g+
>
>
> I don't have a 48gII, but I expect that if it works on one of
> these, then it ought to work on all of them. If it turns out
> otherwise, let's just say that it must work on at least one of
> them.
>
>
>>C) 49-series using also manually attachable "secret" libraries
>> Contestants are urged to dig information using internet.
>
>
> Of course, it could happen that one entry wins in more than one
> category.

An entry that works correctly in more than one category will be
treated as an entry into every category that it works in.

>>The challange ends at 12.12.2004 midnight greenw. time
>>(regardless of D.MY/M.DY setting)
>
>
> "Midnight" meaning when 2004-12-12 ends, in Universal Coordinated
> Time. I'll go by the date and time in the post's
> "NNTP-Posting-Date:" header; usually (but not necessarily) this is
> within a few seconds after you send the post. If the date isn't
> 2004-12-12 or earlier after converting to UTC, then it's too late.

It turns out the some posts don't have an "NNTP-Posting-Date:"
header, so I'll use whichever header, *except the "Date:" header*
has the earliest date and time.

> In case of a tie, whoever posts first wins.

To be considered as an entry, the source code must be posted.

> Entries or questions should be in replies to this thread. Of
> course, if you come up with something smaller, then feel free to
> post another entry.
>
> Let's try to keep this an enjoyable learning exercise. Give it
> your best shot. I'd encourage you to post your smallest program
> before the deadline, even if someone else has already posted a
> smaller one; it could turn out that there's a flaw in an
> apparently better entry. It's interesting to see how many
> different ways to get the same result are possible.

Plagiarism is encouraged. Of course, it's nice to credit whomever
you just got a brilliant idea from.

> In case of a dispute, the judge's final decision is final. But if
> you notice a flaw that the judge hasn't noticed, point it out. The
> judge reserves his right to change his decision.
>
> Prize: Fame (at least in this thread).
>
>
>>James M. Prange is invited to be the Great Judge!
>
>
> Accepted. Thank you!

--
Regards,
James

Veli-Pekka Nousiainen

unread,
Dec 5, 2004, 1:53:31 PM12/5/04
to
"Tony Hutchins" <jus...@csi.com> wrote in message
news:1080379...@news.individual.net...

> -=[ Sun, 5.12.04 12:02 p.m. +1300 (NZDT) ]=-
>
> Hi James M. Prange ! <jmpr...@i-is.com>
>
> 1 day 02h35m ago, on Fri, 3.12.04 at 3:27 p.m. -0500, you wrote
> in message ID <2%3sd.8$yY...@fe39.usenetserver.com> :
>
>> Actually, I was rather surprised that so many entries were
>> using local variables.
>
> Hint taken :-)
> I had to have a go at this, having never been involved in an
> official challenge where size matters.

Any minichallange ever, not just size
IF you do not qualify
THEN please stop posting
END

[VPN]

Veli-Pekka Nousiainen

unread,
Dec 5, 2004, 1:57:17 PM12/5/04
to
"Virgil" <ITSnetNOTcom#vir...@COMCAST.com> wrote in message
news:ITSnetNOTcom%23virgil-099439...@comcast.dca.giganews.com...

We will see in the 13th day
when also the old-timers can put out their entries
We will see some different variations of the same method
I guess, but [VPN] just might have a trick in his sleeve
I just hope that the Great Judge doesn't sentense me to jail...
(-;
[VPN]


Tony Hutchins

unread,
Dec 5, 2004, 2:35:47 PM12/5/04
to
-=[ Mon, 6.12.04 08:13 a.m. +1300 (NZDT) ]=-

Hi James

01h43m ago, on Sun, 5.12.04 at 12:30 p.m. -0500, you wrote
in message ID <SAHsd.11473$QJ2....@fe39.usenetserver.com> :

> I wrote:
> > Veli-Pekka Nousiainen wrote:
> >
> >>A minichallange for those who have *never before* taken part!
>
> In any mini-challenge, whether it involved size or not.

And, even if the mini-challenge was disguised :-)

===============================
From: joe...@holyjoe.net (Joseph K. Horn)
Newsgroups: comp.sys.hp48
Subject: 48/49: Best Fraction Challenge
Date: 11 Oct 2003 13:02:42 -0700

The "Best Fraction Challenge"
(An Extremely Difficult Challenge Disguised as a Mini-Challenge)
[...]
=================================

That's the one that disqualified me. Still it doesn't stop me
learning from the postings of others. Especially about DOLIST
which I had never used - and as Endless (Thanks BTW) pointed
out my program was totally non-functional and therefore
self-disqualifying<G> - easily the worst I've seen. It's so
hard to see "inside" DOLIST - I tried 4 PICK though which gave
an error showing a stack that makes it look like 3 PICK should
work, but .... :-(

Hey, you guys who can take part are the lucky ones!

--
Tony Hutchins
New Zealand

#27 Just got a new car for my wife... Great trade...

Tony Hutchins

unread,
Dec 5, 2004, 3:07:19 PM12/5/04
to
-=[ Mon, 6.12.04 08:51 a.m. +1300 (NZDT) ]=-

Hi Veli-Pekka Nousiainen ! <DROP...@THIS.welho.com>

57m ago, on Sun, 5.12.04 at 8:53 p.m. +0200, you wrote
in message ID <covlcu$tb0$1...@nyytiset.pp.htv.fi> :

{Hutchins}
mini-challenge_disqualified_TYPE
REMELEM
{}

That's all I will post. Better than those non-solutions anyway
<G>.

--
Tony Hutchins
New Zealand

#38 I have seen the evidence. I want DIFFERENT evidence!

Tony Hutchins

unread,
Dec 5, 2004, 3:37:06 PM12/5/04
to
-=[ Mon, 6.12.04 09:13 a.m. +1300 (NZDT) ]=-

Hi Endless ! <news...@daydreamnation.org>

07h10m ago, on Sun, 5.12.04 at 2:02 p.m. +0100, you wrote
in message ID <41b306db$0$15818$636a...@news.free.fr> :

> > \<< TYPE SWAP 1
> > \<< DUP TYPE PICK3 == DROPN \>>
> > DOLIST
> > DUP IF TYPE 5 \=/ THEN {} END
> > NIP
> > \>>
> >
>
> I commented on that above in the thread (in short, it
> doesn't work)

I agree :-( Thanks for your post!

The PICK3 works a little bit only<G>. DOLIST actually *uses*
the upper stack to store any output elements (via a fixed
ROLLD) so our comparison TYPE actually rises up the stack,
sitting on top of the output element sub-stack. Hehe. We need
a variable PICK, or make it a local variable, like you have
already done. What fun :-). *If* DOLIST stored a zero by
default as the starting output LIST SIZE then the final ->LIST
it seems to do would actually produce a clean {}.

Veli-Pekka Nousiainen

unread,
Dec 5, 2004, 6:31:12 PM12/5/04
to
"Tony Hutchins" <jus...@csi.com> wrote in message
news:1056345...@news.individual.net...

> -=[ Mon, 6.12.04 08:13 a.m. +1300 (NZDT) ]=-
>
> Hi James
>
> 01h43m ago, on Sun, 5.12.04 at 12:30 p.m. -0500, you wrote
> in message ID <SAHsd.11473$QJ2....@fe39.usenetserver.com> :
>
>> I wrote:
>> > Veli-Pekka Nousiainen wrote:
>> >
>> >>A minichallange for those who have *never before* taken part!
>>
>> In any mini-challenge, whether it involved size or not.
>
> And, even if the mini-challenge was disguised :-)
>
> ===============================
> From: joe...@holyjoe.net (Joseph K. Horn)
> Newsgroups: comp.sys.hp48
> Subject: 48/49: Best Fraction Challenge
> Date: 11 Oct 2003 13:02:42 -0700
>
> The "Best Fraction Challenge"
> (An Extremely Difficult Challenge Disguised as a Mini-Challenge)
> [...]
> =================================
>
> That's the one that disqualified me. Still it doesn't stop me
> learning from the postings of others. Especially about DOLIST
> which I had never used - and as Endless (Thanks BTW) pointed
> out my program was totally non-functional and therefore
> self-disqualifying<G> - easily the worst I've seen. It's so
> hard to see "inside" DOLIST

Not hard at all: You could do something like this:
{} 'L' STO
Fill the stack with dummies like
65 DUP 25 + FOR c c CHR NEXT
then a sample list and the type value
DBUG the program and just before DOLIST/DOSUBS
(you can see it coming using |NEXT|)
edit the program to hold say (in case of DOSUBS) :
20 DUPN NSUB "
" + 21 ->LIST 'L' STO+
just before the test
==
I you are using DOLIST you may want to have
{} 'L' STO 0 'J' STO
in the beginning and then use
20 DUPN 'J' INCR "
" + 21 ->LIST 'L' STO+
just before the test
==
Just help you all in debugging your code!
[VPN]


It is loading more messages.
0 new messages