Slurps Mad Rips posted:you actually did it right, its just that std::accumulate exists and you reimplemented it gently caress I was trying to pick a language that didn't already have some form of foldl somewhere in the standard library and I forgot about std::accumulate. Ummm okay what about this (probably wildly unsafe and full of UB) C version? C++ code:
C++ code:
|
|
# ? Jul 11, 2017 06:16 |
|
|
# ? May 26, 2024 14:27 |
free tibet and also, somewhat less importantly, my post
|
|
# ? Jul 11, 2017 06:17 |
Ugh writing anything remotely generic in C sucks. That template-filled C++ version was much more pleasant to write, and I'm considerably more confident that it did not have any UB.
|
|
# ? Jul 11, 2017 06:31 |
|
VikingofRock posted:and I'm considerably more confident that it did not have any UB.
|
# ? Jul 11, 2017 06:44 |
in other baby coder news ive been writing issues for some microsoft os things and it's really cool to discuss them with the devs, although i do feel sorry they don't have anyone help them out with unfiltered internet "issue" flow
|
|
# ? Jul 11, 2017 06:49 |
|
cinci zoo sniper posted:in other baby coder news ive been writing issues for some microsoft os things and it's really cool to discuss them with the devs, although i do feel sorry they don't have anyone help them out with unfiltered internet "issue" flow
|
# ? Jul 11, 2017 07:10 |
|
VikingofRock posted:free tibet and also, somewhat less importantly, my post i've got china on the line and they say they'll free tibet as long as your posts stay captive
|
# ? Jul 11, 2017 07:26 |
visual studio is not launching on my commodore, please URGENTLY help, ASAP i implore u
|
|
# ? Jul 11, 2017 07:30 |
|
cinci zoo sniper posted:visual studio is not launching on my commodore, please URGENTLY help, ASAP i implore u works4me
|
# ? Jul 11, 2017 07:42 |
|
i'm porting a piece of software we wrote in javascript to go as a proof of concept and it's not a great language to write in if you don't know the shape of your data until runtime that led me to a question: beyond p-langs are there any languages where it's not stupidly annoying to deal with unknown data without a predefined shape?
|
# ? Jul 11, 2017 14:40 |
|
Sapozhnik posted:(which no two people seem to have a common definition for anyway) gonadic io posted:we are all that programmer unfortunately a rockstar like that guy from everclear but whatever VikingofRock posted:Ugh writing anything
|
# ? Jul 11, 2017 18:37 |
|
tps: investigating out of memory errors. discovered that a coworker had decided that in order to make lookups o(1) instead of o(log n), it was worth doing a whole bunch of extra work up front and incidentally using o(n2) space instead of o(n) this naturally makes the initial computation very expensive, so they also memoize the results, even though each is typically only used once, in an unbounded cache that appears never to remove entries how did this ever work
|
# ? Jul 11, 2017 19:50 |
|
John Big Booty posted:
bugs is right. logic belongs in the controller. logic in the model is asking for pain.
|
# ? Jul 11, 2017 19:54 |
|
logic in the view
|
# ? Jul 11, 2017 19:59 |
|
well with react you just get trees of "components" and they can be either bits of logic or bits of view! or hey why not both! youtube video: sapozhnik reacts to reactjs: its poo poo
|
# ? Jul 11, 2017 20:02 |
|
Shaggar posted:bugs is right. logic belongs in the controller. logic in the model is asking for pain. What would the argument even be for having logic in the model? It seems obvious that control logic should be in the controller.
|
# ? Jul 11, 2017 20:10 |
|
control logic in the controller, business logic in a service layer, dumb models. fite me
|
# ? Jul 11, 2017 20:26 |
|
ThePeavstenator posted:What would the argument even be for having logic in the model? It seems obvious that control logic should be in the controller. making the model "smart" is stupid orm-think.
|
# ? Jul 11, 2017 20:30 |
hmm, hadley is turning out to be about as insufferable as i suspected
|
|
# ? Jul 11, 2017 20:59 |
|
Potassium Problems posted:control logic in the controller, business logic in a service layer, dumb models. it's this if you're not doing this you better have a good reason
|
# ? Jul 11, 2017 22:28 |
|
VikingofRock posted:IMO the simplest thing to do here is to wrap all the data in Rc / Arc (+ RefCell if you need to modify the contained data). If that's too expensive, then you need to carefully consider what is responsible for allocating / deallocating the data--this is the owner of the data. If you can convince Rust that the owner of the data will outlive the other thing (which it had better!), then you can have the non-owner contain references to the owner. If for some reason this doesn't work, then your next options are (1) have the non-owner contain some sort of key used to lookup and retrieve items in the owned data, or (2) use raw pointers. The last option is not really so bad--you can contain all the unsafety in the access methods, and then provide a safe interface by returning raw_ptr.as_ref().expect("aw crud that pointer was null"). Woohoo Rc did the trick, but I am definitely abusing it / using it improperly. Still, closures work now! https://github.com/daviswahl/monkey_rs/blob/master/src/evaluator.rs
|
# ? Jul 11, 2017 22:31 |
|
Blinkz0rz posted:it's this logic in the everywhere wired together with osgi i mean, it's an application server so what can you do
|
# ? Jul 11, 2017 22:36 |
|
Sapozhnik posted:well with react you just get trees of "components" and they can be either bits of logic or bits of view! or hey why not both! it's because everything on the front end should only deal with the presentation. it's all view. if you have business logic written in javascript, lol.
|
# ? Jul 11, 2017 22:48 |
MALE SHOEGAZE posted:Woohoo Rc did the trick, but I am definitely abusing it / using it improperly. Still, closures work now! Glad to hear it! So I was just reading this proposal about improving Rust lifetime checking, and at the end of the article they mention a crate which might be useful to you in the case that you want to allocate everything in an Environment, and then have an AST contain references to that. Your program seemed like a likely possible use-case so I thought I would pass it along.
|
|
# ? Jul 11, 2017 22:55 |
|
Blinkz0rz posted:i'm porting a piece of software we wrote in javascript to go as a proof of concept and it's not a great language to write in if you don't know the shape of your data until runtime Clojure is good for this, and spec can help too
|
# ? Jul 11, 2017 23:15 |
|
carry on then posted:logic in the view drat it man, there are some things you don't say in public.
|
# ? Jul 11, 2017 23:35 |
question of the day: is there, in some language or framework, a genuinely good plotting library that is not a hosted solution of some sort?
|
|
# ? Jul 11, 2017 23:37 |
|
matplotlib?
|
# ? Jul 11, 2017 23:58 |
|
LineTo(Integer h, Integer v)
|
# ? Jul 12, 2017 00:12 |
MeruFM posted:matplotlib? well excluding matplotlib, ggplot, and their derivatives. i like matplotlib as a plotting device, but not really as a thing to set up or debug. ggplot is ok i suppose too, but i don't think ill ever come to like it. what i wonder if there's anything anywhere that's better than those, and not a web service.
|
|
# ? Jul 12, 2017 00:17 |
I've seen some pretty incredible stuff produced with gnuplot. I've never personally used it though, so I don't know if it itself is good or whether people have just managed to use it to good effect despite underlying terribleness.
|
|
# ? Jul 12, 2017 00:43 |
|
could try d3js i guess
|
# ? Jul 12, 2017 00:47 |
|
cinci zoo sniper posted:question of the day: is there, in some language or framework, a genuinely good plotting library that is not a hosted solution of some sort? if you want to make pretty pictures then there's a lot of different nice ways to do that inside of python notebooks, but if you want to make interactive things that are graphs it is a javascript hellscape at best unless bokeh is good now
|
# ? Jul 12, 2017 00:47 |
|
Sapozhnik posted:could try d3js i guess good d3 is kind of amazing for how smooth it looks, but also takes more time than i would like to make a spinning circle expand on mouse over
|
# ? Jul 12, 2017 01:43 |
|
d3 is good game update: i got the game connected to game center AND sending turns back and forth between my busted old iphone 5 and my iphone 6. yase! gamekit owns unfortunately my underlying code isn't very MVC but oh well it works ha ha ha ha
|
# ? Jul 12, 2017 01:47 |
|
on swift 4, awful.app now stack overflows when entering the background due to core data and/or grmoustache this is gonna be so fun to debug
|
# ? Jul 12, 2017 01:54 |
|
Shaggar posted:bugs is right. logic belongs in the controller. logic in the model is asking for pain. how do you feel about stored procedures shaggar
|
# ? Jul 12, 2017 02:39 |
|
i thought that "view" was your render template, "controller" contains the methods that get called when clients make requests, and "model" is literally everything else. I do very simple kinds of parsing of URL query parameters in controller methods and otherwise delegate poo poo out to another layer.Blinkz0rz posted:i'm porting a piece of software we wrote in javascript to go as a proof of concept and it's not a great language to write in if you don't know the shape of your data until runtime I don't know how you can write a program that operates on data whose shape you know jack poo poo about unless it's serialization or tree traversal or something else that really doesn't care how many attributes there are on a particular node or whatever, it just slurps them all up. basically, if you can't represent the kind of program you're talking about in typescript without using `any`, something seriously hosed up is going on.
|
# ? Jul 12, 2017 03:03 |
|
tef posted:how do you feel about stored procedures shaggar well that's where your business logic goes!
|
# ? Jul 12, 2017 03:08 |
|
|
# ? May 26, 2024 14:27 |
|
stored procs are the best cause they house your sql and abstract your application model from your data model.
|
# ? Jul 12, 2017 03:12 |