Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 20, 2024, 01:45:33 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 192 193 [194] 195 196 ... 279
Print
Author Topic: The happy programmer room  (Read 677824 times)
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3860 on: September 10, 2014, 08:42:57 AM »

Quote
It was mostly an excuse to get some Haskell practice in anyway. Using Parsec was a hell of a lot more enjoyable than my last parsing experience which involved magical C++ template meta-programming with Boost.Spirit.

Yeah, Boost.Spirit is pretty bad. Hand-written parsers 4 lyfe.
Logged

beakɍ
Level 0
*


(っ ºДº)っ ︵ ⌨ GAMEDEV IS LIFE


View Profile WWW
« Reply #3861 on: September 10, 2014, 05:40:05 PM »

On the topic of esolangs, I just finished an implementation of a programming language made up entirely of ASCII art of churros.

Hello world:
Code:
{o}==========} {==={*} {o}} {======{o} {o}=} {={o} {o}} {====={o} {o}=}
{======{o} {o}===} {={o} {o}=} {====={o} {o}==} {======{o} {o}=======} {={o}
{o}==} {====={o} {o}===} {======{o} {o}=========} {={o} {o}===} {====={o}
{o}====} {======{o} {o}==========} {={o} {o}====} {====={o} {*}=} {={o} {===={*}
{{o} {o}==} {======{o} {o}==} {={o} {========{o} {o}====} {======{o} {o}=} {={o}
{========{*} {o}=======} {={o} {========{*} {========{*} {o}===} {={o}
{========{*} {o}=} {======{o} {o}==} {={o} {========{o} {o}===} {======{o}
{*}===} {={o} {========{o} {========{*} {o}===} {={o} {========{*} {*}======}
{={o} {========{*} {*}========} {={o} {========{*} {o}=} {======{o} {o}===}
{={o} {========{o} {o}} {======{o} {========{*}

I was working with a lot of Brazilian programmers over the summer, and I can't count how many times they brought up churros... I couldn't help it. Cheesy

It was mostly an excuse to get some Haskell practice in anyway. Using Parsec was a hell of a lot more enjoyable than my last parsing experience which involved magical C++ template meta-programming with Boost.Spirit.

Dang, I need to try writing some Haskell. Good for writing compiler-related stuff. Way better than C/C++ for specific, mostly really technical stuff if you understand it well.
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #3862 on: September 10, 2014, 08:16:43 PM »

Can you give some concrete examples where that might be true? Almost all the haskell related stuff I've seen has been either easy enough to achieve in any other language or a specific "code toy" to try to make more use of functional features. Got to admit I have a hard time breaking out of a procedural mindset though Smiley
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #3863 on: September 10, 2014, 08:37:47 PM »

Haven't written Haskell for yonks, but I remember it was great for implementing toy languages . The AST, for example, writes itself (from some googling):

Code:
data Expr
  = Float Double
  | BinOp Op Expr Expr
  | Var String
  | Call Name [Expr]
  | Function Name [Expr] Expr
  | Extern Name [Expr]
  deriving (Eq, Ord, Show)

Sure you can do something equivalent in C++, but it wouldn't be as terse or readable.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3864 on: September 10, 2014, 10:04:43 PM »

I've been trying to find justification to learn a functional language like haskell but it's been tough doing anything more than the most basic introductory stuff. It's hard to transition to the point where using a functional language is more efficient than the way I know already.

The most useful example i've heard so far was from a analysis developer who transitioned from c# to f#. He was talking about how transforming data is so much easier in a functional language because it doesn't require defining new structures or classes for each transformation. That seems really useful in some cases.
Logged

TheLastBanana
Level 9
****



View Profile WWW
« Reply #3865 on: September 11, 2014, 12:35:12 PM »

@Geti: Gentleman

Learning about Haskell has been a lot of fun. It's a very slick, terse language, and it's absolutely lovely for data transformations and toy languages.

But yeah, thinking functionally can be tricky. Passing around state can especially get a little painful. I'm nowhere near ready to do anything beyond simple stuff with Haskell, but it's good to have it in the toolbox at least.
Logged
Zack Bell
Level 10
*****



View Profile WWW
« Reply #3866 on: September 11, 2014, 11:00:01 PM »

SUPER III now has all kinds of moving platforms, both solid and jumpthrough. It has opened up many design/challenge opportunities.

Just sharing my happiness!

« Last Edit: September 12, 2014, 10:01:27 AM by Zack Bell » Logged

OnslaughtMike
Level 0
**


View Profile WWW
« Reply #3867 on: September 12, 2014, 06:10:02 AM »

Finally was able to conquer the task of creating a RESTful WCF web service and consuming it using get and post in Unity3d. This is a task that I've come face to face with before and lost.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3868 on: September 12, 2014, 10:04:41 AM »

SUPER III now has all kinds of moving platforms, both solid and jumpthrough. It has opened up many design/challenge opportunities.

Just sharing my happiness!



awesome! It's looking better every day :D

@Geti: Gentleman

Learning about Haskell has been a lot of fun. It's a very slick, terse language, and it's absolutely lovely for data transformations and toy languages.

But yeah, thinking functionally can be tricky. Passing around state can especially get a little painful. I'm nowhere near ready to do anything beyond simple stuff with Haskell, but it's good to have it in the toolbox at least.

Passing around state? Is that sort of how haskell handles mutability? Make a copy of the modified object and pass it around for each mod?

I've always heard the dreaded term monads invoked whenever mutability in haskell is discussed.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3869 on: September 12, 2014, 10:07:27 AM »

just discovered stblib :D
Logged

standardcombo
Level 8
***


><)))°>


View Profile
« Reply #3870 on: September 12, 2014, 01:44:10 PM »

It turns out there's no fall-through in C# switch cases. However, you can do a goto <label>; How about that?

Makes me want to write a program in the old Basic ways, just for kicks.

switch (lineNumber) {
case 0: // main
if (?) goto 1;
goto 2;

case 1:
goto 0;

case 2:
goto 0;
}

Fun debug times.....
Logged

jgrams
Level 3
***



View Profile
« Reply #3871 on: September 12, 2014, 03:47:18 PM »

Passing around state? Is that sort of how haskell handles mutability? Make a copy of the modified object and pass it around for each mod?

I've always heard the dreaded term monads invoked whenever mutability in haskell is discussed.

Yeah, pretty much. From an efficiency standpoint it's not bad; you set things up so you're mostly copying references or containers (the structure of the data). But it's both the blessing and the curse of pure functional languages that a lot of things (like I/O and state changes) have to be built into the structure of your code rather than just being function calls stuck in wherever you want.

I think Philip Wadler says it best: "Pure functional languages have this advantage: all flow of data is made explicit. And this disadvantage: sometimes it is painfully explicit."

Monads are basically just a little design pattern: a way to structure your code to hide a part of the boilerplate of passing state around. You might try Philip Wadler's Monads for Functional Programming (the first couple pages of this are well worth reading even if you stop as soon as you get to the code) or Dan Piponi's You Could Have Invented Monads! (And Maybe You Already Have.).

But yeah, as TheLastBanana says, sometimes passing state around is still a pain. I think there are ways to deal with most of it (like lenses for dealing with nested mutable data structures, or the technique of returning/collecting commands/changesets and then applying them to your state all at once), but I don't feel like anyone really gives a good introduction to how you learn to structure practical applications, so it's hard to get into. There's a lot of jargon, which is useful to the people trying to work out the theory of how to make this stuff practical, but a big barrier to beginners.
Logged
Sik
Level 10
*****


View Profile WWW
« Reply #3872 on: September 12, 2014, 11:28:08 PM »

It turns out there's no fall-through in C# switch cases. However, you can do a goto <label>; How about that?

Wait what, C# has goto? O_O You'd think it'd be gone from all modern languages by now (granted, I have actually found some rather good uses for it when dealing with tons of error handling, but it's so demonized I'm surprised it's still around).
Logged
powly
Level 4
****



View Profile WWW
« Reply #3873 on: September 13, 2014, 03:55:35 AM »

only toy languages for kids omit goto
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3874 on: September 13, 2014, 10:15:35 AM »

Passing around state? Is that sort of how haskell handles mutability? Make a copy of the modified object and pass it around for each mod?

I've always heard the dreaded term monads invoked whenever mutability in haskell is discussed.

Yeah, pretty much. From an efficiency standpoint it's not bad; you set things up so you're mostly copying references or containers (the structure of the data). But it's both the blessing and the curse of pure functional languages that a lot of things (like I/O and state changes) have to be built into the structure of your code rather than just being function calls stuck in wherever you want.

I think Philip Wadler says it best: "Pure functional languages have this advantage: all flow of data is made explicit. And this disadvantage: sometimes it is painfully explicit."

Monads are basically just a little design pattern: a way to structure your code to hide a part of the boilerplate of passing state around. You might try Philip Wadler's Monads for Functional Programming (the first couple pages of this are well worth reading even if you stop as soon as you get to the code) or Dan Piponi's You Could Have Invented Monads! (And Maybe You Already Have.).

But yeah, as TheLastBanana says, sometimes passing state around is still a pain. I think there are ways to deal with most of it (like lenses for dealing with nested mutable data structures, or the technique of returning/collecting commands/changesets and then applying them to your state all at once), but I don't feel like anyone really gives a good introduction to how you learn to structure practical applications, so it's hard to get into. There's a lot of jargon, which is useful to the people trying to work out the theory of how to make this stuff practical, but a big barrier to beginners.

Ah thanks for that. I didn't realize reference passing was an option. I'll take a look at those articles.
Logged

standardcombo
Level 8
***


><)))°>


View Profile
« Reply #3875 on: September 13, 2014, 11:53:40 AM »

only toy languages for kids omit goto

So Java is a toy language?
Logged

jgrams
Level 3
***



View Profile
« Reply #3876 on: September 13, 2014, 12:10:37 PM »

Ah thanks for that. I didn't realize reference passing was an option. I'll take a look at those articles.

Oops. I didn't mean to imply that reference passing was a thing. It's just that since everything is immutable there would be no difference (semantically) between passing the value and passing a reference, so the compiler has no reason to pass by value except for types which would make sense to pass in CPU registers or whatever. Or at least that's my understanding. I admit I haven't done anything significant in Haskell.


only toy languages for kids omit goto

So Java is a toy language?

Nah, Java is a B&D language which thinks it knows better than you. Tongue


And to keep this on topic, I'm a happy programmer because I finally got around to trying d3.js, and it's a pretty fun way to make little (or not so little) data visualizations. Smiley
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #3877 on: September 27, 2014, 03:48:12 PM »

I'm currently writing an interpreter for a custom Lisp dialect for scripting my game, which of course involves writing functions in the native code to be exposed to the script.

Being able to duplicate recursive functions like list using C++ templates is quite cool, and getting functions like display and write to properly show lists felt great.

Of course, I haven't started on the parsing, which is probably going to be the hardest part, and come to think of it implementing procedures is going to be a big hurdle... Lips Sealed
« Last Edit: September 27, 2014, 03:54:29 PM by Boreal » Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3878 on: September 27, 2014, 05:04:30 PM »

Most of the pre-amble for a fighting game I'm working on is done (virtual input, rendering, state system etc) and the game logic has been going almost TOO smooth.

I resisted the urge to overengineer my solution since this is a fighting game study more than a game and I think it paid off. My code isn't that pretty right now but making massive changes isn't painful at all.

Also glad I setup the gui and console right away, the debugging information I've been able to send to the screen has been very valuable.
Logged

nikki
Level 10
*****


View Profile
« Reply #3879 on: September 28, 2014, 01:50:02 AM »

Quote
Of course, I haven't started on the parsing, which is probably going to be the hardest part,

I've never build a lisp parser myself, but I have read many times that lispparsers are the among the easiest parsers to write (no types, only lists for containers, postfix notation, etc)

here's one: https://www.hackerschool.com/blog/21-little-lisp-interpreter
and here : http://howtowriteaprogram.blogspot.nl/2010/11/lisp-interpreter-in-90-lines-of-c.html
Logged
Pages: 1 ... 192 193 [194] 195 196 ... 279
Print
Jump to:  

Theme orange-lt created by panic