Daily Programming Thread

"Work on Learning" Edition

Previous: What are you working on, Jow Forums?

Attached: 1528528955423.jpg (417x373, 18K)

Other urls found in this thread:

en.wikipedia.org/wiki/Cool_(programming_language)
github.com/search?utf8=&q=swastika&type=Repositories
github.com/JadeMatrix/Cpp-Learning-Materials/blob/master/C++ Learning Materials.md
repo.or.cz/
twitter.com/NSFWRedditGif

1st for turing

2nd for making porn games in haskell

rooooollll

idea: what if arrays were indexed with [arr, index] instead of arr[index]

what if you kys?

how would you distinguish that from making new arrays in languages such as python?

what if functions were called with (f x y) instead of f(x, y)

braces

what if functions were called with f x y instead of (f x y)

Friendly reminder that this is valid array syntax.

for (int index = 0; index < length; ++index)
{
index[array] = index * 2;
}

only in a shitlang like C

taking the Stanford's Compilers course
The assignments are pretty hell, it's split into 4 independent modules and each assignment is about implementing one. The most complexity comes from making it work according to complete specs in contrast to do work on all 4 phases iteratively from incomplete toy scenarios to full language. On the other hand I'm doing 2 weeks every day so I guess I'm not supposed to do them in single afternoon.
The whole assignments are supposed to be done/tested in some ancient Ubuntu VM, not pleasant at all. But probably not planning to get any cert from it anyway.
en.wikipedia.org/wiki/Cool_(programming_language)
the language is cross between OOP and OCaml syntax. Classes and inheritance, lexical scoping and static typing. Pretty reasonable. It generates MIPS instruction set and SPIM emulator, which I'm not heading forward at all, thinking about generating against NASM assembler or my own toy-ish x64 assembler and ELF binary linker.

Is there a way to replace a conditional branch with constant time operations if the only difference is a variable being used in pos/neg/pos/neg order vs pos/pos/neg/neg?

that would be called "Objective-C"

what percentage of programmers develop tools for other programmers? waiting for it to hit 100% so we can end this profession

no, that would be called lisp

What? Can you give an example of a branch?

What if it was x f: y.?

I'm not sure what you're saying, post code

>github.com/search?utf8=&q=swastika&type=Repositories

Attached: 1528476436337.jpg (413x395, 19K)

if (thing)
DoFunc(x)
DoFunc(-x)
...(x)
...(-x)
else
...(x)
...(x)
...(-x)
...(-x)

>Swastika-IO
>.NET/ASP.NET
It's definitely Hitler.

multiply by an array of 1 and -1?

or f x y?

im using land of lisp to learn programming

wish me luck boys

Attached: lisplogo_256.png (256x223, 37K)

y = (thing & 1)
x = (y * -2) + x

I think thisll work

good luck, user

Attached: 1528401610745.jpg (374x374, 35K)

Have fun, the little games you make are good and the book's humor is pretty gud

Yeah I'm not very far in and the humour is actually quality stuff so far, great comics too

>C
>shitlang
>that's why without it my comp would crash

Attached: kejrjs.png (242x250, 90K)

Lots of necessary programs are written in shitlangs. The internet runs on Javascript.

Ironically, most of the crashes your computer suffers are BECAUSE of C.

it's not like it doesn't crash at all with C

TCO is when I only return the result, even if I change the arguments along the way, right?
That probably sounds really stupid (I kinda believe that it is stupid to believe otherwise) but I have a serious doubt right now that prevents me from going on with my life...

Will this get TCO'd?
iter cnt [] = cnt
iter cnt (x:xs) = iter (cnt+1) xs

Attached: 1506464266066.png (1280x720, 861K)

*(arr + index)

That can be TCO'd.
It's things which happen after the "return" which mess with TCO.
So the "bad" version of that function would be
iter [] = 0
iter (x:xs) = add 1 (iter xs)

>TCO is when I only return the result
TCO is tail call optimization.

A tail recursion is a function whose tail calls are recursive invocations of itself, so that would get TCO'd

looking to practice my bash and unix tool scripting skillz

please suggest something for me to write, I have run out of ideas.

>can you share it? was looking for quite that
uh I pretty much just started it, so far it's got the stuff I could pull off the top of my head
let me make a repo for it — github.com/JadeMatrix/Cpp-Learning-Materials/blob/master/C++ Learning Materials.md

What if it was
fun x, y

With a tab separating function and arguments, and subexpressions simply done on newlines as such:
mod
2147483648
add 12345
mul 1103515245, i

the add has no comma after, which means arg2 is the result of mul

yes I remember now. Thanks!
And thanks for the vocab lesson !

{do {{i 1 {+ i 1}}}
{{> i 100}}
{display
{cond {{= 0 {modulo i 15}} FizzBuzz}
{{= 0 {modulo i 3}} Fizz}
{{= 0 {modulo i 5}} Buzz}
{else i}}}
{newline}}

This is now a curlybraces thread !

Attached: 1522132080613.png (480x360, 136K)

%>

get on my level kiddo

Is this an actualt programming language? You could do something similar in my Lisp because the reader considers (, [ and { to be the same. They still have to match though.

I coded all last week at my coding JOB

Now im gonna use this weekend to crush some puss because im not a nerd

Attached: 1526850733275.jpg (749x746, 71K)

I LOVE JS

Attached: 1526428990857.jpg (1313x575, 160K)

Attached: 1526430179232.jpg (1308x1136, 366K)

mod
2147483648,
add 12345,
mul 1103515245, i

Could have cool syntaxes for indirect/immediate, unlike C's *(*)*&(*int)()()(int) clusterfuck.

For better or worse, JS is afraid of throwing exceptions, because exceptions don't make much sense in web front-end. You can't just have a website not render, normies would think their internet access is malfunctioning.

Attached: 1526430602495.jpg (1297x661, 200K)

Ironically, they borrowed that idea from Java.

What's bad about this? Except null being an object which you already covered.

this gets an average of your processor temperature. rate

$ sensors | sed '/^Core/!d;s/^.*\:\s*+\([0-9][0-9]*\)\.0.*$/\1/g' | awk 'BEGIN{t=0;c=0;}{t++;c+=$1;}END{print (c/t)}'

Attached: 1526431691797.jpg (1302x627, 138K)

Attached: 1526431960465.jpg (1323x1015, 257K)

So many of these issues could have been solved by designing JavaScript with strong typying in mind.

You shouldn't need two ways to represent essentially the same thing.

isn't Java's just that if left side is String the right side gets casted to String? That's not as wild as JS.

>he's writing a compiler
lmao seriously get a girlfriend

What if you indexed with
array(index) instead?
Oh wait, some languages already do this and it looks as unreadable as your average lisp.

>So many of these issues could have been properly solved by designing JavaScript with static type checking in mind.
FTFY

except it's not.

I don't consider `typeof null` to be unfortunate because you'd be using typeof for reflection and you'd want a standard way of doing that. A variable that is `undefined` though signifies an error somewhere so that one makes sense.
But what do I know, I don't even use JS.

i used that for my multidimensional array class in C++. i used variadic templates so that you accessed subarrays like this a(x, y, z) rather than this a[x][y][z]. the array was flat under the hood and [] can only take a single argument so i'd
have had to use wrapper objects which would have been a pain in the ass.

and then we have PHP
$foo = "hello_$_GET[0]_world";
$foo();

>internet runs in Javascript
You sir, are an idiot.

I give some computer courses for kids (8-12 years) and I want to create a minecraft mod with them.
basically they come up with the ideas, create the models, textures, the map etc etc and maybe even do some light coding. I will write the rest.

I found some tool for literally everything but actually animating the models. Im not into minecraft, so does anyone know how to do that except hard coding it?

Attached: 1330914981139.png (392x293, 48K)

What problem?
Live or on phone?

>Most websites won't work without JS enabled
>Desktop applications use Electron now
>Servers run node.js
>JSON is the new XML
Javascript is inescapable user.

>tfw too intelligent

Attached: _.jpg (764x551, 263K)

>Most websites won't work without JS enabled
That is what it was built for.
>Desktop applications use Electron now
They are few and normalfag circlejerk tier social media
>Servers run node.js
Only if they want to torture themselves. The hype is dead and not many want to get constant issues with node and their pm
>JSON is the new XML
You're retarded

>>JSON is the new XML
>You're retarded
XML is retarded

YAML >>>> JSON

XML is shit

lets make a language with function syntax of:
arg1 arg2 -> func

so instead of
var = sqrt(abs(mult(3, 2)))

its written as
var = 3 2 -> mult -> abs -> sqrt

and call it a language for the ascended.

You can already do it in Haskell, albeit the other way around:
sqrt . abs . mult $ 3 2

Oops, it doesn't work like I expected. You can't have multiple argument on the right side. Still, pretty close:
sqrt . abs . (* 2) $ 3

haskell syntax is so pretty

>left-associative arrows
Disgusting

>let's be different for different's sake.
nah

It's the Embracing
it's a niche lisp

Mind sharing a link to wherever the project is hosted? Google gives me useless results.

#define { (
#define } )


here you go bro

WTF is self hosted in the gitlab pricing page?
Does that mean the repo's stored on my own machine?
Why the fuck should I pay gitlab to store source code on my own machine?

core is free though

what library do i want if i want to scan for specific key combinations being pressed in python, even if my program is not in focus?

Attached: 1393085040938.png (297x237, 96K)

Xlib/WinAPI/Cocoa.

some kernel rootkit

I can't recommend specifics but you're looking to hook global events.
So search for python keyboard hook/python global keyboard hook.

git is free though

i know, that's why i have a private gitlab repo.

Bitbucket also has free private repos but has much better uptime in my experience.

meh gitlab has been down twice for ~5 minutes in the year ive been using it.
Not enough to warrant re-setting up everything.

What's the difference between gitlab core, and git init

gitlab specific g̶i̶m̶m̶i̶c̶k̶s̶, features.

repo.or.cz/

haskell/ocaml

>every ML descendant
ftfy

most ML langs can do f x y