Post Reply 
hp 28s - creating nested lists
02-16-2015, 09:38 PM
Post: #6
RE: hp 28s - creating nested lists
(02-16-2015 08:40 PM)mbrethen Wrote:  they must not be supported on its predecessor?

It appears that only the following LIST operations were supported:

HEAD and TAIL are basically the same as CAR and CDR in Lisp.

When I compare my program to Christoph's 2nd solution I notice that they do essentially the same:
  • get the last element of the control-list
  • create a new list by adding the previous result n times

He uses LIST\-> to access the last element and then recreates the list with \->LIST while I use HEAD to get the 1st element. That's why I had to reverse the list in the first step.
Then he DUPs the previous result n times which is once too much. That's why he has to DROP the last one. In my program the previous result is added repeatedly to an ever growing list that started with an empty list {}.

Not sure about that but the statements 0 > could probably be omitted in his program as well. Furthermore I assume that his solution is faster than mine on a HP-48 as list-operations are rather slow. As I wasn't sure whether local variables were already supported I avoided their usage.

Kind regards
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
hp 28s - creating nested lists - mbrethen - 02-16-2015, 04:33 PM
RE: hp 28s - creating nested lists - Thomas Klemm - 02-16-2015 09:38 PM

User(s) browsing this thread: 1 Guest(s)