Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The Avail Programming Language

Name: Anonymous 2015-02-18 5:54

Name: Anonymous 2015-02-18 6:17

Many everyday problems are hard enough to describe and solve using humanity's best tools for communication: natural language and visual metaphor. Any programmer who has ever worked on a nontrivial problem does not need to imagine the difficulty of encoding a good solution using only low-level concepts and a handful of special keywords; she does this very thing for a living! Even using best practice in software engineering, throughout her career she will solve the same adaptation problems repeatedly, gradually building up a repertoire of design patterns, mental boilerplate, dirty tricks, and professional discipline in order to compensate for the chronic deficiencies of traditional programming languages. Nevertheless, any complex project spends its early years replete with bugs that arise directly from the mismatch of the problem and solution domains.

Name: Anonymous 2015-02-18 6:31

Public method "Play Wump the Wumpus with reader_with reporter_" is
I only needed to see the first line of code on that page.

Name: Anonymous 2015-02-18 7:22

Play Hump the Wumpus

Name: Cudder !cXCudderUE 2015-02-18 13:27

With all the syntactic ambiguity and verbosity of a natural language, now you can never be sure of what you're trying to get the computer to do!

No. Just... no.

Name: Anonymous 2015-02-19 6:46

Name: markvangulik 2015-02-19 21:48

Funny you should make the absurd claim that Avail has anything to do with Haskell, then link to a page filled with things that Haskell will never be able to do:
1) maps and sets whose equality is defined only by membership, not by order.
2) semi-heterogenous tuple types (the leading types are heterogenous, and all past a particular index are homogenous, while allowing a range of tuple lengths).
3) polymorphic behavior. Haskell supports polymorphism if all your definitions occur inside the same compilation unit... yeah, all the extensibility of a switch statement with a different syntax. Functional type systems and open/closed polymorphism are inherently incompatible.

I'm sure there are many other features in Avail that Haskell could never support, even in theory. A usable exception mechanism comes to mind.

Name: Anonymous 2015-02-20 6:15

>>7
this is clearly a troll but I'll hbt anyway.

1. I don't see how this is true. Or are you complaining about Map and Set themselves?
2. What's the case for this? Shouldn't the variant part be in a variant type?
3. You had me up to the BS at the end.

Name: markvangulik 2015-02-20 21:52

Enlighten me then; I'm nowhere near an expert on Haskell. How does one construct, say, a map from sets to integers? In Avail I can say:

m : {set → integer|} := {{"foo", "bar"} → 5, {"bar"} → 6, ∅ → 7};
Print: “m[{"bar", "foo"}]”;

This prints 5. Note that I require the sets to be order-insensitive, since that's the point of what I'm saying. How would you accomplish this simple task in Haskell? I haven't been able to determine *any* way so far, but I would love to find a way. I'll have a look at the library again (it's been a *long* time), but if you find a way first, let me know.

Name: markvangulik 2015-02-20 22:32

Ok, I've looked through Data.Set. It looks like it should work just fine for the tiny category of homogenous element types that have a natural full order. And Eq converts the sets to lists to compare them with Eq. That's probably about as well as can be done in Haskell, and it's probably even reasonably efficient for a lazy language (i.e., it can give up early on unequal sets if one of the leftmost elements ("small" in the "<" sense) differs.

It looks like Map is about the same, although I couldn't figure out if it has an equality operation.

Now back to my statement. Can Haskell have a map from sets to integers? Nope. Set doesn't define an ordering operation (between Sets), so it's not allowed as the key of a Map. In Avail, *anything* can be a member of a Set. And *anything* can be the key of a Map.

As for (2), I decided to conflate the traditional notion of heterogenous tuples with homogenous lists. At first I was concerned that it might not be a good fit, and I remained ready to split the concepts, but after a while I saw that it actually worked out wonderfully. It even has a beautiful stack-like emergent property at the left end. I been fooled around with a typed Joy "implementation" in Avail. Prepending a constant number of things onto the left of a tuple preserves the detailed type information of the tuple's element types, so I treated the left end of a tuple as the Joy operand stack.

(3) Since Set can't be a key in a Map, please indicate how I would produce a KeyableSet that's a subtype of Set. It's more than a little tricky to add subtyping to a language that effectively only operates on partially-evaluated expressions. Maybe not completely impossible, but so far I'm unaware of any way it could work. It's unlikely to be doable by adding more tags.

Likewise, exceptions are a concept tied intimately to control flow, which Haskell doesn't have. For them to be useful they must indicate the failure of some operation, not the production of an unexpected result. Perhaps there may be something that subsumes them in the lazy evaluation world, but I sure haven't seen it.

Name: Anonymous 2015-02-21 6:49

>>9,10
So you are talking about Set and Map, but not sets and maps.

If you just want a map between sets and integers, consider the fact that all pure functions are mappings between values. Haskell gives you more than enough abstraction to make it pleasant.

If you're confused about exceptions, I recommend reading Wadler.

Name: Anonymous 2015-02-21 7:23

>>11
huskel is one of the worst languages ever, suck a giant nigger dick.

Name: Anonymous 2015-02-21 9:11

>>12
that argument is one of the suckest dicknigger giant language worst ever gone

Name: Anonymous 2015-02-21 9:13

>>13
Because it's not even an argument, it's just a cry of pain woeing the fact that Haskell is already much more popular than LITHP.

Name: Anonymous 2015-02-22 15:56

>>11
I'll finish reading Wadler and some related papers later.

Perhaps I'm a bit fuzzy on what you're suggesting. Is it that Haskell's idea of a function (which is completely different from functions in imperative languages) is sufficient to implement maps in general? Pretending for the moment that Haskell allows you to have two argument functions, a lookup function could take a map and a key and produce the associated value from the map. Using currying to get this in Haskell, we create a function that takes a map and produces a function that takes a key and produces the associated value. Ok, we can save that inner function instead of applying it right away, as it's already "bound" to the particular map. Is this what you're getting at? I'll assume it is for the moment.

Unfortunately, that function falls pretty short of the functionality of a map. It represents only one operation: look up a key. Maps need to be extensible (produce a new map with a key/value added, removed, or replaced), enumerable (what are the keys?), comparable (does this map have the same key/value pairs as this other map? Are they a superset?), and testable (is this key in it?). I suppose that might be its advantage as well. The function just takes a key and produces a value, regardless of how that is accomplished, so its behavior can be independent of its representation. It's just a discrete partial function (if you throw a Maybe in there to make it partial, which also gives you back the testable property above).

Now note that absolutely *any* function with the right signature can be used there instead, which is a kind of polymorphism over a single operation. That might sound freeing, but other languages certainly have closures with signatures. But in other languages you usually choose *not* to implement most polymorphism in this way, because it conceals the intention – that we wanted a map that was readable, extensible, enumerable, comparable, and testable. We didn't want to separate the functionality, we wanted an abstraction of an object for which all these operations apply, all to the same object. We want to carry these capabilities around in a bundle, an object, specifically designed for these purposes. That seems to be why Data.Map exists.

Interestingly, Java 1.1 -1.7 chose the /opposite/ approach by denying functions and /only/ providing bulky inner classes as a way of bundling functionality with functions... even if you only wanted one piece of functionality. Fortunately, this experiment in boilerplate-writing was concluded with Java 1.8.

I'm not particularly skilled at Haskell, so maybe you could walk me through translating the two lines of Avail code I provided earlier. The first line used "_:_:=_" to declare a local variable with a type and set its initial value. We could have left out the type and used "_::=_" instead, to define a local constant whose type was deduced from the expression (we have forward-only type deductions in Avail, for reasons I won't go into). The expression being assigned used the map construction operation "{«_→_‡,»}" (braces around a comma-separated list of right-arrow-separated pairs), and for the keys it used the set construction operation "{«_‡,»}" (i.e., braces around a comma-separated list of elements). For the empty set it used a zero-argument "∅" operation (just because {} means empty map, not set).

The second line created another set via "{«_‡,»}", looked that up as a key in m via "_[_]" (the lookup operation), converted the resulting integer (yes, it was known statically to be an integer) to a string via the smart quotes operator "“_”", and passed that string to "Print:_". Let's ignore the I/O aspect for this example.

I don't mean this to be a difficult challenge, although I suspect it is. I think after this, it should be pretty clear that whoever claimed Avail was based on Haskell was making a major category error :-).

Name: Anonymous 2015-02-22 17:12

>>15
Is this what you're getting at? I'll assume it is for the moment.
No, but it could work. The approach you outlined can be extended to everything you need to do if you put more thought into it. I encourage you to think about it, though you may have to curry multiple functions to get the result you want.

What I'm getting at is you can just go ahead and build your own data type of the existing one doesn't do the job you need. Haskell ships Map with its own ideas. You're free to use the same tools to build one that works how you would like.

I'm not particularly skilled at Haskell, so maybe you could walk me through translating the two lines of Avail code I provided earlier.
Neither am I. I could port the code you've mentioned, but 1. it would contain no new information for you and 2. without the corresponding implementation, it would not function. What you're really asking is for me to port the corresponding library code, which is not something I'm interested in doing.

I encourage you to finishing the Wadler paper (“Monads for functional programming”). It's easy to understand unlike practically every discussion of monads to follow it.

Name: Anonymous 2015-02-22 23:18

>>15,16
dumbasses wasting their time and are too dumb to come up with anything better or actually go and create something (aka programming).

dumb phds so fucking stupid, all of them score low on iq tests.

Name: Anonymous 2015-02-23 7:22

>>17
IQ tests do not measure intelligence.

Name: Anonymous 2015-02-23 13:06

>>18
Jet fuel can't melt steel beams.

Name: Anonymous 2015-02-23 13:12

>>19
Bad troll.

Name: Anonymous 2015-02-23 22:26

>>19
You'd have to be stupid to believe that.

Name: Anonymous 2015-02-24 0:37

Check em?

Name: Anonymous 2015-02-24 7:43

>>22
Checked.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List