/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: bear.png (568x504, 270K)

Other urls found in this thread:

pages.github.com/
dlang.org/changelog/2.084.0.html#array
crates.io/crates/dyon
youtube.com/watch?v=VGNwXq6vPoI
agner.org/optimize/microarchitecture.pdf
babeljs.io/en/repl.html
twitter.com/SFWRedditImages

anime is gay

nth for nim!

Trade off for hidamari sketch fags vs lain fags.

Attached: 15142219025851_0.jpg (1920x1080, 413K)

I have one javascript file that doesn't really on a backend of any form. What do you guys think is the easiest way to just share it? Is it still gcloud or similar?

Based and redpilled.

Cringe and sóypilled.

Notice me.

Attached: icon.png (552x552, 7K)

...

#include

typedef struct unit unit;
struct unit {
char *s;
unit *next;
};

#define cons(x, y) (unit[]) {{x, y}}

int main(void) {
unit *lst = cons("this",
cons("is",
cons("a",
cons("compile-time",
cons("linked",
cons("list", 0)))))), *l = lst;
do {
puts(l->s);
} while ((l = l->next));

return 0;
}

Does it make me slightly less shitty that I did it with Elm?

What have you done, Satan?

i can't, as i hate ruby syntax.
Choosing to pretty much be 1:1 was a mistake.

post the animated version and I might

Elm is welcome in my opinion. But what do you mean by "share"?

Attached: 68747470733a2f2f692e696d6775722e636f6d2f7048774c6e49702e676966.gif (600x337, 734K)

literally pointless since Nim exists

Exercise: program this 3D polygon in your language of choice (WebGL, SDL, etc)

I want to have it accessible on the web for anyone, I'm just not sure what the easiest (and cheapest) way is.
I could deployit to gcloud I suppose, but that would cost a few dollars a month. I'm just thinking it might be overkill and there is a super easy solution that I just don't know about.

While Nim has some webshit, it's not really geared towards it in the way Crystal is, with trying to convert ruby shitters. Nim's syntax is definitely better though.

if you know your data at compile time is there any need for a linked list in the first place

probably pages.github.com/ then.

and then animate it

Attached: 1545000850280.png (792x791, 795K)

i think this is easier to do in webGL

ah yes, this should do very well. Thank you my friend

Woody's roundup
Right here every day
Woody's roundup
Come on, it's time to play

There's Jessie, the yodelin' cowgirl
(Yo-de-la, you-de-la, yo-de-la)
Bullseye, he's Woody's horse
(He's a smart one)
Pete the old prospector
And Woody the man himself

Of course
It's time for Woody's roundup
He's the very best
He's the rootinest tootinest cowboy
In the wild wild west

Woody's roundup
Come on, gather 'round
Woody's roundup
Where nobody wears a frown

Bad guys go runnin'
Whenever he's in town
He's the rootinest, tootinest
Shootinest, hootinest cowboy around

>try learning haskell
>10 minutes later
>functions don't enclose parameters in parenthesis and parameters are separated with spaces
>absolutely_disgusting.jpg

should I even continue as I'm a python baby?

Thank you for your consideration.

Attached: 1544903316605.jpg (600x597, 66K)

You'll love it when you figure out why Haskell is that way. It'll just click.

fuckin hell I messed up those code tags

>>functions don't enclose parameters in parenthesis and parameters are separated with spaces

you can use parentheses if you want but they're unnecessary because every function accepts exactly one argument

(+) 1 2 is the same as ( (+) 1 )

(+) is a function that accepts one argument and returns a function
( (+) 1 ) is the return value of applying (+) to 1. it is a function that accepts one argument and returns a value (that number incremented by 1)

>python baby wants more visual noise
Why? Parens are fucking disgusting for anything but clarifying scope.

dlang.org/changelog/2.084.0.html#array

Even then you can usually do it more cleanly with $.

I wish walter would stop trying to interop with sepples. it's such a waste of time.

>Next year, D will add std::array
holy shit this is pathetic

Huh? That is std::array

what are you on about?

crates.io/crates/dyon

why use go when you can emulate it in rust?

>rust is so unbearable to write you have to use a scripting language to avoid suicide

>Just another day at the office working microcontrollers.
>Compiler seems to be struggling with a piece of code.
>Hm. Better give them a call
>beep beep bop
>*ring*
>*ring*
>*ring*
>*connecting...* *bzzzt*
>You have reached C customer service.
>Please hold...

youtube.com/watch?v=VGNwXq6vPoI

>beep beep ***crackle** **bzzzt**
>some private conference call is re-routed through by mistake

>......ryyyAAN WHAt THE FUCK DID YOU DO??
>LOOK AT THAT VOID POINTER
>RYAN!!!!! I WILL FUCKING MURDER YOU
>beep beep ***crackle**
>NO AHHHH
>*SMASH* *BREAK* *BAMBAMBAMBAM**
>CLICK CLICKITY CLICK IM GONNA VOID THAT DICK
>*BOOOM* *AAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHH
>*multiple gunshots*
>*blood splatter* *gurgling noises of dying man*
>...my...dick....my .... d..i..
>FUCK YOU RYAN
>*bzzzt*
>Hello. You have reached the C customer service call center.
>This is Lisa, how may I help you?

based and rumpfpilled

I have nothing against Ruby (hell, all I know about it is from other anons) but what makes Crystal special? It's pretty cool that one of their first pieces of sample code is a working HTTP server, but does it scale well beyond the trivial?

There's some really cool shit you can do with that syntax. It's called currying. You can make a function that returns functions that returns functions that returns... etc. Look up "rules engines" in haskell for a simple example of what can be done with it.

What did he mean by this

why use rust when your diet isn't exclusively semen and onions?

kek

why use rust when you can just jam a rusty nail in your eye and drink bleach?

Why is Jow Forums so biased against Rust?

>const mockingbird = fn => (...args) => fn(fn, ...args);

trying to understand decoupling recursive functions with a memoization decorator but I am a shitty brainlet

thanks but it seems too hard to install on Manjaro(arch based) for my newbie brain. might try another day.

Stay mad, sóyboy.

I would rather learn C++, and that's a shit language.

>not using the s that you cant tell the difference with instead
dude lmao learn utf8 please

Rust isn't a good language.

how to unroll that?
function mockingbird(fn) {
function(...args) {
return fn(fn, ...args)
}
}
???

>can't defend using rust
>laps up cum
>moving_the_goal_posts.jpg
LMAOing @ ur lyfe

why you hate ruby syntax?
I really like it, it's easy to understand and looks nice
I wish ruby was as popular as python

you should continue to build syntax tolerance

I don't know. I thought the mockingbird was the function part but you have looks right.

Here's the whole cluster fuck

const mockingbird = fn => (...args) => fn(fn, ...args);

mockingbird((myself, x, n) => {
if (n === 0) {
return 1;
} else if (n % 2 === 1) {
return x * myself(myself, x * x, Math.floor(n / 2));
} else {
return myself(myself, x * x, n / 2);
}
})(2, 8)
//=> 256

using babeljs the mockingbird function actually looks like this unrolled
var mockingbird = function mockingbird(fn) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

return fn.apply(undefined, [fn].concat(args));
};
};

for i in range(10**6):
if i >= 1000:
i %= 1000

$ time python3 t.py

real 0m0.152s
user 0m0.151s
sys 0m0.000s

for i in range(10**6):
i %= 1000

$ time python3 t2.py

real 0m0.135s
user 0m0.131s
sys 0m0.004s
>modulo is faster than a conditional check
Python is retarded, bloated shit.

when i use python urllib the downloaded page as string comes as

b"welcome to my webpage\n goodbye\n"


when I write to file it writes with those \n and in a single line.

how can i write in the same format the html page as?

like
welcome to my webpage
goodbye

Fact: JavaScript is the most powerful language in the world.

Attached: 1_C_7kNH0_rFeicKi9tObdZw.png (800x449, 32K)

Are you having a giggle?

>complaining about the speed of scripted languages

Attached: 0943 - vau6Xw1.png (326x326, 171K)

why the fuck would you do that?

>a conditional branch, a goddamn if statement, one of the elementary bases of programming logic, incurs more cost than goddamn bignum division
This literally doesn't make sense.

recompiling after every tiny change is killing me
wish there was a scripting language but statically typed with great intellisence, many libraries and other shit

Attached: 1534494066458.jpg (685x600, 118K)

We're not in /sqt/. Also nobody will visit your webpage ever.

A branch miss loses you hundreds of cycles on modern cpus. Your first 1000 iterations are all branch misses.

Seeing it unrolled makes it even more daunting.

I think when you pass a function to mockingbird it returns that function with whatever arguments you called on the function passed including the original function

i'm building a scrapper + logger
the string is just an example

Ast literaleval

Python runs in a VM, everything is a branch miss.

Wouldn't branch prediction pick up on the pattern very quickly?

>tfw too brainlet for fp
If I have this in Elixir. A list of tuples with a number and a float
[{-15, 1}, {7, 0.7}, {15, 0.85}
And I want a list of the second element of each tuple, like [1, 0.7, 0.85] how would I even do that?

F# has a REPL.
does that help?

Depends on the cpu. You can find more information about it here:
agner.org/optimize/microarchitecture.pdf

Since Python is interpreted it's probably more so the overhead of decoding and executing the extra instructions than the actual computation.

sorry for the double post but seeing it unrolled helped. If you're still here thank you user.

C# has it too

sure. i used this

babeljs.io/en/repl.html

>Not knowing C++
Let me guess, python? Lol

I've not used Elixir, but you want to map a function that selects the second element of each pair over the list.

I want webdevs to leave this thread now.

Attached: 1498616414733.jpg (880x1024, 86K)

In lower level languages, it does. Which why you put it in a conditional if dividing with a variable. But it doesn't apply for CPython, which runs in a VM. So no idea what that guy is talking about bringing this up.

>wish there was a scripting language but statically typed with great intellisence, many libraries and other shit
Literally F#

>babeljs.io/en/repl.html
Thanks again.

Modern syntax makes shit super clean but seeing it this way makes it 10x explicit

Enum.each [{-15, 1}, {7, 0.7}, {15, 0.85}], fn {_, y} -> IO.puts y end

Nice get, webdevs are cancer.

Thanks. Maybe I’ll get it someday

webdevs get paid more than you
lmfao

jebait me but there's some irony here

seething webdev detected

Not him, but Elixir is pretty dumb, and inherits a lot of dumb things from Erlang. So don't feel too bad.

cope

Case in point, only response is to resort to "lol i makes more moneys"

u mad?

You're the seething weddev.

Take your time my man

Attached: 1521750947337.png (1080x1080, 701K)

pseudocode
for each number in this list: [{-15, 1}, {7, 0.7}, {15, 0.85}]
let {x, y} be the each pair in the list
// x is the first number (e.g. -15)
// y is the second number (e.g. 1)

print the variable "y" from each pair // what you want

quads of truth

delicious NEET cope

>quads
>not checking quints from

Why are animeposter posts always low quality?