Optional parameters: Difference between revisions
Content added Content deleted
Line 2,305: | Line 2,305: | ||
"2 ^2: " print 2 mypower ? |
"2 ^2: " print 2 mypower ? |
||
"2 ^3: " print ( 2 3 ) mypower ?</lang> |
"2 ^3: " print ( 2 3 ) mypower ?</lang> |
||
More in line with the task description |
|||
<lang Phixmonti>include ..\Utilitys.pmt |
|||
( ( "a" "b" "c" ) |
|||
( "" "q" "z" ) |
|||
( "zap" "zip" "Zot" ) ) |
|||
def mysort /# column reverse #/ |
|||
len >ps |
|||
tps 0 == if drop ( 1 false ) endif |
|||
ps> 1 == if false 0 put endif |
|||
pop swap >ps pop drop swap |
|||
len for var i |
|||
i get |
|||
tps extract swap 1 put |
|||
i set |
|||
endfor |
|||
sort |
|||
swap true == if reverse endif |
|||
len for var i |
|||
i get |
|||
pop swap tps put |
|||
i set |
|||
endfor |
|||
ps> drop |
|||
enddef |
|||
pstack |
|||
( ) mysort pstack |
|||
( 3 ) mysort pstack |
|||
( 2 ) mysort pstack |
|||
( 2 true ) mysort pstack |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
[[["a", "b", "c"], ["", "q", "z"], ["zap", "zip", "Zot"]]] |
|||
[[["", "q", "z"], ["a", "b", "c"], ["zap", "zip", "Zot"]]] |
|||
[[["zap", "zip", "Zot"], ["a", "b", "c"], ["", "q", "z"]]] |
|||
[[["a", "b", "c"], ["", "q", "z"], ["zap", "zip", "Zot"]]] |
|||
[[["zap", "zip", "Zot"], ["", "q", "z"], ["a", "b", "c"]]] |
|||
=== Press any key to exit ===</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |