View previous topic - View next topic |
Author |
Message |
tsb I wanna be a ballerina!
Joined: 09 Oct 2004 Posts: 23
|
Posted: Sat Jan 29, 2005 6:54 pm Post subject: |
[quote] |
|
I envy your university.
Here, the curriculum is dominated by Java and VB, which are both so intellectually bankrupt and overrated that it makes me cry inside. (and yet nobody seems to notice that I get all my work done with a tiny, tiny fraction of the effort...)
Grokking functional programming is an absolute necessity if you want to be a Real Programmer. Even if you never actually use a functional language afterward, it increases your ability to think about problems and programs. _________________ —andy
http://ika.sf.net
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Jan 29, 2005 7:08 pm Post subject: |
[quote] |
|
Do you think functional programming would be a good addition to Dyne?
I added "else" support, and "else if" support too. May add in the dynamic stuff next. Maybe, if I feel like it.
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Sat Jan 29, 2005 9:53 pm Post subject: |
[quote] |
|
LordGalbalan wrote: | Do you think functional programming would be a good addition to Dyne?
I added "else" support, and "else if" support too. May add in the dynamic stuff next. Maybe, if I feel like it. | Functional programming is kind of hard to 'add in'... it's fundamentally different from traditional, procedural programming. Some languages like Python have functional-ish features like Lambdas, but it's always going to feel a bit odd.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sun Jan 30, 2005 9:24 pm Post subject: |
[quote] |
|
I think I see what you mean. It's like starting at opposite ends of the road, and trying to make each end the other. So, ...maybe it's impossible to have both in the same language, unless you go to some extremes like saying one line is "functional" and another is "procedural."
What do you guys think programming needs right now?
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Mon Jan 31, 2005 9:55 pm Post subject: |
[quote] |
|
I added dynamic programming to dyne, via the "cause" statement.
Code: | cause <I>varID</I> : <I>interval</I> ? <I>counter</I>
|
The cause statement executes the string at varID as source code. After executing the string, it returns to the next line following the cause statement. If the cause statement has an interval value specified, it is loaded into a multitasking system and reactived at the specified interval for as many times as is specified by the counter value. (if it exists) if the counter value does not exist, then the string at varID is reactivated indefinitely.
So next I may add in parameter support for these dynamic routines, and I'm thinking a lot about making a special case of the dynamic interpreter algorithm called the "field". The field will take a list of parameters, and treat every parameter as an array.
[code]field varID (parameter [range]): interval ? counter
For each element of the parameter sets in range, it will execute the string at varID as program source, passing the parameter list. You could use this to make a magnetic field, for example, or to apply an alpha mask to a region of the screen. It is the principle of implicit directive to large amounts of information, like commanding an army to attack a castle, or calling upon people to join a crusade. No matter what, every person in earshot has to evaluate whether they want to respond to your call or not. No matter what, everyone in earshot is affected by the call. The directive is made, and reaction is implicit.
It seems to me that this is an extremely powerful method of programming, and I don't really see much way to improve upon it. What do you guys think?
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Wed Feb 02, 2005 12:48 am Post subject: |
[quote] |
|
I added in the field concept. I formalized it as specifying an arbitrary set of array variables as parameters, and executing the statement that follows it once for each element of the passed arrays within a user-defined range. In the statement that follows the field statement, the parameters are referred to as single variables, not arrays. The field statement implicitly substitutes each of the elements in range for their corresponding variables in the following statement, until all elements in range have been substituted for their corresponding variables once.
Code: |
array1[4] = "3";
field (array1[4] @ array2, array1 @ array3, array1[0-4] @ array4) :
D = D + array2 + array3 + array4;
|
Because we dimensioned an array with five elements (0-4) and assigned each element the value 3, and passed the array as each of the three parameters of the field, once for each variable mentioned in the field other than D, D will come to 15 + 15 + 15 = 9 * 5 = 45.
I think it's a good idea. What do you guys think?
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Wed Feb 02, 2005 1:47 am Post subject: |
[quote] |
|
I think that syntax is not nearly obvious enough.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Wed Feb 02, 2005 1:51 am Post subject: |
[quote] |
|
I agree. The syntax is a big problem. I'm not sure how to implement it, given that so many details are necessary....
Maybe I should take out the parentheses. They aren't really necessary, are they?
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Wed Feb 02, 2005 1:59 am Post subject: |
[quote] |
|
Hey, how about this:
Code: |
field { array1 ~ array2; array1 ~ array3; array1 ~ array4 } :
|
using the tilde to represent congruency. (?)
As regards the syntax, I'm about out of characters.
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Wed Feb 02, 2005 5:01 pm Post subject: |
[quote] |
|
I think you're trying to put too many features at the language level. It seems to me, however small my comprehension of what you're exactly trying to do here, that these things could be implemented as functions or custom datatypes and as such be quite a bit easier to understand and require less complex syntax.
I don't really get the field thing though, and the "cause" statement seems like installing a timer to me.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Thu Feb 03, 2005 1:17 am Post subject: |
[quote] |
|
"cause" installs a hook-timer kinda thing with a text string as the target function. It seems to me that the more things one can do with a single statement, the better because it means less research time and text formatting, etc.
How about this...?
Code: |
c[5] = 3;
field (a = c, b = c, d = c) : e = a + b + c;
|
Seem reasonable enough? There may seem room for confusion about the assignment operator, but I think it's clear enough what's going on, in the context of the field's functionality. Don't you guys think so?
|
|
Back to top |
|
|
tsb I wanna be a ballerina!
Joined: 09 Oct 2004 Posts: 23
|
Posted: Thu Feb 03, 2005 3:57 am Post subject: |
[quote] |
|
LordGalbalan wrote: | "cause" installs a hook-timer kinda thing with a text string as the target function. |
This is a tiny, tiny subset of what closures can do.
Code: | function make_incrementor(int i) {
function foo() { return i + 1; }
return foo // foo still remembers the value of i!
}
inc = make_incrementor(4)
result = inc() // result == 5 |
Given this, it's a very simple matter to pass a function to some timer library.
With respect to fields:
LordGalbalan wrote: | Code: | array1[4] = "3";
field (array1[4] @ array2, array1 @ array3, array1[0-4] @ array4) :
D = D + array2 + array3 + array4; |
|
I have no idea what this code is supposed to mean, let alone what sorts of problems this field concept is supposed to be good at solving.
I try to keep an open mind, but this smacks of a "really cool" solution to a problem that doesn't exist.
EDIT: oh. I get it now, but why not just use a for loop? _________________ —andy
http://ika.sf.net
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Thu Feb 03, 2005 9:35 am Post subject: |
[quote] |
|
tsb wrote: | LordGalbalan wrote: | "cause" installs a hook-timer kinda thing with a text string as the target function. |
This is a tiny, tiny subset of what closures can do.
Code: | function make_incrementor(int i) {
function foo() { return i + 1; }
return foo // foo still remembers the value of i!
}
inc = make_incrementor(4)
result = inc() // result == 5 |
Given this, it's a very simple matter to pass a function to some timer library.
|
One tiny note, you'd need to return i++, not i+1, right? Otherwise i won't ever change, it'll just always return 5.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Feb 05, 2005 6:06 pm Post subject: |
[quote] |
|
Andy, dude, what I'm trying to do with this language is make it fundamentally simple enough that a person who is not gifted at what we consider traditional programming practices can pick it up easily, and still be able to do something with it.
|
|
Back to top |
|
|
tsb I wanna be a ballerina!
Joined: 09 Oct 2004 Posts: 23
|
Posted: Sat Feb 05, 2005 10:36 pm Post subject: |
[quote] |
|
Janus wrote: | One tiny note, you'd need to return i++, not i+1, right? Otherwise i won't ever change, it'll just always return 5. | Right.
I was actually on a different track when I wrote it, though. I was thinking something more along the lines of this:
Code: | function make_adder(i) {
function adder(j) {
return i + j; // remember the value of i
}
return adder;
}
adder = make_adder(4);
value = adder(5); // value recieves 9 |
LordGalbalan wrote: | Andy, dude, what I'm trying to do with this language is make it fundamentally simple enough that a person who is not gifted at what we consider traditional programming practices can pick it up easily, and still be able to do something with it. | I know, and I don't think you're on the right track: the examples you've posted are, without exageration, more cryptic than Intercal. _________________ —andy
http://ika.sf.net
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|