|
good god lens tutorials are the new monad tutorials
|
# ? Jun 24, 2015 16:20 |
|
|
# ? May 26, 2024 17:43 |
|
rrrrrrrrrrrt posted:lol, lens defense incoming!! cba, can somebody else say that yes those operators are excessive but they kinda make sense as a dsl?
|
# ? Jun 24, 2015 16:35 |
|
rrrrrrrrrrrt posted:good god lens tutorials are the new monad tutorials and no, still plenty of new monad burrito "they make so much sense to me now!" tutorials appearing
|
# ? Jun 24, 2015 16:36 |
|
gonadic io posted:cba, can somebody else say that yes those operators are excessive but they kinda make sense as a dsl? I had you in mind when I wrote that. Shameful.
|
# ? Jun 24, 2015 16:40 |
|
VikingofRock posted:Isn't next() is doing the same thing as dereferencing it? you're making an assumption that inside the Iterator there is a chunk of memory and a pointer referencing a location in the memory, but an iterator could be doing anything to obtain the next element in its sequence. code:
|
# ? Jun 24, 2015 16:41 |
|
rrrrrrrrrrrt posted:I had you in mind when I wrote that. i know, who else would do it?
|
# ? Jun 24, 2015 16:45 |
|
i cant decide whether it's an important difference in the java iterator interface vs the c# enumerator interface that the enumerator interface has MoveNext and Current, while the iterator interface just has next, so you can access the current value more than once with an IEnumerator i guess it'd be easier to implement infinite sequences that conform to the java interface and it's not like it's a big deal that your calling code has to define the temp variable if it wants it
|
# ? Jun 24, 2015 16:52 |
|
its true
|
# ? Jun 24, 2015 16:53 |
|
also idk if i would have put remove() on that interface and not on some other interface, FullAccessIterator or somesuch
|
# ? Jun 24, 2015 16:55 |
|
fleshweasel posted:you're making an assumption that inside the Iterator there is a chunk of memory and a pointer referencing a location in the memory, but an iterator could be doing anything to obtain the next element in its sequence. you are in this case "pointing" to the chunk of memory designated by "prev", though iterators do whatever they want when you increment them and return whatever they want when you dereference them, you can give those operations different names if you want but that's what they do
|
# ? Jun 24, 2015 16:57 |
|
gonadic io posted:i know, who else would do it? tbf i think lens is really cool but most of those operators... goddamn. pretty indefensible imo. and "it makes sense if you use them all the time and memorize these simple mnemonics!" is not a good defense.
|
# ? Jun 24, 2015 17:15 |
|
rrrrrrrrrrrt posted:tbf i think lens is really cool but most of those operators... goddamn. pretty indefensible imo. and "it makes sense if you use them all the time and memorize these simple mnemonics!" is not a good defense. the worst one i've ever actually used myself is <<>= which is basically the writer monad's tell function. gonadic io fucked around with this message at 17:42 on Jun 24, 2015 |
# ? Jun 24, 2015 17:26 |
|
current terrible programmer status: i'd like to thank this paper for including both pseudocode and an appendix with their actual code in. between the two im quite able to translate it into f#
|
# ? Jun 24, 2015 17:37 |
Dessert Rose posted:you are in this case "pointing" to the chunk of memory designated by "prev", though Yeah this is what I was trying to say; I was just saying it poorly.
|
|
# ? Jun 24, 2015 18:08 |
|
Dessert Rose posted:also idk if i would have put remove() on that interface and not on some other interface, FullAccessIterator or somesuch FullSpectrumIterator
|
# ? Jun 24, 2015 18:10 |
|
being able to define an entire iterator with a single method definition in c# is so amazing, like you don't have to janitor class definitions or state variables, just write the method that generates the next element and yield return it from the loop that you'd naturally write
|
# ? Jun 24, 2015 18:13 |
Dessert Rose posted:being able to define an entire iterator with a single method definition in c# is so amazing, like you don't have to janitor class definitions or state variables, just write the method that generates the next element and yield return it from the loop that you'd naturally write drat that sounds sick
|
|
# ? Jun 24, 2015 18:14 |
|
VikingofRock posted:drat that sounds sick the canonical fibonacci example: code:
|
# ? Jun 24, 2015 18:19 |
|
FWIW, Python also does this toocode:
|
# ? Jun 24, 2015 18:31 |
|
That's cool
|
# ? Jun 24, 2015 18:36 |
|
MononcQc posted:FWIW, Python also does this too fyi you missed the first "1", it goes 1, 1, 2, 3 ...
|
# ? Jun 24, 2015 18:40 |
|
Dessert Rose posted:fyi you missed the first "1", it goes 1, 1, 2, 3 ... yeah, but I decided not to care more; guessed iterators were important more than the rest here. Here's the fixed one anyway: code:
|
# ? Jun 24, 2015 18:48 |
|
welcome... to the Fibonacci Zone
|
# ? Jun 24, 2015 18:58 |
|
I am pleased to see that java.util.Iterator.remove() now has a default implementation that throws an UnsupportedOperationException.
|
# ? Jun 24, 2015 18:59 |
|
I literally don't think I have ever used remove() on an iterator, or seen any code that uses it, or seen any iterator implementations outside the stdlib that support it
|
# ? Jun 24, 2015 19:09 |
|
one cannot imagine the depths of terrible programming
|
# ? Jun 24, 2015 19:12 |
|
i want to make a program like gofmt for another language. i have a bnf grammar of the language and a vague idea of the things i would need to write to make it. this is the sort of thing that functional languages and pattern matching are good at, right? im thinking this may be an istp to learn f# with.
|
# ? Jun 24, 2015 20:46 |
|
camlp4 is an interesting comparison (and being implemented for and in ocaml, it should be fairly close to the f# world) basically it's a parser and pretty-printer, kinda like gofmt, except it also permits other kinds of transformation so it can also implement preprocessing, syntax extensions, etc i've never looked at the implementation though so i don't know how hideous it is (probably very)
|
# ? Jun 24, 2015 20:50 |
|
as an ocaml programmer, i recommend staying away from camlp4. it is very complicated and you probably don't need it if you're interested in source code formatting in the ocaml world check out ocp-indent
|
# ? Jun 24, 2015 20:53 |
|
Bloody posted:i want to make a program like gofmt for another language. i have a bnf grammar of the language and a vague idea of the things i would need to write to make it. this is the sort of thing that functional languages and pattern matching are good at, right? im thinking this may be an istp to learn f# with. seems like the kind of thing functional stuff would be good at. Might as well do the F# if you want to.
|
# ? Jun 24, 2015 20:57 |
|
OldAlias posted:it has a bad reputation. the main spots you'd go for perl knowledge are old as gently caress - design wise + if you aren't paying attention you're going to get advice from 15 years ago where people seemed to tolerate horseshit. perl is good at certain things and has been bludgeoned into other roles like any other plang. idk CPAN is at least sane to use. Fair. It gets a lot of use still in the networking field to write scripts so I had to learn it and I like it!
|
# ? Jun 24, 2015 22:19 |
Bloody posted:i want to make a program like gofmt for another language. i have a bnf grammar of the language and a vague idea of the things i would need to write to make it. this is the sort of thing that functional languages and pattern matching are good at, right? im thinking this may be an istp to learn f# with. Sounds pretty reasonable. I can't speak for F#, but yeah functional languages tend to be good at stuff like that.
|
|
# ? Jun 24, 2015 22:28 |
|
abigserve posted:Fair. It gets a lot of use still in the networking field to write scripts so I had to learn it and I like it! this is exactly perl's wheelhouse and it's still a good fit.
|
# ? Jun 24, 2015 22:35 |
|
JewKiller 3000 posted:as an ocaml programmer, i recommend staying away from camlp4. it is very complicated and you probably don't need it fair enough, I haven't really done ocaml for years so I'm sure my opinions are a bit dated do you actually get paid to ml?
|
# ? Jun 24, 2015 22:40 |
|
Dessert Rose posted:i cant decide whether it's an important difference in the java iterator interface vs the c# enumerator interface that the enumerator interface has MoveNext and Current, while the iterator interface just has next, so you can access the current value more than once with an IEnumerator i just give up every time i tr yto write a c++ iterator afaict it's a terrible interface for anythig but iterating over an array c++ also has weird rules for what can be initialized how, so it was hard to make temporary values with generic types iirc
|
# ? Jun 24, 2015 23:20 |
|
Soricidus posted:I literally don't think I have ever used remove() on an iterator, or seen any code that uses it, or seen any iterator implementations outside the stdlib that support it it's not really very useful after about Java 1.5 i used it the other day though lol
|
# ? Jun 24, 2015 23:28 |
|
suffix posted:i just give up every time i tr yto write a c++ iterator i usually cheat and instead of writing custom iterators i write a template function that iterate over whatever i need and calls a lambda given as parameter on each element, it's much easier and when you write the function call + the lambda it kinda looks like a custom for loop ranges will make all that stuff easier: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4128.html
|
# ? Jun 24, 2015 23:48 |
|
Crystal is really promising. i'm doing a web frontend for the docker daemon and in a couple days i've written a) a bespoke routing thing b) bespoke html templating c) the docker client d) bespoke logging thing e) some of a file based storage thing for holding the state (a lot of this stuff exists on github i'm sure but i'm just trying to use the stdlib for fun) anyhow it's basically like using ruby except you can develop EVEN FASTER!! because typing makes your job easier. also macros own and are way better than dynamic bullshit. it's got a little ways to go but it's really really good.
|
# ? Jun 25, 2015 02:10 |
|
i'm not about to hate on anyone's choice of fuckaround language but if you want something vaguely ruby-like but better why not elixir?
|
# ? Jun 25, 2015 05:10 |
|
|
# ? May 26, 2024 17:43 |
|
crystal is statically typed, I guess
|
# ? Jun 25, 2015 06:34 |