[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: 343
Thread images: 32

File: battle programmer shirase.jpg (37KB, 640x480px) Image search: [Google]
battle programmer shirase.jpg
37KB, 640x480px
Previous Thread: >>57395045


What are you working on, /g/?
>>
File: shit font tbh.png (573KB, 587x551px) Image search: [Google]
shit font tbh.png
573KB, 587x551px
First for Haskell
>>
>>57401138
>anime
not technology
>>
Can someone help explain the n-i part of random? n is size of deck.
I understand it's a better method of shuffling versus just producing a number from 1-52 every-time.
Just want a better understanding as to why that is.

//Shuffle 52 card deck
for (int i = 0; i < n; i++) {
int r = i + (int) (Math.random() * (n-i));
String temp = deck[r];
deck[r] = deck[i];
deck[i] = temp;
}
>>
So i want to learn programming but i am not gonna have limited internet. Is there something i can dowload/buy that will show me a video and then have me try it myself?
>>
>>57401240
Get a book.
>>
>>57401240
K&R
>>
File: IMG_2799.gif (17KB, 140x192px) Image search: [Google]
IMG_2799.gif
17KB, 140x192px
>>57401219
Ask the Don
>>
>>57401219
i + (int) (Math.random() * (n-i))

[Math.Random()] is a real number in the range [0, 1]

[(int) (Math.random() * (n-i))] is an integer in the range [0, n-i]

[i + (int) (Math.random() * (n-i))] is an integer in the range [i, n]

It generates an integer between i and n
>>
>>57401185
Except that one is, it's Battle Programmer Shirase.

Shut the fuck up or I'll DOUBLE COMPILE your anus.
>>
Can someone explain me pointers? i know it's to point to some other stored value but why?
>>
>>57401328
http://duramecho.com/ComputerInformation/WhyCPointers.html

This explains it best imo.
>>
>>57401328
So you don't have to copy the stored value around.
>>
>>57401328
int a = 1;
addOne(&a);

void addOne(int *p){
*p +=1;
}


I actually took the time to copy paste my example for you
>>
First for low-latency Javascript apps!
>>
>>57401441
>apps
It's called programs.
>>
>>57401276
I understand but why between i and n and not 0 and n
>>
>>57401138
Why are some anime so badly drawn?
>>
>>57401458
No, it's called cancer.
>>
>>57401404
So is this to not create another extra value in the function? am i understanding that right?
>>
>>57401328
Pointers let you refer to the same piece of memory by different names and also to pass around these names. Like when you order something from the web, you give them your shipping address, which is a pointer to your house.
>>
>>57401404
>>57401507
Jesus no. This would be slower than just passing an int and returning the new int.
>>
>>57401441
>low-latency
>javascript
>>
>>57401507
Sort of yes, instead of copying the 'a' variable to the function you copy the address to the 'a' variable instead. When variables are bigger it's worth using pointers or preferably references
>>
>>57401540
No shit retard
>>
File: shot0033.jpg (310KB, 1920x1080px) Image search: [Google]
shot0033.jpg
310KB, 1920x1080px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>57401404
>not ++(*p)

>>57401328
>Definition: A pointer is a variable containing the address of another variable.
Wrong

>>57401328
>To do this one puts a ‘&’ infront of a variable to mean “give me the address of ”
Wrong

>>57401538
>them your shipping address, which is a pointer to your house.
Wrong

>>57401138
Thank you for using an anime image.
>>
>>57401603
consider suicide
>>
File: grid.webm (3MB, 598x598px) Image search: [Google]
grid.webm
3MB, 598x598px
Playing with Processing.
>>
>>57401603
Why is the probability you quote the wrong anon in all of your posts so high?
>>
>>57401328
pointers exist because your physical memory is divided into cells (blocks)
when a program executes some code, it needs an ADDRESS of the specific cells it's going to read data from in a memory array (your physical RAM or CPU cache or whatever)


think of memory like an apartment building IRL.
your data are the people living in it, and pointers are the address references for those people
(ex. apartment 205)

you cant just visit someone without knowing which apartment they live in first...
>>
How do I declare an object member variable in a header file of a class, and then initialize its constructor outside of a member initialization list?
>>
>>57401691
You don't, unless it's static.
>>
>>57401631
>processing

Literally just vanilla java diluted for braindead "visual artists". Use proper tools like C/C++ and OpenGL, or you'll quickly hit walls with that crappy processing shit.
>>
File: 1475143072125.jpg (15KB, 448x283px) Image search: [Google]
1475143072125.jpg
15KB, 448x283px
>>57401603
you're welcome
>>
>>57401723
But its constructor throws exceptions! What do I do?
>>
>u_int_2b_r_ntb_32_x64_sig = 2
lol c fags
>>
>>57401691
>initialize its constructor

What did he mean by this?
>>
>>57401735
That's exactly what function try-catch is for.

// Your class constructor
A::A()
: willthrow(arg) // Your throwing member ctor
try {

} catch(...) {
// Handle errors here
}
>>
>>57401603
>"A pointer is a variable that contains the address of a variable" -ANSI K&R
Kys weeb
>>
>>57401770
int *p = nullptr;
int *p = malloc(sizeof int);

nevermind that there's extra data too (size)
>>
>>57401761
Oh, I didn't know you could actually put try catches inside member initalization lists. Thanks so much anon, that's perfect.

>>57401750
Initialize the object using its constructor. Run the object's constructor.
>>
>>57401770
still wrong.
>>
>>57401810
>Oh, I didn't know you could actually put try catches inside member initalization lists. Thanks so much anon, that's perfect.
It's not actually inside the list, it replaces the body of the function.

Instead of
T f() {}

You can write
T f() try{} catch () {}
>>
>>57401803
A pointer does not contain size, you idiot. It's up to you to use it properly and not touch unallocated memory.
>>
>>57401831
>A pointer does not contain size, you idiot.
The type does, dumbass
>>
>>57401821
Wew
>>
>>57401849
compile time
>>
>>57401849
That's debatable. The following is valid, defined behavior, and the type doesn't include the size:
unsigned char* a = malloc(64);
printf("%d\n", a[1]); // The free may be arbitrarily far from the malloc, so no way to statically determine the size
free(a);
>>
>>57401885
It defines the size of the type you get from dereferencing, not the size allocated
>>
>>57401803
>>57401831
A pointer is SIMPLY A REFERENCE TO AN ADDRESS IN MEMORY.

sizeof( x ) is defined by your operating system and the architecture of your CPU...
for example sizeof( float ) will be different on 36-bit and 64-bit computers and such.

however if you do sizeof( * float ) (notice the pointer reference), it will always give you the size needed for allocating a single memory pointer, and not the size of bytes it takes to store the actual floating point variable.
>>
>>57401905
Except because of aliasing, this is meaningless.
time_t* a = malloc(sizeof(time_t) * 18;)
unsigned char* b = (unsigned char*)a;
printf("%d\n", b[1]);
free(b);
>>
>>57401913
*32-bit
>>
>>57401460
I think the rationale is that the deck is being partitioned between shuffled and unshuffled, so that no card will be swapped back to the same position except the last one. It also means cards are shuffled progressively worse as you iterate through.
>>
File: 6489.jpg (497KB, 2560x1440px) Image search: [Google]
6489.jpg
497KB, 2560x1440px
>>57401863
sorry, but contrary to Ritchie, i actually have studied PLT.
>>
>>57401947
It's time to ban anime, everyone
>>
>>57401905
Ok, I get what you're saying you nitpicking bastard. On a fundamental level pointers are just memory addresses. In the context of C, you also have the type you get when the pointer is dereferenced (except for void* which cannot be dereferenced).

Are you satisfied faggot?
>>
>>57401913
>a reference to an address
No, that would be int**
>>
>>57401960
>On a fundamental level pointers are just memory addresses
It's not nitpicking.
It's important, because otherwise, all pointers would be void pointers and they'd all be the same.
>>
>>57401966
No, that would be int*&
>>
I want to start learning how to make android apps since I know Java already.

I want to make an app with user accounts. How does one do that? Do I need to set up a server with a LAMP stack and then somehow connect the app to it or what? Kind of lost on this desu.
>>
>>57401953
no
>>
>>57401940
Interesting, I was thinking something similar.
>>
>>57401983
>C
>>
>>57401988
>I want to make an app with user accounts. How does one do that?
If you have to ask, I can already see the security vulnerabilities from here.
>>
>>57402002
>C
>>
>>57401940
False. A card can be swapped with itself if i == r.

If you're interested in the analysis of the algorithm, search for "Knuth shuffle analysis" and you can read the proper treatment which proves that it produces all n! permutations with uniform probability. You can probably also learn why 0 < r < n would produce a _non-uniform_ distribution.
>>
>>57402012
>Javascripty
>>
>>57402005
It's only for practice now. First figure this out then security. What vulnerabilities can you see?
>>
File: asmjs-wasm-comparison.png (16KB, 482x313px) Image search: [Google]
asmjs-wasm-comparison.png
16KB, 482x313px
>>57402023
>Deprecated
>>
>>57401991
It's clearly a cancer to the brain
>>
>>57401138
Recently I made some chef recipes that allow me to deploy a hadoop cluster on AWS EC2 with a single command and now I am able to practice distributed computing when I would want to and then destroy it when I am done with it.

Currently I am playing around with data processing with spark on this cluster.
>>
>>57401979
I'm arguing that the type is only for the compiler to know the dereferenced value's memory layout. You could rewrite your code to use void* everywhere and cast it to the correct type everytime you dereference it, and the compiler would treat it equivalently.
>>
>>57401960
>you nitpicking bastard
He's not. A pointer type is the combination of a type and an address; it's a typed address. The whole of point having pointers over mere addresses is the typing.

& doesn't return an address, this is a common error made by almost every C tutorial and even by the standard. No, what & actually does return is an pointer.

If you had learned assembly programming beforehand, you would have saw that on the first sight.
>>
>>57402036
>skinning
>< 1.0

Wtf, I smell bullshit.
>>
>>57401979
>It's important
It's not.
>all pointers would be void pointers and they'd all be the same.
They effectively are (practically all operating systems relies on that fact, and they even rely on function and data pointers being the same).
>>
>>57402097
The JIT was able to use hot new SIMD instructions, the compiler targeted older CPUs for compatibility.
>>
>>57402109
So they're cheating.
>>
>>57402129
Yep.
Whenever there's a JIT vs AOT benchmark, people always omit -march=native.
>>
>>57402136
webassembly still needs to be compiled, since it's not x86 asm.
>>
>>57402145
Yes, it gets JITed, this is exactly what this benchmark is about ...
>>
>>57402129
All interpreted languages should be disqualified unless their interpreter is bootstrapped in its own language, otherwise you could just submit the C++ version as v8 (that's your C++ source for the benchmark) + javascript code as just data to your C++ program.
>>
>>57402150
I guess I'm a little confused, so why wouldn't SIMD instructions be used?
>>
What's the point of the web?
Why don't social networks and wikipedia just make native apps?

If it costed just $1 or $2 advertisements would barely be useful.
>>
>>57402181
Because then everybody would want to have a native app. That's what we wanted to prevent in the first place.
>>
>>57402181
They do on mobile platforms.
>>
>>57402036
C clang:                        9.971914301 seconds time elapsed
C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed
Dart: 2.585097637 seconds time elapsed
Javascript node.js: 10.406505448 seconds time elapsed
Javascript SpiderMonkey: 10.216595020 seconds time elapsed


>>57402158
v8 is a jit compiler.
>>
>>57402169
The original codebase is in C++, it gets translated to JS/WASM through Emscripten.

WASM and asm.js are JITed by SpiderMonkey, firefox's JS engine, which is able to take advantage of SIMD instructions.

On the other hand when the C++ source is compiled with standard compiler options (-O2, no -march=native), the compiler has to assume the binary will run on older CPUs, and so it can't use all the latest SIMD instructions.
Sometimes, the compiler can build different versions of a function for different CPUs and use dynamic dispatch, but that's not done by default.

Since the benchmark was probably run on a recent CPU, the JIT has an advantage.
>>
>>57402210
>v8 is a jit compiler.
That's my point.
If Javascript beats your C++ version?
Submit v8 as your C++ version and now they are at least equal.
>>
Still working on my toy compiler.
>>
>>57402213
oh, i'm stupid.
>>
>>57402236
Yes, yes you are.
>>
>>57402195
>>57402200
Wait... what went wrong...
>>
>>57402229
the program to be benchmarked is still written in javascript.
>>
>>57402252
Normies. As always.
>>
>>57402275
No, they're written in C++.
>>
>>57402275
No, the javascript code is just data to your C++ program, no different from example a lookup table.
>>
All C++ programs should just be shipped as LLVM IR in the installer and codegen themselves on first use for maximum performance.

provemewrongprotipyoucant.jpg
>>
File: cutmylifeintopieces.jpg (27KB, 499x242px) Image search: [Google]
cutmylifeintopieces.jpg
27KB, 499x242px
>>57401138

I'm working on a calculator program and I'm having a weird glitch

for example if I enter the word "nigger" I get an error

If i use improper formatting "6+6" I get an error

If I put in a fuckhuge number or nonsensical characters "mogjswj939wgsg" "888888888" I get an error

But if I do pick related, I get an error. What can I do to fix this shit senpai? Heres my code for the input.


try
{

System.out.println("Seperate numbers with white space, such as 'A + B'");
System.out.println("Enter your calculation: ");

firstInput = in.nextInt();
operation = in.next(".").charAt(0);
secondInput = in.nextInt();

}
catch(Exception e)
{
System.out.println("Error: improper formatting detected.");

}

>>
>>57402252
What went wrong is people wanting to put application-like functionality on a website, which resulted in the abomination we call webapps, and the heap of crap known as (((javascript))).
>>
>>57402292
>>57402303
data that is used for jit compilation.

having something like

char *s = "function() { ... };"

compile(s).run();


doesn't change the fact that you wrote the program to be benchmark in javascript, you just embedded the source code into the hosting environment.
>>
>>57402336
This uses a switch btw, heres one of the cases (they are pretty much the same just with different operators)

 case '+':       
result = firstInput + secondInput;
System.out.println(firstInput + " + " + secondInput + " = " + result);
break;

>>
>>57402359
>doesn't change the fact that you wrote the program to be benchmark in javascript, you just embedded the source code into the hosting environment.
No, really, the programs to be benchmarked are written in C++.
Just because they get compiled to JS/WASM before being fed to the JIT, doesn't change that they're originally C++ programs.
>>
>>57402335
What is .NET for $100 alex.
>>
>>57402336
why the heck are you indenting like that
>>
>>57402336
> But if I do pick related, I get an error.

I DON'T get the error I put in in the try/catch thats the issue sorry guis
>>
>>57402402
Since when is .NET compiled AOT?
>>
>>57402381
ah, you are talking about doing

c++ -> emscripten -> llvm -> webassembly -> v8 -> machine code

in that case, yes it's c++
>>
>>57402335
All normies should install linux and compile from source.
>>
>>57402359
Whatever language produced the machine code for the entry point of the process is the language the program was written in.
>>
>>57402335
LLVM IR was never intended to be distributed. There was a lengthy discussion about this when Apple introduced "BitCode", where you would upload LLVM IR to the AppStore instead of a fat binary with multiple ARM architectures supported.
https://medium.com/@FredericJacobs/why-i-m-not-enabling-bitcode-f35cd8fbfcc5#.j3cijlrnc
>>
>>57402403
I'm not the code just looks fucky because I copy/pasted
>>
>>57402412
https://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.110).aspx
>>
>>57402420
And if they can't do that? Kill them?
>I'm all for it.
>>
>>57402425
>LLVM IR was never intended to be distributed
That's fine, compiled binaries are already not portable, so shipping LLVM IR instead changes nothing.
In my usecase LLVM IR doesn't have to be target-independant.
>>
>>57402427
That's pretty cool.
Won't change the fact that you can't write optimized code in .NET due to lack of language support (forced GC, no control over data layout, etc), but still cool.
>>
>>57402422
So, everything is written in assembly?
Pretty much every binary starts in a gcc/msvc provided _start routine.
>>
>>57402463
>no control over data layout
What is [Layout(LayoutKind.Explicit)]
What is stackalloc
What are unsafe{}/pinned/pointers
>>
>>57402483
That's the sound of forced bounds checking slowing you down on every memory access.
>>
>>57402425
nacl
>>
>>57402500
deprecated
>>
>>57402445
Fair point. But what I'm saying is that compiling from source can produce more optimized code than compiling from LLVM IR.

Source: http://lists.llvm.org/pipermail/llvm-dev/2011-October/043724.html
>>
>>57402499
>What are unsafe{}/pinned/pointers
You are fucking retarded.
>>
>>57402536
Nobody uses those.
>>
>>57402548
>Baww there no way to open this bottle
>How about you try twisting the lid?
>Literally nobody does that
You are fucking retarded.
>>
>>57402536
>Rust programs unironically need unsafe to do this
Why use this garbage?
>>
>>57401328
>but why
I haven't laughed that hard in a while. Thank you.
>>
>>57402567
Alright fair enough, I was being pretty retarded.
C# is getting surprisingly less shitty.
>>
>>57402576
We were on about C# nigger. Pay fucking attention.
I like rust's unsafe for pointers, it's like a safety on a gun. Nothing stops you flicking it off and removing a few of your own toes, but it stops accidents.
>>
>>57401966
Alright lets break it down:

int variable_name1 = 20;

What does that do?

>int
tells the compiler what type of data we are creating

>variable_name1
tells the compiler to ASSOCIATE the "variable_name1" handle with the MEMORY ADDRESS that the OS throws back to us
ei. variable_name1 means 0x000001aaa7831f20
an address in memory

>=
assign operator (what to do with that address in memory)

>20
overwrite that address in memory with the combination of bytes that represent the numerical 20 in integer form


Now lets look at:

int * variable_name2 = maloc( sizeof(int) * 20);

>int
same thing

>*
tells the compiler that we are creating a POINTER to some data

>variable_name2
same as before, the os will throw back a MEMORY ADDRESS
ei variable_name2 means 0x000001aaa781b3a0
the compiler will store that under the handle variable_name2 (for human purposes)

>=
same as before

>malloc
tells the compiler that we are allocating memory at the MEMORY ADDRESS of variable_name2 (0x000001aaa781b3a0)

>sizeof(int)
tells the compile the size of the data we are allocating

>* 20
allocate 20 times the size it takes to store one integer


So now we have variable_name2 that is an ADDRESS (just like variable_name1), but now the compile knows that the memory location at variable_name2 is not just a SINGLE integer, but multiple integers in succession
variable_name2 itself does not contain any information about the size of that data, only that it is a pointing to SERIES of integer type data

Now lets look at:

int ** variable_name3 = maloc( sizeof( *int ) * 20);

this tells the compiler to create a POINTER that points to a memory address that contains other POINTERS
>notice the sizeof( *int )
we are creating space for 20 pointers and not 20 integers, these pointers can point to OTHER memory addresses later on that contain the actual numerical data for our integers.
>>
>>57402626
stack my man
>>
>>57402626
>tells the compiler to ASSOCIATE the "variable_name1" handle with the MEMORY ADDRESS that the OS throws back to us
>ei. variable_name1 means 0x000001aaa7831f20
>an address in memory
Topkek. No, that's hilariously wrong.
Please understand that unless you take it's address, it might not even be stored in memory at all.
And if it does have to spill to memory, it will be pushed on your stack, not at a random address the OS throws back at you.
>>
>>57402626
Not reading any of this you fucking dumbass
I know what pointers are
>>
>>57402649
> it might not even be stored in memory at all.
Everything is stored in memory besides the assembly instructions (which are hard-coded in your CPU).
>>
>>57402696
what
nigger registers
>>
>>57402696
Oh wow, you really need to learn some humility, you're just making a fool of yourself.

Here's a hint, google.com?q=register
>>
>>57402696
Nigga wut???
>>
File: laughingWhores3DPDShiggy.png (2MB, 1786x1030px) Image search: [Google]
laughingWhores3DPDShiggy.png
2MB, 1786x1030px
>>57402696
>Everything is stored in memory besides the assembly instructions (which are hard-coded in your CPU).
>>
>>57402704
>>57402711
>>57402717
Reading a hardware register in "peripheral units" — computer hardware outside the CPU — involves accessing its memory-mapped I/O address or port-mapped I/O address with a "load" or "store" instruction, issued by the processor.

EVERYTHING OUTSIDE THE CPU
>>
File: 1458780613244.jpg (25KB, 704x528px) Image search: [Google]
1458780613244.jpg
25KB, 704x528px
>>57402696
>what is constant folding
>>
>>57402742
what
nigger the fuck
registers in your cpu
>>
var elements = document.getElementsByClassName('postContainer');
var com = document.getElementsByName('com');
var str = com[0].value;


for(var i=0; i < elements.length; i++) {
if(elements[i].getAttribute('id')[elements[i].getAttribute('id').length-1] == elements[i].getAttribute('id')[elements[i].getAttribute('id').length-2])
str += '>>' + elements[i].getAttribute('id').substring(2) + '\n';

}
str += 'checked :^)';
console.log(str);
com[0].value = str;


>>57401588
>>57401966
>>57401988
>>57402022
>>57402200
>>57402422
>>57402444
>>57402499
>>57402500
>>57402599
>>57402655
>>57402711
checked :^)
>>
File: retardedCongrats.png (178KB, 1190x906px) Image search: [Google]
retardedCongrats.png
178KB, 1190x906px
>>57402742
>Reading a hardware register in "peripheral units" — computer hardware outside the CPU — involves accessing its memory-mapped I/O address or port-mapped I/O address with a "load" or "store" instruction, issued by the processor.
That's literally the MOST RETARDED THING I've read on /g/ ever.

So you just googled hardware regiters, but you still don't know what a CPU register is!

>Accessing the CPU registers through MMIO
HAHAHAHA! How would you even issue a load or store if you don't have registers in the first place?
>>
>>57402742
>Reading a hardware register in "peripheral units" — computer hardware outside the CPU
dude like, what?
>>
>>57402742
Dude - this makes even less sense than:
>This is done by loading a secure hypervisor into CPU cache and acting as a gateway to encrypt memory paging in and out between the CPU cache and RAM.
>>
>>57402704
Simple flip-flop units in your cpu or gpu or whatever.

What does that have to do with how you're data is being stored in memory trough pointers?
>>
>>57402800
You don't understand, you need to access the "peripheral units" because of the rotational velocidensity of the register's hard drives backing store.
>>
File: 1374782163623.jpg (111KB, 500x500px) Image search: [Google]
1374782163623.jpg
111KB, 500x500px
>>57402765
how come /dpt/ has much more checks than other generals? you should provide inter-threads stats.
>>
How do you make a function run on multiple threads in bash on linux? I'm just filling an array with things but I'd like to do it with threads so it runs faster
>>
>>57402813
>What does that have to do with how you're data is being stored in memory trough pointers?
It has something to do with this statement being completely wrong.
>>
>>57402813
OK, you retard.

The compiler might - MIGHT - decide that a pointer in memory is fucking unnecessary because memory accesses are fucking slow. That's why the compiler MIGHT decided to use a fucking register instead of memory to hold a fucking pointer.

And when I write "MIGHT" I mean ´"that's the fucking job of this fucking program".

STFU if you got no clue of nothing, retard.
>>
>>57402696
No idea how you went from talking about variables to assembly instructions being stored in cpu.
>>
File: retard nip cartoon reaction.jpg (1MB, 2323x2067px) Image search: [Google]
retard nip cartoon reaction.jpg
1MB, 2323x2067px
>>57401480
>badly drawn
You mean, drawn to represent the average nip more accurately.
>>
>>57402823
try openmp
>>
>>57402823
Best answer: don't use threads.

Why? Because threads have their own overhead. They have context switches, not only for starting and stopping them, but also for simply executing them. That's the problem with kernel-scheduled threads - they can run on multiple CPUs, but they have context switches.

And threads only make sense if memory or I/O is not your problem, but the CPU. Filling an array does use the memory, not the CPU.

You should rather read a bit about vectorization.
>>
>>57402831
I think you have it wrong.

There is memory in both you CPU and your actual RAM.

The compile decides WHERE to keep the data.

Yes it can decide to keep it in your CPU's memory (L cache) or it might push it off to your RAM, but the data itself is still held in MEMORY.
>>
>>57402817
Ah, so the registers are now used as direct mappings to hard drive metadata? Or did I get that wrong?
>>
>>57402877
nigger do you not understand what cpu registers are
>>
>>57402877
We are talking about pointers, you nitwit. Not the data it points to. Admit it, you have mixed up arrays and pointers so thoroughly that you kinda think both are the same, even when they are not.
>>
>>57402877
>There is memory in both you CPU and your actual RAM.
YES, that is exactly what people are saying, CPU registers, fuck me

>The compile decides WHERE to keep the data.
NO NO NO, it decides where to keep the POINTER. THE ADDRESS. THE DATA IS NOT THE POINTER AND THE POINTER IS NOT THE DATA.
>>
>>57402853
The thing I'm writing is a script in bash.

>>57402862
I'd still like to use it though for the sake of knowing how to
>>
>>57402912
you seem to miss the point where he doesn't understand that registers exist, and thinks that cache is a directly addressable thing
>>
>>57402880
I don't know who's trolling who anymore.
>>
>>57402877
Oh fuck, now you're confusing the caches with registers.
BOTH OF WHICH DON'T HAVE A FUCKING ADDRESS, by the way.
>>
>>57402924
bash doesn't have threading, it has forking and that's it.
>>
>>57402930
I'm equally concerned about the entire ordeal. He doesn't seem to understand arrays, pointers, registers, the difference between pointers and data and arrays, the difference between registers and CPU cache, or even why addresses exist. It's like everything he posts is fundamentally wrong in some way.
>>
>>57402948
truly a great man
>>
>>57402948
So explain it then?
>>
>>57402972
nigger just use wikipedia and google
>>
>>57402972
I have a better idea:
>http://lwn.net/Articles/250967/

Read, and be quiet.
>>
>>57402972
m8, scroll up.

https://en.wikipedia.org/wiki/Memory_address

https://en.wikipedia.org/wiki/Processor_register

The whole point is that these two things can go together. That's all, that everyone has been saying.
>>
>>57402983
This is the only correct answer.
>>
>>57402945
Darn looking up something called gnu parallel so I thought I'd be able to
>>
>>57402984
Yeah we were talking about pointers tho.
What does it have to do with registers and how your compiler distributes that data on a lower level that you have absolutely no control over (unless you're writing in assembly)?
>>
>>57403015
You have control over this in C
>>
>>57403015
>Yeah we were talking about pointers tho.
No no no, we're talking about your claim that C pointers are stored in memory and only memory.

>What does it have to do with registers
Compiler puts things in registers sometimes.

>distributes that data
No

>no control
You have a reasonable amount of control.
>>
>>57403015
Compilers - optimizers in general - know a lot more about the hardware architecture you're compiling for than you'd ever be able to forget. That's why they try to utilize the hardware as good as they can. And shoving off memory accesses is something that all decent optimizers should be able to do - to a certain degree.
>>
Is there 3d math library for C?
>>
>>57403015
you were implying that a local like int a = 3434; would be not stored on the stack, or in a register
>>57403062
GLM
>>
>>57403062
>not writing his one lib
what are you? some kind of C# pajeet?
>>
>>57403068
>GLM
C++, not C, or am I missing something?
>>
>>57403044
>your claim that C pointers are stored in memory and only memory

What?
Nobody said anything about C pointers being restricted only to memory.
>>
>>57403094
>>57402742
>>57402696
>>57402626
>>
File: 00004.jpg (556KB, 2000x2000px) Image search: [Google]
00004.jpg
556KB, 2000x2000px
You have 10 seconds to create a packed structure of 4 variables that take up exactly 8bits of memory. GO.
>>
>>57403094

Nigger, don't even try.

>>57402696
>Everything is stored in memory besides the assembly instructions (which are hard-coded in your CPU).
>>
>>57403088
sorry, i read c++
>>
>>57403115
struct bla
{
uint8_t _1:2;
uint8_t _2:2;
uint8_t _3:2;
uint8_t _4:2;
};
[/code]
>>
>>57403083
There are few header only math libs but they provide all the functions.
There is kazmath but it's seems overkill for just some math functions.

I will make my own if there really isn't any usable library.
>>
>>57403115
union {
uint8_t a, b, c, d;
};
>>
>>57403118
I think you're confusing the word memory with the RAM component in your pc.
>>
>>57403155
I think you don't distinguish between memory and registers.
>>
>>57403144
>he actually answers to my post
wew
>>
>>57403155
registers can't be described accurately as memory
>>
>>57403167
Registers are a form of memory tho.
They are used to STORE instructions, pointers, and stuff.
>>
>>57403115
type Tiny_Type is mod 2**2 with Size=>2;
type Byte_Struct is record
A, B, C, D : Tiny_Type;
end record
with Pack;
>>
>>57403191
cute
>>
>>57403184
You're mixing up even base definitions here. Please go back to Kindergarten and start all over again, you went terribly wrong there.
>>
>>57403167
A processor register (CPU register) is one of a small set of data holding places that are part of the computer processor.

A register may hold an instruction, a storage address, or any kind of data (such as a bit sequence or individual characters).

Basically a form of memory in your CPU.
>>
>>57403210
https://en.wikipedia.org/wiki/Memory

Memory is how information is encoded, stored, and retrieved.

>STORED
>T
>O
>R
>E
>D
>>
>>57403236
>https://www.google.com/?#q=register+memory+difference
>>
>>57402617
Rust is the wrong language for any project, it can't do low level because overhead and for high level it buys you nothing. The safety system has holes in it so why bother having it at all? It's pure garbage.
>>
>>57403148
I think that's a structure that takes up 8 bits, with one variable with 4 aliases. Technically.
>>
>>57403253
I'm not talking about RAM.

Registers are a type of memory in your PC.
Just like how RAM (Random Access Memory) is a type of memory in your PC.
>>
>>57403290
>I'm not talking about RAM.

Memory IS RAM.
Everyone calls memory RAM, and nobody cares if you little autistic nutcase wants to pull a "technically" out of that one. Fuck off. Memory is RAM.
Memory is RAM.
Memory is RAM.
Memory is RAM.

Until you get it in your thick head.
Memory is RAM.
>>
>>57403316
All RAM == Memory, not all Memory == RAM
>>
File: grid2.png (45KB, 1800x600px) Image search: [Google]
grid2.png
45KB, 1800x600px
Playing with Processing.
>>
>>57403316
Is the CPU cache not Memory then?
>>
>>57403366
Memory is RAM.
Memory is RAM.
Memory is RAM.

Until you get it in your thick head.
Memory is RAM.
>>
>>57403366
> not all Memory == RAM
there ya go, bein wrong again
>>
>>57403385
CPU cache is SRAM, memory is DRAM. So no.
>>
>>57403403
>>57403403

Static random-access memory (static RAM or SRAM)

>memory
>e
>m
>o
>r
>y
>>
>>57403432
Until you get it in your thick head.
Memory is RAM.
>>
>>57403396
>there ya go, bein wrong again
I'm sorry, I'm drunk, honestly dont really know what tyhe ahument is about.
Please fogive me.
>>
>>57403447
Until you get it in your thick head.

https://en.wikipedia.org/wiki/Memory

Memory is how information is encoded, stored, and retrieved.
>>
what's even going on anymore
>>
>>57403366
That's not how equality works. Equality is commutative. You want subset notation.
>>
>>57403490
Memory is RAM.
Memory is RAM.
Memory is RAM.

I do not care how often I have to repeat this; I am more autistic than you are.
>>
>>57403499
anon has finally admitted that registers exist, so I'm happy
>>
>>57403510
Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.Memory is how information is encoded, stored, and retrieved.

I dough that.
>>
>>57403512
how can registers be real if buses aren't real
>>
>>57403371
Fuck off already we get it you're playing with your shitty language/whatever this shit is
>>
>>57403528
Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM.
>>
>>57403569
*ROM
>>
>>57403569
Everything that stores information on your PC is memory by definition.

Even that old crusty hard drive you keep all your porn on, yes that's memory too.
>Why?
Because it STORES INFORMATION.
>>
File: memoryAutism.png (58KB, 1300x350px) Image search: [Google]
memoryAutism.png
58KB, 1300x350px
>>
>>57403651
>>57403658
Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Groove street is king. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM. Apathy is death. Memory is RAM. Memory is RAM. Memory is RAM. Memory is RAM.
>>
>>57403659
This is like when you get a stack-overflow from a broken recursion function.
>>
>>57403115
Rust version?
>>
>>57403659
you're like a dude going to /hm/ and calling em faggots, do you realize how dumb you sound?
>>
>>57403659
This needs to be a 4chan banner.
>>
File: cameHereToLaughAtYou.jpg (34KB, 640x480px) Image search: [Google]
cameHereToLaughAtYou.jpg
34KB, 640x480px
>>57403697
>>
>>57403712
that's unfortunate, since we're laughing at you now
>>
>>57403668
Subtle, but you're still wrong.
>>
>>57403712
Who the fuck stores anime in fucking JPG?
>>
>>57403730
You're still wrong.
>>
>>57403750
no u
>>
>>57403760
nu
>>
Currently working on a simple Temperature control program for a PLC device:
http://pastebin.com/9mGCQQz3

Any comments welcome. The language is IEC 61131-3, Structured Text.
>>
should i actually post what im doing, since this is shitposted to hell?
>>
>>57403856
At this point just go to /b/, you're more likely to get serious programming discussion there.
>>
>>57403861
>/b/
>serious programming discussion

Welcome, newfriend.
>>
>>57403856
i'll look at it if i can understand it anon
>>
File: stopPosting.jpg (31KB, 410x307px) Image search: [Google]
stopPosting.jpg
31KB, 410x307px
>>57403893
That's the fucking joke, fagtron.
Holly shit I knew you were autistic, but that's going off the charts.
>>
>>57403893
i made a cow and bulls game :^)

enter a four digit number: 4444
1 cows 3 bulls
enter a four digit number: 0400
0 cows 1 bulls
enter a four digit number: 4000
1 cows 0 bulls
enter a four digit number: 1111
1 cows 3 bulls
enter a four digit number: 4101
2 cows 1 bulls
enter a four digit number: 4100
2 cows 0 bulls
enter a four digit number: 5555
0 cows 0 bulls
enter a four digit number: 6666
0 cows 0 bulls
enter a four digit number: 7777
1 cows 3 bulls
enter a four digit number: 4170
3 cows 0 bulls
enter a four digit number: 8888
1 cows 3 bulls
enter a four digit number: 4178
you guessed it in 11 trys :^)


only problem is I hate making something then lookingat hte solution becuase my way is always csgrad teir code.
>>
>>57403912
>I-I just pretended to be retarded
>how can they always tell someone is new?
>>
a hunt the wumpus game
>>
File: ironicShitpostingMoot.png (137KB, 534x400px) Image search: [Google]
ironicShitpostingMoot.png
137KB, 534x400px
>>57403924
Okay, no way you're real.

But I'm bored, let's play.
How long exactly have you been here, friend?
>>
>>57403906
Alright, here it goes.
I'm working on a VOIP protocol over WAMP(web application messaging protocol).
I have a client in c++ and a server in python 3.
They both partially work, but so far there seems to be some bugs in the /xffSM command(split message), which causes some weird race conditions. If anyone wants to experiment with them they're at:
https://github.com/agrecascino/WAMPVOIPServer
https://github.com/agrecascino/WAMPVOIPClientCPP
>>
>>57403922
stop putting the smiley caret every where even ironically it just makes you look 12 please stop ok
>>
>>57403972
Define "here".
>>
File: 1477688448752.png (125KB, 512x512px) Image search: [Google]
1477688448752.png
125KB, 512x512px
>tfw you don't understand <thing> but all the explanations are in terms of other things you don't understand
>>
>>57404007
m o n a d s
o
n
a
d
s
>>
>>57404006
In what year did you start lurking?
>>
>Your ban was filed on October 10th, 2016 and expired on October 12th, 2016 at 00:00 ET. The name you were posting with was Anonymous.
>Now that you have seen this message, this ban is now no longer active.
Literally what?
>>
>>57404025
2007 or 2008, I don't know.
>>
>>57403980
okay
>>
>>57404049
thanks
>>
>>57404028
Hiroshima has to cut expenses, so they have unified the message for warnings and bans.
>>
>>57403972
This is the first time I see moot actually makes sense.
>>
>>57404074
>implying it's moot
>>
How do I make my own programming language to program in?
>>
>>57404083
You need to write comments in assembly.
>>
File: Poole's Closed.jpg (30KB, 651x207px) Image search: [Google]
Poole's Closed.jpg
30KB, 651x207px
>>57404028
You probably have a dynamic IP, some fag intentionally got b& on October 10th, and 4chan thinks you're the same person.

>>57404044
Cool, mid 2007 for me.
I'm curious, do you only browse /g/?
It used to be my homeboard, but it's gone to complete shit.
>>
https://wiki.haskell.org/Zygohistomorphic_prepromorphisms

What's the practical use of this?
>>
>>57404024
No, I understand monads just fine
>>
>>57404083
do it in haskell
>>
>>57404097
wat
>>
>>57404083
lots of references for this. this is an old classic
>>
>>57404110
Been lurking in /b/ mostly, but since it's the cesspool and I wanted to learn a bit I have started to lurk in other boards too - or rather, I have left /b/ completely.
>>
File: Selection_001.png (31KB, 642x305px) Image search: [Google]
Selection_001.png
31KB, 642x305px
Trying to design a maze in Java using the following requirements:

The maze must be implemented by a two-dimensional array of Cell objects; each Cell knows which neighboring Cells are accessible (which walls are "solid" and which are "passable").

Must generate the maze by reading input from two files: one file to represent North and South walls of the cell, the other file to represent east and west walls of each cell.

The files look like pic related, where a 0 means the wall is passable and 1 means it's solid

How would I begin designing this? Yes, this is homework, so I just need some tips to get me going in the right direction, following those exact requirements. I'm a little confused and just need some help wrapping my mind around it
>>
>>57404083
check irc channel #proglangdesign on freenode.

I recommend you learn some sort of lisp (I recommend racket, but common lisp is fine too), since they are the most moldable languages --> language development is easy in them.

I recommend you to begin with stack based interpreted language. Stacks mean you don't have to worry about variable scoping for now, while interpreted means you can do everything from within lisp. With compiled languages you have to know quite some assembly (or other language you are compiling to), while interpreted languages don't need this.

After this i recommend Essentials of programming languages book. For more resources just ask in the irc channel, they are nice folks.
>>
>>57403976
Test server available at floorchan.org
>>
>>57404127
>xkcd.com
>>
>>57404144
for the record this is an exercise in using queues and linked lists
>>
>>57404137
meant to respond to>>57404150
>>
>>57404115
>haskell

Functional languages tend to be heavily based on mathematics, so I'd imagine it's probably a concept based on something that exists in mathematics.
>>
>>57403976
i'm poking around. voip is a little over my head
the client is very thin, it seems. i really didn't realize that websockets were in wide use and had never heard of wamp
>>
File: bWasAlwaysShit.jpg (8KB, 343x81px) Image search: [Google]
bWasAlwaysShit.jpg
8KB, 343x81px
>>57404133
Yeah, I was suspecting that. You know there's a reason nobody complains about >>>/b/ existing, even though it's a cesspool.

/b/ is a containment board, meant to keep people like you away from slower, higher quality boards.
Now it's a little too late to save /g/, but on behalf of all the smaller boards if you're going to act like you autistic shitposter, please go back to >>>/b/.
>>
>>57404206
the reason isn't that it's a containment board, the reason is they don't spill out too much

unlike some others
>>
>>57404122
how
>>57404144
There's an IRC channel? Sweet... I might just show up sometime

I wanted to make a fully dynamic lisp-like language with a good JIT. I want to make the JIT able to generate code targetting the platform ABI; as in, no need for libc's malloc or fwrite or whatever, you can make abstract calls and the JIT generates the system call code in whatever convention the platform uses. FFIs would also work that way.

This, plus a good module system, should make for an interesting extensible language.
>>
File: polOutsideOfPol.jpg (3KB, 191x38px) Image search: [Google]
polOutsideOfPol.jpg
3KB, 191x38px
>>57404236
>the reason is they don't spill out too much
That's the definition of a containment board.
>>
>>57404242
>how
describe the grammar as an ADT and write an interpreter
>>
The mistake was to merge /programming/ and /technology/ in one board.
>>
>>57404137
I remember doing this in school. Just use right hand rule
>>
>>57404260
the point is pol is a containment board yet they spill out constantly
>>
File: round3Fight.png (448KB, 1328x544px) Image search: [Google]
round3Fight.png
448KB, 1328x544px
Making an open source godus-style map generator with unity.
Not bad considering the little spare time I have for this.
Opinions welcome ;^)
>>
>>57404284
RIPIP dis.4chan.org
>>
>>57404170
maybe it's worth pointing out that even within mathematics this is pretty niche stuff
>>
>>57404242
Yeah, it's great. There isn't a lot of activity, but a lot of people are lurking, so there is always quick response to your questions. Also there are some quite interesting discusions. Most of us use racket or haskell (with other languages just when we need too).

i would recommend beginning with something simple, but i don't know how much you already know.

also just say lisp instead of lisp-like language. lisp is a generic term for a member of a family of languages, not a specific language.
>>
>>57404269
Grammar is simple, I already know all the parsing algorithms. I wrote an earley parser that can do any CFG

I wanna know about how to actually implement the language, it seems I'm supposed to write a computer processor program that somehow executes an imaginary instruction set I also get to make
>>
>>57404269
that's the old boring inefficient approach. It forces you to a particular set of semantics to early in design process. Languages should be, like all other complex programs, programmed bottom-up.
>>
>>57404286
What is right hand rule
>>
>>57404333
That's a shit way to develop a language. That gives you fucking C++

>>57404311
start off by transcompiling then
>>
>>57404311
There are two main approaches for this. First one is implement a simple virtual machine that will execute this imaginary instruction set (a single big case statement is good enough for first version) or map these imaginary instructions to existing language (preferably lisp, this is what macros are for).
>>
>>57404355
That also gives you arc, scheme, perl, unix (began as filesystem), slip protocol, ... read Graham's On macros . You only have to be disciplined when cutting crap out.
>>
>>57404333
That's how you get the abomination that is rust
>>
>>57404382
Don't confuse a language for a piece of software
>>
>>57404188
I'm a little proud that the voip is entirely managed clientside.
>>
>>57404382
>>57404395
A language needs consistency, purpose and clarity.
You can still add to the grammar afterwards.
>>
>>57404382
easy for me to forget that graham is pretty smart

>>57404399
ah sorry, i meant "server is thin" obviously
>>
Why is /dpt/ so shit?
>>
File: meanwhileinlouisiana.jpg (139KB, 706x500px) Image search: [Google]
meanwhileinlouisiana.jpg
139KB, 706x500px
>>57403386
ROM here. Fuck you.
>>
>>57404416
Well both are less than 100 lines so...
The client is a bit of a mess.
>>
>>57404423
I blame it on the influx of C++fags.
>>
>>57404404
>>57404395

Language is a tool like any one else. It's a moldable tool, since it's defined by software (interpreter, compiler or whatever). What it needs is extensibility and the best way to get it is by bottom up approach, making it in layers (it worked for lisps, it worked for unix, it worked for tcp/ip protocol stack).

What it doesn't need is too early rigidity. You will get clarity and consistence later, when you are cutting it into shape.
>>
>>57404426
1000*
>>
>>57404425
Memory is RAM.
>>
>>57403386
Roughly there are two kinds of memory.
RAM - all addresses can be assesed in constant time
idk what the name is (hdd for example) - there is a moving head, which has to move to the address (you can quicker access some memory addresses than others).

When using only ram you are correct, but when using swap...
>>
File: 1467640398135.png (36KB, 473x328px) Image search: [Google]
1467640398135.png
36KB, 473x328px
>>57404432
>the best way is bottom up
That's bullshit and you know it

You need to start with a grammar. That's not rigidity, that's fucking anything that's not wildly random and inconsistent.

You're just going to make another javascript
>>
>>57404305
Well I'm pretty familiar with the general idea. I just can't think of specific ways to do it. I asked an open ended question just to see what DPT was going to say

I know I can write a program that takes some text, parse it into a tree and somehow interpret that tree or somehow compile it to some custom instruction set the program can somehow execute, what I can't imagine is how do I actually execute the stuff? How do I optimize it so my language isn't a useless meme? I want to make something I can use personally

I have a good idea of how to parse things and also a good idea of what operations I want to support at the VM level. I can use a simple parsing algorithm with a simple tree/graph data structure. I can use mmap to get an executable memory page and just directly put processor instructions there. I don't know the middle in-between steps... How do I actually take some tree node/instruction and execute it? How do I optimize those instructions? How do I garbage collect memory? That kind of book keeping thing nobody talks about in order to simplify implementations...
>>
>>57404462
You know lisp right? Uniform syntax best syntax.
You should focus on semantics, grammar can be defined later (haskell has for example the usual mode in compiler and lisp mode (don't know if forked or official)).
>>
File: vegan.jpg (324KB, 750x608px) Image search: [Google]
vegan.jpg
324KB, 750x608px
>>57404056
You're welcome. :^)
>>
>>57404423
circle jerkoff and lack of stuff actually being made
>>
>>57404474
Look at some actual implementations (documents, not source code). SML is rumored to have the most optimized compiler of functional langs.

I recommend to you some of original lambda papers, especially the ones dealing with eval.
http://library.readscheme.org/page1.html

I don't have any specific resources, maybe ask on irc. One guy (athas) is making a functional language specialized for gpu and has made some very interesting optimizations.

I recommend you to just start hacking on it :) that's how perl began and it's turned out fine.
>>
>>57404562
>perl
just #@!*&%!* my shit up senpai
>>
>>57404423
Shitposting and memes are overshadowing real opinions
>>
>>57404584
Yes, it's possible to write terrible code in it, but also beautiful code.

It's some very good functional tools (closures, anonymnous lambdas), decent oop and of course good imperative. If it had a good macro system it would be called perllisp.
>>
larry is a cool guy though...
>>
>>57404501
Add humans between cats and dogs and this is accurate.
>>
>>57404334
Google friend
>>
>>57404610
Yeah, he believes in ghosts and angels and an higher being that monitors our every thought, and in the end we're going to be punished because we behaved in the way we were made.

Either that, or he's just a complete wacko anyways. You don't need religion to be a somewhat decent person.
>>
>>57404562
>eval

Yeah that seems to be the exact thing I wonder about. I've read the lisp papers and saw source code for some ruby and JS VMs... it seems to be the same basic idea. Basically a big cond or switch on the tree node/current instructions. Depending on what it is, the VM does different things... Right? This is what "dispatch" means? Lisp's eval is apparently just more abstract and works with actual lisp lists and symbols

>GPU

lovely! I've been reading Khronos specs to learn about that subject. I wonder if its possible to write a VM that can transparently use GPU without the programmer having to use some API that actually binds the code to the GPU only

>start hacking on it

I guess... I was thinking about making a simple implementation in Python or something, just to bootstrap the language and ensure I can always run programs, no need to be efficient or anything; and then write a compiler/VM/JIT in the actual language as a module.
>>
>>57404604
very good and decent in comparision to other common languages (c++, java, python). Compared to haskell and smalltalk they are ofc horrible.
>>
>>57404703
I really recommend lisp for language development. Anonymnous functions and macros are very often needed (it's still possible to do it, but it's hard for no good reason). Try racket, you can learn it in a day or a two (since its built around a small but powerfull core - scheme).

Eval is amazing and also very simple. There are 7 line implementations of very simple lisps interpreters (not very efficient, but still). It's also the basis of the macro system, combined with use of read.
>>
File: naive lambda calculus.png (40KB, 744x536px) Image search: [Google]
naive lambda calculus.png
40KB, 744x536px
>>57404750
or Haskell
>>
>>57404703
Yes, it's a good idea to start writing language compiler/intepreter in the language as quickly as possible. Read about metacircular interpreters (again, most lisps work like this).

>>57404757
Or haskell, I usually don't recommend it due to horrible syntax (significiant whitespace), but it's surely the powerfulest of all functional langs. I like the current development of racket, it's getting more and more of haskell features. Also, it doesn't have lisp level macros.
>>
>>57404778
>haskell
>horrible syntax
you haven't looked at ocaml, c++, or java, have you
>>
>>57404778
Significant whitespace is good 90% of the time
It saves so much space, clarity and time
>>
New thread over at:
>>57404824
>>
>>57404811
I have and then i quickly looked away.

Okay, haskell's is actually quite decent and readable, but still it's too much syntax for my taste. I like languages with the minimum of syntax possible and small core (lisps and I kinda like c).

I just hope we will soon have a lisp dialect with haskells type system and pattern matching.
>>
>>57404852
Haskell has about as much syntax as C
>>
>>57404821
it makes powerful macros impossible, makes it easy to write practically invisible errors (aligning guards in haskell is such a pain), makes parser all too much complex.
>>
>>57404852
thank you, I feel like there isn't a function lang with the just the good stuff

and also
haskell is pretty minimal in syntax
>>
>>57404872
>it makes powerful macros impossible
no

>makes it easy to write practically invisible errors
this doesn't come up often desu

>makes parser all too much complex
it makes it easier to parse
>>
>>57404886
Show me a whitespace sensitive language with lisp strong macros.

Easier parsing? just no, you have to track indentation, add an extra step (to note all the white spaces, determine if they matter or not). Nothing is easier to parse than s-expressions.
>>
>>57404910
this, the thing about lisps is that they have no syntax
>>
>>57404910
>Show me a whitespace sensitive language with lisp strong macros.
I don't know one

>Easier parsing
It is easier for parsers that already track indentation, much easier. You can tell what block it's in by how indented it is
>>
>>57404873
>>57404862

I will probably give it another try soon. I remember from my last time trying to learn it (I stopped, returned back to lisps, implemented monads and matching in them) that there was different syntax for list comprehension, for type defining, for functions, for guards, ...
>>
>>57404930
They have syntax. S-expressions are syntax, but very minimal one and homoiconity is a big plus. You still have to parse them.
>>
>>57404934
Python's indentation based scoping sucks. There. I said it.
>>
>>57404944
list comprehensions aren't that necessary desu, most of what you're talking about is just sugar
f = \x -> \y -> e
f = \x y -> e
f x y = e

f x | cond

>>57404974
i don't know anything about python
>>
>>57404474
This is a great read how to build a compiler from scratch in practical way.
Doesn't dwell on theory and other crud, but gets right down to a simple top-down recursive parser and compiling to real machine code (68k assembly) for a simple Pascal-esque language (called Tiny), the implementation language is Pascal.
There's also a a translation for the same series but the compiler is instead written in Forth:
http://home.iae.nl/users/mhx/crenshaw/tiny.html

Forth btw is a great case study in itself.
It's a language where you can completely forget about lexing and parsing because it's braindead simple (just whitespace delimited words and numbers) so you can get focused on the interpreter or compiler immediately.
Jonesforth is a great tutorial on implementing a Forth interpreter in x86 assembly (the tutorial is jonesforth.S which is the actual assembly code interspersed with comments explaining how every detail works).

I'm currently working on a 64-bit x86 Forth compiler for Windows myself.
Using it to explore optimization techniques. I haven't really read any literature or theory on the subject, I'm just trying out and applying basically 'common sense' things like inlining (instead of call DUP, just copy the machine code for DUP into this word), replacing slow instruction sequences with faster ones, moving things out of loops, constant folding, eliminating useless code etc.
>>
>>57401138
Was messing around with twitter api.
Thinking of creating a batch program that will be executed daily and add all messages(with a specific #hashtag into a database).
And then when I "get guud" I will perform a text analysis on that data.
>>
File: image_6_0.jpg (17KB, 480x413px) Image search: [Google]
image_6_0.jpg
17KB, 480x413px
>>57401284
Thread posts: 343
Thread images: 32


[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.