/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

en.wikibooks.org/wiki/Haskell
pastebin.com/ZMVbtjyr
youtube.com/watch?v=w-I6XTVZXww
github.com/xoreaxeaxeax/sandsifter
github.com/saeg/ba-dua
t.me/r8mymemebot
github.com/tomhrr/dale
github.com/carp-lang/Carp
github.com/tomhrr/dale/blob/master/doc/1-11-form-reference.md
dec64.com/
twitter.com/SFWRedditGifs

en.wikibooks.org/wiki/Haskell

Learn Haskell today!

Reposting because I want criticism for my sepples.
pastebin.com/ZMVbtjyr

explain

youtube.com/watch?v=w-I6XTVZXww

ramanujan was a madman

It's a misconception. There's some retarded characteristic of that series which is -1/12 but it is not the limit of that series.

Commonly called a sum of that sequence but it is not due to some clickbait british youtubers.

...

thoughts?

> sandsifter: find undocumented instructions and bugs on x86 CPU
> the x86 processor fuzzer

github.com/xoreaxeaxeax/sandsifter

Don't.

Haskell is literally the feminine penis of Sup Forums.

Free monads Ain’t free.
The AST of haskell gotta be litterd with the blood of Functors.
Simon PEYTON jewns aka “S. P. j” is not my contribter.
he is Go enthusiast and probbaly useful as well :DD.
LOO and poo not loo and OOP ok.
praise idris.

>MMXVII
>still using a x86 CPU
I shiggy diggy

this, haskell is LITERALLY (((useful))) and (((well supported))) with (((many functional libraries)))
if you want a REAL useless language with no support or libraries than use idris

>idris
i'll use idris when more than 100 people use it.

figured out my own problem (I think), I was just misunderstanding the syntax of `update-hmac`

this lets me do a rolling hmac with a key over a list of strings

(defun hmac-sig (key lst &key (encoding :utf-8))
(let* ((key (babel:string-to-octets key :encoding encoding))
(hmac (ironclad:make-hmac key 'ironclad:sha256)))
(dolist (x lst)
(let ((x (babel:string-to-octets x :encoding encoding)))
(ironclad:update-hmac hmac x)))
(ironclad:byte-array-to-hex-string (ironclad:hmac-digest hmac))))

or at least it seems to generate a valid hmac
* (hmac-sig "muhkey" '("this" "is" "my" "list"))

"14773136b937862e5609e800fdc1396ab813f741b9301b62c6809c717ff62a80"

thoughts?

>ba-dua is an intra-procedural data-flow testing tool for Java programs.
>Bitwise Algorithm - powered Definition-Use Association coverage

github.com/saeg/ba-dua

>What are you working on, Sup Forums?

Exploring the deepest, darkest corners of Racket. ( ̄ー ̄ )

Made a complete solution for advent of code day 15 that gives the solution for both parts in less than a second (racket vm warmup included).

the program generates a closure for each discs.

#lang racket

(define tonum (compose string->number (curryr string-trim ".")))

(define (make-proc i modulus)
(lambda (x) (= 0 (remainder (+ x i) modulus))))

(define dprocs (for/list ([line (port->lines)]
[i (in-naturals 1)])
(let ([sp (string-split line)])
(make-proc (+ i (tonum (list-ref sp 11)))
(tonum (list-ref sp 3))))))

(for/or ([i (in-naturals)]
#:when (for/and ([p dprocs]) (p i)))
i)

(define part2procs (cons (make-proc (add1 (length dprocs)) 11) dprocs))

(for/or ([i (in-naturals)]
#:when (for/and ([p part2procs]) (p i)))
i)


i could make it faster by reusing the solution of the first part as the starting index for the loop of the second part.

What esoteric programming language is that?

meng what is your reading comprehension level at? He says Racket twice and it even has racket in the header of the code

Racket, a programming language from the past for the programming techniques of the future.

>lang racket
first line

>return {(int)((f) * (float)(1

just finished a bot that works with conv neuralnet to classify good or bad memes
t.me/r8mymemebot

making a system to create a bunch of docker images in my CI

using python but only because it's a trivial program and it's easy af to install python on pretty much any OS

It's obvious for you esoterism aficionados, but as far as I'm concerned, "racket" could be a framework or whatever.

Thanks.

I've revised the template parameters a bit.
template
Is there any way I can enforce a constraint on the decimal_bits parameter to ensure it falls in the range CHAR_BIT * sizeof(T) >= decimal_bits >= 0?

maybe not immediately obvious (though thats arguable) but almost instantly inferred. effort ^_^

My templates are kinda rusty but what about something like this:
template
struct ValidSize
{
constexpr static bool value = CHAR_BIT * sizeof(T) / 2; // or whatever your constrait is
};

template
struct Fixed final
{
};

I was joking, user.
Don't use Idris

Is there any good superset of C?
Gnu C is decent but it limits you to gcc and the extensions are really ugly and usually start with prefix __.
There is unified parallel C and some others but they are basically just C with openMP.
Vala is kind of limited by gtk.
ec seems really nice but it's just C with classes.

Haskell with FFI

Superset of C, not GC ridden functional mastubatory factory.

>superset of C
>but not extra stuff

haskell compiler cannot compile C, dumb fuck.

it can link C code with Haskell code

>2017
>he still uses C

c is a horrible programming language that has now ignored + 60 years of PLT

github.com/tomhrr/dale

github.com/carp-lang/Carp

Almost any language can do that, dumb haskell faggot.

you mean compiler

>github.com/tomhrr/dale
You might have had point but thinking that
(@: c x)

Is acceptable syntax just makes you retard.

but I am a modern day luddite user
progress is evil

>wealthy enough to be reasonably considered culpable for what CPU you use
>still on Sup Forums
something doesn't add up here

this is a good post but c is bad
lisp is bad

>Don't use Idris
but Idris is good though :(

Do you really think all of Sup Forums is terribly poor?
Cool stuff. I have a x64 CPU though.

>60 years of PLT
It has produced nothing good, though.

why?
github.com/tomhrr/dale/blob/master/doc/1-11-form-reference.md

but nobody uses it except one guy from wales

it's statistics, not adding numbers

because @: is something so ugly that only Bjarne or functional retards could come up with.

>Do you really think all of Sup Forums is terribly poor?
no but I think being on Sup Forums is inherently a vice and if you're NOT terribly poor then you really have no excuse

I'll see if I can work something out, this is pretty confusing.

>PLT
Having read some of this stuff.
It's mainly not concerned with actual issues you face when writing software.

I agree, C was a bad idea. We should have stuck with B, types are stupid.

Wealthy people can have problems too. Not wealthy people should probably not waste their time on Sup Forums.

we should have stuck with CPL which was a much better PL than C

CPL > BCPL > B > C

We shouldn't use languages desu.

dumb haskell weenie

>github.com/carp-lang/Carp

This looked neat until I scrolled down to the s-expression garbage.

it's only ugly to you because your brain has been corrupted by the ugly C syntax.

Having * as the dereference operator is worst. n = *x * *y *++*z // ay lmao

This, ^ is a much better dereference operator

>n = *x * *y *++*z // ay lmao
That's not valid C, dumb fuck.

Isn't it?

>says he's in favor of PLT
>Presents languages which don't even elaborate on their ideas and reasons for being what they are on their github page despite having radical features like deterministic and automatic memory management.
Because to me that (carp) sounds like someone is just having you manage your memory implicitly. Stuff like automatic reference counting (practically GC) or other smart pointer constructs.

I'd be interested if it wasn't but to me it just looks like another terrible idea.

that a lot of people can't tell should really make you think

(*x) * (*y) * (++(*z))

dereference operators are a bad idea and so is passing by value
literally just pass and return everything by reference all the time
if you want to copy something then fucking explicitly copy it jesus

>* ++variable
>relying on undefined behavior
NOT PORTABLE
dumb fuck

kill yourself script kiddie

not undefined behavior
this would be undefined behavior:
(*z) * (*z) * (++(*z))

>undefined behavior
where in the standard did you read that?

Not that guy but why is pointer arithmetic and then a dereference UB?

>the standard
not portable

>not portable
not portable

>script kiddie
what the fuck are you on about
i'm not even talking about scripting languages
i'm talking about there should be a bare metal compiled language, on the level of c or at least c++ in terms of speed, in which everything is always passed and returned by reference

I think I figured out a decent solution.
private:
constexpr static bool isValid()
{
return (((CHAR_BIT * sizeof(T)) >= decimal_bits) && (decimal_bits >= 0));
}
typedef typename std::enable_if::type valid;

It's scoped within the class itself so nothing leaks out, I'm satisfied. I'll see if I can constrain T to an integral type too.

what if x or y = z?

int n = 3

int z = &n;
int x = &n;

int nn = *x * ++*z; // 3 * 4 or 4 * 4 ?

That would be UB. For very understandable reasons hopefully.

that...
that code...
there is so much wrong with that code i don't even know where to begin

what i assume you meant:
int n = 3;

int *z = &n;
int *x = &n;

int nn = *x * ++*z;


in this case yes, that would be undefined behavior

looks like a good use case for restrict actually

That's why C shall be avoided at any cost.

>be bad at c
>decide c is bad because of this
nice attitude

>people writing language in the most unreadable way think that somehow it proves the language is bad

i want a programming language that help me being a better programmer, not the inverse.

std::is_integral

Anyone know how to do software rendering using only integer math?

Yep, I heard of that before, pretty happy with how it turned out.
// Template parameter constraints
private:
constexpr static bool valid_decimal_bits()
{
return (((CHAR_BIT * sizeof(T)) >= decimal_bits) && (decimal_bits >= 0));
}
typedef typename std::enable_if< valid_decimal_bits()
&& std::is_integral::value>::type valid;

C isn't about helping you be a better programmer and it isn't about the inverse either.
C is about quick and dirty.
C is about assuming you know what you're doing and staying the fuck out of your way.
C is about holding maximizing efficiency so far above all other concerns that in comparison they cease to be concerns at all.
C doesn't give a fuck about what kind of experience you have with it as a programmer. This is something about it that you should understand going into it, and if you don't, you have no one to blame but yourself.

>&&::::>::;
The best language ever

>constexpr static typedef typename::value::type
that's the real problem here dummy

with this? dec64.com/

that's not specifically a problem with c++, that's just the fact that between ADTs, generics, and OOP, all three are always bad, and you are unconditionally better off with a less sophisticated type system, and frankly having types at all is more of a necessary evil than a feature

Err, preferably without any decimal encoding scheme.

chapel does it nicely, so sepples has no exceuse.

Just bought this, is it any good?

no it doesn't, i'll admit that its syntax is better but its concept is still far inferior to simply not having anything of the sort, which is how c handles the issue
one of the many reasons c is better than c++

just looking at that cover makes me feel sick

why is having a weak type system good?

>this is what CS majors believe

that book are fantastic meme
you are oblige to keep mem

>t. dumb js web designer shitter

because it's one step closer to having no type system, i.e. manipulating everything purely in terms of words, which is the platonic ideal to which we should aspire

>i want a programming language that help me being a better programmer, not the inverse.
try reading a book