Lisp links thread

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
Post Reply
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Post by teamonkey »

This post popped up in my reddit feed this morning. It's nothing particularly new, just echoes some of my feelings why CL never really clicked for me and why I'm getting on so much better with Scheme.
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Re: Lisp links thread

Post by teamonkey »

Brace yourself nebogeo, you've been reddited. :)
User avatar
nebogeo
Baa!
Baa!
Posts: 75
Joined: Wed Mar 31, 2004 10:11 pm 0
Contact:

Re: Lisp links thread

Post by nebogeo »

Ah, thankyou - I didn't notice that :) Must be connected to the fact I just released a new version.

I've made some progress on using frtime with fluxus, and I've begun a simple little shoot em up - but I haven't done enough to really understand it deeply yet. I'll post some screenshots when I have them.
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Re: Lisp links thread

Post by teamonkey »

Cool. I really should have a go at compiling it for Windows at some point.
User avatar
nebogeo
Baa!
Baa!
Posts: 75
Joined: Wed Mar 31, 2004 10:11 pm 0
Contact:

Re: Lisp links thread

Post by nebogeo »

Well, I've made some progress, you can move around, fire bullets and waves of enemy come toward you - the code is here:
http://www.pawfal.org/flotsam/frisbee/rocket.scm
and it looks like this:
Image
Not very impressive, but it's not really the point atm.

I'm pestering Gregory Cooper who wrote FrTime a lot on the plt list, and it's slowly dawning on me how it works. It's very different from the imperative style - but it feels very neat and encapsulated, for example the code to describe the player's position on screen is an integral of a behaviour derived from the keyboard:

Code: Select all

(define player-pos 
  (vector (integral (hold (map-e
                           (lambda (key)                
                             (case key
                               ((#\a) -0.01)
                               ((#\d) 0.01)))
                           keyboard) 0))
          (- (integral (hold (map-e
                              (lambda (key)                
                                (case key
                                  ((#\s) -0.01)
                                  ((#\w) 0.01)))
                              keyboard) 0)) 5)
          0))
Strange but addictive.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Lisp links thread

Post by adam »

paul graham has finally released arc, his new lisp, he says it's designed for exploratory programming:
http://arclanguage.org/
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Re: Lisp links thread

Post by teamonkey »

So Naughty Dog have traditionally been a bit of a poster-child for "real-world things that have been done with Lisp" but them using GOAL to script games several years ago (and then stopping) is getting a bit tired.

But they've only gone and done it again on the PS3! :D
Apparently, they were missing GOAL too much :) Dan's presentation was
on how they used Scheme to write a significant part of their latest
game, called "Uncharted: Drake's Fortune". It's a very high profile
and high quality game that is attracting lots of attention right now
and that was very well received by critics.

They have used they own implementation of Scheme to build the game.
The Scheme code had multiple uses including:
- Generate the C++ used to describe their data structures
- Populate data tables at compile-time
- Ensure validity of data (the code generating it could interact with
their tools at compile-time)
- Write their in-game scripts that would be compiled down to bytecode
to be interpreted at run-time

In addition to programmers, designers and artists were also using
Scheme to create the game. Their presentation slides should be
available soon and will provide a bit more details.
Can't wait to see the slides.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Lisp links thread

Post by adam »

cool... seems a shame that sony bought them for their codebase then basically scrapped the lot, glad they've had the chance to write it the way they wanted to
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re:

Post by adam »

Lisp in a single python expression (didn't copy the url but here's the code)

Code: Select all

#lisp.py
#
#An interpreter for a simple scheme like lexically 
#scoped language implemented as single python expression.
#
#The interpreter is limited to the lambda special form and a
#sum function. The data types supported are positive integers
#and symbols.
#

import re
from itertools import *
iterpreter = (lambda s: (
    (lambda g: lambda env, exp: g(g)(env, exp))
    (lambda g: (lambda interpret:(
        lambda env, exp:{
            list:lambda exp:(
                (exp[:1]==["lambda"]) and 
                    (lambda env: lambda params: 
                        (lambda nenv: [interpret(nenv, e) 
                                for e in exp[2:]][-1])
                            (lambda x: dict(zip(exp[1], params)).get(x, False) 
                                or env(x)))(env) 
                or (lambda pexp: pexp[0](pexp[1:]))([interpret(env, e) 
                    for e in exp])),
            str:lambda exp: env(exp), int:lambda exp: exp
        }[type(exp)](exp)))(lambda env, exp:g(g)(env, exp))))
        (lambda x:{"sum":(lambda params: sum(params))}.get(x, False), 
        reduce(lambda env, v:
            (v==")" and
                (lambda:((lambda i:env[:i]+[env[i+1:]])
                    (len(env)-env[::-1].index("(")-1)))
            or (lambda:env+[v]))(),
                [(i==2 and int(e[i]) or e[i]) for e, i in 
                    [(e,sum([c*(i is not "") for i, c in zip(e, count())])) 
                        for e in re.findall(r"(\()|(\))|(\d+)|(\w+)",s)]], 
                        [])[0]))

s = "((lambda (a b) (sum a (b))) 1 (lambda () 8))"
v = iterpreter(s)
print v
User avatar
Acronym
Baaaaaa!
Baaaaaa!
Posts: 3982
Joined: Wed Feb 19, 2003 8:18 pm 0
Yahoo Messenger: andrew_walkingshaw
Contact:

Re: Lisp links thread

Post by Acronym »

One of my colleagues is responsible for this crime:

http://www.pick.ucam.org/~ptc24/yvfc.html
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Re: Lisp links thread

Post by teamonkey »

Here are the slides from Naughty Dog's GDC'08 presentation: http://www.naughtydog.com/corporate/pre ... lation.pdf
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Re: Lisp links thread

Post by teamonkey »

This appeared in my reddit feed today: http://erleuchtet.org/2008/03/project-o ... storm.html
perfectstorm is a real time strategy game study written in common lisp using OpenGL for graphics display and cairo for texture generation.
...
Since then, the game has grown and, with the developer count rapidly soaring up to two, includes the following features:

* User-definable units and weapons that can be plugged together
* Object-oriented very open design
* Some 20 different textures, with the possibility to add more very easily
* Fragment shaders for nice glows and flickering laser beams
* Pathfinding
* In-game developer console (aka REPL)

Future Plans

In the near future, i’d like to see the following things:

* Steering behaviours for units (currently work in progress)
* A first easily replaceable resource scheme
* Buildings
* More verbose GUI
* Dummy ai for first playtesting
Image

Seems to be Linux only and available by SVN. Looks cool though!
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Lisp links thread

Post by adam »

yeah that looks nice
User avatar
koogy
Baaa!
Baaa!
Posts: 475
Joined: Thu Aug 31, 2006 11:16 am 0

Re: Lisp links thread

Post by koogy »

re: the thing i mentioned on page 6 that reminded me of Al-Jazira, i think i have found it:

http://archive.salon.com/april97/21st/i ... 70403.html

For sheer delight, though, it's impossible to beat Japanese artist Toshio Iwai's "SimTunes," in which animated "Bugz" crawl across screens you paint and make enticing rhythms and melodies as their tracks cross the color zones you lay out. It's a deceptively simple interface for a surprisingly complex syncopation tool that addictively links visual play with musical creation; you can play it free-form or use a variety of pre-supplied patterns. Part "PacMan," part light organ and part synthesizer, "SimTunes" is a pure-fun machine.

description and box picture look spot on, although none of the in-game pictures i've found look anything like i remember.

circa 1997. bloke went on to elektroplankton. i prefer the old, funny stuff... 8)
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Lisp links thread

Post by adam »

thanks koogy, that sounds cool...

just came across this joke generator written in CL

http://grok-code.com/12/how-to-write-or ... t-for-you/
Post Reply