story: fix to-text arms

This commit is contained in:
Yaseen 2022-01-30 15:59:58 -05:00
parent 9286d89fa2
commit 75d6882b51
3 changed files with 26 additions and 24 deletions

View File

@ -24,8 +24,8 @@
%- some %- some
%- crip %- crip
;: welp ;: welp
(trip (tako-to-text:lib r.commit)) (tako-to-text:lib r.commit)
(trip (proses-to-text:lib u.proses)) (proses-to-text:lib u.proses)
== ==
:::: ::::
:: Remarks: :: Remarks:

View File

@ -2,32 +2,34 @@
|% |%
++ tako-to-text ++ tako-to-text
|= [=tako:clay] |= [=tako:clay]
^- cord ^- tape
(crip "commit: {<`@uv`tako>}\0a") "commit: {<`@uv`tako>}\0a"
::
++ proses-to-text ++ proses-to-text
|= [proses=(set prose)] |= [=proses]
^- cord ^- tape
:: XX code cleanup: factor out duplicate code
=/ proses-list=(list prose) ~(tap in proses) =/ proses-list=(list prose) ~(tap in proses)
?: ?=(~ proses-list) '' ?: ?=(~ proses-list) ""
?: ?=([prose ~] proses-list) ?: ?=([prose ~] proses-list)
=/ [title=@t body=@t] i.proses-list (prose-to-text i.proses-list)
%- crip
;: welp
"{(trip title)}"
"\0a\0a"
"{(trip body)}"
"\0a"
==
%- crip
%- tail %- tail
%^ spin ;;((list prose) proses-list) *tape :: WHY DO WE NEED ;; %^ spin ;;((list prose) t.proses-list) :: XX WHY DO WE NEED ;;
|= [[title=@t body=@t] state=tape] (prose-to-text i.proses-list)
|= [prz=prose state=tape]
^- [prose tape] ^- [prose tape]
:- [title body] :- prz
;: welp ;: welp
state state
"|||\0a" "|||"
"\0a"
(prose-to-text prz)
==
::
++ prose-to-text
|= pro=prose
=/ [title=@t body=@t] pro
^- tape
;: welp
"{(trip title)}" "{(trip title)}"
"\0a\0a" "\0a\0a"
"{(trip body)}" "{(trip body)}"

View File

@ -124,14 +124,14 @@
:: XX code clean up: cleaner snoc :: XX code clean up: cleaner snoc
%+ snoc :: ensures terminating newline is present %+ snoc :: ensures terminating newline is present
%+ murn ~(tap by tale) %+ murn ~(tap by tale)
|= [[=tako:clay proses=(set prose)]] |= [[=tako:clay =proses]]
^- (unit cord) ^- (unit cord)
?~ proses ~ ?~ proses ~
%- some %- some
%- crip %- crip
;: welp ;: welp
(trip (tako-to-text:lib tako)) (tako-to-text tako)
(trip (proses-to-text:lib proses)) (proses-to-text proses)
"---" "---"
== ==
'' ''