Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 268 KB, 621x909, 1543156373486.jpg [View same] [iqdb] [saucenao] [google] [report]
69442523 No.69442523 [Reply] [Original] [archived.moe] [rbt]

Old thread: >>69436113

What are you working on, /g/?

>> No.69442561

nth for nim! (and yuno)

>> No.69442593

>>69442523
first for python :333

>> No.69442605
File: 50 KB, 553x493, dpt.png [View same] [iqdb] [saucenao] [google] [report]
69442605

time to choose, yuno: haskell or lisp?

>> No.69442626

>>69442523
>What are you working on, /g/?
Today is learn spacemacs day.

>> No.69442670

>>69442605
haskell

>> No.69442675

i really love python3

>> No.69442687

i like lua

>> No.69442701

>>69442605
haskell

>> No.69442705
File: 286 KB, 1000x494, js-rocks.png [View same] [iqdb] [saucenao] [google] [report]
69442705

JavaScript rocks!

>> No.69442762

>>69442670
>>69442701
Help me, (You)nos. I've got the following doubly-linked list:
data DList a = DLNode (DList a) a (DList a)

As far as I see, it's basically impossible to implement a insert :: a -> DList a -> DList a without extending the type to contain some sort of node index.
Do you see any other way of doing this?

>> No.69442803
File: 134 KB, 1000x494, javascript rocks.png [View same] [iqdb] [saucenao] [google] [report]
69442803

JavaScript rocks!

>> No.69442818
File: 17 KB, 337x372, 1542878327506.png [View same] [iqdb] [saucenao] [google] [report]
69442818

Are intensive coding bootcamps useful? I'm a HS graduate who failed out of college. I just want to get out of minwage cucking. No experience.

https://codeup.com/

This is the program I'm looking at.

>> No.69442830

>>69442605
erlang

>> No.69442831
File: 103 KB, 1280x720, 1406803019377.jpg [View same] [iqdb] [saucenao] [google] [report]
69442831

>>69442818
>Are intensive coding bootcamps useful?
No.
>Le sad reddit meme man
You also should probably consider suicide.

>> No.69442839 [DELETED] 

>>69442762
You have to iterate through the list.

>> No.69442855 [DELETED] 

>>69442831
>le tranny anime girl

You'll kill yourself before me.

>> No.69442859

How do functional languages handle large data structures? If you have a large tree, and a function that changes a nodes value, naively the function would just copy the entire tree and change the value, then return the new tree, but that doesn't seem practical at all.

>> No.69442861

>>69442830
M E N T I O N E D

>> No.69442862

>>69442762
You have to insert at the head of the list for constant time, otherwise it will be linear time if you insert it somewhere else within the list.

>> No.69442867

>>69442839
but how would I know when to stop iterating? without a node index, there's no end to the iteration.

>> No.69442878 [DELETED] 
File: 1.03 MB, 1280x720, 1530486902952.png [View same] [iqdb] [saucenao] [google] [report]
69442878

>>69442762
oh yeah, I read your post yesterday on the train.

>> No.69442880 [DELETED] 
File: 5 KB, 275x183, 1540461425580.jpg [View same] [iqdb] [saucenao] [google] [report]
69442880

>>69442855
>>le tranny anime girl
>You'll kill yourself before me.

>> No.69442892 [DELETED] 
File: 629 KB, 674x752, 1412742862372.png [View same] [iqdb] [saucenao] [google] [report]
69442892

>>69442855
>Comes into /dpt/ and insult its mascot
>Directly insults the cutest animu gril to have ever existed
Seriously, fuck off and kill yourself.

>> No.69442894 [DELETED] 

>>69442855
>tranny
>anime
I have some news for you

>> No.69442895

>>69442859
You use persistent data structures. Since data doesn't mutate in a pure language you can reuse as much of the old structure as you like.

>> No.69442922

i just wanted to thank that anon from yesteday, i got the mingw compiler working, i just had to set the PATH again (apparently it got reset) you are probably american since i posted late last night, you know who (you) are

>> No.69442927

>>69442859
>>69442895
and laziness

>> No.69442933

>>69442862
Not really, since it's a doubly-linked list, all elements would need to be re-created (i.e a new prev with the link to the new head, and a new prev prev to the new prev, etc...; and same for all next links). The problem is how to re-tie the knot like the original DList did.

>> No.69442991

>>69442933
Only the second element has a link back to the head,
if you insert a new head its O(n) because the list just changes the pointer to the first element to the new head and thats it.

The new head points to the next element then of course.

>> No.69443001

>>69442933
>>69442991
*meant O(1)

>> No.69443016

>>69442762
I think your problem is thinking the problem the wrong way. You see, in your list you want the left side of the list to depend on the value of the right side of the list. But since the right side also depends on the value of the left side, you can never reach a conclusion. It's infinite recursion. All in all, it makes no sense to have the other end of the same list in both ends. So if you need access to both ends you should probably use some kind of a pointer type to reference to the other end of the list, instead of pure values.

>> No.69443031

>>69442991
by definition the last element's next points also to the head
-- next links
last -> head -> second
-- prev links
last <- head <- second

since we have a new head, both the last and second elements must change, and by induction, all elements.

>> No.69443050

>>69443016
this
it's like trying to insert an element in a cyclic list (cycle :: [a] -> [a]), it's impossible, unless you still have the finite list, and remake it cyclic after insertion

>> No.69443201

>>69443031
I forgot that, but since the old first element has a link back to the last element the operation will still be constant O(1), without the need of iterating.

>> No.69443239

>>69443201
No, since the last element must point to the new head, a new last element is needed. And since a new last element is needed, a new last of last element, etc.

>>69443016
I agree, however it was surprising to me that we could create such recursive structures but not modify them afterwards. I think >>69443201 is the essence of it.
Like you say, a reference would probably work:
type Node = Int
data DNode = DNode Node Node
data DList a = DList [DNode] [a]

>> No.69443250

>>69443239
I meant that >>69443050 is the essence of the problem.

>> No.69443275
File: 1.60 MB, 2480x3496, 1516648854467.jpg [View same] [iqdb] [saucenao] [google] [report]
69443275

>>69443250
thanks for correcting yourself and giving me my rightful (You)

>> No.69443276

>>69443239
There is no need for new last element at all, you address the last element via the pointer of the last head element.
Then you change the pointer of the last element that points to the first element so it points now to the new first element.

How is that not a constant operation?

>> No.69443289

>>69443276
>Then you change the pointer
how is that pure?

>> No.69443290

why not just use a sentry that also contains pointers to the head and the tail
the sentry itself will never move and it's the size of two memory addresses
there literally all problems solved

>> No.69443301

>>69443276
Perhaps I wasn't clear in my question, but I'm stating the problem for immutable structures. You cannot mutate the last element (i.e. "change the pointer"); instead a new last element must be created.

>> No.69443306

>>69443289
Nevermind I didn't saw it is for haskell. Can't you not simply change the reference of the element or something?

>> No.69443338

reminder computers aren't lamda calculus machines and even "pure" functional langs aren't actually pure in reality

>> No.69443345

>>69443338
look dude why do you even bother with this? we all know you're just gonna pretend that computers are more similar to the C virtual machine than to any hypothetical functional language

>> No.69443352

>>69443338
okay

>> No.69443365

>>69443345
>>69443352
reality and mathematics also aren't pure
pureness is a spook

>> No.69443368

>>69443365
Mathematics actually is pure.

>> No.69443369

>>69443365
You fucking retard. Why the fuck did you waste my time? I shouldn't have fucking replied you dumbass fuck.

>> No.69443378
File: 69 KB, 720x511, 1_mL04Mh-tDosU6_OlqexwyQ.jpg [View same] [iqdb] [saucenao] [google] [report]
69443378

>>69442705
I think you're the only one i ever heard say that

>> No.69443402

>>69443338
nobody cares nerd

>> No.69443407

>>69443306
you can
but that's not what we want
it also comes with other problems

>> No.69443420
File: 157 KB, 800x800, 800px_COLOURBOX8416047.jpg [View same] [iqdb] [saucenao] [google] [report]
69443420

>>69443365
"Pureness" and originality are fucking memes

Originality died centuries ago anons

>> No.69443427

>>69443378
Majority of people are too dumb for JS. You should have seen the last thread.

>> No.69443437
File: 164 KB, 778x640, 1512290877628.png [View same] [iqdb] [saucenao] [google] [report]
69443437

>>69443427
>Majority of people are too dumb for JS.

>> No.69443442

>>69443437
>Wojack edit #15246745785674556
Fuck off, redditor.

>> No.69443463
File: 356 KB, 1280x720, 1547816204146.jpg [View same] [iqdb] [saucenao] [google] [report]
69443463

>>69443427
>majority of people are too dumb for JS
I hope not but I could believe it. It's still shit though.
>>69443442
brainless wojak is a based and redpilled meme friendo, not like that gay frog

>> No.69443470

>>69443427
>(x == y || x < y) == (x <= y) sometimes returning false is fine, your just not smart enough to understand ot

>> No.69443475

>>69443470
if x or y are side effecting expressions, this can fail in C too

>> No.69443481

>>69443463
I don't know what's supposedly based about beating the same dead horse of a "joke" over and over again, despite it never being even remotely funny or endearing in the first place.
That's straight up the reddit mindset.

>> No.69443487

>>69443475
Assume x and y are simple veriables, or direct values.

>> No.69443493

>>69443481
that's wrong, some of the worst trash was made by people desperately wanting it to be unique
meanwhile plenty of good 4chan posts have been relatively unoriginal

>> No.69443533

>>69443470
>still not too dumb to understand === is the equality operator
Please refer to >>69443427

>> No.69443547

>>69443533
Go ahead and replace == with ===, still won't fix the problem.

>> No.69443549

>>69443437
There was a second sentence as well.
>>69443470
lt/gt operators are number coercing operators, with exception being strings for both operand, loose equality follows different rules. Also you should only be using == to compare to null for bottom value checking, for every other case you should be using ===.

>> No.69443560

When will JS get an ==== operator?

>> No.69443580

>>69443560
What would it be used for that isn't already covered by ===?

>> No.69443590

>>69443547
That's still entirely your own fault for using equality operators on some arcane shit instead of numbers. Which is something that never happens in practice, unless you wish to again refer to >>69443427

>> No.69443592

> x = []
Array []
> y = []
Array []
> (x === y || x < y) === (x <= y)
false

LMAO

>> No.69443593

When will JS get a 8==D~ operator?

>> No.69443599

>>69443580
equal reference maybe

>> No.69443615

>>69443592
>x === y
false because different objects
>x < y
false because 0 isn't less than 0
>x <= y
true because 0 is equal to 0

>>69443599
>that isn't already covered by ===

>> No.69443631

>tfw too smart for types

>> No.69443714

>>69443593
> (^-^) n = take (6 * n) $ cycle "(^-^) "
> (^-^) 8
"(^-^) (^-^) (^-^) (^-^) (^-^) (^-^) (^-^) (^-^) "


step it up other languages

>> No.69443726

>>69443714
with PostfixOperators you can do (8 ^-^)

>> No.69443752

>>69443726
with mixfix operators you can do anything

>> No.69443762

>>69443752
not a haskell extension, also muh lexer

>> No.69443775

>>69443762
haskell is shit, also lex deez nuts

>> No.69443785

>>69443775
no_u_

>> No.69443802

>>69443714
Please, write an Haskell code bigger than 1000 loc and explain it's time complexity.

>> No.69443828

>>69443802
>it's time complexity
that's like piss easy, space complexity is like way hard to determine due to laziness

>> No.69443849

>>69443828
I want to remind you that GHC developers need 10 years to prove time complexity of the sort function.

>> No.69443881

Anyone has any experience with parsing PDFs ?

I am trying to convert my credit card statement into json data I can easily process but it's a fucking nightmare.

Best tool I could find is tabula, which worked wonders, but went to shit when I tried parsing for a slightly different layout)

>> No.69443910

>>69443881
write your own parser
use llvm as a backend, i can't imagine .pdfs are more complicated than a language like C++ which is several standards of two separate programming languages + several standards of C
i suppose if the C preprocessor is turing complete it'd technically make it a parser of several standards of four individual programming languages

>> No.69444110

>>69443910
>use llvm as a backend
>to parse pdf into json
This better be a joke

>> No.69444134

>>69442605
Haskell is a useless, shitty, ugly, and inefficient language, but if I had to choice between it and Lisp I'll choose Haskell.

>> No.69444152

My VirtualBox ran fine and smooth yesterday. Why does it run so slow today?

>> No.69444177

>>69444152
Use PhysicalBox instead

>> No.69444205

>>69444110
only partially

>> No.69444211

>>69444205
So you're partially retarded

>> No.69444235

>>69444211
there is a need for a good modern native pdf library that can handle all of the standard, afaik there is none
llvm might be overkill but it doesn't change that fact

>> No.69444253

>>69444235
We shouldn't use pdf to transfer data.

>> No.69444264

>>69443881
PDF is a pretty complex format. Use a library
https://pdfbox.apache.org/
https://opensource.google.com/projects/pdfium

>> No.69444294

>>69444235
Why on EARTH do you think LLVM will help? Why on Earth do you not think using LLVM for this will make everything a LOT more complicated? Are you fucking retarded or something?
Fucking look up what the fuck LLVM actually is and revise your reply kudasai.

>> No.69444357

>>69444253
Why the FUCK do you think the topic is about data transfer? Get a fucking brain and fucking USE it before hitting the reply button, fucktard.

>> No.69444374

>>69444294
>>69444357
take a chill pill my dudes

>> No.69444389

>>69444374
I'll take a chill pill when some fuck tards over there start taking not-be-fucking-retarded pills.

>> No.69444493
File: 3 KB, 125x133, c.png [View same] [iqdb] [saucenao] [google] [report]
69444493

>uses curly brackets
>uses ";"
>uses "main"
>horrible syntax
>can't return arrays
>requires you to declare every single fucking thing
>horribly awkward use of pointers
>excruciatingly painful input/output commands
Why is this piece of shit language shilled so much, when it has absolutely no redeeming qualities, apart from speed and portability?

>> No.69444515

>>69444493
Is this how brainlets cope?

>> No.69444520

>>69444493
Because it has speed, portability, simplicity, discipline, historical interest, interop functionality, heritage, etc.

>> No.69444524

>>69444493
>>uses curly brackets
braces*
and this is a good thing
>>uses ";"
Another good thing
>>uses "main"
Another good thing
>>requires you to declare every single fucking thing
Another good thing
>>horribly awkward use of pointers
You mean use of pointers

Everything else are valid complaints and the reason why C is shit is because no support for good efficient abstractions.
The problem you have is that you have shit taste in programming languages.

>> No.69444535

>>69444493
>>uses curly brackets
so?
>>uses ";"
so?
>>uses "main"
so?
>>horrible syntax
no
>>can't return arrays
wrong
>>requires you to declare every single fucking thing
so?
>>horribly awkward use of pointers
for you
>>excruciatingly painful input/output commands
for you

>> No.69444544

>>69444294
do you have actual literal autism or are you just not familiar with the linguistic concept of hyperbole
while an entire compiler backend is obviously not necessary pdf is complicated enough that i would use a dedicated ast parsing library

>> No.69444546

>>69444535
>wrong
No he's right about that.

>> No.69444558

>>69444544
>pdf is complicated enough that i would use a dedicated ast parsing library
That's nice and all but LLVM is 100% unrelated to parsing. You and the other guy clearly have never actually used LLVM before.
LLVM is for code generation and optimization only.

>> No.69444566 [DELETED] 
File: 296 KB, 1074x1149, unflip.jpg [View same] [iqdb] [saucenao] [google] [report]
69444566

>>69442892
I'd just like to interject for a moment, although yunocchi is cute and very welcome on /dpt/, I think the mascot is still yuki. She can also probably program better than yuno.

>> No.69444578 [DELETED] 

>>69442855
>tranny
Fucking retard. Yuno is biological female.

>> No.69444597 [DELETED] 

>>69444578
back to discord

>> No.69444598

>>69444558
i'm afraid it's worse than that, i'm literally using libtooling right now
i could have sworn llvm contained stuff to help create ast parsers, but looking again you're right

>> No.69444610

>>69444546
return a struct

>> No.69444627 [DELETED] 

>>69444597
I have no idea what you're talking about, but you just claimed that Yuno is a tranny so I'm just here to tell you you're a complete and utter moron who should fuck off somewhere else as you clearly have never even seen Hidamari Sketch before.

>> No.69444648

>>69444610
Not an array and C doesn't have good enough abstractions to make it act like an array efficiently, like std::array.

>> No.69444651 [DELETED] 

>>69444627
>before
stopped reading there

>> No.69444671 [DELETED] 

>>69444651
Of course you did, it's the last word in the post

>> No.69444678 [DELETED] 

>>69444671
hello new friend

>>69444648
return a pointer to an array

>> No.69444712 [DELETED] 

>>69444678
A pointer isn't an array and you have to store that array somewhere. You can't just put it on the stack.

>> No.69444725 [DELETED] 

>>69444712
nigga i don't care

>> No.69444736 [DELETED] 

>>69444678
>hello new friend
Could say the same about you

>> No.69444750 [DELETED] 

>>69444736
not really but nice try.

>> No.69444751 [DELETED] 

>>69444725
Then don't reply, retard.

>> No.69444781 [DELETED] 

>>69444751
>don't reply
if people didn't reply this hole would be dead

>> No.69444902
File: 49 KB, 736x757, Ran 2.jpg [View same] [iqdb] [saucenao] [google] [report]
69444902

>>69442523
Yesterday, I wrote baby's first image catalog site.
https://illegal.pics/

Cataloging 4chan images ofc... It does for most boards, and has infinite scroll. It's really crude, but it's my first actual attempt at a website.

>> No.69444903
File: 8 KB, 231x218, glorious.jpg [View same] [iqdb] [saucenao] [google] [report]
69444903

Why is alambda so good bros?

>> No.69444939

>deleting >>69444712
Mods are fucking idiots

>> No.69444972

>>69444939
I think the janny delete thing is recursive, and you quoted a post that quoted a post that got deleted.

>> No.69445006

>>69444972
Hence, they're fucking idiots.
Recursive delete is an idiotic feature and anyone who blindly deletes entire reply chains without even inspecting it is a fucking idiot.

>> No.69445134

>>69442762
I'm sorry, but could you restate your question?
In >>69443031 you mention a "last" element, but you only allow infinite lists. Do you want finite or infinite lists?

Anyway, in both cases the basic idea is that you can just recursively change your lists.
For the infinite version: Don't worry, you can just do recursion over infinite structures as long as you want due to lazy evaluation. This means your function can't be strict though.
For the finite version: You can also just work recursively, but you have to additionally pass your new head element. This is again possible because lazy recursion doesn't require you to actually calculate the head element before passing it recursively.

Due to immutability this is very inefficient though. If you just need something like a DLL to work on, I'd just recommend using the Sequence type or just implement it impurely.

>>69443050
Wrong. It's impossible in strict languages, but Haskell is lazy. Take a look at:
https://wiki.haskell.org/Tying_the_Knot

>> No.69445144
File: 350 KB, 500x492, yuki3.png [View same] [iqdb] [saucenao] [google] [report]
69445144

>>69445006
Don't be too hard on them, they have a lot of garbage to delete on this website.

>> No.69445243
File: 251 KB, 1920x1080, miNES.jpg [View same] [iqdb] [saucenao] [google] [report]
69445243

NES emulator for Windows and Linux, written in C++. Just working in Visual Studio right now writing the PPU emulation code. Using WxWidgets, OpenGL and OpenAL and it just werks.

>> No.69445275

>>69444902
Nice domain name, makes me not want to click on that.

>> No.69445404

>>69444903
What's that?

>> No.69445466

>>69445243
>& 7
This is trivially optimizable by a compiler. Just write % 8.

>> No.69445480

anything wrong with ruby guys?

>> No.69445489

>>69445134
The article you link is the source of my question. I can create the recursive DList structure fine by tying the knot, however I cannot seem to be able to implement insertion without knowing the actual "length" of my link chain.
It's not something that I'd actually use in practice, since it's so easy to adapt the normal list to have doubly-linked list semantics:
data DList a = DList [a]

mkDList :: [a] -> DList a
mkDList [] = error "dlist empty"
mkDList x = DList x

takeF :: Int -> DList a -> [a]
takeF n (DList x) = take n $ cycle x

takeR :: Int -> DList a -> [a]
takeR n (DList [email protected](x:_)) = x : (take n $ cycle $ reverse t)

next :: DList a -> DList a
next (DList x) = DList $ tail x ++ [head x]

prev :: DList a -> DList a
prev (DList x) = DList $ take l $ drop (l - 1) $ cycle x
where l = length x

insert :: a -> DList a -> DList a
insert a (DList x) = DList (a:x)

remove :: DList a -> DList a
remove (DList []) = error "dlist empty"
remove (DList (_:xs)) = DList xs

>> No.69445616

>>69445466

That's just the bit of logic for mirroring the PPU's memory mapped registers (only bits 0-2 are considered). I guess modulus achieves the same goal. Would it make any difference the compiler really though?

>> No.69445715

>>69445466
I think in that context, & 7 is clearer. He's masking the lower 3 bits.

>> No.69445820

monads are like a dildo factory

>> No.69445827

>>69445480
it's for girls

>> No.69445873

>>69445275
I thought it was cute...

>> No.69445964

>>69442523
Lisp is the most powerful programming language.

>> No.69446039

>https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#jemalloc-is-removed-by-default
I thought the Rust community was religious about using jemalloc instead of the default system allocator.

>> No.69446157

>>69444902
use thumbnails man, I just clicked on a board and scrolled down a little bit and my browser downloaded over 100MiB of images.

>> No.69446253

>>69446157
>downloading 100MiB of illegal.pics
the police is on the way

>> No.69446350

>>69445134
That approach only works if you can actually identify your tail element which is the actual issue.
>>69445489
It's impossible if you don't know the length, store an identifier in your nodes or restrict the elements in some way (e.g. no duplicates or some restriction on order). I'd probably just store the length.
It's the issue >>69443050 mentioned.

If you want to actually use a doubly linked list, I'd recommend just looking into finger trees. It's what Data.Sequence uses and allows an efficient and pure emulation of double linked lists. Your adaption of a linked list is fine and the best you'll get, but it has O(n) complexity for determining the previous element, which isn't all that usable.

>>69443239
That's making it more complicated than needed. Just store an ID directly in your node:
data DList a = DList Int (DList a) a (DList a)

>> No.69446358

>>69445480
monkey patching
performance

>> No.69446650

I'm trying to convert a base64 md5 hash to a "normal" md5 hexdigest.
The following code was used to generate the base64 string:

byte[] bytes = new UnicodeEncoding().GetBytes(input);
return Convert.ToBase64String(new MD5CryptoServiceProvider().ComputeHash(bytes));


If you take "abc123" it will turn into bps6diCq9382J3UVCXfuuA==.
Which you can decode to 6e9b3a7620aaf77f362775150977eeb8

However this is wrong, the md5 of abc123 is e99a18c428cb38d5f260853678922e03.

The problem is that the original dev used UnicodeEncoding and not ASCIIEncoding.

Any ideas? $15 bounty.

>> No.69446706

>>69444939
The janitor and mods that monitor /dpt/ are fucking blind. I've even been banned for on topic posts (while not replying to anyone, and not including any pics), just because it's between 2 shitposts, or because a shitposter replied to me. This never happens on other boards but has happened multiple times here.

>> No.69446713

>>69446650
You can't do it without the original string

>> No.69446740

>>69446650
You're hashing the base64 md5 hash again. You, generally speaking, cannot revert a digest.

>> No.69446761

>>69446713
>>69446740
Shit I feel like an idiot.
The Unicode/Ascii issue occurs before hashing so its not just an encoding/decoding problem.

>> No.69446774

>>69446650

He used UTF-16 Little Endian apparently, whereas you use UTF-8. Adjust your code to do as he does.
>>> hashlib.md5("abc123".encode('utf-16-le')).hexdigest()
'6e9b3a7620aaf77f362775150977eeb8'
>>> hashlib.md5("abc123".encode('utf-8')).hexdigest()
'e99a18c428cb38d5f260853678922e03'

>> No.69446804

>>69446774
That's a Python 3 REPL by the way. If I win the bounty just give it to St-Jude with 'WHITE PRIDE' as the dedication message.

>> No.69446805

>>69442523
Still working on reverse engineering a proprietary and undocumented file format.

>> No.69446857
File: 116 KB, 680x680, absolutely disgusting.jpg [View same] [iqdb] [saucenao] [google] [report]
69446857

>>69446774
>UTF-16 Little Endian

>> No.69446864

>trying to install MIT/GNU Scheme
>keep getting fucking errors
>finally fix one of the sources of errors
>get more errors on the next step

>> No.69446874

>>69446864
use SBCL.

>> No.69446906

>>69446864
in my experience, the dialect used in SICP (1st ed. at least) differs from the GNU dialect in a couple ways. It takes some fucking around to find some of the differences, sadly.

>> No.69446907
File: 157 KB, 1376x1492, glenda.jpg [View same] [iqdb] [saucenao] [google] [report]
69446907

>>69446857
That's MS VisualDOS for you lad. Good thing I'm on Plan9.

>> No.69446910

>>69446864
>>trying to install MIT/GNU Scheme
why? nobody uses MIT scheme. use guile, racket or chicken.

>> No.69446939

>>69446906
https://docs.racket-lang.org/sicp-manual/index.html

>> No.69447153

>>69446857
Hey, if you process a lot of international text it has a better speed/size ratio than UTF-8, since any culture that matters fits in 2 bytes with UTF-16, instead of 3 in UTF-8.

>> No.69447200

I don't understand this in Haskell

mTh x y = \z -> x * y * z


What is happening here exactly? It seems to me that he is declaring a function with two parameters, and inside it there something strange happening with z that I really don't know

My REPL says its type is
Num a => a -> a -> a -> a

Which doesn't make sense since my function has only 2 parameters (x and y)
Any help please?

>> No.69447236

>>69447200
That's a lambda expression.
All three of these mean the same thing.
mTh x y = \z -> x * y * z
mTh x y z = x * y * z
mTh = \x y z -> x * y * z

>> No.69447240

>>69447200
This is literally Haskell-101. Just go fucking read about lambdas and currying, it will take you less than 15 minutes to get it instead of polluting this forum with your blater.

>> No.69447248

I write recreational algebra in javascript
https://pastebin.com/1DWBHuN9

r8 b8 subscribe m8s

>> No.69447255

>>69446157
Thanks, I'll add in thumbnails when I'm back at home tomorrow.

>> No.69447266

>>69447200
mTh returns a function that multiplies a variable by (x*y). That is, mTh 2 3 returns a function \z -> 6 * z. mTh takes two nums, x and y, and returns a function that takes a num and returns a num.

Num a => a -> a -> a -> a
x y (\z -> 6 * z)

>> No.69447298
File: 118 KB, 512x411, 1547682406436.jpg [View same] [iqdb] [saucenao] [google] [report]
69447298

SICP is a meme, what are some good programming books that don't use an obsolete version of an obsolete language?

>> No.69447302

>>69447266
So why there aren't parenthesis on the last a -> a like this

Num a => a -> a -> (a -> a)

>> No.69447306

>>69447298
Read SICP

>> No.69447315

>>69447302
a -> a -> (a -> a) and a -> a -> a -> a are the same thing. Read about currying.

>> No.69447383

>>69447302
The parantheses are implied. -> is right associative

a -> a -> a -> a
=
a -> a -> (a -> a)
=
a -> (a -> (a -> a))

>> No.69447385

>>69447302
https://en.wikipedia.org/wiki/Partial_evaluation

>> No.69447391

>>69447298
just do SICP in r5rs or #lang sicp

>> No.69447395

>>69447302
also this
https://en.wikipedia.org/wiki/Currying

>> No.69447403
File: 1.72 MB, 2100x1400, 1547407541971.jpg [View same] [iqdb] [saucenao] [google] [report]
69447403

>>69447383
fucking haskell seriously

>> No.69447408

>>69447385
partial application /= partial evaluation

>> No.69447421

How can I make visual programming ? Where do I start

>> No.69447441

>>69447421
install gentoo

>> No.69447454

Do any of you think there's ever been a girl (female) in one of these threads?

>> No.69447464
File: 66 KB, 796x596, scratch.png [View same] [iqdb] [saucenao] [google] [report]
69447464

>>69447421

>> No.69447470

>>69447454
>girl (female)
I went through 5 years of IT school and 4 years of university and I saw like 3. One of them is a "man" by now.

I'd say no.

>> No.69447475

>>69439122
>>69439607
Thank you based anons

>> No.69447481

>>69447464
How do I make it though, what pieces and skills do I need to learn ? Why does /g/ suck so much at knowing anything

>> No.69447485

>>69447403
So this is what it's like to be mentally retarded.

>> No.69447508

>>69447403
this is the kind of thing that depressed Java devs permanently stuck at the bottom of the barrel wish they could fool themselves into believing

>> No.69447511
File: 1.00 MB, 218x228, kDefYC2.gif [View same] [iqdb] [saucenao] [google] [report]
69447511

>>69447485
(yOu)

>> No.69447535

>>69447481
I work for a company that provides our clients with a graphical programming language/environment for our clients. Imagine scretch mixed with pascal, running in your browser.
You'll probably want to use a text-based intermediate representation to make life easier, unless you find a really cheeky way to represent the AST using graphical blocks.

>> No.69447650

>>69447421
>>69447481
Are you actually asking about visual programming languages like scratch? Or do by chance mean GUI or graphics programming?

>> No.69447746

From now on I'm only using Java to make compilers. Low level languages are too much of a pain in the ass and Python's dynamic typing causes more problems than it should. Java is exactly what it needs to be a good language for designing compilers.
;1 + 2 * (7 - 3)
mov rax, 7
sub rax, 3
imul rax, 2
add rax, 1

>> No.69447760

>>69447403
wtf is wrong with you to complain about an operator being associative

>> No.69447761

>>69447746
I would call you out for being a dumb cunt for even trying that, but since it's a compiler that will eventually just bootstrap itself it really doesn't matter and that makes java a fine choice

>> No.69447780

>>69442818
try the /dpt/ programming challenges. Commit them to a repository so you have a portfolio type thing of everything you've done so far. Don't know what languages you're familiar with but its good to have examples of what you can do with them posted somewhere.

No clue about intensive code bootcamps but might be worth trying

>> No.69447817

>>69447746
Use Scala instead of Java

>> No.69447876

>>69447746
>1 + 2 * (7 - 3)
>java creates a full assembly with sub,imul,add for a CONSTANT value
>C/C++: mov eax, 9

>> No.69447909

>>69447876
Is the fact that the compiler does math for the programmer a pro or contra for C?

Are you implying java is for smart people that can recognize optimization in math themselves?

>> No.69447933
File: 64 KB, 540x300, baito desu.png [View same] [iqdb] [saucenao] [google] [report]
69447933

>>69447909

>> No.69447938

>>69447909
The compiler should resolve as many referentially transparent expressions as it can. What fucking sense would it make to NOT just return 9 there?

>> No.69447953

>>69445489
> The article you link is the source of my question. I can create the recursive DList structure fine by tying the knot, however I cannot seem to be able to implement insertion without knowing the actual "length" of my link chain.
You can't insert a node without constructing a whole new list. The prior node will have to reference the new node, so the prior node itself must be a new node. Similarly for the following node.

For a singly-linked list, insertion in the middle requires re-creating the list up to the point, but everything after it can be retained. For a doubly-linked list, the re-creation applies both ways, i.e. you'd have to re-create the entire list.

The same reasoning would apply to trees which include "up" links. You couldn't just shallow-copy a subtree by reference because the root would need a new up link, so it would be a new node, meaning its children would need new up links, and so on recursively.

>> No.69447964

>>69447876
I'm actually confused because Java 100% also optimizes constant values.

>> No.69447983

>>69447876
Cool your tits. I just haven't copied over the constant simplification code from the Python version yet.
;print 1 + 2 * (7 - 3)
@func_main:
fs outln, 9
mov rax, 0
ret

>> No.69448002

nextCard :: Game -> Game
nextCard (Game startDeck (_ : xs) alwaysShown False correct wrong) = Game
{ gameStartDeck = startDeck
, gameDeck = xs
, gameAlwaysShown = alwaysShown
, gameShown = alwaysShown
, gameCorrect = correct + 1
, gameWrong = wrong
}
nextCard (Game startDeck (_ : xs) alwaysShown True correct wrong) = Game
{ gameStartDeck = startDeck
, gameDeck = xs
, gameAlwaysShown = alwaysShown
, gameShown = alwaysShown
, gameCorrect = correct
, gameWrong = wrong + 1
}
nextCard [email protected](Game _ [] _ _ _ _) = game

Will lenses help me to make the above code more readable?

>> No.69448067

>>69447953
The issue is that you _can't_ recreate the entire list, because from a circular dll you can't determine the original list unless you have some additional information (length, unique identifiers, etc).

>>69447983
I hope if you're at least using something like ANTLR or Xtext. Otherwise it's really not going to be pretty.

>> No.69448100

>>69448002
readable - maybe, maybe not
nextCard g
| x : xs <- g^.gameDeck
, shown <- g^.gameShown
= ((if shown then gameWrong else gameCorrect) %~ (+ 1)) g
nextCard g = g

where
gameDeck :: Lens' Game [?]
gameShown :: Lens' Game Bool
gameWrong, gameCorrect :: Lens' Game ?

(the ?s could be anything depending on Game, in the last case any Num)

>> No.69448149

>>69448100
Oh, I should also change g to have shown be alwaysShown.
(gameShown .~ g^.gameAlwaysShown)
You can use & (reverse function application operator, in lens and data.function)
g & (if shown then gameWrong else gameCorrect) %~ (+ 1)
& gameShown .~ g^.gameAlwaysShown

(more parens may or may not be needed)
The nice thing here is you can literally do an if statement to determine which field, since a field is a lens is a value.

>> No.69448173

>>69447403
>Java not being too big and bloated to fit

>> No.69448195

>>69448067
This has already been said itt but don't use DLists in Hasklel period. The wiki shows them as a curiosity, not as a practical solution for anything, so unless you're in for the kicks, use finite zippers or something instead. And if you are in for the kicks, imho you need another ADT constructor which serves as a "zero" node in the shitlist.

>> No.69448245
File: 15 KB, 536x459, 1545046525619.jpg [View same] [iqdb] [saucenao] [google] [report]
69448245

>>69448067
Or I could just use a long ass regex and watch the world burn.

>> No.69448305

>>69448245
So your language is regular?

>> No.69448310
File: 2.32 MB, 1130x736, out.webm [View same] [iqdb] [saucenao] [google] [report]
69448310

making a framework for vulkan-accelerated After Effects/Premiere plugins

>> No.69448330

>>69448149
It certainly is more compact, but regarding readability, I don't know.
I'll start using lenses when I'm comfortable using lenses and the Game data type gets out of hand.

>> No.69448391
File: 51 KB, 700x822, Capture.jpg [View same] [iqdb] [saucenao] [google] [report]
69448391

>C++ is dark souls of programming languages
geez, people weren't lying

>> No.69448415

>>69448330
if it's just (literal) lenses rather than other optics included in the lens package, then it isn't so complicated
x ^. l
get field l of x

(l .~ a) x
set field l to a in x

(l %~ f) x
modify field l of x with f

obviously they're subjected to all the usual haskell concepts like partial application, currying, etc.

>> No.69448439

>>69448415
oh and they compose with ., i.e. (x.y) is subfield y of field x -
x ^. name.firstname == (x ^. name) ^. firstname
you don't need to import ., or category or anything, it's just regular function composition (from the way lenses are represented)

>> No.69448486

>>69448391
Do you really like legacy code or do you just like shitty versions of C?

>> No.69448534

>>69448391
lemme guess, your boomer professor made you use some 1998 version C or C++ and scared you off into webdev memelanguage bullshit

>> No.69448646

>>69448439
That's actually much easier than I expected. I'm sure it can get very complex, but I'm able to comprehend '^.' '.~' '%~'. Which says a lot. I'll start using lenses on the next update. Thanks anon.

>> No.69448676

>>69447650
>>69447535
What I think I want is to first build a programming language and then using that build the visual programming aspect

>> No.69448705
File: 44 KB, 636x616, 1521202189899.jpg [View same] [iqdb] [saucenao] [google] [report]
69448705

Employed Haskell programmer reporting in

>> No.69448707

>>69448676
>>69447650
I want it on be general purpose and extensible within itself

>> No.69448804
File: 40 KB, 595x720, 35B8BF88-0F66-47B8-83ED-94847B238DB1.jpg [View same] [iqdb] [saucenao] [google] [report]
69448804

Should I make my compiler detect constant variables and turn them into macros?
For example
let n = 2 + 2

becomes
#define n 4

>> No.69448831

>>69447746
functional languages are pretty great for writing compilers.
this talk is pretty good on the considerations to design languages that are robust to parse
https://www.youtube.com/watch?v=Txf7swrcLYs

>> No.69448849

>>69448705
employed where

>> No.69448874

>>69448804
That's a very basic optimisation technique that every compiler should have.

But you'll want to distinguish between "compile time constant" values and "read-only after initialization" values, if it's possible to do
let n = getUserInputOrSomeShit();

>> No.69448900

>>69448849
Not that guy, but at an university if that counts.

>> No.69448952

>>69448849
mcdonalds, they let me make the fries now

>> No.69448984

>>69448874
I did away with mutability so those are the only two types of variables there will be.

>> No.69448999
File: 5 KB, 225x225, pig.jpg [View same] [iqdb] [saucenao] [google] [report]
69448999

>3 hour till assignment deadline
>decide to wank

>> No.69449012

How do I make an interpreter in an interpreted language? How make compiler in interpreted language

>> No.69449024

>>69449012
Read the Dragon Book.

>> No.69449031
File: 500 KB, 1280x720, 1546076829782.jpg [View same] [iqdb] [saucenao] [google] [report]
69449031

>>69449012

>> No.69449065

>>69442605
elixir > both

>> No.69449080

>>69443368
>x / 0

>> No.69449111

>>69448999
Based degenerate

>> No.69449134

>>69449080
0 is not in the domain of possible inputs for the `x /` function
it's not any more broken than trying to dot-product two vectors of different length

>> No.69449158

>>69443345
Are there any programming languages whose "virtual machines" actually DO resemble modern hardware? language level support for vector/SIMD operations, out-of-order execution, etc
but how would a programming language optimize itself for branch prediction

>> No.69449162
File: 34 KB, 263x360, 1499611764385.jpg [View same] [iqdb] [saucenao] [google] [report]
69449162

>>69448999
>>69449111

>> No.69449174

>>69449158
WASM v2 will have SIMD instructions.

>> No.69449199

I saw the Rust news. Neat.

I'm shouldn't be surprised it has regex, but I am very surprised it didn't support ? until now. Like seriously nigga you expect me to type {0,1} every time?

>> No.69449201

>>69449174
Has anyone actually made a compiler with a WASM target?

>> No.69449247

>>69449158
not that i can think of, keep in mind that this can actually be pretty different depending on processor, video card, machine vs network, etc. the C virtual machine is extremely simple by comparison. I wonder if there could be such a language without it being a pain to use. Ofc if you're programming for an x86 then x86 asm is as close as you'll get, etc.

>> No.69449249

Is const correctness and private fields overrated?

>> No.69449254

>>69449024
But that doesn't apply to.me
>>69449031
Already read

>> No.69449263

>>69448999
>not stopping mid-assignment to jerk off for 2 hours

>> No.69449271

>>69449249
Not when you're dealing with mutable state.

>> No.69449283

>>69448874
Is there a language or language-construct which provides for const/read-only after initialization? I imagine for certain languages it would provide for good optimization if they knew certain dynamic structures weren't going to be editable after initialization.

>> No.69449303

>>69449254
>Already read
Good start, now read the next 4 chapters. The interpreter is in chapter 4, the compiler in chapter 5.

>> No.69449320

>>69449199
(a?) = (a|)

>> No.69449339

>>69442523
learning to test my piece of shit software with Catch2

>> No.69449358

>>69449283
Mine is going to have that and yes it does allow for more optimizations.

>> No.69449373

>>69449303
if I send a github repo with solutions to all exercises of SICP to Google, will they hire me?

>> No.69449406

>>69449283
uh, immutability?

>> No.69449420

>>69449373
maybe as a janitor or something

>> No.69449468

>>69449283
Java lets you initialize global final things in ways that aren't trivial with the keyword static
public static final SomeNontrivialThing THING;

static {
THING = ...
THING.someNonTrivialMember();
}

>> No.69449519

Type erasure at the language level is one of the few things Java got right.

Given the ossification of the CLR and its resulting continued lack of support for HKTs, type erasure in the runtime may turn out to have been the right decision by Java too.

>> No.69449558

>>69449468
I kind of like how Java's final has delayed initialization, kind of sucks that the only alternative is an IIFE in other langs.

>> No.69449652

Is it worth it to test failure cases? We have all kinds of test frameworks that are great for testing if things work, however testing if things should fail is hard, there are many ways things can fail: it can "work" and produce bad values that are expected, it can throw an exception, it can fail to compile, it could return an error code, or any number of other behaviors. One can wrap a failure test that throws an exception, returns a bad value, or returns an error code in such a way to convert expected bad behavior to a failure test pass, but often times this is somewhat difficult because often time you don't care "how" it fails, or what value is returned, just that it did fail. And catching failure that result in compile errors (through static_assert) means working outside of test frameworks and with the build system

>> No.69449686

>>69449065
this

>> No.69449858

>>69449519
What does type erasure at language level mean?
Also, how would type erasure help with HKTs? The JVM doesn't support them so Scala simulates them, right?

>> No.69449883

>>69449519
>Given the ossification of the CLR and its resulting continued lack of support for HKTs
What does this mean?

>> No.69450131

vala is godly

>> No.69450260

>>69449883
HKT = Higher Kinded Types, allowing you to have generic types inside generic types.
HKTs would need to be implemented in the CLR, but the team behind it seems uniwilling to make such large changes.

>> No.69450284

>>69448310
Why aren't you making your own Vulkan-accelerated video composting software

>> No.69450306

>>69450260
I am familiar with the notion of HKTs, I'm just not sure what "the ossification of the CLR" means. I can guess that type erasure makes them easier to implement on the JVM though.

>> No.69450592

>>69446774
the question is how to turn bps6diCq9382J3UVCXfuuA== into e99a18c428cb38d5f260853678922e03

>> No.69450611

>>69449320
BIG THINK. Clever regex there, but you need the grouping so it's a little less intuitive than using straight numbers. You'd want (?: in most cases

>>69449406
For a simple value it's easy, but what about a list you want to read-only allocate during runtime? I normally don't see "constants"/"read-only" in ((((((modern)))))) languages, so Idk if "immutable" is supposed to mean "it's read only, but was given it's value during runtime"

>> No.69450626

>>69450131
>Glib cancer
No.

>> No.69450723

>>69449652
Depends on what you're doing. I worked with SIP and it has standardized results. I specifically had a folder of 20ish "names" for the "From: " sip field, some which should pass, and some which should produce bad results. If there's a standard, it may expect certain failure methods i.e. a name in sip isn't necessary sometimes, if the listener is not using the name to direct traffic (though it should).

Ironically, I introduced a bug when fixing another because with an empty name field, there should be nothing in front of a <resource address> (literal angle brackets). Our code was putting ""<resource address>, because it always quoted the string, even if it was empty. This is unspecified behavior I think (a name MAY?/SHOULD? be in quotes, and no name should have nothing), but someone we worked with was expecting empty quotations.

Our software didn't have a "test harness", but we did have proper/improper behavior, so with VERY strict code changes and explicitly (as best as possible) identified buggy behavior, we were able to make rather precise bugfixes.

Compile errors should always be that - compile errors, not runtime errors. There shouldn't be "errors that compile but are runtime". If your code produces bad values, your code is bad and needs to be fixed, which was why I had to fix the name issue (it was failing on valid but uncommonly used characters).

>> No.69450769

>>69449858
If you declare e.g. a List<Integer> in Java, the compiler will check that you don't try to store other types in it, but in the .class file it will just be a List, no different to a List<Object>. The type information for generic classes is discarded (erased).

The disadvantage is that the type checking only works within a single source file, not between classes. So you can call a method in another class which returns a List of arbitrary objects and store the result in a List<Integer>. If the List contains anything other than Integers, you'll probably get type exceptions at run time.

The advantage is that the type system can be extended without breaking the class file format. C# includes the parameter types for generic containers in the compiled code, so extending the type system would require changing the compiled code format, breaking compatibility. So they don't do it.

>> No.69450770

>>69450592
Oh OK. Well in this case you can't do that without reversing MD5, which you're not supposed to be able to do because it's a hash function. Now I guess you're thinking MD5 is kinda broken. I don't think it's broken enough to do plaintext recovery at neglibible cost tho. I'd have to check the cryptanalyses, which I won't do today. Is it feasible for you to change your protocol down the line so that you use UTF16LE-then-MD5 everywhere instead?

>> No.69450783

>>69442605
Lisp let's you do whatever you want, it's like the chill stoner dad. Haskell on the other is like the helicopter mom who wants to know where you are at all times and never let's you have fun.

The choice should be clear.

>> No.69450814

I feel like my code is retarded, pls halp. It's supposed to round a number up to the nearest number divisible by zero, with ties going towards 0 (and exclude anything but ints from the arguement). I feel the second two conditionals should be able to be combined into one elegant one, I also feel I'm using the modulo in a retarded way on the second condition.

def nearestBusStop(street):
if ((type(street) != int) or (street < 0):
return False
elif (street%8 > 4):
return (street + (8 - (street%8)) #inverse modulo
else:
return (street - (street%8))

>> No.69450834

>>69450769
That's not really true anon. It is discarded at runtime, but the information is still stored in such a way that cross-class generics can still be typechecked. So new List[Integer].getClass and new List[String].getClass are the same.

>> No.69450846
File: 32 KB, 401x500, 1546984302401.jpg [View same] [iqdb] [saucenao] [google] [report]
69450846

>>69450814
>the nearest number divisible by zero

>> No.69450855

>>69450814
>PS
the code isn't wrong, I'm just wondering if a more elegant solution exist.

>> No.69450857

>>69450814
Your math is, rather.
>nearest number divisible by zero
no number is divisible by zero. Do you mean integer numbers?

>> No.69450858

>>69450814
>Mixed return type options
Fuck off with that. God damn python is such a shit language for even allowing that.

def nearest_bus_stop(street: int) -> int:
if (street % 8 > 4):
return (street + (8 - (street%8))
else:
return (street - (street % 8))


If you're going to use that travesty of a language at least do it with static type checking.

>> No.69450866

>>69450846
lmao, I meant divisible by 8, as I'm sure you know.

>> No.69450880

>>69450857
goddammit I meant 8 u nigger

>>69450858
hey, neat. I haven't seen that yet. but it seems like you agree with the underlying math? it just struck me as a little verbose

>> No.69450881

Is there a faster way to dynamically allocate a list or is this as fast as it can get?
;let l = [1, 2, 3, 4, 5]
fsnorax alloc, 5 * rsize ;mallocs 5 * sizeof(int)
mov [rax + 0 * rsize], 1 ;malloc stored in rax
mov [rax + 1 * rsize], 2
mov [rax + 2 * rsize], 3
mov [rax + 3 * rsize], 4
mov [rax + 4 * rsize], 5

>> No.69450912

What do I have to be able to program in .NET with C# to get a job? Can someone give me a project idea that I can get started with?

>> No.69450915

>>69450814
((street+4)//8)*8

>> No.69450922

>>69450880
Oh I'm not gunna bother thinking about your math. Especially not without any context about what the hell you're trying to do with it.
Normally I'd say "It also doesn't even matter, the compiler is way way smarter than you and will probably optimize this out anyways" but I don't think the Python interpreter is clever enough for that.

>> No.69450974

>>69450912
some CRUD app

>> No.69450976

>>69450922
I pretty clearly explained (except the division by 0) what I'm trying to do. It's a *very* simple expression too. I'm not looking for compiler optimizations but a reduction in characters for concision

>> No.69450991

Godbolt is giving me the same thing even with -O2. (No, multiplying by rsize does not slow down the Assembly.)
initlist:
sub rsp, 8
mov edi, 5
call malloc
mov QWORD PTR [rax], 1
mov QWORD PTR [rax+8], 2
mov QWORD PTR [rax+16], 3
mov QWORD PTR [rax+24], 4
mov QWORD PTR [rax+32], 5
add rsp, 8
ret

>> No.69451004

>>69450976
>a reduction in characters for concision
Absolutely fuck off with that thinking. Concise explanations are what comments exist for, and overly terse code more often than not becomes exceedingly hard to parse later.

>> No.69451013
File: 35 KB, 300x300, 1425062273111.jpg [View same] [iqdb] [saucenao] [google] [report]
69451013

>>69450912
>program in .NET with C#
Why do people do this to themselves?

>> No.69451014

>>69450915
fuck yeah thanks anon, glad someone answered my fucking question

>> No.69451028

>>69450991
simd ya doofus
you can write like 128-bits even 256-bits of data with a single instruction at a time

>> No.69451041

>>69450814
Use the fact that integer division rounds down
In general you could also use the ternary operator for such cases e.g.
remainder = street%8
return street-remainder + ((remainder > 4)?8:0)

>> No.69451049

>>69450770
no :/

I just want to throw this base64-UTF16LE-md5 into an optimized md5 cracker.
I guess I'll make something myself and hope to get lucky.

>> No.69451054

>>69450234
can anyone help me?

>> No.69451062

>>69450881
>>69450991
Effectively, no. Allocating stuff into arrays is just sort of inherently costly in terms of instruction count, but you shouldn't ever concern yourself with that. Each of those values has to be generated and inserted into memory at runtime somehow, and there's no guarantee that they'll be a nice sequence every time, so the only way to properly execute that logic is to step through and insert each value one at a time.

It's also a moot concern, if you're worried about asm performance you should be much more concerned with what kind of operators you're using, cache locality, memory access patterns, and that sort of thing. The biggest bottleneck in most programs nowadays usually isn't tied into the logic (assuming its not some haphazard shitpile codebase), it's usually in access patterns. Also always multiply by floats instead of using division operators if it's possible, it's SIGNIFICANTLY faster.

>> No.69451063

>>69451004
i don't give a FLYING FUCK what you think nigger, this solution: >>69450915 is a million times better.

Compare:
def nearest_bus_stop(street: int) -> int:
return ((street+4)//8)*8


to my abomination:

def nearest_bus_stop(street: int) -> int:
if (street % 8 > 4):
return (street + (8 - (street%8))
else:
return (street - (street % 8))


in my eyes, the thrill of programming is elegantly solving problems and elegance is always of the highest priortiy

>> No.69451076
File: 87 KB, 1500x1500, 1.png [View same] [iqdb] [saucenao] [google] [report]
69451076

>>69442523
What programming language is in highest demand right now
I dont want to go balls deep and in six months be outsourced to pajeet
A job opening is here for scala, any advice?
Please God someone help

>> No.69451085

>>69451041
this is also a good solution along the same line of thinking I had, thanks. I do favor the one above slightly though.

>> No.69451099

>>69451054
Sure: Write it yourself pajeet

>>69451028
Vectorized operations are done through the assembler itself, it doesn't show up in generated asm code. If it can write everything in one pass it will, but the instruction set is still gunna be verbose.

>> No.69451121

>>69451013
The main reason I use C# as main work-language is because the documentation in the ide is great in the form of comments, intelisense, self documenting types and so on. Packages also have great documentation and ate easy to use due to C# coding standards, when I want to create a PDF or something I don't want to spend a week trying to figure out how to get the library to do what I want, in C# you can in most cases just get the package and write purely using intelisense and autocomplete and it will do what you expect.

>> No.69451155

>>69451013
What do you mean? I am going to create a CRUD application in ASP.NET with C#. What is wrong with that?

>> No.69451157

What languages have built in broadcasting capabilities? J is the king in this regard, and Julia has some simple broadcasting with the . operator, anything else have any broadcasting?

>> No.69451160

>>69451099
>it doesn't show up in generated asm code
objectively fucking wrong you fucking webdev

https://godbolt.org/z/_L_gkQ

>> No.69451169

>>69451004
god I'm so mad at this idiot, there's simplicity in elegance. you're advocating for inefficient spaghetti code that's overly verbose, that's advocating for complexification. obviously this stuff goes on a case by case basis, and this was objectively the better solution here. It's so much harder to debug spaghetti code than elegant code. i hate you

>> No.69451183

>>69451004
In my view, the original code is a fucking mess. The new version is better because you can visualise the number line being shifted by 4 and then floordivided by 8. Imho if you want to comment something, you do a my_int_rounding(n, step) = ((n+step/2)//step)*step function which you describe, then put in return my_rounding(street, 8).

>> No.69451184

is programming filled with normies? can i get a job if im an autistic misanthrope?

>> No.69451185

>>69451076
Js. It's shit but it's the only language that runs on every platform including frontend web.

>> No.69451188
File: 52 KB, 1024x1010, e1b9854fecda27d4b652b59badebcb5ab6d97641_hq.jpg [View same] [iqdb] [saucenao] [google] [report]
69451188

>>69451099
>Vectorized operations are done through the assembler itself

>> No.69451196

>>69451099
compilers can vectorize you know

>> No.69451229

I don't want to be a web dev. What can I use my Java, C/C++ skills for? I understand memory management, OOP, data structures and algorithms. I know I probably sound like a pajeet or a plebian but please shed some light on me, I'm friendly

>> No.69451238

>>69451229
>C/C++
Why are you grouping two completely different languages together?

>> No.69451250

>>69451121
Yeah, but you're dependent on a Microsoft product.

>> No.69451256

>>69451238
I have used both separately. I wrote it that way because I see it written that way

>> No.69451257

>>69451160
iota lazily evaluates. If you turn off -Ofast (which you should never use) and use -O2 you can clearly see it only inserts the first value, which is 1.

>>69451169
Shut up and comment your fucking code instead of writing unparsable one liner bullshit. I'm not advocated spaghetti code, I'm advocating what literally every single senior developer on the planet advocates and what every single business wants you to do: Clear, verbose code that is well commented.

>>69451183
I mean sure the new version is objectively better (and faster) but that doesn't mean the line of thinking was shit. Reducing character count is a terrible way to look at improving code.

>>69451196
Yes but those operations are still laid out in sequence in asm. Vectorization happens on the machine-code level, and isn't even a guarantee. The sequential order of instructions has to be retained to guarantee eventual execution.

>> No.69451261

>>69451229
get into gpu programming, be it vulkan or metal or directx or opengl
just get into it and find a fast way to solve a problem, even something like "find the median color of an image", find a way to do it on the GPU and expand from there like "fast GP-GPU based sorting in vulkan"

mass-parallelism is going to be the cutting board of a lot of future technologies and nows a good time to be a part of it, especially with Intel releasing compute/gpus very soon and even at a different scale with things like AVX512 becoming "mainstream"

>> No.69451265

>>69451256
They're two completely distinct languages.
Writing it like that shows that you actually don't know anything about either.

>> No.69451278

>>69451257
>I mean sure the new version is objectively better (and faster) but that doesn't mean the line of thinking was shit. Reducing character count is a terrible way to look at improving code.
The original is almost impossible to understand

>> No.69451279

>>69451257
aw shit guys we angered the webdev zoomer
thread over

>> No.69451293

>>69451265
I can write code with both of them?

>> No.69451295

>>69451265
C is just C++ with structs.

>> No.69451298
File: 104 KB, 782x1022, 7CsOm.jpg [View same] [iqdb] [saucenao] [google] [report]
69451298

>>69451257
_mm_add_epi32 and -ftree-vectorize would like to have a word with your dumb ass

>> No.69451331

>>69451257
This arguement isn't about commenting. You acknowledge this yourself here:
>Concise explanations are what comments exist for, and overly terse code more often than not becomes exceedingly hard to parse later.

I never said I wasn't going to comment it, I am only focused on the actual code in this discussion. Also, if you can't parse that, you're an idiot. I know you can parse it, a child could.

>Clear, verbose
Lol no. Verbosity isn't a universal standard to aim for.. Jesus Christ. There are times to be verbose and there are times when overly verbose code complicates things endlessly. The code snippet I provded was a great example, it was drastically simplified in terms of dev understanding by being more concise. This leads to shorter, more understandable programs by extension. I'm not saying concision is a universal standard to aim for either, cuz I'm not an idiot, but instead that it is of a case by case nature.

you make yourself look dumber every post

>> No.69451333

>It's another /dpt/ thread that has resorted to "U-HM ACTUALLY" posting

i miss advent of code

>> No.69451344

>>69451250
You mean VS? Because everything else about C# is open source. I'd rather be dependent on a company that provides the best ide available for free, than use the shitty alternatives.

>> No.69451361

>>69451293
I don't go around writing C/sh just because I know how to write both. / is not a separator for a list.
Not to mention that C and C++ are VERY different languages. It takes a certain type of retard to become proficient with C++ and actually say that they like it.
You should leave it off and just forget everything you know about it. Anyone sensible and with any taste will look down on you for saying you like it.

>> No.69451388

>>69451361
>UM
>ACTUALLY

>> No.69451403

>>69451183
Well said anon, thanks. This is a nice, general solution.

>> No.69451415

>>69451361
>It takes a certain type of retard to become proficient with C++ and actually say that they like it.

Ok I see. What language do you suggest I use to pull myself out of the slums

>> No.69451524

>>69451415
Fortran

>> No.69451548

new thread when? :3

>> No.69451561

This is how Godbolt is telling me to duplicate a list. Is this really the most efficient way?
initlist:
push rbx
mov rbx, rdi
mov edi, 5
call malloc
movsx rdx, DWORD PTR [rbx]
mov QWORD PTR [rax], rdx
movsx rdx, DWORD PTR [rbx+4]
mov QWORD PTR [rax+8], rdx
movsx rdx, DWORD PTR [rbx+8]
mov QWORD PTR [rax+16], rdx
movsx rdx, DWORD PTR [rbx+12]
mov QWORD PTR [rax+24], rdx
movsx rdx, DWORD PTR [rbx+16]
mov QWORD PTR [rax+32], rdx
pop rbx
ret

>> No.69451565

Are there any descriptions around for how LZO is implemented? Doesn't seem like there are any other implementations, just bindings to the C code.

>> No.69451566

>>69451548
never, this is the last /dpt/ ever

>> No.69451572

>>69443752
this

>> No.69451576

New thread:
>>69451570
>>69451570
>>69451570

>>69451548
Stop asking.

>> No.69451658
File: 483 KB, 2560x1600, 2019-01-20-165503_2560x1600_scrot.png [View same] [iqdb] [saucenao] [google] [report]
69451658

>>69442523
Fast change directory.

>> No.69451663

>>69450915
In C I used this at work:
#define round_nearest_uint(x,n) ((((x) + ((n)/2)) / (n)) * (n))

>> No.69451669

>>69451565
There's this. Although it's heavily derived from said C code. But I don't think there's massive amounts of n00b-friendly explanations on LZO specifically. Maybe on this style of algorithms in general idk. Look for gzip or zlib reimplements, that'll help you the best cuz it's not that different afaik.
https://github.com/shevek/lzo-java

>> No.69451750

>>69451099
i actually did it myself and now i can speak javanese. thanks /g/

>> No.69451827

Qt5 gui with user login

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action