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

Pages: 1-

RoR "goto" function?

Name: Anonymous 2007-08-18 10:50 ID:0Eptx7LI

What's the goto function for Ruby on Rails?
Something like this:
x: y
if z goto x

Obviously that's not the proper syntax, but I don't know what is. :(

Name: Anonymous 2007-08-18 10:52 ID:Heaven

sage

Name: Anonymous 2007-08-18 11:23 ID:Heaven

goto considered harmful

Name: Anonymous 2007-08-18 11:31 ID:0Eptx7LI

>>3
How so?

Name: Anonymous 2007-08-18 11:34 ID:tuR+/dVf

>>4
religion

Name: Anonymous 2007-08-18 11:45 ID:Heaven

>>4,5
GOTO (5014,5000,2026,2010)KQ
        PAUSE 'NO NO'
2026 JVERB=K
        JSPK=JSPKT(JVERB)
        IF(JTWO.NE.0)GOTO 2028
        IF(JOBJ.EQ.0)GOTO 2036
2027 GOTO(9000,5066,3000,5031,2009,5031,9404,9406,5081, 5200,
        1 5200,5300,5506,5502,5504,5505)JVERB


50 INPUT A
55 IF A<1 OR A>5 THEN GOTO 50
60 GOTO 900+100*A

Name: Anonymous 2007-08-18 12:22 ID:dN3DI5sk

>>1

Goto is not a function, it is a statement.

Name: Anonymous 2007-08-18 12:34 ID:0Eptx7LI

>>7
You know what I mean.

Name: Anonymous 2007-08-18 13:15 ID:qzSKmo5g

>>7
Goto is not a function, it is a statement, if you catch my drift.

Name: Anonymous 2007-08-18 13:25 ID:ORvhN3vB

>>9
I know what you mean

Name: Anonymous 2007-08-18 16:38 ID:i0cz+u8B



    **** COMMODORE 64 BASIC V2 ****

 64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 PRINT GOTO(30)
LIST
10 PRINT GOTO(30)
READY.
RUN
?SYNTAX  ERROR IN 10
READY.

Name: Anonymous 2007-08-18 17:06 ID:h/Axxav4

me@host: /usr/src/linux-source-2.6.21% grep -R "goto " * | wc -l
44393

Name: Anonymous 2007-08-18 17:19 ID:mDH5Bk5y

callcc

Name: Anonymous 2007-08-18 17:43 ID:jyb8wXrU

>>11
NEW

Name: Anonymous 2007-08-18 17:43 ID:zprZefIG

>>7
>>9
Statements are for losers

Name: Anonymous 2007-08-18 17:45 ID:dN3DI5sk

>>9

I catch your (multi-track) drift.

Name: Anonymous 2007-08-18 17:46 ID:dN3DI5sk

>>14

READY.

Name: Anonymous 2007-08-18 18:39 ID:zprZefIG

>>17
SET.

Name: Anonymous 2007-08-18 18:45 ID:I1YMzUms

>>18

GOTO

Name: Anonymous 2007-08-18 19:11 ID:kyDYKmfu

>>18
GET SET READY. DRIVE IGNITION.

Name: Anonymous 2007-08-18 20:41 ID:fDvjpiTG

GOTO 22

Name: Anonymous 2007-08-18 22:19 ID:kEUDxXi1

omg ror

Name: Anonymous 2007-08-18 22:29 ID:s3wvIezg

Use continuations, bitch.

Name: Anonymous 2007-08-18 23:08 ID:2CXDCuwj

Too bad Ruby on Rails is slow as fuck

Name: Anonymous 2007-08-19 0:11 ID:RrAyFfbx

>>6
I don't remember much FORTRAN and I could understand that.

Are programmer's brains getting smaller and smaller? Back then we had several hundred lines of dense code, and we could write programs just fine that way, and now they're all teaching that you need to separate shit into functions if its over 30 lines. WTF.

Name: Anonymous 2007-08-22 10:23 ID:Hw8swnqu

>>25
your programs did things that are can be done in 3 lines of code today

Name: Anonymous 2007-08-22 18:19 ID:CfP8G2ir

ruby has call/cc that's all you should need for a goto

Name: Anonymous 2007-08-22 20:36 ID:lVDPtLHY

>>24
Lol, if your application is small it doesn't matter, if it's big, hopefully it's generating enough ???profit that you can throw more hardware at it.  Optionally you can use a less mature framework like Django, but whatever.

Also bytecode eventually.

Name: Anonymous 2007-08-23 4:21 ID:jdm0N7E7

>>28
Perl 6 eventually.
Duke Nukem Forever eventually.
Year of the Linux desktop eventually.

Name: Anonymous 2007-08-23 6:58 ID:dz6K8PU5

>>29
ONE WORD, PUGS, THREAD OVER

Name: Anonymous 2007-08-23 10:01 ID:Txh0h8ld

>>30
Amazingly enough, Pugs is sometimes quicker at executing similar programs than Perl 5. Must be that modern garbage collector underneath, or something.

Name: Anonymous 2007-08-23 17:44 ID:Cqp3pqHz

Lulz, Failure on Ferries

Name: sage 2007-08-25 0:33 ID:v4zegzDD

callcc you fucking idiots

Name: test 2010-02-07 7:29

>>39
http://blog.leahculver.com/2007/04/star-ratings.html but she removed it.

Someone used it to troll python-list: http://www.mail-archive.com/python-list@python.org/msg198925.html

--

I've been awfully busy programming lately. My Django-based side
project is coming along well and I hope to have it ready for use in a few weeks. Please don't ask more about it, that's really all I can say for now. Anyways, I came across an interesting little math problem today and was hoping some skilled programmers out there could come up with a more elegant solution than mine.

Problem: Star Ratings

People can rate cheeseburgers on my website with a star rating of 0-5 stars (whole stars only), 5 being mighty tasty and 0 being disgusting. I would like to show the average of everyone's ratings of a particular cheeseburger to the nearest half star. I have already calculated the average rating as a float (star_sum) and the total number of people that rated the particular cheeseburger (num_raters). The result should be stored as a float in a variable named "stars."
My Solution (in Python):

# round to one decimal place and
# separate into whole and fractional parts
parts = str(round(star_sum/num_raters, 1)).split('.')
whole = int(parts[0])
frac = int(parts[1])
if frac < 3:
___frac = 0
elif frac > 7:
___frac = 0
___whole += 1
else:
___frac = 5
# recombine for a star rating rounded to the half
stars = float(str(whole)+'.'+str(frac))


Mmmm… In-N-Out Burgers… Please reply if you've got a better solution.

Name: Anonymous 2011-02-03 8:29

Name: Anonymous 2011-03-31 12:09

I am the phantom autist

Name: 2012-01-25 23:02


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