+
Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Conversation

joemfb
Copy link
Contributor

@joemfb joemfb commented May 25, 2019

This PR fixes higher-order molds (ie, +* specs) in cases where their parameters are bunted. It does so be explicitly defaulting the $- to an identity function.

Before:

> ((pair) [1 2])
[p=0 q=0]
> ((list) [1 2 3 ~])
~[0 0 0]
> ((tree) (sy 1 2 3 ~))
{0 0 0}

After:

> ((pair) [1 2])
[p=1 q=2]
> ((list) [1 2 3 ~])
~[1 2 3]
> ((tree) (sy 1 2 3 ~))
{1 2 3}

Copy link

@belisarius222 belisarius222 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I feel like there's a nugget of wisdom about universal quantification and our defaulting system here, but I can't articulate it.

One thing to note is that mold builders defined manually would not benefit from this change and must adjust the bunts of their own mold parameters. I'm not confident we even support manually constructed mold builders outside of +* anymore, though, so that might not matter.

@joemfb
Copy link
Contributor Author

joemfb commented May 25, 2019

I disagree with your unarticulated nugget! Or rather, I disagree with the implication of universality. In particular, it's easy to conflate +mold with $-, but this is simply wrong. A mold is first of all an identity* function, and it's potential properties of partiality or non-identity are subservient to this spirit. $- is never an identity function, asterisk or otherwise (unless it's clammed on the bunt of its product mold). +mold is in fact defined as _|~(* +<). The macro expansion for +* was just wrong.

It might be clearer and more accurate to define +mold (and the +* expansion) as $~(* $-(* *)).

And it's worth noting that the different arm types should be represented in +hoon (or maybe +synthetic-hoon), and expanded in +open:ap as is right and proper. Expanding (and effectively defining) them in a cooked parser gate is Not Good(tm).

@joemfb
Copy link
Contributor Author

joemfb commented May 25, 2019

I would say that we don't have the capability to not support manually-defined mold-builders, although they should be frowned upon. Ironically enough, they already don't have this problem due to the definition of +mold given above.

@belisarius222
Copy link

belisarius222 commented May 25, 2019 via email

@joemfb joemfb requested a review from belisarius222 May 25, 2019 18:09
@belisarius222
Copy link

LGTM upon re-review

@philipcmonk
Copy link
Contributor

I still don't get why it's $~(* $-(* *)) instead of $~(|~(* +<) $-(* *))

@joemfb
Copy link
Contributor Author

joemfb commented May 26, 2019

It seems to me that * just is the default mold -- it's the identity function on nouns, specified axiomatically instead of by construction (at least as far as the syntax is concerned).

The macro expansion does seem a little too cute, but that's an implementation detail of +ax that can and should be rectified:

> ~(open ap (ream '*'))
[%brcl p=[%ktsg p=[%ktls p=[%bust p=%noun] q=[%ktls p=[%dttr p=[%rock p=%$ q=0] q=[p=[%rock p=%$ q=0] q=[%rock p=%$ q=1]]] q=[%rock p=%$ q=0]]]] q=[%$ p=6]]

@philipcmonk
Copy link
Contributor

Ah, okay, I see it. Relatedly, I found a nice hoon emoji:

> (*_*)
0

@jtobin jtobin merged commit 32d62ba into master May 27, 2019
@jtobin jtobin deleted the fix-ho-mold-bunts branch May 27, 2019 05:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载