/dpt/ - Dependently-typed Programming Thread

>C, C++, D, Java, Kotlin, C#, Go, Python, Nim, Julia
Take it to >JavaScript, TypeScript
Take it to What are you proving, Jow Forums?

Old thread:

Attached: 191256-131-9E594180.jpg (900x675, 87K)

Other urls found in this thread:

github.com/ii8/bale/blob/master/spec.md
pastebin.com/CGWZpENC
archive.fo/mnbNo
ruby-doc.org/core-2.2.2/IO.html
ruby-doc.org/core-2.2.1/Dir.html
node-os.com/
dailyprog.org/f/4rkx/
devver.wordpress.com/2009/06/30/a-dozen-or-so-ways-to-start-sub-processes-in-ruby-part-1/
docs.python.org/3/library/
docs.python-guide.org/#
twitter.com/NSFWRedditVideo

What do you think of my encoding?
github.com/ii8/bale/blob/master/spec.md

nice birb

>My head hurts
>I wish I was at home reading SICP
>tfw everyone here uses dynamically typed languages
>I bet they don't even know who Simon Peyton Jones is

I have nothing against functional circlejerk threads and most of the time I participate, shilling my share, but wouldn't it be better to create a bastard child of /dpt/, a new daily thread instead of coming on their faces?

Attached: punpun-smugTriangle.png (370x175, 57K)

>>JavaScript, TypeScript
>Take it to epic, no more onions

No, it wouldn't.

nicely memed my friend

>SICP
>not based around a dynamically typed language

I like the bird.

Anyway, still trying to figure out a way to use Ruby in order to:
-Open a file
-Do some processing
-Close the file

Right now, I have this, but I'm not sure if it will work...

pastebin.com/CGWZpENC

Haven't been able to post ruby code for some reason, but maybe the bitbucket link will help?

Reminder that Lisp is an utterly useless language: archive.fo/mnbNo

Attached: 1524442610400.png (600x431, 108K)

>C, ...
>sqt
kill self
>JavaScript, ...
>wdg
This is just ignorant. Javashit is garbage, but it is technically programming, you since A) non-browser implementations exist, and B) web browsers are virtual machines anyway.
Pic related: the stutid meowcats this thread is fuck deep in

Attached: 04599.gif (650x450, 46K)

Nigger why? I'm pretty sure Ruby has support for basic I/O. Actually, first Google result: ruby-doc.org/core-2.2.2/IO.html
Also the Jow Forums filters are retarded and prevent you from posting some code sometimes because it thinks it's something malicious.

why do you reply to a bait lol

>expecting better from a C programmer
I'm not sure what to tell you user

1)
log everything but let user set optional logging function and log level compile time
2)
log everything but let user set optional logging function and log level at runtime
3)
return status and set logging message to thread local error message buffer. User can print it if he wants.

I might not have explained that well.

Basically, I'm going to go through all the files in a directory. I will be mainly using this for images, but I'll accept any file type.
I can choose to open the file. Once the file's open and I see what the image is, I can rename it. However, once I finish renaming the file, I want to be able to close the file automatically without needing to mouse over and close it.

I need the PID to call "Kill" on it, but from what little I've done, it looks like, some applications start new PIDs, so calling kill on them won't really do much.

2

Yeah, people do anything other than web development on JavaScript.
Non-browser use cases for JavaScript are still web development

Attached: 1510391736176.png (691x395, 215K)

the overhead though

Then instead of globbing the directory contents use the dir class and iterate over each file and spawn it individually one after another.
ruby-doc.org/core-2.2.1/Dir.html

>Non-browser use cases for JavaScript are still web development
How so?

>Yeah, people do anything other than web development on JavaScript.
They do though. I hate them for it, but such people do exist.
>Non-browser use cases for JavaScript are still web development
Wrong.
1) There are desktop apps written in Javashit.
2) There is at least one (1) operating system written in javatrash.
Or are you making a stronger logical claim: that anything which hosts and runs javascript is a website? Because that would be unbelievably stupid.

I could believe that there is an OS written in C containing a built-in JS interpreter. But an OS written entirely in JS? No.

JS is by definition a webdev language. It was created for use in web browsers.

Just because it was made for use in web browser does not mean that it's confined to web browers. There exist runtimes that do not have DOM support and instead run outside of the browser. Those implementations can be used to implement anything you want and it doesn't make JS for such use case any more of a web dev language than you would call Python, Ruby, Scheme or whatever. It's sad but that's how it is.

>markdown
>lisp
>ruby
>lisp
>c and javascript
>ruby
>c
>pseudocode that gives no indication of being about dependent types
>ruby
>javascript
>ruby
>javascript
>javascript
You're all in the wrong thread. This is /dtpt/ (though mislabeled /dpt/). You should take that shit to /dpt/.

Have you ever heard of any applications for Node outside of running a web server and doing web server things?
Machine learning has zero usershare in JavaScript. Same with alternative data science fields.

>desktop apps written in Javashit
Those are web browsers wrapped in a different window decoration. Slack, Discord et al. electron apps aren't any different from just logging into their websites.

To call those "desktop apps" would be like calling SMS the same as a messenger protocol over IP.
It's idiotic to make such comparisons because the way they interact with the underlying infrastructure is completely different.

Call me back when JavaScript has access to underlying DirectX and OpenGL bindings.

/dpt/ is correct. It's Dependently-typed Programming Thread, not Dependently Typed Programming Thread.

>old thread references /dpt/
checkmate atheists

>this guy

Attached: 1532751119565.png (1011x874, 465K)

node-os.com/

This abomination exists. It's one of those cases where I think to myself: But why? Still runs on a linux kernel.
What exactly is the usage case where you need an entire operating system in JavaScript?

Dependently-typed programming is the future of programming. Dependently-typed Programming Thread is the future of Daily Programming Thread.

>What exactly is the usage case where you need an entire operating system in JavaScript?
When JS is the only language you sort of know, and you refuse to learn any other

are you a real spider

>Dependently-typed Programming Thread is the future of Daily Programming Thread.
This cannot be the case since:
"Dependently-typed" != "Daily"

This is autism

Non-sequitur.

so if opengl ain't so good either, what is? dx?

as real as this is the /dpt/

Not at all. For, consider this. A future is just a reification of laziness in languages that aren't lazy by default. It defers a computation until it's needed. If that computation is a known constant, how can its future be anything but that same constant? Unless you're in a language with mutable promises, which is the worst idea ever.

are there still any non spiders posting on /dpt/?

Another non-sequitur.

How the fuck do you even get to that point? Learning one language pretty much sets the stone to learning others as well...

Next thing we know somebody writes an OS in PHP.

>so if opengl ain't so good

>

bootcamps

dx is platform specific so it's shit.
opengls problem is that it has state machine.
don't know but I believe vulkan has removed the state machine but the API is convoluted as fuck and is not supported on older devices.

if you are not low level graphics programmer you should not care.
If you are then you kind of need to know them all for maximum device support.

Son, be quiet. Some people are trying to program.

The bane of developer existence.

I'm not saying it's intuitive, but there are clear rules about it, and once you learn them, there is nothing to be surprised about it. I admit I didn't think about an empty constructor in my example, but there is still a clear rule in that case too.
Besides, if Foo f {}; called the second constructor in your example, how would you unambiguously call the empty constructor?

>trying
Not surprising that they're only trying and not succeeding if they're not using dependent types.

Okay... So I changed the script a bit to better reflect what I'm trying to do. For now, I'm opening all pngs and after I "rename" them (just a gets statement for now), I want to close them.

Do you know how I could do that?

PNG_REGEX = Regexp.new(".*png")

path = File.expand_path("..")
print "PATH = #{path}"
d = Dir.new("#{path}/") #Open all png images

def is_png?(folder, filename)
return PNG_REGEX.match?(filename)
end

d.each { |file|
if(is_png?(path, file))
puts "Opening... #{file}"
system("open -g \"#{path}/#{file}\"")
gets #Simulate getting some input
# Close after input (How??)
end
}

Where are the dependent types?

Developers are all dependent types.

Why are you relying on external software from the Operating System to open the file? Really kinda messy, you'd have to know how exactly the files are opened on the users machine.
On linux you could do a "ps -xa | grep " or similar to get the process id, I guess? Then send a kill command.

It just seems like bad practice to depend on something like this.

Why is JavaScript the greatest programming language of all time?

Starting up a new project and I need to choose a language. I have strong C skills, and the project demands performance. However, this might be the only excuse I have to learn and use Rust -- how difficult is it to pick up Rust?

The project requires polling hundreds of web APIs, collecting data, then running tens of thousands of operations on that data in parallel. It is very time-sensitive. The codebase it's replacing was written entirely in Javascript which cannot be optimized any further (and I'd like to cut my $300 DigitalOcean bill to a tenth of that).

Obviously, since this involves the web, I need a highly performant string library. With C, I'd just roll my own parser and be done with it -- is Rust's string performance alright, or can I at least achieve decent results without too much effort?

>I'm not saying it's intuitive, but there are clear rules about it, and once you learn them, there is nothing to be surprised about it.
This is true of every idiosyncrasy in C++. "Just learn all 500 000 rules and it won't be surprising any more!". At some point there are too many rules to expect a developer to be aware of them all.

>Besides, if Foo f {}; called the second constructor in your example, how would you unambiguously call the empty constructor?
Personally, I'd have not introduced std::initializer list at all and deprecated constructor invocation with parens. You can already use a proxy or a tag if you want to control overload resolution.

so what you're saying is you're writing a web scraper? just like half of /dpt/?

Sure. The scraping is the easy part. The issue is that the program needs to operate on the scraped data and return a result in milliseconds, which requires parsing and sorting a lot of data very quickly.

I use node for any random script I want, it's like the new python
fite me

Attached: shrugs.jpg (858x720, 127K)

>Why are you relying on external software from the Operating System to open the file
I'm not really sure how else I could do it?
The point of me opening the file would be to see the image, and then rename the file accordingly.
"open" seemed to be the most straightforward way of doing it, but I'm open to suggestions

I just tried doing your grep method, but it didn't seem to catch the file I opened... The grep filter only found the "grep" command, ironically enough... I'm sure I'm missing something, but I can't figure out what it is.

Thanks for the suggestions, though!

Attached: Screen Shot 2018-08-05 at 10.42.21 AM.png (2582x1308, 1.99M)

enjoy every script you write having a folder of dependencies right next to it
It's like Windows' dll fragmentation all over again :^)

Okay. I found out that using
pkill "Preview"


Closed all the images.
However, I want my application to be as general purpose as possible, so I want to be able to close any program opened by the "open" command.
Of course, I could always just force the app to open with preview, but I want it to work with text files and ".docx" files.
Also, using "pkill" closes ALL the preview windows, not just the one I opened with the command line, which might be a tad inconvenient if you have other documents open... Any suggestions?

maybe it shows up in lsof?

Attached: 3cpAS6L.jpg (625x351, 44K)

C# outperforms C/C++ in most real world applications because there's more room for compiler optimizations.

>C# outperforms C/C++ in most real world applications because most real world applications run on Windows.
ftfy

You can install node dependencies globally, like Python PIP does by default.

Europe is recovering from the heat wave, how do I get back from sleeping for past 2 weeks to working on coding. I did literally everything that wasn't programing just to avoid opening the editor and stuff I write from.

Obvious bait. I love C# but you can't expect less (time) by doing more (JIT, GC..etc).
That being said, clr team has been working on tiered compilation and hardware intrintics only recently.
Sure, it beats java in raw speed but not on long running sessions when the jvm warms up.

Reminder that languages which sacrifice resource efficiency for elegance are not eco-friendly.

The lower-level we can keep our software while still preserving full desired functionality and safety, the less computational resources are necessary to run it at an acceptable speed. This allows for computer technology to become less advanced, thus sparing the environment. People who work with languages like Idris or Racket clearly don't care about anthropogenic climate change and are as bad as people who litter.

and then have dependency conflicts like all package management systems eventually have
if only there were "virtual environments" where you could set up a "namespace" which consists of only the dependencies required to run one project, that you could invoke from anywhere, and the dependencies are actually stored in a single location as to prevent unnecessary fragmentation

The word 'future' has more meanings than just the programming language concept named futures, and the phrase "X is the future of Y" is not related to that concept.

>start new node project
>pull in the one dependency I need
>it literally pulls in 193 more

T-Thanks... lemme just install "brace-expansion" and "cli-cursor" and another hundred useless gobs of shit globally...

Attached: node.png (1039x883, 103K)

So, in other words:
>not programming related?
Then take your concerns to:

oh no programmers are such terrible people someone think of the children

>X and Y are both programming related
>"X is the future of Y" is not programming related
Is this what shitlangs do to the brain?

An extraordinarily myopic view which completely misses the savings from using high-level languages with shorter development times and lower bug rates.

>The word 'future' has more meanings than just the programming language concept named futures, and the phrase "X is the future of Y" is not related to that concept.
>The word I used has more meanings than just the meaning that is programming related, and the meaning I meant by using the word is not that meaning.
>The meaning I meant by using the word I used is not the meaning of that word which is programming related.
>My intention in using the word was not the programming related intention.
>My use of the word was not programming related.
Q E fucking D.
>>>>

Attached: OBJECTION_by_Phoenix_is_Wright.png (448x313, 20K)

>if we just change the definitions of words we can argue all kinds of crazy things!

Wasn't able to find it, unfortunately...

'future' wasn't the only word in the sentence. I suggest you practice retaining more than one word in your head at a time.

I only hope this debacle serves as a warning to future programmers about the dangers of using shitlangs.

Oops, I used the word 'future' and wasn't talking about JS or Java futures.

But user, I have 4294967296 different opcodes, so clearly there's no room left in the instruction format for a bitfield of any width whatsoever indicating which register(s) to use. Therefore the obvious conclusion is that at most only a single general-purpose register is available, addressed by simply the omission of a register address altogether (2^(address width) = number of registers that can be addressed, 2^0 = 1). And, clearly, the width of that single register must be one word, since that's practically the fucking definition of a word (that is, that bit width with which the majority of the registers work, and if there's only 1, then 1 is a clear majority).

Who the fuck was ever talking about JS or Java futures? I do posit that the ONLY acceptable use of the word "future" is as a reification of laziness; and yet, I think we can all agree Java and Javashit are shit. Which, incidentally, makes Javashit double-shit, so it should really be called Javashitshit, while Java would take the name Javashit for itself.

Oh - you're an obsolete model! It all makes sense now. I'm sorry, I shouldn't have assumed, I should have asked.

What languages could I try natively on an android phone?

I'd just code in a comfy chair till I get interested in stuff again.

On the contrary, single-register processors with ridiculous quantities of available opcodes are the FUTURE of computing.

That's Lisp in a nutshell.

SET_BACK_DOOR
SET_BIG_DICK_BACK_DOOR
SET_BIG_BLACK_DICK_BACK_DOOR
[...]

The future is bright

>Who
>the
>fuck
>was
>ever
>talking
>about
>I
>posit
>that
>ONLY
>acceptable
>use
>of
>is
>as
>a
>yet
>think
>we
>can
>all
>agree
>are
>shit.
>Which
>incidentally
>makes
>so
>it
>should
>really
>be
>called
>would
>take
>name
>itself
Not programming related. Well that's debatable. Right now RISC is taking over.

Attached: 1530288451422.png (310x250, 29K)

Very interesting. I discovered sqlite var_int and it's a good idea. I do myself a programming language similar to yours. A function I'm working on to parse the output of another program:
> dailyprog.org/f/4rkx/

JS is fast at string handling. You should give more details to get a better feedback.

What are the default python libraries?
Also what are the common libraries that I should learn before I'll start looking into obscure ones as a newbe?

persistent red black tree makes me want to fucking kill myself

Attached: .gif (1067x600, 342K)

Was afk, anyways for the grep, I think you might be using it wrong. Anyways, if you are starting the process from your program, there should be a way of identifying it.

In this blog post: devver.wordpress.com/2009/06/30/a-dozen-or-so-ways-to-start-sub-processes-in-ruby-part-1/ there is the mention of fork. I think that might be what you want, as it returns the PID.
It will only work on Linux/Unix systems, but fuck everything else desu.

Tried programming in the heat wave, it is not possible. Can't concentrate.

Should be
SET_BIG_BLACK_COCK_BACK_DOOR

I found much easier to like, have an idea, implement it and search which libraries I could use to implement the idea. Sometimes you get standard libraries, sometimes not.
You can find the default libs in the documentation:
docs.python.org/3/library/

Just make sure its for the python version you are developing with. Theres a lot that only works for 2.x, but just as much that is only compatible with 3.x

>I found much easier to like, have an idea, implement it and search which libraries I could use to implement the idea.

I want to learn python the "proper" way, sort of the way that would be fine when working in a group or if in a perspective, I'd be working with python. I'm learning stuff in university classes (classes skip much and by myself I learn from basics and they rush to produce results) but sometimes I feel the tutor is using his favorite libraries rather than the common ones as he is a physicist not a programmer.

You do know the hitchhikers guide to python exists? I never used it, but it might be interesting.
docs.python-guide.org/#

>posting this again
how much of a brainlet do you have to be to struggle with this you can implement one in less an hour

>I want to learn python the "proper" way
Get a job where you are paid to do Python then.
>tutor
Most academics can't code worth a shit. Their skill set usually lies with memorizing shit to pass exams.