Discussion:
[urbit] Generic currying gate
c***@gmail.com
9 years ago
Permalink
I think I have a puzzle for you: is it possible to make a gate ++hask such
that (f 1 2 3) and ((((hask f) 1) 2) 3) are the same? We have ++cury and
++curr, but you have to manually curry each parameter.

I've been playing around trying to get this working for a while now, and
have been hitting snags (including one that looks like it looped the type
system...), since you have to propagate the current sample type forward in
the initial core but STOP chaining if you reach the end. There's also the
slight problem in that samples are improper lists so you can't tell the
difference between @ -> @ -> @ and (@ @) -> @
My attempt so far unfortunately type-fails at the second param :(

:- %say
|= [^ ~ ~]
:- %noun
|^
=+ a=(hask f)
((a 1) 2)
++ hask
|* a=_|=(* **)
?: ?=(^ +<.a)
|= b=_+<-.a
...(a |=(c=_+<+.a ((cury a b) c)))
|= b=_+<.a
(a b)
::
++ f
|= [a=@ b=@ c=@]
:(mul a b c)
--
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c***@gmail.com
9 years ago
Permalink
The type system is getting very angry at me, and is spewing errors, but it
*looks* like it should type-check...it (correctly) rejects ((a 1) [2 3])
too, somehow. I'm pretty much out of ideas on how to get this working, too.

:- %say
|= [^ ~ ~]
:- %noun
|^
=+ a=(hask f)
(((a 1) 2) 3)
++ hask
|* a=_|=(* **)
?: ?=(^ +<.a)
|= b=_+<-.a
(hask |=(c=_+<+.a (cury (cury a b) c)))
|= b=_+<.a
(a b)
::
++ f
|= [a=@ b=@ c=@]
:(mul a b c)
--
...
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Curtis Yarvin
9 years ago
Permalink
Do you mean this as the special case of 3 args, or do you want n-ary? The latter is obviously harder...

Sent from my iPhone
...
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c***@gmail.com
9 years ago
Permalink
n-ary favorably. All args being atoms is a semi-valid assumption to make,
if it makes it easier.
My Hoon-foo doesn't seem up to snuff, and I'm beginning to doubt it's
possible at all. I don't see any examples of walking the type of gate
samples in the stdlib, so I don't know if anyone has tried it before.
Hoon's tuples don't have length type information in them, which makes it
harder, and even if they did don't have associated types or type level
numbers for it.
...
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Curtis Yarvin
9 years ago
Permalink
I don't think n-ary is possible. With fixed arity, I'd just use %= to compose the sample of f "by hand" - this should work pretty trivially.

Sent from my iPhone
...
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raymond Pasco
9 years ago
Permalink
I think the fully general version is dependent-types complete, but that's
just my type intuition, I haven't actually spent any time reasoning it out.

Yours,
r
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Curtis Yarvin
9 years ago
Permalink
Also, you could do it if you force the sample of f to be list-shaped, I think. But a tuple isn't as iterable... no, wait, it might be doable. Might be. But I'd try constant first, then list.

Sent from my iPhone
...
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anton Dyudin
9 years ago
Permalink
I have definitely written code that e.g. unrolls an improper list of
functions into a proper one preserving their respective input types, so
that shouldn't be the limiting factor.
...
--
Cabmold delenda est
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...