/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

old thread archived
link forever broken
dpt linked list/tree/graph 2017-2017 F

traps are gay

this

old thread

god what a shit thread

it's dead right now, that's why old thread archived without a new thread
obviously first two shitposts aren't helping but still

.

...

I really liked this.

Kind of vacuous but still funny

I'm working on my compiler

i don't get it, please explain

10_b =
1 x b^1 + 0 x b^0
= b

In binary, base 10 means base 2
1 = 01
2 = 10

In base 4, base 10 means base 4
1 = 01
2 = 02
3 = 03
4 = 10

In every base, 10 means the base number

answer this you four-eyes
if you guys are so smart, why are you on Sup Forums?

But user... I'm not smart...

I'm also schizo

Oh, wow... so base 10 IS special.

so the alien is retarded?
thus the scene is sad, not funny.

Every base is base 10 (in that base). Base ten is not that special.

we count 1 2 3 4 5 6 7 8 9 10
they count 1 2 3 4
we call ours base 10 (makes sense)
they call theirs base 10 (even though they only count to 4, but represent it as one-zero)

if speaking, the alien should say "four", not "ten"
if writing, "four" would be written as "10" in base-4

Yeah the joke doesn't really work if you dissect it TOO hard.

>Base ten is not that special.
I'm not saying using 1+1+1+1+1+1+1+1+1+1 as a base is special, user. I'm saying base 10 is special. ;^)

>not casting malloc
OP is a faggot

if all base-X are equally valid, but you can base-10 special. this is only due to your being accustomed to arabic numerals and their long lasting base-10. if it were some chinese base-5 that caught on and spread worldwide, you'd be saying it were special.

>if speaking, the alien should say "four", not "ten"
What happens when the alien gets to "11" in base 4? Should he say "five" or "eleven"?

>if all base-X are equally valid, but you can base-10 special.
Wew lad

I could spend all watching different posters all day making the mistake they're accusing me of and it won't stop being funny.

This thread should be purged and started anew desu, what a shit show.

(defun current-year ()
(nth-value 5 (decode-universal-time (get-universal-time))))
(format t "~@R" (current-year))

>should SAY five
but represent it in text as 11

Why should he say "five"? Why not "eleven"?

If it speaks English, five.
Actually we count 0-9
They count 0-3.
when having multiple digits (eg 567 in base 10) you mean 5*10^2 + 6*10^1+ 7*10^0.

>If it speaks English
It doesn't even know what four is, according to the comic. How would it know about five?

one - 1
two - 2
three - 3
four - 4
five - 5
six - 6
seven - 7
eight - 8
nine - 9
ten - 10
eleven - 11

>one - 1
>two - 2
>three - 3
>four - 10
>five - 11

>one - 1
>two - 2
>three - 3
>ten - 4
>eleven - 5

ok, now it's 100% confirmed you are just trolling.
game over. next subject.

What if you're just too much of a brainlet to understand?

DOS is vastly superior to windows
you simply cannot prove me wrong

>For example, give this type of task to a C programmer: "I need a data structure containing strings of variable length. The amount of elements to be added to it is in the few millions, depending on the input. It must be fast to add and remove elements from it, as well as searching for existing elements." Then give some example situation where that data structure should be used, for the C programmer to implement. Of course demand the code to be fully tested and debugged.
>The C programmer will spend the next few days implementing and debugging such data structure, and it might or might not be bug-free.
>A C++ programmer needs to do nothing (besides implementing the example program which uses the data structure). That's because the standard C++ library already offers such a data structure.

What data structure is that? At first I thought the author meant a hash table, but he used the term "search" instead of "lookup", which leads me to believe that it can't be a hash table since search usually implies returning all elements that fit a query, like searching for a substring in SQL. If he meant a hash table, you would still have to iterate over all the elements to find the matches, but that can't possibly fit any definition of fast.

you "what if" is moot, since i am a superior brain and thus i know that i do comprehend and your level of understanding is beneath me.
not bragging, just saying.

Ten = 4
Teen = 16
Teeen = 64

Why are you trying to make sense of the words or a retard who doesn't understand the concept of libraries existing besides the standard one?

The author sounds retarded because this is unclear.
Also
>C doesn't have libraries/the only library which counts is the standard library

>chirp chirp chirp
I don't speak brainleteese, but you better bow to my superior intellect until you realize that 5 is actually eleven.

>using std::vector over manually reallocing your array every single time you want to add a new element
do you even kode

>manually reallocing your array every single time you want to add a new element
This is why C++ "programmers" should do what that author claims C programmers do for a while.

>search for existing
I think that counts as lookup
Alternatively you could use set, which gives you > and < lookup, and assuming lexicographic ordering you can search for strings that begin with a string

fucking moron

This is stupid, my dude. The vector only occasionally reallocates, as it reallocates with current size * 1.5 to allow for future insertions without having to reallocate. If you reallocate whenever you want to insert 1 extra element, you should be fired.

JIT > static compilation

dubious

Why?

AOT > Static Compilation > JIT

makes runtime polymorphism fast

>slowing down to better accelerate

Never got this image, malloc returns void* so how do I get around casting it like so?

int x = 32;
char* str = (char*) malloc(x);

In C, void* can implicitly convert to any data pointer type. In C++, the conversion is explicit.
It's a bad idea to use the cast in C.

ahh thanks user

Static compilation IS AOT, you fucking moron.

Is starting emacs with a starter-kit (like better-defaults, emacs-starter-kit, ohai-emacs, etc.) a good idea ?
Which one should I get ?

C++ hashtables are std::unordered_map, and ordered maps (red black trees, i believe) are std::map

You shouldn't use std::unordered_map though.

Besides 'Automate The Boring Stuff With Python', what other beginner-to-intermediate-level Python teaching materials are there available? Preferably those with less focus on general coding fundamentals as I already know about control flow, data types etc from JavaScript and PHP.

I want to start programming, is C# a good starting language?

Also, any good resources for studying?

its OK if you want a code monkey language sure

>red black trees, i believe
Standard doesn't ask for any specific implementation, merely for complexity/ordering guarantees. Usually it's implemented using RBT but they could very well be AVL too.

3 years later, i still see this himegoto picture used as the opening of this thread. Good job.

Personally, I'm working on nothing. But I've been getting into reverse engineering and stuff lately. In particular, game hacking. I don't even play video games for the most part, but I've become interested in bypassing stuff like VAC or Battleye (Battleye in particular is pretty interesting, and has given me a reason to look into kernel exploits, driver signatures, etc.)

Lots of good resources around and I'll probably know a lot more about Windows when I'm done with my adventures.

Liking traps don't make you gay.

No. Either go full C++ or Java. C# doesn't bring anything new or important to the table, the whole "community" has been artificially nurtured by Microsoft.

dont listen to this retard
Java is long dead and pretty much replaced by C# on mobile platforms.

And "starting" from C++ makes no sense, because if you learn C++ you dont really need to learn any hi-level lang since 99% of them use c++ as a base.
It only makes sense to start learning coding from easy hi-level lang so low-level will be easier later

>Java is long dead and pretty much replaced by C# on mobile platforms.
Is this what Microsoft tries to shill? Because FACTS don't agree.

>that
>facts
kek

>Java is long dead and pretty much replaced by C# on mobile platforms.
Fucking where? Windows mobile? New JVM languages are all the rage.

>pretty much replaced by C# on mobile platforms.
>Android devs mainly use C#, not Java
>iPhone devs mainly use C#, not Objective C

>read official BeautifulSoup documentation
>lxml recommended

Okay, let's try this extremely trivial example:
from bs4 import BeautifulSoup

xml = """

My title
My link
My description
"""

soup = BeautifulSoup(xml, "lxml")
items = soup.find_all("item")

for item in items:
print(item.link)


Output


???


Changing to "xml" instead of "lxml" gives
My link

What the fuck is this?


I hate freetard incompetence so goddamned much.

Your tears are delicious, keep crying.
Your daddy microsoft never realized that .NEET will never be able to top Java.

>I hate freetard incompetence so goddamned much
It doesn't sound like you've ever used commercial APIs.

>Java is long dead and pretty much replaced by C# on mobile platforms.
Not a phone-fag, but if I were to make a mobile app, I'd either choose Java or Kotlin.

all your current languages are soon to be obsolete.
Q# will be where the big salaries is.

>salaries is.
Go retake your English course, pajeet.

>Windows mobile?
RIP

I work with integration

If something is not up to specification they will be informed and obliged to fix it.

With freetard software you file an issue that lands in some brony's inbox who is too incompetent to even find the error

>If something is not up to specification they will be informed and obliged to fix it
You mean just like they're "obliged" to fix bugs and security issues in their software? Have fun waiting for months until your minor issue gets any attention.

>With freetard software you file an issue that lands in some brony's inbox who is too incompetent to even find the error
Or you can fix it yourself and issue a pull request.

>You mean just like they're "obliged" to fix bugs and security issues in their software? Have fun waiting for months until your minor issue gets any attention.

I integrate production critical systems on short deadlines during production stops. If something doesn't work they find the moron responsible and drag him to work even if its in the middle of the night.

Amazing how quick newbies learn to test against specifications...

Too bad freetards have never held down an honest job in their lives, so they'll never learn this.

>I integrate production critical systems on short deadlines during production stops.
Sure thing, kid. Opinion discarded on account of your persistent lying.

>freetards have never held down an honest job
Sounds like projection to me.

I finally got off my ass and started reading SICP, /dpt/

sage for pseudo-blogpost and the fact that this is like the third exercise in the book

sess Stream(T: Type) {
next -> T * Stream(T)
}

// processes must be tail recursive
proc from(n: Int) -> Stream(Int) {
match {
next => yield n
}
from(n + 1)
}


data List(T: Type) {
nil: List(T),
cons(T, Box(List(T))): List(T)
}

// functions may be generally recursive
func take[T, P: Stream(T)](n: Int | n >= 0, xs: P) -> List(T) {
if n == 0 {
nil
} else {
let x = xs.next;
cons(x, box(take(n - 1, xs)))
}
}


func range(m: Int, n: Int | m List(Int) {
take(m - n, from(n))
}

>Or you can fix it yourself and issue a pull request.
and wait for bronylord97 to accept it and tag a new release because I don't want to maintain custom built dependencies with all the fixes for retard mistakes

No thanks

What happened to your other language, user? You keep posting psuedo-code... when are you going to write some actual code?

Because let's face it, most freetard developers are unemployed losers whose competencies are on par with recently graduated undergrads

When I'm satisfied with the rough design.

What is this?

My language.

What is monoid homomorphism, Sup Forums?

A function f such that f(x) f(y) = f(x y) and f(e) = e.

Of course traps are gay. Literally no one has ever thought traps aren't gay.

Trap chasers aren't gay though

Just realized `range` should be `take(n - m, from(m))`, whoops.

>func range(m: Int, n: Int | m List(Int)

What's the bar do in this example?