/dpt/ - Daily Programming Thread

Last thread: What are you working on, Jow Forums?

Attached: dpt4.jpg (600x600, 97K)

Other urls found in this thread:

channel9.msdn.com/Blogs/Charles/Emerging-Langs-Clojure-and-F
github.com/facebookarchive/warp
i.4cdn.org/wsg/1563239993385.webm
twitter.com/NSFWRedditGif

never post a non anime image as OP ever again

goats are anime

lisps are nice to work in

t. Shamiko

I don't know much but I get annoyed easily. I guess I'm a Dunning-Kruger sufferer. But I want the suffering to end. Why can't I just be gracefully ignorant until such time as I have become learned.

I wish I could use Lisp macros in a language that has an actual ecosystem.

the reference is lost on me

So what you're saying is, we need a Lisp with an effortless FFI?

trying to learn java. just got my head around some of the OOP ideas and did some applications. going to try my hand at interfaces tonight.

does the jvm qualify?

keep up the good work, user.

nah it's shit

thanks. i can't wait to try my hands at more complicated programs.

Yeah, it'd needs to be more than just a plain old shitty C FFI, that's a never ever though.
I'm not a fan of Java and its ecosystem. Clojure-Java FFI is also pretty ugly from what I've seen.

if you work hard enough, you will hopefully end up like the legends.

Attached: 1564791467778.png (2160x1080, 965K)

only if you're into smart cards since a buttload of that is JavaCard.

>tfw no sugarmommey to peg and feed you while you madly program your pet projects

Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character.

Example 1:
Input: S = "ab#c", T = "ad#c"
Output: true
Explanation: Both S and T become "ac".

Example 2:
Input: S = "ab##", T = "c#d#"
Output: true
Explanation: Both S and T become "".


p.s.

>1

is there a better way to do FFI?

Hai, Anone! I came over to learn JavaScript with you! I hope you won't mind?

Attached: 1b8af276e4d5914ad675bde66689b7df.jpg (853x1280, 107K)

it's okay but you better have brought food, you're eating me out of house and home

Realistically? Not really.
Theoretically? Absolutely. A good example is how D has pretty excellent interfacing with C++. You can essentially use them just like you'd in any C++ program, even if they include template fuckery.
If we had something like JSON but for functionality - a decent universal ABI - you could have pretty great FFI very easily. If something like lisp machines had won, interop between languages would be almost seamless.

what in your opinion qualifies as a good ecosystem?

yall anime people are weird haha! i dont watch anime but i can appreciate u guys!!! happy coding!!!!!

If Microsoft built F# based on OCaml, maybe you can convince them to borrow the ClojureCLR code to create... L#?

export default function (...args) {
const test = /.#/gsu;
const replace = /.#/suy;
return args.map(string => {
while (test.test(string)) {
replace.lastIndex = test.lastIndex -= 2;
string = string.replace(replace, "");
}
return string;
}).every((x, i, array) => {
if (i === 0) {
return true;
}
return x === array[i - 1];
});
}

based
why does cshart fshit still no hkits?

Will probably be in 8.0

*9.0.
So in like 2 years probably

why be disrespectful?

That would actually be pretty cool, but I don't think Microsoft would be all that interested. F# only happened because they have historically strong ties with the ML community and even then the language is pretty neglected.
I also think that MS isn't all that interested in dynamically typed languages.

oddly specifically far away

Is there a better way to do this?
I'm trying to choose a random level. I do that by picking a random integer, and if I've already picked that one before, then I just recursively call the function. The maximum number of levels in a region is 5.

Attached: code.png (849x163, 11K)

What? C# and the CLR get a new version every two years. It didn't make it into this years update, but they said they want to inlcude it in the next one i.e. about 2 years.

that's ages away tho

Attached: image0 (4).jpg (375x380, 73K)

A bit cleaner, but the same approach:
int randLevel;
do{
randLevel = getRandomLevel();
} while(Game::....);
.
A better approach would be to get the levels that haven't been finished and to then pick one out of the list.

say something nice about JavaScript

For 5 and a decent cpu? No. You should use list that is initialized, swaps the used element with the final, decrements how many you have, and goes until you have the last one. In theory, the list would never have to be re-initialized itself, as even disorganized, you're still choosing a random element. You would have to say you have 5 levels again.

When you get to the final level, there's a 20% chance you choose the unused level, so even if it took a ms per random choice, the odds of not choosing it are negligible after 20 ms. Still a bad style.

It's not PHP.

>export default

function foo(...args) {
const test = /.#/gsu,
replace = /.#/suy;
return args.map(string => {
while (test.test(string)) {
replace.lastIndex = test.lastIndex -= 2;
string = string.replace(replace, "");
}
return string;
}).every((x, i, array) => {
return (!i) ? true : x === array[i - 1];
});
}


do you program like that naturally or is this a generated piece of code? don't know if you're a pro or a noob

Programming languages tend to move pretty slowly. I also don't know of any other mainstream languages besides Scala and Haskell that have HKTs, so I think it's understandable that it hasn't been the highest priority.
ES >5 is actually good, it's mostly the old parts that are shit.
Oh, also fuck the people who use it, but that's not a fault of the language.

It runs in most web browsers

what magic is this

Attached: ee.png (1309x427, 40K)

>want to use compiled langauges
>always a pain in the ass when dealing with lesser common systems like ppc/aix etc
feels bad

Holy fuck text editors are tedious as fuck to kode. Why didn't anyone tell me there were so many rules?

Attached: reeeee.png (325x325, 67K)

HKTs aren't even remotely necessary for functional programming, maybe for typeclasses but you don't need them. Strictly speaking, you don't even need types at all. Higher-kinded types are definitely overused and one has to be careful with higher-order anything, since it complicates reasoning about programs. (First-order is simple if you can get away with it)

It's pretty obvious m8
Even notepad or nano has dozens of possible operations

__declspec(dllexport)

Yeah it's super tedious as fuck. Just all the ways you can select, copy, paste, type, insert, et cetera. Every time I write a feature, I end up needing to rewrite it because I forgot you can do X in text editors. It's why all my Vecs became VecDeques at this point.

Lisp is the most powerful programming language.

>HKTs aren't even remotely necessary for functional programming, maybe for typeclasses but you don't need them.
Monads, Functors and similar abstractions can't be expressed if you don't have HKTs. They're not needed, but you're gimped if you don't have them.
>Strictly speaking, you don't even need types at all.
Sure, but having no types at all makes your language more expressive, while having a simple type system makes it less expressive.

Ada too hehe

Smalltalk is the most powerful programming environment.

Now that Microsoft is also moving over to Rust, will it finally graduate from meme status?

Imagine if we got Smalltalk OOP instead of C++ Objects. What a missed opportunity for a world of concurrency.

I wish there was a regular and maintained version of smalltalk where i could just compile out regular programs. Instead of having to be stuck in VM nonsense.

no

Attached: 1564408188364.jpg (512x512, 37K)

>one employee makes a blog post on rust
>OMG MICROSOFT IS USING RUST OFFICIALLY
OMG WE DID IT REDDIT

I like that when haskell and other non-top 5 langs get used at FAA(M)NG, people just dismiss them as toy projects not proving anything.
But when Rust as so much is mentioned in a blog post about "yeah this lang's features could be useful", people lose their shit and start claiming official status.

kek I've seen at least 10 articles on diffirent sites about Microsoft using rust, didn't realise it's all due to a single blog post.

I heard MS now uses actix in the backend in one of their web apps. Actix seems to be picking up because of its speed.

Free as in paid shilling

It was just
>yeah we at MS could do with more memory safe langs, and Rust looks like a candidate to consider
And people extrapolate that Windows 11 is going to be all in Rust, and M$ are abandoning C# and writing everything in Rust.
The Rust community is F E A R L E S S L Y unparalleled in being so fucking obnoxious. It's truly amazing they've already surpassed C++ zealots in that regard.

>windows 11
Uh wut it will be 20 or some other tarded shit

It's called Windows cloud.

>google microsoft rust
>hundreds of articles from msft, slashdot, zdnet etc

that said if they are using rust internally it'd be closed source anyways

nope, Rust is so great that it made them F E A R L E S S about naming conventions.

windows 10 is the last version of windows - some fuck from microsoft, the windows sysinternals book, 7th edition, part 1

>M$ are abandoning C#
Good. C# is a pile of garbage. Breaks scoping.

I'm not a fan of Rust, but what Microsoft said at least indicates an interest in a replacement for C++ and that is actually huge news.
Facebook using Haskell for one project doesn't mean anything because it evidently didn't lead to anything else.

you never know
channel9.msdn.com/Blogs/Charles/Emerging-Langs-Clojure-and-F
6:25

they would probably make it statically typed though
>can't be done
they'd find a way

meme status is a meme

haskell doesn't compete with Rust, Rust actually care about speed as much as it can within its boundary.

>Facebook using Haskell for one project doesn't mean anything because it evidently didn't lead to anything else.
Wasn't just talking about haskell, but yes, obviously haskell is too slow to replace any huge systems. But it certainly could replace a fair bit of smaller utilities i'd imagine.
It's nothing but news unfortunately, the actual process is just going to add more shit on the pile. Instead of M$ doing the proper thing, and burning it all down for a fresh start.

I only wrote one Lisp program in my life and it was a college assignment. Is there a way to execute the following without calling eval?
'(+ 1 2)

There's other cases, like Facebook feeling the need to write their c/++ pre-processor in D.
github.com/facebookarchive/warp
as i said to the other user, plenty of less-popular langs are used in enterprise.

Doesn't everybody want a replacement for C++?
Even C++ programmers know there are parts of the language that could be better, even if they think it's the most practical language currently available.

are you asking how to evaluate something without the evaluator?

you mean like getting rid of the quote mark?

HKTs are nice though

whipped it up quick in n++

noone cares about standards older than ES6

from functools import reduce

def apply(s):
return reduce(lambda s, c: s + c if c != '#' else s[:-1], s, '')

def same(s, t):
return apply(s) == apply(t)

n++?

guido's aversion to functional programming always amused me

apply = lambda s: __import__('functools').reduce(lambda s, c: s + c if c != '#' else s[:-1], s, '')
same = lambda s, t: apply(s) == apply(t)

notepad ++

Do not micro-prettify my code.

i.4cdn.org/wsg/1563239993385.webm

Attached: images.png (259x194, 2K)

NOT CLICKING THAT SHIT, NIGGA

The biggest issue with Haskell is that it doesn't have a corporate backer. If Rust didn't have Mozilla they would have never gotten anywhere. That's also why shitlangs like Dart can survive. Doesn't help that the Haskell community largely isn't actually interested in writing practical software (which is why the Real World Haskell guy left the community).
And MS was never in a million years going to break compatibility. That's just not their style. Even industry wide, C++ will never vanish, it's just too entrenched. I mean, fuck, there are sitll a lot of Fortran libraries that have widespread use.
You can do something like
(apply (car '(+ 1 2)) (cdr '(+ 1 2)))

but apply expands to eval. eval is a central part of a program. There's no point in trying to avoid it because every evaluation uses it.
>Doesn't everybody want a replacement for C++?
That's exactly why one may consider it huge news. Everyone wants a replacement for C++, but actually finding one is the problem. Microsoft considering it as a potential candidate shows that Rust actually has a chance.

it's fine

drawing pixels on the screen in a old computer

God damn that is cool. Takes a bit long, but probably the most stylish computing I've sene.
Why doesn't something like that get used in movies?

>noone cares about standards older than ES6
I think he's asking about the modifiers.

>somebody in Jow Forums fearing a link
damn zoomers

Attached: 1556919234003.png (696x665, 742K)

Whats the most complicated programming algorithm in existence and what language is it implemented in?

Attached: 1564840387867.jpg (291x232, 30K)

Say you've got a neural network being trained on a synthetic dataset and that you can generate training samples on the fly as the network is being trained. Is there some way to loop the network into the sample generation process to optimize how quickly it learns?

Like say you're trying to make a network learn to predict what a 3DCG scene will look like after a small perturbation in the view angle/position. Could you somehow deduce what the next sample should be so that any misconceptions the network has are ironed out? Is there a way to "ask" the network what it would like to see next?

my bubble sort in C

vague

nigger