4A- more or less low priority and/or currently in the wrong section
7------------------------------------------------------------------------
9------------------------------------------------------------------------
15Inverts a list of changes `bur`. Skips stay constant and replaces are
16swapped. Produces a `bur`.
21`bur` is a [`++urge`]().
26The `++urge` of a noun.
31 ++ berk :: invert diff patch
38 | [%| q.i.bur p.i.bur]
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])
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]))
54------------------------------------------------------------------------
60Produces a patch between two nouns, by change type
65`pum` is an [`++umph`]().
75 ++ diff :: generate patch
77 |= [old=* new=*] ^- udon
79 ?+ pum ~|(%unsupported !!)
80 %a [%d (nude old new)]
81 %b =+ [hel=(cue ((hard ,@) old)) hev=(cue ((hard ,@) new))]
83 %c =+ [hel=(lore ((hard ,@) old)) hev=(lore ((hard ,@) new))]
84 [%c (lusk hel hev (loss hel hev))]
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])
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]]]
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]]]
113------------------------------------------------------------------------
119Finds a subsequence of repeated elements within two [`++list`]()s, using
120several internal helper arms. Produces a [`++tape`]().
125`hel` is a [`++list`]() of [nouns]().
127`hev` is a [++list`]() of nouns.
134A [++list`]() of nouns.
139 ++ loss :: longest subsequence
141 |* [hel=(list) hev=(list)]
144 =+ [inx=0 sev=*(map ,@t (list ,@ud))]
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])]
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))))
158 ++ lonk :: extend fits bottom
159 |= [inx=@ud goy=@ud] ^- ?
160 |(=(0 inx) (gth goy p:(need (~(get by q.gox) (dec inx)))))
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))))]
172 ++ merg :: merge all matches
176 =+ [inx=0 zes=*(list ,[p=@ud q=@ud])]
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])
183 ?~(zes +>.^$ $(zes t.zes, +>.^$ (lune i.zes)))
190 $(hev t.hev, rag (done %| ~ [i.hev ~]))
192 $(hel t.hel, rag (done %| [i.hel ~] ~))
194 +(rag (done %| (flop hel) (flop hev)))
197 $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
198 $(hev t.hev, rag (done %| ~ [i.hev ~]))
200 $(hel t.hel, rag (done %| [i.hel ~] ~))
201 $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
207 ~zod/try=> (loss "sam" "sem")
209 ~zod/try=> (loss "samo" "semo")
211 ~zod/try=> (loss "sakmo" "semo")
213 ~zod/try=> (loss "ferdinham" "ferdilapos
214 ~ <syntax error at [1 30]>
215 ~zod/try=> (loss "ferdinham" "ferdilapos")
218------------------------------------------------------------------------
224Finds a subsequence of repeated elements within two
225[`++list`](/doc/hoon/library/1#++list)s, producing a [\`++tape]().
230A cell of two `++tape`s, `hel` and `hev`.
240 ++ locz :: trivial algorithm
241 |= [hel=tape hev=tape]
243 =+ [leh=(lent hel) veh=(lent hev)]
248 ?: |(=(0 leh) =(0 veh)) [0 ~]
249 =+ [dis=(snag (dec leh) hel) dat=(snag (dec veh) hev)]
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)
260 ~zod/try=> (locz "samukot" "semelkot")
262 ~zod/try=> (locz "samukot" "samelkot")
265------------------------------------------------------------------------
271Split on newlines, ascii `10`
283A `++list` of atoms of odor [`@t`]() ([`++cord`]()).
287 ++ lore :: atom to line list
292 ?: =(0 lub) (flop tez)
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))
301 $(lub res, tez [(end 3 meg lub) tez])
307 ~zod/try=> (lore 'soke\0alas\0amep')
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)')]
318------------------------------------------------------------------------
324Join line list with newlines.
329A `++list` of atoms of [odor]() [`@t`]() ([`++cord`]()).
336An atom of [odor]() [`@t`]() ([`++cord`]().
341 ++ role :: line list to atom
343 (rap 3 (turn tez |=(a=@t (cat 3 a 10))))
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' ~)
358------------------------------------------------------------------------
364Use [`++udon`]() to change [noun]().
369A cell of an `++udon`, `don`, and a noun, `src`.
379 ++ lump :: apply patch
382 ?+ p.don ~|(%unsupported !!)
384 ?+ -.q.don ~|(%unsupported !!)
386 %c (lurk ((hard (list)) src) p.q.don)
387 %d (lure src p.q.don)
391 =+ dst=(lore ((hard ,@) src))
393 ?+ -.q.don ~|(%unsupported !!)
394 %a ((hard (list ,@t)) q.q.don)
395 %c (lurk dst p.q.don)
403 ~zod/try=> (lump [%a %a 20 25] 20)
405 ~zod/try=> (lump [%a %d [[%0 1] [%0 1]] [%0 2]] 20)
407 ~zod/try=> (lump [%c %a ~['sa' 'le'] ~['sa' 'lo']] 'sa\0ale')
409 ~zod/try=> (,@t (lump [%c %a ~['sa' 'le'] ~['sa' 'lo']] 'sa\0ale'))
414 ~zod/try=> (,@t (lump [%c %c `1 [%| ~['le'] ~['lo' 'ma']] ~] 'sa\0ale'))
421------------------------------------------------------------------------
427Patch a by references to axis and literal.
432A cell of a [noun](), `a`, and an [`++upas`](), `b`.
442 ++ lure :: apply tree diff
447 ?+ -.b ~|(%unsupported !!)
455 ~zod/try=> (lure ~[1 2] [[%0 2] [%1 3] [%0 7]])
457 ~zod/try=> (lure ~[1 2 4] [[%0 2] [%1 3] [%0 7]])
460------------------------------------------------------------------------
466Reverse a patch (preprocessor unchanged)
471`don` is an [`++udon`]().
481 ++ limp :: invert patch
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]
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]]]]
501------------------------------------------------------------------------
507Prep atom for diff: leave alone, cue, or split by newlines.
512A cell of an [`++umph`](), `pum`, and a [noun](), `src`.
522 ++ hump :: general prepatch
523 |= [pum=umph src=*] ^- *
524 ?+ pum ~|(%unsupported !!)
526 %b (cue ((hard ,@) src))
527 %c (lore ((hard ,@) src))
534 ~zod/try=> (hump %a ~)
536 ~zod/try=> (hump %a 40)
538 ~zod/try=> (hump %c 40)
540 ~zod/try=> (hump %c 'as')
542 ~zod/try=> (hump %c 'as\0alok')
544 ~zod/try=> (hump %b 0vph)
547------------------------------------------------------------------------
553Re-atomize after diff: leave alone, jam, or join with newlines.
558A cell of an [`++umph`](), `pum`, and a [noun](), `dst`.
568 ++ husk :: unprepatch
569 |= [pum=umph dst=*] ^- *
570 ?+ pum ~|(%unsupported !!)
573 %c (role ((hard (list ,@)) dst))
580 ~zod/try=> (husk %a 0)
582 ~zod/try=> (husk %a 40)
584 ~zod/try=> (husk %c [40 0])
586 ~zod/try=> (rip 3 (,@ (husk %c [40 0])))
588 ~zod/try=> (husk %c [%as 0])
590 ~zod/try=> (husk %c [%as 0])
592 ~zod/try=> (,@t (husk %c [%as 0]))
596 ~zod/try=> (husk %c [%as %lok 0])
597 2.932.876.065.272.673
598 ~zod/try=> (,@t (husk %c [%as %lok 0]))
603 ~zod/try=> (husk %b [1 1])
605 ~zod/try=> (,@uv (husk %b [1 1]))
610------------------------------------------------------------------------
616Amend list using an urge: [`++list`]() of `[%& {number skipped}]` and
623A cell of a `++list` of [noun]()s, `hel`, and an [`++urge`]() of a noun, `rug`.
633 ++ lurk :: apply list patch
634 |* [hel=(list) rug=(urge)]
643 hel (slag p.i.rug hel)
644 war (weld (flop (scag p.i.rug hel)) war)
650 hel =+ gur=(flop p.i.rug)
653 ?>(&(?=(^ hel) =(i.gur i.hel)) $(hel t.hel, gur t.gur))
654 war (weld q.i.rug war)
662 ~zod/try=> (lurk "hema" `(urge char)`~[`1 [%| "e" "ru"] `2])
664 ~zod/try=> (lurk "koltep" `(urge char)`~[`3 [%| "et" ""] `1])
667------------------------------------------------------------------------
673Using a common sequence, generate urge from two [`++list`]()s.
679A cell of three `++list`s of [noun](), `hel`, `hev`, and `lcs`.
687 ++ lusk :: lcs to list patch
688 |* [hel=(list) hev=(list) lcs=(list)]
694 => .(rag [p=rag q=*(list ,_rag)])
697 ++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag))
703 | [[%| (weld p.new p.p.rag) (weld q.new q.p.rag)] q.rag]
704 & [new [p.rag q.rag]]
707 | [new ?:(=(0 p.p.rag) q.rag [p.rag q.rag])]
708 & [[%& (add p.p.rag p.new)] q.rag]
717 $(hev t.hev, rag (done %| ~ [i.hev ~]))
719 $(hel t.hel, rag (done %| [i.hel ~] ~))
721 +(rag (done %| (flop hel) (flop hev)))
724 $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
725 $(hev t.hev, rag (done %| ~ [i.hev ~]))
727 $(hel t.hel, rag (done %| [i.hel ~] ~))
728 $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
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]])
743------------------------------------------------------------------------
749Generate tree diff from two nouns.
754A cell of two nouns, `a` and `b`.
759A cell of two [`++upas`](), `p` and `q`.
764 ++ nude :: tree change
767 =< [p=(tred a b) q=(tred b a)]
769 ++ axes :: locs of nouns
770 |= [a=@ b=*] ^- (map ,* axis)
773 => .(c (~(put by c) b a))
777 %- ~(uni by $(a (mul 2 a), b -.b))
778 $(a +((mul 2 a)), b +.b)
785 => .(c (~(get by d) b))
789 =+ e=^-(upas [$(b -.b) $(b +.b)])
791 [[%1 *] [%1 *]] [%1 [p.p.e p.q.e]]
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]]]]
809------------------------------------------------------------------------
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list