[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

rate my factorial function

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 29
Thread images: 2

File: devenv_2016-10-24_17-55-24.png (11KB, 794x330px) Image search: [Google]
devenv_2016-10-24_17-55-24.png
11KB, 794x330px
rate my factorial function
>>
Is this b8?

Please report yourself

But just to sum up:

>Unecessary blank lines
>Unnecessary tabbing
>Inconsistent style
>%ld for usigned
>semicolon after 4
>Redundant if
>Redundant code
>Dumb code (using three variables for that shit)
>returning only if n<2, otherwise only printing
>It won't print for n<2
>Works for negative numbers
>Inline if
>Keeping argv for some reason
>No black line between the for and printf
>>
it's trash
>>
>>57224790
>>57224804
:(
>>
>>57224817
At least you didn't fall for the recursion meme
>>
>>57224790
>after 4
after for

Tired as hell, it's after 4 here

Forgot
>That shitty (i-1) workaround
>Plebdows (probably on Mingw)
>That IDE
>>
>>57224833
visual studio actually. why would i run something non native.
>>
>>57224748
This shit is like the equivalent of tying your shoes... Poorly. It's good that you're proud of yourself for learning something new, but nobody is going to praise you for something so banal. If you're gonna learn how to program then do it for yourself, not just to fish for compliments, you're hella ways off from getting any. Frankly this just strikes me as sad.
>>
>>57224883
someone is jealous of my raw talent.
>>
>>57224933
kys
>>
>>57224942
kek you're super?
>>
return n < 2 ? n : n * factorial(n - 1);
>>
      DOUBLE PRECISION FUNCTION FACT(num)
DOUBLE PRECISION count, num, ans

count = 1D0
ans = num
DO WHILE (count .LT. num)
ans = ans * count
count = count + 1D0
ENDDO
FACT = ans
RETURN
END
>>
>>57224933
Ohboy. I REALLY hope you're just trolling here.

Look... At least try writing a dijkstra or something, or at the VERY least do something with a tree.. Because if this thread isn't just a troll I legit feel sorry for you.
>>
>>57224851
MinGW doesn't put telemetry calls into your compiled code. And it has better support for C99.
>>
>>57224969
>fewer lines makes it run faster
>>
>>57225079
Wish he'd at least do a tail recursion if he has to use it.
>>
factorial = (head .) . (. scanl (*) 1 [1..]) . drop
>>
>not implementing the gamma function
pleb
>>
>>57224827
>>57225093
Recursion is a resource hogging gimmick. Unreadable and unprofessional
>>
>>57225759
Depends on the problem. Some problems that are mathematically defined using recursion are much more readable when written as recursive functions than as an iterative function.
>>
File: IMG_20160606_123124673_HDR.jpg (1MB, 2560x1440px) Image search: [Google]
IMG_20160606_123124673_HDR.jpg
1MB, 2560x1440px
I asked my computer science department head and professor what single precision and double precision means and she didn't know. I'm a freshman but I'm 23. Should I be worried
>>
> something{ };
> };

really?
>>
>>57225759
try defining any graph algorithm, try do it without recursion. Which is clearer?
>>
>>57225909

Doesn't it depend on the algorithm? Say BFS vs DFS
>>
>>57224827
recursion meme? really? this is one of the few times recursion is a good implementation.
>>
>>57225883
lmao do you go to Tyrone University or something?

Yes you should be worried because it sounds like both you and your teachers might be retarded
>>
>>57225949
Nope. Recursion, though more clear, is usually worse than dynamic or inline solutions. Recursion wastes space. If your recursive solution has repeated steps (fibonacci for instance, since in f(n) + f(n+1), f(n) includes solutions needed for f(n+1)), then it'll run at least a factor worse than if you keep track of repeating solutions (which won't take quite much space as recursion)
>>
>>57225957
I'm just a hobbyist. I go to a community college. I'm fairly confident I know more than the professor just from some books I read in my teens and lurking here since the 8800gtx days. I don't have any other options school wise right now so I'm really bummed, it look a lot of work to get off the streets and back into school.
Thread posts: 29
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.