[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
fizzbuzz thread <?php foreach(range(1,100) as $number){ if($number
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 16
Thread images: 1
File: fizzbizz.png (45 KB, 916x916) Image search: [Google]
fizzbizz.png
45 KB, 916x916
fizzbuzz thread

<?php
foreach(range(1,100) as $number){
if($number % 15 == 0){
echo("fizzbuzz<br/>");

}
elseif($number % 3 == 0){
echo("fizz<br/>");

}
elseif($number % 5 == 0){
echo("buzz<br/>");

}
else{
echo("$number<br/>");

}
}

>>
>>55494122
>>http://rosettacode.org/wiki/FizzBuzz
/thread
>>
>>55494122
 {⍵'Fizz' 'Buzz' 'FizzBuzz'[ +/1 2×0=3 5|⍵] }¨1+⍳100 


Most efficient language ever
>>
>>55494440
What in the everloving fuck is that
>>
>>55494459
APL my son.

The most efficient and powerful programming language you'll ever come across.

Able to control mainframe computational tasks in a few lines, and is able to come up with the most advanced algorithms in just 1 line.
>>
>>55494591
>sacrificing readability for functionality
>>
>>55494648
>implying it is unreadable
Only to those who are unworthy of possessing the knowledge of such a powerful language.
>>
>>55494591
how does unix's dc compare?
>>
>>55494686
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
Explain this function then.
>>
>>55494705
Poorly.
The ability to produce many numatic functions is highly effective in producing algorithms. This has many real-world uses.
>>
OCaml Master Race

let rec f n s =
if n = 100 then print_string s
else f (n+1) (s ^ "\n" ^ (
(fun x -> if x = "" then string_of_int n else x)
(List.fold_left
(fun x y -> x ^
if (n mod (fst y) = 0) then (snd y)
else "" )
"" [3,"fizz";5,"buzz"] )
)) in f 0 ""

https://ocsigen.github.io/js_of_ocaml/
>>
>>55494705
By overcomplicating staff. We are all gonna be on a wheelchair pushed by a nurse by the time we reach 80 years. What's the point of making our life hard and not enjoying a carefree existence? Sure go spend your life programing in weird languages, filling your pockets with money which you will never use at the end of your days. Program your own destiny anon. Do it the hard way if you will
>>
>>55494761
APL programs are read from right to left.

So first off, we can see there will be a function(within the {}) that will be stored in a variable called 'life'

It's actually fairly simple once you get the hang of it.

https://en.wikipedia.org/wiki/APL_syntax_and_symbols
>>
>>55494776
That's actually really beautiful anon.
>>
>>55494772
wtf!
>>
>>55494772
>>55494834
Better indents
let rec f n s =
if n = 101
then print_string s
else f (n+1) (s ^ "\n" ^ (
(fun x ->
if x = ""
then string_of_int n
else x)
(List.fold_left
(fun x y -> x ^
if (n mod (fst y) = 0)
then (snd y)
else "" )
""
[3,"fizz";5,"buzz"] )
))
in f 1 "";;
Thread replies: 16
Thread images: 1

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.