/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

bugs.launchpad.net/snapcraft/ bug/1723965
askubuntu.com/questions/965455/how-do-i-create-an-opengles2-and-glfw3-snap
youtube.com/watch?v=I25UeVXrEHQ
twitter.com/SFWRedditVideos

Sadly c# doesn't allow that kind of stuff.

stop using c#

Employed Haskell programmer here

Is it me or while programing does time seems to slip by more?

Can't do that.
No getting older does though.

Why? ASP?

Because one of the requirements of the project was that it needed to be in c#.

What fucking "project" is this?

Reading about the Curry-Howard isomoprhism. Trying to do the exercise in [pic related].
It's asking to provide a proof object for: (¬A∨B) ⇒ (A ⇒ B)
Which, as far as I understand, is equivalent to: ((A ⇒ ⊥)∨B) ⇒ (A ⇒ B)
So my best guess is: λu. cases u id (λb.λa. b)
But somehow this doesn't seem quite right. Fuck this abstract shit.

Is it a mistake to use unsigned types for values that cannot be signed?

no but you should handle the case where the input is negative

Java WebSockets

>delimited continuations
Continuations are powerful enough to implement delimited continuations.
(define jmp #f)
(define (reset x val) (if (car x) (begin (set-car! x #f) val) ((cdr x) val)))
(call/cc (lambda (ret) (* 2 (reset (cons #t ret) (+ 1 (call/cc (lambda (k) (set! jmp k) 5)))))))
(jmp 5)

You can use macros to make it a little prettier but I'll let you do that.

I have to create a program that displays sheet music. It's for a Design pattern course. I also need to be able to convert between multiple formats so for example lilyPond and Midi.

This is the fizzbuzz thread where you're supposed to write Fibonacci in LISP or Idris.
Programs bordering on being useful are not well received in these threads.

>No getting older does though
I don't want to get old...

This doesnt belong here but ill ask anyway, how can i quickly close a window or program that is not responding in ubuntu? in windows i would try the task manager and smashing alt+f4 repeatedly but im kinda lost here

you kidding? how about ones that... don't spawn OS threads? you could distribute a complex computation over the span of multiple frames in a real-time application like a game, on the main thread, with straightforward code

>You can't even implement your own coroutines in your blub language
Boost.Coroutine (now deprecated) did it with C++98, then Boost.Coroutine2 with C++11

>Continuations are powerful enough to implement delimited continuations.
All attempts to implement delimited continuations using undelimited continuations have horrible flaws in them, such as space leaks.

snap doesn't work
bugs.launchpad.net/snapcraft/ bug/1723965

flatpak doesn't even produce a flatpak

why is linux so fucked

shit thread though

>t. butthurt brainlet
Show us your "useful" programs, user.

こんにちは、Sup Forumsのみなさん

>Boost.Coroutine (now deprecated) did it with C++98, then Boost.Coroutine2 with C++11
I don't care enough to dig through sepples code and see what it does, but there's a 99.9% probability that it's a limited hack, given that C++ doesn't support continuations of any sort.

Because FOSS implies people can write bad code and get away with it as long as it's free. That's why company backed Linux distros like RHEL have a more cohesive environment. All in all, there should really just be more code discipline, incentive for code discipline and code quality and higher standards for code quality and system integration. And I mean amazingly high standarsss, or FOSS projects become just shit

Hello, SQL pro.
I'm super beginner and I can't make an atomic counter in PHP with SQLite. Please help. I wrote,
See pic. It caused communication error.

I expected that I could get value of (A) at (B), but I couldn't. Atomic counter itself works, but I can't get the value. How should I do?

Note: This is the same question as .

>That's why company backed Linux distros like RHEL have a more cohesive environment.
but snap is backed by Canonical

they will work
one day

Hey Sup Forums, why don't you make a language that's more like C than C
>all variables are static and mutable by default
>types are only defined by their size
>signed vs. unsigned vs. float math operators are syntactically distinct
>access to overflow flags
>continuations

use B

kill -9

Aaaaaand proper CNF achieved. All that's left is Robinson.

To CNF: ((~P('c2') | (P('c1') | Q('c0'))) & (~Q('c2') | (P('c1') | Q('c0'))))
To CNF: (~Q('c2') | (P('c1') | Q('c0')))
To Clause: (~Q('c2') | (P('c1') | Q('c0')))
To Clause: (P('c1') | Q('c0'))
To Clause: Q('c0')
To Clause: P('c1')
To Clause: ~Q('c2')
To CNF: (~P('c2') | (P('c1') | Q('c0')))
To Clause: (~P('c2') | (P('c1') | Q('c0')))
To Clause: (P('c1') | Q('c0'))
To Clause: Q('c0')
To Clause: P('c1')
To Clause: ~P('c2')
Result: [~P('c2'), P('c1'), Q('c0')] ; [~Q('c2'), P('c1'), Q('c0')]

#
#
Good old Terminus (Terminusmodx for the bold) and vim my guys

#
because I'm not a brainlet who needs my higher level structures written for me. If sepples was neccesary for the project I would have used it, but it wasn't, and usually isn't.

>more like C than C
I just want a C with decent metaprogramming.

Why use C when you can use Rust? If your code doesn't translate directly to Rust, then your code is inherently shit and unsafe, and you should have stuck to immutable trees. There's literally no viable argument against Rust.

Show me a case where storing the whole continuation instead of a delimited one is a significant negative impact.

If you're using a reasonable scheme, call/cc is almost free. The only thing it does is prevent live data in saved continuations from being garbage collected. Delimited continuations might reduce that, but only by a factor. If you're writing code in conditions where memory is that tight, maybe you should be writing C instead of lisp.

Not to mention in practice "undelimited" continuations are delimited by expression they're in.
(define jmp #f)
(call/cc (lambda (k) (set! jmp k) 4))
(jmp #f)

Find me a SINGLE scheme which when compiling this code turns it into something equivalent to this infinite loop:
(begin
(define jmp #f)
(call/cc (lambda (k) (set! k jmp) 4))
(jmp #f))

>There's literally no viable argument against Rust.
It's bloated

The reason is that I do dont now rust well enough yet to do something more large scale like that, as soon as I do I'll try it :^)

I would guess you should select the value again after update, since update does not return anything.

There's just too much wrong with your post for me to bother with it. This is clearly the first time you're hearing about delimited continuations, so I recommend that you do some reading. You can start from this:
okmij.org/ftp/continuations/against-callcc.html#memory-leak

C is bloated. Rust has exactly the minimal set of features necessary to write safe and correct code. It provides you with all the necessary ways to build various immutable tree structures (which is the only thing that's safe) and nothing else.

How can I achieve GNU/enlightenment?

dude memes lmao

anybody could help me with this?

askubuntu.com/questions/965455/how-do-i-create-an-opengles2-and-glfw3-snap

First step is to delete every single bit of proprietary software in your vicinity.
Stop associating with people who use proprietary software unless it is to convince them to use free software.

>t. C++ brainlet
You literally can't name one thing wrong with Rust.

No OOP

But then, it may not be unique if other threads are running.

If they are,
See pic.

then,

count = N at initial,
Thread A do (C)
Thread B do (C)
Thread A do (D) and get N + 2
Thread B do (D) and get N + 2

I use this for No. in posts like Sup Forums, so it must be unique.

>How can I achieve GNU/enlightenment?
You have to maintain bad hygiene and continually eat the fungi that grow underneath your dirty toenails to have enlightening psychedelic shroom experiences that will help you transcend the materialist-capitalist reality. Here's a demonstration by Stallman himself: youtube.com/watch?v=I25UeVXrEHQ

traits are a bit better

Then you should execute all those commands in one transaction.

>OOP
I know we're supposed to be a diverse community, but you just sound too much like a real Pajeet... can't you act more Westernized?

Terry, it's about time for you to reject Jesus and accept Stallman as your true lord.

Please do the needful

>I don't know how to respond I'm going to pretend I do and hope linking an article works

user that generator example to justify shift/reset doesn't even crash... At least on Chicken anyway. I guess the author was using a ghetto scheme.

No. It doesn't work. it returns NULL.

>he uses C instead of C++ for anything other than embedded systems

>let me demonstrate a complete lack of understanding of the basics of the subject
>now prove me wrong
I just don't care enough. Read the article.

>he uses C++ instead of C for anything other than gaymes

sepples
is it funny yet? sepplessepplessepplesepplesepples

Because nobody in the industry uses rust over c/c++

Rust is not ready for production

Thanks for proving my point

Clearly I did. This code, which the author claims would crash, did not crash.

; Demonstrating the memory leak caused by capturing the full -- longer than
; needed -- continuation
; The code is R5RS Scheme, tested on Scheme48 and Petite Chez Scheme

; The most straightforward implementation of generators
(define gen-ret #f)
(define (invoke thunk)
(call-with-current-continuation (lambda (k)
(set! gen-ret k)
(thunk)
'())))
(define (yield v)
(call-with-current-continuation (lambda (k)
(gen-ret (cons v (lambda () (k #f)))))))

; Two simple generators
(define (ones)
(yield 1)
(ones))

(define (from n)
(lambda ()
(yield n)
((from (+ n 1)))))

; Convert a generator to a lazy stream
(define (gen->stream gen)
(delay
(let ((v (invoke gen)))
(cond
((null? v) '())
(else (cons (car v) (gen->stream (cdr v))))))))

; Print first n elements of a stream, or all stream if n is #f
(define (print-stream n stream)
(if (and n (zero? n)) '()
(let ((v (force stream)))
(cond
((null? v) '())
(else
(display (car v)) (newline)
(print-stream (and n (- n 1)) (cdr v)))))))

; Should run in constant memory -- but it runs out of memory within seconds
(print-stream #f (gen->stream ones))

Wow. Holy fuck. shift/reset so useful! Oh wait, no crash, no memory leak.

Shift/reset only reduces the size of a continuation. A continuation still uses up space.

The brainlet "thought" process:
>we can't use asm because everyone in the industry writes in machine code; machine code is obviously superior
>we can't use B because everyone in the industry writes in asm; asm is obviously superior
>we can't use C because everyone in the industry writes in B; B is obviously superior
>we can't use Rust because everyone in the industry writes in C/C++; C/C++ is obviously superior

>"""the industry"""

>b-b-but it works on my machine
>t. brainlet
You clearly didn't understand the actual point.

>we can't use X because everyone in the industry writes in Common Lisp
when???

Literally no argument.

en.wikipedia.org/wiki/sepples

Except the first three never happened.

Literally no argument.

Never. Any overlap between what's being used in "the industry" and what has the most intrinsic merits is coincidental.

Hey Sup Forums, what is the advantage/disadvantage/difference between using:

>sed
>awk
>bash native regex

>(((the industry)))

>

Learning JAVA because University, is there another language I could learn in my free time? I already studied C.

No, that's it.

Learn something which isn't a curly brace language.

Keep lying to yourself.

>[*](&){return("the industry");};

Why?

What's something useful to know to get a job?

That sort of thing won't get you a job, it'll just make you a better programmer.
If you have Java and C you're sorted. Add Javascript if you're interested in webdev.

>thoughtworks

lmao it's a programming thread not a defrauding thread

All of them except Rust and arguably Haskell although there's that one guy in the thread that's an alleged employed Haskell programmer. Now that I think about it, though, he doesn't say "employed AS a Haskell programmer". :pondering:

>What's something useful to know to get a job?
spend time in thread and learn how to shoot the shit with other programmers.

>there's a 99.9% probability that it's a limited hack
if by "hack" you mean "working code", and by "limited" you mean "supports the same things as the Coroutines TS", then yes

>given that C++ doesn't support continuations of any sort
not at the language level, no. but Boost.Context implements them anyway

So? Unlimited continuations are just delimited ones where the mark is at the very top of the stack. Works both ways.

Delimited continuations are easier to understand, keep less state and let the implementation manage the stack better because they explicitly tell the implementation where to fork the stack.

>he doesn't use C++ for embedded systems

Why do you waste time on that half-wit

why use C when you can use C++ since C++ already has memory management and C does not.

How the fuck do I draw a filled circle with colour on an SDL_Surface in SDL2

C++ has no ABI. Try calling a method on a C++ object from Python.

D could get you that with betterC

dude just don't use member functions lmao

with math

>dude just don't use any C++ feature lmao

That's exactly what Linus meant when he said you'd have to restrict yourself to the C parts of C++ in order to retain your brain integrity.

python library for c is just garbage collection for python 3 why use 3? Also is to obfuscated.

??? What in the fuck are you even trying to say?