NEWOB

Synopsis


Replaces a given object with a new copy

Stack Diagram


Input Stack Output Stack
O Ocopy
Level 1 Level 1

Legend

Keyword type Command
Parallel list processing capabilities Group 9 Quirky commands
Affected by flags None

Description


The NEWOB command replaces an object on the stack with a new copy of itself.

The command may seem pointless, but it solves a very specific problem: when an object originated from a larger composite object is extracted and put on the stack it contains a reference to the parent object; even if the parent object is DROPped from the stack it keeps on living in the RAM, occupying precious resources.

A copy of the extracted object created by NEWOB breaks this link and allows the GARBAGE collection to recover the memory associated with the larger object once it is not needed anymore.

Compatibility


NEWOB is fully equivalent to its userRPL counterpart.

Usage


Input

4:                                      
3:                                      
2:                                      
1:{ 'LN(X)' 8888. [[ 1 2 3 ] [ 4 5 6 ]]…
…………………………………………………………………………………………………………
3 GET { 2 3 } GET NEWOB                 


Output

4:                                      
3:                                      
2:                                      
1:                                     6
…………………………………………………………………………………………………………
                                        

Related Commands


Time, Alarms and System Commands 28 1 NEW

Command Short Description
→DATE Set current system date in MM.DDYYYY
DATE+ Add days to a date in MM.DDYYYY
→TIME Set current time as HH.MMSS
→HMS Convert decimal time to HH.MMSS
HMS→ Convert time in HH.MMSS to decimal
HMS+ Add time in HH.MMSS format
HMS- Subtract time in HH.MMSS format
TICKS Return system clock in microseconds CHANGED
TEVAL Perform EVAL and measure elapsed time CHANGED
DATE Current system date as MM.DDYYYY
DDAYS Number of days between dates in MM.DDYYYY
TIME Current time in HH.MMSS
TSTR
ACK Acknowledge oldest alarm (dismiss)
ACKALL Acknowledge (dismiss) all alarms
RCLALARM Recall specified alarm
STOALARM Create a new alarm
DELALARM Delete an existing alarm
FINDALARM Get first alarm due after the given time
VERSION Get newRPL version string
MEM Get available memory in bytes
BYTES Size of an object in bytes and CRC32 CHANGED
PEEK Low-level read memory address CHANGED
POKE Low level write to memory address CHANGED
NEWOB Make a new copy of the given object
GARBAGE Force a garbage collection NEW
FWUPD
OFF Turn calculator off programmatically