Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
crazypenguin
Mar 9, 2005
nothing witty here, move along
if you mark intsToAges as inline, it'll probably be fused away and be free again.

I agree that 'probably' is a problem, though. guarantees are nice.

also what fix are you talking about? is it going to recognize that 'Age' is really just 'id' and rewrite away 'map id'?

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006

coffeetable posted:

was just adding in a reply to your edit, but yeah that's the thing. map/mapM/mapM_ is fine because anyone working in haskell knows what a pain state is and has had lazy evaluation drilled into them since day one. in contrast, the majority of .net devs probably dont know what a side-effect is, and all LINQ's laziness means to them is that they need to scatter some ToList()'s around to stop VS complaining

yeah the vs devs are busy trying to write something worthwhile

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

crazypenguin posted:

if you mark intsToAges as inline, it'll probably be fused away and be free again.

I agree that 'probably' is a problem, though. guarantees are nice.

also what fix are you talking about? is it going to recognize that 'Age' is really just 'id' and rewrite away 'map id'?

it should since newtype constructors should be no-ops

iirc the "fix" is to prevent you from breaking the type system in half with newtypes, generalized nt deriving and type families

gonadic io
Feb 16, 2011

>>=

crazypenguin posted:

if you mark intsToAges as inline, it'll probably be fused away and be free again.

I agree that 'probably' is a problem, though. guarantees are nice.

also what fix are you talking about? is it going to recognize that 'Age' is really just 'id' and rewrite away 'map id'?

https://ghc.haskell.org/trac/ghc/wiki/NewtypeWrappers posted:

It should be possible to add REWRITE rules that turn, for example, map N into the zero-cost conversion from C T to C N
[...]
No work towards [this] goal has been done.

so you'd have the function coerce which can be specialised to have type [Int] -> [Age]. this will (ideally) mean that your use of coercion can be checked to be valid at compile time. the automatic compiler stuff will be some later release i guess

gonadic io fucked around with this message at 21:16 on Jan 23, 2014

detroit
Nov 11, 2009
bang keys run code fix later

code:
%dmpGZ(gz) ;
 S I="" F  S I=$O(^IDX(gz,I)) Q:I']""  D
 . W !,gz_": "_I
 . K PC F  S PC=$O(^IDXGZ(gz,I,PC)) Q:PC=""  D
 . . Q:PC?1N1.E ; fix later
 . . W !,?5_PC_": "_^IDXGZ(gz,I,PC)
 Q

tacodaemon
Nov 27, 2006



Gazpacho posted:

i thought gpl 3 existed because rms spazzed out when he heard that people couldn't hack their tivos

tbf i did get messed up by tivo pairing its web services api with an ssl certificate that expired a couple of years ago with no way to update it

Notorious b.s.d.
Jan 25, 2003

by Reene

Shaggar posted:

web 2.0 is dumb as poo poo, knockout just makes some of it easier. The cool thing about knockout is you don't have to fill it with ajax, you can have your server generate the javascript model and content and put it all on the page and then just let knockout handle things like adding dynamic fields and stuff. Legitimate stuff you would normally do w/ jquery but is still gay as balls javascript that you want to do as little of as possible.

normally i disregard it when people talk shop about js frameworks because i hate js and i hate browsers. but when someone who hates js and likes actual good languages endorses knockout, i think i had better take a look

gonna use knockout for my newest un-finish-able hobby project

Nomnom Cookie
Aug 30, 2009



detroit posted:

bang keys run code fix later

code:
%dmpGZ(gz) ;
 S I="" F  S I=$O(^IDX(gz,I)) Q:I']""  D
 . W !,gz_": "_I
 . K PC F  S PC=$O(^IDXGZ(gz,I,PC)) Q:PC=""  D
 . . Q:PC?1N1.E ; fix later
 . . W !,?5_PC_": "_^IDXGZ(gz,I,PC)
 Q

it's...it's beautiful

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
when you get promoted from junior dev at epic systems they pass around a loving cup

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Notorious b.s.d. posted:

normally i disregard it when people talk shop about js frameworks because i hate js and i hate browsers. but when someone who hates js and likes actual good languages endorses knockout, i think i had better take a look

gonna use knockout for my newest un-finish-able hobby project

i have the same feeling, i just started a project that i didn't really want to do a web ui for anyway but honestly writing the iOS app is going to be just as hard and i'm going to have to implement server calls everywhere so i might as well write the "cross platform" version first

i wasn't going to do it because implementing this kind of thing in jquery looked like a pain in the rear end but knockout looks almost not-terrible

RICHUNCLEPENNYBAGS
Dec 21, 2010

Shaggar posted:

haha so much linq abuse. linq is so cool. never doing a for loop ever again

it's cool how resharper is like "oh, i see you have a foreach going here, i recommend you replace it with a completely illegibile ten-line linq query"

RICHUNCLEPENNYBAGS
Dec 21, 2010

coffeetable posted:

LINQ expressions are supposed to be free of side effects, because procedurally-minded devs playing with lazily-evaluated side-effects is a recipe for disaster. of course there's nothing enforcing that and people do xs.Select(x => spray_state_everywhere(x)) all the time, but the C# team feel that a ForEach() would just be encouraging people

if you really want that syntax, you can still do xs.ToList().ForEach(x => poop(x))

or just write like a four-line extension method. but it gets bad when your statement extends past just a single line

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance
linq is so great, probably the #1 c# feature i miss in java

Shaggar
Apr 26, 2006

Notorious b.s.d. posted:

normally i disregard it when people talk shop about js frameworks because i hate js and i hate browsers. but when someone who hates js and likes actual good languages endorses knockout, i think i had better take a look

gonna use knockout for my newest un-finish-able hobby project

MVC 4/5 have 2 default javascript includes. jquery and knockout.

If you've ever used xaml before knockout will make loads of sense. you create your markup and anywhere you want dynamic content you put a data-bind tag w/ the bind information and the source in the view model. THen in ur view model you do stuff like have normal fields and then also dependent fields that are changed when the fields they depend on change. u can either put data into this viewmodel during the generation of the page and/or pump json into it via the ko.mapper plugin after the page is loaded. if you wanted to be really stupid you could probably do like a websockets or some other persistent connection w/ a server to continuously update data on the page by updating the fields of the viewmodel. it works and its not bad. I mean its not as good as xaml but what is?

for my current project it was a lifesaver cause of the static markup restriction and w/out knockout it probably would have been a massive pain in the dick. if I didn't have that restriction I would still probably use it, but not as much. Like anything if you don't need to use it then don't try to force it in there.

FamDav
Mar 29, 2008

HORATIO HORNBLOWER posted:

haskell is so great, probably the #1 feature i miss in java

Notorious b.s.d.
Jan 25, 2003

by Reene

HORATIO HORNBLOWER posted:

linq is so great, probably the #1 c# feature i miss in java

tie to learn scala

Plastic Snake
Mar 2, 2005
For Halloween or scaring people.

Shaggar posted:

i don't think im actually using ForEach im just using stuff like GroupBy and Select and ToDictionary for transforming data.

where is shaggar and what did you do to him

Shaggar
Apr 26, 2006
im here. writing some interfaces for various components of my Pandora client that contain async requests and event delegates for handling the results so I can separate the various event generators and consumers so they only need to know about their own stuff.

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance

Notorious b.s.d. posted:

tie to learn scala

i looked at it but what a pain. not nearly as ridiculous as clojure but still it's just not worth it

Notorious b.s.d.
Jan 25, 2003

by Reene

HORATIO HORNBLOWER posted:

i looked at it but what a pain. not nearly as ridiculous as clojure but still it's just not worth it

it is really not a pain

if you don't want to use the panoply of crazy features, no one will ever make you. You can just sit tight and use it as a java with lambdas and mixins and properties. That's what I have been doing

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





julia seems like basically the best thing ever. someone talk me out of learning it

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

dont learn julia

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
some guy on hn is betting on julia!!

Zombywuf
Mar 29, 2008

the talent deficit posted:

julia seems like basically the best thing ever. someone talk me out of learning it

It treats UTF-8 strings like arrays of bytes. This is bad.

seiken
Feb 7, 2005

hah ha ha

coffeetable posted:

BALLMER BALLMER BALLMER BALLMER
____/


fritz
Jul 26, 2003

the talent deficit posted:

julia seems like basically the best thing ever. someone talk me out of learning it

in the future half the people who write lovely unreadable matlab programs will be writing lovely unreadable Julia programs instead

Cybernetic Vermin
Apr 18, 2005

the world runs on lovely unreadable code, pushing people from matlab to design-patterned uml-modelled high design poo poo would be a huge loss of programmer efficiency

also, if you think such a thing as an ugly piece of code that is less than a kloc exists you are too concerned with irrelevant trivialities

tef
May 30, 2004

-> some l-system crap ->

Cybernetic Vermin posted:

the world runs on lovely unreadable code, pushing people from matlab to design-patterned uml-modelled high design poo poo would be a huge loss of programmer efficiency

also, if you think such a thing as an ugly piece of code that is less than a kloc exists you are too concerned with irrelevant trivialities

challenge accepted

code:
# Python or Ruby
l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10)),'l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10))','print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))'
print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))
code:
print "\n".join(x.rstrip() for x in (lambda y: y(y,3,3))\
    (lambda x,n,w: ["%s/%s\\%s"%(" "*j, " "*(2*i)," "*j)\
    for (i,j) in zip(xrange(0,w),xrange(w-1,0,-1))]+\
    ["%s"%("-"*w*2)] if n == 0 else ["%s%s%s"%(" "*(w*2**\
    (n-1)), l, " "*(w*2**(n-1))) for l in x(x,n-1,w)]+\
    ["%s%s"%(l,l) for l in x(x,n-1,w)]))
code:
print "\n".join(x.rstrip() for x in (lambda y:y["t"](y,5,1))({"t":lambda y,n,w:["  "*w for _ in xrange(1,w)]+["__"*w] if n == 0 else ["%s%s%s"%(" "*(len(t)//2),t," "*(len(t)//2)) for t in y["t"](y,n-1,w)]+["%s%s"%m for m in zip(y["l"](y,n-1,w),y["r"](y,n-1,w))],"l":lambda y,n,w:["%s/%s"%(" "*i," "*j) for (i,j) in zip(xrange(w-1,-1,-1),xrange(w,w*2))] if n==0 else ["%s%s%s"%(" "*(len(t)//2),t," "*(len(t)//2)) for t in y["r"](y,n-1,w)]+["%s%s"%m for m in zip(y["t"](y,n-1,w),y["l"](y,n-1,w))],"r":lambda y,n,w:["%s\\%s"%(" "*i," "*j) for (j,i) in zip(xrange(w-1,-1,-1),xrange(w,w*2))] if n==0 else ["%s%s%s"%(" "*(len(t)//2),t," "*(len(t)//2)) for t in y["l"](y,n-1,w)]+ ["%s%s"%m for m in zip(y["r"](y,n-1,w),y["t"](y,n-1,w))]})) 
:hattip:

Cybernetic Vermin
Apr 18, 2005

thing is, it really does not matter, i really don't care. if the code breaks then it will usually become fairly clear from the break what the code *should* do, and if it isn't doing it and appears too incomprehensible then such tiny fractions of code are better to just rewrite to do the right thing

as long as some reasonable module-level abstractions are somewhat maintained any local ugliness is not worth caring about

i also wrote kx k3 for a living for a number of years, production code could look roughly like this: http://kx.com/a/k/examples/xml.k

distortion park
Apr 25, 2011


fritz posted:

in the future half the people who write lovely unreadable matlab programs will be writing lovely unreadable Julia programs instead

this would be a pretty significant improvement tbh

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

pointsofdata posted:

this would be a pretty significant improvement tbh

yeah i only wish julia had a better type system

strong static typing owns when exploratory programming

so much time saved

Workaday Wizard
Oct 23, 2009

by Pragmatica

Cybernetic Vermin posted:

i also wrote kx k3 for a living for a number of years, production code could look roughly like this: http://kx.com/a/k/examples/xml.k

holy poo poo

mumps has a cousin

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Shinku ABOOKEN posted:

holy poo poo

mumps has a cousin

measles? rubella?

MeruFM
Jul 27, 2010

Cybernetic Vermin posted:

thing is, it really does not matter, i really don't care. if the code breaks then it will usually become fairly clear from the break what the code *should* do, and if it isn't doing it and appears too incomprehensible then such tiny fractions of code are better to just rewrite to do the right thing

as long as some reasonable module-level abstractions are somewhat maintained any local ugliness is not worth caring about

i also wrote kx k3 for a living for a number of years, production code could look roughly like this: http://kx.com/a/k/examples/xml.k

to rewrite requires knowing what the original code even does

Cybernetic Vermin
Apr 18, 2005

knowledge that is better inferred from the module-level abstraction and the components overall role in the system than from trying to infer anything from the code, because in the local view of the code you have no means of differentiating between the intended functionality and the functionality that induces the problem anyway

1 kloc may be an overstatement, but huge and messy functions are really not problematic if you can somewhat describe what goes in and what is supposed to come back out

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Cybernetic Vermin posted:

1 kloc may be an overstatement, but huge and messy functions are really not problematic if you can somewhat describe what goes in and what is supposed to come back out

the cool part is how in bad code, your initial impression of what is "supposed" to happen does not match what actually has been happening for a very long time, so when you fix something that appears broken, it probably subtly broke something else that depended on the broken behavior

Sagebrush
Feb 26, 2012

i'm trying to learn ruby and it bugs the crap out of me that 0 evaluates to true.

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Sagebrush posted:

i'm trying to learn ruby and it bugs the crap out of me that 0 evaluates to true.

really? that seems wrong to me. is there a reason for it?

double sulk
Jul 2, 2010

prefect posted:

really? that seems wrong to me. is there a reason for it?

everything in ruby is an object.

Adbot
ADBOT LOVES YOU

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

prefect posted:

really? that seems wrong to me. is there a reason for it?

gucci void main posted:

everything in ruby is an object.

"why is the sky blue?" "because ants have six legs"

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply