[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: 352
Thread images: 35

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Old thread: >>61806360

What are you working on, /g/?
>>
>his language doesn't have statically type safe dynamics
>>
File: haskell type typeable magic.png (11KB, 576x160px) Image search: [Google]
haskell type typeable magic.png
11KB, 576x160px
>>61817551
>>
>>61817551
>>61817559
>arguing about things no one cares about

Lol
>>
Lmao, Lisp can't even work with directories.
>>
File: 2017-08-09-184756_128429090.png (237KB, 1920x1200px) Image search: [Google]
2017-08-09-184756_128429090.png
237KB, 1920x1200px
>>61817488
thanks
moved all files to the same directory and did some other stuff I have no idea what was to makefile and headers and it seems to work

hopefully I can tidy up a bit and live on happily not dealing with any more dealing with most unnecessary C++ features
>>
>>61817602
Lmao it can
>>
>>61817670
Oh yeah, how about you implement listing all the files under a directory (in CL)
>>
File: 1484431183728.jpg (83KB, 546x678px) Image search: [Google]
1484431183728.jpg
83KB, 546x678px
I need help naming an event. /agdg/ has failed me (most of them are failures so I should have expected this)

>Event Damaged
Called when you take damage
>Event Healed
Called when you are healed
>Event DealtDamage
Called when one of your abilities deals damage to someone
>Event ...?
Called when one of your abilities heals someone
>>
Do you guys have any idea of how to reverse a dynamic string fast? I did it with a for, starting from the last position and going to the first position while printing, but that is not efficient enough.
>>
>>61817694
What language?
>>
>>61817698

C or Python
>>
>>61817694
(nreverse "string")
>>
>>61817693
EventTargetHealed?
EventUnitHealed?

Or just reuse EventHealed with optional target pointer?
>>
>>61817602
I implemented my own Lisp and it can easily deal with file system operations. My lisp is well-integrated with the whole Linux kernel, actually.
>>
>>61817688
I am not going to do your homework for you anon.
I found a solution in my first google query.
>>
Lisp vs ML vs Haskell
>>
>>61817707
Python:
str[::-1]
>>
>>61817694
Wtf is a dynamic string?
>>
>>61817790
Lisp >= Haskell >>>>>>>>> ML
>>
>>61817790
Haskell > ML > Lisp
>>
>>61817808
SML is better than haskell, though
>>
>>61817799
A string that is not static
>>
Statically typed typed, type infered, manually memory managed Common Lisp derivation when?
>>
>>61817693
might make sense to use the same event for you/other but it depends on how your game is designed
>>
>>61817694
>how to reverse a string fast
Have all your code use a step size and starting position that's defined in the string type.
Set the starting position to the end and the step size to -1.
O(1) and really fast.
>what you did
If we're just supposed to output the string that's fine. If your output isn't buffered you can buffer it.

Generally text output nowadays is fast enough almost whatever you do.
>>
>>61817693
Healer or heals
I prefer healer.
It's not worth spending time on.
>>
>>61817693
Use a parameterized event
EventHealed(target)
Target can be any game creature including player character
Can also have an origin parameter determining what caused the event, or even an event stack showing the chain of events that led to the healing such as KeyPress->PlayerHeal(creature)->Healed(creature)

Sky's the limit m8, you can do anything you want.

Also namespace that shit for gods sake
Game.Events.{Healed(target),Damaged(target),etc...}
>>
>>61817923
>you can do anything you want
I can't drink 24 cans of beer a day and lose weight at the same time, fucking bullshit.
>>
is refactoring the funnest part of programming?
>>
Anyone know how to best debug device trees? I'm trying to get an alsa driver which works on Rpi's onto another linux single board and it's just refusing to work.
>>
>>61817994
I have to reorganize this entire class hierarchy, so no.
>>
>>61817761
Show me a demo.
>>61817778
read."I can't do it"
>>
>>61817994
It's certainly satisfying.
>>61818007
If your code isn't poo.
>>
>>61817994
Programming ain't fun.
>>
>>61818039
but I have autism so it is
>>
>>61818039
I agree. All this programming I do on my free time is to appease the gods.
>>
>>61818039
get a loads of this pajeet/wage cuck/chad thundercock
>>
>>61817952
Ganes are asynchronous evented software. You can structure your events however you want.

If you're having trouble naming things, it's because you don't understand what you're doing. You literally lack the vocabulary needed to talk about the concepts in your game. It's time to step away from the code and study more.
>>
>>61818048
Go to a disco and drink beer.
>>
>>61818053
>wage cuck
>people give you lots of money for something you're good at and that's a bad thing

????
>>
>>61818053
>>>/r9k/
It's pathetic you are wasting your potential.
>>
File: you.jpg (11KB, 238x212px) Image search: [Google]
you.jpg
11KB, 238x212px
>>61818167
>something you're good
>implying you are good programmer
>>
>>61818181
You're *probably* using my software right now.
>>
>>61818184
Well you are clearly mentally retarded and suffering from bad case of Dunning-Kruger
>>
>>61817707
>Python
>fast
>>
What's the closest thing to statically typed Common Lisp?
>>
File: events.jpg (93KB, 1123x591px) Image search: [Google]
events.jpg
93KB, 1123x591px
>>61817737
>>61817877
>>61817923
This is what I ended up going with. I wanted to split the took damage and dealth damage events.

Even though they are essentially the same event, the only event I really care about is "Damaged" for things like ending a stun that breaks after X damage, or if you're afflicted with a debuff that breaks early when you take damage (like a Rogue Blind or Gouge in WoW if you're familiar with that)
>>
>>61818234
>static typing
>>
>>61818020
No. My language isn't publicly available at this time. I'm currently it's only user. It will stay that way until I have all the semantics I want in place.

I currently have no easy-to-use "standard library", just actual Linux system calls that can be used straight from Lisp. So I can do anything any other Linux program can do. To get a list of directory entries, I can call openat on a path and then call getdents until it returns 0 to get all the Linux directory entries.

I really have no idea why you're so fixated on this directory business. It's extremely basic.
>>
>>61818234
Nigga, just use compiler optimizations.
>>
>>61818234
Doesn't SBCL into type assertion?
>>
>>61818269
>just use compiler optimizations
Doesn't work. You can't trust it.
>>
I have recently developed massively enlarged thyroid nodules. It seems to have affected my ability to program.

Physically, there is not yet any obvious indication as to whether thyroid hormones are low or high, or neither. But I'm wondering if I'm bordering on psychotic, lately. I have pretty decently traced out ontological and epistemological underpinnings, and error control, but some of the shit recently. I don't know what's what. Kept getting segfaults, found I was referencing variables I shouldn't have. Would run a program multiple times and get different results, despite that the output should be deterministic. I can find no sign of uninitialized memory use. I would make trivial changes in one part of the program, and have it break things elsewhere, and the inverse. Unrelated things would fix everything. Program works fine when I go to sleep, is fucked when I wake up, for the same input. Implement a new subsystem, works fine. Suddenly my awareness is simply that it isn't working. Then it's working. Nothing has changed with the program at all. Can't recall what happened in between.

Machine is stable. Memory, probably, isn't bad. Program is written to different disk areas each build, and checksum checks out across builds. Low thyroid hormones can cause perceptual distortion. However it does seem like I'm being observed, and potentially myself or my environment, tampered with.

Etc. /blog. Can't get anything done.
>>
I was trying to get my feet wet with coding.

No experience at all

Was following this guys video, and ended up getting lost.

https://www.youtube.com/watch?v=SykxWpFwMGs

That video right at the 4:30 minute mark.. I just got lost, and couldn't follow, and no matter how many times I would re-watch it to that point, I could never figure out what the fuck he just did.

I have those programs installed, and the consoles opened up, but legit have no idea what I'm doing.
>>
>>61818281
Sure but fuck SBCL because you can't deploy software with it or you have to pack the whole 70mb runtime with. Also the platform support is shit for sbcl.
>>
>>61818294
don't start with prolog
>>
>>61818234
C++

>>61818282
you can trust C++ compiler fairly well and inspect the assembly output, and you can whip up some constexpr magic when needed
>>
>>61818296
>wow you have to deploy a whopping 70 mb it sucks

Are you kidding me?
>>
>>61818332
sepples isn't even a fucking language.
You should Bjarne, nobody likes you.
>>
Anyone have the project roll list?
>>
>>61818333
The platform support is shit for SBCL also the C interface sucks too.
>>
>>61818328
What can I do with Cigwyn standalone, just to get my feet wet?

Like, I don't know anything, if I could make a text program that had the days date, I'd be impressed.
>>
>>61818351
google "g programming list"
>>
Writing in C++ like you're writing in C is more comfortable than simply writing C.
>>
>>61818362
Cygwin is just a bunch of unix tools for use on windows. You won't need it until you know what that entails, and I'm not sure you do.
Go look up some Python tutorials. There's a minimal amount of fussing before you can write something basic with immediate results.
>>
Porting 21 years old device driver from SCO to Red hat due virtualization project.
>>
>>61818398
This.
>>
>>61818362
don't start with python

https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
>>
>>61818184
Someone keeps saying this.
Did you write a Realtek network driver or something?
>inb4 it's actually just some undiscovered malware
>>
>>61818362
don't start with C.
https://sarabander.github.io/sicp/html/index.xhtml#SEC_Contents
>>
>>61818362
the guy that suggested python is right if all you want to do right now is get your feet wet. It's a great language for that purpose.
>>
>>61818234
typed racket
typed clojure
https://github.com/tomhrr/dale
https://github.com/carp-lang/Carp
>>
>>61818294
>I have no idea what I'm doing
Are you getting the same results and not understanding it?
What he's doing during pic related is opening a console (a command line interface to your shell which let's you use a textual interface to your computer.
Most actions are possible through that console.
The command 'ls' lists directory contents. If you just type ls it's listing the working directory contents. (if you type pwd, 'print working directory' you get what the working directory is right now).
If you find that you're not where you placed your helloworld.h you can navigate there using change directory 'cd'. You can type cd and then the absolute path to your directory to change the working directory to the absolute path directory.
g++ invokes a C++ compiler. As he mentioned this has nothing to do with prolog. He's just using this to verify that things are alright (dunno why he thinks this is a good check).
You don't have to understand that bit.
He then types ./helloworld which executes the executable the c++ compiler output. It should respond hello world.

Did this help?
>>
>>61818611
>nonstandardized shit with only one implementation that is constantly changing
Fuck I hate everything
>>
>>61818739
I read
>>61818362
Now.
I suggest not starting with prolog and instead something more popular where less experience is presumed. If you're looking to learn prolog you probably know how to operate a computer already. But not in your case.
Python and Javascript are the kinds that do expect much less of you. But I don't think you'd have trouble following that guide despite this though. You'll have to learn this stuff either way. If you have good reason to learn prolog stick to it.
>>
>>61818746
who care about standards excepting c++ and java users?
>>
>>61818794
I first mentioned common lisp. If I didn't care about standards I would have just went with fucking scheme or some even gayer shit.
>>
>>61818836
scheme is standardized. why do you care this much about standards? most programming languages don't have one and still tons of great softwares are made with these.
>>
>>61818877
>giving a shit about shit compiler implementation to a language that is not standardized and might go down to Chinatown at any point when the only developer stops studying and he has to get a real job
>>
>>61818746
>nonstandardized
Who the fuck cares?
>>
>asprintf
>doesn't even take an allocator argument
Awful. Why is C such an awful language? You'd think the memory aware people of the 70s would understand the importance of that.
>>
>>61819009
>upgrade your compiler to get security fixes
>your program breaks
epic
>>
>>61819089
How do you browse the web? Is your browser standardized?
>>
>>61819089
kek
>>
>>61818739
>>61818780
Basically, the other day I had a hunch to attempt C++ coding, so I tackled google, came across a few things, and tried to copy that video.

I got to that 4:30 mark, and I wasn't able to replicate his results.

I went to my files, I didn't have anything like that in there, no "hello world" thing or whatever he was doing, I was just completely lost no matter how much I tried to understand it.

From the responses I've gotten here, apparently I jumped in a bit too deep, and I think I'll check out Python or whatever just to see if I could have a chance at understanding coding.
>>
>>61819108
It compiles with compiler that implements standardized language.
>>
>>61819019
Most old languages have historical cruft. The difference is that in C, most of this cruft can simply be ignored or cleanly worked around.
>>
>>61819152
And what safety brings standardization?
>>
>>61819194
Usually standardized languages have more than 1 implementation. Also they tend to make way more sense.
>>
>>61819149
Usually the first program you are introduced to is a hello world. Just something super basic which prints the words "hello world", it's good for testing whether or not you have a working environment.
You should be well past that point if you're following that video. It's not an introduction to C++.
>>
>>61819149
its because compiling c++ using raw commandline shit is way more awkward than it should be. just use dev-c++ ide, code blocks ide, or visual studio ide. they work right out of the box and you dont have to dick around with settings. it really has nothing to do with programming. rather just interfacing with your programs and os being strange.
>>
>>61819217
Like C++?
>>
>>61819250
sepples isn't language
>>
File: 1502176933554.jpg (55KB, 593x515px) Image search: [Google]
1502176933554.jpg
55KB, 593x515px
need to write a REST api for my job. what's the best tools for this/ languages?
>>
>>61819265
john is kill
>>
>>61819268
node.js and express if your company is into cool and hip technologies
>>
>>61819149
Use MSYS2, if on Windows.

gcc file.c -o program.exe
>>
>>61819303
>nodejs
that's so 2014
>>
File: Без име.png (118KB, 1366x702px) Image search: [Google]
Без име.png
118KB, 1366x702px
can some C fag tell me why my code doesn't work?
>ibn4 a brainlet struggling with dynamic memory
>>
are there better opengl tutorials than http://www.opengl-tutorial.org/beginners-tutorials/ ?

it feels pretty condescending at times and dumps a bunch of code early on about vertex attribute arrays, buffers, and binding without mentioning what it is for.

I can understand the boilerplate to get a blank opengl window open getting glossed over, but the rest of this stuff feels pretty important to understand early rather than doing whatever it takes to get stuff to display.
>>
>>61819268
Spring and kotlin.
>>
Name my OS, /dpt/
>>
>>61819450
Qhyburn
>>
>>61819429
two char*s are not guaranteed to compare equal to each other (but may). You can have the same sequence of characters at different locations in memory.
You're supposed to use strcmp rather than ===.
>>
File: 1502305005427.jpg (26KB, 600x400px) Image search: [Google]
1502305005427.jpg
26KB, 600x400px
What's the best programming language for white men?
>>
>>61819450
Cuckslayer
>>
>>61818284
Your main problem is probably that you're just neurotic (in the big 5 sense). Worry less. Read a book on how to overcome neuroticism.

I'd worry less.
>>
>>61819532
batch.
>>
>>61819434
Yes the opengl superbible is excellent. There are no good free modern opengl tutorials. NeHe was good 20 years ago though.
>>
File: carlcuck[1].jpg (39KB, 600x615px) Image search: [Google]
carlcuck[1].jpg
39KB, 600x615px
>>61819532
Ruby.
>>
>>61818254
>I'm currently it's only user. It will stay that way until I have all the semantics I want in place.
You should change that. Better to have something partial where people can see it (and perhaps offer to contribute) instead of waiting for perfection that never comes. If you've got it to the point where you can run things at all, you're good enough to come out of hiding.
>>
>>61819532
Scheme.

I've never met or seen colored folk that like Scheme.

It's the whitest programming language.
>>
>>61819558
Nah. I've just seen some shit and suddenly have a large mass in my neck on top of it all. The moment I begin to fix one angle, I am screwed from another.

The only question that remains are if people with certain genes (likely voltage gated calcium channel, iNOS, or calcium trafficking and superoxide dismutase related) are being purged deliberately, or as an indirect consequence of some greater shift. Perhaps it is both.
>>
>>61819603
There are articles written about how kmowing LISP is a signal for belonging to the white male in-group.
>>
>>61819622
I was just shitposting anon are you for real? Pls link.
>>
>>61819532
Any Lisp dialect.
>>
>>61819577
yeah I hear things that were common 20 years ago are deprecated, trash, harmful, or all three nowadays.

I will look into superbible, thanks.
>>
>>61819532
assembly.
>>
File: 1fe.png (59KB, 658x662px) Image search: [Google]
1fe.png
59KB, 658x662px
Why is R so hard to learn?
>>
I am currently jumping a lot between a ton of small projects.
The coding style wary a lot between the projects.
Is there a way to automatically detect and apply coding style (without programming it myself that is)
Currently I use kate and vim.
>>
>>61819883
Some coding styles really are awful. I'm most bothered by the tendency to obsess over line count, "terseness", and code density. The very mindset tat makes people put single statement ifs all on one line, etc.
>>
How do I webdev and don't want to kill myself
everything's so clunky, I am not used to it
>>
>>61819883
The best thing you can do is reformat all code to a single style.
>>
>>61817882
>stepping through the string 1 character at a time
>O(1)

?
>>
>applied for a job
>get a technical assessment from codingame.com
How difficult are those things?
>>
>>61819161
Yeah. The way you'd do it in the case of asprintf is reimplement it. The only other option would be to do all the work processing the format string to figure out the width and then not completing the process and instead use the buffer size you figured out to allocate using your allocator and then pass it as a buffer to sprintf.

And C doesn't have its format string processing modularized afaik.
>>
>>61819396
What's the new hip thing? Just curious.
>>
>>61818675
simplifies to true dingus
>>
>>61819996
No. The point was that you'd not reverse the string at all but rather tell the program that they should act as if it's reversed. Essentially.
>>
>>61819978
not an option.
It is not my project and there is no way in hell I get my few line patch merged if I also make formatting changes on every line in the code. (I wouldn't accept such a patch)

Some people are crazy and I don't really care, I just want to fix their stuff so I can move on with my things.
The most relevant part is indentation.
Some use 2, others use 4 spaces and some use tabs.
I will look through the API tonight and see if I can easily change the indentation method because going through the menus is a waste of time and I don't even care enough to fix it in vim.
>>
>>61819532
bash https://en.wikipedia.org/wiki/Brian_Fox_(computer_programmer)
>>
>>61820182
Maybe IntelliJ is smart enough to handle those things.
>>
>>61819813
What are you learning?
>>
>>61819532
Probably something stupid like C# cracker.
>>
>>61819532
C++

females and non-whites can't handle the sepples
>>
>>61820233
All projects are in C++, but I could try it out.
(just found out kate already have a feature for aligning with leading ','
Never used that.
Holy shit people can write ugly code.
Who writes for loops like
for (
auto first = std::begin(stuff)
, last = std::end(stuff)
; it != last
; ++it
)
{
//do stuff
}
>>
File: a8d.jpg (85KB, 814x960px) Image search: [Google]
a8d.jpg
85KB, 814x960px
>>61820224
>Fox co-wrote a New York Times piece in 2017 with former CIA head R. James Woolsey advocating open source election systems as a means of securing US elections against Russian interference.
MUH RUSSIA
>>
>>61820347
That's pretty fucked up senpai. Even the GNU Coding Style looks better.
>>
>>61819883
clang format has some tools for that. I'm not sure they're convenient to customize for something like >>61820347 though. It's really good at understanding the code and intent for my use though. Even macros
>>
>>61818181
Not an argument.
>>
>>61820416
when I said apply programming style, I meant to my editor.
Eg, read the document and see they use 2 spaces and then set the editor to use 2 spaces for this file and so on.
clang format makes it easier to push my style on code instead which is the opposite of what I want.
>>
>>61820479
Ah mb.
>>
>>61819532
Functional Programming is the white man's paradigm.
>>
>>61820521
fr
>>
Need help, I stole a computer from work, managed to by pass administrator password but some features are still telling me that I dont have full access to change settings, asks me to talk to my administrator. any help?
>>
>>61820479
If you can define their formats, then you can write however you want, then use clang format to convert the code to their style.
>>
File: index.jpg (11KB, 225x225px) Image search: [Google]
index.jpg
11KB, 225x225px
>>61820606
>Need help, I stole a computer from work,
>>
>>61820606
That's impossible. Niggers don't have a job.
>>
>>61820606
Jamal needs his work system back, Cletus. Give it back.
>>
>>61820606
Talk to the owner of the computer
>>
>>61820398
what the problem? he's a true patriot at least, unlike trump apologists.
>>
File: 1502147852617.jpg (7KB, 250x230px) Image search: [Google]
1502147852617.jpg
7KB, 250x230px
>>61820780
>>
>>61819585
Soon. I have a particular set of features I want to implement before I push it to a public repository. I somehow created a Lisp with direct access to Linux system calls. A linux/system-call function is among the few "magic" bits provided by the really simple interpreter I wrote.

I'm still ironing out the low-level interface with the system calls and the garbage collector. Once that's done the language will essentially become a powerful systems programming Lisp. I plan to go public at that point.

I want to create my own Linux user-space on top of this language. My future goal is full SystemV ABI compatibility, so that it can easily call into foreign object code.
>>
>>61820825
Post code snippet, dear wizard.
>>
Every time I compile my C++ I feel like I have to inspect the assembly to see if it's done something stupid.
>>
>>61820606
>I stole a computer from work
but why and how is it programming related
>>
>>61820840
(define hello-world "Hello World!"); simple Scheme-like nested envrionments and text strings
(define data (text-encode hello-world 'UTF-8)); abstract text to UTF-8 encoded array of u8
(linux/system-call 'write 1 data (size data)); write out binary data to standard output


I need better names for functions. I envy the fluency of the Scheme designers. Such gods of word choice.
>>
Why is common lisp the only decent standardized language? It would be perfect if it was statically typed.
>>
>>61821204
Standards are where languages go to die. Also, you can proclaim types for the compiler, allowing optimization.
>>
>>61821283
>Also, you can proclaim types for the compiler, allowing optimization.
Allowing for optimization but the compiler might as well just ignore it.
>>
>>61821283
>Standards are where languages go to die
If the langauge needs to change it's SHIT LANGUAGE.
Having standard is the only thing that can assure some kind of stability.
>>
>type at 140 WPM
>120-130 if I want to make absolutely sure I make no mistakes
>buy ergonomic keyboard
>realise I type with only two fingers
>go on typing site that teaches you about the home row and typing with all four fingers
>can barely manage 30 WPM with mistakes
Did any of you ever go through this? How long does it take to git gud?
>>
>>61821357
Standardized languages change all the time, see C and C++. A language implementation is a de-facto standard.

>>61821334
You can either have the flexibility of Lisp and optionally constrain it with optional typing, or you can have forced static typing.
>>
>>61821399
I learned to touch type by playing nethack and using vim. The latter is great because you learn two skills at once.
>>
>>61821426
>you can have forced static typing.
No I can't because there's no standized language providing Common lisp with that feature.
>Standardized languages change all the time, see C
The c11 didn't bring anything new, glibc still doesn't implement the fucking threading.
Also people are still writing libraries for ansi C.
>C++
It's shit and Bjarne should just be kicked out of any project that he is in.
>>
>>61821452
>I learned to touch type by playing nethack and using vim. The latter is great because you learn two skills at once.
I can touch type already but I realised I am typing incorrectly and now that this keyboard I've got has a big gap in the middle it's making it difficult as fuck to type correctly.
>>
>>61821459
What good is a standard if people don't implement it, or implement it wrong? The only thing that matters is a working implementation. That is the standard. It's easier to understand too: just read the source code, or write test suites like RubySpec that implementations are expected to pass.

>it's shit

I agree, but it's a very much alive standardized shit language. Even then it takes years, decades for any kind of change to happen, while Python can just do it.
>>
>>61820780
stay mad

https://www.youtube.com/watch?v=9_OOrWQs33E
>>
>>61820606
Wipe the disk and install an operating system.
>>
File: eHFR2pp.jpg (196KB, 800x533px) Image search: [Google]
eHFR2pp.jpg
196KB, 800x533px
>Wow anon, you really can't implement Prim's algorthim? I thought you would be good at programming with all the time you spend on the computer
>>
>>61821605
I-I can show you Dijkstra i-if you like...
>>
>>61819429
>>61819472
In this case, == is guaranteed not to work because a is stored in the stack and p in the heap. They'll always have different addresses, even if they're the same string.
>>
>>61821647
The strings which are pointed-to will be in the data section, won't they?
>>
>>61820290
Time Series analysis mostly.

But still, R is very "dense" in the way most people seem to write it. Even compared to Python I think I have to write 60% less to accomplish the same task.
>>
>>61821605
from prim import algorithm
>>
>>61820347
Looks fine to me
>>
>>61821685
Nope. The strings a points to will be in the data section (stack). At line 15, p is assigned uninitialized heap data. At lines 19/20, p is initialized, but it's address doesn't change.
>>
>>61821796
>in the data section (stack)
wat
>>
>>61821147
syscall is perfectly good. If you're trying to call a linux syscall on windows you're fucked anyways. Windows technically has syscalls but you're supposed to use the wrapper library because syscall numbers change between updates. They're undocumented because Microsoft really, really wants you to use the wrapper library.

I also have to question why strings aren't utf-8 by default.
>>
>>61821832
Not sure what you're asking.
>>
>>61821866
The data segment is for globals and static variables. That's not the stack at all.
>>
>>61821865
I plan to support exclusively Linux
>>
>>61821783
>not
from algorithm import prim

Why is python so shitty?
>>
>>61821865
Also they are UTF-8 internally but my preliminary API requires one to specify the encoding when converting to binary format, and incidentally UTF-8 is the only one currently supported
>>
>>61821875
I see what you mean.
>>
File: g1.png (1MB, 1045x785px) Image search: [Google]
g1.png
1MB, 1045x785px
Building a isometric 2d rts here.
>>
>>61821954
Nice, looks like Dark Reign
>>
>>61818294
clearly you should start with something easier like a markup language
>>
>>61821919
>implying that's a real python module in the standard library
Probably shouldn't comment on the shitiness of a language unless you know what you're talking about
>>
>>61821954
I like it!
>>
>>61821875
>>61821950
Actually, static and global variables are stored on the stack, but if they're pointers to static data, that data is stored in the data section, which is separate from the heap.
>>
>>61822001
> data section, which is separate from the stack
Is what I meant to say.
>>
>>61821992
propably shouldn't be making shitty jokes if you are not going to make them in a proper way, dumb faggot
>>
>>61822016
That wasn't even my comment retard
>>
Speaking of Lisp, I kinda want to make an OS in it. But how? I see two ways:
1)implement a basic runtime for LISP in a normal way (ASM, C) and build in it from there
2)Make a very low-level cross-compiled LISP without GC and implement everything in it.
I kind of want to do it the second way, since it seems "purer", but it doesn't seem feasible as it'd lack basic LISP features and I'll have a separate language anyway for full LISP experience.
>>
>>61821919
from prim import algorithm

asking prim about the algorithm. perfectly clear
from algorithm import prim

asking an algorithm about prim. makes no sense
semantic programming mate
>>
File: you.png (2KB, 244x226px) Image search: [Google]
you.png
2KB, 244x226px
>>61822024
>>
>>61822031
kek
>>
>>61821334
So C has no inline functions. The compiler might as well just ignore it.
>>
File: not samefag.png (11KB, 464x120px) Image search: [Google]
not samefag.png
11KB, 464x120px
>>61822039
btfo
>>
>>61822025
https://github.com/robert-strandh/LispOS
https://github.com/froggey/Mezzano
There's also that loper os guy but I think he is mental and has not ever made OS.
>>
File: 1501185942047.png (602KB, 963x720px) Image search: [Google]
1501185942047.png
602KB, 963x720px
What anime do I watch to improve my programming skill?

Please respond.
>>
>>61822055
>what is #define
>>
>>61822064
Thanks. I'll try and read the code.
>>
>>61822031
from prim import algorithm
from astar import algorithm


Oops.

from prim import algorithm as prim
from astar import algorithm as astar


Hmm, why does this feel stupid?

from algorithm import prim, astar


That's better.
>>
>>61822079
Not a function.
>>
>>61822001
>global variables are stored on the stack
#include <stdio.h>
#include <stdint.h>
int x;
int main() {
scanf("%d",&x);
return x;
}

    .file    "float.c"
.intel_syntax noprefix
.comm x,4,4
.section .rodata
.LC0:
.string "%d"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
lea rsi, x[rip]
lea rdi, .LC0[rip]
mov eax, 0
call __isoc99_scanf@PLT
mov eax, DWORD PTR x[rip]
pop rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 6.3.0-18) 6.3.0 20170516"
.section .note.GNU-stack,"",@progbits

>The .comm directive allocates storage in the data section. The storage is referenced by the identifier name. Size is measured in bytes and must be a positive integer. Name cannot be predefined. Alignment is optional. If alignment is specified, the address of name is aligned to a multiple of alignment.
>>
>>61822071
Serial Experiments Lain.
>>
>>61822086
>implying there's difference between function and macro
The only difference is that the macro is forcefully inlined
>>
>>61822085
import prim
import astar

prim.algorithm()
astar.algorithm()
>>
>>61822101
How do you know your C compiler does not define a anonymous function to avoid code repetition?
>>
>>61822025
My Lisp (I still don't know what to call it yet) is a stand-alone program. It requires zero dependencies. Not even Libc is required. It's a C90 program, too. I could easily compile it for embedded architectures. The GC is designed to work with a configurable array as it's memory during bootstrap phase of the language; after that part I just extend the GC from within Lisp with an allocation function based on mmap. The bootstrap memory is allocated by Linux during program load time. It's just a static array. It'd be easy to make it work with some huge, fixed memory segment.

The harder part is implementing the low level hardware interface to Lisp. I relied on Linux so I could get away with a magic linux/system-call function, but with nothing below you'd need a lot more magic.
>>
>>61822133
because the code is run through my custom preprocessor before the compiler can go full retard on the code.
>>
>>61822101
Are you the fexprs retard from a few days ago?

#define make_ll(x) typedef struct { x head; * ll_##x * tail } ll_##x;

(define-syntax defun (syntax-rules () ((_ name (args ...) body ...) (define (name args ...) body ...))))

I really wanna see functions that do the same thing as those macros.
>>
>>61822167
>fexps retard

wot
What's wrong with fexprs?
>>
>>61822185
Some retard thought they were a total replacement for macros.
>>
>>61822167
>(define-syntax defun
dumb fag. defun defines functions into global space even though it might be inside let. define defines stuff only for the current scope.
Anyways I meant more of a there's no difference between using function and function like macro.
Of course there will be difference, the biggest one being that there will be no function in the compilation product.
>>
>>61822206
I thought macros replaced them as a safer but not more powerful alternative?
>>
>>61822149
It can still find your similar code and replace it with function calls.
>>
>>61822416
The fuck kind of compiler are you smoking?
>>
>>61822465
We're talking about standards, not compilers.
>>
>>61822556
It's the compiler that does any kind of optimization, dumb faggot.
>>
What should I do after finishing the have classes at mood.fi
>>
>>61822606
masturbate to cartoons? It's the only thing can do without failing, even though I bet you find a way to manage to fail even masturbating.
>>
Hey /g/, I want to try and learn programming, it looks like a fun hobby. I have literally no clue how a computer works. How should I go about learning to program, and what book should I use?
>>
>>61822606
the fuck is that
>>
Alright girls and traps
New PC, win10
Fresh start
What IDE do I get for C++
>>
>>61822662
>win10
>>>/v/
>>>/reddit/
>>
>>61822662
Emacs
>>
>>61822592
But if something is not defined by the standard, you can expect any shit from compilers, at least that is how >>61821334 seems to think.
>>
File: 1406223097801.png (929KB, 873x1079px) Image search: [Google]
1406223097801.png
929KB, 873x1079px
>>61822645
>>
>>61822645
code.org, do the angry bird tutorial.
>>
>>61822741
Can you really start with the SICP? You don't need to work up?
>>
>>61822645
Programming ain't about how computers work.
https://www.youtube.com/watch?v=2Op3QLzMgSY
You could try out this book but don't be upset if it's too hard. K&R is another good choice if SICP is too much.

>>61822662
vim + tmux now that you can install windows subsystem for linux.
>>
>>61822783
It doesn't require a CS background but it is very abstract in a way that people aren't exposed to that commonly.

If you majored in philosophy or math, or if you did really well in your high school geometry class you'd probably handle it fine.
>>
>>61822783
SICP starts at basics so any beginner can start with it. It's a fantastic book, but it expects you to think, which makes most people consider it difficult. If you want to do some mindless learning with no theory, try "the non-programmers guide to python."
>>
>>61822787
>>61822817
>>61822848
Okay, I'll try it out.
>>
>>61817688
(directory "*")
>>
>>61817688
se library cl-fad.
The implementation most likely provides functions for that because it's no in the standard.
>>
>>61822878
have fun and go slowly. feel free to ask any questions here, we were all beginners once
>>
>>61822783
it does require sophomore maths.
>>
>>61823042
HS or college?
>>
>>61823066
college. for example,

"Exercise 1.13. Prove that Fib(n) is the closest integer to φ^n/√5, where φ=(1+√5)/2"
>>
>>61823181
To be fair you can skip those sorts of exercises.
>>
File: 1488248151444.jpg (233KB, 503x662px) Image search: [Google]
1488248151444.jpg
233KB, 503x662px
>You have to make a header file for your seperate source files
>You have to specify them in QMake
>You have to keep the header files updated by yourself
What kind of autism is this? Is there any way to automatically generate header files in Qtcreator?
>>
>Plebbit
>Someone claims performance is an objective fact.
>I claim that it's relative
>Plebbitors get buttflustered
How come people get TRIGGERED so easily?
>>
>>61823351
>gets triggered by reddit so hard that he has to come to his hugbox on 4chan
Sounds like you're the one that got triggered, sweetie. Faggot
>>
>>61823399
Did my post look rude to you? Weak beta cuck.
>>
>>61823467
Go back to r-ddit, subhuman nu male.
>>
>>61823498
Did I strike your nerve there? I think I just did. What a weak beta
>>
>tfw every language with competent algebraic data types is objectively shit, every time
Programming was a mistake
>>
>>61823013
Will any edition work?
>>
>>61823611
https://mitpress.mit.edu/sicp/
>>
>>61823632
thanks
>>
>>61822645
Give the CS50 (Introduction to Computer Science) course from Harvard a try, it's free, and you can even get a cert if you give them some shekels.

cs50.edx.org
>>
@echo OFF

echo Enter Image filename(Drag and Drop)
set /p img=

echo Enter Audio filename(Drag and Drop)
set /p sound=

set removequotes=%sound:"=%

For %%A in ("%removequotes%") do (
Set Folder="%%~dpA"
Set Name="%%~nA.webm"
)

cd /D %Folder%

Set FullPath=%Name%

ffmpeg -r 1 -loop 1 -y -i %img% -i %sound% -threads 8 -c:v libvpx -fs 3M -shortest -pix_fmt yuv420p -c:a libvorbis -b:a 128k %FullPath%


audio webm creator for /wsg/. Windows Only. Handles spaces in filenames, drag n drop operation and limits to 4chan's file restriction.(3MB)
dependency:ffmpeg.
>>
File: 5723.png (615KB, 601x600px) Image search: [Google]
5723.png
615KB, 601x600px
>>61817506

What does the MOR instruction in MMIX do?

I understand the concept of SIMD but how is "matrix multiplication on the 8 bytes of two 64 bit integers where multiplication is replaced with AND and addition is replaced with XOR" useful
>>
File: 1480273526404.png (728KB, 1366x768px) Image search: [Google]
1480273526404.png
728KB, 1366x768px
How to make big array in python?

>>> arr = [None] * 10000000000
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError
>>
Can you guys beat this time?

user@box:~$ gcc -lm test.c -o sum-of-two-million-primes
user@box:~$ time ./sum-of-two-million-primes
142913828922

real 0m1.251s
user 0m1.244s
sys 0m0.000s
user@box:~$
>>
>>61824199
Numpy
>>
>>61824249
forgot my flags, can you guys beat this one?

user@box:~$ gcc -lm -O3 -march=native -funroll-loops test.c -o sum-of-two-million-primes
user@box:~$ time ./sum-of-two-million-primes
142913828922

real 0m0.541s
user 0m0.540s
sys 0m0.000s
user@box:~$
>>
What am I doing with my life, /g/? I took up programming for fun a few years ago and I've made some good progress. But I've never developed a project of my own. I just solve puzzles, do tutorials and read about interesting things. I'm in a rut and everything seems pointless and boring.
>>
>>61817693
Just throw a delt damage event but pass a negitive number
>>
>>61817693
Event SucculentBoipucci
>>
>>61817694
Push every char into a stack, pop it all back out, concatenate, then return.
>>
>>61820049
>codingame.com
easy af
>>
File: Pembroke-Welsh-Corgi-Puppies.jpg (433KB, 1920x1200px) Image search: [Google]
Pembroke-Welsh-Corgi-Puppies.jpg
433KB, 1920x1200px
at what point do I have to consider making my program to use multithreading?
>>
What is this sequence called and how can I generate it? How can I generalize it to tuples of unbounded size?
>0, 0
>1, 0
>0, 1
>1, 1
>2, 0
>2, 1
>0, 2
>1, 2
>2, 2
I doubt I'm the first one to come up with it. I need to figure out how to generate it for an algorithm I'm working on.
>>
>>61824421
some kind of lexical order?
>>
>>61824283
make a game
>>
>>61822787
sadly those videos don't compare to the Brian Harvey lectures that were removed

http://www.washingtontimes.com/news/2017/mar/7/berkeley-removing-20k-free-educational-videos-afte/
>>
Guys what is "pepper friday"? My boss said we're having it instead of pizza friday this week
>>
>>61824411
if the program can benefit significantly from using multiple threads, then you make it multi threaded.
>>
>>61823722
https://github.com/sarabander/sicp-pdf/raw/master/sicp.pdf

this is nicer to use
>>
>>61824450
Well I'm trying to generate the sequence of every combination of elements each from a infinite sequence if that gives any hints.

If I can generate a sequence of indexes then it's a matter of mapping after that.

>>61824485
>the law made everyone lose for equality
REEEEEEEEEEEEEEE
>>
>>61820479
literally editorconfig.org
>>
>>61824500
You mean "prepper friday"?
>>
>>61824584
No, "pepper friday", apparently we're doing it because it's healthier.
>>
>>61824485
lol wtf
>>
File: 1483633095308.jpg (47KB, 600x896px) Image search: [Google]
1483633095308.jpg
47KB, 600x896px
>>61824136
Galois arithmetic?

>>61824595
>>
just finished the last challenge of google foobar
>>
>>61824754
That looks tasty anon, looking forward to it if that's what it is
>>
>>61817506
#include <stdio.h>

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

printf("%d\n", d);

return 0;

}


How much is d?
>>
>>61819610
Well, results returned. It would seem my T4 is ~13x below average, T3 is 5x below average, and TSH is elevated ~310x above average.

Looks like that's probably that.
>>
>>61824789
Is that the thing you have to use Python for?
>>
>>61824817
none of your business
>>
>>61824817
Enough
>>
>>61824817
d = 6 x 12.
Google operator precedence.
>>
Every year of Python experience is equivalent to -1 year of programming
>>
>>61824421
I remember what this is called and I studied it in Abstract Algebra. I feel like a dumbfuck.

If anyone runs into needing something like this, it's called Cantor's Pairing Function.
>>
>>61824791
They are pretty tasty. Costco sells them by the six-pack, ready to bake, fwtw

>>61824817
>>61824905
>139
wtf
>>
>>61824934
>Costco sells them by the six-pack, ready to bake
Anon I have a fear of ready-to-cook things
>>
>>61824934
Well, maybe I don't remember correctly. Regardless, it can be predictable resolved in advance.
>>
>>61824877
>>61824896
>>61824905

You all suck!

>>61824934
Congratulations, you don't suck.
>>
Scheme, Shen, or Idris?
>>
>>61825026
Dafuq are Shen and Idris?
>>
>>61824817
(((undefined behaviour)))
>>
>>61825061
>Shen
http://shenlanguage.org/

>Idris
https://www.idris-lang.org/
>>
>>61825091
My advice to you is not to waste time with that stupid shit. Just learn Java and you're good.
>>
>>61825144
I know Java.
>>
if lazy evaluation is so good, why is eager evaluation used so much?
is it really that hard to implement as a language feature?
>>
>>61824957
Shit. Um, well, maybe they're catered?

>>61824971
I do, actually. 6+...+17 == 138, but how in the hell?
>>
>>61819603
>>61819622
I'm black and I like Common Lisp.
>>
>>61823042
>>61823066

Algebra 1, 2, basic calculus, mathematical induction, series and sums and modular arithmetic and you're good.

The book is hard from the beginning, just be persistent and you will be okay.
>>
>>61825257
>I'm black
lies, they're only a myth, no such beings truly exist

at least on /g/ anyway
>>
>>61825257
There ya go. Further proof that Scheme is for the white man.
>>
>>61818239
The fuck is this?
>>
File: 1500366956182.jpg (407KB, 1000x1000px) Image search: [Google]
1500366956182.jpg
407KB, 1000x1000px
I'm going to preprocess my animations by recursively looping through the entire model-node-tree to precalculate bone positions at keyframes!
>>
>>61825257
How big is your cock?
>>
File: 1500576257114.gif (58KB, 600x400px) Image search: [Google]
1500576257114.gif
58KB, 600x400px
>>61820347
This is gross.
>>
>>61825333
Please just do interpolation on keyframes anon.
https://en.wikipedia.org/wiki/Slerp
>>
>>61825372
I am then going to interpolate between these keyframes.
>>
If I am going two for loops in the same function in c is it better to initialise it twice in the call or just initialise one and reassign it at the beginning of the next loop?

eg
(for int i = 1; ...

(for int i = 1...

OR
int i;
for ( i = 0;,...
for ( i = 0; ...

>>
>>61825398
It doesn't matter and if it did, that would be a micro-optimization that the compiler could easily do for you.
>>
>>61825415

Ahh, I haven't learnt about compilers yet.
>>
>>61825398
Depends if you want the variable to be scoped only to the loop. I've never bothered to look, but always figured declaring in the for loop header gave the compiler an extra hint about how that information will be used, possibly just keeping it sitting in a register for the entirety of the loop run.

Don't know. I see a lot of PHP programmers who start writing C declare a variable at the beginning and re-use it repeatedly, though. It likely only feels less efficient, while leading to more complicated, error prone, and difficult too maintain routines.
>>
>>61824789
I got through round 3 then stopped. About how long did each challenge take you? Did you opt in to get contacted?
>>
>>61825336
5"
but im a mongrel, I'm not fully black
>>
>>61825257
>>61825336
>>61825488
Never change, cuckchan.
>>
>>61825272
I really am black.
>>
File: 1479504413594.png (690KB, 850x464px) Image search: [Google]
1479504413594.png
690KB, 850x464px
In Python, how do I adjust this to make it result in declaring Fuze as part of the roster? An 'elif' or 'and' statement? As-is, it declares all three values in the desired_ops variable to follow the 'else'.

available_ops = ['blackbeard', 'fuze', 'capitao']
desired_ops = ['twitch', 'blitz', 'fuze']

for desired_ops in available_ops:
if available_ops == desired_ops:
print(desired_ops.title() + "is in the roster.")
else:
print("You don't have " + desired_ops.title() + " unlocked yet.")
>>
>>61825272
females don't exist, blacks do exist
>>
>>61825576
that's the thing, blacks go where women are
no women on /g/, no blacks on /g/
QED
>>
>>61825231
>is it really that hard to implement as a language feature?
Dynamically? Um, yes?

>>61825459
For at least a decade, any compiler worth using has been able to determine the actual lifetime of a variable and reuse the memory/register under another name once it's dead.
>>
>>61825599
Unproven: blacks don't go where no women are
Contradictory evidence: street gangs
QED
>>
>>61825572
What is that screenshot from?

Anyway what your code is doing is different from what you think it is doing:
for each element "desired ops" in available ops, if desired ops equals available ops, then ... else ...

Rename desired_ops in the for loop to x and I think it will be clearer why that doesn't work. What you want is something closer to this
for x in available_ops:
for y in desired_ops:
if x == y:
....
>>
>>61825663
this, blacks don't really care about women, they never fight over women
>>
>>61825690
>fighting over women when you can just sexually enslave them with the BBC and enjoy them with all brothas at once
>>
>>61825750
>bbc meme
bet you also belive whites are the most incestuous
>>
>>61825750
Fucking cuckolds.
>>
>>61825775
aww, did someone break your hopes for happy evo afto by thinking of something else?
>>
    for ( int i = 0; i < ROWS; putchar('\n'), i++ ) {
for ( int j = 0; j < COLS; j++ ) {
printf(" %c", array[i][j]);
}
}


Is it bad practice to put print functions with the comma operator in loops?
>>
>>61825769
>not fucking your younger sisters

>>61825775
>not having your wife lick the nutsack of superior bbc man while he fucks your asshole
>>
>>61825810
Damaged anon, why don't you post your greentext cuckold fantasies somewhere else >>>/b/?
>>
New thread:

>>61825885
>>61825885

>>61825885
>>61825885

>>61825885
>>61825885
>>
>>61825750
95% of the time these are numales larping as Africans.
>>
>>61824531
What language?
>>
>>61825931
Scheme. Although thinking about it, Cantor's pairing function won't work well.

I don't know of any pairing functions that do what I need. Fuck.
>>
>>61825836
yes put that shit in the loop body
>>
File: reeeeee.png (25KB, 345x564px) Image search: [Google]
reeeeee.png
25KB, 345x564px
>>61825679
>What is that screenshot from?
I thought it was from Gundam, but it might be from Memories (1995 film).

I feel even more lost, now. Code related:


available_ops = ['blackbeard', 'fuze', 'capitao']
desired_ops = ['twitch', 'blitz', 'fuze']

for desired_ops in available_ops:
for available_ops in desired_ops:
if desired_ops == available_ops:
print(desired_ops.title() + " is in the roster.")
else:
print("You don't have " + desired_ops.title() + " unlocked yet.")

print("\nJUST\nFUCK\n\tMY\tSHIT\n\tUP\nREEEEEEEEEEEEEEEEEEEEEEEEEEE\n")

for available_ops in desired_ops:
if desired_ops == available_ops:
print(desired_ops.title() + " is in the roster.")
else:
print("You don't have " + desired_ops.title() + " unlocked yet.")



All that happens now is that a mass-print occurs. Blackbeard gets 10 prints, Fuze gets 4, and Capitao gets 7. I am absolutely lost.

This is how my mental map is thinking:


Here are the values you have = [....]
Here are the values you request = [....]

If you request values AND you have them, then state you have them. Otherwise, state you do not.

Alt:

If you have values and you requested them, then state you have them. Otherwise, state you do not.

>>
File: how the fuck is this possible.png (68KB, 1381x401px) Image search: [Google]
how the fuck is this possible.png
68KB, 1381x401px
i already have ropes prepared im so stressed right now and simple shit like this is not working
>>
>>61826082
available_ops = ['blackbeard', 'fuze', 'capitao']
desired_ops = ['twitch', 'blitz', 'fuze']

for x in available_ops:
for y in desired_ops:
if x == y:
print(x.title() + " is in the roster.")
else:
print("You don't have " + x.title() + " unlocked yet.")

print("\nJUST\nFUCK\n\tMY\tSHIT\n\tUP\nREEEEEEEEEEEEEEEEEEEEEEEEEEE\n")


for x in available_ops

Is pythonese for:
"∀x ∈ available_ops" or "For each x that's a member of available_ops"
>>
File: dfbsfdb.png (27KB, 738x415px) Image search: [Google]
dfbsfdb.png
27KB, 738x415px
>>61826169
I think I get it now, though I still don't understand why I'm getting the strange duplicate posting. I both attempted to retype this based on your advice and copy-pasted your text, and got the same result (pic related).

It states each op three times. It confirms Fuze as being in the roster once, but says he is not unlocked twice.
>>
>>61826337
The inner-most if-else statement is executed 9 times, printing something each time. It's doing just what you've instructed it to do.
>>
>>61826337
That's a deliberate flaw in my solution. 3 * 3 = 9. the outer loop loops 3 times. The inner loop loops 3 times. You can correct it with a couple changes and using a boolean variable.

Or you can use set operations in python:
https://stackoverflow.com/questions/642763/find-intersection-of-two-lists#642919
https://stackoverflow.com/questions/3462143/get-difference-between-two-lists#3462160

Anyway you should learn more formally anon.
https://wiki.installgentoo.com/index.php/Programming_resources#Python
>>
>>61824831
python or java, but if you're not a dipshit you use python for obvious reasons
>>61825475
up through level 3 they never took more than a day tops. levels 4 and 5 i spent more time on to hopefully look good, and spent about 4 days per puzzle. most of it was just thinking about how to do it during real-life errands and stuff, the actual code was never more than 200loc.
>>
oh, yes i opted to get contacted. forgot to answer that
>>
>>61826526
>Anyway you should learn more formally anon.
I am trying to learn. That's the whole point of this. I've been reading a book, and I've been stuck on this problem for several hours. It wasn't even in the book, but I thought that it wouldn't be too difficult to attempt to do. This is what I did before it:


ops = ['valkyrie', 'blackbeard', 'castle', 'jager']
lame_ops = 'jager'

for op in ops:
if op == lame_ops:
print(op.title() + " is lame.")
else:
print(op.title() + " is cool.")



This worked fine, but I only had a single value in lame_ops. When introducing multiple values, it just hasn't worked That said, it only printed once for each value, which is one desired outcome achieved.

I don't know everything listed in the Stackoverflow pages yet, so I can't use those resources.

The only thing I can think of to do as a newbie is to make a third list of what overlaps, but surely, there is a more efficient method of doing this.

Also, is the /g/ wiki ever not down? I can never reach it.
>>
>>61826811
The third list way is a good approach too. It's easier to express and not that inefficient. Don't stress too much about optimization right now.

The very efficient ways involve sorted sets and binary trees, and I think you have a bit of learning before that.
>>
File: rostFIXED.png (24KB, 660x388px) Image search: [Google]
rostFIXED.png
24KB, 660x388px
>>61826885
>Don't stress too much about optimization right now.

I just really want to be an efficient programmer. I feel if I start relying on inefficient methods, I will seldom move from them. Easier to build good habits than break old bad ones, you know?

This is what I've got from my experimentation. I was able to have multiple values printed this time:


available_ops = ['blackbeard', 'capitao']
desired_ops = ['twitch', 'blitz',]
have_ops = ['fuze', 'ash']

for desired_op in desired_ops:
if desired_op == available_ops:
print(desired_op.title() + " is in the roster.")
else:
print("You don't have " + desired_op.title() + " unlocked yet.")

print(have_ops[0].title() + " is in the roster.")
print(have_ops[1].title() + " is in the roster.")



Does this look solid? For clarification:

available_ops = values had but not wanted.
desired_ops = values wanted but not had.
have_ops = values both wanted and had.

The results I wanted to display printed. Though, I really wish I could have done it in two lists.
>>
>>61827357
>I just really want to be an efficient programmer.
From my CS Dept's old chairman: "First get it right, then worry about making it fast."
>Does this look solid?
No. It looks like the result of flailing about without an understanding of either the tools or the problem, but with a copy of the desired output.
Thread posts: 352
Thread images: 35


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