Live data from Hacker News

A Haskell Programmer Tries to Learn Racket

artyom.me

21–30 of 163 posts

Re: A Haskell Programmer Tries to Learn Racket

#21
post #10

One note: > Racket's default IDE is better than GHCi and probably on par with Emacs (you almost certainly can configure Emacs to be better than anything, but it's not trivial and people don't bother, while DrRacket provides autocompletion and documentation out of the box). Last I used it (a few years ago), DrRacket was very laggy, so I would find it very hard to use for a serious project. YMMV, maybe it's improved.

Yeah DrRacket is fairly slow unless you have a powerful computer. I recommend just using a text editor and making use of XREPL, see: http://docs.racket-lang.org/xrepl/index.html?q=

tl;dr, open up the normal repl by typing "racket" and then type (require xrepl) and then ,install! (leading comma denotes an xrepl command).

Then when you want to interact with a file you can do racket -i $file to interact with it using xrepl.

If you're wondering why this isn't just the default, I think it has to do with the readline license.

Re: A Haskell Programmer Tries to Learn Racket

#22
As others have said, this does justice to the idea of actually learning a new language...or perhaps because it is Racket a new family or ecosystem of languages. Anyway, if you're still curious about pairs verus lists and why anyone would use dotted pairs, I like to think about it as where Lisps show that they are from the age when running close to the metal was a given.

And it all goes back to car and cdr and the fact that they are (or rather were) embedded assembly language and there to give raw access to Lisp's linked memory model (as opposed to the sequential memory model of Fortran). A dotted pair has two efficiency advantages over a proper list and both stem from the fact that the last cell of the last pair of a proper list contains 'nil (or 'null in Racket).

Storing two values in a proper list requires two cons cells - the first with the first value and a pointer to the second cons cell and a second cons cell containing the second value and a null pointer. In contrast, a dotted pair holds two values in a single cons cell - halving the memory requirement.

The second advantage is that when there are only two values there's no need to walk the list and test for 'null (or 'nil) on the cdr. This saves an instruction step.

Philosophically, dotted pairs allow for car and cdr to be used symmetrically. Calling cdr on a dotted pair returns the second value directly just as calling car on any list returns the first value directly. Lastly, one of the things that is awesome about Lisp is the way in which lists can model data structures, and in the case of a dotted pairs their efficiencies are available to all those structures which consist of or rely on paired values.

Of course, this may be obvious and on a machine with 10+ GB of RAM not really applicable, but I find it fun to think about anyway.

Re: A Haskell Programmer Tries to Learn Racket

#24
post #21
post #10

One note: > Racket's default IDE is better than GHCi and probably on par with Emacs (you almost certainly can configure Emacs to be better than anything, but it's not trivial and people don't bother, while DrRacket provides autocompletion and documentation out of the box). Last I used it (a few years ago), DrRacket was very laggy, so I would find it very hard to use for a serious project. YMMV, maybe it's improved.

Yeah DrRacket is fairly slow unless you have a powerful computer. I recommend just using a text editor and making use of XREPL, see: http://docs.racket-lang.org/xrepl/index.html?q= tl;dr, open up the normal repl by typing "racket" and then type (require xrepl) and then ,install! (leading comma denotes an xrepl command). Then when you want to interact with a file you can do racket -i $file to interact with it using xr…

     racket -il xrepl
Will launch Racket with already xrepl loaded.

Re: A Haskell Programmer Tries to Learn Racket

#25
post #10

One note: > Racket's default IDE is better than GHCi and probably on par with Emacs (you almost certainly can configure Emacs to be better than anything, but it's not trivial and people don't bother, while DrRacket provides autocompletion and documentation out of the box). Last I used it (a few years ago), DrRacket was very laggy, so I would find it very hard to use for a serious project. YMMV, maybe it's improved.

I find DrRacket sufficiently fast and sufficiently frustrating.

It's very useful for interactive debugging but dependent on the mouse and many Emacs key combinations simply cannot be mapped because of it's CUA interface...and so far as I can tell there is no key-combination that switches focus between the REPL pane and the Editor pane short of closing the other pane.

The syntax analysis gets to be a bit much too.

On the other hand, that's just the price of an IDE over a text editor, and for a batteries included IDE, it's pretty good even if I wish that the effort would have been put into Emacs support while knowing that doing so would not meet the needs of the PLT group's target audience of students.

Re: A Haskell Programmer Tries to Learn Racket

#26
post #3

"...but nothing beyond that. As long as Node.js exists in this world, I can't truly hate anything else." I found this hilarious. I am also rather underwhelmed (to be nice) with Nodejs and a little bothered at its wide adoption. I have also been learning racket recently; my formal language and functional programming class uses it. I had some previous experience with common lisp but the raw nature of scheme still pleas…

I also hate NodeJS for its package manager, NPM. I don't understand the way it manages dependencies and their folder. What the hell is 'node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/'.

As a result, when updating dependencies with npm, a same dependency is downloaded multiple times.

Re: A Haskell Programmer Tries to Learn Racket

#27
post #10

One note: > Racket's default IDE is better than GHCi and probably on par with Emacs (you almost certainly can configure Emacs to be better than anything, but it's not trivial and people don't bother, while DrRacket provides autocompletion and documentation out of the box). Last I used it (a few years ago), DrRacket was very laggy, so I would find it very hard to use for a serious project. YMMV, maybe it's improved.

I find DrRacket sufficiently fast and sufficiently frustrating. It's very useful for interactive debugging but dependent on the mouse and many Emacs key combinations simply cannot be mapped because of it's CUA interface...and so far as I can tell there is no key-combination that switches focus between the REPL pane and the Editor pane short of closing the other pane. The syntax analysis gets to be a bit much too. On…

by default ctrl+f6 will switch focus. You can remap that to something more convenient though (it's called shift-focus).

Re: A Haskell Programmer Tries to Learn Racket

#28
post #19

Earlier quoted context omitted.

I keep flipping back and forth, thinking I don't get it, then thinking others don't get it. Single-threaded JS with callbacks. OK? What am I missing? The only thing Node has going for it is a lot of networking libraries. It's not fast, the async style leads to callback hell, JS is a terrible language, and their package management system is slow and bloated (or at least the packages are)[1]. Yet people think it's some…

V8 vs Racket: http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...

Yeah, but I've basically never seen anybody suggest that Racket is a great language for prod.

Re: A Haskell Programmer Tries to Learn Racket

#29
post #20
post #17

Earlier quoted context omitted.

My theories: 1. Using the same programming language on both sides of HTTP often appeals to a developers visceral sense of elegance, or tidiness, even though it this alone inherently solves no existing problems. 2. It's powered by Googles V8 engine, which means people already associate it with this "super fast JIT" thing that lives in their favourite browser. It must be efficient, right? 3. The crowned alternative is…

1. There is a concrete advantage of shared code.

How does one share server HTTP-serving code and client DOM-manipulating code?

Re: A Haskell Programmer Tries to Learn Racket

#30
post #3

"...but nothing beyond that. As long as Node.js exists in this world, I can't truly hate anything else." I found this hilarious. I am also rather underwhelmed (to be nice) with Nodejs and a little bothered at its wide adoption. I have also been learning racket recently; my formal language and functional programming class uses it. I had some previous experience with common lisp but the raw nature of scheme still pleas…

I also hate NodeJS for its package manager, NPM. I don't understand the way it manages dependencies and their folder. What the hell is 'node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/readable-stream/node_modules/debuglog/'. As a result, when updating dependencies with npm, a same dependency is downloaded multiple times.

That is a good thing when multiple libraries you depend on depend on different versions of some other library.

See http://blog.izs.me/post/1675072029/10-cool-things-you-probab...

Post reply on HN