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.
yes/no/etc?
yes
no
http://www.twentygoto10.com :(
10 print PENUS 20 goto 10
View Results
 
  • Locked thread
LP0 ON FIRE
Jan 25, 2006

beep boop
you can perform repetitive tasks with virtually no effort using for loops in just about any language. could we be doing the world much better with for loops, or have we exhausted those possibilities already and i just haven't realized it?

Adbot
ADBOT LOVES YOU

LP0 ON FIRE
Jan 25, 2006

beep boop
rotor please change poll to multiple choice, ty v much

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i think the map function is more suited to operations performed on the world

LP0 ON FIRE
Jan 25, 2006

beep boop
what's a map function. like an html image map? i think that helps only a little

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
exit() suits me fine

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

cure cancer with this one weird old loop construct invented by a mom

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i havent written a for or while loop in a year. if the problem cant be solved with a combination of mapping and folding then i'm doing it wrong and need to reapproach

Valeyard
Mar 30, 2012


Grimey Drawer

USSMICHELLEBACHMAN posted:

i havent written a for or while loop in a year.

unlucky lol

functional languages ftl

LP0 ON FIRE
Jan 25, 2006

beep boop
what the frick is folding and mapping?

Valeyard
Mar 30, 2012


Grimey Drawer

LP0 ON FIRE posted:

what the frick is folding and mapping?

realyl fail is what they are

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
lol if you need to invoke return or break from within your loop

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
code:
function make_world_a_better_place(world)
	for thing in world 
   		if thing == 'so poor, so black'
      			next
   		end 
   		do_things
	end
end

DONT THREAD ON ME fucked around with this message at 19:42 on Aug 10, 2014

Valeyard
Mar 30, 2012


Grimey Drawer
code:
-module(hello).
-export([start/0]).

start() ->
   spawn(fun() -> loop() end).

loop() ->
   receive
      hello ->
         io:format("Hello, World!~n"),
         loop();
      
      goodbye ->
         ok
   end.

Valeyard
Mar 30, 2012


Grimey Drawer
v readable lol

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
functional lanauges are indeed very confusing if you're not used to them

unlike iterative languages, which always make sense to people who have never programmed with them before

The Management
Jan 2, 2010

sup, bitch?

LP0 ON FIRE posted:

what the frick is folding and mapping?

it's a way to hide for loops behind compiler nonsense

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
actually, loops are just a special case of the map function

z0rlandi viSSer
Nov 5, 2013

life is one big for loop until death

makes u think

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
physics operate in a way much more akin to a functional language than an imperative language. because physics is based on, and math is all functions. and can you imagine if physics was iterative? you'd have to wait for the universe to run through am assive for loop before you could move your hand or something. lol.

also, the universe is lazily evaluate. so the answer to the question 'if a tree falls and the woods and no one is there to see it, does it make a sound?' is both yes and no. the actual answer is that the tree never even falls until someone shows up to observe that it fell.

Otaku Alpha Male
Nov 11, 2012

bitches get ~tsundere~ when I pull out my katana
ill

make

the

WIKI!!

hah hah hha

LP0 ON FIRE
Jan 25, 2006

beep boop

USSMICHELLEBACHMAN posted:

physics operate in a way much more akin to a functional language than an imperative language. because physics is based on, and math is all functions. and can you imagine if physics was iterative? you'd have to wait for the universe to run through am assive for loop before you could move your hand or something. lol.

also, the universe is lazily evaluate. so the answer to the question 'if a tree falls and the woods and no one is there to see it, does it make a sound?' is both yes and no. the actual answer is that the tree never even falls until someone shows up to observe that it fell.

maybe we don't perceive the time it takes to make the loop. the hand movement isn't really separate from anything else. we don't individually choose to do anything

The Management
Jan 2, 2010

sup, bitch?
until your computer stops retiring instructions sequentially, everything "functional" on top of that is pure wankery

Sapozhnik
Jan 2, 2005

Nap Ghost
code:
    foreach (ForumThread thread in forums[219].Threads.Where(t => t.Poster.Name == "LP0 ON FIRE"))
    {
        thread.GasThread();
    }

Pile Of Garbage
May 28, 2007



ForEach-Object

Fart.Bleed.Repeat.
Sep 29, 2001

just billions of cases and switches

A Wheezy Steampunk
Jul 16, 2006

High School Grads Eligible!

USSMICHELLEBACHMAN posted:

physics operate in a way much more akin to a functional language than an imperative language. because physics is based on, and math is all functions. and can you imagine if physics was iterative? you'd have to wait for the universe to run through am assive for loop before you could move your hand or something. lol.

also, the universe is lazily evaluate. so the answer to the question 'if a tree falls and the woods and no one is there to see it, does it make a sound?' is both yes and no. the actual answer is that the tree never even falls until someone shows up to observe that it fell.

makes u think

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

The Management posted:

what the frick is a for loop?

it's a way to hide gotos behind compiler nonsense

nigga crab pollock
Mar 26, 2010

by Lowtax
fruity loops :mrgw:

The Management
Jan 2, 2010

sup, bitch?

Symbolic Butt posted:

it's a way to hide gotos behind compiler nonsense

now you're getting it! a for is a test and branch loop, much like a goto with an if. a map is just a way to trick the developer into believing they are doing something other than a test and branch loop in the background.

Locker Room Zubaz
Aug 8, 2006

:horse:
~*~THE SECRET OF THE MAGICAL CRYSTALS IS THAT I'M FUCKING TERRIBLE~*~

:horse:
i think we should apply switch statements to this problem

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Locker Room Zubaz posted:

i think we should apply switch statements to this problem

Yeah, the op should switch to posting in another forum!

Mr. Glass
May 1, 2009

Locker Room Zubaz posted:

i think we should apply switch statements to this problem

why not both?

LP0 ON FIRE
Jan 25, 2006

beep boop

that is so strange looking but cool. look at all those pointers

Locker Room Zubaz
Aug 8, 2006

:horse:
~*~THE SECRET OF THE MAGICAL CRYSTALS IS THAT I'M FUCKING TERRIBLE~*~

:horse:

neat as gently caress

Adbot
ADBOT LOVES YOU

Sapozhnik
Jan 2, 2005

Nap Ghost
and completely counterproductive when fed to any compiler written in the last 20 years

  • Locked thread