From 7b095d47c8f58cff4e89b5ca6f07634fc450d86d Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Wed, 18 Jun 2014 20:27:36 -0700 Subject: [PATCH] Today's modifications. --- arvo/eyre.hoon | 11 ++-- arvo/hoon.hoon | 12 ++--- arvo/zuse.hoon | 21 ++++---- main/app/philbug/app.js | 3 +- main/app/philbug/core.hoon | 100 +++++++++++++++++++++---------------- main/app/philbug/urb.js | 2 +- 6 files changed, 83 insertions(+), 66 deletions(-) diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index 3354a36f02..62575582b1 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -2009,16 +2009,15 @@ q.rey %+ ~(put by q.rey) num ^- pimp + =+ quo=|=(a=cord :(weld "\"" (trip a) "\"")) %= pip pez %new - vaz :~ [%ship :(weld "\"" (trip (rsh 3 1 (scot %p our))) "\"")] + vaz :~ [%ship (quo (rsh 3 1 (scot %p our)))] + [%appn (quo app)] [%port (trip (rsh 3 2 (scot %ui nap)))] [%auto "true"] - [%oryx "oryx"] - :- %user - :: ?: =(our you) - :: "null" - :(weld "\"" (trip (rsh 3 1 (scot %p you))) "\"") + [%oryx (quo orx.ced)] + [%user (quo (rsh 3 1 (scot %p our)))] == sip sip som ^- seam diff --git a/arvo/hoon.hoon b/arvo/hoon.hoon index 9744b84503..112d5ab49d 100644 --- a/arvo/hoon.hoon +++ b/arvo/hoon.hoon @@ -1918,12 +1918,6 @@ b $(a r.a, b [n.a $(a l.a)]) :: - +- tur :: turn - |* b=$+([* *] *) - |- - ?~ a ~ - [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)] - :: +- uni :: union ~/ %uni |* b=_a @@ -1944,6 +1938,12 @@ $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a) $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a) :: + +- urn :: turn + |* b=$+([* *] *) + |- + ?~ a ~ + [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)] + :: +- wyt :: depth of map .+ |- ^- @ diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon index bdeb39b42c..7daf839e4c 100644 --- a/arvo/zuse.hoon +++ b/arvo/zuse.hoon @@ -2217,18 +2217,19 @@ r=httq :: == :: ++ kite ,[p=care q=case r=ship s=desk t=spur] :: parsed global name -++ json :: json top level - $% [%a p=(list jval)] :: array - [%o p=(map ,@t jval)] :: object +++ json :: normal json value + $| ~ :: + $% [%a p=(list json)] :: array + [%b p=?] :: boolean + [%o p=(map ,@t json)] :: object + [%n p=@ta] :: number + [%s p=@ta] :: string == :: -++ jval :: json value - $| ~ :: null - $? json :: - $% [%b p=?] :: boolean - [%n p=@ta] :: number - [%s p=@ta] :: string - == :: +++ jsot :: strict JSON top + $% [%a p=(list json)] :: array + [%o p=(map ,@t json)] :: object == :: +++ jval json :: XX compatibility ++ lamb :: short path $% [& p=@tas] :: auto [| p=twig] :: manual diff --git a/main/app/philbug/app.js b/main/app/philbug/app.js index 0f6d738619..f98e639973 100644 --- a/main/app/philbug/app.js +++ b/main/app/philbug/app.js @@ -1,6 +1,6 @@ window.onload = function() { - data = {} + var data = {} change = function(_data) { for(i in _data) { @@ -28,6 +28,7 @@ window.onload = function() { window.urb.send(d) } + window.urb.send(null); window.urb.subscribe("frog","goof", function(err,res) { if(err) return console.log('cannot connect to frog/goof') diff --git a/main/app/philbug/core.hoon b/main/app/philbug/core.hoon index 0372e6c5ce..2a2c9dddd4 100644 --- a/main/app/philbug/core.hoon +++ b/main/app/philbug/core.hoon @@ -12,6 +12,10 @@ [%rasp gilt] == ++ move ,[p=bone q=[%give p=gift]] + ++ phil + $% [%new ~] + [%add p=(list ,@p)] + == -- |= * |_ [hid=hide vat=axle] @@ -23,7 +27,21 @@ ++ root /(scot %p our.hid)/main/(scot %da lat.hid)/app/[app.hid] :: -++ page +++ respond :: respond to message + |= ost=bone + `move`[ost %give %rasp %json *json] +:: +++ update :: update subscribers + ^- (list move) + %+ turn + ^- (list bone) + %+ ~(rep by sup.hid) *(list bone) + |= [p=[p=bone q=[ship path]] q=(list bone)] ^- (list bone) + ?. =(/goof +.q.p) q + [p.p q] + send-vat +:: +++ render ^- manx ;html ;head @@ -41,14 +59,8 @@ == == ;body - ;p: Hello. - ;table#cont ;tbody - ;* %+ turn - %+ sort (~(tap by p.vat) ~) - |= [p=[u=@p n=@ud] q=[u=@p n=@ud]] (gth n.p n.q) - |= [u=@p n=@ud] - ;tr(id (slag 1 )):(td:(-) td:(-)) - == == + ;p: Yo. + ;table#cont:tbody; ;p: Select a ship ;button(onclick "goof()"): Give 5 points == @@ -57,45 +69,49 @@ ++ peer |= [ost=bone you=ship pax=path] ^- [(list move) _+>] - ?: =(~ pax) - =. p.vat (~(put by p.vat) you (fall (~(get by p.vat) you) _@ud)) - [[ost %give %rust %hymn page]~ +>] :_ +> - ~[(send-vat ost (turn (~(tap by p.vat)) |=([p=@p q=@ud] p)))] + ?: =(/ pax) + [ost %give %rust %hymn render]~ + [(send-vat ost) ~] +:: +++ poke-phil + |= [ost=bone you=ship pil=phil] + =. p.vat + ?- -.pil + %new (~(put by p.vat) you (fall (~(get by p.vat) you) _@ud)) + %add %- ~(tur by p.vat) + |= [u=@p n=@ud] + ?. (lien p.pil |=(a=@p =(a u))) + n + (add 5 n) + == + [[(respond ost) update] +>.$] :: ++ poke-json |= [ost=bone you=ship jon=json] - ^- [(list move) _+>] - ~& [%poke [%state p.vat] ost you] - =+ j=(,[%a p=(list ,[%s p=@t])] jon) - =. p.vat - %- ~(tur by p.vat) - |= [u=@p n=@ud] - ?. (lien p.j |=([%s p=@t] =((slav %p (cat 3 '~' p)) u))) - n - (add 5 n) - :_ +>+ - :- [ost %give %rasp %json jon] - %+ turn - ^- (list bone) - %+ ~(rep by sup.hid) *(list bone) - |= [p=[p=bone q=[ship path]] q=(list bone)] ^- (list bone) - ?. =(/goof +.q.p) q - [p.p q] - |= o=bone - %+ send-vat o - %+ turn p.j - |= [%s p=@t] - (slav %p (cat 3 '~' p)) + ~& [%poke-json jon] + %^ poke-phil ost you + ^- phil + ?+ -.jon !! + %o [%new ~] + %a :- %add + %+ turn p.jon + |= a=json + ?> ?=([%s *] a) + (slav %p (cat 3 '~' p.a)) + == +:: ++ send-vat - |= [o=bone l=(list ,@p)] - :* o %give %rust %json %o + |= ost=bone + =+ luz=(~(tap by p.vat) ~) + ^- move + :* ost %give %rust %json %o ^- (map ,@t jval) %- mo - %+ turn l - |= p=@p - :- (rsh 3 1 (scot %p p)) :- %n - %^ rsh 3 2 - (scot %ui (fall (~(get by p.vat) p) _@ud)) + %+ turn luz + |= [a=@p b=@ud] + :- (rsh 3 1 (scot %p a)) + :- %n + (rsh 3 2 (scot %ui b)) == -- diff --git a/main/app/philbug/urb.js b/main/app/philbug/urb.js index 3352a9e6f7..d4d8017b4d 100644 --- a/main/app/philbug/urb.js +++ b/main/app/philbug/urb.js @@ -4,7 +4,7 @@ window.urb = { auto: auto, oryx: oryx, user: user, - appn: "foobug", + appn: appn, seqn: 0, seqp: 1, dely: 0,