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
TiMBuS
Sep 25, 2007

LOL WUT?

JawnV6 posted:

eugh, im missing so much mockables today

wtf arent you smart? get hired and paid for the things you do

:( life does not work htis way

Adbot
ADBOT LOVES YOU

TiMBuS
Sep 25, 2007

LOL WUT?

why the gently caress do i keep snipeing im not trying to

tef
May 30, 2004

-> some l-system crap ->

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

node.js

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

tef posted:

node.js
haha no i mean ALL THE FUKKEN WAY

e: dammit why did i post that at the end of the page

skeevy achievements
Feb 25, 2008

by merry exmarx

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.

as a dad you should know trying to look cool in front of the kids never works

Nomnom Cookie
Aug 30, 2009



Actually it does if you're cool

MononcQc
May 29, 2007

fyi rotor if you want a modern Forth, go for Factor. It's no longer this tiny system Forth was, but keeps all the ideas and adds stuff like a great REPL, full Unicode support, etc. And Slava Pestov (the guy in charge of Factor) definitely knows his poo poo.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
factor is like forth with a good bit of the stackholm syndrome gone

JawnV6
Jul 4, 2004

So hot ...
hey javascript 1980 called

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
im "learning" j again

quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)

suck it legibility havers

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
fun game: write up a bunch of J procedures that are defined as various smilies and try to guess what they do

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Gazpacho posted:

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 ";".

a good post

tef
May 30, 2004

-> some l-system crap ->
why not learn postscript instead of forth rotor

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

tef posted:

why not learn postscript instead of forth rotor

fun rotor fact: postscript was the first language I learned as an adult

duTrieux.
Oct 9, 2003

what, no, don't pound that screw into your dick. use this nail instead!

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
i've been looking at joy
http://en.wikipedia.org/wiki/Joy_(programming_language)

which is forth-y and looks like a blast

also proof that dr dobbs still got it goin on:
http://www.drdobbs.com/blogs/architecture-and-design/228701299

JawnV6
Jul 4, 2004

So hot ...

Deuterieux posted:

what, no, don't pound that screw into your dick. use this nail instead!

we're way past the decision you're mocking, SOMETHING's gettin #ed

coaxmetal
Oct 21, 2010

I flamed me own dad

tinselt0wn posted:

im "learning" j again

quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)

suck it legibility havers

I don't like this. :mad:


Same with poo poo like fancy perl oneliners. If its hard to tell what the code actually does then its lovely code imo.

GameCube
Nov 21, 2006

speaking of forth if any of y'all are arduino nerds, the gameduino coprocessor is the guy's custom forth cpu. was thinking of picking one of these up a while back but got distracted by something shiny

Necc0
Jun 30, 2005

by exmarx
Broken Cake

JawnV6 posted:

:can:

ppp
Feb 13, 2012

by angerbot
arduino is stupid

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
i made a little RGB notification light with my arduino but i don't use it because nothing important happens in my life

Shaggar
Apr 26, 2006
use it to notify u that mom restocked the dew

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
my mom doesn't let me have sugar

Shaggar
Apr 26, 2006
wow. guess shes not getting anything for mothers day

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
she's getting a cool stay-at-home son

Inverse Icarus
Dec 4, 2003

I run SyncRPG, and produce original, digital content for the Pathfinder RPG, designed from the ground up to be played online.
i made a wireless hygrometer to keep track of the humidity/temp in my humidors for my cigars, but it turns out the arduino will just suck a battery dry for no loving reason

then i got really lazy and some computer game came out and i stopped playing with it

i should really pick it back up

Shaggar
Apr 26, 2006
i was thinking about getting an arduino but i couldnt think of any problems 2 solve.

Soldier of Fortran
May 2, 2009

Shaggar posted:

i was thinking about getting an arduino but i couldnt think of any problems 2 solve.

could it solve your posting?















can it solve mine?

vapid cutlery
Apr 17, 2007

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

Inverse Icarus posted:

i made a wireless hygrometer to keep track of the humidity/temp in my humidors for my cigars, but it turns out the arduino will just suck a battery dry for no loving reason

then i got really lazy and some computer game came out and i stopped playing with it

i should really pick it back up

did you implement any kind of sleep mode or anything

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

Shaggar posted:

i was thinking about getting an arduino but i couldnt think of any problems 2 solve.

have you thought about using it to make an LED flash?

vapid cutlery
Apr 17, 2007

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

Sweevo posted:

have you thought about using it to make an LED flash?

at least use pwm to dim an led, or make it pulse

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

i dont think you understand how stupid the arduino community is

ppp
Feb 13, 2012

by angerbot
use pwm to blow it up

vapid cutlery
Apr 17, 2007

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

Sweevo posted:

i dont think you understand how stupid the arduino community is

i'm a Maker. back off. i Make things. check otu all these blogs i read

Inverse Icarus
Dec 4, 2003

I run SyncRPG, and produce original, digital content for the Pathfinder RPG, designed from the ground up to be played online.

ahhh spiders posted:

did you implement any kind of sleep mode or anything

yes, but the sleep is lovely

it still dies after like 11 hours on a 9v battery

i looked into using other types of batteries but a bunch of people online have found the same thing using a bunch of AAs or li-poly whatever

simply running through the arduino's circuit drains the battery, even when it's not doing anything

what i really need to do is make a small circuit on a timer that supplies power to the arduino itself, like rotor told me to months ago, but again, lazy

vapid cutlery
Apr 17, 2007

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

Inverse Icarus posted:

yes, but the sleep is lovely

it still dies after like 11 hours on a 9v battery

i looked into using other types of batteries but a bunch of people online have found the same thing using a bunch of AAs or li-poly whatever

simply running through the arduino's circuit drains the battery, even when it's not doing anything

what i really need to do is make a small circuit on a timer that supplies power to the arduino itself, like rotor told me to months ago, but again, lazy

lol that's terrible. oh well i guess that's why it costs like $30 or whatever

ppp
Feb 13, 2012

by angerbot
use a msp430

GameCube
Nov 21, 2006

ppp posted:

use a msp430

Adbot
ADBOT LOVES YOU

GameCube
Nov 21, 2006

nobody in yospos is dumb enough that they can't use a real microcontroller instead of some lovely dev board loaded up with unnecessary poo poo that sucks power and leaves you with no room for your code. I only posted that gameduino poo poo because an accessible forth cpu seemed neat

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