2019-03-14 19:01:28 +01:00
|
|
|
I find `)` useful to punctuate code chunks.
|
|
|
|
|
|
|
|
~~~
|
|
|
|
:) ; immediate (code_chunk_punctuation_that_does_nothing
|
|
|
|
~~~
|
|
|
|
|
|
|
|
Here is an example:
|
|
|
|
|
2019-05-13 14:27:13 +02:00
|
|
|
:i@ (an-n) a:fetch ;
|
2019-03-14 19:01:28 +01:00
|
|
|
|
|
|
|
~~~
|
|
|
|
{{
|
2019-05-13 14:27:13 +02:00
|
|
|
:I@ (an-n) I a:fetch ;
|
2019-03-14 19:01:28 +01:00
|
|
|
'Index 'Value [ var ] bi@
|
|
|
|
:lt?-or-gt? hook ;
|
|
|
|
:pre.min (a-an)
|
|
|
|
(comparison <? <?-or-gt? set-hook )
|
2019-04-24 16:02:15 +02:00
|
|
|
(begin_with #-1 !Index n:MAX !Value dup a:length ) ;
|
2019-03-14 19:01:28 +01:00
|
|
|
:pre.max (a-an)
|
|
|
|
(comparison >? <?-or-gt? set-hook )
|
2019-04-24 16:02:15 +02:00
|
|
|
(begin_with #-1 !Index n:MIN !Value dup a:length ) ;
|
2019-03-14 19:01:28 +01:00
|
|
|
:min-or-max (a-nn) [ dup I@ dup @Value lt?-or-gt?
|
2020-07-06 04:49:49 +02:00
|
|
|
[ !Value I !Index ] [ drop ] choose ] indexed-times
|
2019-03-14 19:01:28 +01:00
|
|
|
(a-nn drop @Index @Value ) ;
|
|
|
|
---reveal---
|
2019-04-24 16:02:15 +02:00
|
|
|
:a:min (a-iv) pre.min min-or-max ;
|
|
|
|
:a:max (a-iv) pre.max min-or-max ;
|
2019-03-14 19:01:28 +01:00
|
|
|
}}
|
|
|
|
~~~
|
|
|
|
|
|
|
|
```
|
2019-04-24 16:02:15 +02:00
|
|
|
{ #3 #2 #5 #7 #3 } a:min dump-stack nl reset
|
|
|
|
{ #3 #2 #5 #7 #3 } a:max dump-stack nl
|
2019-03-14 19:01:28 +01:00
|
|
|
```
|
|
|
|
|