How to resolve the algorithm Vector step by step in the Phixmonti programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Vector step by step in the Phixmonti programming language
Table of Contents
Problem Statement
Implement a Vector class (or a set of functions) that models a Physical Vector. The four basic operations and a pretty print function should be implemented.
The Vector may be initialized in any reasonable way.
The four operations to be implemented are:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Vector step by step in the Phixmonti programming language
Source code in the phixmonti programming language
include ..\Utilitys.pmt
def add + enddef
def sub - enddef
def mul * enddef
def div / enddef
def opVect /# a b op -- a b c #/
var op
list? not if swap len rot swap repeat endif
len var lon
( lon 1 -1 ) for var i
i get rot i get rot op exec >ps swap
endfor
lon for drop
ps>
endfor
lon tolist
enddef
( 5 7 ) ( 2 3 )
getid add opVect ?
getid sub opVect ?
drop 2
getid mul opVect ?
getid div opVect ?
You may also check:How to resolve the algorithm Quine step by step in the ACL2 programming language
You may also check:How to resolve the algorithm RIPEMD-160 step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Multifactorial step by step in the Miranda programming language
You may also check:How to resolve the algorithm Ackermann function step by step in the EMal programming language
You may also check:How to resolve the algorithm Ethiopian multiplication step by step in the Forth programming language