Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
CaptainMeatpants
Jun 1, 2010

what is all this nerd poo poo

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

ahhh spiders posted:

what's wrong with it?
dynamic typing, weak typing, no integers, hash tables as the primary abstraction

it's great if your alternative is Tcl or something, but programming has seen a few advances in the last 20 years and Lua hasn't adopted any of them.

JawnV6
Jul 4, 2004

So hot ...

Gazpacho posted:

youre probably right, the recovery code for that must look terrible

no, im saying once you let ONE exception like that in, it all goes to poo poo

like opening a can of worms or something

JawnV6
Jul 4, 2004

So hot ...

Janin posted:

programming has seen a few advances in the last 20 years and $lang hasn't adopted any of them.

tef
May 30, 2004

-> some l-system crap ->

Janin posted:

dynamic typing, weak typing, no integers, hash tables as the primary abstraction

it's great if your alternative is Tcl or something, but programming has seen a few advances in the last 20 years and Lua hasn't adopted any of them.

ephemerons

The Best Christmas
May 13, 2011

i think i'm going to learn lolcode as my first language

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Janin posted:

dynamic typing, weak typing, no integers, hash tables as the primary abstraction

it's great if your alternative is Tcl or something, but programming has seen a few advances in the last 20 years and Lua hasn't adopted any of them.

lol

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
you outdid yourself again

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
tcl is cool because gitk

EIDE Van Hagar
Dec 8, 2000

Beep Boop
tickle

tef
May 30, 2004

-> some l-system crap ->

tef posted:

ephemerons

to elaborate, this came out in 97 and it is in lua 5.2. :smugdog:

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

tef posted:

to elaborate, this came out in 97 and it is in lua 5.2. :smugdog:

Owns

graph
Nov 22, 2006

aaag peanuts
didnt read the last 700 posts

tef
May 30, 2004

-> some l-system crap ->
don't blame you, they're terrible.

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
Lua ftw. Epic ftw

duTrieux.
Oct 9, 2003

i saw a car on the freeway today with a sticker that had "epic fail" over an arrow pointing to the right, and it was on the right side of the car, but there wasn't really any room for it on the far right so it was still to the left of the make/model badge.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
ok so quick summary for those of you just joining us: tbc is always wrong, internaut doesn't know wtf, janin, well, janin is janin, spiders is mostly right and jawn and tef are always right. now, back to the thread, already in progress.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Tiny Bug Child posted:

unironically this

the old-school beardo attitude of crash-and-burning whenever there is the tiniest recoverable error is so stupid

a post by tiny bug child

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rotor posted:

ok so quick summary for those of you just joining us: tbc is always wrong, internaut doesn't know wtf, janin, well, janin is janin, spiders is mostly right and jawn and tef are always right. now, back to the thread, already in progress.

...


ALREADY IN PROGRESS!

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
it's cool how simple lua is but there's all this sweet metatable stuff that lets you add complexity if you want it

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
has anyone ever written forth? it seems so neat.

ppp
Feb 13, 2012

by angerbot

rotor posted:

has anyone ever written forth? it seems so neat.

i suspect so

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
I mean anyone in this thread you oaf

Sneaking Mission
Nov 11, 2008

rotor posted:

has anyone ever written forth? it seems so neat.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

rotor posted:

has anyone ever written forth? it seems so neat.
forth is great for embedded systems, but it's kinda difficult to write maintainable programs in it because they trend towards being super-short and cryptic. you have to be the kind of person who enjoys busting out a whiteboard to diagram a line containing fourty single characters.

there's a guy I know who writes these little five-line forth programs to draw roses or bridges or such, they're cool.

salted hash browns
Mar 26, 2007
ykrop
Low level code is for chumps

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

ahhh spiders posted:

it's cool how simple lua is but there's all this sweet metatable stuff that lets you add complexity if you want it

yeah, it's basically like if you took all the lovely parts out of javascript

ppp
Feb 13, 2012

by angerbot

Zaxxon posted:

yeah, it's basically like if you took all the lovely parts out of javascript

i think what you are looking for is coffeescript

coaxmetal
Oct 21, 2010

I flamed me own dad
im going to write something called espressoscript where its just javascript but I hosed around with the syntax a bit.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Ronald Raiden posted:

im going to write something called espressoscript where its just javascript but I hosed around with the syntax a bit.

too late, that's coffeescript

ppp
Feb 13, 2012

by angerbot

Ronald Raiden posted:

im going to write something called espressoscript where its just javascript but I hosed around with the syntax a bit.

too late http://www.pmade.com/static/presentations/espresso.pdf

coaxmetal
Oct 21, 2010

I flamed me own dad
ok how about expresso

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

ppp posted:

i think what you are looking for is coffeescript

yeah but I could also just stick with lua, seeing as it's already super great.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
if you're the one writing it, call it "weak drip"

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

rotor posted:

has anyone ever written forth? it seems so neat.
it's a neat idea but i've met some of chuck moore's clique and they're pretty cultish, always talking about the great things that could be done with forth except that the "forth philosophy" says you shouldn't

i suppose if you wants to write actual programs in 100% continuation passing style by hand that's the language to do it in

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Gazpacho posted:

it's a neat idea but i've met some of chuck moore's clique and they're pretty cultish, always talking about the great things that could be done with forth except that the "forth philosophy" says you shouldn't

i suppose if you wants to write actual programs in 100% continuation passing style by hand that's the language to do it in

brb downloading forth compiler

EIDE Van Hagar
Dec 8, 2000

Beep Boop
in my previous life in semiconductor manufacturing i used to use a Varian EHP 500 ion implanter that all ran on forth. the front end was a normal x86 PC with a touch screen but the whole realtime system for moving the robots and doing dosimetry calculations was written in forth and ran on some weird forth CPU.

i tried to write a program in forth for it once just to move the robot arms around and it was totally baffling so i gave up, hth.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
btw i'm not really talking about ansi forth, i'm talking about any one of chuck moore's custom forths like this one that replaces the OS and color highlighting is operationally significant and it has its own optimized keyboard layout

also here's a photo of chuck which would make a good avatar

EIDE Van Hagar
Dec 8, 2000

Beep Boop
huh heres an ehp500 for sale if you want a weird forth hardware system and some robots:

http://www.caeonline.com/listing/product/145581/varian-e500-ehp

it even has the "productivity plus" upgrade which gave you a blazing fast 1GHz PIII for the front end in 2006 and only cost $40,000, and another robot arm for moving poo poo around faster.

EIDE Van Hagar fucked around with this message at 06:03 on May 2, 2012

Adbot
ADBOT LOVES YOU

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Gazpacho posted:

i suppose if you wants to write actual programs in 100% continuation passing style by hand that's the language to do it in
I thought i'd put in a little :effort: and write up what I mean. I've had this in the back of my mind for a few weeks but I've never seen it discussed online because Forth is a kind of ghetto language to academics. Take your naive Fibonacci in Javascript.
code:
function fib(n) {
  if(n < 2)
    return 1;
  else {
    return fib(n - 1) + fib(n - 2);
}
Next transform just the fib function to continuation style. Note that it's starting to look like postfix because you have the two recursive fibs first then the addition.
code:
function fib(n, cont) {
  if(n < 2)
    cont(1);
  else {
    fib(n - 1, function(x) {
      fib(n - 2, function(y) {
        cont(x + y);
      });
    });
  }
}
Now go all out and transform the operators and control statements as well.
code:
function fib(n, cont) {
  op<(n, 2, function(x0) {
    ifelse(x0,
      function() { cont(1); },
      function() {
        op-(n, 1, function(x1) {
          fib(x1, function(x2) {
            op-(n, 2, function(x3) {
              fib(x3, function(x4) {
                op+(x2, x4, cont);
              });
            });
          });
        });
      });
    });
}
From this you can read off the corresponding Forth code line by line.
code:
// ": fib" (define fib)
function fib(n, cont) {
  // "dup" (preserve n for later use) "2 <"
  op<(n, 2, function(x0) {
    // "if"
    ifelse(x0,
      // "drop" (n not used on this branch) "1"
      function() { cont(1); },
      // "else"
      function() {
        // "dup" (preserve n) "1 -"
        op-(n, 1, function(x1) {
          // "fib"
          fib(x1, function(x2) {
            // "swap" (reach up the stack past x2 to get n for last use) "2 -"
            op-(n, 2, function(x3) {
              // "fib"
              fib(x3, function(x4) {
                // "+ then" (end of false branch) ";" (call cont)
                op+(x2, x4, cont);
...
Result:
code:
: fib dup 2 < if drop 1 else dup 1 - fib swap 2 - fib + then ;
There's a quirk here that the second cont call translates to ; but the first doesn't. colorForth actually handles this consistently so "else" becomes ";".

Gazpacho fucked around with this message at 11:45 on May 2, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply