/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: ocaml4.jpg (220x220, 9K)

Other urls found in this thread:

shenlanguage.org/osmanual.htm#4. The Core Language
github.com/randy3k/radian
wordpress.org/plugins/greentext/
qemu.org/
craftinginterpreters.com/
github.com/awesomekling/serenity
dlang.org/blog/2018/12/04/interview-liran-zvibel-of-wekaio/
github.com/uTensor/uTensor
tour.dlang.org/
ddili.org/ders/d.en/index.html
dlang.org/spec/betterc.html
dub.pm/getting_started
twitter.com/SFWRedditImages

nth for Nim!

c for cecurity

Attached: cecurity.jpg (1920x1080, 855K)

I just want a language to fall in love with and learn everything about and become very good at it for my whole life.

No such language for me, sadly.
R is close. Haskell is close. But I am forever the bride's maid and never the bride.

I can't decide if I should learn Lisp or Forth or neither

Lisp will do it for you.

Install Shen
shenlanguage.org/osmanual.htm#4. The Core Language

Just let me learn something normal

are you sure? which one?

R is love, R is life.

Currently the shitposting color parameter is log(posts per IP) * log(number of posts), but I don't feel like this perfectly accounts for the size/age/samefag combo that really makes a shitpost thread. This formula is more effective for wsg and asp (I originally made it for wsg). On some boards where too many people make threads you can see a cool delineation between the pointless threads that die quickly vs popular threads.

Attached: WeMadeTheTop5.png (1516x851, 104K)

Just flip a coin. Although Scheme is more functional.
I recommend Guile or Racket.
Why do you like R user?

Source?

desu I'm kind of embarrassed to post it. I want to get it perfect first. Once I implement an effective thread selector, clean up the way I parse OP numbers, and correct the thread age calculator (the issue has no real effect unles you're measuring something as fast as /b/), I might post it.

For webscraping I used rvest in combo with selectorgadget.com
For the interactive/autolabeled plot I used plotly

It's just Lisp with Dep types and Seq Calculus?

Very nice
I do love R. CRAN is wonderful, all the math/stats/dataviz stuff at hand makes it nice for prototyping, rstudio is great but I've recently moved to rtichoke github.com/randy3k/radian
The fact that it's functional works with how I tend to work on problems.

>scheme or guile or racket
>flip a coin

Oh also if you do try Radian (used to be rtichoke I didn't notice it changed) make sure to check that History section in the readme, if I remember the default is to leave annoying history files in your pwd

This wasn't already a wordpress plugin for some reason
wordpress.org/plugins/greentext/

Getting it on wp was a faster process than expected, I'll probably pump out a bunch of plugins and see if something sticks

guile and racket are scheme
just use guile

Seems pretty based
((/. X (make-string "((/. X (make-string ~S X X)) ~S)" X X)) "((/. X (make-string ~S X X)) ~S)")

It's pretty neat.
I don't play with it a whole lot because I like Idris more. But it's a gem of a language.

Oh I see, ok I'll check it out, thanks.

Make your own language user

I wouldn't know where to begin!
And besides, what would I write it in?

After you’ve been programming for some time with one or two languages, try and learn about as many language designs/paradigms that you can. Then you can make a pet language of your own. You would write a functional subset in whatever you’re most comfortable with, then the rest can be in your own language.

BYTES EQU 5
RAM EQU 0
ROM EQU $C000
ORG RAM
op1 RMB BYTES
op2 RMB BYTES
res RMB BYTES+1
ORG ROM
CLR res
CLC
LDAB #BYTES
LDX #(op1+BYTES-1)
loop LDAA 0,X
ADCA BYTES,X
STAA (BYTES*2)+1,X
DEX
DECB
BNE loop
BCC bye
INC res
bye BRA bye
learning assembler
pretty fun

that seems a bit "draw the rest of the owl"
I very briefly looked into compilers, anyhow at least a very general overview of the process
I would really need some kind of resource on general notions involved in writing a language
It does sound fun and could be something I could get into, but since I don't know where to begin it will never happen

Haskell is pretty good for making languages (Elm, Idris, luna-lang)

I wouldn't want to task any user with getting started with haskell as well as mine.
I hope someday idris divorces from haskell

>I hope someday idris divorces from haskell
already happened for Idris 2.

what do you even mean? you don't need to know Haskell to use Elm (though it's easier if you do)

Good news!
Oh, I think I'm fundamentally mistaken. I thought writing a language in Haskell would mean the user must first set up Haskell, then set up your language.

I guess by that I mean the compilers and any libraries and linking information or whatever else.
But, for instance, a wizard snaps his fingers and all traces of Haskell are gone tomorrow from every computer. I could still get started with Elm?

What are some good little projects for a complete beginner who wants to practice [spoiler]JavaScript[/spoiler]

...

A little history of guile from the original creator + some drama, in case anyone likes this sort of thing. It's sometimes a guilty pleasure of mine. I remember reading about some schism between two codecs, libav and ffmpeg maybe?

Attached: 1550389097.png (1582x1079, 440K)

But I want to make desktop apps after wrapping the HTML/css/JavaScript files in an excecutable

Don't

You're going to eventually settle on electron like every other webshitter.
So again.

avconv and ffmpeg, avconv was forked from ffmpeg by somebody very mad. it fucked up every debian user for a while

Guys, it's really interesting for me. This code
#include
int main()
{
std::cout

Why is electron seen as a bad thing, it's easy to make desktop applications without too much work.

Because it adds insane input latency and eats your RAM.

why not try yourself!
qemu.org/

electron is bloat. use webview

If you look at the elm docs, there's basically no mentions of any setup for haskell: you just install elm and you're done.
If you want to be pedantic about it, since the elm compiler is a haskell program, it embeds a small haskell runtime in the executable in order for it to work. However, this is opaque to the user.

1. Build an interpreter. Do whatever it takes to get a parser to output an AST, and then write an AST walker. Keep the grammar as simple as possible to make sure you can actually do all this in a short period of time.
2. Modify your interpreter to flatten the AST into an array of self-contained opcodes, which allows you to implement things like a goto statement in C, or tail call elimination in Lisp.
3. Observe that "an array of self-contained opcodes" is exactly what an executable file is, and come up with a plan to translate your custom instructions into native instructions.

What regular desktop desktop program needs lower input latency ? Most things have a web version anyway.
Also ram shouldn't be an issue these days anyway.

I'll have a look at webview, the goal is to make simple desktop applications with just html/css/JavaScript.

I see, yes I looked around. I saw elm.cabal in the code and realized how you explain it with embedding a haskell runtime (?) must be how it's done.
Then also it's important to know haskell's license (or whichever language you spring off from)

Okay cool, I vaguely remember reading a little about ASTs. I'll read this more carefully in the morning to understand what you wrote better than I can now, but what's some recommended resources for these topics?

>What regular desktop desktop program needs lower input latency ?
Most don't imo. But something like vscode is unusable for me, since the lag way too distracting.

not that guy, but follow this tutorial
craftinginterpreters.com/

I am that guy and I was gonna post the same link.

Great, thanks

Cniles do you really have to make a for loop everytime you want to do a thing to an array
Why not just do this
mapM_ putStrLn ["C", "IS", "DEPRECATED"]

This looks great, thanks, user

that reminds me of another reason I love R, the vectorized operations. That's probably on the brainlet side of cool CS shit but I love it

is R typed?

it is on the brainlet side of CS, but i personally think it's patritician as far as programming itself goes

dynamic, unfortunately.

death to those who do not embrace the lambda

Attached: 1548177308276.jpg (1280x720, 356K)

damn imagine if we did get a more LISP-like UNIX

RMS wanted the windowing system to be written in lisp afaik

dynamic as in vectors can hold any object type ever?
then you probably won't like lisp, because it's language design requires it's variables to not be typed (so we can store any object type ever)
although Racket scheme has a typed version.

language rankings:
1) Elixir
2) everything else

elixir is best of the worst, if you're forced to use a dynamic shitlang.
But it makes me miss static types and UFCS.

I moved my OS's window server from kernelspace to userspace. It was a pretty big effort, and now it works :)

Attached: Screenshot at 2019-02-17 09-30-29.png (1920x1080, 666K)

do you have repo for this?

>dyanmic shitlang
try again sweetie

Lisp is dynamic

pretty nice, keep it up!

Yep, didn't forget about it.

Why is it bad,m? What are your favorite langs

It's just not enjoyable to program in. And extensive programs tend to be awful to refactor due to paren hell.
D & Idris.

>D

It's a great lang, ignore /dpt/'s shitposting.

really stupid question but does anyone know why this segfaults? i'm trying to use AVX intrinsics to speed up a raytracer
struct alignas(32) Vec
{
double x, y, z, w;

operator __m256d() const
{
static_assert(sizeof(Vec) == sizeof(__m256d), "Sizes not same");
return *(__m256d*)this;
};
};

you're a brainlet who falls for memes. go to lisp general on lainchan. learn real language

Sure, it's here:
github.com/awesomekling/serenity

Thanks user :)

D is pajeet shit

Why?
Lisp doesn't offer me anything over D or Idris.
And if I want AST wank I'll use Nim.

>D is pajeet shit
How?

lisp is fantastic. you can do anything in it. learn one lisp and you can go anywhere. scheme, common lisp, need jvm? use clojure. need shell? scsh. need text editor/OS? emacs. its good I dont understand why you'd not use it unless you're too dumb for it.

Have you Forthed? Also why Nim?

>you can do anything in it
Yeah, you lisp zealots always love saying this. But never want to give any practical application because there really isn't one besides making more Lisp flavors.
>You can turn Lisp into anything you want!
Why? D already has everything I want, so I don't need to waste time tinkering my own flavor in it.
No, And because it has Lisp AST wank with static types.

D is just a joke. Will never replace C. Not a real systems language and we have better languages. You can't even argue employability

>D is just a joke. Will never replace C
This feels like what someone would say if they can't come up with any legitimate argument. Which is what most of the anti-d posts in /dpt/ tend to be.
>Not a real systems language and we have better languages.
Why? You can write a kernel in it, so how isn't it a system's lang?
There's "the world's fastest file-system" written it. so how isn't it a system's lang?
dlang.org/blog/2018/12/04/interview-liran-zvibel-of-wekaio/
>You can't even argue employability
Well there's several companies already using it, but you're half-right, it still has a lot of time before mass-adoption.
Honestly don't know why D makes you people so irrationally angry when its brought up.

Idiots will find any pedantic reason to go apeshit here.

I'd rather use Go or Rust

Why's that?

Should I learn D?

What do you want to do?

How do I make python to infinitely loop through all the entries in a file?

I have a proxy list and I want it to go one by one until the end and then start from the beginning again.

Attached: 4hwk6zgfd7fy.jpg (3818x2636, 3.58M)

>What are you working on, Jow Forums?
looking at the uTensor library, thinking how to port it to bare-metal rust
github.com/uTensor/uTensor

Fellow R bro, Lisp is good shit. You'll like it. R is basically infix Lisp, especially the quote/eval, how you can directly access and mutate the environment, the metaprogramming, etc. R has basically the same semantics (actually respecting lexical scope, unlike Pyshit). Also S4 is basically a very simplified version of CLOS, the Common Lisp Object System.

I don't even understand the question.

You start at the first entry.
Go through each entry
If at last entry, go back to first entry
Repeat

????????????????????????????????????????????????????????????????????????????????????????????????????

Program well

Start here: tour.dlang.org/
If you like what you see, give ddili.org/ders/d.en/index.html a look
There's also dlang.org/spec/betterc.html If you want a more "C with some modern features" approach.
And you'll want to get familiar with the package manager
dub.pm/getting_started

I have a proxy list with, let's say, 200 entries. I need python to use each of them once and move to the next until the end of file is reached.
Then I need it to start from the beginning again.

Usually, I would use 'for' loops, but that wouldn't work in this case.

Encase the for loop in a while True loop

Why would a for loop not work?

for (1..some number):
loop through all data()

forever $ readFile "foo.txt" >>= print

I'll try, thank you.
Wouldn't it stop after reaching the end?
I'll check this out, thanks.

What are the biggest reasons Haskell is slow?

Is it purity, or is it laziness?