/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

pastebin.com/bS5K0Rp8
twitter.com/NSFWRedditVideo

>Fagshit
Delete this thread and kill yourself.

Sup Forums used to be anime free

...

I don't look toward the day I will become so lonely and deranged that I will start putting on women's clothing while craving a dick just so I can have any sort of a relationship since women just find me repugnant.

anime will literally never be fully embraced in the west and that's a good thing

I still love this meme.

Wrong.

Rate my fizzbuzz
(define fizz (λ (x) (= 0 (modulo x 3))))
(define buzz (λ (x) (= 0 (modulo x 5))))

(define fizzbuzz (λ (x) (and (fizz x) (buzz x))))

(define (fizzbuzzer x)
(cond
((fizzbuzz x) 'Fizzbuzz)
((fizz x) 'Fizz)
((buzz x) 'Buzz)
(else x)))

(define (do-fizzbuzz n) (map fizzbuzzer (range 1 n)))

Racket/10

do computers with the same first 3 numbers in an ip address necessarily have a similar physical location?

or are two hop nodes with the same first 3 numbers in an IP address necessarily owned by the same company?

I'm finding conflicting information.

who /templates/ here?

Isn't bash handy?
for i in {1..100}; do ((( i % 15 == 0 )) && echo "FizzBuzz" ) || ((( i % 5 == 0 )) && echo "Buzz" ) || ((( i % 3 == 0 )) && echo "Fizz" ) || echo $i; done

scheme or lisp?

template isFaggot(){
using true = false;
}
template(){
using true = Faggot;
}

is this the fizzbuzz thread?
local fizz = function(x) return x % 3 == 0 end
local buzz = function(x) return x % 5 == 0 end
local fizzbuzz = function(x) return fizz(x) and buzz(x) end

local fizzbuzzer = function(x)
if fizzbuzz(x) then
return 'FizzBuzz'
elseif fizz(x) then
return 'Fizz'
elseif buzz(x) then
return 'Buzz'
else
return x
end
end

local do_fizzbuzz = function(x)
local ret = {}
for i = 1, x do
table.insert(ret, fizzbuzzer(i))
end
return ret
end

print(unpack(do_fizzbuzz(100)))

which esoteric programming language is this?

but that's ugly... and it isn't n-line like mine.
Scheme, which is a lisp.

Lua, not esoretic at all

It's a 1 liner; not supposed to be pretty.
pastebin.com/bS5K0Rp8
>our system thinks your post is spam
Can you make it that simple?

Fizzbuzz using a circular list

(use-modules (srfi srfi-1))

(let ((f (const "Fizz"))
(b (const "Buzz"))
(fb (const "FizzBuzz"))
(n number->string))
(do ((i 1 (+ i 1))
(fl (circular-list n n f n b f n n f b n f n n fb) (cdr fl)))
((> i 100))
(display ((car fl) i))
(newline)))

interesting

why can't i fucking concentrate?

every time i try to sit down and get to work i get so easily distracted

am i defective, Sup Forums?

>Reddit formatting
Leave.

>knows the formatting of reddit posts
heh, you don't say

>Not denying it
Just go. You're not welcome here.

...

Nice filename, redditor.

Reddit-spacing is a well-documented phenomenon.
Your kind is not welcome here.

>reddit-spacing phenomenon also known as the thing that was a thing a few decades before reddit existed

really makes you think

shameless samefag

There is more than just the spacing that I've noticed.
You can also see the lack of capital letters and full stops.

youre trying too hard to fit in.
lmao cringing at your posts.
(im posting from the front page btw so dont bother replying)

...

Jesus christ, all of these posts reek of reddit cancer.
Fuck off, all of you.

Is it supposed to be autistic to notice very poor writing style?
Learn to write, you fucking illiterate redditor.

>typical autistic temper tantrum

The redditors seem to be out in force at the moment.

I remember imageboards being the place for creeps.

>All these hipsters not using the superior language

[(i%5==0)*"Buzz" or (i%3==0)*"Fizz" or i for i in range(1,100)]

Congrats it doesn't even print, you outplayed yourself

It does in REPL. And if you want it to print just put it in a print function. It's not that difficult.

It doesnt even print fizzbuzz too rekt

It's a list comprehension in Python.

Yes, and it doesnt print nor does it even detect fizzbuzz, kek.

>python toddlers kek

Missed that requirement here you go

["".join([(i%3==0)*"Fizz", (i%5==0)*"Buzz"]) or i for i in range(1,101)]

...

Should I learn Racket or CL?

I'm a passer-by, I've noticed a familiar syntax and decided to try it after your post about the inability to be printed.

F#

So what happens in the screenshot if not being printed?

I used a Racket interpreter to try the code from SICP.

>Inability to be printed
Thats not what I said. Its not following the clear fizzbuzz instructions.

It creates the list, ends the program and wipes the list without anything being printed to the cl

Put it as an argument into a 'print' function to print a string representation of the list. We taught it's obvious.

Yes I know? But the interviewer doesnt care whether you produce the correct results or not if you cannot follow simple instructions.

You have to print the result.

Just finished this

I surmise it depends.

>clear fizzbuzz instructions.
The "clear fizzbuzz instructions" merely state that the result needs to be printed. Which clearly happens in and . Or are you saying you can't see the parts where numbers, Fizz, Buzz and FizzBuzz are being printed?

He means that it won't be printed if this will be evaluated as line in a script file. Now it's printed only in the interactive shell of an interpreter.

nice

Some coloring. Now what?

Try lighting and shading.

View frustrum culling and LOD.

Add cute anime girls.

I don't recall any task description of FizzBuzz detailing the way that the result is being printed. Otherwise it would be impossible to solve FizzBuzz on embedded devices since they don't have consoles.

ALL of these

it's been anime from the very beginning
it used to be more anime before came along

Ok faggots, how do I go about doing this?

Im bored as fuck and feel like writing a fizzbuzz in x64, only problem is im on windows and using visual studio to write C code.

Can visual studio act as an assembler for x64? it should right? But I don't see an option to write anything in asm

>I want to write x86 but I don't know how to do anything inside (let alone outside) of Visual Studio
>help me you fags

click the X in the top right corner

>That spacing
>Winfag
>VS
I think is more your speed.

xd epic post guys.

why are you using local outside of functions?
>local fizzbuzzer = function(x)
why not local function fizzbuzzer(x) (or just function fizzbuzzer(x))

>only problem is im on windows and using visual studio
Get rid of the problem

Kek, common I can't buy my thinkpad till shits on sale, halpz pl0x

maybe the language is like lua

what? the language is lua

>Kek halpz pl0x
Are you fucking 12?
Get the fuck out of here.

oh, then that means that it dumps any functions into a global space and they are actually extremely slow to call versus local functions, specifying local like that is how you make them local

xP B>smex 2k c/o 1.5k

>that means that it dumps any functions into a global space, specifying local like that is how you make them local
i know that
>they are actually extremely slow to call versus local functions
hmmmmmmmmmmmmmmmmmmmmmm

Can someone help me understand the arguments for functions and the arguments for for loops in Python? Like this
def mysum(xs):
""" Sum all the numbers in the list xs, and return the total. """
running_total = 0
for x in xs:
running_total = running_total + x
return running_total

I could write for s in xs, for xs in xs, and for a in xs and as long as I change the variable x to match it then it will run fine. I don't understand why I can put pretty much anything for a for loop and not encounter a problem.

What's the difference between coloring "normally" and using shaders?

Define "normally".

Normally you use shaders

python probably keeps a reference to xs, so you can use xs for the iteration name.
why are you confused that you can use any name for the iteration name though?

> C onces again proves it only causes problems
Why are C fags so afraid of security

because python knows that xs is iterable (array) and you are defining a 'name' for every content in that array.
for ITEM in COLLECTION:
rt = rt + ITEM

>A program that was written in C had a bug
>Therefore it's C's fault
Good one.

Why would I not mark the functions as local if they are only relevant to the current scope? No reason to pollute the global namespace.

>why not ...
A matter of preference.

Some shitty malware database for storing stuffs

Graph databases make me cry

So that x is an item and an item is nothing more than a variable?

>In 3 years there's been at least 3 exploits of potentially catastrophic scale caused by errors introduced by the non typesafe nature of C/.
>Somehow C fags think 1% performance increases are worth these consistent, and in large code bases impossible to avoid failures

I don't know what is your purpose. If you're learning OpenGL or something similar, it's useful to learn graphic pipelines, lightning, shaders and so on. If you're trying to make just a fancy picture, may be there's no a significant difference in tools you use.

well desu Im coming from c++/c#/java so I dont exactly know much about python.

There are items(actually datatypes as in int, char etc) and there are variables.
You assign an item(data) to a variable and call it by that variable(which has a name, x in your example)

normally = load much data
shader = load some data and calculate
?

Written a terminal in as3 :^)
ActionShit is greatest language.
Flash is most secure platform

memory safe*

>What are you working on, Sup Forums?
Attempting to write my own userspace NVMe driver.

It assigns an item to the variable in every iteration over the array. This summation actually can be done in one line
reduce(lambda x, y: x+y, xs)

its a helluva lot more than 1%, dumbfuck
you seriously think people would use C for a 1% perf increase?
comlare similar programs for your shitty meme language of choice and C and see the difference
then try it for something non-trivial
C wins by a reasonable margin

Not the guy you're responding to, but you don't write in C to get correct code. You write in C when you need to deal with low-level stuff, like I'm doing now ()