jamii
09/30/2019, 6:09 PMstevekrouse
jamii
10/01/2019, 10:06 AMfruit -> fruit
is the set of ("apples" x "apples" | "foo" x "foo" etc...)
. So when you join it with colors, the intersection is empty.jamii
10/01/2019, 10:08 AMcolors (fruit color -> color)
will return just the colors, without the fruits.jamii
10/01/2019, 10:27 AMcolors (fruit -> some)
stevekrouse
fruit -> fruit
also contain (apples x red) x (apples x red)
?jamii
10/01/2019, 5:07 PM(apples x red) x (apples x red)
= (apples x red x apples x red)
which has arity 4. fruit -> fruit
has arity two.jamii
10/01/2019, 5:08 PM->
to a different symbol that has less preconceptions attached...jamii
10/01/2019, 5:08 PMScalar = Integer + String
Value = union_all({ Scalar^i | i in Naturals })
Environment = Name -> Value
M: Environment -> Expression -> Value
M[[ env, 42 ]] = {(42,)}
M[[ env, A | B ]] = union(M[[ env, A ]], M[[ env, B ]])
M[[ env, A & B ]] = intersect(M[[ env, A ]], M[[ env, B ]])
M[[ env, A x B ]] = product(M[[ env, A ]], M[[ env, B ]])
M[[ env, !A ]] = if M[[ env, A ]] = {} then {()} else {}
M[[ env, name ]] = env(name) // handwave about no undefined names
M[[ env, let name = A in B ]] = M[[ bind(env, name, M[[ env, B ]]), C ]]
M[[ env, A B ]] = union_all({ product(a[n..], b[n..]) | a in M[[ env, A ]], b in M[[ env, B ]], n = min(len(a), len(b)), if a[1..n] = b[1..n] })
M[[ env, name -> B ]] = union_all({ product({(a,)}, M[[ bind(env, name, a), B ]]) | a in Scalar })
D: Expression -> Value
D[[ A ]] = M[[ (_ -> missing), A ]]
jamii
10/01/2019, 9:34 PMwtaysom
10/02/2019, 5:52 AM->
notation, let me tell you what my first guess from it, then you can evaluate whether it's good or not. (I'm sure I'd figure it out from reading carefully, but the whole point is first impressions.) Now ->
should have a functiony, implicationy sort of meaning. let inc = a -> a + 1
. Looks like a typical lambda to me, introducing a
as a variable, the normal thing.
"Well, the value of inc is a set of tuples." Do we really mean "is"? Does it work basically the same way? Let's see... "apples" colors
. Oh! Yes. There it is. Okay, I'll buy it. You can use a ->
construct in the same places you can use a tuple. So sure, "inc is a set of tuples." Though not any set of tuples...
One would initially expect a ->
to associate one output for every input. But that's totally not how it is going to work! In fact, I expect "apples" (fruit -> fruit colors)
to be "red" | "green"
. Moreover, Eta conversion should hold with x -> x t
being the same as t
always.wtaysom
10/02/2019, 5:53 AMwtaysom
10/02/2019, 5:53 AMx
up there. Hmm... thinking.)wtaysom
10/02/2019, 5:55 AMwtaysom
10/02/2019, 5:56 AMlet hmm = a -> a x a in
(3 x 3) q
wtaysom
10/02/2019, 6:00 AMhmm = [|a| a, a, a]
3, 3 . hmm
wtaysom
10/02/2019, 6:08 AMx
. Though let ... in
is easy to parse it's annoying to type/read. but importantly with the Smalltalk block syntax, you aren't conflating the introduction of a variable with a mapping of that variable to something else. And the scope is explicit whereas something like a Prolog hmm(A, A, A).
doesn't compose particularly well. Finally, notice that with the block syntax, dec = [|a| a + 1, a]
feels really natural.Edward de Jong / Beads Project
10/02/2019, 7:51 AMwtaysom
10/02/2019, 8:55 AMwtaysom
10/02/2019, 12:21 PMwow = 6 | 5 | 3
, you could print 6 | 5 | 3
by default instead of the standard order 3 | 5 | 6
. There's a natural way to extend this definitional order across operators. It's not simplest, but it is least surprising in its own way. Of course, the operators wouldn't commute with respect to order, but I think associativity is preserved.Breck Yunits
10/02/2019, 9:54 PMwtaysom
10/02/2019, 11:51 PMjamii
10/10/2019, 1:47 AMBreck Yunits
10/10/2019, 5:10 AMjamii
10/14/2019, 1:01 AMjamii
10/14/2019, 1:01 AMjamii
10/18/2019, 11:47 PMjamii
02/03/2020, 12:52 AMjamii
05/01/2020, 1:06 AM