[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]

/dpt/ - Daily Programming Thread

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: 336
Thread images: 33

Welcome to the daily programming thread, where programming is very occasionally discussed, but mostly the gender of anime characters is hotly debated.

Our resident trips:

>OSGTP
A Microsoft shill, C# expert, also known as "mummy"

>Ruby
Dynamic language aficionado, of indeterminate gender

>nv
Knows some type theory, will forever be working on his own language

Old thread: >>56365584
>>
What does this image have to do with programming?
>>
>>56372563

...seriously?
>>
How can I make Python generate a 500x500 grid and have it randomly be populated with black or white squares?
>>
>>56372577
Write the function in C and call it from Python.
>>
>>56372577
https://pypi.python.org/pypi/Pillow
>>
Can I ask beginner questions about JavaScript in this topic?
>>
>>56372613
yes, you can ask anything as long as its programming related.
>>
>>56372501
Please don't shitpost in the OP.
>>
Which functional language is good for start?
>>
>>56372501
Holy shit, kill yourself.

>>56372613
Yeah, avoid straight HTML/CSS shit, though.
>>
>>56372647
Haskell
>>
>>56372621
There's no Code of Conduct in the OP to stop me. If you think we should establish one, let's discuss it.
>>
>>56372647
Scheme. Avoid the Haskell meme at all costs.
>>
>>56372683
>avoid the _ meme at all costs
>recommends a lisp
>recommends a lisp influenced by _
>>
>>56372683
>>56372661
Learn both.
>>
>>56372620
Well, I'm learning how to use objects. I made a variable containing three keys which are all simple functions. I'm trying to run an input through all three functions and log it to the console with a for... in... loop, but I'm not sure how to do it. I can't seem to get the input to actually go through the keys themselves.
>>
>>56372663
Follow the fucking well-established OP format. The OP isn't your personal shitposting space.
Adding a bunch of shit into the OP and/or posting a retarded image will set a terrible tone for the entire thread, and there will be much more shitposting overall.
Just look at threads with frogs, US election or trap OP images.
>>
>>56372647
>>56372683
>>56372698
>>56372700
Learn Erlang.
>>
File: 1472568273491.png (929KB, 873x1079px) Image search: [Google]
1472568273491.png
929KB, 873x1079px
I've got basic knowledge of Python and C++. What's the best book to guide me into Java? I'm reading pic related just for general programming skills and it's pretty good.
>>
>>56372708
Post code.
>>
>>56372563
What do traps have to do with programming?
>>
>>56372719
unlearn Python
>>
>>56372712
It follows good practice. It includes /dpt/ in the title, and links to the previous thread. Those are the only consistent features of /dpt/ OPs.
>>
>>56372715
Erlang is useless.

>>56372719
haskellbook.com
>>
File: 1450731958946.jpg (293KB, 1920x1080px) Image search: [Google]
1450731958946.jpg
293KB, 1920x1080px
I'm working on a desktop wallpaper randomizer that supports multi-monitor setups. Its working great, but only on GNOME right now. Is there some *nix way to set the desktop wallpaper without having to worry about figuring out what DE/WM the user is currently running?

Otherwise, I'd just have to write some routine for every fucking DE/WM out there... Right?
>>
>>56372737
What do traps have to do with what I said?

>>56372742
>it follows good practice
No it doesn't, it reads as an autistic rant by someone who just got here and is into "the memes"
>>
>>56372731
http://pastebin.com/jF4VeCTT

It's the FizzBuzz challenge. I thought running the numbers through the three functions would be a good place to start.
>>
>>56372742
Are you new?
It's been
>/dpt/ in title
>Old thread link
>What are you working on /g/?
for years, and NOTHING ELSE.
>>
>>56372767
>and NOTHING ELSE.
Obviously this is a pretty shitty thread thanks to OP (who is definitely a faggot among faggots) but this plainly isn't true
>>
>>56372742
>it follows the bare minimum qualifications of consistency so i can use the rest of it as an epic meme space x--DDDDDDDDDD
1) This is what your post reads like
2) No, see >>56372767 for the ACTUAL CONSISTENT BODY OF THE OP
>>
>>56372763
Use Feh
>>
>>56372775
I bet you thought the umaru threads were acceptable or some shit.
Anything besides the standard /dpt/ format has always been plain shitposting.
>>
>>56372683
But I don't like polish notation.
>>
>>56372802
Then learn Haskell instead
>>
>>56372767
That template is ableist, as it presupposes that all /g/ posters are able to work.

>>56372764
It is helpful and informative for new readers, unlike the common "miyuki-chan edition, traps are best programmers!" nonsense.
>>
>>56372601

Ok I installed pillow, how do I use it to draw shit?
>>
>>56372766
Read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects
>>
>>56372767
Why do you care?
Are you autistic?
>>
>>56372501
>>OSGTP
>A Microsoft shill, C# expert, also known as "mummy"

wew
>>
>>56372806
Autism is neither helpful nor informative
>>
>>56372823
What's wrong mummy?
>>
>>56372823
Hi mummy!
>>
>>56372812
Because community guidelines need to be maintained. If you let newfags walk in and act however they want, the place will devolve into crap even more than it has.
>>
>>56372846
Where does it say those are the guidelines, or law?

And only a newfag calls others newfag you autistic retard. Get over it.
>>
>>56372797
Shit, you're right.

I originally started this because I'm too dumb to figure out if feh can set a different image per screen, but now that I'm generating one image that spans all the screens, using feh would be simple.

Thanks, anon.
>>
>>56372763
There is the stock XORG desktop that you can set with nitrogen or feh, but every faggot DE draws their own in a layer on top. So you will need a switch case for every one, sadly.
>>
JSfags get triggered by criticism of their language, ban criticism at their conference: https://mobile.twitter.com/marcosc/status/770136032113287168
>>
File: 1406803019377.jpg (103KB, 1280x720px) Image search: [Google]
1406803019377.jpg
103KB, 1280x720px
>>56372871
It's your fucking job to lurk more and find out, or fuck off.
Do you walk into a chess club, start making a ruckus and pissing everyone there off, try and force them to play checkers instead, and get defensive when they tell you to piss off?
>>
>>56372739
>>56372759

Are there no real answers here on /dpt/? I just want to learn Java so I can get out there and get my first job programming. Thanks.
>>
File: 1470343533729.jpg (45KB, 421x445px) Image search: [Google]
1470343533729.jpg
45KB, 421x445px
>>56372886
Unsurprising that people who like Javascript are incapable of listening to reason

>>56372871
>only a newfag calls others newfag
>>
>>56372939
Java is a horrible language
>>
>>56372939
You don't just 'learn Java'. It is a fool's errand. Learning concepts is more important.
>>
>>56372871
>only a newfag calls others newfag
This is some bullshit made up by newfags
>>
>>56372955
but isn't it the most marketable one right now? I could go with Python or C++ instead, but it might be harder to get a job with those.

>>56372966
I'm working on the fundamentals with SIoCP, but I want to learn the Java language as well.
>>
Is jizzbuzz really something that people should know thesedays? I asked a programmer friend who has been working for like 5 years what is it and he didnt even know.
>>
>sitting in embedded programming class
>lecture is on bitwise operators
>everyone is lost and confused

God dammit why did I cheap out on university choice.
>>
>>56372872
>>56372881
https://wiki.archlinux.org/index.php/feh#As_a_desktop_wallpaper_manager

Yeah, looks like I can't simply use feh.

Good shit, thanks for the info.
>>
>>56372886
I can only hope that WASM will purge web dev of this foul taint. I want SJW framework monkeys to leave.
>>
>>56373008
>Is jizzbuzz really something that people should know thesedays?
No, you've completely missed the point.
It's something that everyone should be able to do.
Not something you should memorise and then be like "I've done this before" - it's something you should hear as a task and think "this is fucking easy"
>>
>not using the /dpt/ grill
>not asking the question
kys
>>
>>56373006
C# is considerably better, but still very marketable. Also less Pajeet poo in your code base to clean up.
>>
>>56373008
yes I've been a programmer for 10 years in node.js and I can tell you it's the most common interview question I've gotten. Once you know it you know how to program
>>
>>56373006
Java easily has the most jobs, but C# is second place in that regard, significantly higher than Python or C++.

It's also much nicer than Java to use.
>>
File: solution.png (14KB, 851x330px) Image search: [Google]
solution.png
14KB, 851x330px
What are you working on, /g/?


Previous Thread: >>56365584
>>
>>56373069
This is the new /dpt/ template. It is superior.
>>
>>56373112
superior in patheticness, yes
>>
I sent over 200 individually tailored resumes since March (manually). And I went to about 8 interviews but got rejected from all of them. I believe tech interviews are totally f***ed up. I have been asked so many ridiculous questions that makes me sick for days just thinking about them. Every job posting I see asks for "SENIOR DEVS".

So I'm going to take a different approach. I believe in the numbers game. There are ton of companies out there. But its impossible for me to find them one by one.

So I'm building a bot to speed up this process: 1- Find a list of all companies 2- Filter only those companies that hire software devs 3- tailor my resume based on specific keywords 4- send emails 5- reply and arrange interview based on my schedule.

Currently I'm working on the first part. The bot finds a list of companies using major search engines. Each search engine has a certain query limit. So I use proxies to get around it. And when the system runs out of proxies, it starts data processing till the query limits are reset. Currently the bot harvested about 895,000 companies across the US. But only 9000 has been processed to see if they hire software developers.

For the data processing, I used AWS at first but it got pricey very quickly. So I built a nodejs version of my bot and used socket.io to handle connections. I run the bot as a daemon on each one of the library computers of my University. There are about 80 computers that I can access without credentials. Also I connected my slack bot to get live status from each processing node. I think at some point the system admin will notice the unusual CPU loads. So I renamed the nodejs process as chrome and I run the bot during busy hours to make it look like people are using chrome on those computers.

Anyway, so the only important part left is to automatically tailor my resume based on keywords. I don't exactly know how to go about this. Do I need to use some kind of machine learning method?
>>
>>56373130
You could try a markov chain
>>
>>56373130
This smells of a crosspost for fat stacks of (You)s.
>>
Rate my masterpiece

def fizzbuzz(n):
for i in range(1, n):
if i % 15 == 0: print ('fizzbuzz')
elif i % 3 == 0: print ('fizz')
elif i % 5 == 0: print ('buzz')
else: print (i)
>>
>>56373130
>>56373152
Yep, it's a reddit post, and this never happened anyway.

McFucking Kill Yourself.
>>
>>56373157
it functions but that's about it
1/10
>>
>>56373157
>elif
Fucking why
>>
>>56373170

write something better nignog
>>
>>56373202
I've done so dozens of times
>>
>>56372808
https://pillow.readthedocs.io/en/3.3.x/
>>
File: Vqr4p1E.png (116KB, 1515x663px) Image search: [Google]
Vqr4p1E.png
116KB, 1515x663px
Can we get some more of these?
>>
In a book I'm reading there's a question: What is a statement that introduces a new name into a program with memory set aside for a variable called? Is the answer declaration or definition? I assumed that a definition was for defining behaviour of a function whereas declaration is the right answer?
>>
>>56373295

assignment dumbass
>>
>>56372563
The thread is daily and has been for years so I think by this point the OP image doesn't really matter.
>>
>>56373157
PHP Master Race checking in with this hot bit of code.

<?php

function fizzbuzz (n) {
while (n) {
$hasEchoedFizzOrBuzz = false;

if (n % 3 == 0) {
$hasEchoedFizzOrBuzz = true;
echo "fizz";
}

if (n % 5 == 0) {
$hasEchoedFizzOrBuzz = true;
echo "buzz";
}

if (!$hasEchoedFizzOrBuzz) {
echo n;
}

i -= 1;
}
}
>>
>>56373310
Assignment is just another name for declaration.
>>
>>56372698
Scheme is good for the huge amount of recommended reading material on it. If you read the Schemer books and SICP, which you probably would while learning Scheme, you'd be a much better programmer and computer scientist overall. All things considered, as long as you're learning the paradigm, the specific language isn't horribly relevant.
>>
>>56373345
> i -= 1;

What
>>
>>56372871
did you read that on know your meme?
>>
I just finished SICP chapter 2 (out of 5). Will the next chapters blow my mind or should I start doing practical stuff?
>>
>>56373356
i = i - 1
, innit?
>>
>>56373400
>Will the next chapters blow my mind or should I start doing practical stuff?
Congrats, /dpt/.

You got another one to waste their time with the SCIP meme.
>>
File: dyplom9.png (43KB, 506x388px) Image search: [Google]
dyplom9.png
43KB, 506x388px
>>56373288
>>
File: dyplom8.png (88KB, 890x670px) Image search: [Google]
dyplom8.png
88KB, 890x670px
>>56373428
>>
>>56373310
Infact, you're wrong. Assignment obliterates the current value of an object. Initialization is what I meant.
>>
I've been hobby-programming for over 10 years. I have no degree and no car, and I live in a town in a rural tourism-economy state. How do I into career?
>>
File: dyplom7.png (105KB, 766x434px) Image search: [Google]
dyplom7.png
105KB, 766x434px
>>56373439
>>
>>56373444
Initialization is declaration + assignment. Assignment can be seen as a form of definition.
>>
File: dyplom6.png (79KB, 728x800px) Image search: [Google]
dyplom6.png
79KB, 728x800px
>>56373456
>>
>>56373404
I think they meant

$n -= 1;
// or
$n = $n - 1;
// or
$n--;


But n is fucked up all over, there's no $ in front of it. Fuckin' PHP """""devs"""""...
>>
File: dyplom5.png (95KB, 694x670px) Image search: [Google]
dyplom5.png
95KB, 694x670px
>>56373478
>>
>>56373456
>no setters
not pajeet enough
having no setters means that the pajeet in question at least used encapsulation correctly (even though redundantly)
>>
>>56373502
I don't think encapsulation means what you think it means
>>
File: 1449700279793.png (74KB, 300x256px) Image search: [Google]
1449700279793.png
74KB, 300x256px
>>56373502
I was about to say it has "setDefinition" but then I realized it's the same as "getDefinition".
>>
>>56372708
Why won't my car start?
>>
File: dyplom4.jpg (27KB, 694x732px) Image search: [Google]
dyplom4.jpg
27KB, 694x732px
>>56373499
>>
>>56373532
this is genius
>>
glorious functional master race

In elixir:

defmodule FizzBuzz do
def fizzbuzz(x) when rem(x, 15) == 0, do: "fizzbuzz"
def fizzbuzz(x) when rem(x, 3) == 0, do: "fizz"
def fizzbuzz(x) when rem(x, 5) == 0, do: "buzz"
def fizzbuzz(x), do: x
end

IO.inspect Enum.map(1..100, fn x -> FizzBuzz.fizzbuzz(x) end)
>>
>>56373428
What's wrong with this one aside from not being a switch?
>>
I'm making a prototype for something I'm eventually gonna write in C, right now it's in python. I'm using pillow to iterate over an image and store all the pixels' color values in a dict. How do I properly multithread this to make it faster?
>>
File: dyplom3.png (114KB, 694x670px) Image search: [Google]
dyplom3.png
114KB, 694x670px
>>56373532
>>
>>56373550
Misplaced strtolower, I presume.
>>
>>56373550
you might want to make $email lowercase and then compare it to noko or nonoko, rather than comparing raw $email to lowercase version of noko and nonoko
>>56373428
za każdym
>>
File: dyplom1.png (78KB, 500x577px) Image search: [Google]
dyplom1.png
78KB, 500x577px
>>56373556
>>
File: dyplom0.png (115KB, 850x800px) Image search: [Google]
dyplom0.png
115KB, 850x800px
>>56373588
>>
>>56373547
>In elixir
I've been meaning to learn Elixir. My buddy is really fond of it.

What kind of applications is Elixir well-suited for?
>>
>>56373575
chuj ci w dupe
>>
>>56373637
FizzBuzz and smaller
>>
>>56373637
trolling buddies, apparently
>>
>>56373637
They got a neato web framework called phoenix that I've been learning

My guess would be web applications that are IO heavy and not computationally stressful
>>
>>56373644
Ładnie nam się pan przedstawił przed milionami kuców
>>
>>56373588
This is a hilarious joke, not a failure shitcoding. Does not belong in the meme.
>>
>>56373637
Shilling to Rubyists and getting odd stares from Erlang programmers.
>>
File: 42f5ce85.png (356KB, 658x357px) Image search: [Google]
42f5ce85.png
356KB, 658x357px
>>56373667
>milionami
>kuce
>szambo
xD
defekentom polibudy dziekujemy
>>
>>56373691
to nawiązanie do pamiętnego telefonu do radia maryja
jak młodym trzeba być żeby tego nie znać?
>>
>>56373667
>>56373691
>>56373712
>>>/int/
>>
>>56373645
>>56373646
>>56373677
ayy
okay

I'll avoid it and learn Haskell for a try at functional programming instead.
>>
>>56373724
speaking of int, how do I average two integers in C?
>>
>>56373724
Easter?
>>
import Control.Monad.Writer

factor n msg x =
when (x `mod` n == 0) $
tell msg

mempty `mOr` y = y
x `mOr` _ = x

tag loggers n = tags `mOr` show n
where tags = execWriter $
loggers `forM_` ($n)

main = [1..100] `forM_` (putStrLn . tag factors)
where factors = [ factor 3 "Fizz",
factor 5 "Buzz" ]


Wish there were some kind of built-in "mOr" in prelude
>>
>>56373734
Grab SICP and learn Scheme.
>>
>>56373741
i don't know how to do this in c, this is g
>>
>>56373765
cast as float & round the result, duh
>>
>>56373478
I know this is a joke, but FYI:
1 kb = 1000 bits
>>
>>56373476
So declaration is just declaring the type and the declarator then and it frees up some memory for it upon compilation?
>>
>>56373791
In most languages, yes, declaration of a variable guarantees there will be memory you can address, whether in the data segment or on the stack.
>>
>>56373741
(a >> 1) + (b >>  1)


amidoinitrite?
>>
>>56373754
whoops, mOr is wrong

x `mOr` y | x /= mempty  = x
| otherwise = y
>>
>tfw no higher-rank polymorphism and therefore polymorphic recursion in Rust
Actually, it has higher-rank polymorphism, but only for lifetimes. What a kick in the dick.
>>
>>56373810
No
>>
>>56373912
>higher-rank
Rust is an inclusive language and it will brook no classism such as that.
>>
>>56373345
>all those undefined constants for variables
>i-=1

for($i=1; $i<=100; $i++, $t='') {
if($i%3==0) $t.='Fizz';
if($i%5==0) $t.='Buzz';
echo $t ? $t : $i, "\n";
}
>>
>>56373940
whats wrong with that
>>
>tfw your program, made in a few months, generates better results than what a major international company got in several years

Alas, I can't really say more (confidential info and all), but hell I'm proud!
>>
>>56373967
Try it with a = b = 1
>>
>>56373967
try averaging 7 and 5
>>
>>56373999
I don't believe you.
>>
>>56373912
Not a functional programming nerd, but curious, here. What does that mean, anyway?

Type an example in Rust of what you think *should* be possible, but isn't.
>>
>>56373999
I sort of know that feel.

The project I'm working on now does the same functionality as a major software competent, but much faster.

I'm two months in on it, and a good analogy would be that I've got all the pieces working, but they're strewn out on a table connected by exposed wires.

I've got to create the encasement and the user interface now, so to speak.
>>
>>56374014
you don't have to and I don't have any proof to provide. But I think the said company just didn’t want to spare some time on this, whereas it is an important point for mine.
>>
>>56374020
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
>>
>>56374040
nice!
I totally see what you mean, well good luck with your project!
>>
>>56372501
>Our resident trips:
>>OSGTP
>A Microsoft shill, C# expert, also known as "mummy"
C# fanboy who can't actually code.*

>>Ruby
>Dynamic language aficionado, of indeterminate gender
Dynamic language fanboy who doesn't actually code, browses tumblr.*

>>nv
>Knows some type theory, will forever be working on his own language
Idiot wannabe-langdev who spends too much time on IRC*

You gave attention to tripfags and posted an image that has nothing to do with programming. Kill yourself, OP.

>>56372647
I like Scheme and Clojure. Ocaml is fun but it's a pain in the dick for a first timer. Don't use Haskell. It's useless for anything other than Window Manager config files.
Don't learn functional programming for the sake of functional programming. Paradigm-fags are never good at anything.

>>56372712
I agree with you in a general sense, but
>implying the trap OP images don't make the best threads
>>
>>56374020
How can I give an example in Rust of something that can't be expressed in Rust?
>>
What IRC does /dpt/ use?

We had the maths Slack a while back, but it died, and wasn't really about programming anyway.
>>
File: ruby brony.png (15KB, 796x293px) Image search: [Google]
ruby brony.png
15KB, 796x293px
>>56372501
>>56374076
You forgot something
>>
>>56372501

I had learning Java from Beginning Programming with Java For Dummies book.

But recently I start learning from another book that call Head First Programming (Python) because I realise that learning computer language is not enough and I actually need to learn programming.
>>
File: ruby_is_a_brony.png (47KB, 955x497px) Image search: [Google]
ruby_is_a_brony.png
47KB, 955x497px
>>56374094
Here, add this to your collection, too.
>>
>>56374094
Hahahahahahaha holy shit
>>
>>56373734
Haskell has pretty godawful hash map insertion performance, especially if you're inserting millions of values into one table. You should skip it and learn OCaml or F# instead.
>>
>>56374129
Both those languages have crippled type systems.
>>
>>56374112
I already had this, thanks

>>56374129
Use the containers library
>>
>>56374080
>How can I give an example in Rust of something that can't be expressed in Rust?
I mean, if the syntax can describe it but the compiler won't understand what you're trying to do.
>>
>>56374140
What good does a type system do you when your hash map performance is unacceptable?
>>
>>56374088
Slack is not IRC. It is harmful. So too is Discord.
>>
>>56374154
Anon, you can implement your own hash maps
>>
>>56374154
See >>56374143
>>
>>56374163
Not in Haskell. Not if you want them to perform fast.
>>
>>56374178
>Not in Haskell. Not if you want them to perform fast.
How does lying contribute to the thread?
>>
>>56374158
I didn't even say Slack was IRC.

Fucking freetards, goddamn. Kill yourself.
>>
>>56374088
bump for interest

is there official /dpt/ irc channel?
>>
>>56374158
>harmful ...Discord.
Discord is a comfy program to use but the fact that they give you free servers but it doesn't have any obvious monetization scheme spooks me.

How likely is it that Discord surveils everything you say and then sells a dossier on you to targeted advertising firms?
>>
>>56374020
I don't know how it would be best expressed in Rust, so I'll just use Haskell.
foo :: (forall a. a -> d) -> b -> c -> (d, d)
foo f b c = (f b, f c)
-- foo show 10 "Hello" = ("10", "\"Hello\"")

It works in Haskell because everything is boxed, and polymorphic functions can be implemented with void pointers. The existential part of higher-rank polymorphism can just be fat pointers, which Rust already has.

>>56374050
Higher-kinded =/= higher-rank
>>
>>56374198
Of course they do that, you numpty. You are the product.
>>
>>56374198
>VCs include Tencent and Time Warner
100%
>>
>>56374198
If you don't pay money, you're the product.

That being said, they don't care about you, specifically, and they're not selling a dossier on you, specifically.

The value comes from the aggregation of the millions of users, and what keywords they use, etc.
>>
>>56374210
Regardless, you can't do either in Rust.
>>
>>56374210
>(forall a. a -> d)
Give a non-trivial instance of this function
Non-trivial meaning "not const"
>>
>>56374020
>>56374210
Oh, and it ~could~ work in Rust as long as the polymorphic type variable is only used behind a pointer, e.g. &T, Box<T>, etc.
>>
>>56374189
Let's see some benchmarks.
>>
>>56373157
from sys import argv

def generatePrimes(words):
limit = len(words) ** 2
notPrimes = []
for a in range(3, limit):
for b in range(a * 2, limit, a):
notPrimes += [b]
notPrimes = set(notPrimes)

i = 3
x = []
while len(x) < len(words):
if not i in notPrimes: x += [(words[len(x)], i)]
i += 2
return x

if __name__ == "__main__":
if len(argv) < 3:
print "FizzGen requires at least 2 arguments. An int, and some strings."
rangeLimit = 100
primes = [("Fizz", 3), ("Buzz", 5), ("Bar", 7)]
else:
rangeLimit = int(argv[1]) + 1
primes = generatePrimes(argv[2:])

for number in range(1, rangeLimit):
print ''.join([
string
for string, prime in primes
if number % prime == 0 ]) or number

https://gist.github.com/LandonPowell/aeacf1f02b49fdb96ba2f7607d5baf27

Your FizzBuzz is like a little baby, trying desperately to walk.

>>56373345
>>56373966
Fucking Pajeets.
Let me show you how it's done in a real language.

#!/usr/bin/dy
each { x range
if { divisible(x 3) p:'Fizz' }
if { divisible(x 5) p:'Buzz' }
elf { !:divisible(x 3) p:x }
out
}
>>
>Watching MIT recitation
>TA has coded meme references into his code like 'All Your Code Are Belong To Us'
>acknowledges it in front of the entire class

why
>>
I'm trying to find a good tutorial on setting up a Java application (on desktop) to be able to talk to a Java server.

All I can find are ones that set up a web page rather than talk to an app

For context my architecture will be:

App <--> Server <--> MySQL DB
>>
File: 8799631.jpg (2KB, 84x84px) Image search: [Google]
8799631.jpg
2KB, 84x84px
>>56374251

Nice one Landon, but mine literally prints the same as yours dumbass.
>>
>>56374262
Use sockets.
>>
>>56374076
I haven't been on irc in like a month
>>
>>56374210
>so I'll just use Haskell
>Not a functional programming nerd, but curious, here

I can't read Haskell syntax. This is why I wanted it in pseudo-Rust. I have no idea what this implies.
>>
>>56374251
what the fuck is dy
>>
>>56374253
To be fair "All your [x]" is ancient (pretty sure it predates YTMND?)
>>
>>56374288
You can't express it in Rust, though

You're like the person who tries to learn monads by attempting to implement them in Java
>>
>>56374210
show is forall a. (Show a) => a not forall a. a
>>
>>56374299
>pretty sure it predates YTMND?
It's from Zero Wing, faggot
>>
>>56374237
show

Any function whose domain is polymorphic can be used. The range doesn't have to be.

>>56374288
The same function in Rust (hijacking the higher-rank lifetime syntax):
fn foo<F, B, C, D>(f: F, b: B, c: C) -> (D, D) where F: for <A> in fn(A) -> D {
(f b, f c)
}
>>
>>56374316
The adaption of that entire dialogue as a meme, you god damn mongoloid
>>
>>56374217
>>56374221
>>56374231
Yep, I figured.

I'm going to try to get my friends to move back to Teamspeak, before some dickhead sells the knowledge that I'm [spoiler]a gay furry[/spoiler] to potential employers and/or future NRx degenerate-slaying death squads.
>>
>>56374251

lmao
>>
>>56374196
>>56374196
>is there official /dpt/ irc channel?
>>
>>56374327
Thanks bruv.
>>
>>56374210
>everything is boxed
That sounds terrible.
>>
>>56374340
Gay furries make good employees, they have more incentive than most to not get fired and have to try to get another job, most interviewers find fursuits off-putting.
>>
>>56374340
>trying to get normies to use anything but Discord

I've given up on trying to get them to move back to TS.

I don't even care about the privacy thing, nor am I a freetard, but TS is far superior for voice chat.
>>
Beat this.


for i in range(1,101): print ("FizzBuzz"[i*i%3*4:8--i**4%5] or i)
>>
>>56374312
It's less generic, so it can be used wherever the latter is expected. It just puts additional constraints on the rest of the parameters:
foo show :: (Show b, Show c) => b -> c -> (String, String)


>>56374359
In retrospect, the higher-rank lifetime syntax extends perfectly to types, so I should have just used that in the first place.

>>56374365
It's part of being lazy, and also so that they don't have to monomorphize.
>>
>>56374327
see >>56374312
show is not forall a. a
show is forall a. (Show a) => a

i think you could maybe do this with constraint kinds


>>56374365
you can force strict evaluation
>>
>>56374384
>the fizzbuzz of the lord
And people said python was a meme lang
>>
>>56374379
Also Discord doesn't have a Linux client.

To be fair, the other thing normies use is Skype. Discord is WAAAAAAY better than Skype in pretty much every way, except that Skype has a Linux client.
>>
Threadly reminder that you can't use haskell to make real programs, and if you try to anyway they'll have unfixable program-crashing bugs because of all the hacks
>>
>>56374407
Oh, I didn't realise constraints worked that way
>>
>>56374422
One liners are clearly all satanic, you demon worshiper.
>>
Rust can't do

(forall a. m a -> n a) -> (forall b. m (m b) -> n (n b))
>>
>>56374426
No, Discord isn't better at all. It fails the bare minimum requirement of being better than Skype. It's just as bad.
>>
print('\n'.join('FizzBuzz' if i % 15 == 0 else 'Fizz' if i % 3 == 0 else 'Buzz' if i % 5 == 0 else i for i in range(100)))
>>
File: pajeetslayer.png (46KB, 774x921px) Image search: [Google]
pajeetslayer.png
46KB, 774x921px
>>56374384
>not using semen operators liberally
>>
>>56374426
>Skype has a Linux client
That is majorly gimped and segfaults on start every other release.
>>
>>56374413
>>56374434
Actually, you guys are probably right. That shouldn't work the way I've written it. But yes, constraint kinds would make it possible.
>>
>>56374428
Just because your language is like that it doesn't mean that Haskell is too.
>>
>>56374426
>using Linux for gaming, where you would even use a VOIP
>>
>>56374278
>mine literally prints the same as yours dumbass
Firstly, I posted my GitHub intentionally. I'm an attention whore and a faggot.
Secondly, read my code and you'll realize yours isn't as full-featured as mine is.
Thirdly, check the first line it prints.

>>56374291
https://github.com/LandonPowell/DeviousYarn
Autistic programming language I made. It's mostly LISP inspired. I haven't optimized it or done any speed testing, but I'm pretty sure it's faster than PHP.

>>56374384
>>56374422
>>56374448

I've got this -
for x in range(1,101):print(x%3==0)*"Fizz"+(x%5==0)*"Buzz"or x


But I've also got this -
HAI 1.2
I HAS A VAR
VAR R 1
IM IN YR FIZZBUZZ UPPIN YR VAR WILE BOTH SAEM VAR AN SMALLR OF VAR AN 100
NOT MOD OF VAR AN 15
O RLY?
YA RLY, VISIBLE "FIZZBUZZ"
MEBBE NOT MOD OF VAR AN 3, VISIBLE "FIZZ"
MEBBE NOT MOD OF VAR AN 5, VISIBLE "BUZZ"
NO WAI, VISIBLE VAR
OIC
IM OUTTA YR FIZZBUZZ
KTHXBYE
>>
WHY THE HELL DOES CURSES TREAT RGB AS 0-999 AND NOT 0-255 THIS MAKES EVERYTHING MORE TIME CONSUMING REEEEEEEEEEEEE
>>
>>56374484
ok but why did you name it after a potato
>>
>>56374493
>0-999
kek
>>
File: 4.0.png (2MB, 3840x2160px) Image search: [Google]
4.0.png
2MB, 3840x2160px
Rolling
>>
>>56374280

Thanks for the suggestion - will it allow for some decent serverside logic and a mysql connection?

I looked at spring/maven but the learning curve seems way too steep for the amount of time I've got
>>
>>56374484
Any relation to Enoch?
>>
>>56374458
If I don't care about audio quality because I have cheap chinkshit headphones anyway, in what way is Discord not better than Skype?

Unless I'm missing something, Discord isn't a buggy memory-leaking mess, and Discord doesn't serve you ads that can contain malware.
>>
>>56374493
It predates binary numbers.
>>
>>56374474
That said, that's a contrived, pathological example. Higher-rank polymorphism is much more useful for nested data types and polymorphic recursion, and those issues don't crop up since you're not writing overly-generic combinators.
>>
>>56374508
You can use whatever logic and send and receive whatever bytes you like with them.
>>
>>56374497
Fun naming conventions, like "DeviousYarn Interpreted Executable (*.die)", "Dynamite", etc.
>>
>>56374531
It's also used in at least one monad transformers function.
>>
>>56374251
>calculates divisible(x 3) twice
>doesn't realize the entire purpose of fizzbuzz is to weed out people that can't avoid such duplication
>calls people Pajeets
>>
>>56374105
how is that Head First book going for you? I'm doing the C# one, pretty good so far.
>>
>>56374483
Sometimes you just want to use VOIP to talk to internet friends.
>>
>>56374550
Regions?

Yeah, it's useful for regions, and funnily enough Rust has that higher-rank lifetime polymorphism so it actually already covers that use case.
>>
File: 1464955046751.jpg (22KB, 417x421px) Image search: [Google]
1464955046751.jpg
22KB, 417x421px
I don't know if anyone will answer this, but out of interest, how many hours should a M.I.T online course take? Or rather, what is roughly the time frame you are to be expected to invest in order to complete the course? Would anyone have an idea?

example:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/index.htm

100 hours? 200 hours?
>>
>>56374547
You could have gone with FarligUlv and then had code files with the extension .fuc
>>
>>56374576
I was thinking of the hoist function.
>>
>>56374599
Oh, I see. Yes, higher-rank polymorphism is necessary to encode natural transformations.
>>
REMINDER TO USE THE NEW OP TEMPLATE FOR THE NEXT THREAD, THANK YOU
>>
File: thumbs-up[1].jpg (3MB, 2304x3456px) Image search: [Google]
thumbs-up[1].jpg
3MB, 2304x3456px
>>56374536
>>
>>56374623
It makes you wonder what they're trying to achieve with Rust if it doesn't contain even this basic functionality.
>>
Any idea on a cool Machine Learning project?
>>
>>56374647
Learn a machine to create dank memes.
>>
>>56374512
Never heard of it. Is it your lang? Link?

>>56374551
The only way you can avoid duplicating the divisible(x 3) is by calculating another divisible or by holding a variable in memory. This is an example of acceptable duplication because you only have to deal with checking if a modulo of a number equals zero anyways.

If you'd like it in your preferred way, pajeet, here you go -
#!/usr/bin/dy
each { x range
fizznigger = divisible(x 3)
if { fizznigger p:'Fizz' }
if { divisible(x 5) p:'Buzz' }
elf { !:fizznigger p:x }
out
}
>>
File: mammon3_1.jpg (256KB, 800x800px) Image search: [Google]
mammon3_1.jpg
256KB, 800x800px
>>56374517
They are exactly as bad as each other. By using them, you are whoring away your right to privacy in lurid congress with Mammon and submitting to a thought-slave covenant. You're denuding your soul before a money-construct devoid of morals or a conscience. Cross that threshold and you have no principles left whatsoever. It's utterly meaningless to compare their sound quality.
>>
>>56374657
No, I was referring to Enoch Powell.
>>
>>56374676
Ah, kek, I thought it was just a lang that had some etymology involving https://en.wikipedia.org/wiki/Enochian

No, no relation.
>>
>>56374644
I wouldn't call it basic functionality, but it is surprising that they don't even seem to want to consider it. To be fair, a lot of the use cases for higher-rank types in systems programming are subsumed by Rust's lifetime system, which does have higher-rank polymorphism (presumably because lifetimes are erased and don't need monomorphization).

The lead language designer said this about the lack of polymorphic recursion:
>I am going to close this as "not a bug, working as designed".
https://github.com/rust-lang/rust/issues/4287
It only takes a bit of creativity to implement higher-rank types without boxing everything.
>>
>>56374730
They'd rather focus their efforts on getting more attack helicopters into programming. It's a shame, Rust could have been so much more than it is going to be.
>>
>>56374754
Fuck off, /pol/.
>>
>>56374583

2^64 hours approximately
>>
File: 1472631300743.jpg (77KB, 776x600px) Image search: [Google]
1472631300743.jpg
77KB, 776x600px
>>56374754
>attack helicopters
>>
>>56374765
I'll not fuck off as long as programming and politics intersect.
>>
>>56374112
Literally nothing wrong in having a pony wallpaper.
>>
>>56374791
Kill yourself, ponyfag.
>>
>>56374664
Don't go off-meds unless your doctor tells you it's okay, Ted.
>>
Can someone explain to me why 'Rust' is hated so much? I actually don't know anything about the language, I just assumed you guys were talking about the game
>>
Programming is Magic
>>
>>56374754
Thanks for the memes, Pajeet-kun.
>focus their efforts
I seriously doubt the Code of Conduct stuff consumes any significant amount of coder time to administrate.

Development on Rust, Rust standard libraries, and other libraries in Rust are marching forward nicely.
>>
>>56374808
Infamous for pandering to the SJWiest of the SJWs.

I think it was Rust that got triggered over an eggplant and the guy ended up getting banned globally from GitHub.
>>
File: 1472539335333.gif (2MB, 271x303px) Image search: [Google]
1472539335333.gif
2MB, 271x303px
>>56374800
>I don't want advice so you must be crazy
Suit yourself, wretch.

Mammon hungers.
>>
>>56374816
Only if you use Lisp
>>
>>56374836

What the fuck did they spray the car with? Aerosols?
>>
>>56373616
>>56373588
>>56373556
>>56373532
>>56373499
>>56373478
>>56373456
>>56373439
>>56373428
>>56373288
These were great thanks famalam.
>>
>>56374836

anyone got the continuation
>>
>>56374808
It's actually good and many people here like it. That's why trolls like to shit on it all the time, much like the response to C.

There are legitimate complaints, like that borrow checker / lifetime shit requires a ridiculous amount of cognitive load to get right the first time, but shitposters would rather talk about how you're not allowed to call people "degenerates" in pull requests.

Like this guy: >>56374832
>>
>>56374754
>attack helicopters
>>56374832
>eggplant

You both sound as unhinged as the mammon guy. Are you speaking in code? Because I have no idea what the fuck you're saying.
>>
>>56374836
I have read the Slatestarcodex post on Moloch. It's just that I think you're radically overstating the significance of targeted advertising information.

If you try your best to keep your shit private, but you miss something and somebody rootkits your computer, does that also make you a dirty slut-slave of babylon?
>>
>>56374872
>There are legitimate complaints, like that borrow checker / lifetime shit requires a ridiculous amount of cognitive load to get right the first time
Only if you don't understand how it works. Not saying there aren't situations where the borrow checker is overly conservative, but they're easy to avoid.
>>
>>56374888
I'm speaking from an oldfag forums-user context rather than normies who misuse the term "troll." :^)

I mean, people want to get a rise so they can giggle at the anon who got really mad about autistic shit on the internet. Those people then go meme about Rust.
>>
>>56374428
A lot of places use Haskell these days, all trading floor jobs, all big data jobs esp in oil and gas industry, I'm constantly seeing Haskell popping up on HN hiring threads.

There is a bunch of hacks in their compiler, I wouldn't want to use it but people definitely are
>>
>>56374915
https://archive.is/7b1iG

It was Node.JS, actually.

Guy posted an eggplant emoji next to a toilet paper roll emoji.

He was banned from the Node.JS repo, and subsequently banned from all of GitHub.
>>
>>56374943

that is not called trolling anymore, try to keep up
>>
>>56374959
Maybe "funposting"?
>>
>>56374808
Oh I also forgot to mention.

Rust the language is good.

Rust the game is fucking shit where you grind a lot and then if you don't play 16 hours a day some naked guy with a rock will steal all of your shit while you're logged off.

It's just a griefing simulator.

Same goes for ARK: Survival Memed.
>>
>>56373741
Look up any quicksort algorithm, to average you want the sum of all values divided by the total number of values

(min +max) / 2
>>
>>56374995
Doesn't work you moon
>>
Anyone here use Scala? How is it?

Thinking about learning it, I already know C and Python.
>>
>>56374808
Rust is sort of a middleware, it allows you to link together C libraries and use them in a guaranteed memory safe manner.

It's still very much in development and they are actively trying to cram absolutely everything into the language spec so filling daily with complexity.

I'd check back in 2 years to see where Rust is or go play with servo the browser written in Rust to fuck around in alpha
>>
File: 1462047431609.gif (391KB, 640x360px) Image search: [Google]
1462047431609.gif
391KB, 640x360px
Working on a script to break apart the titles people post anime with, and match them to a database.

I already had one, but it didn't work very well. I matched over 200,000 shows to a series with it, but it missed about 80,000.
Like a huge fucking retard instead of having my script re-check only the 80,000 I missed before, I decided to reset all 280,000 titles. This is going to take fucking days now.
>>
>>56375030
>Rust is sort of a middleware, it allows you to link together C libraries and use them in a guaranteed memory safe manner.
Well, yes, but you can also write those libraries, drivers, etc. yourself in Rust. It's a systems programming language.
>>
>>56374529
>>56374504
IT'S SUFFERING
>>
>>56374808
Rust and Go were announced in the same week. Go is almost at version 2.0 and Rust is... still in alpha? I've lost count.
>>
>>56375030
>no higher-rank polymorphism
>no higher-kinded types
It's a bit rubbish, eh?
>>
>>56374753
very little
>>
>>56375045
Go is garbage. It's a middle ground between C and Python (as in worse than both) that nobody asked for.
>>
>>56375068
It was literally designed for people who aren't capable of using a better language.
>>
>>56374808
It's horribly designed, the syntax is just plain silly, and i/o is a pain in the dick with it. The obsession with what the Rust devs define "safety" as makes it completely unusable. Effectively, it's C, but ever so slightly worse.

Go check how you implement an input-prompt in Rust and you'll see why it's shit. Compare it to Golang's -
reader  := bufio.NewReader(os.Stdin)
in, _ := reader.ReadString('\n')

which makes at least a thousand times more sense.

Not really a fair comparison because interpreted vs compiled, but in DeviousYarn, it's just "x = in", and in Python it's just "x = raw_input()".

If you want to make your Rust code one step more of a pain in the ass, try comparing the text you got in your prompt to a hardcoded string.

>>56375068
Cool post, but can you please explain exactly why you dislike it? Your opinion alone is not important to anyone here other than you. You'll have to give some reasoning.

I don't really see the resemblance to Python in Golang, past things that it also shares in common with Javascript.
>>
>>56375068
It's a "memory safe" tool for network programming, specifically concurrent programming using go channels.

It's a good tool, for specific jobs. Their web server is simple to customize and run safe for shit like a customer router that needs a config interface
>>
>>56375049
>Haskell poster says a language is bad because it isn't Haskell
fancy that eh

Rust's type system is basically typeclasses. It actually supports the kind of thing HKTs do, but the standard library hasn't been written with that in mind. You can get pseudo-HKTs through fuckery.

https://gist.github.com/CMCDragonkai/a5638f50c87d49f815b8
https://gist.github.com/14427/af90a21b917d2892eace
>>
>>56375096
microcorruption, and starfighter AVR are both written w/Rails "front end" and Go as the server that does all the work emulating the stock exchange and assembly language, also spinning up the VMs.

go is indeed a tool for certain jobs but of course there is Erlang you could also use for concurrency/custom web servers
>>
>>56375091
>Cool post, but can you please explain exactly why you dislike it?
It's got the polymorphism of C (void pointers), but also a garbage collector. Plus goroutines, I guess.
>>
>>56375091
>The obsession with what the Rust devs define "safety" as makes it completely unusable.
Rust safety is no memory errors. It can crash and get stuck in an infinite loop, but safe Rust code can't lead to an exploit, it won't corrupt your kernel, etc.

If all you want to do is I/O with some processing, Rust isn't the right language for you. Nor would C++ be, nor C.
>>
>>56375131
Erlang is pretty niche. Go is just as good for 99% of its use cases, and a hundred times more usable.
>>
>>56375045
>Go is almost at version 2.0
Source? Last I heard there are no plans for version 2 at all.
>>56375068
It was designed specifically for writing servers and related tools. Show me a better language for this task that is not C++ levels of complexity.
>>
>>56375185
Java

Seriously
>>
>>56375091
>interpreted
Which language are you talking about - Rust or C?
>>
>>56375091

> If you want to make your Rust code one step more of a pain in the ass, try comparing the text you got in your prompt to a hardcoded string.

Oh god, so horrible code!!

use std::io::prelude::*;

fn main() {
let stdin = std::io::stdin();
for line in stdin.lock().lines() {
println!("input==test? {}", line.unwrap() == "test");
}
}
>>
>>56375211
I worked at a UK betting firm for 5 years and they used java to run their gigantic trading engine which did something like 18 million trades per day but when I left they were in the process of switching everything over to Erlang due to numerous issues and pitfalls in Java of which they were tired of writing hacks to work around.
>>
>>56375091
>>56375068
>>56375163
>>56375174
>>56375185

Go has no templates / generics, which encourages unsafe usage of void pointers ("interface {}" in this case)

It deliberately disallows operator overloading, which makes working with vectors and matricies fucking impossible.

A lot of built-in types are "special" and have functionality of a sort users cannot define themselves (I think Go's foreach only works on builtins, yeah?).

Stop-the-world garbage collection makes it impractical for large classes of problems.

The package manager just pulls the latest version of the head branch from the repository of each package you define, which is pretty much guaranteed to break shit constantly. The solution to this is vendoring, which can cause legal issues.


...That said, Go is the best language for its primary niche. That is, building servers, especially servers which don't do much business logic but instead just coordinate I/O operations like multimedia CDNs. I think Go is actually a good language if you think of it as a domain-specific language for building servers in. The central role of channels and CSP coroutines make a lot of sense from that perspective.
>>
>>56375268

>UK
>Betting
>Firm

I bet the money was fucking shit
>>
>>56375211
No, thank you. OOP is a good tool in some use cases, but I don't want to end up overengineering my class clusterfuck, when a procedural solution is easier to read, write, lower on memory and likely faster.
>>
>>56372501
VB.Net forever <3
>>
In the UK, how to get a coding job in America?
>>
>>56375280
Betting is huge in the UK
>>
>>56375310
Move to America
>>
>>56375330
ok
so how much money did you make?
>>
>>56375340

I'm sure the procedure is, get a job, then get an invite to the country, this makes things a lot easier.
>>
Anyone Python around here?
If so, can you explain to me why code related returns A C B instead of A B C?

I mean i can still go through the loop just fine, but why does C go before B?
The syntax is correct so far as i can see.
>>
>>56375279
Is this pasta?
>>
>>56375395
No.

It could be, but I just cooked it up fresh. Repost it if you're a spaghetti aficionado.
>>
>>56375392

Dictionaries are not ordered by nature, you could fix this by calling for key in
 sorted(dict.keys()) 
, this is because of the way hashing works. Hashing generates a bunch of buckets with distinct values, you can't necessarily access those buckets in order.
>>
>>56375408
I swear I've read the exact sentence about vendoring being illegal here before.
>>
>>56374848
Yes. Actually, that's exactly what they did.
>>
>>56375392
for key in sorted(dict):
print(key, " ", dict[key])


I believe you can do this to restore order so it prints out A B C. >>56375413 beat me to it.
>>
>>56375426
Probably because I've been posting the same complaints about Go for a while.
>>
>>56375030

The main problem is that doing low level embedded unsafe Rust, which is supposed to compete with C and is unavoidable, it has worse defined behavior and is ridiculously more verbose than equivalent C. I would wager the UB is even worse than C++.

Until they sort that part out, it won't become anywhere near a better C. And linking jemalloc by default is stupid.
>>
>>56375265
>
.unwrap()

No thanks.
>>
>>56375413
>>56375444
Thanks. That explains a lot.
Though i'm hesitant to sorted() my dictionaries every time i want to go through them.
>>
>>56375392
As a sidenote to other comments:

Do not use dict as a variable name, its a build-in type..

Instead of iterating over a dict like that which re-hashes every key and does a lookup, do this instead:

for key, value in d.iteritems():
print(key, ' ', value)


Use items() instead of iteritems() if python3.
>>
With jsoup i did this
https://jsoup.org/apidocs/org/jsoup/Connection.html#validateTLSCertificates-boolean-
So it doesn't validate certs

Now how do i do it with okhttp?
I need to manually add the certs? is there any way to not validate the certs?

I can't do anything serve side because it's not something i have access, it's not mine
>>
NEW THREAD!

>>56375507
>>
>>56375479
No difference to the go versions
in, _   := reader.ReadString('\n')


where you dismiss the error by writing ,_.

If you check it (which you should) and don't want to panic if the line can't be read
if let Ok(text) = line {
println!("input==test? {}", text == "test");
} else { ... }

go would look very similar
>>
>>56375310
Search for em nigger. I found them by accident but America is a backwards shit hole. Don't waste your time.
>>
>>56375499
The order in which the dictionary is handled keeps changing every time i run the script.
Even sorting before starting the for loop doesn't guarantee a singular order.

Am i overlooking something or am i just too new to Python to notice my error?
>>
>>56375581

Why do you say that?
What state?
How much pay?
>>
>>56375631
The things said in the other replies still hold; dictionaries are not ordered.

So you either call sorted() on the dict while iterating over it, or you can for instance use collections.OrderedDict which is a dictionary that remembers the order in which keys were inserted.
>>
>>56375865
I get what the others were saying.

I got hung on what sorted() did.
I thought it just sorted lists and dicts, but i guess that's only when it's being iterated over?

I mean the sorting doesn't seem to stick in pic related.
>>
>>56373157
static void FizzBuzz()
{
for(int i = 0;i<int.MaxValue;i++)
{
if(i%15) {Console.WriteLine("FizzBuzz"); }
else if(i%3){Console.WriteLine("Fizz");}
else if(i%5){Console.WriteLine("buzz");}
else Console.WriteLine(i);
}
}
>>
>>56376011
Neverfucking mind.
I forgot to store sorted(l) in l

Be nice, i'm new to this.
>>
>>56376011
I advise you to look at the python documentation.

sorted() returns a new sorted list.

If you want to do an in place sorting you have to do:
l.sort()
>>
>>56376067

> using curly braces around single statements
>>
File: 092.jpg (49KB, 655x631px) Image search: [Google]
092.jpg
49KB, 655x631px
>>56376110
>curly braces
>braces
>>
Don't mind me, just using this dying thread to figure out how code tags work.
l = ["a", "g", "d", "c", "e", "b", "f"]

l = sorted(l)

for letter in l:
print(letter)
>>
>>56376203
>curly braces

https://en.wikipedia.org/wiki/Bracket

{ } – braces are "two connecting marks used in printing"; and in music "to connect staves to be performed at the same time"[3] (UK and US), flower brackets (India), French brackets, curly brackets, definite brackets, swirly brackets, curly braces, birdie brackets, Scottish brackets, squirrelly brackets, gullwings, seagulls, squiggly brackets, twirly brackets, Tuborg brackets (DK), accolades (NL), pointy brackets, or fancy brackets
>>
[code=python]
l = ["a", "g", "d", "c", "e", "b", "f"]

l = sorted(l)

for letter in l:
print(letter)
[/code]
>>
>>56376249
congratulations senpai
>>
>>56376279
>senpai
/g/ also doesn't like senpai desu?
>>
>>56376310
no, i'm just not a fag
Thread posts: 336
Thread images: 33


[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.