@@ -0,0 +1,810 @@
1+2eP diff
2+========
3+
4+A- more or less low priority and/or currently in the wrong section
5+anyway.
6+
7+------------------------------------------------------------------------
8+
9+------------------------------------------------------------------------
10+
11+### `++berk`
12+
13+Invert diff patches
14+
15+Inverts a list of changes `bur`. Skips stay constant and replaces are
16+swapped. Produces a `bur`.
17+
18+Accepts
19+-------
20+
21+`bur` is a [`++urge`]().
22+
23+Produces
24+--------
25+
26+The `++urge` of a noun.
27+
28+Source
29+------
30+
31+ ++ berk :: invert diff patch
32+ |* bur=(urge)
33+ |- ^+ bur
34+ ?~ bur ~
35+ :_ $(bur t.bur)
36+ ?- -.i.bur
37+ & i.bur
38+ | [%| q.i.bur p.i.bur]
39+ ==
40+ ::
41+
42+Examples
43+--------
44+
45+ ~zod/try=> (berk `(urge)`~[`10 %|^[~[2] ~[3 4]] `5])
46+ ~[[%.y p=10] [%.n p=~[3 4] q=~[2]] [%.y p=5]]
47+ ~zod/try=> (lurk "somes" `(urge char)`~[`1 [%| "o" "a"] `3])
48+ "sames"
49+ ~zod/try=> (berk `(urge char)`~[`1 [%| "o" "a"] `3])
50+ ~[[%.y p=1] [%.n p="a" q="o"] [%.y p=3]]
51+ ~zod/try=> (lurk "sames" (berk `(urge char)`~[`1 [%| "o" "a"] `3]))
52+ "somes"
53+
54+------------------------------------------------------------------------
55+
56+### `++diff`
57+
58+Generate patch
59+
60+Produces a patch between two nouns, by change type
61+
62+Accepts
63+-------
64+
65+`pum` is an [`++umph`]().
66+
67+Produces
68+--------
69+
70+An [`++udon`]()
71+
72+Source
73+------
74+
75+ ++ diff :: generate patch
76+ |= pum=umph
77+ |= [old=* new=*] ^- udon
78+ :- pum
79+ ?+ pum ~|(%unsupported !!)
80+ %a [%d (nude old new)]
81+ %b =+ [hel=(cue ((hard ,@) old)) hev=(cue ((hard ,@) new))]
82+ [%d (nude hel hev)]
83+ %c =+ [hel=(lore ((hard ,@) old)) hev=(lore ((hard ,@) new))]
84+ [%c (lusk hel hev (loss hel hev))]
85+ ==
86+ ::
87+
88+Examples
89+--------
90+
91+ ~zod/try=> ((diff %a) 20 21)
92+ [p=%a q=[%d p=[%1 p=21] q=[%1 p=20]]]
93+ ~zod/try=> ((diff %a) [1 2 3] [1 2 4])
94+ [ p=%a
95+ q
96+ [ %d
97+ p=[p=[%0 p=2] q=[p=[%0 p=6] q=[%1 p=4]]]
98+ q=[p=[%0 p=2] q=[p=[%0 p=6] q=[%1 p=3]]]
99+ ]
100+ ]
101+ ~zod/try=> ~04hh
102+ [1 2]
103+ ~zod/try=> ~0ph
104+ [1 1]
105+ ~zod/try=> ((diff %b) 0v4hh 0vph)
106+ [p=%b q=[%d p=[p=[%0 p=2] q=[%0 p=2]] q=[p=[%0 p=3] q=[%1 p=2]]]]
107+ ~zod/try=> ((diff %c) (role 'sam' 'les' 'les' 'kor' ~) (role 'sam' 'mor' 'kor' ~))
108+ [p=%c q=[%c p=~[[%.y p=1] [%.n p=~[7.562.604 7.562.604] q=~[7.499.629]] [%.y p=1]]]]
109+ ~[[%.y p=0] [%.y p=0] [%.y p=1] [%.n p=<|les les|> q=<|mor|>] [%.y p=1]]
110+ ~zod/try=> (,[%c %c (urge cord)] ((diff %c) (role 'sam' 'les' 'les' 'kor' ~) (role 'sam' 'mor' 'kor' ~)))
111+ [%c %c ~[[%.y p=1] [%.n p=<|les les|> q=<|mor|>] [%.y p=1]]]
112+
113+------------------------------------------------------------------------
114+
115+### `++loss`
116+
117+Longest subsequence
118+
119+Finds a subsequence of repeated elements within two [`++list`]()s, using
120+several internal helper arms. Produces a [`++tape`]().
121+
122+Accepts
123+-------
124+
125+`hel` is a [`++list`]() of [nouns]().
126+
127+`hev` is a [++list`]() of nouns.
128+
129+Produces
130+--------
131+
132+XX
133+
134+A [++list`]() of nouns.
135+
136+Source
137+------
138+
139+ ++ loss :: longest subsequence
140+ ~/ %loss
141+ |* [hel=(list) hev=(list)]
142+ |- ^+ hev
143+ =+ ^= sev
144+ =+ [inx=0 sev=*(map ,@t (list ,@ud))]
145+ |- ^+ sev
146+ ?~ hev sev
147+ =+ guy=(~(get by sev) i.hev)
148+ $(hev t.hev, inx +(inx), sev (~(put by sev) i.hev [inx ?~(guy ~ u.guy)]))
149+ =| gox=[p=@ud q=(map ,@ud ,[p=@ud q=_hev])]
150+ =< abet
151+ =< main
152+ |%
153+ ++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag))
154+ ++ hink :: extend fits top
155+ |= [inx=@ud goy=@ud] ^- ?
156+ |(=(p.gox inx) (lth goy p:(need (~(get by q.gox) inx))))
157+ ::
158+ ++ lonk :: extend fits bottom
159+ |= [inx=@ud goy=@ud] ^- ?
160+ |(=(0 inx) (gth goy p:(need (~(get by q.gox) (dec inx)))))
161+ ::
162+ ++ lune :: extend
163+ |= [inx=@ud goy=@ud]
164+ ^+ +>
165+ %_ +>.$
166+ gox
167+ :- ?:(=(inx p.gox) +(p.gox) p.gox)
168+ %+ ~(put by q.gox) inx
169+ [goy (snag goy hev) ?:(=(0 inx) ~ q:(need (~(get by q.gox) (dec inx))))]
170+ ==
171+ ::
172+ ++ merg :: merge all matches
173+ |= gay=(list ,@ud)
174+ ^+ +>
175+ =+ ^= zes
176+ =+ [inx=0 zes=*(list ,[p=@ud q=@ud])]
177+ |- ^+ zes
178+ ?: |(?=(~ gay) (gth inx p.gox)) zes
179+ ?. (lonk inx i.gay) $(gay t.gay)
180+ ?. (hink inx i.gay) $(inx +(inx))
181+ $(inx +(inx), gay t.gay, zes [[inx i.gay] zes])
182+ |- ^+ +>.^$
183+ ?~(zes +>.^$ $(zes t.zes, +>.^$ (lune i.zes)))
184+ ::
185+ ++ main
186+ |- ^+ +
187+ ?~ hel
188+ ?~ hev
189+ ?>(?=(~ lcs) +)
190+ $(hev t.hev, rag (done %| ~ [i.hev ~]))
191+ ?~ hev
192+ $(hel t.hel, rag (done %| [i.hel ~] ~))
193+ ?~ lcs
194+ +(rag (done %| (flop hel) (flop hev)))
195+ ?: =(i.hel i.lcs)
196+ ?: =(i.hev i.lcs)
197+ $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
198+ $(hev t.hev, rag (done %| ~ [i.hev ~]))
199+ ?: =(i.hev i.lcs)
200+ $(hel t.hel, rag (done %| [i.hel ~] ~))
201+ $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
202+ --
203+
204+Examples
205+--------
206+
207+ ~zod/try=> (loss "sam" "sem")
208+ "sm"
209+ ~zod/try=> (loss "samo" "semo")
210+ "smo"
211+ ~zod/try=> (loss "sakmo" "semo")
212+ "smo"
213+ ~zod/try=> (loss "ferdinham" "ferdilapos
214+ ~ <syntax error at [1 30]>
215+ ~zod/try=> (loss "ferdinham" "ferdilapos")
216+ "ferdia"
217+
218+------------------------------------------------------------------------
219+
220+### `++locz`
221+
222+Find common
223+
224+Finds a subsequence of repeated elements within two
225+[`++list`](/doc/hoon/library/1#++list)s, producing a [\`++tape]().
226+
227+Accepts
228+-------
229+
230+A cell of two `++tape`s, `hel` and `hev`.
231+
232+Produces
233+--------
234+
235+A `++tape`.
236+
237+Source
238+------
239+
240+ ++ locz :: trivial algorithm
241+ |= [hel=tape hev=tape]
242+ ^- tape
243+ =+ [leh=(lent hel) veh=(lent hev)]
244+ =- (flop q.yun)
245+ ^= yun
246+ |- ^- [p=@ud q=tape]
247+ ~+
248+ ?: |(=(0 leh) =(0 veh)) [0 ~]
249+ =+ [dis=(snag (dec leh) hel) dat=(snag (dec veh) hev)]
250+ ?: =(dis dat)
251+ =+ say=$(leh (dec leh), veh (dec veh))
252+ [+(p.say) [dis q.say]]
253+ =+ [lef=$(leh (dec leh)) rig=$(veh (dec veh))]
254+ ?:((gth p.lef p.rig) lef rig)
255+ ::
256+
257+Examples
258+--------
259+
260+ ~zod/try=> (locz "samukot" "semelkot")
261+ "smkot"
262+ ~zod/try=> (locz "samukot" "samelkot")
263+ "samkot"
264+
265+------------------------------------------------------------------------
266+
267+### `++lore`
268+
269+Split on `\n`
270+
271+Split on newlines, ascii `10`
272+
273+Accepts
274+-------
275+
276+`lub` is an atom.
277+
278+Produces
279+--------
280+
281+XX
282+
283+A `++list` of atoms of odor [`@t`]() ([`++cord`]()).
284+
285+Source
286+------
287+ ++ lore :: atom to line list
288+ ~/ %lore
289+ |= lub=@
290+ =| tez=(list ,@t)
291+ |- ^+ tez
292+ ?: =(0 lub) (flop tez)
293+ =+ ^= meg
294+ =+ meg=0
295+ |- ^- @ud
296+ =+ gam=(cut 3 [meg 1] lub)
297+ ?:(|(=(10 gam) =(0 gam)) meg $(meg +(meg)))
298+ =+ res=(rsh 3 +(meg) lub)
299+ ?: &(=(0 (cut 3 [meg 1] lub)) !=(0 res))
300+ !!
301+ $(lub res, tez [(end 3 meg lub) tez])
302+ ::
303+
304+Examples
305+--------
306+
307+ ~zod/try=> (lore 'soke\0alas\0amep')
308+ <|soke las mep|>
309+ ~zod/try=> (lore '|= a=@\0a=+ b=(add a 5)\0a(mix b a)')
310+ <||= a=@ =+ b=(add a 5) (mix b a)|>
311+ ~zod/try=> `wain`[(fil 3 80 ' ') (lore '|= a=@\0a=+ b=(add a 5)\0a(mix b a)')]
312+ <|
313+ |= a=@
314+ =+ b=(add a 5)
315+ (mix b a)
316+ |>
317+
318+------------------------------------------------------------------------
319+
320+### `++role`
321+
322+Join with `\n`
323+
324+Join line list with newlines.
325+
326+Accepts
327+-------
328+
329+A `++list` of atoms of [odor]() [`@t`]() ([`++cord`]()).
330+
331+Produces
332+--------
333+
334+XX
335+
336+An atom of [odor]() [`@t`]() ([`++cord`]().
337+
338+Source
339+------
340+
341+ ++ role :: line list to atom
342+ |= tez=(list ,@t)
343+ (rap 3 (turn tez |=(a=@t (cat 3 a 10))))
344+ ::
345+
346+Examples
347+--------
348+
349+ ~zod/try=> (role 'sep' 'tek' 'lap' ~)
350+ 3.230.709.852.558.292.782.985.274.739
351+ ~zod/try=> `@t`(role 'sep' 'tek' 'lap' ~)
352+ '''
353+ sep
354+ tek
355+ lap
356+ '''
357+
358+------------------------------------------------------------------------
359+
360+### `++lump`
361+
362+Change with `++udon`
363+
364+Use [`++udon`]() to change [noun]().
365+
366+Accepts
367+-------
368+
369+A cell of an `++udon`, `don`, and a noun, `src`.
370+
371+Produces
372+--------
373+
374+A noun.
375+
376+Source
377+------
378+
379+ ++ lump :: apply patch
380+ |= [don=udon src=*]
381+ ^- *
382+ ?+ p.don ~|(%unsupported !!)
383+ %a
384+ ?+ -.q.don ~|(%unsupported !!)
385+ %a q.q.don
386+ %c (lurk ((hard (list)) src) p.q.don)
387+ %d (lure src p.q.don)
388+ ==
389+ ::
390+ %c
391+ =+ dst=(lore ((hard ,@) src))
392+ %- role
393+ ?+ -.q.don ~|(%unsupported !!)
394+ %a ((hard (list ,@t)) q.q.don)
395+ %c (lurk dst p.q.don)
396+ ==
397+ ==
398+ ::
399+
400+Examples
401+--------
402+
403+ ~zod/try=> (lump [%a %a 20 25] 20)
404+ 25
405+ ~zod/try=> (lump [%a %d [[%0 1] [%0 1]] [%0 2]] 20)
406+ [20 20]
407+ ~zod/try=> (lump [%c %a ~['sa' 'le'] ~['sa' 'lo']] 'sa\0ale')
408+ 11.473.670.267.251
409+ ~zod/try=> (,@t (lump [%c %a ~['sa' 'le'] ~['sa' 'lo']] 'sa\0ale'))
410+ '''
411+ sa
412+ lo
413+ '''
414+ ~zod/try=> (,@t (lump [%c %c `1 [%| ~['le'] ~['lo' 'ma']] ~] 'sa\0ale'))
415+ '''
416+ sa
417+ ma
418+ lo
419+ '''
420+
421+------------------------------------------------------------------------
422+
423+### `++lure`
424+
425+Patch `a`
426+
427+Patch a by references to axis and literal.
428+
429+Accepts
430+-------
431+
432+A cell of a [noun](), `a`, and an [`++upas`](), `b`.
433+
434+Produces
435+--------
436+
437+A noun.
438+
439+Source
440+------
441+
442+ ++ lure :: apply tree diff
443+ |= [a=* b=upas]
444+ ^- *
445+ ?^ -.b
446+ [$(b -.b) $(b +.b)]
447+ ?+ -.b ~|(%unsupported !!)
448+ %0 .*(a [0 p.b])
449+ %1 .*(a [1 p.b])
450+ ==
451+
452+Examples
453+--------
454+
455+ ~zod/try=> (lure ~[1 2] [[%0 2] [%1 3] [%0 7]])
456+ [1 3 0]
457+ ~zod/try=> (lure ~[1 2 4] [[%0 2] [%1 3] [%0 7]])
458+ [1 3 4 0]
459+
460+------------------------------------------------------------------------
461+
462+### `++limp`
463+
464+Reverse patch
465+
466+Reverse a patch (preprocessor unchanged)
467+
468+Accepts
469+-------
470+
471+`don` is an [`++udon`]().
472+
473+Produces
474+--------
475+
476+An `++udon`.
477+
478+Source
479+------
480+
481+ ++ limp :: invert patch
482+ |= don=udon ^- udon
483+ :- p.don
484+ ?+ -.q.don ~|(%unsupported !!)
485+ %a [%a q.q.don p.q.don]
486+ %c [%c (berk p.q.don)]
487+ %d [%d q.q.don p.q.don]
488+ ==
489+ ::
490+
491+Examples
492+--------
493+
494+ ~zod/try=> (limp [%a %a 20 40])
495+ [p=%a q=[%a p=40 q=20]]
496+ ~zod/try=> (limp [%c %c ~[`20 [%| ~[52 53] ~[51]] `6]])
497+ [p=%c q=[%c p=~[[%.y p=20] [%.n p=~[51] q=~[52 53]] [%.y p=6]]]]
498+ ~zod/try=> (limp [%a %d [[%0 1] [%0 1]] [%0 2]])
499+ [p=%a q=[%d p=[%0 p=2] q=[p=[%0 p=1] q=[%0 p=1]]]]
500+
501+------------------------------------------------------------------------
502+
503+### `++hump`
504+
505+Prep for diff
506+
507+Prep atom for diff: leave alone, cue, or split by newlines.
508+
509+Accepts
510+-------
511+
512+A cell of an [`++umph`](), `pum`, and a [noun](), `src`.
513+
514+Produces
515+--------
516+
517+A noun.
518+
519+Source
520+------
521+
522+ ++ hump :: general prepatch
523+ |= [pum=umph src=*] ^- *
524+ ?+ pum ~|(%unsupported !!)
525+ %a src
526+ %b (cue ((hard ,@) src))
527+ %c (lore ((hard ,@) src))
528+ ==
529+ ::
530+
531+Examples
532+--------
533+
534+ ~zod/try=> (hump %a ~)
535+ 0
536+ ~zod/try=> (hump %a 40)
537+ 40
538+ ~zod/try=> (hump %c 40)
539+ [40 0]
540+ ~zod/try=> (hump %c 'as')
541+ [29.537 0]
542+ ~zod/try=> (hump %c 'as\0alok')
543+ [29.537 7.040.876 0]
544+ ~zod/try=> (hump %b 0vph)
545+ [1 1]
546+
547+------------------------------------------------------------------------
548+
549+### `++husk`
550+
551+Atomize post diff
552+
553+Re-atomize after diff: leave alone, jam, or join with newlines.
554+
555+Accepts
556+-------
557+
558+A cell of an [`++umph`](), `pum`, and a [noun](), `dst`.
559+
560+Produces
561+--------
562+
563+A noun.
564+
565+Source
566+------
567+
568+ ++ husk :: unprepatch
569+ |= [pum=umph dst=*] ^- *
570+ ?+ pum ~|(%unsupported !!)
571+ %a dst
572+ %b (jam dst)
573+ %c (role ((hard (list ,@)) dst))
574+ ==
575+ ::
576+
577+Examples
578+--------
579+
580+ ~zod/try=> (husk %a 0)
581+ 0
582+ ~zod/try=> (husk %a 40)
583+ 40
584+ ~zod/try=> (husk %c [40 0])
585+ 2.600
586+ ~zod/try=> (rip 3 (,@ (husk %c [40 0])))
587+ ~[40 10]
588+ ~zod/try=> (husk %c [%as 0])
589+ 684.897
590+ ~zod/try=> (husk %c [%as 0])
591+ 684.897
592+ ~zod/try=> (,@t (husk %c [%as 0]))
593+ '''
594+ as
595+ '''
596+ ~zod/try=> (husk %c [%as %lok 0])
597+ 2.932.876.065.272.673
598+ ~zod/try=> (,@t (husk %c [%as %lok 0]))
599+ '''
600+ as
601+ lok
602+ '''
603+ ~zod/try=> (husk %b [1 1])
604+ 817
605+ ~zod/try=> (,@uv (husk %b [1 1]))
606+ 0vph
607+ ~zod/try=> ~0ph
608+ [1 1]
609+
610+------------------------------------------------------------------------
611+
612+### `++lurk`
613+
614+Apply list patch
615+
616+Amend list using an urge: [`++list`]() of `[%& {number skipped}]` and
617+`[%| old new]`
618+
619+
620+Accepts
621+-------
622+
623+A cell of a `++list` of [noun]()s, `hel`, and an [`++urge`]() of a noun, `rug`.
624+
625+Produces
626+--------
627+
628+A `++list` of nouns.
629+
630+Source
631+------
632+
633+ ++ lurk :: apply list patch
634+ |* [hel=(list) rug=(urge)]
635+ ^+ hel
636+ =+ war=`_hel`~
637+ |- ^+ hel
638+ ?~ rug (flop war)
639+ ?- -.i.rug
640+ &
641+ %= $
642+ rug t.rug
643+ hel (slag p.i.rug hel)
644+ war (weld (flop (scag p.i.rug hel)) war)
645+ ==
646+ ::
647+ |
648+ %= $
649+ rug t.rug
650+ hel =+ gur=(flop p.i.rug)
651+ |- ^+ hel
652+ ?~ gur hel
653+ ?>(&(?=(^ hel) =(i.gur i.hel)) $(hel t.hel, gur t.gur))
654+ war (weld q.i.rug war)
655+ ==
656+ ==
657+ ::
658+
659+Examples
660+--------
661+
662+ ~zod/try=> (lurk "hema" `(urge char)`~[`1 [%| "e" "ru"] `2])
663+ "hurma"
664+ ~zod/try=> (lurk "koltep" `(urge char)`~[`3 [%| "et" ""] `1])
665+ "kolp"
666+
667+------------------------------------------------------------------------
668+
669+### `++lusk`
670+
671+`lcs` to list patch
672+
673+Using a common sequence, generate urge from two [`++list`]()s.
674+
675+
676+Accepts
677+-------
678+
679+A cell of three `++list`s of [noun](), `hel`, `hev`, and `lcs`.
680+
681+Produces
682+--------
683+
684+Source
685+------
686+
687+ ++ lusk :: lcs to list patch
688+ |* [hel=(list) hev=(list) lcs=(list)]
689+ =+ ^= rag
690+ ^- $% [& p=@ud]
691+ [| p=_lcs q=_lcs]
692+ ==
693+ [%& 0]
694+ => .(rag [p=rag q=*(list ,_rag)])
695+ =< abet =< main
696+ |%
697+ ++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag))
698+ ++ done
699+ |= new=_p.rag
700+ ^+ rag
701+ ?- -.p.rag
702+ | ?- -.new
703+ | [[%| (weld p.new p.p.rag) (weld q.new q.p.rag)] q.rag]
704+ & [new [p.rag q.rag]]
705+ ==
706+ & ?- -.new
707+ | [new ?:(=(0 p.p.rag) q.rag [p.rag q.rag])]
708+ & [[%& (add p.p.rag p.new)] q.rag]
709+ ==
710+ ==
711+ ::
712+ ++ main
713+ |- ^+ +
714+ ?~ hel
715+ ?~ hev
716+ ?>(?=(~ lcs) +)
717+ $(hev t.hev, rag (done %| ~ [i.hev ~]))
718+ ?~ hev
719+ $(hel t.hel, rag (done %| [i.hel ~] ~))
720+ ?~ lcs
721+ +(rag (done %| (flop hel) (flop hev)))
722+ ?: =(i.hel i.lcs)
723+ ?: =(i.hev i.lcs)
724+ $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
725+ $(hev t.hev, rag (done %| ~ [i.hev ~]))
726+ ?: =(i.hev i.lcs)
727+ $(hel t.hel, rag (done %| [i.hel ~] ~))
728+ $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
729+ --
730+
731+Examples
732+--------
733+
734+ ~zod/try=> (lusk "hamok" "hasok" "haok")
735+ ~[[%.y p=2] [%.n p="m" q="s"] [%.y p=2]]
736+ ~zod/try=> (lusk "hamok" "hasok" "hak")
737+ ~[[%.y p=2] [%.n p="om" q="os"] [%.y p=1]]
738+ ~zod/try=> (lusk "telroga" "tesomga" "teoga")
739+ ~[[%.y p=2] [%.n p="rl" q="s"] [%.y p=1] [%.n p="" q="m"] [%.y p=2]]
740+ ~zod/try=> (lurk "telroga" `(urge char)`~[[%.y p=2] [%.n p="rl" q="s"] [%.y p=1] [%.n p="" q="m"] [%.y p=2]])
741+ "tesomga"
742+
743+------------------------------------------------------------------------
744+
745+### `++nude`
746+
747+Tree change
748+
749+Generate tree diff from two nouns.
750+
751+Accepts
752+-------
753+
754+A cell of two nouns, `a` and `b`.
755+
756+Produces
757+--------
758+
759+A cell of two [`++upas`](), `p` and `q`.
760+
761+Source
762+------
763+
764+ ++ nude :: tree change
765+ |= [a=* b=*]
766+ ^- [p=upas q=upas]
767+ =< [p=(tred a b) q=(tred b a)]
768+ |%
769+ ++ axes :: locs of nouns
770+ |= [a=@ b=*] ^- (map ,* axis)
771+ =+ c=*(map ,* axis)
772+ |- ^- (map ,* axis)
773+ => .(c (~(put by c) b a))
774+ ?@ b
775+ c
776+ %- ~(uni by c)
777+ %- ~(uni by $(a (mul 2 a), b -.b))
778+ $(a +((mul 2 a)), b +.b)
779+ ::
780+ ++ tred :: diff a->b
781+ |= [a=* b=*] ^- upas
782+ =| c=(unit ,*)
783+ =+ d=(axes 1 a)
784+ |- ^- upas
785+ => .(c (~(get by d) b))
786+ ?~ c
787+ ?@ b
788+ [%1 b]
789+ =+ e=^-(upas [$(b -.b) $(b +.b)])
790+ ?- e
791+ [[%1 *] [%1 *]] [%1 [p.p.e p.q.e]]
792+ * e
793+ ==
794+ [%0 u.c]
795+ --
796+
797+Examples
798+--------
799+
800+ ~zod/try=> (nude 40 20)
801+ [p=[%1 p=20] q=[%1 p=40]]
802+ ~zod/try=> (nude [5 5] 5)
803+ [p=[%0 p=3] q=[p=[%0 p=1] q=[%0 p=1]]]
804+ ~zod/try=> (nude "sam" "sal")
805+ [ p=[p=[%1 p=115] q=[p=[%1 p=97] q=[p=[%1 p=108] q=[%0 p=15]]]]
806+ q=[p=[%1 p=115] q=[p=[%1 p=97] q=[p=[%1 p=109] q=[%0 p=15]]]]
807+ ]
808+
809+------------------------------------------------------------------------
810+