Pandora Pandora Schemers


todd

Member
Joined
Sep 5, 2008
Messages
187
Creating new topic in order to avoid hijacking Java: Where To Next?.

Dutch_Cap said:
By SICP you must mean Structure and Interpretation of Computer Programs, which I hadn't heard of before. Would you recommend that?



Yes, that's what I meant by SICP. Recommend? I dunno.

It was (is?) used for introductory CS classes at MIT. Written by two of the past (present?) instructors of that course. You can also find ancient lecture videos online: they're quite amusing.

I found the book a little dry. It's teaching theory. I'm more accustomed to modern, peppy programming books. However, there's a copy at work which I brought home again today. Having a specific hardware target in mind might be more motivating. I'll probably start, though, with Sitaram's Teach Yourself Scheme in Fixnum Days. It's free. And it looks to be fairly direct. Then I'll probably take another skim through SICP and see if I find any topics of interest.

Speaking of which, do you have any specifically Scheme-oriented books to recommend?

I remember doing some Lisp in a languages class in college. I remember the "a-ha!" moment, long lost to me now. I always see glowing reports about the Lisp family of languages and how Ruby, for example, borrows HEAVILY from it. Some say that Scheme has a very concise grammar, which appeals to me: Ruby is shedding some of its more obscure Perl inheritance (e.g., frequent use of implied operators), but still has a lot of grammar to be mastered.

And Chicken compiling to C. Wow. Very cool. Have you tried out the SDL eggs?

--Todd
 
Last edited by a moderator:
todd said:
I'll probably start, though, with Sitaram's Teach Yourself Scheme in Fixnum Days. It's free. And it looks to be fairly direct.


That looks pretty nice, thanks.

todd said:
Speaking of which, do you have any specifically Scheme-oriented books to recommend?

Nope, I've been looking for one myself. I've been browsing The Scheme Programming Language, but that's pretty dry too.

todd said:
I remember doing some Lisp in a languages class in college. I remember the "a-ha!" moment, long lost to me now. I always see glowing reports about the Lisp family of languages and how Ruby, for example, borrows HEAVILY from it. Some say that Scheme has a very concise grammar, which appeals to me: Ruby is shedding some of its more obscure Perl inheritance (e.g., frequent use of implied operators), but still has a lot of grammar to be mastered.
For me the "a-ha" moment was about one-and-a-half years ago. The "a-ha!" was even bigger than it was for OOP or functional programming in Haskell or grasping Turing completeness. Supposedly all ALGOL-descended languages are slowly evolving into Lisp. :)

todd said:
And Chicken compiling to C. Wow. Very cool. Have you tried out the SDL eggs?
I have, but I'm having some trouble. I can create a window and detect keypresses just fine, but as far as I can tell SDL_GL_SwapBuffers() isn't implemented. So I haven't been able to make any OpenGL graphics appear (at least I think that's the reason).

On the topic of compilers, you may also want to check out Bigloo and Gambit. I've seen benchmarks that suggest they generate faster code.
 
Last edited by a moderator:
Thanks for the links; I'm keeping a list.

Dutch_Cap said:
todd said:
And Chicken compiling to C. Wow. Very cool. Have you tried out the SDL eggs?
I have, but I'm having some trouble. I can create a window and detect keypresses just fine, but as far as I can tell SDL_GL_SwapBuffers() isn't implemented. So I haven't been able to make any OpenGL graphics appear (at least I think that's the reason).


Wow. So it sounds like a first order of business is to get drawing squared away. I've not yet looked into this OpenGL ES business. My current project at work is supposed to get me into JOGL over the next few months, so I see a nice point of connection there.

I don't know so much about SDL, either. Do some SDL implementations allow one to plug in different graphics backends (e.g., OpenGL, OpenGL ES)?

Dutch_Cap said:
On the topic of compilers, you may also want to check out Bigloo and Gambit. I've seen benchmarks that suggest they generate faster code.



Ahh, an embarrassment of riches. Which compiler to target? I guess we need to look through and see what kinds of libraries each has to offer? All of them seem to value quick and easy interfacing with C code: that would bode well for SDL or OpenGL ES libraries. We could put together a facade to make life prettier.

There are too many interesting things in life! I need some time to study!

--Todd
 
Last edited by a moderator:
I've always been more a CLOS man rather than a strrict Scheme. Sorry :)

Theres a fair number of good Lisp and CLOS books; Scheme is a much stricter grammar (ie: easier to get, much easier to implement), but CLOS is a little like Java .. in that it comes with a huge huge pile of useful code already, so while Scheme is a great language, I find Common Lisp to be more useful 'right away'.

But as always, just use Emacs and Emacs-Lisp ;)

jeff
 
todd said:
Dutch_Cap said:
I can create a window and detect keypresses just fine, but as far as I can tell SDL_GL_SwapBuffers() isn't implemented. So I haven't been able to make any OpenGL graphics appear (at least I think that's the reason).
Wow. So it sounds like a first order of business is to get drawing squared away. I've not yet looked into this OpenGL ES business. My current project at work is supposed to get me into JOGL over the next few months, so I see a nice point of connection there.
With a little help from the chicken mailing list I got OpenGL drawing through SDL going, I drew my first triangle today! The author promised to add SDL_GL_DrawBuffers() to the SDL egg ASAP. In the mean time we can access it through C:
CODE
#>
#include <SDL/SDL.h>
<#

[...]

(foreign-code "SDL_GL_SwapBuffers();")



If you want to use the function a lot, you can create a foreign lambda:
CODE
(define sdl:gl-swap-buffers
(foreign-lambda void "SDL_GL_SwapBuffers"))


todd said:
I don't know so much about SDL, either. Do some SDL implementations allow one to plug in different graphics backends (e.g., OpenGL, OpenGL ES)?

I believe OpenGL ES support for SDL is in the works, but for now it requires some sort of workaround that is different between Windows and Linux etc. See this thread for more information.

Also, I think porting OpenGL bindings to OpenGL ES should be relatively easy. If I understand the differences between OpenGL 2.0 and OpenGL 2.0 ES correctly, it would mostly involve removing a bunch of things.

todd said:
Dutch_Cap said:
On the topic of compilers, you may also want to check out Bigloo and Gambit. I've seen benchmarks that suggest they generate faster code.



Ahh, an embarrassment of riches. Which compiler to target? I guess we need to look through and see what kinds of libraries each has to offer? All of them seem to value quick and easy interfacing with C code: that would bode well for SDL or OpenGL ES libraries. We could put together a facade to make life prettier.
I've chosen chicken because I like the eggs available for graphics, objects and macros and because the whole calling-with-continuation thing sounds funky, even if I don't really understand what it means. :)

I've always wanted to create a graphics/sound/input abstraction layer for Lisp. I'd like to call it Gasp: Graphics And Sound Processing. I'd start by building it on top of existing SDL and OpenGL bindings, though. Then perhaps I'd try to optimise some parts with C code. Interfacing with an existing C(++) graphics engine provides some interesting possibilities, though.
 
Last edited by a moderator:
Hooray for SDL/OpenGL! Once I work through t-y-scheme or something similar, I may ask to see that code as a good starting place!

Gasp sounds like a great project.

-----------------------------------------

So I don't intend this as a troll -- honest! But.... :D

Would you guys care to share your motivations/interests in Scheme/CLOS? Why and when would you choose it over other languages (e.g., C/C++, Java, Python). Why and when would you choose conversely?

I have my own ill-defined reasons. Growth as a programmer. Lisp's stature as a classical language that has retained its shine despite all the trendy languages that come and go, Lisp's claim to be relatively paradigm-independent. And a longstanding feeling of, "I should pursue that (again) someday." But I'm worried about the availability of supported modern libraries (I suppose easy use of C/C++ libraries should make this a minor issue) and the general appropriateness of Lisp for general application development.

Personally, I don't intend to develop much in the way of complex graphically-driven games. I tend to code (mostly small stuff) to scratch my own issues: file manipulation/transformation, workflow helpers, small graphics intended to convey specific pieces of information. One reasons the Pandora interests me is that it might provide a complete (I prefer minimal anyhow) development environment that I can carry in my pocket. Great for those random half-hours of waiting. Usable in much the same contexts where presently I read a book or review vocab on my aging PalmPilot.

So I would appreciate thoughts re: why and when you would choose Scheme/CLOS vs. C/C++/Java vs. Python/Ruby.

Is that a vague enough question? :p

Thanks,

--Todd
 
Hmmm... so no bites on my invitation to discourse on the relative merits of Scheme/CLOS vs. Python/Ruby vs. C/C++/Java? (How's that for expressing opinions just by the way I group things?!? :D )


Well, partially as a bump and partially because we were discussing resources: Last night I came across an article I printed off some months ago, the last time I thought about toying with Scheme. It's called Scheme for C programmers. I like it for its practical slant. I will need to supplement to get more of the theoretical underpinnings of scheme: it sounds like The Little Schemer might be a good starting place in that regard. Opinions?

--Todd
 
todd said:
Would you guys care to share your motivations/interests in Scheme/CLOS? Why and when would you choose it over other languages (e.g., C/C++, Java, Python). Why and when would you choose conversely?
(For the record: CLOS stands for "Common Lisp Object System", it's the standard for Object Oriented Programming in Common Lisp.)

For me the only reason not to choose Lisp is if other people have to be able to read my code. For some reason not a lot of programmers know Lisp. :(

Lisp provides most, if not all of the advantages of both interpreted and compiled languages. It's possible to change code and load it without having to completely restart your program. You can interactively run any Lisp expression while your program runs. And when you're done debugging (part of) your program, a good Lisp compiler can achieve speeds that are pretty close to C++ (if you write your code the right way).

But what I like most about Lisp are its metaprogramming abilities. Metaprogramming basically means writing software that writes software. Because Lisp code is represented as lists, it's easy to have programs that generate lists to make new code. So called Lisp Macros are a kind of function that runs before the program is compiled. A macro can generate any piece code decided by any kind of algorithm based on the arguments passed to it. It's like generic programming on steroids, with the complete power of the language behind it.
 
Last edited by a moderator:
I've encountered scheme once, in the first term of my CS degree (and later its more bizzare cousin prolog). Although we never touched on anything as fancy as code generation, I found it a very fun language to play around with. It's also reasonably simple to pick up, which is probably the reason why it was the first language they taught in my course.

EDIT: Is there going to be some way of using scheme or similar on Pandora? From whats been written in this topic, it sounds like it could be very useful.
 
fiveseven said:
EDIT: Is there going to be some way of using scheme or similar on Pandora? From whats been written in this topic, it sounds like it could be very useful.
Porting Lisp interpreters and Lisp-to-C compilers and such to the Pandora should be a matter of recompiling. Many already run on ARM-based platforms. But as far as I know there isn't a native compiler for the ARM platform, that is a compiler that generates native machine code for the ARM processor.

I don't think there are OpenGL ES bindings either.
 
Last edited by a moderator:
Dutch_Cap said:
fiveseven said:
EDIT: Is there going to be some way of using scheme or similar on Pandora? From whats been written in this topic, it sounds like it could be very useful.
Porting Lisp interpreters and Lisp-to-C compilers and such to the Pandora should be a matter of recompiling. Many already run on ARM-based platforms. But as far as I know there isn't a native compiler for the ARM platform, that is a compiler that generates native machine code for the ARM processor.

I don't think there are OpenGL ES bindings either.


As you say, it should be trivially easy to arrive at a build chain for Scheme -> C -> Pandora native binaries. gcc is well-established. I see the lack of a native Lisp->binary compiler for ARM as a non-issue. The other half of the attraction of the compilers that pass through C are their capacity to interface to existing C libraries. Such as one for OpenGL ES.

Personally, unless I end up writing device drivers or have some other compelling need for it, I intend to avoid C/C++ going forward. I used to be reasonably competent in C, never learned C++ well. They are powerful, effective languages, generally tons better than the assembly that went before them. But we can do better now for general applications programming. And the funny thing to me is that Lisp, old as it is, embodies lots of that "better" which is causing programmers to embrace currently-popular languages like Java, Ruby and Python. Languages that take some of the headache off the programmer and let the computer consume a few more cycles to deal with it instead. In most cases a reasonable trade-off.

So the question I'm asking myself now is, since I code Java at work, which alternate language would be fun to pursue for personal projects, most of which will be centered around my new toy. My top candidates at present are Scheme/Lisp and Python. I don't anticipate writing anything for which either one would be too slow (and, if truly desperate, I can write the real number-crunching pieces in C).

Thanks for your thoughtful reply to my plea for opinions. :) I've been toying with Scheme during odd moments of the past week, with some success and a fair bit of frustration. I'm still faintly suspicious that Scheme will turn out to be a "toy" language, a language of academicians, a handicap relative to the quick development speeds promised by Python. But I feel like Scheme/Lisp would be a much better discipline as I seek to develop as a programmer (and to build a better resume).

And what about all that parenthesis noise?!? :lol: I need to go find a good style guide to read!


--Todd
 
Last edited by a moderator:
If you want a language that's fun to play around with, have a go at prolog. I found it a little harder to pick up, but once you do, there's some really clever tricks you can do with it.
 
I had to take "Logical Programming" in university, a Prolog course. It was very educational to learn a completely different programming paradigm. I also really enjoyed learning functional programming in Haskell.
 
Back
Top