[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: 323
Thread images: 27

File: miku cock.png (388KB, 435x437px) Image search: [Google]
miku cock.png
388KB, 435x437px
old thread: >>61915702

>when your program abuses undefined behavior and triggers valgrind warnings up the asshole but your program is correct
What are you working on, /g/?
>>
>>61919981
too soon, fgt
>>
>>61919981
Productivity tips? Currently:

>Having a sleep schedule (rise at 6 and go to bed at 10)
>Alternating between focused-work and rest (60 min for work, 30 min for rest) sessions
>Using Python and Make (free multithreading) for scripts (level generation from image) and C11 (need performance and too much of a brainlet for C++) for the game engine
>Sometimes using physical work (splitting logs) as rest from programming, but longer (90 min session for a full trailer). I think it's working just as well, maybe just as good as good as just resting, but you get perspired so that sucks.
>Reading random excerpts from C11 standard, OpenGL ES 2.0 guidebook, OpenGL ES 2.0 standard, GLSL 1.0 standard on free time when just can't think about programming anymore (it gets too much, maybe I don't like it as much as I thought I did, but it's too late to "search for myself" now, I'm fucking 20 already)
>Using Code::Blocks svn build (much fewer bugs and much faster) and IDLE as IDEs
>Dropped Lua because Python does its job (except for high-performance embedded game-engine scripting, but my little turd is very far from that) and focusing on Python
>Thinking about starting drinking coffee, maybe it improves focusing on code (or maybe I should look into aderall for a real thing?). So far not having any major bad habits (smoking, drinking, drugs) but this one might actually be beneficial.
>Got ~3.5 years to start my own company because then I get my university degree (software engineer) and if I'm not good enough to sell my own shit by then I'm officially a failure
>So far got some primitive matrix/vector math that I'm really using, nothing else, even algorithms (only BFS, DFS, backtracking and shit I have probably re-invented when I needed) in my head, maybe that's enough. Can't wrap head around physics with angular velocity (haven't really tried yet), for know I'm fine with "minecraft-like bit-array using primitive physics", access is O(1)
>>
>>61919981
report and ignore
>>
Please, vinny did nothing wrong
>>
Here's the real one made after bump limit:
>>61919998
>>61919998

>>61919998
>>61919998

>>61919998
>>61919998
>>
>>61920026
no thank you
>>
>>61919992
>>Got ~3.5 years to start my own company because then I get my university degree (software engineer) and if I'm not good enough to sell my own shit by then I'm officially a failure
kiddo. That's not how life works.
>>
>>61920042
Let him be, life hasn't curbstomped his hopes and dreams yet.
>>
File: 2017-08-15-193147_755636200.png (61KB, 1370x632px) Image search: [Google]
2017-08-15-193147_755636200.png
61KB, 1370x632px
wow I suck
>>
File: 1501768070135.jpg (785KB, 1712x1535px) Image search: [Google]
1501768070135.jpg
785KB, 1712x1535px
#define TRAPS straight
>>
File: dpt.png (39KB, 180x193px) Image search: [Google]
dpt.png
39KB, 180x193px
>>61920026
You do know that /dpt/ used to only use this image, right?
>>
>>61920058
>>61920042
>you will be a loser like me. just wait for it
>>
>>61920043
Soon as it grows beyond a lexer, I probably will. Like I said, it's pretty early on in development at this point. It's just a couple hundred lines for now.
>>
>>61920077
that's a cute girl
>>
File: DPT_Flood.png (189KB, 879x236px) Image search: [Google]
DPT_Flood.png
189KB, 879x236px
>>61920088
Outright lie.
>>
>>61920107
>sure is summer
at least go work on your shit instead of shitposting
>>
>>61919992
If you're trying to make an end product and not teach yourself stuff like math and physics, use libraries like Eigen and Bullet. Making a proper math or physics library is an undertaking that can take years in and of itself.
>>
>>61920137
>sure is summer
>>
>>61920115
>girl
>>
>>61920077
use Sexuality::*;

#[derive(Debug, PartialEq)]
enum Sexuality {
Gay, Bi, Straight
}

trait Are {
fn are(self) -> Sexuality;
}

struct Traps;

impl Are for Traps {
fn are(self) -> Sexuality {
Gay
}
}

fn main() {
assert_eq!(Traps.are(), Gay);
}
>>
>>61920162
What esoteric programming language is this?
>>
>>61920170
TrannyLang

a.k.a. Rust
>>
>>61920170
The death of Cniles
>>
>>61920156
if you haven't already made it, all you have is your lofty dreams, and you're probably deluded about what you can achieve or the timeframe of doing so. reaching massive success in a few years time is something very few people can pull off
>>
>>61920193
if i pull that off, would you die?
>>
>>61920117
I also grabbed my image from wiki.installgentoo.com
>>
>>61920152
>use libraries like Eigen and Bullet
The thing is, as far as I looked at them they're humongous and have a steep learning curve.

If I can limit my game to simple block-like physics without angular momentum, rolling my own 2D/3D bit array is a task I can accomplish myself in a reasonable timeframe, which would probably be less that getting accustomed to a full-blown physics engine and learning C++.
>>
>>61920275
Eigen isn't that hard. I'd say it'd be easier than teaching yourself the underpinnings of the relevant math, and the result will most likely be more efficient than anything you could roll yourself in the short term.
Bullet is the wrong library for a 2D game, true, but you have stuff like Box2D for that. In your specific case it sounds like rolling your own would be more efficient, but for math, I would look before I leap, and look hard.
>>
I'm flying out to LA to interview with Tinder.
Wish me luck /dpt/
>>
>>61920275
Eigen is really intuitive to learn.
https://eigen.tuxfamily.org/dox/AsciiQuickReference.txt
is a good start if you already know matlab or know the math
>>
>>61919992
>>Using IDLE as IDE
>>
>>61920369
Guess dating applications is the best place to be a game developer.
Whoever has the most entertaining dating service wins these days
>>
>>61920162
>impying traps aren't Bi as well
kek
>>
>>61920412
>the gamification of everything means gamedevs are now everywhere
JUST
>>
>>61920412
They pay well too. The position I'm applying for starts at $135k
>>
>>61920058
Nah, it's not that. It's just that successful people are generally those who are resilient from repeated failure and have contingency plans ready to go rather than those who are committed to a very specific fantasy.
>>61920107
>loser
kek. You don't know me, kiddo. I have succeeded past my wildest dreams in a number of arenas and I still ain't dead yet.
>>
I know it's stupid, but, should I buy a Net Yaroze?

It's got 5 days to go and already £155. It'd be like a collector's items.
>>
>>61920513
Where though? Cost of life matters dude, the valley is a shit place for that.
>>
>>61920525
>I have succeeded past my wildest dreams in a number of arenas and I still ain't dead yet.
This is where people are usually retarded. Just don't have wild dreams.
>>
>>61920527
Planning on making homebrew?
>>
>>61920561
Wut?
>>
>>61920567
Yup. It would be good to learn how the developers of old had to deal with stuff.

It would totally be a vanity own project. It's quite an expense.
>>
>>61920576
People usually think that they are hot shit, when most aren't.
The rational course of action if you want to be happy is to not expect much out of life and be happy with what you have. Count your blessings like christians say.

Then if you actually are hot shit, you can be pleasantly suprised, and if you ain't, you can still be happy.

Psychology supports that as well, people are happier when they make achievable goals for themselves. Tons of studies support this.
>>
>>61920162
>no ace definition
>>
>>61920599
I'm not sure what advantage a net yaroze has over a regular modded PS1. Are there special debugging tools?
>>
>>61920636
>ace
?
>>
>>61920654
straight = eg, boy loves girl
gay = boy loves boy
bi = boy loves boy or girl
ace = boy becomes engineer
>>
>>61920629
Well yeah, that's what I did.

Like, I didn't try to have a threesome with supermodels, that would be impossible, but they were still young and cute.
>>
File: 1500184187272.jpg (92KB, 508x767px) Image search: [Google]
1500184187272.jpg
92KB, 508x767px
>>61920681
jej
>>
>>61920546
It's in LA. They're in West Hollywood and I've been looking at rent. I found a place for $2k a month. The net gain of expendable income is better than the 70k job I'm doing right now.
>>
>>61920629
People who don't think they're hot shit take anti-depressants.
>>
>>61920744
Studies have been made anon.
It's actually the other way around.
>>
>>61920726
Makes sense, but you'll forgive my europeean ass to be weary of huge figures when cost of living in America (and Sanfran even moreso) is high as a kite.
>>
I'm checking a byte array if it matches any particular file signature from a predefined list. The byte array length is not fixed and file signatures can have any length. Is there any common way to do this without using some existing library?
I thought about doing hex string switch case but that would require to convert the byte array for every signature length.
Converting to integer is impossible because a long signature can exceed values provided by uint64.
Is doing byte array comparisons the only way?
>>
>>61920817
use memcmp to write a memmem function
>>
>>61920645
It's official homebrew, rather than nodded homebrew.

My PS1 is already chipped I guess, so you're right, I could just use that, especially as that will allow me to write to CDs. Whereas the net can only have the system ram used. Can't use the cd.

There's the PSIO, which I could use, though I would need to buy a PS1 that has a parallel port, as mine doesn't have one.
>>
>>61920837
The file signatures start at the start of the byte array, I don't need to search the whole array as offset is always the same (0).
Also please explain the method and not throw a vague solution. Are you suggesting doing byte array comparisons?
>>
>>61920860
Unless you write a lot of PS1 homebrew I don't see the point.
>>
>>61920869
In this case, you don't need a memmem function.
Just memcmp the first n bytes of your signature and see if it's a match with your byte array.
>>
>>61920817
Depends on the language
fn matches(bytes: &[u8], signatures: &[&[u8]]) -> bool {
signatures.into_iter().any(|sig| {
bytes.windows(sig.len()).any(|ref slice| slice == sig)
})
}
>>
File: 1502672854879.jpg (78KB, 351x351px) Image search: [Google]
1502672854879.jpg
78KB, 351x351px
What's the best way to measure real time in milliseconds C, lads?
>>
>>61920898
I never have before. It'd be fun to learn. And great to keep in a collection. Maybe I'll find one being sold cheap as someone doesn't realise what it is.
>>
>>61921060
static struct timeval tm1;

static inline void start()
{
gettimeofday(&tm1, NULL);
}

static inline void stop()
{
struct timeval tm2;
gettimeofday(&tm2, NULL);

unsigned long long t = 1000 * \
(tm2.tv_sec - tm1.tv_sec) + (tm2.tv_usec - tm1.tv_usec) / 1000;
printf("%llu ms\n", t);
}
>>
>>61921077
I tried making some DS homebrew but all the guides I can find are shit, I spent more time refactoring example code than building my own shit.
>>
>>61921060
There is no way to get a better resolution than 1s in pure C that I recall, but you can use gettimeofday() on Unix.
>>
File: 1489245875402.jpg (37KB, 419x424px) Image search: [Google]
1489245875402.jpg
37KB, 419x424px
Is there BASIC dialect with C features?
>>
>>61921118
Go is pretty basic
>>
>>61921118
>using BASIC
Just learn C anon.
>>
>>61921088
I guess for all these consoles it's quicker and easier to develop with emulators, rather than real hardware anyway.
>>
>>61921208
DS emulators bite you in the ass with improper cache emulation but yeah. desmume gave me a good excuse to learn gdb.
>>
school me, /dpt/

why does
002002FB  0000              add [eax],al
002002FD 0000 add [eax],al
002002FF 004801 add [eax+0x1],cl
00200302 2000 and [eax],al
00200304 0000 add [eax],al
00200306 0000 add [eax],al
00200308 2500000000 and eax,0x0
0020030D 0000 add [eax],al
0020030F 0000 add [eax],al
;repeat for fucking ever


occur when inside the bin conversion of
int main (){
int i;
i = 0x12345678;
}
>>
>>61921395
https://godbolt.org/g/UKKM2X
I don't see it.
>>
>>61921395
From where exactly did you get that asm?
>>
>>61921395
https://stackoverflow.com/questions/10816395/what-is-the-purpose-of-the-assembly-instructions-generated-on-a-minimal-c-progra
>>
>>61921466
from this tut: https://web.archive.org/web/20030611140013/http://www.nondot.org:80/sabre/os/files/Booting/CompilingBinaryFilesUsingACompiler.pdf
I ran
ndisasm -b 32 test.bin


test.bin being the conversion of test.c using objcopy
>>
>>61921505
Oh I get it now, so you wouldn't normally write that, that's just disassembled junk. Thanks anon
>>
>>61921516
can you do objdump -zd test.bin?
>>
>>61921551
>objdump -zd test.bin

test.bin: file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: c7 45 fc 78 56 34 12 movl $0x12345678,-0x4(%rbp)
b: b8 00 00 00 00 mov $0x0,%eax
10: 5d pop %rbp
11: c3 retq

i assume this is what they call "intel syntax"
>>
>>61921577
no, that's AT&T syntax
>>
>>61921577
>objdump -M intel -zd test.bin
for intel syntax
>>
>>61921577
OK that's your code. It returns 0. And it's 64bits, not 32.
>>
Am I a code rat for having this as my solution to Euler problem 1?

Would people in the workplace laugh at me for writing this way?

#!/usr/bin/env xcrun swift
import Foundation

/*
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
*/

private let VALUE : Int! = 1000

func multiplesOf3And5() -> Int {
var sum : Int = 0
for index in 1..<VALUE {
if (index % 3 == 0 || index % 5 == 0) {
sum = sum + index
}
}
return sum
}

print(multiplesOf3And5())
>>
>>61921577
No, that's "tl;dr" syntax
>>
>>61921606
>>61921582
So it wouldn't really matter which way i choose to write the asm, right?
>>61921609
Ah, thanks. Do you know how i'd run 32bit?
>>
>>61921647
>So it wouldn't really matter which way i choose to write the asm, right?
No, they have slightly different syntax, but as long as your assembler understands the syntax you chose, it doesn't matter.

>Do you know how i'd run 32bit?
compile with "-m32" flag(gcc and clang)
>>
>>61921671
thanks again, anon
it runs:
test.bin:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:
0: 55 push ebp
1: 89 e5 mov ebp,esp
3: 83 ec 10 sub esp,0x10
6: e8 13 00 00 00 call 1e <__x86.get_pc_thunk.ax>
b: 05 f5 1f 00 00 add eax,0x1ff5
10: c7 45 fc 78 56 34 12 mov DWORD PTR [ebp-0x4],0x12345678
17: b8 00 00 00 00 mov eax,0x0
1c: c9 leave
1d: c3 ret

0000001e <__x86.get_pc_thunk.ax>:
1e: 8b 04 24 mov eax,DWORD PTR [esp]
21: c3 ret
>>
>>61921617
At least parametrize your function:
fn sum_multiples(of: &[u64], below: u64) -> u64 {
(1..below)
.filter(|x| of.into_iter().any(|div| x % div == 0))
.sum()
}
fn main() {
assert_eq!(23, sum_multiples(&[3, 5], 10));
println!("{}", sum_multiples(&[3, 5], 1000));
}
>>
>>61921190
I know C, I just was thinking of a language that's as powerful as C and as easy as BASIC.
>>
>>61921723
not in the spec.

fucking wanks prematurely optimizing.
>>
Idea for a project: Lexer/Parser generator that generates Rust code, similar to Flex/Yacc for C.
>>
>>61921771
It's not premature, not optimization, it's just common sense.
>>
>>61921752
It's called Pascal.
>>
>>61921752
isn't OpenEuphoria like that?
>>
>>61921776
That's actually a good one, Rust would be great to implement a compiler-compiler, with the extended enums and all.
>>
>>61919981
> touch CoC.md

Yeah no not right for me old chump
>>
Asking for golang advice here because /wdg/ are literal monkeys.

I need advice for which golang router to pick. Go-programmers shit out a dozen of routers each week, some which suck, and others are even worse. Asking someone will lead to them telling you to "just use net/http". Useless people.

I'm going to have a REST service which may have some complex url patterns. Example:
Here:
GET http://api.site.com/gallery/files
Lists all files.
GET http://api.site.com/gallery/files.json
lists all files in json format.
GET http://api.site.com/gallery/files.xml
lists all files in json format.

Here:
GET http://api.site.com/gallery/files/123129381293893242093429
Gets a single file with that ID.

GET http://api.site.com/gallery/files/123129381293893242093429/edit
Links to a page where one can edit said file.

http://api.site.com/gallery/files/123129381293893242093429/


plus all the PUT, PATCH, DELETE and other things. Question is, what router or net package makes this the easiest? Consider how easy Django REST framework makes it with nesting url patterns.

Any clue for which router offers the best performance/ease of use? httprouter is out of the window because it doesn't support things like this.
>>
>>61921714
Why do you need 32bits?
>>
Thinking of maybe making a Chrome/FF extension that does a price-tracking similar to pic related, but for Steam games (I often find myself jumping through several hoops just to see if a game has ever dropped in price).

How bad of an idea is this?
>>
>>61919981
I-is that you vinny?
https://www.youtube.com/watch?v=RJmtp26d8fs
>>
File: 1489241743901.jpg (96KB, 392x417px) Image search: [Google]
1489241743901.jpg
96KB, 392x417px
>>61921787
It's not called Pascal.

>>61921798
Well, that's the language I've never heard of, but it looks great and seems to be just right for me!
I'll invest some time into it, thanks, anon!
>>
>>61921996
I want to write a kernel, which they say is easier for i686, I'm familiarizing myself with how C turns into ASM.
>>
>>61922045
You'll need to be resilient for that.
>>
>>61921998
>How bad of an idea is this?
not a bad one at all.
I would suggest selling it for 10 cents.
>>
>>61921998
>How bad of an idea is this?
Well the general case is that stream games dont' fluctuate that much in price and low prices are always announced (sales send you emails and stuff).

But it's not that bad an idea. Just mostly unnecessary.
>>
File: PointerFunC.png (424KB, 989x932px) Image search: [Google]
PointerFunC.png
424KB, 989x932px
>somebody actually needed this
https://a.pomf.cat/gfdihf.avi
>>
>>61922045
Don't give up, I did it and it took me a whole lot of time to debug that shit.
But it's worth it in the end.
>>
>>61921617
>Would people in the workplace laugh at me for writing this way?
They would laugh for not using python for this:
sum([i if not i % 3 or not i % 5 else 0 for i in range(1000)])
>>
>>61922222
>making your code slower and less readable, also less statically safe
>>
>>61922190
Did you use any specific tutorials (i know about OSdev), or was it a uni thing?
>>
>>61919992
similar to me except I'm using gnu11 instead of c11
>>
>>61922269
It was indeed a school thing (although without any teacher help for some reason), but i used OSdev throughout.

Beware though, if you don't know the ins and out of asm before launching into it, you'll fail for sure. Learn that shit ahead of time.
>>
>>61922264
Meh, you'd have to go to pretty high numbers for that to be slow. And only a retard would impose restrictions on himself that are not necessary for the current task.
>>
>>61921617
okay i'll take that as a no.

So when I try and run my solution for Euler 2, my computer damn near implodes.

import Foundation

var sum : Int! = 0

func fib(_ n : Int ) -> Int {
if (n < 2) {
sum = 1
return 1;
} else {
let tmpSum = fib( n-2 )+fib( n-1 )

if ( tmpSum % 2 == 0 ) {
sum = sum + tmpSum
}
return tmpSum
}

return 0
}

print(fib(4000000))
print(sum)
>>
>>61922522
meanwhile in haskell

sum [ i | i <- [1..1000], mod i 3 + mod i 5 == 0 ]

Type safe, not slow (likely compiles to a loop), readable (if you have any experience with set notation)
>>
>>61922543
I also feel like there is a way to do anonymous recursion here, so I could inline filter even numbers to partially apply to a sum, but meh I don't know if that's a thing
>>
>>61922522
>thinking ahead is premature optimization
Brainlets shouldn't read Knuth.
>>
>>61922617
>he predicts profiler results before its even run
wow
>>
>>61922636
Yeah, i'm a systems programmer, sue me.
Better yet, run that fucking profiler faggot.
>>
>>61922543
Don't do recursion here. It's ridiculously slow. Usually you should avoid recursion, if you can, since it adds such an overhead.

Do something like this for fibonacci numbers:
a=1
b=0
while a < x:
t = a
a = a + b
b = t
>>
>>61922655
>recursion
>slow
>>
>>61919981
Here is how software meant to be written:
https://github.com/DmitryHetman/gentoofetch
>>
>>61922669
It is slow. Recursion will at best be as fast as a loop. At worst, far far slower. In python it's a suicide by heat death of universe to use recursion.
>>
>>61922669
>like this for fibonacci numbers:
Recursion is slow as fuck. Never use it.
Only few algorithms require recursion.
>>
>>61922689
>>61922705
>goto is slow, use goto instead
>>
>>61922705
Please stop bullshitting.
>>
>>61922714
You're a retard. A function call is not a goto. It is a complete context switch. You move stuff on top of the stack repeatedly. Stop replying to people if you're so retarded. Especially with meme arrows, it's obnoxious.
>>
>>61922543
I say = Fuck swift, what a gay language

Read = (My tiny brainlet mind can't comprehend why this doesn't work)
>>
>>61922676
You need to put a license to https://github.com/DmitryHetman/gentoofetch/blob/master/gentoofetch.c
>>
>>61922736
Recursion by using tail-calls is a goto.
>>
>>61922652
real    0m0,048s
user 0m0,040s
sys 0m0,004s
>>
>>61922758
And the problem here is not a tail call. Stop wiggling, you lost the argument.
>>
>>61922758
Then you're dependent on your language implementation supporting tail call optimizations.
>>
>>61922736
If you tail call then it is just a goto you dumbass
>>
>>61922779
>And the problem here is not a tail call
What is the problem then?

>Stop wiggling, you lost the argument.
How so?
>>
>>61922785
>>61922779
>>61922758

Umm...guys? This isn't getting my homework done.
>>
>>61922788
>>61922543

Also, someone shoot this guy: >>61922785
>>
>>61922780
By using a while loop you are dependent on your language implementation not allocating 100MB on every loop.
Implementations that do not transform tail calls into a simple goto are shit and should not be used.
>>
>>61922714
Stupid prostitute.
>>61922726
You are pussy. People that have balls use loops.

recursion haves huge overhead, function call uses stack heavily, in recursive functions there is a lot of function calls, you can even overflow stack.

You are too stupid to get job, you will die unemployed or as Mcdonalds worker.
>>
>>61922816
Finally someone with sense.
>>
>>61922803
The discussion started from >>61922655 which can be done in a recursive way. Everything that can be done in a while can be done with recursion after all.
>>
>>61922816
No shit, that's why you move the stack into the parameters or outside of the body you recurse on.

You're literally just too dumb to know how to use recursion.
>>
>>61922806
for loop doesn't allocate memory.
>>
>>61922827
>Everything that can be done in a while can be done with recursion after all.
Sure. You can. You shouldn't.
>>
>>61922848
It does if it has locals.
>>
>>61922843
Go clean floor in MCdonalds, you are not allowed to communicate with people.
>>
>>61922869
Once.
>>
File: 1478584019436.jpg (106KB, 1280x720px) Image search: [Google]
1478584019436.jpg
106KB, 1280x720px
>>61922825
>roumounian namefag
>sense
no

>>61922816
Real men are not scared of recursion.

>recursion haves huge overhead, function call uses stack heavily, in recursive functions there is a lot of function calls, you can even overflow stack.
Tail calls are gotos.

>>61922848
It does not in a proper implementation. Neither do tail calls in a proper implementations.

>>61922859
>You shouldn't.
Explain your reasoning. I would argue exactly the reverse. You should avoid things like while looks and use recursion and constructions like map instead.
>>
>>61922869
There is no way to overflow stack in for loop.
>>
>>61922827
That doesn't mean you should. Most of the time you shouldn't. You'll incur unnecessary overhead like >>61922816 said that simply isn't worth the trouble 90% of the time.
>>61922843
Do you know what the call stack is? Because what you just said doesn't apply to it in any way whatsoever.
>>
>>61922843
The stackframe needs still needs to have the return address.
>>
File: 1468348033936.jpg (106KB, 750x653px) Image search: [Google]
1468348033936.jpg
106KB, 750x653px
>>61919981
How do I clean this up?

I want to remove retardation before I add more features.

no bully please I am new


I am 90% sure there is a better way to run this loop.

is the while part even necessary?
>>
>>61922882
>Explain your reasoning.
Because a recursion reduces to a loop in the best case scenario. In all other scenarios, it starts filling your stack. It is a substantial overhead, and utterly unnecessary.
>>
>>61922910
>no bully please I am new
we can see
>>
>>61922889
>>61922896
You're adding to a variable, you don't need to return
>>
Building the Rust compiler is slow as balls, how the fuck do they even deal with this

>>61922910
Yes
>>
>>61922910
>How do I clean this up?
A mop maybe. Vacuum cleaner could work. Hard to say, really. I've never had a dimensional rift in my floorboards. Use bleach if nothing else works.
>>
Rust, C++ was a mistake, and all scripting languages too.
We have C for system programming and 'go' for services.
>>
>>61922921
>>61922938
>>61922940
Why does it keep giving me connection issues when I try to post my code?
>>
>>61922945
And python for solving your everyday problems.
>>
File: 1501650876534.jpg (121KB, 1280x720px) Image search: [Google]
1501650876534.jpg
121KB, 1280x720px
>>61922889
>You'll incur unnecessary overhead like >>61922816 said
Not if used instead of while loops. Everything that can be done with a while loop can also be done with recursive tail-calls.

>That doesn't mean you should. Most of the time you shouldn't.
See >>61922882

>>61922896
Not if it is a tail-call. The point is that you will not return to the same function.

>>61922911
>Because a recursion reduces to a loop in the best case scenario
Loops are not defined in lambda calculus. Instead, one in lambda calculus would use recursion. Loops are literally defined on top of recursive procedures.

>In all other scenarios, it starts filling your stack. It is a substantial overhead, and utterly unnecessary.
You can have non-recursive or functions that call each other in a recursive way by using tail-calls in order to do things that can't be done trivially with a simple loop.
I would argue that loops are a useless imperative construction that should be avoided. After all function calls can replace them for everything.
>>
>>61922945
>Go
Where are the generics?
WHEREARETHEY?
>>
>>61922945
See >>61922741
>>
>>61922945
>Go
I'd rather write Java than Go, that language is layers upon layers of bad design.
>>
import time
import vidopener

now = time.strftime("%H%M") #add and seconds


#things to do:
#1.decide if I should use 12 or 24 hour clock
#2.learn to involve a gui
#3.Find better way too prevent it from repeatedly asking for input
#5.Figure out if its a bad idea to import a module that is importing modules ect
#6. Figure out how to implement tts

Alarm = input("When do you want to wake up: ")

while True:
if Alarm != now:
print('ZZZ til:' + Alarm)
print('Current time is' + now + time.strftime('%S'))
time.sleep(3)
now = time.strftime("%H%M")
continue
else:
vidopener.getnews()
# use vidopener or just post whole code here?
break


# connect to schedule somehow
print('Time to wake up, you have work at !!!!!')
>>
>>61922957
Have you registered yet? Just put your email and password in the name-field when you post. If you don't have an account it creates one.
>>
>>61922996
Go is clearly and cleanly designed, as every young language is. Java is bloated with legacy shit and hacks.
>>
>>61923009
>>61922957
>>61922940
>>61922938
>>61922921
>>61922910


OK PLS HELP NOW.

>>61923018
thanks
>>
>>61923009
It's fine. What do you want to change?
>>
>>61923040
Be on your best behavior, guys. We have a grill here.

So, how you doing?
>>
>>61923018
Alright, I'll try.

i = 0
while i < 100:
if i % 15 == 0:
print("FizzBuzz")
elif i % 5 == 0:
print("Buzz")
elif i % 3 == 0:
print("Fizz")
i += 1
>>
>>61923048
Do I even need the NOW variable?

Do I even need the WHILE loop or can I just use IF and CONTINUE?

How often should I run my loop? I have it at 3 seconds right now, but That seems to often. 60 seconds is too long. Will this program take up resources if I let it run forever?
>>
>>61922986
They called interfaces in go.
>>61922741
Thanks a lot.
>>
>>61923037
- fucking nil
- no generics
- new and make instead of one
- GOPATH is a mess
- you can only import from master branches
- no immutables
- no light functional stuff like map/reduce/filter
- ungoogleable name
- can't change the hash function in maps

I could go on.
>>
>>61923079
fuckoff

>>61923088
It wasnt funny the first time.
>>
>>61922996
Java doesn't have any reasonable implementation.
Go has at least two.
>>
>>61923157
>interfaces
You can't use them for code reuse.
People literally argue that using interface{} everywhere is acceptable practice.
>>
>>61923159
- ungoogleable name

Inexcusable truly. I bet there is some one at google right now tasked with analysing go's growth through search data who is crying under his desk.
>>
>>61923168
Only the GCC one is reasonable.

And that doesn't change the fact that the language is shit design.
>>
>>61923159
>- fucking nil
I prefer it to exceptions desu
>>
>>61923168
Of course someone who hates recursion would be a go programmer.

Too dumb for Java!
>>
>>61923166
post feet or gtfo
>>
>>61923202
That's a funny way of spelling tits, anon.
>>
>>61923191
Rust and Haskell style error handling are the sane way to do it mate.
nil/NULL is the blunder of the century, the guy that introduced it to programming still weeps about it.
>>
>>61923202
I woudlnt even mind posting retarded shit like feet if you guys had helped me at all.
>>
>>61923218
I will help you if you post your soles.
>>
>>61923212
what does Rust error handling look like anyway/
>>
>>61923150
>Do I even need the NOW variable?
No, but it doesn't really hurt. Makes it a bit clearer maybe.

>Do I even need the WHILE loop or can I just use IF and CONTINUE?
Yes, you need a while loop. Otherwise it'll quit after 3 seconds.

>I have it at 3 seconds right now, but That seems to often. 60 seconds is too long. Will this program take up resources if I let it run forever?
It almost doesn't matter. You can put it to do it every millisecond and your perforamcne probably hardly changes, since it's sleeping. most of the time. A modern processor works at around 4ghz. That means it'll do about 4 billion operations per second. They're of course the lowest level operations, but that should give you an idea how fast they are.
>>
>>61923228
Rust code makes no errors.
>>
>>61923218
It takes time two write, man. Don't expect immediate answers.
>>
>>61923228
Two types of errors.
Recoverable errors are handled by returning a Result<Err, T> type with associated convenience functions and operators.
Unrecoverable errors are panics which are either stack unwinding on debug builds or crashes on production builds.
>>
>>61922882
>namefag
>no id
>>
>>61923228
unwrap()
>unwrap()
unwrap()
>unwrap()
unwrap()
>unwrap()
unwrap()
>unwrap()
>>
>>61923268
You are thinking of tripfagging.
>>
>>61923272
That shit is bad practice though. The Book warns against it.

People use ? now, like in scala.
>>
>>61923265
>Result<Err, T>
how does this differ from Go exactly?
>>
What is the reason /g/ doesn't have id:s? It'd be much easier to talk to people if we did have those.
>>
>>61923300
get out
>>
>>61923300
we're a slow board dumbass
>>
>>61923236
Thank you.

Especially with the performance question. I couldn't find it concisely explained anywhere.

One more if you dont mind?

If I import another module I made that itself imports modules and so on, are there any negatives with this?

And if there is no downside :
Is it easier to edit as several separate pieces or does that just make it more annoying.

>>61923260
Fair, but I got immediate creepers so...
>>
>>61923330
What do you think about diversity in tech?
>>
File: hackerman.jpg (39KB, 450x449px) Image search: [Google]
hackerman.jpg
39KB, 450x449px
>>61923330
you've just been hacked
>>
>>61923295

Result types have to be explicitly handled and are easier to deal with, whereas you can mistakenly dereference a nil.

fn does_things() -> Result<u32, IoError> {
let res1 = canFail()?;
let res2 = canFail()?;
return Ok(res1 + res2);
}

versus
func doesThings() (uint32, error)
res1, err1 = canFail()

if err1 != nil {
return error
}

res2, err2 = canFail()

if err2 != nil {
return error
}

return res1 + res2, nil
}
>>
>>61923330
>If I import another module I made that itself imports modules and so on, are there any negatives with this?
No, it's fine.
>Is it easier to edit as several separate pieces or does that just make it more annoying.
Just try to keep the stuff organized somehow. It gets annoying to modify files if they are too long. It also gets annoying if all your functions are scattered in dozens of files.
>Fair, but I got immediate creepers so...
That's 4chan for you. Also, I was like two or three of those creepers, so, you know, where's dem tiddies at?
>>
>>61923350
What does that even mean?

is this a programming question? I am really new sorry. I only know a tiny bit of python and javascript. I dont know what
diversity in tech

does

>>61923363
hehe

saved
>>
>>61923407
>I dont know what
>diversity in tech
>does
Well, if you have a company, but you wish you didn't, you implement diversity(tm), and it will eventually implode. Basically it's a self-destruction protocol.
>>
>>61923435
10/10
>>
>>61920002
Can someone explain the story of this image??
Used to subscribe to vinesauce on youtube
>>
File: 1482706740533.png (184KB, 1280x800px) Image search: [Google]
1482706740533.png
184KB, 1280x800px
#include <unistd.h>
struct string {
char *hw;
int hw_end;
};

struct string hw = { "Hello, World!\n", 0 };

int main()
{
register int length = (int) ((void *)&hw.hw_end - (void *)hw.hw) / 8;
write(1, hw.hw, length);
}


Why does this work on macOS but not on FreeBSD? Pic related
>>
>>61923512
>using literals instead of sizeof
Undefined behavior.

But that's probably not why it's failing.
>>
>>61923512
>((void *)&hw.hw_end - (void *)hw.hw)
Are you alowed to do this? I don't think you are.
>>
>>61923569
Yeah I used sizeof(void*) on my desktop but I wanted to rewrite it quickly on my macOS laptop to see if it worked.

>i promise my code is usually good dont judge senpai ;_;
>>
>>61923591
void* arithmetic is a gnu extension.
>>
>>61923170
Inheritance is a meme.
You can implement it if you want, but there is no need. People with balls solve problems with composition.
>>
>>61923435
>>61923451
I google it.

Thats a retarded question.

Diversity is the default state. Unless you intentionally hired only Asians or something. So being opposed to diversity is retarded. You would have to actively curate a staff of a single race/gender.

But I still dont get your joke.
>>
File: 1483496941844.png (142KB, 645x675px) Image search: [Google]
1483496941844.png
142KB, 645x675px
>>61923591
Yes you are, subtracting pointers is how most strlen algorithms do it, and the type of the pointer doesn't matter in arithmetics. pic related.
>>
>>61923623
>inheritance
>for code reuse
Don't insult me anon, I use composition.
I was talking about Generics.
>>
>>61923636
10/10
>>
>>61923512
>FTFY
        .global _start
.text
str: .asciz "Hello, World!\n"
_start:
mov $0, %rdx
mov $str, %rsi
.L0:
cmpb $0, (%rsi, %rdx)
je .L1
inc %rdx
jmp .L0
.L1:
mov $1, %rax
mov $1, %rdi
syscall
mov $60, %al
xor %rdi, %rdi
syscall
>>
>>61923636
People's reaction to
https://firedfortruth.com/2017/08/08/first-blog-post/
Is the real joke anyways.
>>
>>61923672
>doing it through a loop

I wanted to implement the usual assembly strlen actually but they make a "str_end" label after str and subtract both labels all in data before going to .text.

Looking at the assembly output is a good idea to see why it fails though
>>
>>61923646
I recall that it's not allowed to do pointer arithmetic on void *.

>>61923636
>Diversity is the default state
Explains how European countries used to be all white, sub-Saharan countries all black and Japan all hentai. For some reason my dad got really angry when my mother started pushing out diverse kids. Why weren't you there to tell him that it was just how it's supposed to be?
>>
File: Head.jpg (65KB, 803x379px) Image search: [Google]
Head.jpg
65KB, 803x379px
>>61923685
oh is this the guy who spread around a memo criticizing his bosses policies to his co-workers?

>man shit talks his boss
>man writes his diatribe down
>man signs his name to multi page criticism of his bosses
>man sits back
>places arms behind head
>waits to be fired


I really dont get why this is news other than he works at google.
>>
>>61923734
Because it's illegal to fire people for criticizing workplace discrimination, whether what they say is true or not. Tons of precedent behind it as well.
>>
>rewrite OS to use OOP
>(((DatabaseManager-FactoryReset)Factory)Manager)Database
>>
>>61923709
Usually I have a printstr label, so I'm used to compute the length of the string before printing it.
>>
>>61923760
OOP was a mistake
>>
>>61923760
>enterprise solutions can be applied to system programming
>>
>>61923793
http://www.yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html
>>
>>61923734
>>man signs his name to multi page criticism of his bosses
u wot m8?
>I really dont get why this is news other than he works at google.
I think it's nice that you're here. You're obviously triggered, but most people don't even want to subject themselves to the possibility of it It takes endurance to listen to people you don't agree with.

On that note: ur rly dum. You don't fire competent people for valid criticism.
>>
>>61923796
>enterprise solutions can be applied to _
>>
>>61923710
>>61923756
This seems kinda /pol/ I dont wanna get banned for off topic on first day...

but you are both wrong. (except japan which is an island so duh)
>>
>>61923823
>This seems kinda /pol/
/g/ is the scifi division of /pol/, so that's just natural.

>but you are both wrong.
Huh, you've really changed my mind. I never thought of it that way.
>>
>>61923823
>i'm wrong
explain
https://www.cnbc.com/2017/08/07/it-may-be-illegal-for-google-to-punish-engineer-over-anti-diversity-memo-commentary.html
>>
>>61923823
>but you are both wrong.
>firing people for their political views and opinions
>not illegal
Nice little echo chamber you got there.
>>
>>61923512
just before the write call:
(gdb) p &hw.hw_end
$4 = (int *) 0x600968 <hw+8>
(gdb) p hw.hw
$5 = 0x4005e4 "Hello, World!\n"
(gdb) p (void*) &hw.hw_end
$6 = (void *) 0x600968 <hw+8>
(gdb) p (void*) hw.hw
$7 = (void *) 0x4005e4
(gdb) p length
$8 = 262256

don't know why it works on the mac, maybe you got lucky and *hw.hw and hw.hw_end were just the right number of bytes apart
>>
>>61923885
>echo chamber
Meh, that's not really an issue. We have an echo chamber here if you think about it. You hang around people you like, and you don't like people who don't share your values, opinions and ideas etc. Therefore you don't hang around with people who are too different from you, i.e., people naturally tend towards echo chambers. I left leddit, because I couldn't listen to them anymore.
>>
>>61923900
Shouldn't a struct usually make each composing variable next to each other? I thought that was the whole point of them
>>
>>61923953
yeah, you have a char pointer and an int next to each other, and the char pointer points to the first character of your character array, which might be anywhere in memory
>>
How would you store this in C? −0.42E7
Do I just write it in as it is "−0.42E7 " or -4200000.0?
>>
>>61923932
>you don't like people who don't share your values, opinions and ideas etc.
Bullshit. I go fishing with a literal communist every month and my brother is an ancap. And I think that their political opinons are retarded.

Echo chambers are not about people agreeing, but about silencing dissent.

There's always the possibility of someone disagreeing on 4chan, and though it may be laughed at with image macroes, it's still displayed on the page for all to see.
>>
Do people actually use #define constants outside of C89?
>>
>>61924002
This makes sense. So Apple's compiler actually makes the string next to the pointer and FreeBSD's doesn't is why it works on macOS.
>>
>>61922676
It's shit
>>
>>61924004
I don't remember if C has defined float implementation in the standard.
Look up the help of your compiler.
>>
>>61924047
maybe, maybe not, you should check in a debugger to be sure, or have the program print out the addresses and values of your struct members
>>
>>61924013
>There's always the possibility of someone disagreeing on 4chan, and though it may be laughed at with image macroes, it's still displayed on the page for all to see.
Well, that's true, but the users here largely share the same ideas. There are far more conservatives than 'progressives' here, you must admit. People want to be with their own kind. People actually avoid diversity. I'd say diversity is the most unnatural order of things, and I'm quite sure that's true.

Maybe this place is not an echo chamber, but it doesn't have to be. I doubt some feminism forums in leddit actually would have to ban as many people as they do. People who disagree with them simply don't want to go there in the first place. Apart from you, of course.
>>
>libthis.js
>libthat.js
Should I embrace and use JS?
>>
>>61923885
>>61923861
>>61923756
Have you guys ever worked anywhere corporate before? They always fire the person who speaks out. Then they settle out of court. Dude probably signed some retarded arbitration only agreement too(he can get out of it).

I dont really care about the politics of it, but if you think those anti-discrimination statues do anything you must never have had to use them before. Companies violate that stuff all the time.
>>
>>61923636
There are very few women in tech.
>>
>>61924132
Depends on what you want to do. Backend js is a meme, use php. For frontend, javascript is a must.
>>
>>61924136
I'm in a country with actual worker rights.
Here firing someone for what he did would have exposed the company to massive penalties.

Not to mention at least one of the unions would have sided with him.
>>
>>61924153
https://thefullsnack.com/en/rust-for-the-web.html
>>
>>61924094
This worked on FreeBSD under the assumption that hw_end's string would follow hw's. It also works on macOS.
Thanks!

#include <unistd.h>
struct string {
char *hw;
char *hw_end;
};

struct string hw = { "Hello, World!\n", "\0" };

int main()
{
register int length = ((int)hw.hw_end - (int)hw.hw);
write(1, hw.hw, length);
}
>>
>>61924153
I want JS to become a mainstream systems scripting language unironically.

It's much better than python as a language, has better implementations and tools and is all around easier to work with and deploy.
>>
>>61924184
hmmm
test.c:11:28: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
test.c:11:45: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>>
>>61924210
Yeah I should've cleaned this up

#include <unistd.h>
struct string {
char *hw;
char *hw_end;
};

struct string hw = { "Hello, World!\n", "\0" };

int main()
{
register int length = hw.hw_end - hw.hw;
write(1, hw.hw, length);
}
>>
>>61924184
that only works if the compiler decides to put hw_end directly behind hw, what if you have a 1000 different struct strings and the compiler decides to just allocate one "\0" to save some space? I'm pretty sure the compiler's allowed to do that since "\0" is const
also why not just use either a length member in the struct or a second char* pointing to the terminating '\0' of hw?
>>
>>61924153
To be honest I am just a humble guy (male) who doesn't have a clue what's frontend and backend is (client-side and server-side applications, I suppose?). I am not a web programmer, I just need to write some shit for my daily use, but I see many people recommending various JS libraries.
>>
Is there a site or a guide to must know keyboard shortcuts, key combinations? Like Ctrl + a to select all etc?
>>
>>61924293
F1
>>
>>61924164
Oh, well in america we have no unions big unions outside of public unions. And California is right to work so they can fire you for any reason with no warning at anytime.

And then you have to prove after the fact that they fired you for some illegal reason.

In this country they measure the potential penalties of labour law violations against the possible problems an employee can cause. If they think you will do more harm than a 10,000 fine they fire you.

this dude was clearly a bad apple from the google management perspective. Simple choice to fire them.
>>
File: _____.jpg (186KB, 736x856px) Image search: [Google]
_____.jpg
186KB, 736x856px
>>61924293
>>
>>61924277
>client-side and server-side applications,
Yes.
>>61924277
>I just need to write some shit for my daily use, but I see many people recommending various JS libraries.
You definitely want Python. It has great libraries for all kinds of things from maths to drawing, and from text editing to image editing. It's nowhere near the more efficient languages in speed, but it is probably one of the most expressive languages there are, i.e., it's very fast to write working code with it.
>>
>>61924188
No way. JS is obsolete piece of shit for browsers only.
>>
>>61924420
What is ES6?
>>
File: 1480055557772.png (31KB, 412x296px) Image search: [Google]
1480055557772.png
31KB, 412x296px
>>61924269
>or a second char* pointing to the terminating '\0' of hw?
Because I'd need the length to find it, and at that point strlen would be more efficient, so it'd be better to have the length as a struct member. Both of these are against the goal, what I want to do by this is to always have a reliable way to compute the length.

What you suggested is really what I tried to do by making the null byte a member of the struct, although I know the hw string already has a null byte associated with it. pic related

I know the data does save a length of the string which would accomplish this but I don't know how to access it, and the only way to force myself onto it is by knowing the size in advance and the right alignment which is annoying. The program still calls strlen though even though that data's saved.
>>
File: yeeeahhh.jpg (20KB, 449x287px) Image search: [Google]
yeeeahhh.jpg
20KB, 449x287px
>>61924433
It's.... promising
>>
File: 003.jpg (54KB, 960x540px) Image search: [Google]
003.jpg
54KB, 960x540px
>>61924474
>mfw JS has generators and async/await now as well as a better OOP than Python
>>
>>61924188
Haskell instead
>>
>>61924458
>what I want to do by this is to always have a reliable way to compute the length
well hoping that the compiler will put two strings back to back in memory isn't a way to do it
if you only want to store strings that are known at compile time, you can get the size of the literal with sizeof, but you would probably want to use a macro for initializing a string
>>
>>61924538
Gotta be realistic, Haskell is great but it's terrible for scripts because io is not what it was designed for.
>>
>want to build own foobar2k like music player as a project to learn
>look into open source players to see what to expect
>none of the functions make immediate sense, don't get the feeling of why anything that's there is necessary for a music player

i want to kill myself
>>
>>61924596
you can do io easily
>>
>>61924669
>implying IO isn't inherently stateful
anon pls
>>
>>61924685
you're creating a representation of an IO action that is eventually compiled into a program along with bindings

try playing with free monads
>>
>>61924596
import Turtle               --
--
datePwd = do -- datePwd() {
dir <- pwd -- DIR=$(pwd)
result <- datefile dir -- RESULT=$(date -r $DIR)
return result -- echo $RESULT
-- }
main = do --
time <- datePwd -- TIME=$(datePwd)
print time -- echo $TIME
>>
>>61924770
Interesting. But why write stateful code in haskell when an imperative language has better libs?
>>
>>61924797
Haskell is better at imperative than imperative
>>
File: tumblr_lh34ynuuVq1qhv4q1o1_500.jpg (13KB, 500x333px) Image search: [Google]
tumblr_lh34ynuuVq1qhv4q1o1_500.jpg
13KB, 500x333px
>>61924812
>>
Is there any substantial evidence for any small team development models (like scrum) actually working? I mean more than just some ignoramus saying it's working. Numbers.
>>
>>61924834
you know it's true

>>61924770
main = pwd >>= datefile >>= print
>>
>>61924845
Read The Mythical Man Month.

The surgeon team works, it's how NASA put a man on the moon: they had a huge number of small teams working on small problems (sometimes multiple teams per problem) with efficient management inbetween.
>>
>>61924433
It's same shit, and obsolete event in terms of javascript, lastest version is ES7
>>
>>61924846
bonus mode

(const pwd >=> datefile >=> print) ()


if we could rebind lists in a decent manner, then we could do type aligned lists

kleisli [const pwd, datefile, print] ()
>>
>>61924894
in fact rather than kleisl you could have compose and it could work for any category
>>
File: c5.png (58KB, 304x218px) Image search: [Google]
c5.png
58KB, 304x218px
Well, /dpt/?
>>
GPLv3 or AGPLv3 for a library?
>>
>>61924929
Right.
>>
>>61924188
>It's much better than python as a language
it's not
>>
>>61924188
>61924188
They're both terrible languages.
>>
>>61924929
right, except with 8-space tabs
>>
>>61924929
Right.
The opening brace is not a different statement, and in modern languages the parenthesies are removed anyways.
>>
I have a container of <BaseFoo*> that holds objects of derived classes
to polymorphically access common functionality of a data structure.
Is there a way to access the uncommon functions or should I need a new
interface?
>>
>>61925012
>{ }
>"parenthesies"
>>
>>61925034
Using C++ btw.
>>
>>61925034
pattern matching
catamorphisms

oh, sorry, you're using OO, guess you're out of luck!
>>
>>61925044
>reading comprehension
I meant
if condition {
code
}
>>
>>61924929
Only shitty programmers care.
>>
>>61925072
surely you have a personal preference
>>
>>61925034
You need to cast. Do dynamic_cast if you want typechecking, static_cast if you don't.
>>
>>61925034
Why not just typecast them to the desired types?
>>
>>61925086
case condition of
True -> ...
False -> ...
>>
>>61925112
import Data.Bool (bool)
bool (...) (...) condition
>>
>>61925086
Not using a language with a C-based syntax
>>
>>61925090
>>61925097
Thanks, this is what I needed.
>>
>>61925034
>>61925177
You should probably use decorators for the uncommon functions instead of inheritance.
>>
>>61925210
>decorators
I love how OO manages to sell an entire industry around "patterns" that solve problems that OO itself introduces
>>
>>61925057
>he doesn't know you can do the same in OO using the visitor pattern
Pleb
>>
make new thread fags
>>
>>61925280
Not bump limit yet faggot
>>
NEW THREAD
>>61919998
>>61919998
>>61919998
>>61919998
>>
>>61925253
>yet another "pattern" solving a problem that only exists because of OO
>>
>>61925309
>>61925245
>durr computers solve problems that didn't exist before therefore computers suck XDDDDD
Stop showing off how pleb you are.
>>
>not using go
>>
>>61927216
\>not using rust
>>
>>61927228
ᐳbeing gay
>>
>>61927263
>can't triforce

▲▲
>>
>>61927319
>failing this hard
>>
>>61927573

▲▲
>>
>>61927587
>figured it out
>>
>>61927634
>being new
>>
>>61919981
>vinesauce
Thread posts: 323
Thread images: 27


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