[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Search] [Home]
Board
Settings Home
/g/ - Technology


Thread archived.
You cannot reply anymore.



File: 1533440827829.png (514 KB, 810x698)
514 KB
514 KB PNG
What are you working on, /g/?

Last thread: >>70550602
>>
first for use C
>>
>>70556663
An AI-powered programming language
>>
third for turds
>>
File: k-kawaii.png (1.05 MB, 1280x727)
1.05 MB
1.05 MB PNG
I want to become an enterprise meme developer: C#, Java, or Kotlin?
>>
>>70556725
C#
>>
>>70556725
If you're serious, Java
>>
>>70556725
C#. Java's too old and Kotlin's too young.
>>
>>70556725
Nobody uses Kotlin
Java is gay, I'd only use it if you wanna transition into something not gay like scala later
>>
>>70556725
java is very widely used, it's good to know. i have no personal experience with c#, but have heard it's also reasonably popular in enterprise environments.

kotlin is a meme, almost nobody uses it outside startups
>>
How do I render a polygon in 3d space from an arbitrary position and angle?
>>
the task was to write a function that checks if two strings of length n are the same

int same(char* s1, char* s2, int n) {
if(n==0) {
return (n==(s1[0]==s2[0]));
}
return n == ((s1[n]==s2[n]) + same(s1,s2,n-1));
}


is this good? I cant fail this class
>>
File: resigned to my fate.png (191 KB, 364x364)
191 KB
191 KB PNG
Thank you, I will start learning C#.
>>
>>70556765
With a transform matrix. Traditionally they separate them into three transforms: World, View, and Projection, but they get aggregated into a single transform.
>>
>>70556768
Well, anon...
>I cant fail this class
Never mind, you're on your own.
>>
>>70556768
you're thinking too hard.
>>
What is Ruby good for?
>>
>>70556780
Actually, it's not just tradition. Obviously, you have minimally a world matrix for each object, and a camera matrix. However, the camera matrix is split into a view matrix and a projection matrix, even though you're unlikely to mix and match them, because lighting is computed in view space.
>>
>>70556817

just use node.js
>>
>>70556768
That is an inappropriate use of recursion, especially because it's not tail-call.
You're being too "clever" for your own good.
>>
>>70556768
Don't use recursion just because you can. It's bad.
>>
>>70556817
Basically a better, actually readable perl.
>>
>>70556823
I don't intend to learn Ruby. I just wanted to know if there is anything in particulat that is easier in Ruby.
>>
>>70556780
>>70556822
Shit, didn't even think of that.
Thanks, all!
>>
>>70556822
World/Camera separation makes sense from a logical/conceptual level. I'm just saying that mathematically, all you're doing is pushing points through a single transform matrix. In fact I'm more doing this to imply that you can, should, and WILL add on more and more transform matrices on top of those, not so much to suggest that you should re-invent the pipeline wheel.
>>
>>70556768
>is this good?
nigga it doesnt even work
does your assignment require it to be done recursively? if so, here you go:
#include <stdio.h>

#define MIN(x,y) ((x) < (y) ? (x) : (y))

int same(char* s1, char* s2, int n) {
if (n == 0)
return s1[n] == s2[n];
else
return MIN(same(s1, s2, n-1), s1[n] == s2[n]);
return 0;
}

int main() {
char *a = "Test";
char *b = "Test";
printf("%d\n", same(a, b, 4));
return 0;
}
>>
>>70556780
I've always wondered, why do you need to do this?
Just subtract the camera position and call atan2 twice, then subtract the angles. Why is a matrix faster?
>>
File: Scared Satania.png (223 KB, 1000x1000)
223 KB
223 KB PNG
I just saw one of you faggots on stackoverflow. I feel violated.
>>
>>70556827
>>70556829
You're missing the bigger issue, that he compares n to everything. Just remove n== and you get a working program.
>>
>>70556860
Ok. Let's say that instead of shifting then rotating, you needed to shift, then rotate, then scale, then shift again, then rotate again, then shift and rotate again, then apply a projection using aperture / field-of-view logic. This is usually what you need in a 3D environment

Your way that's like 20 calculations per-vertex and it's hard to communicate an arbitrary list of these to the GPU who's doing all the work.
Using transforms, all you need to do is multiply a vector by a matrix.
>>
>>70556876
who was it? name & shame
was it that Anonymous dude?
>>
>>70556860
Because you can combine as many matrices as you want together ahead of time, and apply the transform efficiently later as a single operation. It doesn't matter how much shit you're doing; it's a single matrix multiplication.
>>
>>70556876
Post it
>>
>>70556877
Maybe he'd realize that if he didn't set up his program so counter-intuitively. Frankly, I didn't even try to understand the program because it's conceptually bad. Fix the conceptual bad before you fix the logic.
>>
>>70556860
Matrix isn't faster, it just represents all the possible transformations you want to do with the camera like perspective, rotation, scaling, skew, etc
>>
>>70556877


the function returns 1 if the both strings are identical else 0

where is the issue? it just works
>>
>>70556889
>>70556892
But if you're only doing basic rendering, it would be equally fast?
>>
>>70556918
yeah okay it works with the addition
still, don't write retarded code like that unless you're competing in the ioccc
>>
>>70556921
Basic rendering? What I described is a pretty basic scenario: you have an object which has its own position, scale, and orientation inside a world which has its own position, scale, and orientation, seen by a camera, which has its own position, scale, and orientation, projected to a screen which has a field of view and clipping bounds.

That's about as basic as it gets in 3D.

Even 2D gets pretty complicated pretty quick. You need an orthogonal projection on top of a pan box on top of each object's orientation.
>>
>>70556890
>>70556896
Guffa, and of course he's an Assembly loving ancient gamer boomer turbowizard.
>I have used a lot of different languages over the years, like 6502 machine code, 68000 assembler, x86 assembler, Atari Basic, GFA Basic, Compis Pascal, Turbo Pascal, C, VB 6, VB.NET, C#.
>>
>>70556768
Well, since everyone else is posting their solutions

int same(char *s1, char *s2) {
for (int n = 0;s1[n] || s2[n];) if (s1[n] != s2[n++]) return 0;
return 1;
}
>>
>>70556936
Being able to combine a transformation hierarchy into one isn't a unique property of a matrix. You can do it with just x,y,z coordinates if your objects only need a position. The reason matrices are used is because they can represent several transformations at once (position, scale, rotation, perspective transformation, etc)
>>
File: 1529061672434.jpg (123 KB, 509x499)
123 KB
123 KB JPG
>>70556968
i saw that, friendo
>>
>>70556959
Dial your sensor back a tad. I literally said that two posts down the chain and the post your replying is a direct response to a question of WHY you do it that way because requiring multiple transformations is a common scenario.
>>
>>70556987
i realized my mistake while it was posting, pls forgive ;_;
>>
>>70557002
:3
>>
int strcmp(char* s1, char* s2)
{
while (*s1++ == *s2++);
return *s1 > *s2 - *s1 < *s2;
}
>>
>>70556987
dumb but fast frogposter
>>
STRCMP (const char *p1, const char *p2)
{
const unsigned char *s1 = (const unsigned char *) p1;
const unsigned char *s2 = (const unsigned char *) p2;
unsigned char c1, c2;
do
{
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0')
return c1 - c2;
}
while (c1 == c2);
return c1 - c2;
}
>>
>>70556768
Give him this and you win all the things.
s(char*a,char*b){return*a?*a-*b?0:s(++a,++b):1;}
>>
>>70557036
>b longer than a
>returns 1
dummy
>>
>>70557053
The problem specified they're both length n, dipshit.
>>
>>70557069

why are you so rude
>>
>>70557069
>expecting consistency in C
dummy
>>
>>70556768
This is the code your teacher wants to see:
int stringCompare( char* s1, char* s2, int len) {
for( int i=0; i < len; ++i) {
if( s1[i] != s2[i])
return false;
}
return true;
}


Analyze its simplicity and clarity and strive for it. Cut out the "clever coder" cancer before it takes root. It has been the ruin of greater coder than you.
>>
I'm trying to do a sliding puzzle for a school project in assembly. Anybody know any good resources for MASM, specifically Mode 13h?
>>
File: 1555113059457.jpg (154 KB, 562x1000)
154 KB
154 KB JPG
Rate my Haskell fizzbuzz.
(unsafe! (mutate! *turing-complete* true))
(mutate! *codegen* :haskell)

(type fizz-buzz Π :nat (:prog (Π :unit :str)))
(defn fizz-buzz (n)
#_(compiler (optimize *fn-body* :nat-opt :pmatch-opt))
`(λ (_)
(match ((mod ~n 3) (mod ~n 5))
(0 0) "FizzBuzz"
(0 _) "Fizz"
(_ 0) "Buzz"
:otherwise (show ~n))))

(type main Π (:prog (Π :nat :str)) (:io :unit))
(defn main (prog)
(do-io!
;; Base case - the program is a nop.
(when (nop? prog) (cons- prog `(io! (println :unit)))
(let (new-prog :infer-type)
;; Check if the compiler halts.
(if (halts? (compile prog))
(main (read (eval (compile `(map prog @[0..100])))))
;; If compilation doesn't halt, we optimize the code so that it halts on the next recursive call.
#_(compiler (optimize *if-else-branch* :recur-till-halt)))
(main (optimize prog :force-halt)))
(eval new-prog)))

(type prog Π :nat (:prog (Π :nat :str)))
(defn prog (n) (compile `(λ (_) (map (show ○ eval) (map fizz-buzz @[0..~n])))))

(io! (main (prog 100))) ;; => usual fizz-buzz, but guaranteed to halt.
>>
>>70556817
Web dev MVPs (see: devise, activeadmin, cancancan), rails in general
DB heavy applications
CLI programs, if the user has ruby installed (very likely, it comes with mac) you can get a lot of stuff done without anything 3rd party libs, but also there's things like nokogiri, mechanize, tty to get shit done that is non-trivial in other languages
>>
>>70557266
>get shit done that is non-trivial in other languages
What is non-trivial in any non-crippled language that is trivial in Ruby?
>>
>>70556768
>>70556857
>>70556947

#include <string.h>

int strnsame(char *a, char *b, int n) {
if(!a && !b && n == 0) return 1;
if(!a || !b) return 0;

int len_a = strlen(a), len_b = strlen(b);
if(len_a != n || len_b != n) return 0;
return !strcmp(a, b);
}
>>
>>70556768

Keep It Simple Stupid

int same(char  *s1, char *s2, int n)
{
while (n --> 0)
if (*s1++ != *s2++)
return n;
return n;
}
>>
>>70557292
Doing things with dates and times is incredibly easy and you write it in english like "2.days" or "Date.yesterday"
Running commands and capturing the outputs is literally just typing `ls`
I can't think many right now but if you try using ruby it's rare you need to go import libraries to handle things that in other languages need that.
>>
I feel so stuck with javascript. Everything where I work runs on Node.js, and when I'm practicing algorithms I default to javascript since it's so easy to get set up.

How do I get out of this loop?
>>
>>70557476
>How do I get out of this loop?
By using recursion.
>>
>>70557476
>sudo apt-get install gcc
>>
>>70557486
sorry grandpa, no one uses C++ or C anymore
>>
>>70557495
Speak for yourself, pahjeet
>>
File: anger.jpg (42 KB, 600x532)
42 KB
42 KB JPG
>>70557504
don't call me pajeet i hate pajeet
>>
>>70557476
Write in other languages in your spare time.
>>
>>70557495
I write in C almost exclusively in both my personal projects and my employment.
>>
>>70557518
oh, sorry ahmed
>>
why not just do

int same(char* s1, char* s2, int n) {
return !n || s1[n] == s2[n] && same(s1,s2,n-1);
}
>>
>>70557604
Not a tail call.
>>
>>70557518
what programming language does ahmed use? Pascal maybe?
>>
>>70557635
>her compiler doesn't convert every recursive call to a tail call
>>
Where can I start to learn programming? codecademy and freecodecamp?
>>
>>70557655
red wire, blue wire
>>
>>70557682
find out what you want to make first.
>>
I keep losing interest in programming because I feel like I'm not making any progress or learning anything new. Are there any good books or new things I should try to expand my understanding and try new things?
>>
>>70558010
https://raft.github.io/raft.pdf
>>
>>70557210
>Haskell
Are you sure?
>>
>>70557604
>why not just do
Cause I'm not a Ctard.
>>
In C++ this is just
bool is_same(std::string_view a, std::string_view b) {
return a == b;
}
>>
>>70556663
Trying to learn common lisp by doing assignments from an intro CS Course.

https://web.stanford.edu/class/cs106b/homework/2/ngrams-spec.html
How do I read in a file one word at a time?

I read about this function,
split-sequence
,but it doesn't seem exist in SBCL.
>>
>>70558437
based
>>
@70558490
do not ever post at me again
>>
>>70558496
ok
>>
Just made a simple snake game. It's a nice project to do in ~3 hours. https://madprops.github.io/Snek/
>>
>>70556663
protip: x264 encoding defaults to 25fps. ffmpeg will match the output fps to the input fps by default. If your input fps does not match the output fps you are going to have a bad time when trying to do rtmp.

rei@streamingserver:~$ cat code/run3.sh
#!/bin/bash
# Encodes camera stream with timestamp and sends to nginx for rtmp streaming

rm -f /tmp/latest.mp4

nc 192.168.11.222 9999 | \
ffmpeg \
-loglevel warning \
-probesize 10MB \
-r 30 \
-i - \
-vf drawtext="fontfile=Roboto-Bold.ttf: fontsize=12: box=1: boxcolor=black@0.34: boxborderw=5: fontcolor=white@0.75: x=10: y=10: text='Cam2 - %{localtime\:%D %T}'" \
-c:v libx264 -preset ultrafast -tune zerolatency \
-x264opts "qpmax=40:qpmin=20:min-keyint=25:keyint=250" \
-pix_fmt yuv420p -an \
-f flv -flvflags no_duration_filesize - \
| \
ffmpeg \
-loglevel info \
-f live_flv -i - \
-c copy -an \
-f flv rtmp://192.168.11.200:1935/dash/cam2 \
-c copy -an \
-f flv rtmp://192.168.11.200:1935/hls/cam2 \
-c copy -an \
'/tmp/latest.mp4'
>>
>>70558575
how is that programming
>>
File: 1506143372712.jpg (40 KB, 450x450)
40 KB
40 KB JPG
>>70558659
Ah, good point, it's scripting. You aren't programming either, anon.
>>
>>70558482
Okay. I'm really confused now.
I'm using this library, "cl-ppcre" to split a line into words, but am running into an issue.

Essentially, if I do
(ql:quickload "cl-ppcre")
on the REPL, then all of my code compiles fine.
However, when I try to compile the file by using
slime-compile-and-load-file
, I get this error:

I just want to be able to compile my file out of the box.
>>
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1221r0.html
C++ is getting a new feature called Parametric Expressions which are kind of like better macros that allow you to take parameters as values, unevaluated tokens, and even constrain them to be constexpr.
They are always inlined.
>>
>>70558678
its not even scripting it's command line arguments
>>
>>70558686
I should mention, that this is the file I'm compiling. Any and all help is appreciated:
https://pastebin.com/CxEzVRkW
>>
>>70558688
great, more C++ features, can't wait to not use them
>>
Give me a quick rundown on trading bots. My brother came to me with the idea and I though that it would be easily possible, the only thing slowing you down is how much money you have. All you have to do is set up the bot so that it buys when
x is lower than your initial and sells when x is y amount higher than
your initial. Most of the websites I'm
looking at have APIs that allow for buy/sell calls. Is making a trading bot as simple as it sounds or am I not getting something?
>>
>>70558702
most trading has been done by bots for decades
>>
File: 1487550014410.gif (1.36 MB, 470x313)
1.36 MB
1.36 MB GIF
>>70558692
>has she-bang
>is a bash script
Why are you so hostile. This is all a part of a DVR and home security system I am working on. What is a better thread to share in the progress on my programming project?
>>
I was able to QR encode some data and print it out... But how do I read the QR code?
>>
>>70558715
fuck off
>>
>>70558715
I think there's several consumer electronics threads on this board
>>
>>70558715
Don't reply to retards. Why are you using rtmp though?
>>
>>70558765
you're the one replying to retards, retard.
>>
>>70556939
t. javascript ninja
>>
File: nginxrtmp.png (16 KB, 658x484)
16 KB
16 KB PNG
>>70558765
For "realtime" viewing of the camera streams. Seems to be about a 30 second delay. I want to have clients view the streams from the streaming server and not directly from the cameras since the cameras are just raspberry pi's and I want to limit CPU usage.
>>
File: 1492870106236.jpg (211 KB, 612x816)
211 KB
211 KB JPG
good morning qts
>>
>>70558792
there are no qts here
>>
>>70558795
nonsense, I'm replying to one right now!
>>
>>70556939
>those 2000 point answers to simple questions

lmao SO is such shit 100% low hanging fruit
>>
>>70558805
yeah imagine actually helping people by answering their questions, how gay is that
>>
File: 1546287725929.gif (94 KB, 500x281)
94 KB
94 KB GIF
>>70558803
t-t-that's not true!
>>
File: dash-hls.png (460 KB, 1253x750)
460 KB
460 KB PNG
>>70558783
DASH and HLS streams are available and I am using Shakka js and dash.js and testing them out. IOS devices can play HLS natively. The FPS thing was causing streams to stop working after about an hour.
>>
>>70558705
Yeah, but is there more to it than API calls?
>>
>>70558892
show me actual programming or fuck off. Oh that's right there is none.
fuck off.
>>
>>70556827
how isn't that tail-call?
>>
>>70558818
>answering shit questions like "how do I make a random int"

stop encouraging retards
>>
>>70558904
bool scanMemIda(const char *module, const char* signature, DWORD *retAddress, DWORD *retBase, DWORD startOffset)
{
int i = 0;
const unsigned int MAX_SIG_LEN = 2048;
unsigned char tmpSig[MAX_SIG_LEN] = { 0 };
char tmpPat[MAX_SIG_LEN] = { 0 };
char *p;
//char debugOutput[4096] = { 0 };
p = (char *)signature;
while(*p) {
if (i >= MAX_SIG_LEN - 1) {
writeToPipef(XorString("Scan Failure: Signature was too long to scan"), COLOR_RED);
return false;
}
if (*p == ' ') {
p++;
continue;
}
else if (*p == '?') {
tmpSig[i] = 0xCC;
tmpPat[i] = '?';
i++;
p++;
}
else {
tmpSig[i] = (unsigned char)strtoul(p, &p, 16);
tmpPat[i] = 'x';
i++;
}
//sprintf_s(debugOutput, "%s%X ", debugOutput, tmpSig[i-1]);
}
tmpPat[i] = '\0';
tmpSig[i] = '\0';
//writeToPipef("sig: %s\npat: %s", COLOR_YELLOW, debugOutput, tmpPat);
return scanMem(module, (char *)tmpSig, tmpPat, retAddress, retBase, startOffset);
}
>>
>>70556663
what are you working on g?
>>
>>70559003
Raging at this shitposter in this thread who won't let me post ffmpeg commands.
>>
>>70558985
What language is this? Is it obfuscated on purpose or is this how normal code in it looks like?
>>
>>70559034
c++, it is a part of a game cheat I was working on. This would convert IDA format search strings to the format I used for searching memory.

My cheat had a few functions it patched and used pattern matching with wildcards to find the offsets.

https://pastebin.com/uxTbKT0B
>>
>>70558937
Being last in the function syntactically doesn't mean it's a tail call.
The real last operation is the ==, and prior to that, the +.
>>
>>70559172
>>>/g/wdg
>>
>>70559187
What committee? I'm talking about quickload...
>>
>>70559172
>What am I doing wrong?
Using a butchered shitty Lisp instead of the real thing.
>>
>>70559211
dumb baka probably meant >>70558688
>>
>>70558688
did anybody ask for this? does anyone on the committee even care?
>>
>>70559205
>>70559214
In other words I am doing three things wrong?
What is the real thing, clojure?
>>
>>70559222
The only thing I find useful about this proposal is the fact that parameters can be constexpr which is a feature I want.
>>
>>70559236
Consteval will take care of this. Hell, generalized non-type template parameters will.
>But what about mixing and matching constexpr and non-constexpr arguments?
curry your function
>>
>>70559255
>curry your function
this isn't haskell. that's disgusting.
>>
Why doesn't the sepples committee have a "cleanup" period of sorts, where they just focus on simplifying and cleaning up the language for 3 years instead of consolidating a new feature set?
>>
>>70559263
not really any different to invoking a template with explicit arguments desu

>>70559272
that's what C++03 was
>>
>>70559272
you cant clean up a language without removing features somebody is using, which is why C++ is a shit language full of a trillion features
>>
>>70559285
>not really any different to invoking a template with explicit arguments desu
yes it is, of course it is.
>>
>>70559298
how is this
foo(0, 1)(2, 3)

much worse than this
foo<0, 1>(2, 3)
>>
>>70559305
because they're both not this
foo(0, 1, 2, 3);
>>
>>70559384
even if you think that's a good thing (I don't) that isn't worth the extra complexity
>>
File: 1531792122257.png (138 KB, 1920x788)
138 KB
138 KB PNG
Reminder that C++ automatic resource management is actually more efficient than manual resource management in C.
>>
>>70559016
>Raging shitposting
nobody do anything nowadays ha?
>>
>>70559016
Good. ffmpeg commands aren't programming. Fuck off.
>>
what's a text editor that allows me to adjust the spacing between lines?
>>
File: 1462192474095.gif (655 KB, 700x625)
655 KB
655 KB GIF
how do I deal with having to read Cnile code
>>
>>70559477
rewrite it in an actually fast language like C++.
>>
>>70559420
>cleanup
what?
>void*
what?

i don't think you've used or read c really. and where are your measurements?
>>
>>70559477
>>70559495
all me lol
>>
>>70559497
the name and type doesn't matter in this example
>>
File: mpv-shot0005.jpg (406 KB, 1920x1080)
406 KB
406 KB JPG
>>70559420
Cniles btfo
>>
>>70559524
>writes non-idiomatic code that doesn't even appear to be defined
>provides no measurements
>makes stupid assertion
please keep posting
>>
>>70559542
butthurt
>doesn't even appear to be defined
you don't even know C.
>>
>>70559566
again what do you think you're demonstrating? and where are your measurements?
>>
>>70559578
C++ automatic resource management produces better codegen.
>>
>>70559587
1. why do you think two declared yet undefined functions "init(void*)" and "cleanup(void*)" being called on a pointer to an integer are representative of typical "resource management" in c? and you aren't even managing any resources
2. by what metric?
>>
>>70559420
I think that's just being GCC being retarded. Clang doesn't do that.
>>
File: 53985327523253.jpg (54 KB, 543x589)
54 KB
54 KB JPG
So exactly whats the difference in speed between RUST C++ and C? My plan for now is learning one of these 3 languages (know something something of C) and combine it with a higher level language like Python JS or whatever there is.
>>
>>70559724
depends on coding style but don't expect a 2x difference between any of them
>>
>>70559724
The point of rust and modern langs is that you no longer need python and JS.
Nim for example has a first class JS backend.
>>
>>70559768
>The point of rust and modern langs is that you no longer need python and JS.
Call me when Rust has 1/4 of the libraries of JS or Python
>>
>>70559783
Ah, so you don't actually want to program, you just want to glue libraries together.
>>
>>70559783
Who the hell cares? The only libraries that are relevant are written in C.
>>
File: me.jpg (489 KB, 1536x2048)
489 KB
489 KB JPG
I am just sitting in the cafeteria in uni. Some guys sit right beside me. One of them:
>I don't really understand python. It is so complicated. I like javascript much more
>>
File: 9438634682347.jpg (45 KB, 640x803)
45 KB
45 KB JPG
>>70559793
>Programming without libraries
>Glues instructions together to create something
>Programming with libraries
>Glues instructions together to create something

Unless you fucking write in Assembly exclusively shut the fuck up
>>
>>70556663
i'm working on an neural network that strives to develop a sequel to the critically acclaimed song by american rapper kanye west, black skinhead
>>
>>70559793
>programming is all about reinventing the wheel
>t. has never created anything useful
>>
>>70559846
Your argument for not using a language is:
>it doesn't have enough ready made solutions for me
So yeah, you don't actually want to learn or program. You just want to fork example code and slightly change it.
>>70559860
define "useful".
>>
>>70559829
imagine being a pythontard thinking you're better than javascripttards
>>
>>70559854
Can it make music, or just the lyrics?
>>
>>70559872
music, i am working hard to create black skinhead 2 and save the world
then again if i tried the lyrics it would just be "i keep it 299, like the greeks"
>>
>>70559865
You implied RUST not having as many libraries as JS or Python isn't a bad thing when also saying when using it you don't need those more popular langauges but if you actually worked on a remotely bigger project so not a calculator with a small team or solo you'd see how useful libraries are
>>
libraries are for people with jobs, and you definitely do not want to be like them
>>
>>70559885
I don't like Rust, but yeah, not having as many libraries does not disqualify a language from being used. People like you are actually helping to kill newer langs that never see adoption because you want to leech off other people's work, instead of making the contribution yourself.
>>
File: 4.jpg (231 KB, 800x500)
231 KB
231 KB JPG
>jobs
before having a job I was happy.
Now, I don't even remember what happiness feels like
>>
>>70559929
You are fucking retarded, i want RUST to suceed i actually really like what is trying to do but i wouldn't use it for a big project as the main/only language, but i'd happily use it as the main one for heavy-ass operations while for example Python handles the rest
>>
>>70559981
>i want a language to succeed but don't want to put in the work to help it
So you're a leech, got it.
>>
>>70559929
When I try to use a newer language like Crystal, I'll try do something pretty simple, and get roadblocked.
Then I'll try create it, which is quite a task, but since it probably exists for Ruby it's not that hard, but then you realize that thing is relying on other libraries.

So then you have to create 5 more libraries to create that one thing. Ok cool, but the problem is even if you do that, the standard library doesn't even have functions that Ruby does.

Maybe with rust it's a bit better supported since it's a little more popular, but the problems are the same.
It's libraries all the way down.

>tfw waste days on something that is just "npm install answer" in node, and don't even get it done in the end
>>
>>70559989
What amazing software did you write in a new language
>>
>>70560000
The problem is you're thinking only in libraries, not solutions.
>>70560000
define "new"
>>
>>70559885
>>70559981
Rust isn't an acronym.
>>
>>70560008
2015+
>>
>>70560019
whelp, i'm disqualified.
>>
>not making your own language
>>
>>70560017
Really unused shit tool
>>
File: 1544688927103.jpg (693 KB, 1920x1080)
693 KB
693 KB JPG
C++ is the most powerful programming language in the world.
Man I so want to take Ebin-chan home and then feed her lots of food until her boobies double in size!
>>
File: Martian_face_viking.jpg (97 KB, 640x472)
97 KB
97 KB JPG
Is designing a vm for your language with bytecode interpretation/compiling really the most portable thing you can do?

all your code then targets the specs of a virtual machine, which if the devs are good, should be able run on all feasible hardware. No other language could promise such portability. If your language is low level, that bytecode is essentially translated to variable length assembly instructions, otherwise JITs exist which can take care of the more complicated VM byte ops. You would have no UB and no IB either, and all your code can be entirely safe. You could make a universal assembly language with it, why doesnt that exist?
>>
https://www.makeuseof.com/tag/programmers-more-fun-to-date/
Why don't you date a programmer yet?
>>
>>70560243
erlang/elixir already exist.
>>
>>70560243
>You could make a universal assembly language with it, why doesnt that exist?
it's called web assembly
>>
File: 1547509972431.png (24 KB, 405x314)
24 KB
24 KB PNG
>>70560000
Waste of digits.
>>
>>70560243
Congratulations on reinventing the https://en.wikipedia.org/wiki/O-code .
> You could make a universal assembly language with it, why doesnt that exist?
You mean JVM bytecode, CLR IL, LLVM IR, wasm, etc. aren't real?
>>
>>70560279
But is it the strategy that maximizes portability and safety while still remaining a useful language?
I heard some guy ported the java VM to ancient 8bit consoles like the sega master system.
>>
>>70560312
Yes. The entire Android ecosystem is built on JVM bytecode.
>>
>>70560249
VMs are for runtime tasks/optimzations. You still need to make a JIT implementation that works on mainstream platforms, a GC that relies on the OS for effecient MM and a metadata handler.
If a VM IS doesn't go far from assembly, it shouldn't be a VM at all e.g the JVM bytecode is silly universal assembly with no registers and only few high level features like invokedynamic whereas the CLR intermediate language supports many features from polymorphic instructions to generic type builder to stack manipulation and easy marshalling
TL;DR Just target LLVM and call it a day, lazy fuck
>>
>>70559724
> So exactly whats the difference in speed between RUST C++ and C?
There are none.
>>
>>70560249
>smells bad
>extremely stubborn
>arrogant
>pedantic
>surprisingly stupid
>>
File: 1547585670529.jpg (55 KB, 1113x640)
55 KB
55 KB JPG
What are the best (and up-to-date) books about programming that aren't specifically about one language? Just all around about programming
>>
>>70560377
>SICP
>How to Design Programs
>Concepts, Techniques, and Models of Computer Programming
>The Art of Programming
>Practical Foundations of Programming Languages
>Types and Programming Languages
>>
>>70560437
>SICP
>How to Design Programs

>up-to-date
>aren't specifically about one language
nah
>>
If you have an array of m unique strings, an equal sized array of integers associated with each string by index, and an array of size n>=m consisting at least 1 of each of the unique strings, is it possible to map each string in that array to its integer in O(n) worst case time? dictionaries have O(n) worst case lookup so using it would be an O(nm) solution

e.g.:

strings: a b c d | integers: 0 1 2 3
input: c a a a d b | output: 2 0 0 0 3 1
>>
c++ is the most powerful programming language
>>
>>70560456
if the only thing you learnt from SICP was scheme you're just not cutoff for programming. Focus on your efforts on devops or test automation, you'll thank me later

>up-to-date
what's your point, we've been programming the same fucking way since the 70s
>>
Minimize statefulness. Go functional.
>>
>>70560477
> we've been programming the same fucking way since the 70s
t. rob pike
>>
>>70560487
You don't have to minimize state in FP, you just have to define, and properly handle it.
>>
>>70560488
>providing proof for my claim
t-thanks
>>
>state is too hard for programmers to deal with
>lets invent another system that has no state but makes things much cumbersome than using state ever was
>perfect
>>
>>70560512
> he thinks being compared to a smug boomer who has been out of touch with the industry and PL research for 30 years and authored the worst "new" PL in decades is a compliment
np
>>
>>70560547
devops and test automation require a minimal reading comprehension, just look for a book on word processing instead
>>
>>70560473
*bloated
>>
>>70560540
>no state

FP does have state: but FP makes it immutable as much as possible. Obviously you can't have immutable state all the time as your program will effectively "do nothing", but minimizing side effects has its merits.

>makes things much cumbersome than using state ever was

When you try FP you will realize just how wrong you are. Being assured that the output of a function relies entirely on what is given to it is a big relief on the mind of the debugger.
>>
fp is for brainlets that cant keep track of the state of their programs in their heads
>>
>>70560665
>Being assured that the output of a function relies entirely on what is given to it is a big relief on the mind of the debugger.
This is based on the assumption that you're a shit programmer or you're working with shit programmers who can't be bothered or don't know how to set up their dependencies hygienically
Any paradigm based on your programmers being bad is only ever going to hold good programmers back
>>
>>70560540
>state is too hard for programmers to deal with
state isn't the hard thing
>lets invent another system that has no state
FP has state, it's explicit
>but makes things much cumbersome than using state ever was
not if you use basic abstractions
>perfect
yes
>>
>>70560618
It's not like an introduction freshman textbook from the 80s is hard to read either, it's just a waste of time, you might as well read Fortran manuals from the 50s.
>>
File: 1550091932282.png (47 KB, 336x317)
47 KB
47 KB PNG
What's the best Lisp for writing standalone scripts?
>>
>>70560325
>entire Android ecosystem
No, just the applications part and it's shit
>>
>>70560695
Python
>>
>>70560694
you're clearly than a freshman from the 80s, soooooo I'm not sure if it's a waste of *your* time
>>
>>70560710
dumber*
>>
>>70560461
I'm pretty sure it's O(n) because you just loop over the input and add results to the dict as you go, and simply check the dict for previous inputs each time, if it exists you use it, otherwise you add it.

And each time you just add to the output also.

So you really only loop over once, and everything else is O(1)
>>
>>70560685
Any good programmer knows she's not infallible and make mistakes, and would be fine with compiler having her back. Only fizzbuzzers think that "good programmers" don't make mistakes or can hold the entire program in their heads.
>>
>>70560730
>Any good programmer knows she's not infallible and make mistakes
Yeah, typos and the occasional logic error
good programmers don't randomly shit global state all over the place without thinking about it
I can't remember the last time I ever had some mysterious problem somewhere because of some piece of global state I forgot about
>>
>>70560727
>simply check the dict for previous inputs each time
dictionary lookup isn't O(1) though and you're doing that inside an O(n) loop
>>
File: 1542968691817.jpg (198 KB, 1003x700)
198 KB
198 KB JPG
I am just a beginner but what the fuck is the deal with binary trees, everyone keeps freaking talking about them

>Binary tree this
>Binary tree that
>Oh this is so easy just use a binary tree
>A binary tree will be necessary here

the hell they are about
>>
>>70560803
Well they are a data structure that is good for certain tasks. For example you can find a value in log(n) time instead of linear time.
>>
>>70560803
lets say you need to look up a word in the dictionary
the dictionary has 2,000,000 entries
it might take up to 2,000,000 iterations to find the word you're looking for if you search through it one-by-one
if you use a properly balanced binary tree, it would only take about 20 in the worst case scenario instead
that's a huge improvement
>>
>>70560769
No because you'd never have chance to collide in the hash table, and you'd do lookups rather than autistic python "if "a" in dict" shit, you'd do "if dict["a"] which is O(1)
>>
>>70560685
Your conception of a good programmer is someone who can step through and easily debug a program that relies on side effects but is held back by FP? I doubt that.

In all my years of programming I have never encountered a problem where I was limited by FP. There are definitely some things that could be more easily implemented with global shared state, but the peace of mind of having it effectively disabled for not just me but EVERYONE on the team is not something I would trade away.

That's the point I want to make. FP doesn't hinder good programmers and makes bad programmers less worse. It's a win-win.
>>
>>70560803
Because trees are one of the very fundamental parts of computer science. They're just so damn useful.
>>
>>70560832
>years of functional programming
>the team
nice roleplay
anyone is held back by functional programming, unless you're doing one of the tasks it's better suited for, which is the minority
>>
>>70560836
On the topic of trees and FP, trees are how functional programs "copy" state on every function call and remain memory efficient.
Basically, trees make it so that you don't actually have to copy when the state remains the same .

>>70560845
You seriously think functional programming isn't used on a big scale? Do you think that "web development" is the minority of programming tasks?
>>
File: 1527056827122.png (306 KB, 641x490)
306 KB
306 KB PNG
>>70560862
Are you seriously one of those retarded memers who claims that javascript is a functional programming language?
>>
>>70560862
>You seriously think functional programming isn't used on a big scale?
if you mean on big projects, then yes, but if you mean wide adoption, certainly not
>>
>>70560845
>anyone is held back by functional programming
How so?
>>
>>70560862
Isn't GHC the largest Haskell project with, like, 130ksloc?
>>
>>70560882
Javascript is as functional as a bicycle is a car. No, I meant elixir. Erlang features are simply way too good for companies to ignore, and it has been seeing steady adoption over the years. I'm very happy to be working on an elixir project!
>>
>>70560892
because most of the time it's not the best tool for the job? Like brushing your teeth with a screwdriver
>>
>>70560914
Are you implying imperative programming is somehow the ``right tool'' for most jobs? How so?
>>
>>70560953
If you want an short answer, because that's how your computer works
>>
>>70560967
Circuits implement combinatorial logic. Sequential logic is implemented by way of a monad. Your hardware is purely functional.
>>
>>70561011
Memory is a big block of state and your CPU executes instructions more or less in order
stop being retarded
>>
>>70560967
You aren't making much sense right now. How does that imply it being the ``right tool'' for most jobs? Why not consider it the right tool for every job then if that's so important?
>>
>>70561021
I run programs exclusively on FPGAs.
>>
File: xkx1gpkrb3s21.jpg (2.12 MB, 3024x4032)
2.12 MB
2.12 MB JPG
Just be yourself.
>>
>>70560967
""epic"" argument. Are you "black" and incapable of abstract though, by any chance?
>>
>>70561032
cringe
>>
>>70561021
>state is somehow indicative of imperative programming
It's pretty clear that you understand neither FP, nor what you claim to support.
>>
>>70561021
memory is world X and devices are worlds Y
Your CPU is a set of pure functions that map state of X -> Y or Y -> X

your computer is an FP model
>>
>>70561049
>Saying "cringed" like that
That's extremely winceworthy. You're even worse than the guy in the photo.
>>
>>70561060
it's pretty clear you're being pointlessly pedantic while contributing nothing to the discussion
>>
>>70561069
I'd totally stand next to them with "cringe" posted on cardboard
>>
File: gyate_cirno_huh.png (59 KB, 400x250)
59 KB
59 KB PNG
>>70561032
>object Micah modifies properties of object Hannah on method calls to Micah
how do we end OOP once and for all?
>>
>>70561086
or printed on card i guess
>>
>>70561077
It's pretty clear that you're just spouting garbage you read on some blog without really understanding what "FP" even means in the first place.
see >>70561062
>>
>>70561106
your CPU is a set of instructions which changes registers and bytes in memory
>>
>>70561118
In what context is that a refutation of that post? Or do you lack the basic knowledge required to read and understand the meaning of individual words in that text?
>>
>>70561092
Hannah modifies it itself, it only receives a message.
>>
All code compiles to imperative one :)
Nothing in cpu is functional.
>>
>>70561069
He could at least wrote something reasonable instead of this pseudo-code, like
if Hannah.request(Goto(Destination::Prom, /*with*/ Micah)) == Request::Granted {
Micah.mood = Mood::Happy;
}


Also what kind of name Micah is? Why can't Americans stick to John and Bill?
>>
>>70561106
Feel free to enlighten me on the true meaning of functional programming then
>>
>>70561165
Surely you know that better than me since you seem to be an expert on how it's not the right tool for most jobs.
>>
File: 1532863779855.png (1.61 MB, 3840x2160)
1.61 MB
1.61 MB PNG
rolling for a project I can surely do in C++
>>
>>70561177
Actually using something is a different thing than being a pedantic smartass on the internet who knows all the jargon for it
>>
>>70561199
Please explain how it "not working like your computer" makes it the wrong tool for most jobs. Surely you should be able to do that if you're so proficient at using it.
>>
File: 5sjnvcbsc9r21.jpg (85 KB, 777x1082)
85 KB
85 KB JPG
r/ProgrammerAnimemes is my new favourite subreddit
>>
>>70560803
Trees are everywhere, not just as a data structure.
Binary trees are the simplest trees.
>>
>>70561246
>Binary trees are the simplest trees
What's better is that you can implement any tree with a binary tree instead.
>>
>>70561220
good, now you can stay there.
>>
Is Forth worth learning?
>>
>>70561252
that's not really better at all and doesn't make any sense in most cases
>>
File: qz10tf080br21.png (225 KB, 1596x1382)
225 KB
225 KB PNG
>>70561253
My browser supports multiple tabs tho.
>>
>>70561220
image is correct
>>
File: 1554384840972.png (407 KB, 600x600)
407 KB
407 KB PNG
>>70561220
>>70561279
wtf is that pile of shit. look at this, it's not funny, it's not original, it nothing but shit and cringe. kys
>>
>>70561381
Reddit is just like Open Source - feel free to improve it by posting /dpt/ memes there.
>>
>>70561182
ReRolling for a red one.
>>
>>70561404
Reroll again
>>
>>70561399
Wrong. Incredibly wrong.
it's an echo-chamber.
>>
>>70561424
reminds me of this place I go on a lot to discuss programming... There are very few users so they don't get a lot of outside opinion.
>>
>>70561449
Seems like a nice place. Link?
>>
>>70561424
> Reddit, alexa rating 21, an echo chamber
> 4chan, alexa rating 439, not an echo chamber
>>
>>70561485
no you'll ruin our echo chamber.
>>
>>70561449
sure, it's still possible despite the absence of pseudonyms and upvotes, but not when there are a few users.
/dpt/'s only problem is its incredibly low average IQ.
>>
>>70561491
yes
>inb4 look at this one board
>>
>>70561511
> he believes in the IQ meme
>>
>>70561534
how's life as an aspie?
>>
>>70561511
dpts biggest problem is it's all college kids or basement dwellers
>>
>>70561556
>dpt
Stop projecting, you stupid redditor.

>>70561449
How is a place where everybody disagrees with each other just for the sake of disagreeing supposed to be an echo chamber?
>>
>>70561534
nigger
>>
stop replying the shitposter
>>
>>70561576
>Stop projecting, you stupid redditor.
what?
>>
>>70561613
nigger
>>
>>70561130
>Nothing in cpu is functional
All CPU inputs have a known output. I'm not sure if any modern CPU's have instructions that produce side effects but for the most part CPUs follow the functional paradigm.
>>
File: 3b6.jpg (20 KB, 353x400)
20 KB
20 KB JPG
>>70561659
>I'm not sure if any modern CPU's have instructions that produce side effects
>>
>>70561659
> I'm not sure if any modern CPU's have instructions that produce side effects
wtf are you talking about? Writing in memory, setting registers and status flags are side effects.
>>
>>70561032
>first line "Hannah" is a string
>second line Hannah is an object
>>
>>70561686
Strings are objects brainlet
>>
File: 1280.jpg (39 KB, 600x568)
39 KB
39 KB JPG
I'm at work. Needed a variable that holds cumulative sum. Name it cum_sum but that's a bit inappropriate, don't want anyone thinking I'm weird . What souls I change it to?
>>
>>70561679
they're not side effects, they're just effects, there's nothing "functional" about CPU instructions, they dont take inputs and return outputs, they make changes to shared global state
>>
>>70561670
Please provide two (2) CPU instructions that produce a side effect. Thank you.
>>
>>70561719
Change it to "im_a_fucking_retarded_frogposter" instead.
>>
>>70561032
Michah.askToProm(Hannah);
if (Hannah.answer == "yes") {
Michah.mood = "Happy";
}
Hannah.askForSex(Chad);
if (Chad.answer == "yes") {
Hannah.mood = "Happy";
Hannah.suckCock(Chad);
}
>>
>>70561719
Don't worry, they already think you're weird.
>>
File: 1500751023899.jpg (67 KB, 1024x962)
67 KB
67 KB JPG
>>70561733
>>
>>70561719
cum_collection
>>
>>70561699
So why couldn't he just write "Hannah".answer == "yes" ?
>>
>>70561719
cum_dump
>>
>>70561731
go look it up, tons of them set error flags
>>
>>70561736
> 2k19
> being an insecure incel
>>
>>70561750
Setting flags would be a side effect! Thanks. Couldn't really think of anything.
>>
>>70561752
> 2k19
> being a white knight
>>
>>70561756
functional doesn't mean 'no side effects'
>>
>>70561778
"In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data...Eliminating side effects, i.e., changes in state that do not depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming."

https://en.wikipedia.org/wiki/Functional_programming
>>
New thread:
>>70561796
>>70561796
>>70561796
>>
>>70561800
a mathematical function returns a result for a given input
CPU instructions don't 'return' anything, an instruction is executed and that instruction makes a change to the state of the computer
state doesn't exist for real functions, all computer instructions do is change state, they are not remotely the same thing
>>
non-reddit shitpost
>>70561898
>>70561898
>>70561898
>>
>>70561803
reddit
>>70561902
4chanu
>>
>>70561182
rolling
>>
How the fuck do I get started with C++/CLI and .NET?



Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.