[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 330
Thread images: 38

File: 1499797154117.jpg (17KB, 320x320px) Image search: [Google]
1499797154117.jpg
17KB, 320x320px
What are you working on, /g/?

Old thread: >>62395061
>>
File: 1491068347426.gif (36KB, 679x604px) Image search: [Google]
1491068347426.gif
36KB, 679x604px
Why haven't you learned Haskell yet, /dpt/?
>>
>>62405707
Because Scala.
>>
>>62405707
I'm unemployed!
>>
>>62405714
Scala is trash
>>
>>62405724
You are trash.
>>
File: 1500444236472.gif (44KB, 838x734px) Image search: [Google]
1500444236472.gif
44KB, 838x734px
>>62405707
>>
>>62405707
Because I haven't yet got a reason to.

Thus far I haven't found a good reason to apply it to bioinformatics when python and R do the job just as well.
>>
>>62405707
I still need to learn Scheme.
>>
>>62405707
Is she a fairy?
>>
File: adolfina_hitler.jpg (130KB, 745x982px) Image search: [Google]
adolfina_hitler.jpg
130KB, 745x982px
>>62405687
Going through "Thinking functionally with Haskell"
>>
>>62405777

Checked.

Learn Scheme and than learn Steelbank CL or Clojure.
Then look at Haskell and laugh..

>hurr, muh types!
>we_need_more_monads.png
>>
File: 1491273330831.jpg (36KB, 233x215px) Image search: [Google]
1491273330831.jpg
36KB, 233x215px
>>62405826
No, she's a baka.
>>
>>62405830
And then pull your hair out when you have to refactor your code.
>>
File: 1490484324331.jpg (89KB, 400x400px) Image search: [Google]
1490484324331.jpg
89KB, 400x400px
>>62405826
Cirno is an ice fairy

>>62405835
NO
>>
>>62405687
This thread is not canon, no animu girl in OP post
>>
I'm going to write R++
>>
>>62405707
unironically employed Haskell programmer here though
>>
>>62405888
kys

>>62405889
check out Julia
>>
Why the fuck did the exercises get so hard once it got to arrays?
>>
File: 1493967347358.png (140KB, 420x420px) Image search: [Google]
1493967347358.png
140KB, 420x420px
>>62405888
That's why we have to compensate with posting some animu girls, anon-kun.
>>
>>62405916
Because arrays are where C starts to smell like shit.
>>
>>62405924
You must be a serious brainlet if you're a supposed "programmer" and can't even handle C arrays.
>>
> time to work on personal projects
> don't feel like doing anything
WHY.
>>
Does a "dynamically allocated array" mean vector?
>>
>>62405970
Often but not necessarily.

>>62405962
I can handle them, but they're suboptimal. Give me slices over pointers any day.
>>
File: Screenshot_20170913_214307.png (65KB, 1270x813px) Image search: [Google]
Screenshot_20170913_214307.png
65KB, 1270x813px
>>62405970
Damn, this question is hard
>>
>>62405970
vector is usually just one dimensional array. Your array can be dynamically allocated too.
>>
>>62405968
>relying on motivation
>not relying on habits, scheduling, discipline and delayed gratification
Your only hope is to travel back in time and tell your parents to make you do chores
>>
>>62405970
Not necessarily.VLAs are "dynamically allocated arrays", but you not call it a direction in a Cartesian coordinate system.
>>
>>62405979
>Give me slices over pointers any day
And how do you think a slice works, fuckboi?
>>
>>62405984
>only tool available to develop habits, scheduling, discipline and delayed gratification is motivation
I truly pity anyone in this hopeless situation.
>>
>>62406001
pointer + size. Abstractions are a nice thing to have you know.
>>
>>62406011
>Le obstructions meme
Enjoy you're slow programs.
>>
File: 1419559831897.jpg (119KB, 615x535px) Image search: [Google]
1419559831897.jpg
119KB, 615x535px
>>62405984
This post hurts my soul.
>>
>>62405916

What exactly is "hard" for you?

a[i] = [pointer to a + (i * size of data type)]


The only gotcha I can think of is that with strings you always have to think of the \0..

char *a = "Ayylmao"
char *b = "Ho"
strcpy(b, a) = ['H', 'o', '\0', 'l', 'm', 'a', 'o', '\0']

But those are details..
>>
>>62406014
low effort post
>>
>>62405830
as a professional clojure programmer - I find Haskell concepts more and more useful as my projects get bigger. Especially monads, automatic currying and the typeclasses.

I tried both cats and that other one category theory library - forgot its name - but they just don't cut it. A lot of monadic stuff works well in Haskell because the type system can dispatch stuff in functions by type of the output as well, not only by the type of the input as it happents in clojure's multimethods. The automatic currying would help me so much to not have (partial ... (partial... (partial... shit everywhere in the code.

Of course, macros and shit help me a lot already, but they are not even in the same league of the racket ones so yeah - it's nice but not comfy-all-the-way nice.

If it was for me, I'd rewrite quite a lot of clojures' innards, since a lot of functions are just counterintuitive (why TF mapping over a vector returns a list - they're both seqs, just preserve the fucking type, how hard might it be?), but I just don't want to join the infinite horde of projects that aim to rewrite clojure but change only a tiny bit of it so it behaves slightly differently. They'll all end up writing racket with a tad more syntax eventually anyways.
>>
File: 1498250623555.png (197KB, 419x530px) Image search: [Google]
1498250623555.png
197KB, 419x530px
>>62405984
Nice all that's left is to kms.
Just when I finally graduated.
Oh well, it's not like I was going to be of any use to anyone.
Thanks for opening my eyes anon, I nearly lost my time trying !
>>
In C++, I don't really understand what
if (std::cin >> var)

does. Why is it different from
std::cin >> var;
?
>>
>>62405899
What job?
>>
You have 10 seconds to post your thoughts about atom-ide
>>
>>62406090
operator>> conventionally returns a reference to the stream on the left handside.
A stream overloads operator bool. It returns true if the stream is ready to use, or it returns false if the stream has encountered an error.
In other words, the body of
if (std::cin >> var)
will only execute if there hasn't been an error.
>>
>>62406097
whatever clients require
>>
>>62406121
I understand, thank you.
>>
File: 1396464219897.jpg (52KB, 742x720px) Image search: [Google]
1396464219897.jpg
52KB, 742x720px
>>62405921
aw yiss
>>
>>62406130
So you do freelance in Haskell?
>>
>>62406021

Sorry, I forgot to add:
My example wouldn't work, since "char *a =" would be "read-only", so you need "char a[] =".
>>
File: 1489008461413.png (600KB, 629x520px) Image search: [Google]
1489008461413.png
600KB, 629x520px
I can't wait to go back to good ol' C after having to trudge through the boredom that is front-end webdev.
>>
>>62406155
ye
>>
>>62406193
Just do frontend with C
>>
>>62406155
no, work for a place, boss finds projects and clients and puts us on them; contractor/consultancy place
>>
File: 1505204051495.png (180KB, 392x309px) Image search: [Google]
1505204051495.png
180KB, 392x309px
>>62406193
I know that feel bro
>>
File: 1505277469769.jpg (77KB, 658x632px) Image search: [Google]
1505277469769.jpg
77KB, 658x632px
>>62405981
Okay I got it to compile but it causes a double free memory corruption
/*Write your own integer array class named IntArray from scratch (do not use
* std::array or std::vector). Users should pass in the size of the array when
* it is created, and the array should be dynamically allocated. Use assert
* statements to guard against bad data.*/

#include <iostream>
using namespace std;

class IntArray {
private:
int* arr0{0};
size_t length;

public:
IntArray(const size_t n) : length{n} { arr0 = new int[n]; }
int& operator[](const size_t element) const {
if (element < this->length) {
return this->arr0[element];
}
}

IntArray& operator=(IntArray& given_arr) {
this->length = given_arr.length;
this->arr0 = given_arr.arr0;
for (size_t i = 0; i < length; ++i) {
this->arr0[i] = given_arr[i];
}
return *this;
}
~IntArray() { delete[] arr0; }

friend ostream& operator<<(ostream& os, const IntArray& arr) {
for (size_t i = 0; i < arr.length; ++i) {
os << arr[i] << " ";
}
return os;
}
};

IntArray fillArray() {
IntArray a(5);
a[0] = 5;
a[1] = 8;
a[2] = 2;
a[3] = 3;
a[4] = 6;

return a;
}

int main() {
IntArray a = fillArray();
std::cout << a << '\n';

IntArray b(1);
a = a;
b = a;

std::cout << b << '\n';

return 0;
}
>>
>>62406256
nvm fixed it
>>
>>62406241
>tfw when you get to write C while you webdev because extensions
>>
>>62406216
How did you get him to accept using Haskell in a professional environment though?
>>
File: 1505274955724.jpg (78KB, 460x566px) Image search: [Google]
1505274955724.jpg
78KB, 460x566px
>>62406265
>>
Speaking of C and webdev, has anybody here used C with their backend?
>>
>>62406274
It's a Haskell place to begin with, no accepting needed
>>
I just realize my browser now supports font ligature :)
>>
>>62406312
What's the pay like?
Does the firm specialize in certain services or not at all?
Was it easy to find a job there given how rare Haskell programmers are?
>>
File: 1476540933228.jpg (4KB, 200x200px) Image search: [Google]
1476540933228.jpg
4KB, 200x200px
>>62405899
>he thinks that posting this every day will make his fantasies real
>>
>>62406369
I got 50k starting straight out of undergrad, fully remote; you can obviously get a lot more depending on experience &c. Yearly raise.

Technically we're specialised on the surface but we do just about anything

Yes it was easy: Haskell programmers are rare which makes them even more in demand. We're constantly looking for people, even now

>>62406379
lol
>>
File: ....jpg (18KB, 200x256px) Image search: [Google]
....jpg
18KB, 200x256px
Employed D programmer here
>>
>>62406297
I have. But beware that you will need to get your hands on some kind of CGI interface which is not shit (i had to write that crap on my own and it was probably inefficient as fuck since you need to get thread management, i/o management and a whole bunch of other stuff implemented properly).
>>
>>62406434
Based Andrei
>>
File: success.jpg (9KB, 434x77px) Image search: [Google]
success.jpg
9KB, 434x77px
>>62405981
I hope that was sarcasm
class IntArray
{
public:
int m_size;
int* ia;
IntArray(int size) : m_size(size) { ia = new int[size]; }
virtual ~IntArray() { free(ia); }
friend ostream& operator<<(ostream& os, const IntArray& ia)
{
int size = ia.m_size;
for(int i = 0; i < size; i++) { os << ia[i] << " "; }
return os;
}
int& operator[](int val)
{
return ia[val];
}
};
>>
File: d_foundation.png (11KB, 531x152px) Image search: [Google]
d_foundation.png
11KB, 531x152px
>>62406434
> employed
> as treasurer
I mean, who the fuck would trust money to a gypsy?
>>
do any of you use the windows operating system for your software development?
if so, why the fuck would you do that to yourself?
>>
>>62406412
Are there Haskell jobs in Europe or is that a burger privilege
>>
>>62406434
What sort of qualifications do you need to work at the morgue, anyway?
>>
>>62406449
That doesn't overload '=' though. Here's what I solved it
class IntArray {
private:
int* arr0{0};
size_t length;

public:
IntArray(const size_t n) : length{n} { arr0 = new int[n]; }
int& operator[](const size_t element) const { return this->arr0[element]; }

IntArray& operator=(IntArray& given_arr) {
this->length = given_arr.length;
this->arr0 = given_arr.arr0;
for (size_t i = 0; i < length; ++i) {
this->arr0[i] = given_arr[i];
}
return *this;
}

friend ostream& operator<<(ostream& os, const IntArray& arr) {
for (size_t i = 0; i < arr.length; ++i) {
os << arr[i] << " ";
}
return os;
}
};
>>
>>62406483
We're EU based. Main office in Paris. There are a few local people there (for reasons) but nearly everyone works remotely.
>>
>>62406447
My shitposting aside, Andrei really is a cool guy. Seeing him with Scott Meyers at DConf was cool.
Walter needs to be more cogent.
>>
>>62405994
> VLAs are "dynamically allocated arrays"
Not in the sense that the C standard uses the term "dynamically allocated". VLAs have automatic storage (which typically means that they're on the stack). "Dynamically allocated" means allocated with malloc/calloc/realloc (i.e. on the heap).
>>
>>62406463
It's nota problem to trust money when you have no money.
>>
>>62406529
Heh, I wish I was as good as him. I feel like a brainlet all the time
>>
>>62406536
I don't believe the C standard ever uses the word "dynamic" when referring to memory.
>>
>>62406527

That explains it.

The french are weird people, I wouldn't be surprised if some of them unironically used Haskell for customers..
>>
>>62406527
You work for Atos?
>>
File: 7de.png (63KB, 400x250px) Image search: [Google]
7de.png
63KB, 400x250px
>>62406504
>>62406449
Also, do you think I need to delete the array in the deconstructor? Both you and the book author is doing it. But I thought the classes will delete all its object when they go out of the scope.
>>
>>62406437
Figured as much. But it does sound fun. Thanks for the feedback, anon.

>>62406545
We can't all be a Romanian God.
>>
>>62406577
> The french are weird people
Actually this, they manage to write and use some weirdest stuff no one else uses, like Coq, OCaml, Pharo and Eiffel.
>>
>>62406577
I see…

>>62406579
Nope and I don't know of anyone who does; do they use Haskell internally for stuff?
>>
>>62406613
In some cases it might, but is good practice.
>>
>>62406412
>Haskell programmers are rare which makes them even more in demand.
B programmers are even rarer, and there's about as much demand for them as for Haskell memers.
>>
>>62406619
>no one else uses
>OCaml
It's pretty popular in finance since Jane Street wrote a new stdlib for it
>>
>>62406637
>but is good practice.
I, too, deleted the array in the destructor. Please see >>62406256. However this causes a horrible looking crash and complains about double-free memory corruption etc
>>
Does anyone have any shit to say about Rust?
Since I've started writing it I'm loving the shit out of it, but I felt similar with Golang, and it wasn't until too late that I realized how painful it was to not have any concept of generics/templates.

So far the only things I've disliked are that because of the zero cost abstractions, there are some kind of difficult things to work with like object safety is really fucking my shit up right now, and I'm finding somet hings I want to do I either can't or have to do in roundabout ways to keep object safety. Stuff like needing a receiver for trait methods meaning I can't have `from` methods in them.
>>
>>62406619

Don't forget about Prolog, Linotte or LSE..
Dem frogs.
>>
>>62406644
Good thing we're not trying to hire people solely based on rarity then.
>>
>>62406687
if you don't care about perf or efficiency just go to haskell
>>
>>62406725
Why?
>>
how much do you charge for a simple website scraper? company wants one
>>
>>62406688
Isn't Prolog used in AI?
>>
>>62406735
much better type system, generics (better than other languages, barring Agda/Idris/etc)
>>
>>62406665
Because you used a delete, they dont work the same way
>>
>>62406687
>Does anyone have any shit to say about Rust?
I'm using it for my personal projects, it's really good. It won't replace C or C++ in the near future, but I hope in 5-10 years I'll be able to use it professionally.
> Stuff like needing a receiver for trait methods meaning I can't have `from` methods in them.
How do you think FromStr is defined? https://doc.rust-lang.org/std/str/trait.FromStr.html
>>
>>62406753
no, lol
>>
>>62406753
It was supposed to lead the AI revolution in the 80s, together with Lisp, but both failed to deliver are basically dead since then.
>>
>>62406719
Yes, good thing we don't, or someone somewhere would have to endure having Haskell programmers as coworkers.
>>
>>62406780
>>62406801
>failed to deliver
Why?
>>
>>62406878
Prolog is generally fucking painful to program in, but lisp still lives on in various incarnations, and the only real problem with it is that it's brainlet and corporate unfriendly.
>>
>>62406878
I've never used it, but as far as I understand, Prolog is based on its own deduction engine, which is hard to program actual code to and is a performance bottleneck.
>>
>>62406918

Lisp is timeless. It's one of the oldest languages out there are yet there are still contemporary implementations like Clojure or Racket.

Prolog is a pain in the arse, but it had influence on later languages like Erlang.
>>
>>62405687
>starting from the bottom of the cliff

Start from the peak instead. Learn the language's implementation, then learn it's grammar, then it's standard library.

Guaranteed to be able to answer arcane stackoverflow questions after this.
>>
>>62406918
It's unfriendly because it barely has any syntax. The language is just syntax for parenthesized lists and it gets interpreted. Most people aren't used to that.
>>
>>62406918
>brainlet unfriendly
Hi Paul, how's Arc going on?
>corporate unfriendly
Yes, it's called being unpractical.
>>
>>62406278
every time
>>
>>62407017
their fucking problem. Reminder that the engineers work to make the other peoples' lives more convenient, not the other way round. Thus, if there's something that might get peoples' live easier but involves some learning for the programmer - he must do that. I mean - getting a bug in any lisp is hard, and in haskell is even harder - why would anyone not want to have that? And in lisp you've have the live-patching for free - just start a REPL on the prod server, fix whatever and then backport it to the master branch.

I seriously hate the circlejerking in the big companies where the programmers are lifeless and utterly uninterested in whatever they're building. This is how the disgusting shit as SAP gets born.
>>
>>62406966
What was the point of making Prolog declarative?
As I understand it, declarative languages just use a set of instructions to manipulate data, like SQL. Why not make Prolog functional?
>>
>>62406779
I tried to make a really basic example of it using FromStr
https://play.rust-lang.org/?gist=cfd0bf5fa238c4ad1200829bb1091ea0&version=stable
>>
>>62405981
https://play.rust-lang.org/?gist=3485e1d54a4edfa557970e33b9eaed58&version=nightly
>>
>>62407084
this is why I use prolog
>>
>>62407017
>Most people aren't used to that
I can think of a load of other things people "aren't used to" when they first learn how to program. I doubt "muh parens" is the root issue. It's not that hard to grok.
>>
>>62407092

Prolog is Logic/Constraint based.
FP Languages wouldn't fit here.
>>
>>62407117
Here we go, this is better.
https://github.com/rust-lang/rfcs/blob/master/text/0255-object-safety.md#detailed-design
>must have a receiver that has type Self or which dereferences to the Self type;
>>
>>62407181
Thank you, now I am certain that Rust is more verbose than C++
>>
>>62407052
>it's called being unpractical.
Sure, when you're in an environment that fosters mediocrity on almost every level of the hierarchy, powerful tools are impractical because they can easily be abused.
>>
Does Python have more jobs than C++?
>>
>>62407117
>>62407223
Interesting, I didn't know, it seems https://doc.rust-lang.org/error-index.html#E0038 explains why this is the case. Still, tho, what's the possible use case for such a method in `Box<Trait>`? Since you don't know the type at the run-time, it's impossible to store the result of `from`. You should really just use generics, resorting to dynamical dispatch only if necessary.
>>
>>62407319 (You)
> you don't know the type at the compile-time*
>>
>>62407092
>Why not make Prolog functional?
I don't know. Why not make Haskell imperative? Your question makes no sense. The failure of Prolog has nothing to do with it being declarative per se. It's that you have to understand all the underlying details of how the inference engine works and tailor your problem description to that. It's easy to accidentally create something Prolog can't handle, and it's hard to find exactly the part that trips it up.
>>
>>62407232
np friend
>>
MUMPS is now the official language of /dpt/
>>
How is std::cerr different from std::cout, practically speaking?
Apparently std::cerr doesn't write to the buffer, so why use std::endl; after calling it?
>>
>>62407092
use LogicT in Haskell
>>
>>62407357
stdout and stderr are different streams entirely
play around with redirection in your shell, you'll see
>>
>>62407243
> lisp is super powerful
Are you this guy: http://winestockwebdesign.com/Essays/Lisp_Curse.html ?
>>
File: 1480603564745.gif (999KB, 250x251px) Image search: [Google]
1480603564745.gif
999KB, 250x251px
>>62405687
In C++ what's the difference between nearbyint, round, and rint?
>>
>>62407364
I understand that they're different streams and are used for different cases, but why doesn't cerr write to the buffer (when clog does)?
>>
>>62407333
>The failure of Prolog
It still lives around as datalog tho
>>
>>62407319
>such a method
Whats the possible use case of having a from_* method on a trait?
I am abusing dynamic dispatch really badly right now, which is why I'm running into object safety issues. I'm going to try and see if I can write what I'm doing so that it uses static dispatch instead.
>>
>>62407401
The second one exists, the other two don't.
>>
F*
>>
>>62407398
>implying the understanding that lisp is very powerful (and that this power can be easily abused) is somehow unique, controversial or non-obvious, and can be attributed to one source
>>
>>62407448
Sure, Prolog and the like have some niche applications, but nobody can honestly say it's convenient for general purpose programming, or that the problem I described doesn't exist.
>>
>>62407398
I don't understand what author wanted to say.
>>
>>62407524
That if you want to use simple functions like left_pad you should use library for it instead of wirting it yourself. You should also use cdn and not donwnload the source to your server to reduce your http servers load.
>>
>>62407562
>That if you want to use simple functions like left_pad you should use library for it instead of wirting it yourself.
And Lisp lets you write the library by yourself fast?
>>
>>62407449
> Whats the possible use case of having a from_* method on a trait?
Something like this https://play.rust-lang.org/?gist=26a924d86d27873ca8b2a18f3429788f&version=stable : no dynamic dispatching, everything is decided at the compile-time, fast and safe.
>>
>>62406742
How simple? Like are you grabbing just a few pieces of text off of one page, are you pulling down json, are you ripping user posted content, or what?

If it's something simple a couple hundred bucks and it's done. If they're trying to get you to make an api for a site that doesn't have one, or a fat client for a site that doesn't offer one, then we're going to be talking billable hours and support.
>>
PHP and JavaScript are fantastic languages specifically because they don't have any retarded "design" getting in the way of your projects. The only thing preventing you from writing ugly code is you.
>b-but muh code is art
Everyone isn't a California hipster who has unlimited time to fuck around with writing "beautiful code". Forcing people to write code according to your latest meme """best practices""" is just stalinism.
>>
>>62407524
Author, starting from a ridiculous premise that Lisp is the most powerful language out there, is trying to explain why no one is using it then. Quite unsurprisingly, he concludes that Lisp is just too powerful for human beings. It's almost like the explanations religious fanatics come up with trying to explain why haven't their religion conquered the world yet if it's the only true one.
>>
>>62407497
declarative programming can never ever be a possible candidate for general purpose programming because it just hides too much.
>>
>>62407651
That's not true. You're just dumb.
>>
File: multiple inheritance.gif (4KB, 355x224px) Image search: [Google]
multiple inheritance.gif
4KB, 355x224px
How is return type covariance implemented in C++?
struct Base1
{
int x;
Base1(int x): x(x) {};
virtual Base1* clone() { return new Base1(x); };
};

struct Base2
{
int y;
Base2(int y): y(y) {};
virtual Base2* clone() { return new Base2(y); };
};

struct Derived : Base1, Base2
{
int z;
Derived(int x, int y, int z): Base1(x), Base2(y), z(z) {};
Derived* clone() override { return new Derived(x, y, z); };
};

You can see that it's possible for an override of a virtual function to have a return type which is more derived then the function it is overriding.

How the fuck does this work, though? With multiple inheritance, there's no guarantee that the pointer value for one of its base classes will be the same as the derived one. The same pointer value returned by Derive::clone cannot possibly point to both the Base1 and Base2 contained within.
Does the compiler emit multiple functions, or what?
>>
>>62407665

But he's not completely wrong, you know?

>Dr. Mark Tarver — twice-quoted, above — wrote a dialect of Lisp called Qi. It is less than ten thousand lines of macros running atop Clisp. It implements most of the unique features of Haskell and OCaml. In some respects, Qi surpasses them.
>>
Clover board sorting algorithm.

Clover's sort function arranges boards by board code, not their display name so I alphabetically sort them by hand. Imagine writing an algorithm which sorts a list with the same limitations as you have sorting the board list by hand.

1. You have a list of unsorted elements where you can only view N number of elements at a time.

2. You can only move elements currently being viewed.

3. Elements can only switch places with each other.

4. You can only adjust the view's position up or down N-1 elements at a time.

Assuming view moves and swapping elements has the same cost, what's the most efficient algorithm to sort the list?
>>
>>62407206
What's the issue then? Because nearly every modern dynamic language has already incorporated most Lisp features that used to distinguish it from, say, Fortran.

>>62407084
Engineers work to make money. They want to learn something at school then make as much money as they can with it, and then keep doing that thing forever without updating themselves or making any further effort if possible.

A lot of people are like this.
>>
>>62407709
bubblesort
>>
>>62407704
No, he's completely wrong.
> It implements most of the unique features of Haskell and OCaml. In some respects, Qi surpasses them.
This is just false, mostly because the author understands neither Haskell nor OCaml. To be honest, I doubt he understands Qi either.
>>
>>62407704
>you can implement interpreter in high level language in 10k lines of code
are we supposed to be impressed?
>>
File: 1502947226662.jpg (87KB, 400x400px) Image search: [Google]
1502947226662.jpg
87KB, 400x400px
>about to get a shitty CS degree
>think im hot shit, made a few Java applications for stupid shit
>Start browsing here
>Its all fucking greek to me
>realize my degree is worthless
>Start learning C/C++
>Too tired to pick up a book for more than an hour after four years of grinding shitty gen ed classes like womans studies and "why gmos are totally ebil grrr"
End my suffering
>>
>>62407601
Actually, you can just write
fn parse_csv<T: str::FromStr>(s: &str) -> Vec<T> {
s.split(',').filter_map(|s| T::from_str(s.trim()).ok()).collect()
}
>>
>>62407765
>four years of grinding shitty gen ed classes like womans studies and "why gmos are totally ebil grrr"
what shithole did you get a degree from
>>
>>62406687
It seems really nice technically, but unfortunately the whole Rust team and community is cucked. They even have an Antifa fag as a core developer.
>>
>>62407777
An American university that is well known for non-technical fields
>>
>>62406665
The problem is that you're not copying the array, but copying the pointer; both IntArrays share the same pointer and once both go out of scope and call their destructors, the delete is called on the same pointer twice. Better learn to use unique_ptr to avoid such things in the future.

class IntArray {
std::unique_ptr<int[]> arr_;
std::size_t len_;

public:
IntArray(const std::size_t len)
: arr_(new int[len]), len_(len) {}

IntArray& operator=(const IntArray& other) {
if (this != &other) {
arr_.reset(new int[other.len_]);
len_ = other.len_;
std::uninitialized_copy_n(other.arr_.get(), len_, arr_.get());
}
return *this;
}

int& operator[] (const std::size_t i) {
assert(i < len_);
return arr_[i];
}

friend std::ostream& operator<<(std::ostream& os, const IntArray arr) {
for (std::size_t i = 0; i < arr.len_; i++) {
os << arr[i] << ' ';
}
return os;
}
};


This causes no memory leaks as when the object goes out of scope, it calls unique_ptr's destructor which deletes the array it owns.
>>
>>62407765
Don't be a jack of all trades. Master a single language.
>>
>>62406449
so i havent touched c++ and the correct way to use c++ in a few months, this post flooded my mind with knowledge i thought i'd be rustier at.

ty anon
>>
>>62407401
do your test yourself
>>
>>62407820
Im not trying to do anything more than bettering my Java so I can get a job, and C/C++ to do something better eventually, as far as I am concerned I dont have any stuff I want to do that isnt better served by other stuff anyways
Thats not really jack of all trading, I assume
>>
>>62407357
Standard streams comprise input, output and error streams.

The error stream is a frequent source of confusion. Despite being called the "error" stream, it's really meant as a "user" stream; data meant for the user should go there. If your program's purpose is to calculate a number, the number and nothing else should be written to the output stream while any message or log should be written to the error stream. With this design you can do a lot of nifty things, such as having your terminal show messages from the program even if you pass the output to another program, or redirecting the messages to a file while the output goes to another program, or saving just the output to a file while printing the messages on the terminal.

C and C++ standards do not specify more than the fact the standard streams exist; it's up to the implementation to define semantics for them. In Unix, standard input and output are line buffered, while standard error is unbuffered. If you read from standard input, you always get an entire line buffer's worth of data. If you write to standard output, you're really writing to a buffer (an array of characters really) maintained by the standard library implementation, and that buffer will only be written to the actual kernel file descriptor when you write a new line (\n) into it. When you write to standard error, the standard library will write your data to the file descriptor immediately without buffering. The implication being: you could write something to standard output, then to standard error, and the error message could appear before the output.
>>
>>62407665
>starting from a ridiculous premise that Lisp is the most powerful language out there
Didn't care to read the article, but feel free to name a language more powerful than, say, Common Lisp. Protip: you will repeatedly fail to do so.
>>
File: prophet_of_lisp.png (156KB, 995x582px) Image search: [Google]
prophet_of_lisp.png
156KB, 995x582px
>>62407398
This is the author's GitHub, btw.
>>
>>62407833
You're welcome anon.
>>
>>62407904
C++
>>
>>62407904
scheme
>>
>>62407742
>This is just false, mostly because the author understands neither Haskell nor OCaml. To be honest, I doubt he understands Qi either.
You don't understand Haskell, OCaml, any dialect of lisp or anything besides javascript.
>>>/wdg/
>>
>>62407895
Thanks a bunch.
>>
>>62407914
>C++
Doesn't let you do 1% of what you can do in CL. C++ is a sad joke.

>>62407934
>scheme
In what way is it more powerful than CL? It's just a lisp with a weaker macro system and no standard library.
>>
>>62406527
je peu uh, frotter en mon francais pour l'ammelieurer si vous voulez un programmeur functional je peu venir a paris

parce que j'travaille pour €48k mais le job est en java et je veux me tuer parce que enterprise programming est merde.
>>
explain vagrant to me like I am a retard
>>
>>62407967
Vagrant is an open-source software product for building and maintaining portable virtual software development environments,[4] e.g. for VirtualBox, Hyper-V, Docker, VMware, and AWS. The core idea behind it lies in the fact that the environment maintenance of virtualizations becomes increasingly difficult in a large software development project. Vagrant simplifies the necessary software configuration management in order to increase development productivity. Vagrant is written in the Ruby language, but its ecosystem supports development in almost all major languages.
>>
Why are more new languages targeted at LLVM (Rust, Go), when you can write a fronted for both LLVM and GCC and GCC is both faster and has more targets?
>>
>>62407961
>Doesn't let you do 1% of what you can do in CL
Fucking hell, it's obvious you've never programmed anything relevant in your life.
Templates alone make C++ one of the most powerful programming languages out there.
>>
>>62407403
Buffers are used to increase performance.

Actually writing to file descriptors is a costly operation that involves a system call and therefore a transition to kernel mode. Minimizing the number of system calls is desirable. The easiest method is to write as much data as humanly possible all at once.

That's what the buffer does. It batches your data for later writing until it either hits a physical limit (buffer is full) or a logical one (line ending was output, a logical line is ready to be written out). When the limit is hit, the buffer is "flushed out" to the OS, thereby writing all the data in one sitting.
>>
>>62407979
because writing a frontend for GCC is hellish
>>
>>62407904
"Powerfulness" of a language is a meme, that's the point. There are many factors at play that explain why different languages are good for different tasks. But I would say Haskell is way more expressive, safe and maintainable than CL, and Idris is more expressive than Haskell.
>>
>>62407964
I don't speak French but Google Translate to the rescue. Drop an e-mail address?
>>
>>62406742
Figure out how much money they're going to make off your software, and charge based on that.
>>
>>62407961
Imagine when this brainlet >>62407981 actually tries lisp one day and discovers macros
>>
>>62407981
I don't think you've ever learned a Lisp before.
What's even the point of templates if you have dynamic typing?
>>
>>62407981

the most powerful language is brainfuck, doesn't mean you should use it.
>>
>>62405707
Learning it right now!! I'm actually really liking it; there are a lot of rules you have to know to sort of understand it, but once you do, it doesn't pull anything funny (at least from what I've seen)

Is there a better way of doing this:

{-Using takeWhile and dropWhile, write a function
that takes in a string and returns a list of each word (space-delimited)
removeWSFromString "This is a test" == ["This", "is", "a", "test"] -}
isWS :: Char -> Bool
isWS c = (c == ' ')

removeWSFromString :: [Char] -> [ [Char] ]
removeWSFromString str
| (str == "") = []
| otherwise =
strToProcess : removeWSFromString nextStr
where strToProcess = takeWhile (not . isWS) str
nextStr = dropWhile isWS (dropWhile (not . isWS) str)
>>
>>62406297
tweag?
>>
>>62407993

except you can't actually do anything with haskell other than wanking yourself
>>
>>62407967
It's a ruby DSL for specifying how you want your virtual machine to be like.
>>
>>62408006
>muh superior metaprogramming
Fuck off.
>>62408012
>I don't think you've ever learned a Lisp before
I finished the little schemer a few weeks ago and I'll probably pick up the seasoned schemer or land of lisp sometime in the future.
Lisp is interesting but constantly jerking off over it is laughable.
>>
>>62408028
replied to wrong post
>>
>>62408016
There's a standard library function that does that, I'm not sure if there's a better way to do it yourself though
>>
>>62407936
Is this supposed to be an argument or what? I doubt even the author of Qi/Shen would claim that "It implements most of the unique features of Haskell and OCaml", only an uneducated fanboy would do that.
But it's funny you've mentioned JS, because it looks like it's the only thing that the author understands: >>62407909.
>>
>>62407981
>thinking C++ template metaprogramming is somehow "impressive" when compared to CL's metaprogramming facilities
You just have to be baiting.
>>
>>62408043
Found the blub programmer http://www.paulgraham.com/avg.html
>>
>>62408040
So, to simplify virtual machine deployment? Kinda?

>"Here's our project build and vagrant scripts to test it"
Like that?
>>
is scheme to CL what is C to C++?
>>
File: 1505313763.png (23KB, 679x277px) Image search: [Google]
1505313763.png
23KB, 679x277px
>>62408016
removeWSFromString = words


Look in the source to find out a nicer way.
>>
>>62408097
>implying I was comparing C++ templates to Lisp macros
Learn to read, brainlet.
>>62408099
>Eric Raymond
Stopped reading there. He's only ever produced one thing of value in his entire life (no, not maintaining intercal) and now he's completely irrelevant.
>>
>>62406297
Can anyone remind me that site teaching C+FreeBSD+fastcgi stack usage? Can't find it
>>
>>62408099
>don't be close minded and try other languages because your language isn't as perfect as you think
>unless you're using lisp, then it's just perfect
Every time.
>>
File: worksonmymachine.png (31KB, 200x193px) Image search: [Google]
worksonmymachine.png
31KB, 200x193px
>>62407403
>>62407986

To see how buffers increase performance, see for example the dd command:

https://unix.stackexchange.com/questions/322223/why-dd-takes-too-long/322397

The default buffer size is 512 bytes, it might as well be zero in 2017. If you set it to something such as 16 megabytes, reading and writing performance will improve by orders of magnitude.

>>62408101
Pretty much.

>It leverages a declarative configuration file which describes all your software requirements, packages, operating system configuration, users, and more.

You use a language to tell vagrant which OS, packages, configuration files, user accounts, etc. you want the VM to have and I suppose it does it for you. Since it's a declarative program, the VM should be reproducible and eliminate pic related.
>>
>>62407993
>There are many factors at play that explain why different languages are good for different tasks
>many factors
Unless you're doing some very low-level system programming or embedded programming stuff, the only relevant factor to the discussion is being able to hire replaceable, semi-competent code monkeys and have them produce code that can be understood by subsequent code monkeys.
>>
>>62408028
yes
>>
>>62408170
Wew, sounds cool. thanks fampai
>>
>>62407699
It is. It's definitely possible to write clean and readable JS/PHP code. But it doesn't force you to, so it gets the reputation of an ugly language. And most of the decisions are justified. '5' + 3 = '8', 5 + '3' = 53, '5' - 3 = NaN all make the most possible sense, and removing something that people might want to use doesn't really make sense. So keeping them is the logical thing.
>>
>>62408134
C++ is a babby-tier language and templates are a sad joke.

Remember, kids:
Ignore sepples posts.
Do not respond to sepples posters.
Sage sepples threads.
>>
>>62408202
t. idiot whose greatest achievement is a CL fizzbuzz
Stop being an elitist cunt.
>>
>>62408183
Another cool development virtual machine thing I found are cloud IDEs like cloud9 and many others.

They give me an ubuntu VM full of dev packages, a terminal, file system browser and editor on a webpage. It's completely eliminated the pain of setting up linux shit on windows for me.
>>
>>62408096
I don't care about your meme article. I didn't even read it. The sad truth is that if you think Haskell has anything on a garden variety lisp when it comes to flexibility and abstraction, you clearly don't know either.
>>
>>62408222
>sepples templates are powerful
>this is what sepples babby-tier "programmers" actually believe
>>
>>62408263
but they are
>>
>>62408263
>he thinks shitting on C++ just to fit in will make him look competent
wew lad
>>
>>62408202
This is why people hate lisp zealots. Nobody said you only had to know or use 1 language.
>>
>>62408263
Relatively speaking, yeah. C++ isn't Haskell or CL but neither are most languages.
>>
>>62405687
Doesnt happen with JS and PHP, get to town already
/g BTFO
>>
>>62408280
>>62408294
>>62408295
>butthurt sepples fags
Give me any example of a task that you think can be accomplished more easily and elegantly in C++ than in Common Lisp. (Impossible mode: pick something that doesn't involve playing with pointers).
>>
>>62408355
>more easily and elegantly
moving the goalpost
btw the burden of proof is on you. give me one example of a task that you can't do with c++ templates
>>
>>62408370
partial specialization of member functions
>>
>>62408355
I don't even use or care about C++. My comment was solely about your inane shitpost (>>62408202).
>>
>>62408233
> you don't know things because your opinion contradicts mine and I actually know things because Paul Grahm agrees with me and he knows things too
But hey, what's up with moving goalposts? The original quote was
> [Qi] implements most of the unique features of Haskell and OCaml. In some respects, Qi surpasses them.
Which is demonstrably false, and not even the author of Qi/Shen claims it. This means the author of the article knows nothing about Haskell and Qi, and just pulls claims out of his ass. I've said nothing about "flexibility" and "abstraction". But hey, you can demonstrate I'm wrong by showing to me how Qi surpasses Haskell in its unique features, starting with static typing, type classes, and monads.
>>
>implying anyone unsarcastically uses templates for anything more complicated than vectors
>>
>>62408355
Nobody except you ever compared C++ and CL. They have nothing to do with each other. You're a fucking retard.
>>
>>62408355
> Give me any example of a task that you think can be accomplished more easily and elegantly in C++ than in Common Lisp
Writing a fast, small, maintainable program with a reasonable memory footprint.
>>
>>62408370
>the ability to do things easily and elegantly is moving the goalpost
Are you retarded? You can do everything in x86 assembly, too. Ease and elegance are the major yardsticks. If there's almost nothing in C++ that you can't do more easily in elegantly in CL (which is very much the case), C++ is clearly inferior.
>>
If you can learn a language "100%", it's a silly toy language with massively limited functionality that forces you to reinvent every wheel you want to use.
>>
>>62408413
That's actually an example of something that is impossible to do at all in C++. (Protip: it's as easy for others to dismiss your arbitrary assertions as it is for you to make them).
>>
>>62408410
>Nobody except you ever compared C++ and CL.
It was, hilariously enough, touted as an example of a language more powerful than CL, and these drooling retards (yourself included) are responding to that exchange. Get sterilized ASAP, brainlet.
>>
>>62408491
no are you retarded?
>>sepples templates are powerful
>>this is what sepples babby-tier "programmers" actually believe
first he was talking about c++ templated not bwing powerful, then about ease of use and elegance. kys
>>
>>62408548
C++ templates are a joke, and anyone who uses them in real-world projects should be shot. Thanks for demonstrating the truth of this statement by posting in this thread.
>>
>>62408572
>moving the goalpost once again
thanks for demonstrating your stupidity
>>
>>62408538
No it wasn't, learn to read you utter mongoloid. But kill yourself first.
>>
File: lisp_is_slow.png (30KB, 650x366px) Image search: [Google]
lisp_is_slow.png
30KB, 650x366px
>>62408520
How is it arbitrary? Are you implying C++ isn't fast or that Lisp doesn't rely on GC?
>>
>tfw you program everything in batch
Give it to me straight lads, am I autistic?
>>
>>62408595
>poting rigged benchmarks
dumb sepples poster
>>
>>62408572
The only thing that is truly a joke in C++ is the binary interface. Nothing will ever, ever be able to interface with a C++ binary.

Only another C++ program compiled side-to-side with the original one has a hope of ever talking to it.
>>
>>62408572
>real-world projects
You mean something Common Lisp is completely unfamiliar with?
>>
>>62408588
Yes it was, you subhuman. You can trivially prove it to yourself by following the chain of exchanges, starting from here:
>>62407904
>>62407914
>>
>>62408608
>Nothing will ever, ever be able to interface with a C++ binary.
D
>>
>>62408604
Lispers are truly the flat-earthers of programming languages.
>>
>>62408608
Even then it will only work if it's compiled on the same version of the same compiler.
Thank god for extern "C" or the language would have no stable ABI at all.
>>
>>62408586
>not understand what simple words like "powerful" mean
>being a drooling sepples retard
You are a living argument for forced sterilization. If there's nothing your "powerful" language feature enables that can't be done with greater ease and elegance using different language features, then what is your language feature powerful compared to? C? Basic? x86 assembly?
>>
>>62408617
See >>62407993, brainlet. The question itself was fallacious from the very start.
Now promptly fuck off.
>>
>>62408624

Good luck.

>>62408639

Yeah. I think it's ironic that the only way to do C++ libraries right is to wrap them in a C interface because only C is able to actually implement the standard SystemV ABI the rest of the OS uses. It's just stupid.
>>
>>62408595
I'm implying that your moronic and irrelevant statement can be trivially dismissed, and that your cute little chart doesn't make it any less false.
>>
>>62408670
Your right to exist is a meme. Please kill yourself, brainlet.
>>
>>62408615
http://www.clausbrod.de/twiki/pub/Blog/DefinePrivatePublic20090620CommonLispInCoCreateModeling/els2009_lightningtalk_common_lisp_in_cocreate_modeling.pdf
>>
>>62408674
>Using Unix
There is your problem, Unix and everything derived from it needs to die and fast.
>>
>>62408684
>I can just dismiss the arguments I don't like
Whatever you say.
>>
>>62408707
>I have no arguments
It's ok faggot, you can have the last word if you want :^)
>>
>>62408724
>my arbitrary assertions are arguments
Nope. Kill yourself.
>>
>>62408718
>hey look one guy is using CL for some shit
Nice. I can also get a huge list of "real world projects" that use Haskell or even OCaml, doesn't mean they're any good outside of very specific niches. Face it, Lisp's golden age is gone and nobody uses it outside of academia and some very niche firms.
>>
Anyone here using Electron? Thoughts on it?
>>
>>62408608
what are you talking about?
If we have a library L and an application that uses said library A, are you complaining about having to compile A when changes are made to B?
>>
>>62408718
See picture.

>>62408759
Try calling a C++ function from Python.
>>
>>62408725
>hurr durr power is a meme!
>this is considered an "argument" on /g/
Kill. Your. Self.
>>
>>62408756
>hey guys lets bundle chromium and node.js together

It's the most pointless thing I've ever seen. Just make a regular web application
>>
>>62408759
Exported C++ functions may as well not exist for how unstable the name mangling is.
>>
>>62408754
I don't think academia uses lisp anymore too, except maybe Scheme/Racket for teaching.
>>
>>62408156
The only thing that comes to mind for me is learnbchs.org
>>
>>62408807
Eh, I need to use the user's connection.
>>
>>62408851
What?
>>
>>62408789
I am right though Unix and it's derived need to go.
>>
File: kill you so hard.jpg (65KB, 680x383px) Image search: [Google]
kill you so hard.jpg
65KB, 680x383px
>>62408873
>>
File: 1467818013202.jpg (48KB, 466x601px) Image search: [Google]
1467818013202.jpg
48KB, 466x601px
>>62408873
But can your beloved Windows ship with a compiler that supports C99?
My OS can.
>>
Some simple oauth2 service with a frontend which I will need for the other services I'm going to program.
Basically building a infrastructure which will connect with all my devices and data without big companies fucking me in the bum.
Already bought a domain and root server. Mostly because I like the idea to have my own infrastructure which I will use on a daily base.

After my oauth2 server I will build a personal app store with different application I already programmed.

Then I will create a service for my passwords and shit like last pass.

I use typescript with angular2, Java, c/c++ and python.
>>
>>62408920
>Then I will create a service for my passwords and shit like last pass.
Please don't. Unless you have several years of experience with crypto code as well as netsec and/or a skilled team of auditors you can pay as you go along, just don't.
>>
>>62408918
Windows is so shit they virtualized the entire OS. Now all new development is C# and all programs run virtualized on top of the common language runtime. The CLR is the new Windows.
>>
>>62408754
>judging languages by popularity
Inherently the same as judging anything else by popularity. You can look at what's popular and get a pretty good idea of what to avoid, but the fact is that real world projects can and have been written in Lisp with great success.
>>
>>62408941
At least he's not a PHP moron storing CC data in the clear on the database.

>>62408920
Install and configure cryptographic port knocking on your "root server" so that it will drop all packets and refuse to open any connections unless a cryptographically signed packet is sent to it first. It will be virtually unhackable and no one but you (and your host's sysops) will be able to access any of the services offered.
>>
>>62408941
Nah, I won't write my own crypto stuff, so I'm fine. Passwords will be encrypted on my device using a master password and then will be syncd with the server over https. They will never be a clear text password send over the wire.
>>
>>62408918
We just need something that is actually good, Unix isn't good and neither is Windows.
>>
Why must mobile development be such a cluster fuck?
Like what's so hard about making operating system that provides C api for system stuff and GUI?
But no they have to go full retard and make their own jvm implementation and require that every graphical application is started as jvm program.
And they only provide API for one retarded languages like java or objective-c. Ok there's ndk but it's limited.
Fuck Google and Apple for ruining mobile development.
>>
File: 1492599981663.png (54KB, 250x347px) Image search: [Google]
1492599981663.png
54KB, 250x347px
>>62409035
I'm sure you'll be able to come up with the next Right Thing.
>>
>>62409038
>waaaahh
>>
>>62408829
That's it!
Danke
>>
>>62409038
And your point is?
>>
File: 1485652958941.jpg (131KB, 591x800px) Image search: [Google]
1485652958941.jpg
131KB, 591x800px
Have you loved Lain today, /dpt/?
>>
what has been made using the power of lisp?
>>
>>62409020
>cryptographic port
I have heard of it before. It definitely sounds interesting. Thanks for the reminder, I will look into it.
>>
>>62409122
How do you love (fuck) a cartoon character?
>>
After 5 years of basically only using cpp I'm learning python. Why am I doing this to myself
>>
I'm working on coding a quiz thing in python which will have user accounts etc, I want to store the user account info ( their username and password hash or whatever) in a MySQL database. I have never touched MySQL before, does anyone have any advice or links to resources I should have a gander at? Cheers y'all.
>>
File: remiq_net_564.gif (588KB, 180x160px) Image search: [Google]
remiq_net_564.gif
588KB, 180x160px
>>62409055
I can't and I won't, I am not smart enough to be able to do that.
>>
>>62409038
Got you covered : https://medium.freecodecamp.org/building-a-node-js-application-on-android-part-1-termux-vim-and-node-js-dfa90c28958f
>>
>>62408789
>Try calling a C++ function from Python.
You can export the functions you need in C and then call those.
In R, you need to do a bit more, but it is doable.
>>
>>62409158
It's a simple concept.

What makes systems vulnerable is the fact they have to talk to literally anyone who opens up a connection. Some people will inevitably start sending it crafty payloads that make it explode.

So you configure the firewall so that the server can talk to nobody. It blacklists everyone. You make it so it works even at the most basic protocol level; your server can't even be pinged. It's as if it's not even there.

And then you configure a program that watches all incoming data for a special packet containing a valid signature that can be verified by a configured public key. If it finds this packet and verifies the signature, it allows the origin IP address to connect.

Now nobody but you can talk to your server.
>>
File: 1478953841419.png (59KB, 383x279px) Image search: [Google]
1478953841419.png
59KB, 383x279px
>>62409217
Tell me something I didn't already know.

>>62409233
I said "try calling a C++ function".
I didn't say "try calling a C function that calls a C++ function".
>>
>>62405984
this, desu. If you don't feel the fire in your loins to program 24/7 and you're studying CS, kys.
>>
>>62409158
>>62409247

Be aware of NAT though.
>>
>>62409282
Just because you're exporting a C++ function with C linkage conventions doesn't mean it's no longer a C++ function.
>>
>>62409282
That is how things are done though.
You make a function and then you make an interface for it.
>>
>>62409353
Yeah, thanks lad. I will program the password service as my last one. I have been kinda looking into other commercial password services just to see how they implement it. But it will probably takes lot of time on application side and configuration on server side. But that's OK I'm doing it for fun.
>>
>>62409124
>how to google?
https://en.wikipedia.org/wiki/Dynamic_Analysis_and_Replanning_Tool
http://www.cyc.com/
http://maxima.sourceforge.net/
https://franz.com/success/
>>
>>62409215
python + lampp stack.
>>
>>62409282
> I didn't say "try calling a C function that calls a C++ function".
Is this a C or a C++ function?
extern "C"
int my_atoi(const char* str) {
std::istringstream iss(str, strlen(str));
int i = 0;
iss >> i;
return i;
}
>>
>>62409449
sepples function because it does not compile with C compiler
dump sepples poster
>>
>>62409477
anyone who uses the name sepples without a hint of irony is the kind of moron who cannot follow a conversation for more than two posts
this post confirms it for me
>>
>>62409477
but it does, nigga
>>
>>62409358
You're not actually exporting a C++ function.

You're creating a new C function and calling the original C++ function from within it.

Completely different things.

>>62409391
Yes. Because C++ functions cannot actually be exported. You cannot even rely on the ABI being stable between different versions of the same compiler.

>>62409449
It's a C function. Try overloading it. See what happens.
>>
>>62409512
s@localhost ~ $ cat sepples.c 
extern "C"
int my_atoi(const char* str) {
std::istringstream iss(str, strlen(str));
int i = 0;
iss >> i;
return i;
}

int main(void)
{
return my_atoi("test");
}
s@localhost ~ $ cc sepples.c
sepples.c:1:8: error: expected identifier or ‘(’ before string constant
extern "C"
^~~
sepples.c: In function ‘main’:
sepples.c:11:9: warning: implicit declaration of function ‘my_atoi’ [-Wimplicit-function-declaration]
return my_atoi("test");


but it doesn't, nigga
>>
>>62409477
We're talking about C++ though. You can create C functions from within C++ code.
>>
>>62409502
Anyone who uses and defends C++ without a hint of irony is the kind of moron responsible for the pathetic state of the software world. You "people" deserve nothing short of violence.
>>
>>62409547
>poorfag compiler
ayylmao
>>
>>62409556
impossible
>>
>>62408392

It's not about Qi itself.
Lisp is just incredibly powerfull, since you are basically writing programms, that write programms.

So it would not be too hard to implement Haskell in Lisp:

>https://gergo.erdi.hu/blog/2013-02-17-write_yourself_a_haskell..._in_lisp/


But that's not the point either. Langauges are not only great bacause of what you can do, but also because of what you CAN'T do (which is the whole point of types, for example).

It reamins true that Lambda calculus originally had no types and Lisp is a very close implementation of the original lambda calculus. Much closer than C is to the turing machine.

But that's exactly the problem of Lisp:
It's too powerfull.
>>
>>62409589
A few incompatibilities notwithstanding, it's very possible.
>>
>>62409477
>sepples function
This means you can call C++ function directly, and whoever wrote >>62409282 is wrong.
>>62409538
> It's a C function.
Then why can't I compile it with C compiler?
>>
>>62409593
No sense arguing with brainlets. I just wanted to point out that Haskell-like type systems can and have been added on top of lisp using lisp.
>>
>>62409538
$ echo 'extern "C" int foo() { return 0; };' > main.cpp; g++ -c main.cpp 
$ nm main.o
0000000000000000 T foo

There's only one symbol in my symbol table, no wrapper to be seen.
>>
File: mccarthy on lambda calculus.png (40KB, 546x317px) Image search: [Google]
mccarthy on lambda calculus.png
40KB, 546x317px
>>62409593
> Lisp is a very close implementation of the original lambda calculus
This is a common misconception, Lisp has nothing to do with lambda calculus, it just uses the notation.
>>
Can you just write everything in a low level language like C, C++, or Rust? Should you? Is there even any point to Java, C#, and all that other crap that needs you to install various runtimes and such?
>>
>>62409609
>whoever wrote >>62409282 is wrong.

I'm not wrong. Check the ELF symbols. You will doubtless find the two functions you declared: one fucked mess of a name that points to the C++ function, and the clean C function name that was actually exported as the program's ABI.

>Then why can't I compile it with C compiler?

Because the function definition contains C++ code. The function declaration however is C.

>>62409648
Duh. You declared exactly one function with C linkage.
>>
Why is someone else code always so confusing!
>>
File: consider.jpg (29KB, 600x600px) Image search: [Google]
consider.jpg
29KB, 600x600px
new thread, though
>>62409722
>>
>>62409606
so... not C
>>
>>62409664

Nice quote from outta nowhere.

This is the fixed point calculator in original lambda calculus:
Y = λf. (λx. f (x x)) (λx. f (x x))



This is the same Racket:
(define Y (λ(f) ((λ(x) (f (x x))) (λ(x) (f (x x))))))



Isn't this close than Haskell?
In syntax as in the underlying logic?
newtype Mu a = Mu (Mu a -> a)
y f = (\h -> h $ Mu h) (\x -> f . (\(Mu g) -> g) x $ x)



Also read the original paper, to see how closely Lisp was is tied to (or "inspiered by", if you perfer that?) lambda calculus:
>https://docs.google.com/viewer?url=http%3A%2F%2Fwww.cs.berkeley.edu%2F~christos%2Fclassics%2Flisp.ps
>>
>>62409955

Sorry, here is better link:
>http://www-formal.stanford.edu/jmc/recursive.pdf

Also check my double dubs.
Double dubs don't lie.
>>
>>62409955
If lisp implements lambda calculus, then (by your logic) so does javascript. You can likewise implement the Y combinator there and manually emulate currying (which lisp does not support).
>>
Guess this might be a good place to post it.
I have this weird error when pasting code here.
I get "connection error" / Access-Control-Allow-Origin doesn't exist when I paste code.
I think it might be an encoding issue, but I have no idea where to solve it.
Writing the stuff inside firefox works for some reason (why I can write this).
When I check the text for non ascii chars, nothing comes up.
Does anyone know?
>>
>>62409538
Say you have a function you have written in C++.
You then make an extern function for it.


#include <iostream>

void fizz_buzz(size_t max, size_t f=3, size_t b=5){
for(size_t i = 1; i <= max; ++i){
std::string p;
if(!i%f){
p += "fizz";
}
if(!i%b){
p += "buzz";
}
if(p.empty()){
p = std::to_string(i);
}
std::cout << p << std::endl;
}
}
extern "C" {
void fizzbuzz(size_t max, size_t f=3, size_t b=5){ fizz_buzz(max,f,b); }
}
>>
>>62410518
Then you compile it to a library
g++ -std=c++11 -c -fPIC fizz.cpp -o fizz.o
g++ -shared -o fizz.so fizz.o

You can run it in python
#!/bin/python
from ctypes import cdll
lib = cdll.LoadLibrary('./fizz.so')
lib.fizzbuzz(100);

So you think that if I didn't write the extern command, everything would be "native", but as long as I use it, I am writing C code?
>>
I don't understand why there's a difference between those two kinds of variable initializations in C++11:
int i(3.14);
int i{3.14};
Why does the first one just get truncated while the second one return an error?
>>
>>62410537
The body of the function is irrelevant. It all compiles down to assembly, at which point there's no distinction between C and C++. What's relevant is the calling scheme and naming convention, and extern "C" exports a C function in that regard. The original language the body of the function is written in is irrelevant.
>>
>>62409449
It's a C++ function (the body uses C++ features, so it won't compile in C) with C linkage. The fact that it uses C linkage means that its prototype can't use types which don't exist in C (e.g. templates, pointer-to-member).

>>62409538
> You cannot even rely on the ABI being stable between different versions of the same compiler.
You can't even rely upon the ABI being stable with the same compiler but different compilation switches.

> Try overloading it.
You'll get an error, probably a duplicate definition error. Functions with C linkage don't have their names mangled, so overloads will have the same name regardless of their arguments.
>>
>>62410824
So the "problem" is you cannot call
name_space::class.function
and you have to make it a C like function?
>>
>>62410837
I still don't see what the problem is here.
You can write function or class any way you want in C++ as long as the interface is as simple as you would make it in C.
Is this a problem in any way?
>>
>>62406878
Because rule-based AI was shit in general, and neural network machine learning shit started getting tryndee.
>>
>>62410577
The first is variable initialization, the second is a initializer list.
Use the first one. always.
Thread posts: 330
Thread images: 38


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.